[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26010] trunk/blender/source/blender/ editors/transform/transform_constraints.c: 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.
Martin Poirier
theeth at yahoo.com
Fri Jan 15 01:35:22 CET 2010
Revision: 26010
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26010
Author: theeth
Date: 2010-01-15 01:35:21 +0100 (Fri, 15 Jan 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/transform/transform_constraints.c
Modified: trunk/blender/source/blender/editors/transform/transform_constraints.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_constraints.c 2010-01-14 23:59:13 UTC (rev 26009)
+++ trunk/blender/source/blender/editors/transform/transform_constraints.c 2010-01-15 00:35:21 UTC (rev 26010)
@@ -198,15 +198,23 @@
}
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 */
More information about the Bf-blender-cvs
mailing list