diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-06-27 11:42:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-06-27 11:48:45 +0300 |
commit | c93af8529dfec9513de3bfcead9d15fa0eeb9a81 (patch) | |
tree | 846d5c2d63f889f8b2bc2d642733939b39b2a6d5 /source/blender | |
parent | 3366b333e49dd0623c3c68c2c04aac66e5028be9 (diff) |
Tool System: don't unlink gizmos when changing tools
Needed for tools not to unlink each other with multiple windows.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index f40ea55ee82..3d22981f7ba 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -128,11 +128,16 @@ bool WM_toolsystem_ref_ensure(struct WorkSpace *workspace, const bToolKey *tkey, /** \} */ -static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *tref) +/** + * \param do_gizmo: Make removing the gizmo optional because it complicates multi-window support + * since the tool might be used in another window. The gizmos poll function must handle this, + * since this is needed for switching workspaces anyway. + */ +static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *tref, bool do_gizmo) { bToolRef_Runtime *tref_rt = tref->runtime; - if (tref_rt->gizmo_group[0]) { + if (do_gizmo && tref_rt->gizmo_group[0]) { wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(tref_rt->gizmo_group, false); if (gzgt != NULL) { bool found = false; @@ -165,7 +170,7 @@ void WM_toolsystem_unlink(bContext *C, WorkSpace *workspace, const bToolKey *tke { bToolRef *tref = WM_toolsystem_ref_find(workspace, tkey); if (tref && tref->runtime) { - toolsystem_unlink_ref(C, workspace, tref); + toolsystem_unlink_ref(C, workspace, tref, false); } } @@ -312,7 +317,7 @@ void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace) LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) { if (tref->runtime) { if (tref->tag == 0) { - toolsystem_unlink_ref(C, workspace, tref); + toolsystem_unlink_ref(C, workspace, tref, true); tref->tag = 1; } } @@ -359,7 +364,7 @@ void WM_toolsystem_ref_set_from_runtime(struct bContext *C, Main *bmain = CTX_data_main(C); if (tref->runtime) { - toolsystem_unlink_ref(C, workspace, tref); + toolsystem_unlink_ref(C, workspace, tref, false); } STRNCPY(tref->idname, idname); |