[Bf-committers] Grab and Scale Transform Numeric Entry Behavior with Patch

Nathanael Law bf-committers@blender.org
Tue, 16 Dec 2003 17:23:20 -0700


--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I was playing with the axis constraints for grab and scale transforms
and I thought that the behavior was slightly illogical.  Without axis
constraints, I think everything is great, but once a constraint is used
some irregularities show up.  (Note, this is not a bug, it's more of a
possible improvement)

When you enter grab or scale mode, then constrain the transformation to a
particular axis, then enter numeric entry mode by hitting a number or
'n', there is no reason for you to try and edit the numeric value of a
non-constrained axis which is the current behavior.

E.g. You grab an object and want to move it along the z-axis, so you
enter grab mode and either hit 'z' or the middle mouse button and you
move the mouse to get an idea of how it looks.  You decide that you
want to use a value of +4.2 with numeric entry; now you have to enter
the following sequence: 'g', 'z', 'move mouse', 'tab', 'tab', '4.2',
'enter'.  However, you're already constrained to the z-axis, so you
should not have to enter 'tab', 'tab'.

The included patch changes the behavior of grab and scale transforms so
that if you are constrained to an axis, and enter numeric entry mode via
'n' or by hitting a number, you will immediately begin editing the
appropriate axis, and will not have to hit 'tab'.

This may not seem like a big improvement (because it's not), but I feel
that it improves the workflow of a commonly used task slightly and does
not negatively impact any other aspects of the program.

I welcome feedback on this idea.

-- 
 - Nathanael Law <njlaw@xyrodian.com>


--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="AxisConstraint.diff"

Index: source/blender/src/editobject.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editobject.c,v
retrieving revision 1.48
diff -u -r1.48 editobject.c
--- source/blender/src/editobject.c	16 Dec 2003 01:27:37 -0000	1.48
+++ source/blender/src/editobject.c	17 Dec 2003 00:02:09 -0000
@@ -5097,6 +5097,13 @@
 					else{
 						axismode= XTRANS;
 					}
+                                        if (mode == 'g') {
+                                                if (axismode & XTRANS)
+                                                        ax = 0;
+                                        } else if (mode == 's') {
+                                                if (axismode & XTRANS)
+                                                        ax = 1;
+                                        }
 					firsttime=1;
 					break;
 					
@@ -5108,17 +5115,31 @@
 					else{
 						axismode= YTRANS;
 					}
+                                        if (mode == 'g') {
+                                                if (axismode & YTRANS)
+                                                        ax = 1;
+                                        } else if (mode == 's') {
+                                                if (axismode & YTRANS)
+                                                        ax = 2;
+                                        }
 					firsttime=1;
 					break;
 					
 				case ZKEY:
-					if (axismode==ZTRANS)
+					if (axismode==ZTRANS) 
 						axismode=ZTRANSLOCAL;
 					else if (axismode==ZTRANSLOCAL)
 						axismode=0;
 					else{
 						axismode= ZTRANS;
 					}
+                                        if (mode == 'g') {
+                                                if (axismode & ZTRANS)
+                                                        ax = 2;
+                                        } else if (mode == 's') {
+                                                if (axismode & ZTRANS)
+                                                        ax = 3;
+                                        }
 					firsttime=1;
 					break;
 				case WHEELDOWNMOUSE:
@@ -5259,6 +5280,8 @@
 						if ((mode == 'S') || (mode == 'w') || (mode == 'C') || (mode == 'N'))
 							break;
 						if ((mode != 'r') && (mode != 'R')){
+                                                        if (axismode != 0)
+                                                                break;
 							ax += 1;
 							if (mode == 's'){
 								if (ax == 4){ax=0;}
@@ -5306,6 +5329,12 @@
 						typemode = 1;
 						del = 0;
 						if (mode == 's'){
+                                                        if (axismode & XTRANS)
+                                                                ax = 1;
+                                                        if (axismode & YTRANS)
+                                                                ax = 2;
+                                                        if (axismode & ZTRANS)
+                                                                ax = 3;
 							if (ax == 0){
 								if (pe[0]){
 									int div = 1;
@@ -5377,6 +5406,12 @@
 							}
 						}
 						else{
+                                                        if (axismode & XTRANS)
+                                                                ax = 0;
+                                                        if (axismode & YTRANS)
+                                                                ax = 1;
+                                                        if (axismode & ZTRANS)
+                                                                ax = 2;
 							if (pe[ax]){
 								int div = 1;
 								int i;

--FCuugMFkClbJLl1L--