Commit: e1831990227ad43c9c41fca8f3e3639aaa222c2d Author: Campbell Barton Date: Sun Mar 22 03:29:59 2015 +1100 Branches: master https://developer.blender.org/rBe1831990227ad43c9c41fca8f3e3639aaa222c2d
Cleanup: instantiate arg once in context macro =================================================================== M source/creator/creator.c =================================================================== diff --git a/source/creator/creator.c b/source/creator/creator.c index 0ca5fbe..9815b3c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1185,19 +1185,24 @@ static int set_skip_frame(int argc, const char **argv, void *data) #define BPY_CTX_SETUP(_cmd) \ { \ wmWindowManager *wm = CTX_wm_manager(C); \ - wmWindow *prevwin = CTX_wm_window(C); \ - Scene *prevscene = CTX_data_scene(C); \ - if (wm->windows.first) { \ + Scene *scene_prev = CTX_data_scene(C); \ + wmWindow *win_prev; \ + const bool has_win = !BLI_listbase_is_empty(&wm->windows); \ + if (has_win) { \ + win_prev = CTX_wm_window(C); \ CTX_wm_window_set(C, wm->windows.first); \ - _cmd; \ - CTX_wm_window_set(C, prevwin); \ } \ else { \ fprintf(stderr, "Python script \"%s\" " \ "running with missing context data.\n", argv[1]); \ + } \ + { \ _cmd; \ } \ - CTX_data_scene_set(C, prevscene); \ + if (has_win) { \ + CTX_wm_window_set(C, win_prev); \ + } \ + CTX_data_scene_set(C, scene_prev); \ } (void)0 \ #endif /* WITH_PYTHON */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs