From 3e4bf31327c9264c735b85e565d817016db495fc Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 15 Jun 2018 17:33:24 +0200 Subject: [PATCH] Cleanup: G.main removal from 2.8-only code. --- source/blender/blenkernel/BKE_workspace.h | 1 + source/blender/blenkernel/intern/workspace.c | 3 ++- source/blender/blenloader/intern/versioning_280.c | 2 +- source/blender/editors/screen/screen_edit.c | 4 ++-- source/blender/editors/screen/workspace_layout_edit.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 5442fd43ce5..03d24ac53d1 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -44,6 +44,7 @@ struct WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const struct Ma void BKE_workspace_instance_hook_free(const struct Main *bmain, struct WorkSpaceInstanceHook *hook); struct WorkSpaceLayout *BKE_workspace_layout_add( + struct Main *bmain, struct WorkSpace *workspace, struct bScreen *screen, const char *name) ATTR_NONNULL(); diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index b71dfaf5aea..99fb6b14a35 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -227,13 +227,14 @@ void BKE_workspace_instance_hook_free(const Main *bmain, WorkSpaceInstanceHook * * Add a new layout to \a workspace for \a screen. */ WorkSpaceLayout *BKE_workspace_layout_add( + Main *bmain, WorkSpace *workspace, bScreen *screen, const char *name) { WorkSpaceLayout *layout = MEM_callocN(sizeof(*layout), __func__); - BLI_assert(!workspaces_is_screen_used(G.main, screen)); + BLI_assert(!workspaces_is_screen_used(bmain, screen)); layout->screen = screen; workspace_layout_name_set(workspace, layout, name); BLI_addtail(&workspace->layouts, layout); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index a5d2ced6858..2dda6f00faf 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -114,7 +114,7 @@ static void do_version_workspaces_create_from_screens(Main *bmain) else { workspace = BKE_workspace_add(bmain, screen->id.name + 2); } - BKE_workspace_layout_add(workspace, screen, screen->id.name + 2); + BKE_workspace_layout_add(bmain, workspace, screen, screen->id.name + 2); BKE_workspace_view_layer_set(workspace, layer, scene); } } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index ac4ab3461a3..4d7533d575c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -832,13 +832,13 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) } /* file read, set all screens, ... */ -void ED_screens_initialize(Main *UNUSED(bmain), wmWindowManager *wm) +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, G.main->workspaces.first); + WM_window_set_active_workspace(win, bmain->workspaces.first); } if (BLI_listbase_is_empty(&win->global_areas.areabase)) { diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c index 0c7431cb2e7..6d504c05dd1 100644 --- a/source/blender/editors/screen/workspace_layout_edit.c +++ b/source/blender/editors/screen/workspace_layout_edit.c @@ -57,7 +57,7 @@ WorkSpaceLayout *ED_workspace_layout_add( WM_window_screen_rect_calc(win, &screen_rect); screen = screen_add(bmain, name, &screen_rect); - return BKE_workspace_layout_add(workspace, screen, name); + return BKE_workspace_layout_add(bmain, workspace, screen, name); } WorkSpaceLayout *ED_workspace_layout_duplicate( diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index f3fe04f7714..8faf7f2c14a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5737,7 +5737,7 @@ void ED_object_sculptmode_enter_ex( } } - // ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob); + // ED_workspace_object_mode_sync_from_object(bmain->wm.first, workspace, ob); /* Flush object mode. */ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); @@ -5789,7 +5789,7 @@ void ED_object_sculptmode_exit_ex( /* Leave sculptmode */ ob->mode &= ~mode_flag; - // ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob); + // ED_workspace_object_mode_sync_from_object(G_MAIN->wm.first, workspace, ob); BKE_sculptsession_free(ob);