WM: remove tool initialization code
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 Nov 2018 02:57:21 +0000 (13:57 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Nov 2018 02:58:53 +0000 (13:58 +1100)
Area initialization handles these cases now.

source/blender/editors/screen/workspace_edit.c
source/blender/windowmanager/intern/wm_toolsystem.c
source/creator/creator.c

index 6c836c9fc081654304662aacca91cdc698637c92..d8e0945eb25463cda5420675e13e8829c17d7426 100644 (file)
@@ -187,7 +187,7 @@ bool ED_workspace_change(
        BLI_assert(CTX_wm_workspace(C) == workspace_new);
 
        WM_toolsystem_unlink_all(C, workspace_old);
-       WM_toolsystem_reinit_all(C, win);
+       /* Area initialization will initialize based on the new workspace. */
 
        /* Automatic mode switching. */
        if (workspace_new->object_mode != workspace_old->object_mode) {
index 2b2a4f5e43a30f4a889713b69329338aee3bf103..3b91b351b253b5d90d442137fc416ba94b08aa35 100644 (file)
@@ -553,40 +553,10 @@ void WM_toolsystem_init(bContext *C)
        LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
                LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
                        MEM_SAFE_FREE(tref->runtime);
-                       tref->tag = 0;
                }
        }
 
-       for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
-               for (wmWindow *win = wm->windows.first; win; win = win->next) {
-                       CTX_wm_window_set(C, win);
-                       WorkSpace *workspace = WM_window_get_active_workspace(win);
-                       bScreen *screen = WM_window_get_active_screen(win);
-                       ViewLayer *view_layer = WM_window_get_active_view_layer(win);
-                       for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-                               if (((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) == 0) {
-                                       continue;
-                               }
-                               const bToolKey tkey = {
-                                       .space_type = sa->spacetype,
-                                       .mode = WM_toolsystem_mode_from_spacetype(view_layer, sa, sa->spacetype),
-                               };
-                               bToolRef *tref = WM_toolsystem_ref_find(workspace, &tkey);
-                               if (tref) {
-                                       if (tref->tag == 0) {
-                                               toolsystem_reinit_ref(C, workspace, tref);
-                                               tref->tag = 1;
-                                       }
-                               }
-                               else {
-                                       /* Without this we may load a file without a default tool. */
-                                       tref = toolsystem_reinit_ensure_toolref(C, workspace, &tkey, NULL);
-                                       tref->tag = 1;
-                               }
-                       }
-                       CTX_wm_window_set(C, NULL);
-               }
-       }
+       /* Rely on screen initialization for gizmos. */
 }
 
 int WM_toolsystem_mode_from_spacetype(
index 5bc266427d5a0922429f84bd3e60c53d9fbee92c..5a61f077a84e0c27e87eb974ad569de08fac8dce 100644 (file)
@@ -467,11 +467,6 @@ int main(
        CTX_py_init_set(C, 1);
        WM_keyconfig_init(C);
 
-       /* Called on load, however Python is not yet initialized, so call again here. */
-       if (!G.background) {
-               WM_toolsystem_init(C);
-       }
-
 #ifdef WITH_FREESTYLE
        /* initialize Freestyle */
        FRS_initialize();