[Bf-blender-cvs] [1040e4008ca] blender2.8: Gizmo: reset dial value on cancel

Campbell Barton noreply at git.blender.org
Tue Sep 25 06:23:48 CEST 2018


Commit: 1040e4008ca84936c1e051686a29d810d76c7ca2
Author: Campbell Barton
Date:   Tue Sep 25 14:37:19 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB1040e4008ca84936c1e051686a29d810d76c7ca2

Gizmo: reset dial value on cancel

===================================================================

M	source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list