Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-27 09:49:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-27 09:49:41 +0300
commit3e2dfc6db8e01ffa5e12a8e9b300ef6509a06552 (patch)
tree1095154957d62ed8440254e985b4a3a1b87e7bc2 /source/creator
parent98c8094e3a52edaec87bb9f61809e9ae573df430 (diff)
Fix T55991: Python ignores scene switch argument
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/creator_args.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index b78e76f6ba3..22301bd62f5 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -60,6 +60,8 @@
#include "BKE_sound.h"
#include "BKE_image.h"
+#include "DNA_screen_types.h"
+
#include "DEG_depsgraph.h"
#ifdef WITH_FFMPEG
@@ -1588,6 +1590,16 @@ static int arg_handle_scene_set(int argc, const char **argv, void *data)
Scene *scene = BKE_scene_set_name(CTX_data_main(C), argv[1]);
if (scene) {
CTX_data_scene_set(C, scene);
+
+ /* Set the scene of the first window, see: T55991,
+ * otherwise scrips that run later won't get this scene back from the context. */
+ wmWindow *win = CTX_wm_window(C);
+ if (win == NULL) {
+ win = CTX_wm_manager(C)->windows.first;
+ }
+ if (win != NULL) {
+ win->screen->scene = scene;
+ }
}
return 1;
}