[Bf-blender-cvs] [b58d4e7fe4a] blender2.8: WM: remove tool initialization code

Campbell Barton noreply at git.blender.org
Wed Nov 28 03:59:29 CET 2018


Commit: b58d4e7fe4a01250f13d4bb764806e9f8d59db1b
Author: Campbell Barton
Date:   Wed Nov 28 13:57:21 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBb58d4e7fe4a01250f13d4bb764806e9f8d59db1b

WM: remove tool initialization code

Area initialization handles these cases now.

===================================================================

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

===================================================================

diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 6c836c9fc08..d8e0945eb25 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -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) {
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 2b2a4f5e43a..3b91b351b25 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -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(
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 5bc266427d5..5a61f077a84 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -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();



More information about the Bf-blender-cvs mailing list