[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27790] trunk/blender/source/creator/ creator.c: Fix #21543: running python script from command line would lose active

Brecht Van Lommel brecht at blender.org
Sat Mar 27 13:42:01 CET 2010


Revision: 27790
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27790
Author:   blendix
Date:     2010-03-27 13:42:01 +0100 (Sat, 27 Mar 2010)

Log Message:
-----------
Fix #21543: running python script from command line would lose active
scene from context for background render. Ideally this should not be
using the context to get the scene but currently the active scene is
not stored anywhere, as it's a concept we tried to get rid of.. just
did a simple fix for now.

Modified Paths:
--------------
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2010-03-27 12:35:14 UTC (rev 27789)
+++ trunk/blender/source/creator/creator.c	2010-03-27 12:42:01 UTC (rev 27790)
@@ -796,6 +796,7 @@
 		/* XXX, temp setting the WM is ugly, splash also does this :S */
 		wmWindowManager *wm= CTX_wm_manager(C);
 		wmWindow *prevwin= CTX_wm_window(C);
+		Scene *prevscene= CTX_data_scene(C);
 
 		if(wm->windows.first) {
 			CTX_wm_window_set(C, wm->windows.first);
@@ -808,6 +809,9 @@
 			fprintf(stderr, "Python script \"%s\" running with missing context data.\n", argv[1]);
 			BPY_run_python_script(C, filename, NULL, NULL); // use reports?
 		}
+
+		CTX_data_scene_set(C, prevscene);
+
 		return 1;
 	} else {
 		printf("\nError: you must specify a Python script after '-P '.\n");





More information about the Bf-blender-cvs mailing list