Gizmo: reset dial value on cancel
This commit is contained in:
@@ -459,6 +459,18 @@ static int gizmo_dial_modal(
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
static void gizmo_dial_exit(bContext *C, wmGizmo *gz, const bool cancel)
|
||||
{
|
||||
DialInteraction *inter = gz->interaction_data;
|
||||
if (cancel) {
|
||||
/* Set the property for the operator and call its modal function. */
|
||||
wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset");
|
||||
if (WM_gizmo_target_property_is_valid(gz_prop)) {
|
||||
WM_gizmo_target_property_float_set(C, gz, gz_prop, inter->init.prop_angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void gizmo_dial_setup(wmGizmo *gz)
|
||||
{
|
||||
@@ -502,6 +514,7 @@ static void GIZMO_GT_dial_3d(wmGizmoType *gzt)
|
||||
gzt->setup = gizmo_dial_setup;
|
||||
gzt->invoke = gizmo_dial_invoke;
|
||||
gzt->modal = gizmo_dial_modal;
|
||||
gzt->exit = gizmo_dial_exit;
|
||||
|
||||
gzt->struct_size = sizeof(wmGizmo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user