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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user