Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-25 07:37:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-25 07:37:19 +0300
commit1040e4008ca84936c1e051686a29d810d76c7ca2 (patch)
tree4279b82aab729442e30221b1744e0abc0194d8ae /source/blender/editors/gizmo_library/gizmo_types
parentebdeb3eca0d6ea483a4ef057c5ffbbb20938d25b (diff)
Gizmo: reset dial value on cancel
Diffstat (limited to 'source/blender/editors/gizmo_library/gizmo_types')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
index cb474255fd4..d09acfa8761 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -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);