diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index c92172dff15..5f5c2abd88a 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -406,6 +406,9 @@ typedef struct wmGizmoGroupType { /* same as gizmo-maps, so registering/unregistering goes to the correct region */ struct wmGizmoMapType_Params gzmap_params; + /** Use with #WM_GIZMOGROUPTYPE_TOOL_INIT so tools don't run gizmo's in every region, see: T60112. */ + struct ARegion *tool_init_region; + } wmGizmoGroupType; typedef struct wmGizmoGroup { diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index 67b7149c0bd..444efc7f098 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -800,6 +800,15 @@ void WM_gizmomaptype_group_init_runtime( for (ARegion *ar = lb->first; ar; ar = ar->next) { wmGizmoMap *gzmap = ar->gizmo_map; if (gzmap && gzmap->type == gzmap_type) { + + /* Special case, only allow a single region to run this gizmo type. */ + if (gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) { + BLI_assert(gzgt->tool_init_region != NULL); + if (gzgt->tool_init_region != ar) { + continue; + } + } + wm_gizmogroup_new_from_type(gzmap, gzgt); /* just add here, drawing will occur on next update */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a2850a7554b..ae771f7a34a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2057,6 +2057,8 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false); if (gzgt != NULL) { if ((gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) != 0) { + BLI_assert(gzgt->tool_init_region == NULL); + gzgt->tool_init_region = CTX_wm_region(C); WM_gizmo_group_type_ensure_ptr(gzgt); } }