diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-12-06 05:57:47 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-12-06 05:57:47 +0300 |
commit | df1db2073759939fb8bec905eb99321efc3bd04b (patch) | |
tree | 8e174c0d0cf0da17e6e41c263edf0aeca3459fb8 /source/blender/src/transform.c | |
parent | 26b8892c9c6733e2716df4aa84d02e3ff5331735 (diff) |
== LimitLoc Transform - Tweaks ==
* Made 'cob' be a stack var instead of allocating memory (as suggested by Martin)
* Adjusted the position of "Trans" button in panel, and changed its name/tooltip to better describe its function
* 'Active' constraint now draws brighter than other constraints... this is still not clear enough though.
Diffstat (limited to 'source/blender/src/transform.c')
-rw-r--r-- | source/blender/src/transform.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 637bed97abd..8a38c66738f 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -1318,23 +1318,23 @@ static void constraintTransLim(TransInfo *t, TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); - bConstraintOb *cob; + bConstraintOb cob; bConstraint *con; /* Make a temporary bConstraintOb for using these limit constraints * - they only care that cob->matrix is correctly set ;-) * - current space should be local */ - cob= MEM_callocN(sizeof(bConstraintOb), "bConstraintOb-Transform"); - Mat4One(cob->matrix); + memset(&cob, 0, sizeof(bConstraintOb)); + Mat4One(cob.matrix); if (td->tdi) { TransDataIpokey *tdi= td->tdi; - cob->matrix[3][0]= tdi->locx[0]; - cob->matrix[3][1]= tdi->locy[0]; - cob->matrix[3][2]= tdi->locz[0]; + cob.matrix[3][0]= tdi->locx[0]; + cob.matrix[3][1]= tdi->locy[0]; + cob.matrix[3][2]= tdi->locz[0]; } else { - VECCOPY(cob->matrix[3], td->loc); + VECCOPY(cob.matrix[3], td->loc); } /* Evaluate valid constraints */ @@ -1351,8 +1351,8 @@ static void constraintTransLim(TransInfo *t, TransData *td) /* do space conversions */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { /* just multiply by td->mtx (this should be ok) */ - Mat4CpyMat4(tmat, cob->matrix); - Mat4MulMat34(cob->matrix, td->mtx, tmat); // checkme + Mat4CpyMat4(tmat, cob.matrix); + Mat4MulMat34(cob.matrix, td->mtx, tmat); // checkme } else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) { /* skip... incompatable spacetype */ @@ -1360,28 +1360,27 @@ static void constraintTransLim(TransInfo *t, TransData *td) } /* do constraint */ - cti->evaluate_constraint(con, cob, NULL); + cti->evaluate_constraint(con, &cob, NULL); /* convert spaces again */ if (con->ownspace == CONSTRAINT_SPACE_WORLD) { /* just multiply by td->mtx (this should be ok) */ - Mat4CpyMat4(tmat, cob->matrix); - Mat4MulMat34(cob->matrix, td->smtx, tmat); // checkme + Mat4CpyMat4(tmat, cob.matrix); + Mat4MulMat34(cob.matrix, td->smtx, tmat); // checkme } } } - /* copy results from cob->matrix, and free */ + /* copy results from cob->matrix */ if (td->tdi) { TransDataIpokey *tdi= td->tdi; - tdi->locx[0]= cob->matrix[3][0]; - tdi->locy[0]= cob->matrix[3][1]; - tdi->locz[0]= cob->matrix[3][2]; + tdi->locx[0]= cob.matrix[3][0]; + tdi->locy[0]= cob.matrix[3][1]; + tdi->locz[0]= cob.matrix[3][2]; } else { - VECCOPY(td->loc, cob->matrix[3]); + VECCOPY(td->loc, cob.matrix[3]); } - MEM_freeN(cob); } } |