Fix #28733, #29885: fix missing scene in context in python. The window manager
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 30 Jan 2012 15:12:51 +0000 (15:12 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 30 Jan 2012 15:12:51 +0000 (15:12 +0000)
would indirectly clear it when clearing the window from the context. This makes
some sense when we support multiple scenes properly, but currently there's still
many places assuming there is a single active scene, so keep it available to
avoid crashes.

source/blender/blenkernel/intern/context.c

index 9e9a0ca2d547b7f3a53fd2d581b356b9a20b9b95..05c56fa81019f15660bb39bd9b84937c10a66ad9 100644 (file)
@@ -381,7 +381,8 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
 {
        C->wm.window= win;
        C->wm.screen= (win)? win->screen: NULL;
-       C->data.scene= (C->wm.screen)? C->wm.screen->scene: NULL;
+       if(C->wm.screen)
+               C->data.scene= C->wm.screen->scene;
        C->wm.area= NULL;
        C->wm.region= NULL;
 }
@@ -389,7 +390,8 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
 void CTX_wm_screen_set(bContext *C, bScreen *screen)
 {
        C->wm.screen= screen;
-       C->data.scene= (C->wm.screen)? C->wm.screen->scene: NULL;
+       if(C->wm.screen)
+               C->data.scene= C->wm.screen->scene;
        C->wm.area= NULL;
        C->wm.region= NULL;
 }