[Bf-blender-cvs] [fe9110e] master: Code cleanup: use scene variable rather then calling CTX_data_scene

Campbell Barton noreply at git.blender.org
Tue Jul 1 10:59:41 CEST 2014


Commit: fe9110edc4d0f49b7dd8941409e8d63743942ea6
Author: Campbell Barton
Date:   Tue Jul 1 18:51:54 2014 +1000
https://developer.blender.org/rBfe9110edc4d0f49b7dd8941409e8d63743942ea6

Code cleanup: use scene variable rather then calling CTX_data_scene

===================================================================

M	source/blender/blenkernel/intern/blender.c

===================================================================

diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 8afd2c4..9be9db7 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -286,6 +286,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 		CTX_wm_area_set(C, NULL);
 		CTX_wm_region_set(C, NULL);
 		CTX_wm_menu_set(C, NULL);
+		curscene = bfd->curscene;
 	}
 	
 	/* this can happen when active scene was lib-linked, and doesn't exist anymore */
@@ -299,6 +300,9 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 		curscene = CTX_data_scene(C);
 	}
 
+	BLI_assert(curscene == CTX_data_scene(C));
+
+
 	/* special cases, override loaded flags: */
 	if (G.f != bfd->globalf) {
 		const int flags_keep = (G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
@@ -349,12 +353,12 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 			
 			for (win = wm->windows.first; win; win = win->next) {
 				if (win->screen && win->screen->scene) /* zealous check... */
-					if (win->screen->scene != CTX_data_scene(C))
+					if (win->screen->scene != curscene)
 						BKE_scene_set_background(G.main, win->screen->scene);
 			}
 		}
 	}
-	BKE_scene_set_background(G.main, CTX_data_scene(C));
+	BKE_scene_set_background(G.main, curscene);
 
 	if (mode != LOAD_UNDO) {
 		IMB_colormanagement_check_file_config(G.main);




More information about the Bf-blender-cvs mailing list