forked from bartvdbraak/blender
Local axis constraints for pose mode. Added
Camera rotation fix (was off centered because it used persinv instead of viewinv. Now rotation center is always center screen in camera mode. (Still need to fix the helpline not showing) Numinput constraint function was no good, didn't check if a constraint was even on... Fixed. Rotation was missing constraint text in header print. Fixed.
This commit is contained in:
parent
589ce4a005
commit
c1a7b8b7a1
@ -1000,7 +1000,9 @@ int Resize(TransInfo *t, short mval[2])
|
||||
float obsizemat[3][3];
|
||||
// Reorient the size mat to fit the oriented object.
|
||||
Mat3MulMat3(obsizemat, tmat, td->axismtx);
|
||||
//printmatrix3("obsizemat", obsizemat);
|
||||
Mat3ToSize(obsizemat, fsize);
|
||||
//printvecf("fsize", fsize);
|
||||
}
|
||||
else {
|
||||
Mat3ToSize(tmat, fsize);
|
||||
@ -1374,7 +1376,7 @@ int Rotation(TransInfo *t, short mval[2])
|
||||
final *= (float)(M_PI / 180.0);
|
||||
}
|
||||
else {
|
||||
sprintf(str, "Rot: %.2f %s", 180.0*final/M_PI, t->proptext);
|
||||
sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext);
|
||||
}
|
||||
|
||||
VecRotToMat3(axis, final * td->factor, mat);
|
||||
|
@ -114,36 +114,38 @@ void getConstraintMatrix(TransInfo *t);
|
||||
void constraintNumInput(TransInfo *t, float vec[3])
|
||||
{
|
||||
int mode = t->con.mode;
|
||||
float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
|
||||
if (mode & CON_APPLY) {
|
||||
float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
|
||||
|
||||
if (getConstraintSpaceDimension(t) == 2) {
|
||||
if (mode & (CON_AXIS0|CON_AXIS1)) {
|
||||
vec[2] = nval;
|
||||
if (getConstraintSpaceDimension(t) == 2) {
|
||||
if (mode & (CON_AXIS0|CON_AXIS1)) {
|
||||
vec[2] = nval;
|
||||
}
|
||||
else if (mode & (CON_AXIS1|CON_AXIS2)) {
|
||||
vec[2] = vec[1];
|
||||
vec[1] = vec[0];
|
||||
vec[0] = nval;
|
||||
}
|
||||
else if (mode & (CON_AXIS0|CON_AXIS2)) {
|
||||
vec[2] = vec[1];
|
||||
vec[1] = nval;
|
||||
}
|
||||
}
|
||||
else if (mode & (CON_AXIS1|CON_AXIS2)) {
|
||||
vec[2] = vec[1];
|
||||
vec[1] = vec[0];
|
||||
vec[0] = nval;
|
||||
}
|
||||
else if (mode & (CON_AXIS0|CON_AXIS2)) {
|
||||
vec[2] = vec[1];
|
||||
vec[1] = nval;
|
||||
}
|
||||
}
|
||||
else if (getConstraintSpaceDimension(t) == 1) {
|
||||
if (mode & CON_AXIS0) {
|
||||
vec[1] = nval;
|
||||
vec[2] = nval;
|
||||
}
|
||||
else if (mode & CON_AXIS1) {
|
||||
vec[1] = vec[0];
|
||||
vec[0] = nval;
|
||||
vec[2] = nval;
|
||||
}
|
||||
else if (mode & CON_AXIS2) {
|
||||
vec[2] = vec[0];
|
||||
vec[0] = nval;
|
||||
vec[1] = nval;
|
||||
else if (getConstraintSpaceDimension(t) == 1) {
|
||||
if (mode & CON_AXIS0) {
|
||||
vec[1] = nval;
|
||||
vec[2] = nval;
|
||||
}
|
||||
else if (mode & CON_AXIS1) {
|
||||
vec[1] = vec[0];
|
||||
vec[0] = nval;
|
||||
vec[2] = nval;
|
||||
}
|
||||
else if (mode & CON_AXIS2) {
|
||||
vec[2] = vec[0];
|
||||
vec[0] = nval;
|
||||
vec[1] = nval;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,6 +432,9 @@ static void add_pose_transdata(TransInfo *t, ListBase *lb, Object *ob, TransData
|
||||
|
||||
Mat3CpyMat4 (td->mtx, parmat);
|
||||
Mat3Inv (td->smtx, td->mtx);
|
||||
|
||||
Mat3CpyMat3(td->axismtx, td->mtx);
|
||||
Mat3Ortho(td->axismtx);
|
||||
|
||||
(*tdp)++;
|
||||
deeper= 0;
|
||||
|
@ -697,13 +697,14 @@ void calculateCenter(TransInfo *t)
|
||||
if(t->flag & T_OBJECT) {
|
||||
if( G.vd->camera==OBACT && G.vd->persp>1) {
|
||||
float axis[3];
|
||||
VECCOPY(axis, G.vd->persinv[2]);
|
||||
/* persinv is nasty, use viewinv instead, always right */
|
||||
VECCOPY(axis, G.vd->viewinv[2]);
|
||||
Normalise(axis);
|
||||
|
||||
/* 6.0 = 6 grid units */
|
||||
axis[0]= t->center[0]+ 6.0f*axis[0];
|
||||
axis[1]= t->center[1]+ 6.0f*axis[1];
|
||||
axis[2]= t->center[2]+ 6.0f*axis[2];
|
||||
axis[0]= t->center[0]- 6.0f*axis[0];
|
||||
axis[1]= t->center[1]- 6.0f*axis[1];
|
||||
axis[2]= t->center[2]- 6.0f*axis[2];
|
||||
|
||||
project_short_noclip(axis, t->center2d);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user