|
|
|
|
@@ -424,7 +424,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
|
|
|
|
|
/* ------------ General Target Matrix Tools ---------- */
|
|
|
|
|
|
|
|
|
|
/* function that sets the given matrix based on given vertex group in mesh */
|
|
|
|
|
static void contarget_get_mesh_mat (Scene *scene, Object *ob, const char *substring, float mat[][4])
|
|
|
|
|
static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat[][4])
|
|
|
|
|
{
|
|
|
|
|
DerivedMesh *dm = NULL;
|
|
|
|
|
Mesh *me= ob->data;
|
|
|
|
|
@@ -580,7 +580,7 @@ static void contarget_get_lattice_mat (Object *ob, const char *substring, float
|
|
|
|
|
|
|
|
|
|
/* generic function to get the appropriate matrix for most target cases */
|
|
|
|
|
/* The cases where the target can be object data have not been implemented */
|
|
|
|
|
static void constraint_target_to_mat4 (Scene *scene, Object *ob, const char *substring, float mat[][4], short from, short to, float headtail)
|
|
|
|
|
static void constraint_target_to_mat4 (Object *ob, const char *substring, float mat[][4], short from, short to, float headtail)
|
|
|
|
|
{
|
|
|
|
|
/* Case OBJECT */
|
|
|
|
|
if (!strlen(substring)) {
|
|
|
|
|
@@ -597,7 +597,7 @@ static void constraint_target_to_mat4 (Scene *scene, Object *ob, const char *sub
|
|
|
|
|
* way as constraints can only really affect things on object/bone level.
|
|
|
|
|
*/
|
|
|
|
|
else if (ob->type == OB_MESH) {
|
|
|
|
|
contarget_get_mesh_mat(scene, ob, substring, mat);
|
|
|
|
|
contarget_get_mesh_mat(ob, substring, mat);
|
|
|
|
|
constraint_mat_convertspace(ob, NULL, mat, from, to);
|
|
|
|
|
}
|
|
|
|
|
else if (ob->type == OB_LATTICE) {
|
|
|
|
|
@@ -677,10 +677,10 @@ static bConstraintTypeInfo CTI_CONSTRNAME = {
|
|
|
|
|
/* This function should be used for the get_target_matrix member of all
|
|
|
|
|
* constraints that are not picky about what happens to their target matrix.
|
|
|
|
|
*/
|
|
|
|
|
static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
|
|
|
|
|
static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime))
|
|
|
|
|
{
|
|
|
|
|
if (VALID_CONS_TARGET(ct))
|
|
|
|
|
constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
else if (ct)
|
|
|
|
|
unit_m4(ct->matrix);
|
|
|
|
|
}
|
|
|
|
|
@@ -1152,7 +1152,7 @@ static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstra
|
|
|
|
|
bKinematicConstraint *data= con->data;
|
|
|
|
|
|
|
|
|
|
if (VALID_CONS_TARGET(ct))
|
|
|
|
|
constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
else if (ct) {
|
|
|
|
|
if (data->flag & CONSTRAINT_IK_AUTO) {
|
|
|
|
|
Object *ob= cob->ob;
|
|
|
|
|
@@ -2039,7 +2039,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT
|
|
|
|
|
/* firstly calculate the matrix the normal way, then let the py-function override
|
|
|
|
|
* this matrix if it needs to do so
|
|
|
|
|
*/
|
|
|
|
|
constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
|
|
|
|
|
/* only execute target calculation if allowed */
|
|
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
|
@@ -2158,7 +2158,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
|
|
|
|
|
unit_m4(ct->matrix);
|
|
|
|
|
|
|
|
|
|
/* get the transform matrix of the target */
|
|
|
|
|
constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
|
|
|
|
|
|
|
|
|
|
/* determine where in transform range target is */
|
|
|
|
|
/* data->type is mapped as follows for backwards compatability:
|
|
|
|
|
@@ -2209,7 +2209,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
|
|
|
|
|
tchan->rotmode= pchan->rotmode;
|
|
|
|
|
|
|
|
|
|
/* evaluate action using workob (it will only set the PoseChannel in question) */
|
|
|
|
|
what_does_obaction(cob->scene, cob->ob, &workob, pose, data->act, pchan->name, t);
|
|
|
|
|
what_does_obaction(cob->ob, &workob, pose, data->act, pchan->name, t);
|
|
|
|
|
|
|
|
|
|
/* convert animation to matrices for use here */
|
|
|
|
|
pchan_calc_mat(tchan);
|
|
|
|
|
@@ -2223,7 +2223,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
|
|
|
|
|
|
|
|
|
|
/* evaluate using workob */
|
|
|
|
|
// FIXME: we don't have any consistent standards on limiting effects on object...
|
|
|
|
|
what_does_obaction(cob->scene, cob->ob, &workob, NULL, data->act, NULL, t);
|
|
|
|
|
what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t);
|
|
|
|
|
object_to_mat4(&workob, ct->matrix);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|