From ed6709260152f43478160d235bfd227b6036887b Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Wed, 17 Dec 2003 04:27:29 +0000 Subject: [PATCH] Nathanael Law's fix to make numerical input more compatible with axis constraints. I thought this was a nice addition, so I'm commiting it. To Ton for easier changelog creation: When constraining to an axis, numerical input is limited (and will switch automaticly) to that axis. Original e-mail ------------------------------- 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 --- source/blender/src/editobject.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index c411a61da65..b42380392b1 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -5097,6 +5097,13 @@ void transform(int mode) else{ axismode= XTRANS; } + if (mode == 'g') { + if (axismode & XTRANS) + ax = 0; + } else if (mode == 's') { + if (axismode & XTRANS) + ax = 1; + } firsttime=1; break; @@ -5108,6 +5115,13 @@ void transform(int mode) else{ axismode= YTRANS; } + if (mode == 'g') { + if (axismode & YTRANS) + ax = 1; + } else if (mode == 's') { + if (axismode & YTRANS) + ax = 2; + } firsttime=1; break; @@ -5119,6 +5133,13 @@ void transform(int mode) 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 @@ void transform(int mode) 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 @@ void transform(int mode) 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 @@ void transform(int mode) } } else{ + if (axismode & XTRANS) + ax = 0; + if (axismode & YTRANS) + ax = 1; + if (axismode & ZTRANS) + ax = 2; if (pe[ax]){ int div = 1; int i;