diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-18 09:10:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-18 09:15:06 +0300 |
commit | d421adb83e8d39bd9d74ea3d526326b70e93c341 (patch) | |
tree | 4c5e16b5e2fcd8c587204aa85dde175a6951392a /source/blender/editors/mesh/editmesh_extrude.c | |
parent | 0a3b66cfb573a91ba3b19f30ead4a026bdfa6873 (diff) |
Gizmo: de-duplicate poll logic
Checking the active tool or operator was a common way to check
if the gizmo was still in use.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_extrude.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index d1050f1122f..c66999b135e 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -54,6 +54,7 @@ #include "ED_transform.h" #include "ED_view3d.h" #include "ED_gizmo_library.h" +#include "ED_gizmo_utils.h" #include "UI_resources.h" @@ -417,20 +418,6 @@ static void gizmo_mesh_extrude_orientation_matrix_set( } } -static bool gizmo_mesh_extrude_poll(const bContext *C, wmGizmoGroupType *gzgt) -{ - ScrArea *sa = CTX_wm_area(C); - bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL; - if ((tref_rt == NULL) || - !STREQ(gzgt->idname, tref_rt->gizmo_group) || - !ED_operator_editmesh_view3d((bContext *)C)) - { - WM_gizmo_group_type_unlink_delayed_ptr(gzgt); - return false; - } - return true; -} - static void gizmo_mesh_extrude_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup) { struct GizmoExtrudeGroup *ggd = MEM_callocN(sizeof(GizmoExtrudeGroup), __func__); @@ -687,7 +674,7 @@ static void MESH_GGT_extrude(struct wmGizmoGroupType *gzgt) gzgt->gzmap_params.spaceid = SPACE_VIEW3D; gzgt->gzmap_params.regionid = RGN_TYPE_WINDOW; - gzgt->poll = gizmo_mesh_extrude_poll; + gzgt->poll = ED_gizmo_poll_or_unlink_delayed_from_tool; gzgt->setup = gizmo_mesh_extrude_setup; gzgt->refresh = gizmo_mesh_extrude_refresh; gzgt->draw_prepare = gizmo_mesh_extrude_draw_prepare; |