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:
authorTon Roosendaal <ton@blender.org>2005-03-25 14:17:59 +0300
committerTon Roosendaal <ton@blender.org>2005-03-25 14:17:59 +0300
commit727a056de4e83ee0013c9007ec8d6b9de8863c4c (patch)
tree93caea9dcfc89f35d8f6da7f3f81f28c7ab20595 /source/blender/src/transform_constraints.c
parentcf30d9443d76b2502a91b1d3f20847c85d3b88e8 (diff)
A couple of wee transform featurettes;
- center of rotation for camera in cameraview rotate has to remain the camera center itself, drawing the dashed helpline then doesn't work, since it's behind the camera clipplane. Just disabled that line. - made MMB switch for cameraview grab to become quadratic, for a dolly this feels OK, and makes it possible to move in small and large scenes. - restored SHIFT modifier for translation and scaling. This based on old convention that allowed precision editing on top of the transform you already applied before pressing SHIFT. Solved it with a new flag (T_SHIFT_MOD), since the G.qual cannot be used. Transform() innerloop has to detect the SHIFT event itself. Also coded it with storing the mouseposition while SHIFT event happened. Hope Martin can approve! :) - Martin's last commit made Manipulator Translate not work, it passed on a zero translation to the constrainter, causing NaN's. Nicely catched the exception. - Fixed 'Trackball' to accept number input too
Diffstat (limited to 'source/blender/src/transform_constraints.c')
-rwxr-xr-xsource/blender/src/transform_constraints.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index dc99d6209a5..1d66e7e92e0 100755
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -203,21 +203,27 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
/* 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(n[0]*n[0] + n[1]*n[1] + n[2]*n[2] < 0.000001) {
+ if(n[0]*n[0] + n[1]*n[1] + n[2]*n[2] < 0.000001f) {
Projf(vec, in, t->viewinv[1]);
factor = Inpf(t->viewinv[1], vec) * 2.0f;
-
+ /* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
+ if(factor<0.0f) factor*= -factor;
+ else factor*= factor;
+
VECCOPY(out, axis);
Normalise(out);
- VecMulf(out, factor);
+ VecMulf(out, -factor); /* -factor makes move down going backwards */
}
else {
- Projf(vec, in, n);
- factor = Normalise(vec);
- factor /= Inpf(axis, vec);
+ // prevent division by zero, happens on constrainting without initial delta transform */
+ if(in[0]!=0.0f || in[1]!=0.0f || in[2]!=0.0) {
+ Projf(vec, in, n);
+ factor = Normalise(vec);
+ factor /= Inpf(axis, vec);
- VecMulf(axis, factor);
- VECCOPY(out, axis);
+ VecMulf(axis, factor);
+ VECCOPY(out, axis);
+ }
}
}