[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46486] trunk/blender/source/blender/ editors: fix [#31382] Loop Cut and Slide numpad (-)

Campbell Barton ideasman42 at gmail.com
Thu May 10 09:10:39 CEST 2012


Revision: 46486
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46486
Author:   campbellbarton
Date:     2012-05-10 07:10:39 +0000 (Thu, 10 May 2012)
Log Message:
-----------
fix [#31382] Loop Cut and Slide numpad (-)

investigation lead to finding 3 bugs here...
- transform key input handling didnt ignore minus key on an unsigned value as it should.
- not being able to set numcuts to 0 made typing in numbers not very useful.
- backspace would set the cuts to an unsigned value.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
    trunk/blender/source/blender/editors/util/numinput.c

Modified: trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c	2012-05-10 06:32:24 UTC (rev 46485)
+++ trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c	2012-05-10 07:10:39 UTC (rev 46486)
@@ -492,7 +492,7 @@
 			if (event->val == KM_RELEASE)
 				break;
 
-			cuts = MAX2(cuts - 1, 1);
+			cuts = MAX2(cuts - 1, 0);
 			RNA_int_set(op->ptr, "number_cuts", cuts);
 			ringsel_find_edge(lcd, cuts);
 			show_cuts = TRUE;
@@ -519,12 +519,15 @@
 	
 	/* using the keyboard to input the number of cuts */
 	if (event->val == KM_PRESS) {
-		float value;
+		/* init as zero so backspace clears */
+		float value = 0.0f;
 		
 		if (handleNumInput(&lcd->num, event)) {
 			applyNumInput(&lcd->num, &value);
 			
-			cuts = CLAMPIS(value, 1, 130);
+			/* allow zero so you can backspace and type in a value
+			 * otherwise 1 as minimum would make more sense */
+			cuts = CLAMPIS(value, 0, 130);
 			
 			RNA_int_set(op->ptr, "number_cuts", cuts);
 			ringsel_find_edge(lcd, cuts);

Modified: trunk/blender/source/blender/editors/util/numinput.c
===================================================================
--- trunk/blender/source/blender/editors/util/numinput.c	2012-05-10 06:32:24 UTC (rev 46485)
+++ trunk/blender/source/blender/editors/util/numinput.c	2012-05-10 07:10:39 UTC (rev 46486)
@@ -221,7 +221,7 @@
 					break;
 			case MINUSKEY:
 				if (n->flag & NUM_NO_NEGATIVE)
-					break;
+					return 0;
 
 				if (n->ctrl[idx]) {
 					n->ctrl[idx] *= -1;




More information about the Bf-blender-cvs mailing list