diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_scene.h | 5 | ||||
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 5 | ||||
-rw-r--r-- | source/blender/editors/scene/scene_edit.c | 40 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 49 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/workspace_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 6 |
8 files changed, 60 insertions, 57 deletions
diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h index 9b48187e541..116d9bd24fc 100644 --- a/source/blender/editors/include/ED_scene.h +++ b/source/blender/editors/include/ED_scene.h @@ -31,10 +31,7 @@ enum eSceneCopyMethod; struct Scene *ED_scene_add(struct Main *bmain, struct bContext *C, struct wmWindow *win, enum eSceneCopyMethod method) ATTR_NONNULL(); bool ED_scene_delete(struct bContext *C, struct Main *bmain, struct wmWindow *win, struct Scene *scene) ATTR_NONNULL(); -void ED_scene_change_update( - struct Main *bmain, struct bContext *C, - struct wmWindow *win, const struct bScreen *screen, - struct Scene *scene_old, struct Scene *scene_new) ATTR_NONNULL(); +void ED_scene_change_update(struct Main *bmain, struct Scene *scene, struct ViewLayer *layer) ATTR_NONNULL(); bool ED_scene_view_layer_delete( struct Main *bmain, struct Scene *scene, struct ViewLayer *layer, struct ReportList *reports) ATTR_NONNULL(1, 2, 3); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 1fdbd46bacf..cc80108e20c 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -184,10 +184,7 @@ void ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win); void ED_screen_ensure_updated(struct wmWindowManager *wm, struct wmWindow *win, struct bScreen *screen); void ED_screen_do_listen(struct bContext *C, struct wmNotifier *note); bool ED_screen_change(struct bContext *C, struct bScreen *sc); -void ED_screen_update_after_scene_change( - const struct bScreen *screen, - struct Scene *scene_new, - struct ViewLayer *view_layer); +void ED_screen_scene_change(struct bContext *C, struct wmWindow *win, struct Scene *scene); void ED_screen_set_active_region(struct bContext *C, struct wmWindow *win, const int xy[2]); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable); diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c index 677fc0a068e..0ebbd770c9f 100644 --- a/source/blender/editors/scene/scene_edit.c +++ b/source/blender/editors/scene/scene_edit.c @@ -80,7 +80,7 @@ Scene *ED_scene_add(Main *bmain, bContext *C, wmWindow *win, eSceneCopyMethod me } } - WM_window_change_active_scene(bmain, C, win, scene_new); + WM_window_set_active_scene(bmain, C, win, scene_new); WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, scene_new); @@ -102,7 +102,7 @@ bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene) else return false; - WM_window_change_active_scene(bmain, C, win, scene_new); + WM_window_set_active_scene(bmain, C, win, scene_new); BKE_libblock_remap(bmain, scene, scene_new, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE); @@ -114,43 +114,17 @@ bool ED_scene_delete(bContext *C, Main *bmain, wmWindow *win, Scene *scene) return true; } -static ViewLayer *scene_change_get_new_view_layer(const WorkSpace *workspace, const Scene *scene_new) +/* Depsgraph updates after scene becomes active in a window. */ +void ED_scene_change_update(Main *bmain, Scene *scene, ViewLayer *layer) { - ViewLayer *layer_new = BKE_workspace_view_layer_exists(workspace, scene_new); - return layer_new ? layer_new : BKE_view_layer_default_view(scene_new); -} + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, layer, true); -void ED_scene_change_update( - Main *bmain, bContext *C, - wmWindow *win, const bScreen *screen, Scene *UNUSED(scene_old), Scene *scene_new) -{ - WorkSpace *workspace = CTX_wm_workspace(C); - ViewLayer *layer_new = scene_change_get_new_view_layer(workspace, scene_new); - Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene_new, layer_new, true); - Object *obact_new = OBACT(layer_new); - UNUSED_VARS(obact_new); - -#if 0 - /* mode syncing */ - eObjectMode object_mode_old = workspace->object_mode; - ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace); - Object *obact_old = OBACT(layer_old); - UNUSED_VARS(obact_old, object_mode_old); -#endif - - win->scene = scene_new; - CTX_data_scene_set(C, scene_new); - BKE_workspace_view_layer_set(workspace, layer_new, scene_new); - BKE_scene_set_background(bmain, scene_new); - DEG_graph_relations_update(depsgraph, bmain, scene_new, layer_new); + BKE_scene_set_background(bmain, scene); + DEG_graph_relations_update(depsgraph, bmain, scene, layer); DEG_on_visible_update(bmain, false); - ED_screen_update_after_scene_change(screen, scene_new, layer_new); ED_render_engine_changed(bmain); ED_update_for_newframe(bmain, depsgraph); - - /* complete redraw */ - WM_event_add_notifier(C, NC_WINDOW, NULL); } static bool view_layer_remove_poll( diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 6bc8a6c10cf..50609815168 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -477,8 +477,8 @@ void ED_screens_initialize(Main *bmain, wmWindowManager *wm) wmWindow *win; for (win = wm->windows.first; win; win = win->next) { - if (WM_window_get_active_workspace(win) == NULL) { - WM_window_set_active_workspace(win, bmain->workspaces.first); + if (BKE_workspace_active_get(win->workspace_hook) == NULL) { + BKE_workspace_active_set(win->workspace_hook, bmain->workspaces.first); } if (BLI_listbase_is_empty(&win->global_areas.areabase)) { @@ -792,11 +792,19 @@ static void screen_global_statusbar_area_create(wmWindow *win) void ED_screen_global_areas_create(wmWindow *win) { + /* Don't create global areas for child windows. */ + if (win->parent) { + return; + } + + /* Don't create global area for temporary windows. */ bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); - if (screen->temp == 0) { - screen_global_topbar_area_create(win); - screen_global_statusbar_area_create(win); + if (screen->temp) { + return; } + + screen_global_topbar_area_create(win); + screen_global_statusbar_area_create(win); } @@ -936,13 +944,40 @@ static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrAre } } -void ED_screen_update_after_scene_change(const bScreen *screen, Scene *scene_new, ViewLayer *view_layer) +static ViewLayer *scene_change_get_new_view_layer(const WorkSpace *workspace, const Scene *scene_new) +{ + ViewLayer *layer_new = BKE_workspace_view_layer_exists(workspace, scene_new); + return layer_new ? layer_new : BKE_view_layer_default_view(scene_new); +} + +void ED_screen_scene_change(bContext *C, wmWindow *win, Scene *scene) { + const bScreen *screen = WM_window_get_active_screen(win); + WorkSpace *workspace = CTX_wm_workspace(C); + ViewLayer *view_layer = scene_change_get_new_view_layer(workspace, scene); + +#if 0 + /* mode syncing */ + Object *obact_new = OBACT(view_layer); + UNUSED_VARS(obact_new); + eObjectMode object_mode_old = workspace->object_mode; + ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace); + Object *obact_old = OBACT(layer_old); + UNUSED_VARS(obact_old, object_mode_old); +#endif + + BKE_workspace_view_layer_set(workspace, view_layer, scene); + + win->scene = scene; + if (CTX_wm_window(C) == win) { + CTX_data_scene_set(C, scene); + } + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; - screen_set_3dview_camera(scene_new, view_layer, sa, v3d); + screen_set_3dview_camera(scene, view_layer, sa, v3d); } } } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a0e8357b8f3..ab0fbfacf93 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1130,7 +1130,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) newwin->scene = scene; - WM_window_set_active_workspace(newwin, workspace); + BKE_workspace_active_set(newwin->workspace_hook, workspace); /* allocs new screen and adds to newly created window, using window size */ layout_new = ED_workspace_layout_add(bmain, workspace, newwin, BKE_workspace_layout_name_get(layout_old)); newsc = BKE_workspace_layout_screen_get(layout_new); diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 9d329355500..9ba9b70a6e8 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -191,8 +191,8 @@ bool ED_workspace_change( BLI_assert(BKE_workspace_layout_screen_get(layout_new) == screen_new); if (screen_new) { - WM_window_set_active_layout(win, workspace_new, layout_new); - WM_window_set_active_workspace(win, workspace_new); + BKE_workspace_hook_layout_for_workspace_set(win->workspace_hook, workspace_new, layout_new); + BKE_workspace_active_set(win->workspace_hook, workspace_new); /* update screen *after* changing workspace - which also causes the * actual screen change and updates context (including CTX_wm_workspace) */ diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 6668ea1faeb..8a5df196c7b 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -262,7 +262,7 @@ static eOLDrawState tree_element_set_active_object( sce = (Scene *)outliner_search_back(soops, te, ID_SCE); if (sce && scene != sce) { - WM_window_change_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); + WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); scene = sce; } @@ -431,7 +431,7 @@ static eOLDrawState tree_element_active_world( if (set != OL_SETSEL_NONE) { /* make new scene active */ if (sce && scene != sce) { - WM_window_change_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); + WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); } } @@ -950,7 +950,7 @@ static void do_outliner_item_activate_tree_element( /* editmode? */ if (te->idcode == ID_SCE) { if (scene != (Scene *)tselem->id) { - WM_window_change_active_scene(CTX_data_main(C), C, CTX_wm_window(C), (Scene *)tselem->id); + WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), (Scene *)tselem->id); } } else if (te->idcode == ID_GR) { diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 9952db5e652..b23ea8e4dae 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -580,7 +580,7 @@ void outliner_do_object_operation_ex( // when objects selected in other scenes... dunno if that should be allowed Scene *scene_owner = (Scene *)outliner_search_back(soops, te, ID_SCE); if (scene_owner && scene_act != scene_owner) { - WM_window_change_active_scene(CTX_data_main(C), C, CTX_wm_window(C), scene_owner); + WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), scene_owner); } /* important to use 'scene_owner' not scene_act else deleting objects can crash. * only use 'scene_act' when 'scene_owner' is NULL, which can happen when the @@ -956,7 +956,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) Scene *sce = scene; // to be able to delete, scenes are set... outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_select_cb); if (scene != sce) { - WM_window_change_active_scene(bmain, C, win, sce); + WM_window_set_active_scene(bmain, C, win, sce); } str = "Select Objects"; @@ -967,7 +967,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) Scene *sce = scene; // to be able to delete, scenes are set... outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_cb, false); if (scene != sce) { - WM_window_change_active_scene(bmain, C, win, sce); + WM_window_set_active_scene(bmain, C, win, sce); } str = "Select Object Hierarchy"; DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE); |