Gizmo: de-duplicate poll logic

Checking the active tool or operator was a common way to check
if the gizmo was still in use.
This commit is contained in:
2018-09-18 16:10:07 +10:00
parent 0a3b66cfb5
commit d421adb83e
10 changed files with 130 additions and 98 deletions

View File

@@ -35,6 +35,7 @@
#include "BKE_editmesh.h"
#include "ED_gizmo_library.h"
#include "ED_gizmo_utils.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
@@ -199,12 +200,7 @@ static void gizmo_placement_prop_matrix_set(
static bool gizmo_mesh_placement_poll(const bContext *C, wmGizmoGroupType *gzgt)
{
wmOperator *op = WM_operator_last_redo(C);
if (op == NULL || !STREQ(op->type->idname, "MESH_OT_primitive_cube_add_gizmo")) {
WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
return false;
}
return true;
return ED_gizmo_poll_or_unlink_delayed_from_operator(C, gzgt, "MESH_OT_primitive_cube_add_gizmo");
}
static void gizmo_mesh_placement_modal_from_setup(