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.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user