diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-06 16:01:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-06 16:08:23 +0300 |
commit | e41dddd29a17a77e60bde6a2336fcd3937819bec (patch) | |
tree | f54945d97037d5f197c27b9ea1dc203b03cbbb09 /source | |
parent | cda20a7af89c7da76a5016667f24f06eaa8afdb1 (diff) |
Gizmo: remove wmGizmoGroup.use_fallback_keymap
This ended up being a copy of:
`toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK`
requiring boiler plate assignment in gizmos refresh callbacks.
Remove this struct member and check `toolsettings->workspace_tool_type`
directly, since so far there has been no advantage in gizmo-groups
being able to control this themselves.
Diffstat (limited to 'source')
7 files changed, 5 insertions, 66 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c index 0e0d59764e5..1de08e75f80 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c @@ -140,13 +140,10 @@ static void WIDGETGROUP_tool_generic_refresh(const bContext *C, wmGizmoGroup *gz ToolSettings *ts = CTX_data_tool_settings(C); if (ts->workspace_tool_type != SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = false; WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, true); return; } - gzgroup->use_fallback_keymap = true; - /* skip, we don't draw anything anyway */ { int orientation; diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c index 4f6556cd2a2..aa4d5c03d74 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.c +++ b/source/blender/editors/transform/transform_gizmo_2d.c @@ -465,16 +465,6 @@ static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup) copy_v2_v2(ggd->origin, origin); bool show_cage = !ggd->no_cage && !equals_v2v2(ggd->min, ggd->max); - if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) { - Scene *scene = CTX_data_scene(C); - if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = true; - } - else { - gzgroup->use_fallback_keymap = false; - } - } - if (has_select == false) { for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) { ggd->translate_xy[i]->flag |= WM_GIZMO_HIDDEN; @@ -641,16 +631,6 @@ static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup GizmoGroup_Resize2D *ggd = gzgroup->customdata; float origin[3] = {UNPACK2(ggd->origin), 0.0f}; - if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) { - Scene *scene = CTX_data_scene(C); - if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = true; - } - else { - gzgroup->use_fallback_keymap = false; - } - } - gizmo2d_origin_to_region(region, origin); for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) { @@ -793,16 +773,6 @@ static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup GizmoGroup_Rotate2D *ggd = gzgroup->customdata; float origin[3] = {UNPACK2(ggd->origin), 0.0f}; - if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) { - Scene *scene = CTX_data_scene(C); - if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = true; - } - else { - gzgroup->use_fallback_keymap = false; - } - } - gizmo2d_origin_to_region(region, origin); wmGizmo *gz = ggd->gizmo; diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 0fa179c4f74..e4c20fa0be1 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -1670,13 +1670,6 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup) RegionView3D *rv3d = region->regiondata; struct TransformBounds tbounds; - if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = true; - } - else { - gzgroup->use_fallback_keymap = false; - } - if (ggd->use_twtype_refresh) { ggd->twtype = v3d->gizmo_show_object & ggd->twtype_init; if (ggd->twtype != ggd->twtype_prev) { @@ -2105,13 +2098,6 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgr struct TransformBounds tbounds; - if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = true; - } - else { - gzgroup->use_fallback_keymap = false; - } - const int orient_index = BKE_scene_orientation_get_index_from_flag(scene, SCE_ORIENT_SCALE); if ((ED_transform_calc_gizmo_stats(C, @@ -2316,13 +2302,6 @@ static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzg struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata; struct TransformBounds tbounds; - if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { - gzgroup->use_fallback_keymap = true; - } - else { - gzgroup->use_fallback_keymap = false; - } - /* Needed to test view orientation changes. */ copy_m3_m4(xgzgroup->prev.viewinv_m3, rv3d->viewinv); diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c index ca4ed01c0f6..6e89c3de197 100644 --- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c +++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c @@ -381,11 +381,9 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) { WM_gizmo_set_flag(ggd->invoke_view, WM_GIZMO_HIDDEN, false); - gzgroup->use_fallback_keymap = true; } else { WM_gizmo_set_flag(ggd->invoke_view, WM_GIZMO_HIDDEN, true); - gzgroup->use_fallback_keymap = false; } } diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index a1edc4196dc..b667872a914 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -502,8 +502,6 @@ typedef struct wmGizmoGroup { bool tag_remove; - bool use_fallback_keymap; - void *customdata; /** For freeing customdata from above. */ void (*customdata_free)(void *); diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index 22bdf65a169..7772c87f71c 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -266,7 +266,6 @@ void WM_gizmogroup_ensure_init(const bContext *C, wmGizmoGroup *gzgroup) /* prepare for first draw */ if (UNLIKELY((gzgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0)) { - gzgroup->use_fallback_keymap = true; gzgroup->type->setup(C, gzgroup); /* Not ideal, initialize keymap here, needed for RNA runtime generated gizmos. */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a2625f233b5..f4753c7c190 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -4060,14 +4060,12 @@ void WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm, if (gzgroup != NULL) { if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP) { /* If all are hidden, don't override. */ - if (gzgroup->use_fallback_keymap) { - is_gizmo_visible = true; - wmGizmo *highlight = wm_gizmomap_highlight_get(gzmap); - if (highlight) { - is_gizmo_highlight = true; - } - add_keymap = true; + is_gizmo_visible = true; + wmGizmo *highlight = wm_gizmomap_highlight_get(gzmap); + if (highlight) { + is_gizmo_highlight = true; } + add_keymap = true; } } } |