Cleanup: G.main removal from 2.8-only code.
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 15 Jun 2018 15:33:24 +0000 (17:33 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 15 Jun 2018 15:33:24 +0000 (17:33 +0200)
source/blender/blenkernel/BKE_workspace.h
source/blender/blenkernel/intern/workspace.c
source/blender/blenloader/intern/versioning_280.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/workspace_layout_edit.c
source/blender/editors/sculpt_paint/sculpt.c

index 5442fd4..03d24ac 100644 (file)
@@ -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();
index b71dfaf..99fb6b1 100644 (file)
@@ -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);
index a5d2ced..2dda6f0 100644 (file)
@@ -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);
        }
 }
index ac4ab34..4d7533d 100644 (file)
@@ -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)) {
index 0c7431c..6d504c0 100644 (file)
@@ -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(
index f3fe04f..8faf7f2 100644 (file)
@@ -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);