[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50060] branches/pyapi_devel_26/source/ blender: * Fix draw function not being set correctly due to wrong have_function check

Nathan Letwory nathan at letworyinteractive.com
Mon Aug 20 22:48:20 CEST 2012


Revision: 50060
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50060
Author:   jesterking
Date:     2012-08-20 20:48:19 +0000 (Mon, 20 Aug 2012)
Log Message:
-----------
* Fix draw function not being set correctly due to wrong have_function check
* Initialize and draw panels. Note that this is current hackish, as now both
  panels and view content can be drawn.

Modified Paths:
--------------
    branches/pyapi_devel_26/source/blender/editors/space_script/space_script.c
    branches/pyapi_devel_26/source/blender/makesrna/intern/rna_space.c

Modified: branches/pyapi_devel_26/source/blender/editors/space_script/space_script.c
===================================================================
--- branches/pyapi_devel_26/source/blender/editors/space_script/space_script.c	2012-08-20 20:13:37 UTC (rev 50059)
+++ branches/pyapi_devel_26/source/blender/editors/space_script/space_script.c	2012-08-20 20:48:19 UTC (rev 50060)
@@ -133,6 +133,8 @@
 	wmKeyMap *keymap;
 	
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+
+	ED_region_panels_init(wm, ar);
 	
 	/* own keymap */
 	keymap = WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
@@ -150,6 +152,12 @@
 	glClear(GL_COLOR_BUFFER_BIT);
 	
 	UI_view2d_view_ortho(v2d);
+
+	/* figure out how to setup region for panels,
+	 * and how for other drawing. Better not to
+	 * allow both to not have clashing drawings.
+	 */
+	ED_region_panels(C, ar, 1, NULL, -1);
 		
 	/* data... */
 	// BPY_script_exec(C, "/root/blender-svn/blender25/test.py", NULL);
@@ -158,9 +166,11 @@
 	if (sscript->idname[0] || 1) {
 		SpaceTypeDynamic *std = WM_spacetypedynamic_find("TEST", FALSE); /* sscript->idname */
 		if (std) {
-			SpaceDynamic sd = {0}; /* PYSPACE_TODO, make persistant? - Campbell */
-			sd.type = std;
-			std->draw(C, ar, sscript, &sd);
+			if(std->draw) {
+				SpaceDynamic sd = {0}; /* PYSPACE_TODO, make persistant? - Campbell */
+				sd.type = std;
+				std->draw(C, ar, sscript, &sd);
+			}
 		}
 		// BPY_run_script_space_draw(C, sscript);
 	}

Modified: branches/pyapi_devel_26/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/pyapi_devel_26/source/blender/makesrna/intern/rna_space.c	2012-08-20 20:13:37 UTC (rev 50059)
+++ branches/pyapi_devel_26/source/blender/makesrna/intern/rna_space.c	2012-08-20 20:48:19 UTC (rev 50060)
@@ -75,6 +75,7 @@
 	{SPACE_CONSOLE, "CONSOLE", 0, "Python Console", ""},
 	{SPACE_USERPREF, "USER_PREFERENCES", 0, "User Preferences", ""},
 	{SPACE_CLIP, "CLIP_EDITOR", 0, "Clip Editor", ""},
+	{SPACE_SCRIPT, "TEST", 0, "Test", ""},
     /* PYSPACE_TODO - make dynamic enum */
 	{0, NULL, 0, NULL, NULL}
 };
@@ -252,7 +253,7 @@
 	RNA_def_struct_flag(std->ext.srna, STRUCT_NO_IDPROPERTIES);
 
 	//std->poll = (have_function[0]) ? space_poll : NULL;
-	std->draw = (have_function[1]) ? space_draw : NULL;
+	std->draw = (have_function[0]) ? space_draw : NULL;
 
 	WM_spacetypedynamic_add(std);
 
@@ -1274,7 +1275,7 @@
 	/* draw */
 	func = RNA_def_function(srna, "draw", NULL);
 	RNA_def_function_ui_description(func, "Draw function for the operator");
-	//RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+	//RNA_def_function_flag(func, FUNC_REGISTER);
 	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
 	parm = RNA_def_pointer(func, "region", "Region", "", "");




More information about the Bf-blender-cvs mailing list