[Bf-blender-cvs] [1b8069b] master: UI: location/scale were snapping to 10s

Campbell Barton noreply at git.blender.org
Mon May 4 17:24:32 CEST 2015


Commit: 1b8069bdd921a2807f156682aec540f2acc37e3c
Author: Campbell Barton
Date:   Tue May 5 01:20:40 2015 +1000
Branches: master
https://developer.blender.org/rB1b8069bdd921a2807f156682aec540f2acc37e3c

UI: location/scale were snapping to 10s

In practice this isn't useful (for scale especially).

For float buttons with a very large range, don't attempt to match the snap to the range.

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

M	source/blender/editors/interface/interface_handlers.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 3d8a56c..7ed02c9 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3501,6 +3501,16 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
 			softrange /= fac;
 		}
 
+		/* workaround, too high snapping values */
+		/* snapping by 10's for float buttons is quite annoying (location, scale...),
+		 * but allow for rotations */
+		if ((softrange > 2100.0f)) {
+			int unit_type = UI_but_unit_type_get(but);
+			if (!ELEM(unit_type, PROP_UNIT_ROTATION)) {
+				softrange = 20.0f;
+			}
+		}
+
 		if (snap == SNAP_ON) {
 			if      (softrange < 2.10f) tempf = roundf(tempf * 10.0f) * 0.1f;
 			else if (softrange < 21.0f) tempf = roundf(tempf);




More information about the Bf-blender-cvs mailing list