diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-02-28 16:27:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-02-28 16:27:45 +0300 |
commit | bab4cd69913eee9aa30d61db7dc46e21655e4bde (patch) | |
tree | ebf28a1372c0db195928a1724b05f56d5c62d35e /source/blender/editors/space_script/space_script.c | |
parent | 0f8969640ccb5e7f615c85576e569ba23dd62c6f (diff) |
Python experimental UI API
Can draw panels in the scripts space containing RNA and operator buttons.
* Added bpyui.register() so scripts can draw buttons and panels into the scripts space type.
* wrapped drawBlock, drawPanels and matchPanelsView2d
* Operator buttons take a python dictionary used to set the button defaults.
* BPY_getFileAndNum utility function to get the filename and line number python is currently running.
Diffstat (limited to 'source/blender/editors/space_script/space_script.c')
-rw-r--r-- | source/blender/editors/space_script/space_script.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 52ef016497d..8fedcd8761f 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -60,6 +60,10 @@ #include "script_intern.h" // own include + +//static script_run_python(char *funcname, ) + + /* ******************** default callbacks for script space ***************** */ static SpaceLink *script_new(const bContext *C) @@ -139,7 +143,7 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar) static void script_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - // SpaceScript *sscript= (SpaceScript*)CTX_wm_space_data(C); + SpaceScript *sscript= (SpaceScript*)CTX_wm_space_data(C); View2D *v2d= &ar->v2d; float col[3]; @@ -151,7 +155,12 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(C, v2d); /* data... */ + // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py"); + if (sscript->script) { + //BPY_run_python_script_space(scpt->script.filename); + BPY_run_script_space_draw(C, sscript); + } /* reset view matrix */ UI_view2d_view_restore(C); @@ -190,6 +199,8 @@ static void script_header_area_draw(const bContext *C, ARegion *ar) static void script_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ + // XXX - Todo, need the ScriptSpace accessible to get the python script to run. + // BPY_run_script_space_listener() } /* only called once, from space/spacetypes.c */ @@ -213,7 +224,7 @@ void ED_spacetype_script(void) art->init= script_main_area_init; art->draw= script_main_area_draw; art->listener= script_main_area_listener; - art->keymapflag= ED_KEYMAP_VIEW2D; + art->keymapflag= ED_KEYMAP_VIEW2D| ED_KEYMAP_UI|ED_KEYMAP_FRAMES; // XXX need to further test this ED_KEYMAP_UI is needed for button interaction BLI_addhead(&st->regiontypes, art); |