Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2010-01-15 03:35:21 +0300
committerMartin Poirier <theeth@yahoo.com>2010-01-15 03:35:21 +0300
commit01236d49f94e30efed5c151ebfd9a2a0d3b1ee69 (patch)
treeb668bbe71a3fce7955b358b1eedf249b452cd33b /source/blender
parent4770cc031d6897a9384f39e61eadba3b8ace8250 (diff)
Transform Constraints: When axis is quasi perpendicular to the screen (within 5 degrees), it uses vertical motion of the mouse instead of normal axis projection. This behavior isn't new, but the 5 degrees limit is (it's also the limit at which manipulator axis disappear), it used to be much lower than that making small angles hard to manage.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/transform/transform_constraints.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index fd53f6fcd20..d8a738a2d45 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -198,15 +198,23 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
}
static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) {
- float norm[3], vec[3], factor;
+ float norm[3], vec[3], factor, angle;
if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
return;
+ print_v3("viewinv[2]", t->viewinv[2]);
+
+ angle = fabs(angle_v3v3(axis, t->viewinv[2]));
+ if (angle > M_PI / 2) {
+ angle = M_PI - angle;
+ }
+ angle = 180.0f * angle / M_PI;
+
/* For when view is parallel to constraint... will cause NaNs otherwise
So we take vertical motion in 3D space and apply it to the
constraint axis. Nice for camera grab + MMB */
- if(1.0f - fabs(dot_v3v3(axis, t->viewinv[2])) < 0.000001f) {
+ if(angle < 5.0f) {
project_v3_v3v3(vec, in, t->viewinv[1]);
factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */