[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33527] trunk/blender/source/blender/ python: minor internal python api change - pass the context rather then getting from BPy_GetContext () again.

Campbell Barton ideasman42 at gmail.com
Tue Dec 7 07:47:55 CET 2010


Revision: 33527
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33527
Author:   campbellbarton
Date:     2010-12-07 07:47:40 +0100 (Tue, 07 Dec 2010)

Log Message:
-----------
minor internal python api change - pass the context rather then getting from BPy_GetContext() again.

Modified Paths:
--------------
    trunk/blender/source/blender/python/BPY_extern.h
    trunk/blender/source/blender/python/intern/bpy_interface.c
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/source/blender/python/BPY_extern.h
===================================================================
--- trunk/blender/source/blender/python/BPY_extern.h	2010-12-07 05:39:14 UTC (rev 33526)
+++ trunk/blender/source/blender/python/BPY_extern.h	2010-12-07 06:47:40 UTC (rev 33527)
@@ -100,7 +100,7 @@
 	int BPY_run_python_script( struct bContext *C, const char *filename, struct Text *text, struct ReportList *reports ); // 2.5 working
 	int BPY_run_script_space_draw(const struct bContext *C, struct SpaceScript * sc); // 2.5 working
 //	int BPY_run_script_space_listener(struct bContext *C, struct SpaceScript * sc, struct ARegion *ar, struct wmNotifier *wmn); // 2.5 working
-	void BPY_update_modules( void ); // XXX - annoying, need this for pointers that get out of date
+	void BPY_update_modules(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
 //
 	int BPY_context_get(struct bContext *C, const char *member, struct bContextDataResult *result);
 //

Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c	2010-12-07 05:39:14 UTC (rev 33526)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c	2010-12-07 06:47:40 UTC (rev 33527)
@@ -88,7 +88,7 @@
 			fprintf(stderr, "ERROR: Python context called with a NULL Context. this should not happen!\n");
 		}
 
-		BPY_update_modules(); /* can give really bad results if this isnt here */
+		BPY_update_modules(C); /* can give really bad results if this isnt here */
 
 #ifdef TIME_PY_RUN
 		if(bpy_timer_count==0) {
@@ -136,7 +136,7 @@
 	}
 }
 
-void BPY_update_modules( void )
+void BPY_update_modules(bContext *C)
 {
 #if 0 // slow, this runs all the time poll, draw etc 100's of time a sec.
 	PyObject *mod= PyImport_ImportModuleLevel("bpy", NULL, NULL, NULL, 0);
@@ -146,7 +146,7 @@
 
 	/* refreshes the main struct */
 	BPY_update_rna_module();
-	bpy_context_module->ptr.data= (void *)BPy_GetContext();
+	bpy_context_module->ptr.data= (void *)C;
 }
 
 /* must be called before Py_Initialize */

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2010-12-07 05:39:14 UTC (rev 33526)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2010-12-07 06:47:40 UTC (rev 33527)
@@ -5122,7 +5122,7 @@
 	return 0;
 }
 
-extern void BPY_update_modules( void ); //XXX temp solution
+extern void BPY_update_modules(bContext *C); //XXX temp solution
 
 /* TODO - multiple return values like with rna functions */
 static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)





More information about the Bf-blender-cvs mailing list