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:
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c1650
1 files changed, 825 insertions, 825 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 9e47d136863..eed5ec49012 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -69,7 +69,7 @@
#include "BKE_constraint.h"
#include "BKE_displist.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h" /* for geometry targets */
+#include "BKE_DerivedMesh.h" /* for geometry targets */
#include "BKE_cdderivedmesh.h" /* for geometry targets */
#include "BKE_object.h"
#include "BKE_ipo.h"
@@ -90,7 +90,7 @@
#endif
#ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846
#endif
@@ -113,15 +113,15 @@ void unique_constraint_name(bConstraint *con, ListBase *list)
/* package an object/bone for use in constraint evaluation */
/* This function MEM_calloc's a bConstraintOb struct, that will need to be freed after evaluation */
-bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata, short datatype)
+bConstraintOb *constraints_make_evalob(Scene *scene, Object *ob, void *subdata, short datatype)
{
bConstraintOb *cob;
/* create regardless of whether we have any data! */
- cob= MEM_callocN(sizeof(bConstraintOb), "bConstraintOb");
+ cob = MEM_callocN(sizeof(bConstraintOb), "bConstraintOb");
/* for system time, part of deglobalization, code nicer later with local time (ton) */
- cob->scene= scene;
+ cob->scene = scene;
/* based on type of available data */
switch (datatype) {
@@ -139,7 +139,7 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
copy_m4_m4(cob->startmat, cob->matrix);
}
- break;
+ break;
case CONSTRAINT_OBTYPE_BONE:
{
/* only set if we have valid bone, otherwise default */
@@ -150,11 +150,11 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
if (cob->pchan->rotmode > 0) {
/* should be some type of Euler order */
- cob->rotOrder= cob->pchan->rotmode;
+ cob->rotOrder = cob->pchan->rotmode;
}
else {
/* Quats, so eulers should just use default order */
- cob->rotOrder= EULER_ORDER_DEFAULT;
+ cob->rotOrder = EULER_ORDER_DEFAULT;
}
/* matrix in world-space */
@@ -165,7 +165,7 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
copy_m4_m4(cob->startmat, cob->matrix);
}
- break;
+ break;
default: /* other types not yet handled */
unit_m4(cob->matrix);
@@ -202,7 +202,7 @@ void constraints_clear_evalob(bConstraintOb *cob)
invert_m4_m4(cob->ob->constinv, delta);
}
}
- break;
+ break;
case CONSTRAINT_OBTYPE_BONE:
{
/* cob->ob or cob->pchan might not exist */
@@ -214,7 +214,7 @@ void constraints_clear_evalob(bConstraintOb *cob)
invert_m4_m4(cob->pchan->constinv, delta);
}
}
- break;
+ break;
}
/* free tempolary struct */
@@ -278,7 +278,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
float imat[4][4];
/* prevent crashes in these unlikely events */
- if (ob==NULL || mat==NULL) return;
+ if (ob == NULL || mat == NULL) return;
/* optimize trick - check if need to do anything */
if (from == to) return;
@@ -298,8 +298,8 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}
}
- break;
- case CONSTRAINT_SPACE_POSE: /* ---------- FROM POSESPACE ---------- */
+ break;
+ case CONSTRAINT_SPACE_POSE: /* ---------- FROM POSESPACE ---------- */
{
/* pose to world */
if (to == CONSTRAINT_SPACE_WORLD) {
@@ -331,7 +331,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
}
}
}
- break;
+ break;
case CONSTRAINT_SPACE_LOCAL: /* ------------ FROM LOCALSPACE --------- */
{
/* local to pose - do inverse procedure that was done for pose to local */
@@ -351,7 +351,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}
}
- break;
+ break;
case CONSTRAINT_SPACE_PARLOCAL: /* -------------- FROM LOCAL WITH PARENT ---------- */
{
/* local + parent to pose */
@@ -366,12 +366,12 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to);
}
}
- break;
+ break;
}
}
else {
/* objects */
- if (from==CONSTRAINT_SPACE_WORLD && to==CONSTRAINT_SPACE_LOCAL) {
+ if (from == CONSTRAINT_SPACE_WORLD && to == CONSTRAINT_SPACE_LOCAL) {
/* check if object has a parent */
if (ob->parent) {
/* 'subtract' parent's effects from owner */
@@ -391,7 +391,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4]
mult_m4_m4m4(mat, imat, mat);
}
}
- else if (from==CONSTRAINT_SPACE_LOCAL && to==CONSTRAINT_SPACE_WORLD) {
+ else if (from == CONSTRAINT_SPACE_LOCAL && to == CONSTRAINT_SPACE_WORLD) {
/* check that object has a parent - otherwise this won't work */
if (ob->parent) {
/* 'add' parent's effect back to owner */
@@ -415,15 +415,15 @@ 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 (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;
+ Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
float vec[3] = {0.0f, 0.0f, 0.0f};
float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3];
float imat[3][3], tmat[3][3];
- const int defgroup= defgroup_name_index(ob, substring);
+ const int defgroup = defgroup_name_index(ob, substring);
short freeDM = 0;
/* initialize target matrix using target matrix */
@@ -436,7 +436,7 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
if (em) {
/* target is in editmode, so get a special derived mesh */
dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
- freeDM= 1;
+ freeDM = 1;
}
else {
/* when not in EditMode, use the 'final' derived mesh, depsgraph
@@ -454,10 +454,10 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
/* check that dvert is a valid pointers (just in case) */
if (dvert) {
- MDeformVert *dv= dvert;
+ MDeformVert *dv = dvert;
/* get the average of all verts with that are in the vertex-group */
for (i = 0; i < numVerts; i++, dv++) {
- MDeformWeight *dw= defvert_find_index(dv, defgroup);
+ MDeformWeight *dw = defvert_find_index(dv, defgroup);
if (dw && dw->weight != 0.0f) {
dm->getVertCo(dm, i, co);
dm->getVertNo(dm, i, nor);
@@ -512,20 +512,20 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
}
/* function that sets the given matrix based on given vertex group in lattice */
-static void contarget_get_lattice_mat (Object *ob, const char *substring, float mat[][4])
+static void contarget_get_lattice_mat(Object *ob, const char *substring, float mat[][4])
{
- Lattice *lt= (Lattice *)ob->data;
+ Lattice *lt = (Lattice *)ob->data;
DispList *dl = find_displist(&ob->disp, DL_VERTS);
- float *co = dl?dl->verts:NULL;
+ float *co = dl ? dl->verts : NULL;
BPoint *bp = lt->def;
MDeformVert *dv = lt->dvert;
- int tot_verts= lt->pntsu*lt->pntsv*lt->pntsw;
- float vec[3]= {0.0f, 0.0f, 0.0f}, tvec[3];
- int grouped=0;
+ int tot_verts = lt->pntsu * lt->pntsv * lt->pntsw;
+ float vec[3] = {0.0f, 0.0f, 0.0f}, tvec[3];
+ int grouped = 0;
int i, n;
- const int defgroup= defgroup_name_index(ob, substring);
+ const int defgroup = defgroup_name_index(ob, substring);
/* initialize target matrix using target matrix */
copy_m4_m4(mat, ob->obmat);
@@ -537,9 +537,9 @@ static void contarget_get_lattice_mat (Object *ob, const char *substring, float
/* 1. Loop through control-points checking if in nominated vertex-group.
* 2. If it is, add it to vec to find the average point.
*/
- for (i=0; i < tot_verts; i++, dv++) {
- for (n= 0; n < dv->totweight; n++) {
- MDeformWeight *dw= defvert_find_index(dv, defgroup);
+ for (i = 0; i < tot_verts; i++, dv++) {
+ for (n = 0; n < dv->totweight; n++) {
+ MDeformWeight *dw = defvert_find_index(dv, defgroup);
if (dw && dw->weight > 0.0f) {
/* copy coordinates of point to temporary vector, then add to find average */
memcpy(tvec, co ? co : bp->vec, 3 * sizeof(float));
@@ -551,7 +551,7 @@ static void contarget_get_lattice_mat (Object *ob, const char *substring, float
/* advance pointer to coordinate data */
if (co) co += 3;
- else bp++;
+ else bp++;
}
/* find average location, then multiply by ob->obmat to find world-space location */
@@ -565,14 +565,14 @@ 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 (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)) {
copy_m4_m4(mat, ob->obmat);
constraint_mat_convertspace(ob, NULL, mat, from, to);
}
- /* Case VERTEXGROUP */
+ /* Case VERTEXGROUP */
/* Current method just takes the average location of all the points in the
* VertexGroup, and uses that as the location value of the targets. Where
* possible, the orientation will also be calculated, by calculating an
@@ -631,14 +631,14 @@ static void constraint_target_to_mat4 (Object *ob, const char *substring, float
*/
/* Template for type-info data:
- * - make a copy of this when creating new constraints, and just change the functions
- * pointed to as necessary
- * - although the naming of functions doesn't matter, it would help for code
- * readability, to follow the same naming convention as is presented here
- * - any functions that a constraint doesn't need to define, don't define
- * for such cases, just use NULL
- * - these should be defined after all the functions have been defined, so that
- * forward-definitions/prototypes don't need to be used!
+ * - make a copy of this when creating new constraints, and just change the functions
+ * pointed to as necessary
+ * - although the naming of functions doesn't matter, it would help for code
+ * readability, to follow the same naming convention as is presented here
+ * - any functions that a constraint doesn't need to define, don't define
+ * for such cases, just use NULL
+ * - these should be defined after all the functions have been defined, so that
+ * forward-definitions/prototypes don't need to be used!
* - keep this copy #if-def'd so that future constraints can get based off this
*/
#if 0
@@ -661,7 +661,7 @@ 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 *UNUSED(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(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
@@ -677,26 +677,26 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
// TODO: cope with getting rotation order...
#define SINGLETARGET_GET_TARS(con, datatar, datasubtarget, ct, list) \
{ \
- ct= MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \
+ ct = MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \
\
- ct->tar= datatar; \
+ ct->tar = datatar; \
BLI_strncpy(ct->subtarget, datasubtarget, sizeof(ct->subtarget)); \
- ct->space= con->tarspace; \
- ct->flag= CONSTRAINT_TAR_TEMP; \
+ ct->space = con->tarspace; \
+ ct->flag = CONSTRAINT_TAR_TEMP; \
\
if (ct->tar) { \
- if ((ct->tar->type==OB_ARMATURE) && (ct->subtarget[0])) { \
- bPoseChannel *pchan= BKE_pose_channel_find_name(ct->tar->pose, ct->subtarget); \
+ if ((ct->tar->type == OB_ARMATURE) && (ct->subtarget[0])) { \
+ bPoseChannel *pchan = BKE_pose_channel_find_name(ct->tar->pose, ct->subtarget); \
ct->type = CONSTRAINT_OBTYPE_BONE; \
- ct->rotOrder= (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \
- }\
+ ct->rotOrder = (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \
+ } \
else if (OB_TYPE_SUPPORT_VGROUP(ct->tar->type) && (ct->subtarget[0])) { \
ct->type = CONSTRAINT_OBTYPE_VERT; \
ct->rotOrder = EULER_ORDER_DEFAULT; \
} \
- else {\
+ else { \
ct->type = CONSTRAINT_OBTYPE_OBJECT; \
- ct->rotOrder= ct->tar->rotmode; \
+ ct->rotOrder = ct->tar->rotmode; \
} \
} \
\
@@ -711,11 +711,11 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
// TODO: cope with getting rotation order...
#define SINGLETARGETNS_GET_TARS(con, datatar, ct, list) \
{ \
- ct= MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \
+ ct = MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \
\
- ct->tar= datatar; \
- ct->space= con->tarspace; \
- ct->flag= CONSTRAINT_TAR_TEMP; \
+ ct->tar = datatar; \
+ ct->space = con->tarspace; \
+ ct->flag = CONSTRAINT_TAR_TEMP; \
\
if (ct->tar) ct->type = CONSTRAINT_OBTYPE_OBJECT; \
\
@@ -733,13 +733,13 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
if (ct) { \
bConstraintTarget *ctn = ct->next; \
if (nocopy == 0) { \
- datatar= ct->tar; \
+ datatar = ct->tar; \
BLI_strncpy(datasubtarget, ct->subtarget, sizeof(datasubtarget)); \
- con->tarspace= (char)ct->space; \
+ con->tarspace = (char)ct->space; \
} \
\
BLI_freelinkN(list, ct); \
- ct= ctn; \
+ ct = ctn; \
} \
}
@@ -754,39 +754,39 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
if (ct) { \
bConstraintTarget *ctn = ct->next; \
if (nocopy == 0) { \
- datatar= ct->tar; \
- con->tarspace= (char)ct->space; \
+ datatar = ct->tar; \
+ con->tarspace = (char)ct->space; \
} \
\
BLI_freelinkN(list, ct); \
- ct= ctn; \
+ ct = ctn; \
} \
}
/* --------- ChildOf Constraint ------------ */
-static void childof_new_data (void *cdata)
+static void childof_new_data(void *cdata)
{
- bChildOfConstraint *data= (bChildOfConstraint *)cdata;
+ bChildOfConstraint *data = (bChildOfConstraint *)cdata;
data->flag = (CHILDOF_LOCX | CHILDOF_LOCY | CHILDOF_LOCZ |
- CHILDOF_ROTX |CHILDOF_ROTY | CHILDOF_ROTZ |
- CHILDOF_SIZEX | CHILDOF_SIZEY | CHILDOF_SIZEZ);
+ CHILDOF_ROTX | CHILDOF_ROTY | CHILDOF_ROTZ |
+ CHILDOF_SIZEX | CHILDOF_SIZEY | CHILDOF_SIZEZ);
unit_m4(data->invmat);
}
-static void childof_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void childof_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bChildOfConstraint *data= con->data;
+ bChildOfConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int childof_get_tars (bConstraint *con, ListBase *list)
+static int childof_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bChildOfConstraint *data= con->data;
+ bChildOfConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -798,21 +798,21 @@ static int childof_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void childof_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void childof_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bChildOfConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bChildOfConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bChildOfConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bChildOfConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
@@ -849,15 +849,15 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
mat4_to_size(sizo, invmat);
/* disable channels not enabled */
- if (!(data->flag & CHILDOF_LOCX)) loc[0]= loco[0]= 0.0f;
- if (!(data->flag & CHILDOF_LOCY)) loc[1]= loco[1]= 0.0f;
- if (!(data->flag & CHILDOF_LOCZ)) loc[2]= loco[2]= 0.0f;
- if (!(data->flag & CHILDOF_ROTX)) eul[0]= eulo[0]= 0.0f;
- if (!(data->flag & CHILDOF_ROTY)) eul[1]= eulo[1]= 0.0f;
- if (!(data->flag & CHILDOF_ROTZ)) eul[2]= eulo[2]= 0.0f;
- if (!(data->flag & CHILDOF_SIZEX)) size[0]= sizo[0]= 1.0f;
- if (!(data->flag & CHILDOF_SIZEY)) size[1]= sizo[1]= 1.0f;
- if (!(data->flag & CHILDOF_SIZEZ)) size[2]= sizo[2]= 1.0f;
+ if (!(data->flag & CHILDOF_LOCX)) loc[0] = loco[0] = 0.0f;
+ if (!(data->flag & CHILDOF_LOCY)) loc[1] = loco[1] = 0.0f;
+ if (!(data->flag & CHILDOF_LOCZ)) loc[2] = loco[2] = 0.0f;
+ if (!(data->flag & CHILDOF_ROTX)) eul[0] = eulo[0] = 0.0f;
+ if (!(data->flag & CHILDOF_ROTY)) eul[1] = eulo[1] = 0.0f;
+ if (!(data->flag & CHILDOF_ROTZ)) eul[2] = eulo[2] = 0.0f;
+ if (!(data->flag & CHILDOF_SIZEX)) size[0] = sizo[0] = 1.0f;
+ if (!(data->flag & CHILDOF_SIZEY)) size[1] = sizo[1] = 1.0f;
+ if (!(data->flag & CHILDOF_SIZEZ)) size[2] = sizo[2] = 1.0f;
/* make new target mat and offset mat */
loc_eulO_size_to_mat4(ct->matrix, loc, eul, size, ct->rotOrder);
@@ -877,9 +877,9 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
/* without this, changes to scale and rotation can change location
* of a parentless bone or a disconnected bone. Even though its set
* to zero above. */
- if (!(data->flag & CHILDOF_LOCX)) cob->matrix[3][0]= tempmat[3][0];
- if (!(data->flag & CHILDOF_LOCY)) cob->matrix[3][1]= tempmat[3][1];
- if (!(data->flag & CHILDOF_LOCZ)) cob->matrix[3][2]= tempmat[3][2];
+ if (!(data->flag & CHILDOF_LOCX)) cob->matrix[3][0] = tempmat[3][0];
+ if (!(data->flag & CHILDOF_LOCY)) cob->matrix[3][1] = tempmat[3][1];
+ if (!(data->flag & CHILDOF_LOCZ)) cob->matrix[3][2] = tempmat[3][2];
}
}
}
@@ -902,26 +902,26 @@ static bConstraintTypeInfo CTI_CHILDOF = {
/* -------- TrackTo Constraint ------- */
-static void trackto_new_data (void *cdata)
+static void trackto_new_data(void *cdata)
{
- bTrackToConstraint *data= (bTrackToConstraint *)cdata;
+ bTrackToConstraint *data = (bTrackToConstraint *)cdata;
data->reserved1 = TRACK_Y;
data->reserved2 = UP_Z;
}
-static void trackto_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void trackto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bTrackToConstraint *data= con->data;
+ bTrackToConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int trackto_get_tars (bConstraint *con, ListBase *list)
+static int trackto_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bTrackToConstraint *data= con->data;
+ bTrackToConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -933,11 +933,11 @@ static int trackto_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void trackto_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void trackto_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bTrackToConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bTrackToConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
@@ -945,9 +945,9 @@ static void trackto_flush_tars (bConstraint *con, ListBase *list, short nocopy)
}
-static int basis_cross (int n, int m)
+static int basis_cross(int n, int m)
{
- switch (n-m) {
+ switch (n - m) {
case 1:
case -2:
return 1;
@@ -961,7 +961,7 @@ static int basis_cross (int n, int m)
}
}
-static void vectomat (float *vec, float *target_up, short axis, short upflag, short flags, float m[][3])
+static void vectomat(float *vec, float *target_up, short axis, short upflag, short flags, float m[][3])
{
float n[3];
float u[3]; /* vector specifying the up axis */
@@ -1025,10 +1025,10 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh
}
-static void trackto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bTrackToConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bTrackToConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float size[3], vec[3];
@@ -1039,23 +1039,23 @@ static void trackto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
mat4_to_size(size, cob->matrix);
/* Clear the object's rotation */
- cob->matrix[0][0]=size[0];
- cob->matrix[0][1]=0;
- cob->matrix[0][2]=0;
- cob->matrix[1][0]=0;
- cob->matrix[1][1]=size[1];
- cob->matrix[1][2]=0;
- cob->matrix[2][0]=0;
- cob->matrix[2][1]=0;
- cob->matrix[2][2]=size[2];
+ cob->matrix[0][0] = size[0];
+ cob->matrix[0][1] = 0;
+ cob->matrix[0][2] = 0;
+ cob->matrix[1][0] = 0;
+ cob->matrix[1][1] = size[1];
+ cob->matrix[1][2] = 0;
+ cob->matrix[2][0] = 0;
+ cob->matrix[2][1] = 0;
+ cob->matrix[2][2] = size[2];
/* targetmat[2] instead of ownermat[2] is passed to vectomat
* for backwards compatibility it seems... (Aligorith)
*/
sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);
vectomat(vec, ct->matrix[2],
- (short)data->reserved1, (short)data->reserved2,
- data->flags, totmat);
+ (short)data->reserved1, (short)data->reserved2,
+ data->flags, totmat);
copy_m4_m4(tmat, cob->matrix);
mul_m4_m3m4(cob->matrix, totmat, tmat);
@@ -1079,32 +1079,32 @@ static bConstraintTypeInfo CTI_TRACKTO = {
/* --------- Inverse-Kinemetics --------- */
-static void kinematic_new_data (void *cdata)
+static void kinematic_new_data(void *cdata)
{
- bKinematicConstraint *data= (bKinematicConstraint *)cdata;
+ bKinematicConstraint *data = (bKinematicConstraint *)cdata;
- data->weight= 1.0f;
- data->orientweight= 1.0f;
+ data->weight = 1.0f;
+ data->orientweight = 1.0f;
data->iterations = 500;
- data->dist= 1.0f;
- data->flag= CONSTRAINT_IK_TIP|CONSTRAINT_IK_STRETCH|CONSTRAINT_IK_POS;
+ data->dist = 1.0f;
+ data->flag = CONSTRAINT_IK_TIP | CONSTRAINT_IK_STRETCH | CONSTRAINT_IK_POS;
}
-static void kinematic_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void kinematic_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bKinematicConstraint *data= con->data;
+ bKinematicConstraint *data = con->data;
/* chain target */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
/* poletarget */
- func(con, (ID**)&data->poletar, FALSE, userdata);
+ func(con, (ID **)&data->poletar, FALSE, userdata);
}
-static int kinematic_get_tars (bConstraint *con, ListBase *list)
+static int kinematic_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bKinematicConstraint *data= con->data;
+ bKinematicConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints is used twice here */
@@ -1117,11 +1117,11 @@ static int kinematic_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void kinematic_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void kinematic_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bKinematicConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bKinematicConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
@@ -1129,15 +1129,15 @@ static void kinematic_flush_tars (bConstraint *con, ListBase *list, short nocopy
}
}
-static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void kinematic_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
- bKinematicConstraint *data= con->data;
+ bKinematicConstraint *data = con->data;
if (VALID_CONS_TARGET(ct))
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;
+ Object *ob = cob->ob;
if (ob == NULL) {
unit_m4(ct->matrix);
@@ -1172,9 +1172,9 @@ static bConstraintTypeInfo CTI_KINEMATIC = {
/* -------- Follow-Path Constraint ---------- */
-static void followpath_new_data (void *cdata)
+static void followpath_new_data(void *cdata)
{
- bFollowPathConstraint *data= (bFollowPathConstraint *)cdata;
+ bFollowPathConstraint *data = (bFollowPathConstraint *)cdata;
data->trackflag = TRACK_Y;
data->upflag = UP_Z;
@@ -1182,18 +1182,18 @@ static void followpath_new_data (void *cdata)
data->followflag = 0;
}
-static void followpath_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void followpath_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bFollowPathConstraint *data= con->data;
+ bFollowPathConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int followpath_get_tars (bConstraint *con, ListBase *list)
+static int followpath_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bFollowPathConstraint *data= con->data;
+ bFollowPathConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints without subtargets */
@@ -1205,25 +1205,25 @@ static int followpath_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void followpath_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void followpath_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bFollowPathConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bFollowPathConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy)
}
}
-static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void followpath_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
- bFollowPathConstraint *data= con->data;
+ bFollowPathConstraint *data = con->data;
if (VALID_CONS_TARGET(ct)) {
- Curve *cu= ct->tar->data;
+ Curve *cu = ct->tar->data;
float vec[4], dir[3], radius;
- float totmat[4][4]= MAT4_UNITY;
+ float totmat[4][4] = MAT4_UNITY;
float curvetime;
unit_m4(ct->matrix);
@@ -1233,7 +1233,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
*/
/* only happens on reload file, but violates depsgraph still... fix! */
- if (cu->path==NULL || cu->path->data==NULL)
+ if (cu->path == NULL || cu->path->data == NULL)
makeDispListCurveTypes(cob->scene, ct->tar, 0);
if (cu->path && cu->path->data) {
@@ -1241,7 +1241,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
/* animated position along curve depending on time */
Nurb *nu = cu->nurb.first;
- curvetime= cu->ctime - data->offset;
+ curvetime = cu->ctime - data->offset;
/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
* but this will only work if it actually is animated...
@@ -1265,21 +1265,21 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
}
else {
/* fixed position along curve */
- curvetime= data->offset_fac;
+ curvetime = data->offset_fac;
}
- if ( where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/
+ if (where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/
if (data->followflag & FOLLOWPATH_FOLLOW) {
#if 0
float x1, q[4];
vec_to_quat(quat, dir, (short)data->trackflag, (short)data->upflag);
normalize_v3(dir);
- q[0]= (float)cos(0.5*vec[3]);
- x1= (float)sin(0.5*vec[3]);
- q[1]= -x1*dir[0];
- q[2]= -x1*dir[1];
- q[3]= -x1*dir[2];
+ q[0] = (float)cos(0.5 * vec[3]);
+ x1 = (float)sin(0.5 * vec[3]);
+ q[1] = -x1 * dir[0];
+ q[2] = -x1 * dir[1];
+ q[3] = -x1 * dir[2];
mul_qt_qtqt(quat, q, quat);
#else
quat_apply_track(quat, data->trackflag, data->upflag);
@@ -1305,15 +1305,15 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
unit_m4(ct->matrix);
}
-static void followpath_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void followpath_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bConstraintTarget *ct= targets->first;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
float obmat[4][4];
float size[3];
- bFollowPathConstraint *data= con->data;
+ bFollowPathConstraint *data = con->data;
/* get Object transform (loc/rot/size) to determine transformation from path */
// TODO: this used to be local at one point, but is probably more useful as-is
@@ -1326,7 +1326,7 @@ static void followpath_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
mul_serie_m4(cob->matrix, ct->matrix, obmat, NULL, NULL, NULL, NULL, NULL, NULL);
/* un-apply scaling caused by path */
- if ((data->followflag & FOLLOWPATH_RADIUS)==0) { /* XXX - assume that scale correction means that radius will have some scale error in it - Campbell */
+ if ((data->followflag & FOLLOWPATH_RADIUS) == 0) { /* XXX - assume that scale correction means that radius will have some scale error in it - Campbell */
float obsize[3];
mat4_to_size(obsize, cob->matrix);
@@ -1358,7 +1358,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = {
/* --------- Limit Location --------- */
-static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void loclimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bLocLimitConstraint *data = con->data;
@@ -1405,7 +1405,7 @@ static bConstraintTypeInfo CTI_LOCLIMIT = {
/* -------- Limit Rotation --------- */
-static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void rotlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bRotLimitConstraint *data = con->data;
float loc[3];
@@ -1463,7 +1463,7 @@ static bConstraintTypeInfo CTI_ROTLIMIT = {
/* --------- Limit Scaling --------- */
-static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
bSizeLimitConstraint *data = con->data;
float obsize[3], size[3];
@@ -1497,11 +1497,11 @@ static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
}
if (obsize[0])
- mul_v3_fl(cob->matrix[0], size[0]/obsize[0]);
+ mul_v3_fl(cob->matrix[0], size[0] / obsize[0]);
if (obsize[1])
- mul_v3_fl(cob->matrix[1], size[1]/obsize[1]);
+ mul_v3_fl(cob->matrix[1], size[1] / obsize[1]);
if (obsize[2])
- mul_v3_fl(cob->matrix[2], size[2]/obsize[2]);
+ mul_v3_fl(cob->matrix[2], size[2] / obsize[2]);
}
static bConstraintTypeInfo CTI_SIZELIMIT = {
@@ -1521,25 +1521,25 @@ static bConstraintTypeInfo CTI_SIZELIMIT = {
/* ----------- Copy Location ------------- */
-static void loclike_new_data (void *cdata)
+static void loclike_new_data(void *cdata)
{
- bLocateLikeConstraint *data= (bLocateLikeConstraint *)cdata;
+ bLocateLikeConstraint *data = (bLocateLikeConstraint *)cdata;
- data->flag = LOCLIKE_X|LOCLIKE_Y|LOCLIKE_Z;
+ data->flag = LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z;
}
-static void loclike_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void loclike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bLocateLikeConstraint *data= con->data;
+ bLocateLikeConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int loclike_get_tars (bConstraint *con, ListBase *list)
+static int loclike_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bLocateLikeConstraint *data= con->data;
+ bLocateLikeConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -1551,21 +1551,21 @@ static int loclike_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void loclike_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void loclike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bLocateLikeConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bLocateLikeConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void loclike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void loclike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bLocateLikeConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bLocateLikeConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float offset[3] = {0.0f, 0.0f, 0.0f};
@@ -1611,25 +1611,25 @@ static bConstraintTypeInfo CTI_LOCLIKE = {
/* ----------- Copy Rotation ------------- */
-static void rotlike_new_data (void *cdata)
+static void rotlike_new_data(void *cdata)
{
- bRotateLikeConstraint *data= (bRotateLikeConstraint *)cdata;
+ bRotateLikeConstraint *data = (bRotateLikeConstraint *)cdata;
- data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
+ data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z;
}
-static void rotlike_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void rotlike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bChildOfConstraint *data= con->data;
+ bChildOfConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int rotlike_get_tars (bConstraint *con, ListBase *list)
+static int rotlike_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bRotateLikeConstraint *data= con->data;
+ bRotateLikeConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -1641,26 +1641,26 @@ static int rotlike_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void rotlike_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void rotlike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bRotateLikeConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bRotateLikeConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bRotateLikeConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bRotateLikeConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
- float loc[3];
- float eul[3], obeul[3];
- float size[3];
+ float loc[3];
+ float eul[3], obeul[3];
+ float size[3];
copy_v3_v3(loc, cob->matrix[3]);
mat4_to_size(size, cob->matrix);
@@ -1670,7 +1670,7 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
/* we must get compatible eulers from the beginning because some of them can be modified below (see bug #21875) */
mat4_to_compatible_eulO(eul, obeul, cob->rotOrder, ct->matrix);
- if ((data->flag & ROTLIKE_X)==0)
+ if ((data->flag & ROTLIKE_X) == 0)
eul[0] = obeul[0];
else {
if (data->flag & ROTLIKE_OFFSET)
@@ -1680,7 +1680,7 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
eul[0] *= -1;
}
- if ((data->flag & ROTLIKE_Y)==0)
+ if ((data->flag & ROTLIKE_Y) == 0)
eul[1] = obeul[1];
else {
if (data->flag & ROTLIKE_OFFSET)
@@ -1690,7 +1690,7 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
eul[1] *= -1;
}
- if ((data->flag & ROTLIKE_Z)==0)
+ if ((data->flag & ROTLIKE_Z) == 0)
eul[2] = obeul[2];
else {
if (data->flag & ROTLIKE_OFFSET)
@@ -1723,25 +1723,25 @@ static bConstraintTypeInfo CTI_ROTLIKE = {
/* ---------- Copy Scaling ---------- */
-static void sizelike_new_data (void *cdata)
+static void sizelike_new_data(void *cdata)
{
- bSizeLikeConstraint *data= (bSizeLikeConstraint *)cdata;
+ bSizeLikeConstraint *data = (bSizeLikeConstraint *)cdata;
- data->flag = SIZELIKE_X|SIZELIKE_Y|SIZELIKE_Z;
+ data->flag = SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z;
}
-static void sizelike_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void sizelike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bSizeLikeConstraint *data= con->data;
+ bSizeLikeConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int sizelike_get_tars (bConstraint *con, ListBase *list)
+static int sizelike_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bSizeLikeConstraint *data= con->data;
+ bSizeLikeConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -1753,21 +1753,21 @@ static int sizelike_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void sizelike_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void sizelike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bSizeLikeConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bSizeLikeConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void sizelike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void sizelike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bSizeLikeConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bSizeLikeConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float obsize[3], size[3];
@@ -1819,18 +1819,18 @@ static bConstraintTypeInfo CTI_SIZELIKE = {
/* ----------- Copy Transforms ------------- */
-static void translike_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void translike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bTransLikeConstraint *data= con->data;
+ bTransLikeConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int translike_get_tars (bConstraint *con, ListBase *list)
+static int translike_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bTransLikeConstraint *data= con->data;
+ bTransLikeConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -1842,20 +1842,20 @@ static int translike_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void translike_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void translike_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bTransLikeConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bTransLikeConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void translike_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
+static void translike_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
- bConstraintTarget *ct= targets->first;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
/* just copy the entire transform matrix of the target */
@@ -1880,17 +1880,17 @@ static bConstraintTypeInfo CTI_TRANSLIKE = {
/* ---------- Maintain Volume ---------- */
-static void samevolume_new_data (void *cdata)
+static void samevolume_new_data(void *cdata)
{
- bSameVolumeConstraint *data= (bSameVolumeConstraint *)cdata;
+ bSameVolumeConstraint *data = (bSameVolumeConstraint *)cdata;
data->flag = SAMEVOL_Y;
data->volume = 1.0f;
}
-static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void samevolume_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
{
- bSameVolumeConstraint *data= con->data;
+ bSameVolumeConstraint *data = con->data;
float volume = data->volume;
float fac = 1.0f;
@@ -1936,9 +1936,9 @@ static bConstraintTypeInfo CTI_SAMEVOL = {
/* ----------- Python Constraint -------------- */
-static void pycon_free (bConstraint *con)
+static void pycon_free(bConstraint *con)
{
- bPythonConstraint *data= con->data;
+ bPythonConstraint *data = con->data;
/* id-properties */
IDP_FreeProperty(data->prop);
@@ -1948,7 +1948,7 @@ static void pycon_free (bConstraint *con)
BLI_freelistN(&data->targets);
}
-static void pycon_copy (bConstraint *con, bConstraint *srccon)
+static void pycon_copy(bConstraint *con, bConstraint *srccon)
{
bPythonConstraint *pycon = (bPythonConstraint *)con->data;
bPythonConstraint *opycon = (bPythonConstraint *)srccon->data;
@@ -1957,19 +1957,19 @@ static void pycon_copy (bConstraint *con, bConstraint *srccon)
BLI_duplicatelist(&pycon->targets, &opycon->targets);
}
-static void pycon_new_data (void *cdata)
+static void pycon_new_data(void *cdata)
{
- bPythonConstraint *data= (bPythonConstraint *)cdata;
+ bPythonConstraint *data = (bPythonConstraint *)cdata;
/* everything should be set correctly by calloc, except for the prop->type constant.*/
data->prop = MEM_callocN(sizeof(IDProperty), "PyConstraintProps");
data->prop->type = IDP_GROUP;
}
-static int pycon_get_tars (bConstraint *con, ListBase *list)
+static int pycon_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bPythonConstraint *data= con->data;
+ bPythonConstraint *data = con->data;
list->first = data->targets.first;
list->last = data->targets.last;
@@ -1980,33 +1980,33 @@ static int pycon_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void pycon_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void pycon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bPythonConstraint *data= con->data;
+ bPythonConstraint *data = con->data;
bConstraintTarget *ct;
/* targets */
- for (ct= data->targets.first; ct; ct= ct->next)
- func(con, (ID**)&ct->tar, FALSE, userdata);
+ for (ct = data->targets.first; ct; ct = ct->next)
+ func(con, (ID **)&ct->tar, FALSE, userdata);
/* script */
- func(con, (ID**)&data->text, TRUE, userdata);
+ func(con, (ID **)&data->text, TRUE, userdata);
}
/* Whether this approach is maintained remains to be seen (aligorith) */
-static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void pycon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
#ifdef WITH_PYTHON
- bPythonConstraint *data= con->data;
+ bPythonConstraint *data = con->data;
#endif
if (VALID_CONS_TARGET(ct)) {
/* special exception for curves - depsgraph issues */
if (ct->tar->type == OB_CURVE) {
- Curve *cu= ct->tar->data;
+ Curve *cu = ct->tar->data;
/* this check is to make sure curve objects get updated on file load correctly.*/
- if (cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */
+ if (cu->path == NULL || cu->path->data == NULL) /* only happens on reload file, but violates depsgraph still... fix! */
makeDispListCurveTypes(cob->scene, ct->tar, 0);
}
@@ -2025,16 +2025,16 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT
unit_m4(ct->matrix);
}
-static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void pycon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
#ifndef WITH_PYTHON
(void)con; (void)cob; (void)targets; /* unused */
return;
#else
- bPythonConstraint *data= con->data;
+ bPythonConstraint *data = con->data;
/* only evaluate in python if we're allowed to do so */
- if ((G.f & G_SCRIPT_AUTOEXEC)==0) return;
+ if ((G.f & G_SCRIPT_AUTOEXEC) == 0) return;
/* currently removed, until I this can be re-implemented for multiple targets */
#if 0
@@ -2067,29 +2067,29 @@ static bConstraintTypeInfo CTI_PYTHON = {
/* -------- Action Constraint ----------- */
-static void actcon_new_data (void *cdata)
+static void actcon_new_data(void *cdata)
{
- bActionConstraint *data= (bActionConstraint *)cdata;
+ bActionConstraint *data = (bActionConstraint *)cdata;
/* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */
data->type = 20;
}
-static void actcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void actcon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bActionConstraint *data= con->data;
+ bActionConstraint *data = con->data;
/* target */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
/* action */
- func(con, (ID**)&data->act, TRUE, userdata);
+ func(con, (ID **)&data->act, TRUE, userdata);
}
-static int actcon_get_tars (bConstraint *con, ListBase *list)
+static int actcon_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bActionConstraint *data= con->data;
+ bActionConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -2101,18 +2101,18 @@ static int actcon_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void actcon_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void actcon_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bActionConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bActionConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bActionConstraint *data = con->data;
@@ -2130,33 +2130,33 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
/* determine where in transform range target is */
/* data->type is mapped as follows for backwards compatibility:
* 00,01,02 - rotation (it used to be like this)
- * 10,11,12 - scaling
+ * 10,11,12 - scaling
* 20,21,22 - location
*/
if (data->type < 10) {
/* extract rotation (is in whatever space target should be in) */
mat4_to_eul(vec, tempmat);
mul_v3_fl(vec, RAD2DEGF(1.0f)); /* rad -> deg */
- axis= data->type;
+ axis = data->type;
}
else if (data->type < 20) {
/* extract scaling (is in whatever space target should be in) */
mat4_to_size(vec, tempmat);
- axis= data->type - 10;
+ axis = data->type - 10;
}
else {
/* extract location */
copy_v3_v3(vec, tempmat[3]);
- axis= data->type - 20;
+ axis = data->type - 20;
}
/* Target defines the animation */
- s = (vec[axis]-data->min) / (data->max-data->min);
+ s = (vec[axis] - data->min) / (data->max - data->min);
CLAMP(s, 0, 1);
- t = (s * (data->end-data->start)) + data->start;
+ t = (s * (data->end - data->start)) + data->start;
if (G.debug & G_DEBUG)
- printf("do Action Constraint %s - Ob %s Pchan %s\n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
+ printf("do Action Constraint %s - Ob %s Pchan %s\n", con->name, cob->ob->id.name + 2, (cob->pchan) ? cob->pchan->name : NULL);
/* Get the appropriate information from the action */
if (cob->type == CONSTRAINT_OBTYPE_BONE) {
@@ -2172,8 +2172,8 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
*/
pchan = cob->pchan;
- tchan= BKE_pose_channel_verify(pose, pchan->name);
- tchan->rotmode= pchan->rotmode;
+ tchan = BKE_pose_channel_verify(pose, pchan->name);
+ tchan->rotmode = pchan->rotmode;
/* evaluate action using workob (it will only set the PoseChannel in question) */
what_does_obaction(cob->ob, &workob, pose, data->act, pchan->name, t);
@@ -2200,9 +2200,9 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
}
}
-static void actcon_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
+static void actcon_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
- bConstraintTarget *ct= targets->first;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float temp[4][4];
@@ -2232,26 +2232,26 @@ static bConstraintTypeInfo CTI_ACTION = {
/* --------- Locked Track ---------- */
-static void locktrack_new_data (void *cdata)
+static void locktrack_new_data(void *cdata)
{
- bLockTrackConstraint *data= (bLockTrackConstraint *)cdata;
+ bLockTrackConstraint *data = (bLockTrackConstraint *)cdata;
data->trackflag = TRACK_Y;
data->lockflag = LOCK_Z;
}
-static void locktrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void locktrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bLockTrackConstraint *data= con->data;
+ bLockTrackConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int locktrack_get_tars (bConstraint *con, ListBase *list)
+static int locktrack_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bLockTrackConstraint *data= con->data;
+ bLockTrackConstraint *data = con->data;
bConstraintTarget *ct;
/* the following macro is used for all standard single-target constraints */
@@ -2263,21 +2263,21 @@ static int locktrack_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void locktrack_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void locktrack_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bLockTrackConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bLockTrackConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bLockTrackConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bLockTrackConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float vec[3], vec2[3];
@@ -2290,217 +2290,217 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
/* Vector object -> target */
sub_v3_v3v3(vec, ct->matrix[3], cob->matrix[3]);
switch (data->lockflag) {
- case LOCK_X: /* LOCK X */
- {
- switch (data->trackflag) {
- case TRACK_Y: /* LOCK X TRACK Y */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[0]);
- sub_v3_v3v3(totmat[1], vec, vec2);
- normalize_v3(totmat[1]);
+ case LOCK_X: /* LOCK X */
+ {
+ switch (data->trackflag) {
+ case TRACK_Y: /* LOCK X TRACK Y */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[0]);
+ sub_v3_v3v3(totmat[1], vec, vec2);
+ normalize_v3(totmat[1]);
- /* the x axis is fixed */
- normalize_v3_v3(totmat[0], cob->matrix[0]);
+ /* the x axis is fixed */
+ normalize_v3_v3(totmat[0], cob->matrix[0]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+ }
break;
- case TRACK_Z: /* LOCK X TRACK Z */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[0]);
- sub_v3_v3v3(totmat[2], vec, vec2);
- normalize_v3(totmat[2]);
+ case TRACK_Z: /* LOCK X TRACK Z */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[0]);
+ sub_v3_v3v3(totmat[2], vec, vec2);
+ normalize_v3(totmat[2]);
- /* the x axis is fixed */
- normalize_v3_v3(totmat[0], cob->matrix[0]);
+ /* the x axis is fixed */
+ normalize_v3_v3(totmat[0], cob->matrix[0]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+ }
break;
- case TRACK_nY: /* LOCK X TRACK -Y */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[0]);
- sub_v3_v3v3(totmat[1], vec, vec2);
- normalize_v3(totmat[1]);
- negate_v3(totmat[1]);
+ case TRACK_nY: /* LOCK X TRACK -Y */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[0]);
+ sub_v3_v3v3(totmat[1], vec, vec2);
+ normalize_v3(totmat[1]);
+ negate_v3(totmat[1]);
- /* the x axis is fixed */
- normalize_v3_v3(totmat[0], cob->matrix[0]);
+ /* the x axis is fixed */
+ normalize_v3_v3(totmat[0], cob->matrix[0]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+ }
break;
- case TRACK_nZ: /* LOCK X TRACK -Z */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[0]);
- sub_v3_v3v3(totmat[2], vec, vec2);
- normalize_v3(totmat[2]);
- negate_v3(totmat[2]);
+ case TRACK_nZ: /* LOCK X TRACK -Z */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[0]);
+ sub_v3_v3v3(totmat[2], vec, vec2);
+ normalize_v3(totmat[2]);
+ negate_v3(totmat[2]);
- /* the x axis is fixed */
- normalize_v3_v3(totmat[0], cob->matrix[0]);
+ /* the x axis is fixed */
+ normalize_v3_v3(totmat[0], cob->matrix[0]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+ }
break;
- default:
- {
- unit_m3(totmat);
- }
+ default:
+ {
+ unit_m3(totmat);
+ }
break;
+ }
}
- }
break;
- case LOCK_Y: /* LOCK Y */
- {
- switch (data->trackflag) {
- case TRACK_X: /* LOCK Y TRACK X */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[1]);
- sub_v3_v3v3(totmat[0], vec, vec2);
- normalize_v3(totmat[0]);
+ case LOCK_Y: /* LOCK Y */
+ {
+ switch (data->trackflag) {
+ case TRACK_X: /* LOCK Y TRACK X */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[1]);
+ sub_v3_v3v3(totmat[0], vec, vec2);
+ normalize_v3(totmat[0]);
- /* the y axis is fixed */
- normalize_v3_v3(totmat[1], cob->matrix[1]);
+ /* the y axis is fixed */
+ normalize_v3_v3(totmat[1], cob->matrix[1]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+ }
break;
- case TRACK_Z: /* LOCK Y TRACK Z */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[1]);
- sub_v3_v3v3(totmat[2], vec, vec2);
- normalize_v3(totmat[2]);
+ case TRACK_Z: /* LOCK Y TRACK Z */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[1]);
+ sub_v3_v3v3(totmat[2], vec, vec2);
+ normalize_v3(totmat[2]);
- /* the y axis is fixed */
- normalize_v3_v3(totmat[1], cob->matrix[1]);
+ /* the y axis is fixed */
+ normalize_v3_v3(totmat[1], cob->matrix[1]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+ }
break;
- case TRACK_nX: /* LOCK Y TRACK -X */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[1]);
- sub_v3_v3v3(totmat[0], vec, vec2);
- normalize_v3(totmat[0]);
- negate_v3(totmat[0]);
+ case TRACK_nX: /* LOCK Y TRACK -X */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[1]);
+ sub_v3_v3v3(totmat[0], vec, vec2);
+ normalize_v3(totmat[0]);
+ negate_v3(totmat[0]);
- /* the y axis is fixed */
- normalize_v3_v3(totmat[1], cob->matrix[1]);
+ /* the y axis is fixed */
+ normalize_v3_v3(totmat[1], cob->matrix[1]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]);
+ }
break;
- case TRACK_nZ: /* LOCK Y TRACK -Z */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[1]);
- sub_v3_v3v3(totmat[2], vec, vec2);
- normalize_v3(totmat[2]);
- negate_v3(totmat[2]);
+ case TRACK_nZ: /* LOCK Y TRACK -Z */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[1]);
+ sub_v3_v3v3(totmat[2], vec, vec2);
+ normalize_v3(totmat[2]);
+ negate_v3(totmat[2]);
- /* the y axis is fixed */
- normalize_v3_v3(totmat[1], cob->matrix[1]);
+ /* the y axis is fixed */
+ normalize_v3_v3(totmat[1], cob->matrix[1]);
- /* the z axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
- }
+ /* the z axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+ }
break;
- default:
- {
- unit_m3(totmat);
- }
+ default:
+ {
+ unit_m3(totmat);
+ }
break;
+ }
}
- }
break;
- case LOCK_Z: /* LOCK Z */
- {
- switch (data->trackflag) {
- case TRACK_X: /* LOCK Z TRACK X */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[2]);
- sub_v3_v3v3(totmat[0], vec, vec2);
- normalize_v3(totmat[0]);
+ case LOCK_Z: /* LOCK Z */
+ {
+ switch (data->trackflag) {
+ case TRACK_X: /* LOCK Z TRACK X */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[2]);
+ sub_v3_v3v3(totmat[0], vec, vec2);
+ normalize_v3(totmat[0]);
- /* the z axis is fixed */
- normalize_v3_v3(totmat[2], cob->matrix[2]);
+ /* the z axis is fixed */
+ normalize_v3_v3(totmat[2], cob->matrix[2]);
- /* the x axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
- }
+ /* the x axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+ }
break;
- case TRACK_Y: /* LOCK Z TRACK Y */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[2]);
- sub_v3_v3v3(totmat[1], vec, vec2);
- normalize_v3(totmat[1]);
+ case TRACK_Y: /* LOCK Z TRACK Y */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[2]);
+ sub_v3_v3v3(totmat[1], vec, vec2);
+ normalize_v3(totmat[1]);
- /* the z axis is fixed */
- normalize_v3_v3(totmat[2], cob->matrix[2]);
+ /* the z axis is fixed */
+ normalize_v3_v3(totmat[2], cob->matrix[2]);
- /* the x axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
- }
+ /* the x axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+ }
break;
- case TRACK_nX: /* LOCK Z TRACK -X */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[2]);
- sub_v3_v3v3(totmat[0], vec, vec2);
- normalize_v3(totmat[0]);
- negate_v3(totmat[0]);
+ case TRACK_nX: /* LOCK Z TRACK -X */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[2]);
+ sub_v3_v3v3(totmat[0], vec, vec2);
+ normalize_v3(totmat[0]);
+ negate_v3(totmat[0]);
- /* the z axis is fixed */
- normalize_v3_v3(totmat[2], cob->matrix[2]);
+ /* the z axis is fixed */
+ normalize_v3_v3(totmat[2], cob->matrix[2]);
- /* the x axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
- }
+ /* the x axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]);
+ }
break;
- case TRACK_nY: /* LOCK Z TRACK -Y */
- {
- /* Projection of Vector on the plane */
- project_v3_v3v3(vec2, vec, cob->matrix[2]);
- sub_v3_v3v3(totmat[1], vec, vec2);
- normalize_v3(totmat[1]);
- negate_v3(totmat[1]);
+ case TRACK_nY: /* LOCK Z TRACK -Y */
+ {
+ /* Projection of Vector on the plane */
+ project_v3_v3v3(vec2, vec, cob->matrix[2]);
+ sub_v3_v3v3(totmat[1], vec, vec2);
+ normalize_v3(totmat[1]);
+ negate_v3(totmat[1]);
- /* the z axis is fixed */
- normalize_v3_v3(totmat[2], cob->matrix[2]);
+ /* the z axis is fixed */
+ normalize_v3_v3(totmat[2], cob->matrix[2]);
- /* the x axis gets mapped onto a third orthogonal vector */
- cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
- }
+ /* the x axis gets mapped onto a third orthogonal vector */
+ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]);
+ }
break;
- default:
- {
- unit_m3(totmat);
- }
+ default:
+ {
+ unit_m3(totmat);
+ }
break;
+ }
}
- }
break;
- default:
- {
- unit_m3(totmat);
- }
+ default:
+ {
+ unit_m3(totmat);
+ }
break;
}
/* Block to keep matrix heading */
@@ -2508,16 +2508,16 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
normalize_m3(tmpmat);
invert_m3_m3(invmat, tmpmat);
mul_m3_m3m3(tmpmat, totmat, invmat);
- totmat[0][0] = tmpmat[0][0];totmat[0][1] = tmpmat[0][1];totmat[0][2] = tmpmat[0][2];
- totmat[1][0] = tmpmat[1][0];totmat[1][1] = tmpmat[1][1];totmat[1][2] = tmpmat[1][2];
- totmat[2][0] = tmpmat[2][0];totmat[2][1] = tmpmat[2][1];totmat[2][2] = tmpmat[2][2];
+ totmat[0][0] = tmpmat[0][0]; totmat[0][1] = tmpmat[0][1]; totmat[0][2] = tmpmat[0][2];
+ totmat[1][0] = tmpmat[1][0]; totmat[1][1] = tmpmat[1][1]; totmat[1][2] = tmpmat[1][2];
+ totmat[2][0] = tmpmat[2][0]; totmat[2][1] = tmpmat[2][1]; totmat[2][2] = tmpmat[2][2];
copy_m4_m4(tmat, cob->matrix);
mdet = determinant_m3(totmat[0][0], totmat[0][1], totmat[0][2],
totmat[1][0], totmat[1][1], totmat[1][2],
totmat[2][0], totmat[2][1], totmat[2][2]);
- if (mdet==0) {
+ if (mdet == 0) {
unit_m3(totmat);
}
@@ -2543,25 +2543,25 @@ static bConstraintTypeInfo CTI_LOCKTRACK = {
/* ---------- Limit Distance Constraint ----------- */
-static void distlimit_new_data (void *cdata)
+static void distlimit_new_data(void *cdata)
{
- bDistLimitConstraint *data= (bDistLimitConstraint *)cdata;
+ bDistLimitConstraint *data = (bDistLimitConstraint *)cdata;
- data->dist= 0.0f;
+ data->dist = 0.0f;
}
-static void distlimit_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void distlimit_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bDistLimitConstraint *data= con->data;
+ bDistLimitConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int distlimit_get_tars (bConstraint *con, ListBase *list)
+static int distlimit_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bDistLimitConstraint *data= con->data;
+ bDistLimitConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -2573,40 +2573,40 @@ static int distlimit_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void distlimit_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void distlimit_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bDistLimitConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bDistLimitConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void distlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bDistLimitConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bDistLimitConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
- float dvec[3], dist=0.0f, sfac=1.0f;
- short clamp_surf= 0;
+ float dvec[3], dist = 0.0f, sfac = 1.0f;
+ short clamp_surf = 0;
/* calculate our current distance from the target */
- dist= len_v3v3(cob->matrix[3], ct->matrix[3]);
+ dist = len_v3v3(cob->matrix[3], ct->matrix[3]);
/* set distance (flag is only set when user demands it) */
if (data->dist == 0)
- data->dist= dist;
+ data->dist = dist;
/* check if we're which way to clamp from, and calculate interpolation factor (if needed) */
if (data->mode == LIMITDIST_OUTSIDE) {
/* if inside, then move to surface */
if (dist <= data->dist) {
- clamp_surf= 1;
- if (dist != 0.0f) sfac= data->dist / dist;
+ clamp_surf = 1;
+ if (dist != 0.0f) sfac = data->dist / dist;
}
/* if soft-distance is enabled, start fading once owner is dist+softdist from the target */
else if (data->flag & LIMITDIST_USESOFT) {
@@ -2618,24 +2618,24 @@ static void distlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
else if (data->mode == LIMITDIST_INSIDE) {
/* if outside, then move to surface */
if (dist >= data->dist) {
- clamp_surf= 1;
- if (dist != 0.0f) sfac= data->dist / dist;
+ clamp_surf = 1;
+ if (dist != 0.0f) sfac = data->dist / dist;
}
/* if soft-distance is enabled, start fading once owner is dist-soft from the target */
else if (data->flag & LIMITDIST_USESOFT) {
// FIXME: there's a problem with "jumping" when this kicks in
if (dist >= (data->dist - data->soft)) {
- sfac = (float)( data->soft*(1.0f - expf(-(dist - data->dist)/data->soft)) + data->dist );
+ sfac = (float)(data->soft * (1.0f - expf(-(dist - data->dist) / data->soft)) + data->dist);
if (dist != 0.0f) sfac /= dist;
- clamp_surf= 1;
+ clamp_surf = 1;
}
}
}
else {
- if (IS_EQF(dist, data->dist)==0) {
- clamp_surf= 1;
- if (dist != 0.0f) sfac= data->dist / dist;
+ if (IS_EQF(dist, data->dist) == 0) {
+ clamp_surf = 1;
+ if (dist != 0.0f) sfac = data->dist / dist;
}
}
@@ -2667,9 +2667,9 @@ static bConstraintTypeInfo CTI_DISTLIMIT = {
/* ---------- Stretch To ------------ */
-static void stretchto_new_data (void *cdata)
+static void stretchto_new_data(void *cdata)
{
- bStretchToConstraint *data= (bStretchToConstraint *)cdata;
+ bStretchToConstraint *data = (bStretchToConstraint *)cdata;
data->volmode = 0;
data->plane = 0;
@@ -2677,18 +2677,18 @@ static void stretchto_new_data (void *cdata)
data->bulge = 1.0;
}
-static void stretchto_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void stretchto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bStretchToConstraint *data= con->data;
+ bStretchToConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int stretchto_get_tars (bConstraint *con, ListBase *list)
+static int stretchto_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bStretchToConstraint *data= con->data;
+ bStretchToConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -2700,21 +2700,21 @@ static int stretchto_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void stretchto_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void stretchto_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bStretchToConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bStretchToConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bStretchToConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bStretchToConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
@@ -2750,40 +2750,40 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
if (data->bulge == 0)
data->bulge = 1.0;
- scale[1] = dist/data->orglength;
+ scale[1] = dist / data->orglength;
switch (data->volmode) {
- /* volume preserving scaling */
- case VOLUME_XZ :
- scale[0] = 1.0f - (float)sqrt(data->bulge) + (float)sqrt(data->bulge*(data->orglength/dist));
- scale[2] = scale[0];
- break;
- case VOLUME_X:
- scale[0] = 1.0f + data->bulge * (data->orglength /dist - 1);
- scale[2] = 1.0;
- break;
- case VOLUME_Z:
- scale[0] = 1.0;
- scale[2] = 1.0f + data->bulge * (data->orglength /dist - 1);
- break;
+ /* volume preserving scaling */
+ case VOLUME_XZ:
+ scale[0] = 1.0f - (float)sqrt(data->bulge) + (float)sqrt(data->bulge * (data->orglength / dist));
+ scale[2] = scale[0];
+ break;
+ case VOLUME_X:
+ scale[0] = 1.0f + data->bulge * (data->orglength / dist - 1);
+ scale[2] = 1.0;
+ break;
+ case VOLUME_Z:
+ scale[0] = 1.0;
+ scale[2] = 1.0f + data->bulge * (data->orglength / dist - 1);
+ break;
/* don't care for volume */
- case NO_VOLUME:
- scale[0] = 1.0;
- scale[2] = 1.0;
- break;
- default: /* should not happen, but in case*/
- return;
+ case NO_VOLUME:
+ scale[0] = 1.0;
+ scale[2] = 1.0;
+ break;
+ default: /* should not happen, but in case*/
+ return;
} /* switch (data->volmode) */
/* Clear the object's rotation and scale */
- cob->matrix[0][0]=size[0]*scale[0];
- cob->matrix[0][1]=0;
- cob->matrix[0][2]=0;
- cob->matrix[1][0]=0;
- cob->matrix[1][1]=size[1]*scale[1];
- cob->matrix[1][2]=0;
- cob->matrix[2][0]=0;
- cob->matrix[2][1]=0;
- cob->matrix[2][2]=size[2]*scale[2];
+ cob->matrix[0][0] = size[0] * scale[0];
+ cob->matrix[0][1] = 0;
+ cob->matrix[0][2] = 0;
+ cob->matrix[1][0] = 0;
+ cob->matrix[1][1] = size[1] * scale[1];
+ cob->matrix[1][2] = 0;
+ cob->matrix[2][0] = 0;
+ cob->matrix[2][1] = 0;
+ cob->matrix[2][2] = size[2] * scale[2];
sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);
normalize_v3(vec);
@@ -2791,32 +2791,32 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
/* new Y aligns object target connection*/
negate_v3_v3(totmat[1], vec);
switch (data->plane) {
- case PLANE_X:
- /* build new Z vector */
- /* othogonal to "new Y" "old X! plane */
- cross_v3_v3v3(orth, vec, xx);
- normalize_v3(orth);
-
- /* new Z*/
- copy_v3_v3(totmat[2], orth);
-
- /* we decided to keep X plane*/
- cross_v3_v3v3(xx, orth, vec);
- normalize_v3_v3(totmat[0], xx);
- break;
- case PLANE_Z:
- /* build new X vector */
- /* othogonal to "new Y" "old Z! plane */
- cross_v3_v3v3(orth, vec, zz);
- normalize_v3(orth);
-
- /* new X */
- negate_v3_v3(totmat[0], orth);
-
- /* we decided to keep Z */
- cross_v3_v3v3(zz, orth, vec);
- normalize_v3_v3(totmat[2], zz);
- break;
+ case PLANE_X:
+ /* build new Z vector */
+ /* othogonal to "new Y" "old X! plane */
+ cross_v3_v3v3(orth, vec, xx);
+ normalize_v3(orth);
+
+ /* new Z*/
+ copy_v3_v3(totmat[2], orth);
+
+ /* we decided to keep X plane*/
+ cross_v3_v3v3(xx, orth, vec);
+ normalize_v3_v3(totmat[0], xx);
+ break;
+ case PLANE_Z:
+ /* build new X vector */
+ /* othogonal to "new Y" "old Z! plane */
+ cross_v3_v3v3(orth, vec, zz);
+ normalize_v3(orth);
+
+ /* new X */
+ negate_v3_v3(totmat[0], orth);
+
+ /* we decided to keep Z */
+ cross_v3_v3v3(zz, orth, vec);
+ normalize_v3_v3(totmat[2], zz);
+ break;
} /* switch (data->plane) */
copy_m4_m4(tmat, cob->matrix);
@@ -2841,9 +2841,9 @@ static bConstraintTypeInfo CTI_STRETCHTO = {
/* ---------- Floor ------------ */
-static void minmax_new_data (void *cdata)
+static void minmax_new_data(void *cdata)
{
- bMinMaxConstraint *data= (bMinMaxConstraint *)cdata;
+ bMinMaxConstraint *data = (bMinMaxConstraint *)cdata;
data->minmaxflag = TRACK_Z;
data->offset = 0.0f;
@@ -2851,18 +2851,18 @@ static void minmax_new_data (void *cdata)
data->flag = 0;
}
-static void minmax_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void minmax_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bMinMaxConstraint *data= con->data;
+ bMinMaxConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int minmax_get_tars (bConstraint *con, ListBase *list)
+static int minmax_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bMinMaxConstraint *data= con->data;
+ bMinMaxConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -2874,21 +2874,21 @@ static int minmax_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void minmax_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void minmax_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bMinMaxConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bMinMaxConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void minmax_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bMinMaxConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bMinMaxConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
@@ -2908,38 +2908,38 @@ static void minmax_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *tar
}
switch (data->minmaxflag) {
- case TRACK_Z:
- val1 = tarmat[3][2];
- val2 = obmat[3][2]-data->offset;
- index = 2;
- break;
- case TRACK_Y:
- val1 = tarmat[3][1];
- val2 = obmat[3][1]-data->offset;
- index = 1;
- break;
- case TRACK_X:
- val1 = tarmat[3][0];
- val2 = obmat[3][0]-data->offset;
- index = 0;
- break;
- case TRACK_nZ:
- val2 = tarmat[3][2];
- val1 = obmat[3][2]-data->offset;
- index = 2;
- break;
- case TRACK_nY:
- val2 = tarmat[3][1];
- val1 = obmat[3][1]-data->offset;
- index = 1;
- break;
- case TRACK_nX:
- val2 = tarmat[3][0];
- val1 = obmat[3][0]-data->offset;
- index = 0;
- break;
- default:
- return;
+ case TRACK_Z:
+ val1 = tarmat[3][2];
+ val2 = obmat[3][2] - data->offset;
+ index = 2;
+ break;
+ case TRACK_Y:
+ val1 = tarmat[3][1];
+ val2 = obmat[3][1] - data->offset;
+ index = 1;
+ break;
+ case TRACK_X:
+ val1 = tarmat[3][0];
+ val2 = obmat[3][0] - data->offset;
+ index = 0;
+ break;
+ case TRACK_nZ:
+ val2 = tarmat[3][2];
+ val1 = obmat[3][2] - data->offset;
+ index = 2;
+ break;
+ case TRACK_nY:
+ val2 = tarmat[3][1];
+ val1 = obmat[3][1] - data->offset;
+ index = 1;
+ break;
+ case TRACK_nX:
+ val2 = tarmat[3][0];
+ val1 = obmat[3][0] - data->offset;
+ index = 0;
+ break;
+ default:
+ return;
}
if (val1 > val2) {
@@ -2985,27 +2985,27 @@ static bConstraintTypeInfo CTI_MINMAX = {
/* ------- RigidBody Joint ---------- */
-static void rbj_new_data (void *cdata)
+static void rbj_new_data(void *cdata)
{
- bRigidBodyJointConstraint *data= (bRigidBodyJointConstraint *)cdata;
+ bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)cdata;
// removed code which set target of this constraint
- data->type=1;
+ data->type = 1;
}
-static void rbj_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void rbj_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bRigidBodyJointConstraint *data= con->data;
+ bRigidBodyJointConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
- func(con, (ID**)&data->child, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->child, FALSE, userdata);
}
-static int rbj_get_tars (bConstraint *con, ListBase *list)
+static int rbj_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bRigidBodyJointConstraint *data= con->data;
+ bRigidBodyJointConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints without subtargets */
@@ -3017,11 +3017,11 @@ static int rbj_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void rbj_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void rbj_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bRigidBodyJointConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bRigidBodyJointConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy)
@@ -3045,18 +3045,18 @@ static bConstraintTypeInfo CTI_RIGIDBODYJOINT = {
/* -------- Clamp To ---------- */
-static void clampto_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void clampto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bClampToConstraint *data= con->data;
+ bClampToConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int clampto_get_tars (bConstraint *con, ListBase *list)
+static int clampto_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bClampToConstraint *data= con->data;
+ bClampToConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints without subtargets */
@@ -3068,28 +3068,28 @@ static int clampto_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void clampto_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void clampto_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bClampToConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bClampToConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy)
}
}
-static void clampto_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void clampto_get_tarmat(bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
if (VALID_CONS_TARGET(ct)) {
- Curve *cu= ct->tar->data;
+ Curve *cu = ct->tar->data;
/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
* currently for paths to work it needs to go through the bevlist/displist system (ton)
*/
/* only happens on reload file, but violates depsgraph still... fix! */
- if (cu->path==NULL || cu->path->data==NULL)
+ if (cu->path == NULL || cu->path->data == NULL)
makeDispListCurveTypes(cob->scene, ct->tar, 0);
}
@@ -3100,17 +3100,17 @@ static void clampto_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bC
unit_m4(ct->matrix);
}
-static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bClampToConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bClampToConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target and it is a curve */
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) {
- Curve *cu= data->tar->data;
+ Curve *cu = data->tar->data;
float obmat[4][4], ownLoc[3];
float curveMin[3], curveMax[3];
- float targetMatrix[4][4]= MAT4_UNITY;
+ float targetMatrix[4][4] = MAT4_UNITY;
copy_m4_m4(obmat, cob->matrix);
copy_v3_v3(ownLoc, obmat[3]);
@@ -3134,20 +3134,20 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
* extent. Otherwise, default to the x-axis, as that is quite
* frequently used.
*/
- if ((size[2]>size[0]) && (size[2]>size[1]))
- clamp_axis= CLAMPTO_Z - 1;
- else if ((size[1]>size[0]) && (size[1]>size[2]))
- clamp_axis= CLAMPTO_Y - 1;
+ if ((size[2] > size[0]) && (size[2] > size[1]))
+ clamp_axis = CLAMPTO_Z - 1;
+ else if ((size[1] > size[0]) && (size[1] > size[2]))
+ clamp_axis = CLAMPTO_Y - 1;
else
clamp_axis = CLAMPTO_X - 1;
}
else
- clamp_axis= data->flag - 1;
+ clamp_axis = data->flag - 1;
/* 2. determine position relative to curve on a 0-1 scale based on bounding box */
if (data->flag2 & CLAMPTO_CYCLIC) {
/* cyclic, so offset within relative bounding box is used */
- float len= (curveMax[clamp_axis] - curveMin[clamp_axis]);
+ float len = (curveMax[clamp_axis] - curveMin[clamp_axis]);
float offset;
/* check to make sure len is not so close to zero that it'll cause errors */
@@ -3162,7 +3162,7 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
}
else if (ownLoc[clamp_axis] > curveMax[clamp_axis]) {
/* bounding-box range is after */
- offset= curveMax[clamp_axis] + (int)((ownLoc[clamp_axis] - curveMax[clamp_axis]) / len) * len;
+ offset = curveMax[clamp_axis] + (int)((ownLoc[clamp_axis] - curveMax[clamp_axis]) / len) * len;
/* now, we calculate as per normal, except using offset instead of curveMax[clamp_axis] */
curvetime = (ownLoc[clamp_axis] - offset) / (len);
@@ -3174,7 +3174,7 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
}
else {
/* as length is close to zero, curvetime by default should be 0 (i.e. the start) */
- curvetime= 0.0f;
+ curvetime = 0.0f;
}
}
else {
@@ -3183,7 +3183,7 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
curvetime = 0.0f;
else if (ownLoc[clamp_axis] >= curveMax[clamp_axis])
curvetime = 1.0f;
- else if ( IS_EQ((curveMax[clamp_axis] - curveMin[clamp_axis]), 0) == 0 )
+ else if (IS_EQ((curveMax[clamp_axis] - curveMin[clamp_axis]), 0) == 0)
curvetime = (ownLoc[clamp_axis] - curveMin[clamp_axis]) / (curveMax[clamp_axis] - curveMin[clamp_axis]);
else
curvetime = 0.0f;
@@ -3220,27 +3220,27 @@ static bConstraintTypeInfo CTI_CLAMPTO = {
/* ---------- Transform Constraint ----------- */
-static void transform_new_data (void *cdata)
+static void transform_new_data(void *cdata)
{
- bTransformConstraint *data= (bTransformConstraint *)cdata;
+ bTransformConstraint *data = (bTransformConstraint *)cdata;
- data->map[0]= 0;
- data->map[1]= 1;
- data->map[2]= 2;
+ data->map[0] = 0;
+ data->map[1] = 1;
+ data->map[2] = 2;
}
-static void transform_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void transform_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bTransformConstraint *data= con->data;
+ bTransformConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int transform_get_tars (bConstraint *con, ListBase *list)
+static int transform_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bTransformConstraint *data= con->data;
+ bTransformConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -3252,21 +3252,21 @@ static int transform_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void transform_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void transform_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bTransformConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bTransformConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bTransformConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bTransformConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
@@ -3295,21 +3295,21 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
/* determine where in range current transforms lie */
if (data->expo) {
- for (i=0; i<3; i++) {
+ for (i = 0; i < 3; i++) {
if (data->from_max[i] - data->from_min[i])
- sval[i]= (dvec[i] - data->from_min[i]) / (data->from_max[i] - data->from_min[i]);
+ sval[i] = (dvec[i] - data->from_min[i]) / (data->from_max[i] - data->from_min[i]);
else
- sval[i]= 0.0f;
+ sval[i] = 0.0f;
}
}
else {
/* clamp transforms out of range */
- for (i=0; i<3; i++) {
+ for (i = 0; i < 3; i++) {
CLAMP(dvec[i], data->from_min[i], data->from_max[i]);
if (data->from_max[i] - data->from_min[i])
- sval[i]= (dvec[i] - data->from_min[i]) / (data->from_max[i] - data->from_min[i]);
+ sval[i] = (dvec[i] - data->from_min[i]) / (data->from_max[i] - data->from_min[i]);
else
- sval[i]= 0.0f;
+ sval[i] = 0.0f;
}
}
@@ -3317,18 +3317,18 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
/* apply transforms */
switch (data->to) {
case 2: /* scaling */
- for (i=0; i<3; i++)
- size[i]= data->to_min[i] + (sval[(int)data->map[i]] * (data->to_max[i] - data->to_min[i]));
+ for (i = 0; i < 3; i++)
+ size[i] = data->to_min[i] + (sval[(int)data->map[i]] * (data->to_max[i] - data->to_min[i]));
break;
case 1: /* rotation */
- for (i=0; i<3; i++) {
+ for (i = 0; i < 3; i++) {
float tmin, tmax;
- tmin= data->to_min[i];
- tmax= data->to_max[i];
+ tmin = data->to_min[i];
+ tmax = data->to_max[i];
/* all values here should be in degrees */
- eul[i]= tmin + (sval[(int)data->map[i]] * (tmax - tmin));
+ eul[i] = tmin + (sval[(int)data->map[i]] * (tmax - tmin));
/* now convert final value back to radians */
eul[i] = DEG2RADF(eul[i]);
@@ -3336,8 +3336,8 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
break;
default: /* location */
/* get new location */
- for (i=0; i<3; i++)
- loc[i]= (data->to_min[i] + (sval[(int)data->map[i]] * (data->to_max[i] - data->to_min[i])));
+ for (i = 0; i < 3; i++)
+ loc[i] = (data->to_min[i] + (sval[(int)data->map[i]] * (data->to_max[i] - data->to_min[i])));
/* add original location back on (so that it can still be moved) */
add_v3_v3v3(loc, cob->matrix[3], loc);
@@ -3366,15 +3366,15 @@ static bConstraintTypeInfo CTI_TRANSFORM = {
/* ---------- Shrinkwrap Constraint ----------- */
-static void shrinkwrap_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void shrinkwrap_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
bShrinkwrapConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->target, FALSE, userdata);
+ func(con, (ID **)&data->target, FALSE, userdata);
}
-static int shrinkwrap_get_tars (bConstraint *con, ListBase *list)
+static int shrinkwrap_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
bShrinkwrapConstraint *data = con->data;
@@ -3389,22 +3389,22 @@ static int shrinkwrap_get_tars (bConstraint *con, ListBase *list)
}
-static void shrinkwrap_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
bShrinkwrapConstraint *data = con->data;
- bConstraintTarget *ct= list->first;
+ bConstraintTarget *ct = list->first;
SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, nocopy)
}
}
-static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
- if ( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) {
+ if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) {
int fail = FALSE;
float co[3] = {0.0f, 0.0f, 0.0f};
float no[3] = {0.0f, 0.0f, 0.0f};
@@ -3415,7 +3415,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
BVHTreeRayHit hit;
BVHTreeNearest nearest;
- BVHTreeFromMesh treeData= {NULL};
+ BVHTreeFromMesh treeData = {NULL};
nearest.index = -1;
nearest.dist = FLT_MAX;
@@ -3448,10 +3448,10 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
dist = len_v3v3(co, nearest.co);
if (dist != 0.0f) {
- interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist)/dist); /* linear interpolation */
+ interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist) / dist); /* linear interpolation */
}
space_transform_invert(&transform, co);
- break;
+ break;
case MOD_SHRINKWRAP_PROJECT:
if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) no[0] = 1.0f;
@@ -3477,7 +3477,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
break;
}
copy_v3_v3(co, hit.co);
- break;
+ break;
}
free_bvhtree_from_mesh(&treeData);
@@ -3496,9 +3496,9 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
}
}
-static void shrinkwrap_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
+static void shrinkwrap_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets)
{
- bConstraintTarget *ct= targets->first;
+ bConstraintTarget *ct = targets->first;
/* only evaluate if there is a target */
if (VALID_CONS_TARGET(ct)) {
@@ -3523,25 +3523,25 @@ static bConstraintTypeInfo CTI_SHRINKWRAP = {
/* --------- Damped Track ---------- */
-static void damptrack_new_data (void *cdata)
+static void damptrack_new_data(void *cdata)
{
- bDampTrackConstraint *data= (bDampTrackConstraint *)cdata;
+ bDampTrackConstraint *data = (bDampTrackConstraint *)cdata;
data->trackflag = TRACK_Y;
}
-static void damptrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void damptrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bDampTrackConstraint *data= con->data;
+ bDampTrackConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int damptrack_get_tars (bConstraint *con, ListBase *list)
+static int damptrack_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bDampTrackConstraint *data= con->data;
+ bDampTrackConstraint *data = con->data;
bConstraintTarget *ct;
/* the following macro is used for all standard single-target constraints */
@@ -3553,11 +3553,11 @@ static int damptrack_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void damptrack_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void damptrack_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bDampTrackConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bDampTrackConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
@@ -3566,14 +3566,14 @@ static void damptrack_flush_tars (bConstraint *con, ListBase *list, short nocopy
/* array of direction vectors for the tracking flags */
static const float track_dir_vecs[6][3] = {
- {+1, 0, 0}, {0, +1, 0}, {0, 0, +1}, /* TRACK_X, TRACK_Y, TRACK_Z */
- {-1, 0, 0}, {0, -1, 0}, {0, 0, -1} /* TRACK_NX, TRACK_NY, TRACK_NZ */
+ {+1, 0, 0}, {0, +1, 0}, {0, 0, +1}, /* TRACK_X, TRACK_Y, TRACK_Z */
+ {-1, 0, 0}, {0, -1, 0}, {0, 0, -1} /* TRACK_NX, TRACK_NY, TRACK_NZ */
};
-static void damptrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bDampTrackConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bDampTrackConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
if (VALID_CONS_TARGET(ct)) {
float obvec[3], tarvec[3], obloc[3];
@@ -3614,8 +3614,8 @@ static void damptrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
*/
cross_v3_v3v3(raxis, obvec, tarvec);
- rangle= dot_v3v3(obvec, tarvec);
- rangle= acos( MAX2(-1.0f, MIN2(1.0f, rangle)) );
+ rangle = dot_v3v3(obvec, tarvec);
+ rangle = acos(MAX2(-1.0f, MIN2(1.0f, rangle)) );
/* construct rotation matrix from the axis-angle rotation found above
* - this call takes care to make sure that the axis provided is a unit vector first
@@ -3650,43 +3650,43 @@ static bConstraintTypeInfo CTI_DAMPTRACK = {
/* ----------- Spline IK ------------ */
-static void splineik_free (bConstraint *con)
+static void splineik_free(bConstraint *con)
{
- bSplineIKConstraint *data= con->data;
+ bSplineIKConstraint *data = con->data;
/* binding array */
if (data->points)
MEM_freeN(data->points);
}
-static void splineik_copy (bConstraint *con, bConstraint *srccon)
+static void splineik_copy(bConstraint *con, bConstraint *srccon)
{
- bSplineIKConstraint *src= srccon->data;
- bSplineIKConstraint *dst= con->data;
+ bSplineIKConstraint *src = srccon->data;
+ bSplineIKConstraint *dst = con->data;
/* copy the binding array */
- dst->points= MEM_dupallocN(src->points);
+ dst->points = MEM_dupallocN(src->points);
}
-static void splineik_new_data (void *cdata)
+static void splineik_new_data(void *cdata)
{
- bSplineIKConstraint *data= (bSplineIKConstraint *)cdata;
+ bSplineIKConstraint *data = (bSplineIKConstraint *)cdata;
- data->chainlen= 1;
+ data->chainlen = 1;
}
-static void splineik_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void splineik_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bSplineIKConstraint *data= con->data;
+ bSplineIKConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int splineik_get_tars (bConstraint *con, ListBase *list)
+static int splineik_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bSplineIKConstraint *data= con->data;
+ bSplineIKConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints without subtargets */
@@ -3698,28 +3698,28 @@ static int splineik_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void splineik_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void splineik_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bSplineIKConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bSplineIKConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, nocopy)
}
}
-static void splineik_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void splineik_get_tarmat(bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
if (VALID_CONS_TARGET(ct)) {
- Curve *cu= ct->tar->data;
+ Curve *cu = ct->tar->data;
/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
* currently for paths to work it needs to go through the bevlist/displist system (ton)
*/
/* only happens on reload file, but violates depsgraph still... fix! */
- if (cu->path==NULL || cu->path->data==NULL)
+ if (cu->path == NULL || cu->path->data == NULL)
makeDispListCurveTypes(cob->scene, ct->tar, 0);
}
@@ -3747,18 +3747,18 @@ static bConstraintTypeInfo CTI_SPLINEIK = {
/* ----------- Pivot ------------- */
-static void pivotcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void pivotcon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bPivotConstraint *data= con->data;
+ bPivotConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID **)&data->tar, FALSE, userdata);
}
-static int pivotcon_get_tars (bConstraint *con, ListBase *list)
+static int pivotcon_get_tars(bConstraint *con, ListBase *list)
{
if (con && list) {
- bPivotConstraint *data= con->data;
+ bPivotConstraint *data = con->data;
bConstraintTarget *ct;
/* standard target-getting macro for single-target constraints */
@@ -3770,21 +3770,21 @@ static int pivotcon_get_tars (bConstraint *con, ListBase *list)
return 0;
}
-static void pivotcon_flush_tars (bConstraint *con, ListBase *list, short nocopy)
+static void pivotcon_flush_tars(bConstraint *con, ListBase *list, short nocopy)
{
if (con && list) {
- bPivotConstraint *data= con->data;
- bConstraintTarget *ct= list->first;
+ bPivotConstraint *data = con->data;
+ bConstraintTarget *ct = list->first;
/* the following macro is used for all standard single-target constraints */
SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, nocopy)
}
}
-static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
+static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets)
{
- bPivotConstraint *data= con->data;
- bConstraintTarget *ct= targets->first;
+ bPivotConstraint *data = con->data;
+ bConstraintTarget *ct = targets->first;
float pivot[3], vec[3];
float rotMat[3][3];
@@ -3845,11 +3845,11 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
}
/* perform the pivoting... */
- /* 1. take the vector from owner to the pivot */
+ /* 1. take the vector from owner to the pivot */
sub_v3_v3v3(vec, cob->matrix[3], pivot);
- /* 2. rotate this vector by the rotation of the object... */
+ /* 2. rotate this vector by the rotation of the object... */
mul_m3_v3(rotMat, vec);
- /* 3. make the rotation in terms of the pivot now */
+ /* 3. make the rotation in terms of the pivot now */
add_v3_v3v3(cob->matrix[3], pivot, vec);
}
@@ -3883,9 +3883,9 @@ static void followtrack_id_looper(bConstraint *con, ConstraintIDFunc func, void
{
bFollowTrackConstraint *data = con->data;
- func(con, (ID**)&data->clip, TRUE, userdata);
- func(con, (ID**)&data->camera, FALSE, userdata);
- func(con, (ID**)&data->depth_ob, FALSE, userdata);
+ func(con, (ID **)&data->clip, TRUE, userdata);
+ func(con, (ID **)&data->camera, FALSE, userdata);
+ func(con, (ID **)&data->depth_ob, FALSE, userdata);
}
static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
@@ -3896,10 +3896,10 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
MovieTracking *tracking;
MovieTrackingTrack *track;
MovieTrackingObject *tracking_object;
- Object *camob= data->camera ? data->camera : scene->camera;
+ Object *camob = data->camera ? data->camera : scene->camera;
if (data->flag & FOLLOWTRACK_ACTIVECLIP)
- clip= scene->clip;
+ clip = scene->clip;
if (!clip || !data->track[0] || !camob)
return;
@@ -3925,7 +3925,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
copy_m4_m4(obmat, cob->matrix);
- if ((tracking_object->flag & TRACKING_OBJECT_CAMERA)==0) {
+ if ((tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0) {
float imat[4][4];
copy_m4_m4(mat, camob->obmat);
@@ -3947,7 +3947,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
else {
MovieTrackingMarker *marker;
float vec[3], disp[3], axis[3], mat[4][4];
- float aspect= (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
+ float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
float len, d;
BKE_object_where_is_calc_mat4(scene, camob, mat);
@@ -3995,7 +3995,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
copy_v3_v3(cob->matrix[3], disp);
}
else {
- d= (len * params.sensor_x) / (2.0f * params.lens);
+ d = (len * params.sensor_x) / (2.0f * params.lens);
vec[0] = d * (2.0f * (pos[0] + params.shiftx) - 1.0f);
vec[1] = d * (2.0f * (pos[1] + params.shifty) - 1.0f);
@@ -4076,7 +4076,7 @@ static void camerasolver_id_looper(bConstraint *con, ConstraintIDFunc func, void
{
bCameraSolverConstraint *data = con->data;
- func(con, (ID**)&data->clip, TRUE, userdata);
+ func(con, (ID **)&data->clip, TRUE, userdata);
}
static void camerasolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
@@ -4129,10 +4129,10 @@ static void objectsolver_new_data(void *cdata)
static void objectsolver_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bObjectSolverConstraint *data= con->data;
+ bObjectSolverConstraint *data = con->data;
- func(con, (ID**)&data->clip, FALSE, userdata);
- func(con, (ID**)&data->camera, FALSE, userdata);
+ func(con, (ID **)&data->clip, FALSE, userdata);
+ func(con, (ID **)&data->camera, FALSE, userdata);
}
static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
@@ -4143,7 +4143,7 @@ static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
Object *camob = data->camera ? data->camera : scene->camera;
if (data->flag & OBJECTSOLVER_ACTIVECLIP)
- clip= scene->clip;
+ clip = scene->clip;
if (!camob || !clip)
return;
@@ -4196,46 +4196,46 @@ static bConstraintTypeInfo CTI_OBJECTSOLVER = {
/* These globals only ever get directly accessed in this file */
static bConstraintTypeInfo *constraintsTypeInfo[NUM_CONSTRAINT_TYPES];
-static short CTI_INIT= 1; /* when non-zero, the list needs to be updated */
+static short CTI_INIT = 1; /* when non-zero, the list needs to be updated */
/* This function only gets called when CTI_INIT is non-zero */
-static void constraints_init_typeinfo (void)
-{
- constraintsTypeInfo[0]= NULL; /* 'Null' Constraint */
- constraintsTypeInfo[1]= &CTI_CHILDOF; /* ChildOf Constraint */
- constraintsTypeInfo[2]= &CTI_TRACKTO; /* TrackTo Constraint */
- constraintsTypeInfo[3]= &CTI_KINEMATIC; /* IK Constraint */
- constraintsTypeInfo[4]= &CTI_FOLLOWPATH; /* Follow-Path Constraint */
- constraintsTypeInfo[5]= &CTI_ROTLIMIT; /* Limit Rotation Constraint */
- constraintsTypeInfo[6]= &CTI_LOCLIMIT; /* Limit Location Constraint */
- constraintsTypeInfo[7]= &CTI_SIZELIMIT; /* Limit Scaling Constraint */
- constraintsTypeInfo[8]= &CTI_ROTLIKE; /* Copy Rotation Constraint */
- constraintsTypeInfo[9]= &CTI_LOCLIKE; /* Copy Location Constraint */
- constraintsTypeInfo[10]= &CTI_SIZELIKE; /* Copy Scaling Constraint */
- constraintsTypeInfo[11]= &CTI_PYTHON; /* Python/Script Constraint */
- constraintsTypeInfo[12]= &CTI_ACTION; /* Action Constraint */
- constraintsTypeInfo[13]= &CTI_LOCKTRACK; /* Locked-Track Constraint */
- constraintsTypeInfo[14]= &CTI_DISTLIMIT; /* Limit Distance Constraint */
- constraintsTypeInfo[15]= &CTI_STRETCHTO; /* StretchTo Constaint */
- constraintsTypeInfo[16]= &CTI_MINMAX; /* Floor Constraint */
- constraintsTypeInfo[17]= &CTI_RIGIDBODYJOINT; /* RigidBody Constraint */
- constraintsTypeInfo[18]= &CTI_CLAMPTO; /* ClampTo Constraint */
- constraintsTypeInfo[19]= &CTI_TRANSFORM; /* Transformation Constraint */
- constraintsTypeInfo[20]= &CTI_SHRINKWRAP; /* Shrinkwrap Constraint */
- constraintsTypeInfo[21]= &CTI_DAMPTRACK; /* Damped TrackTo Constraint */
- constraintsTypeInfo[22]= &CTI_SPLINEIK; /* Spline IK Constraint */
- constraintsTypeInfo[23]= &CTI_TRANSLIKE; /* Copy Transforms Constraint */
- constraintsTypeInfo[24]= &CTI_SAMEVOL; /* Maintain Volume Constraint */
- constraintsTypeInfo[25]= &CTI_PIVOT; /* Pivot Constraint */
- constraintsTypeInfo[26]= &CTI_FOLLOWTRACK; /* Follow Track Constraint */
- constraintsTypeInfo[27]= &CTI_CAMERASOLVER; /* Camera Solver Constraint */
- constraintsTypeInfo[28]= &CTI_OBJECTSOLVER; /* Object Solver Constraint */
+static void constraints_init_typeinfo(void)
+{
+ constraintsTypeInfo[0] = NULL; /* 'Null' Constraint */
+ constraintsTypeInfo[1] = &CTI_CHILDOF; /* ChildOf Constraint */
+ constraintsTypeInfo[2] = &CTI_TRACKTO; /* TrackTo Constraint */
+ constraintsTypeInfo[3] = &CTI_KINEMATIC; /* IK Constraint */
+ constraintsTypeInfo[4] = &CTI_FOLLOWPATH; /* Follow-Path Constraint */
+ constraintsTypeInfo[5] = &CTI_ROTLIMIT; /* Limit Rotation Constraint */
+ constraintsTypeInfo[6] = &CTI_LOCLIMIT; /* Limit Location Constraint */
+ constraintsTypeInfo[7] = &CTI_SIZELIMIT; /* Limit Scaling Constraint */
+ constraintsTypeInfo[8] = &CTI_ROTLIKE; /* Copy Rotation Constraint */
+ constraintsTypeInfo[9] = &CTI_LOCLIKE; /* Copy Location Constraint */
+ constraintsTypeInfo[10] = &CTI_SIZELIKE; /* Copy Scaling Constraint */
+ constraintsTypeInfo[11] = &CTI_PYTHON; /* Python/Script Constraint */
+ constraintsTypeInfo[12] = &CTI_ACTION; /* Action Constraint */
+ constraintsTypeInfo[13] = &CTI_LOCKTRACK; /* Locked-Track Constraint */
+ constraintsTypeInfo[14] = &CTI_DISTLIMIT; /* Limit Distance Constraint */
+ constraintsTypeInfo[15] = &CTI_STRETCHTO; /* StretchTo Constaint */
+ constraintsTypeInfo[16] = &CTI_MINMAX; /* Floor Constraint */
+ constraintsTypeInfo[17] = &CTI_RIGIDBODYJOINT; /* RigidBody Constraint */
+ constraintsTypeInfo[18] = &CTI_CLAMPTO; /* ClampTo Constraint */
+ constraintsTypeInfo[19] = &CTI_TRANSFORM; /* Transformation Constraint */
+ constraintsTypeInfo[20] = &CTI_SHRINKWRAP; /* Shrinkwrap Constraint */
+ constraintsTypeInfo[21] = &CTI_DAMPTRACK; /* Damped TrackTo Constraint */
+ constraintsTypeInfo[22] = &CTI_SPLINEIK; /* Spline IK Constraint */
+ constraintsTypeInfo[23] = &CTI_TRANSLIKE; /* Copy Transforms Constraint */
+ constraintsTypeInfo[24] = &CTI_SAMEVOL; /* Maintain Volume Constraint */
+ constraintsTypeInfo[25] = &CTI_PIVOT; /* Pivot Constraint */
+ constraintsTypeInfo[26] = &CTI_FOLLOWTRACK; /* Follow Track Constraint */
+ constraintsTypeInfo[27] = &CTI_CAMERASOLVER; /* Camera Solver Constraint */
+ constraintsTypeInfo[28] = &CTI_OBJECTSOLVER; /* Object Solver Constraint */
}
/* This function should be used for getting the appropriate type-info when only
* a constraint type is known
*/
-bConstraintTypeInfo *get_constraint_typeinfo (int type)
+bConstraintTypeInfo *get_constraint_typeinfo(int type)
{
/* initialize the type-info list? */
if (CTI_INIT) {
@@ -4245,7 +4245,7 @@ bConstraintTypeInfo *get_constraint_typeinfo (int type)
/* only return for valid types */
if ( (type >= CONSTRAINT_TYPE_NULL) &&
- (type < NUM_CONSTRAINT_TYPES ) )
+ (type < NUM_CONSTRAINT_TYPES) )
{
/* there shouldn't be any segfaults here... */
return constraintsTypeInfo[type];
@@ -4260,7 +4260,7 @@ bConstraintTypeInfo *get_constraint_typeinfo (int type)
/* This function should always be used to get the appropriate type-info, as it
* has checks which prevent segfaults in some weird cases.
*/
-bConstraintTypeInfo *constraint_get_typeinfo (bConstraint *con)
+bConstraintTypeInfo *constraint_get_typeinfo(bConstraint *con)
{
/* only return typeinfo for valid constraints */
if (con)
@@ -4290,7 +4290,7 @@ static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isRe
void free_constraint_data(bConstraint *con)
{
if (con->data) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
if (cti) {
/* perform any special freeing constraint may have */
@@ -4313,7 +4313,7 @@ void free_constraints(ListBase *list)
bConstraint *con;
/* Free constraint data and also any extra data */
- for (con= list->first; con; con= con->next)
+ for (con = list->first; con; con = con->next)
free_constraint_data(con);
/* Free the whole list */
@@ -4342,8 +4342,8 @@ void remove_constraints_type(ListBase *list, short type, short last_only)
return;
/* remove from the end of the list to make it faster to find the last instance */
- for (con= list->last; con; con= conp) {
- conp= con->prev;
+ for (con = list->last; con; con = conp) {
+ conp = con->prev;
if (con->type == type) {
remove_constraint(list, con);
@@ -4356,10 +4356,10 @@ void remove_constraints_type(ListBase *list, short type, short last_only)
/* ......... */
/* Creates a new constraint, initializes its data, and returns it */
-static bConstraint *add_new_constraint_internal (const char *name, short type)
+static bConstraint *add_new_constraint_internal(const char *name, short type)
{
- bConstraint *con= MEM_callocN(sizeof(bConstraint), "Constraint");
- bConstraintTypeInfo *cti= get_constraint_typeinfo(type);
+ bConstraint *con = MEM_callocN(sizeof(bConstraint), "Constraint");
+ bConstraintTypeInfo *cti = get_constraint_typeinfo(type);
const char *newName;
/* Set up a generic constraint datablock */
@@ -4377,12 +4377,12 @@ static bConstraint *add_new_constraint_internal (const char *name, short type)
cti->new_data(con->data);
/* if no name is provided, use the type of the constraint as the name */
- newName= (name && name[0]) ? name : cti->name;
+ newName = (name && name[0]) ? name : cti->name;
}
else {
/* if no name is provided, use the generic "Const" name */
// NOTE: any constraint type that gets here really shouldn't get added...
- newName= (name && name[0]) ? name : "Const";
+ newName = (name && name[0]) ? name : "Const";
}
/* copy the name */
@@ -4393,13 +4393,13 @@ static bConstraint *add_new_constraint_internal (const char *name, short type)
}
/* if pchan is not NULL then assume we're adding a pose constraint */
-static bConstraint *add_new_constraint (Object *ob, bPoseChannel *pchan, const char *name, short type)
+static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const char *name, short type)
{
bConstraint *con;
ListBase *list;
/* add the constraint */
- con= add_new_constraint_internal(name, type);
+ con = add_new_constraint_internal(name, type);
/* find the constraint stack - bone or object? */
list = (pchan) ? (&pchan->constraints) : (&ob->constraints);
@@ -4434,7 +4434,7 @@ static bConstraint *add_new_constraint (Object *ob, bPoseChannel *pchan, const c
con->flag |= CONSTRAINT_SPACEONCE;
}
}
- break;
+ break;
}
return con;
@@ -4443,7 +4443,7 @@ static bConstraint *add_new_constraint (Object *ob, bPoseChannel *pchan, const c
/* ......... */
/* Add new constraint for the given bone */
-bConstraint *add_pose_constraint (Object *ob, bPoseChannel *pchan, const char *name, short type)
+bConstraint *add_pose_constraint(Object *ob, bPoseChannel *pchan, const char *name, short type)
{
if (pchan == NULL)
return NULL;
@@ -4485,8 +4485,8 @@ void id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *userdat
{
bConstraint *con;
- for (con= conlist->first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ for (con = conlist->first; con; con = con->next) {
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
if (cti) {
if (cti->id_looper)
@@ -4517,11 +4517,11 @@ void copy_constraints(ListBase *dst, const ListBase *src, int do_extern)
{
bConstraint *con, *srccon;
- dst->first= dst->last= NULL;
+ dst->first = dst->last = NULL;
BLI_duplicatelist(dst, src);
- for (con=dst->first, srccon=src->first; con && srccon; srccon=srccon->next, con=con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ for (con = dst->first, srccon = src->first; con && srccon; srccon = srccon->next, con = con->next) {
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
/* make a new copy of the constraint's data */
con->data = MEM_dupallocN(con->data);
@@ -4554,13 +4554,13 @@ bConstraint *constraints_findByName(ListBase *list, const char *name)
}
/* finds the 'active' constraint in a constraint stack */
-bConstraint *constraints_get_active (ListBase *list)
+bConstraint *constraints_get_active(ListBase *list)
{
bConstraint *con;
/* search for the first constraint with the 'active' flag set */
if (list) {
- for (con= list->first; con; con= con->next) {
+ for (con = list->first; con; con = con->next) {
if (con->flag & CONSTRAINT_ACTIVE)
return con;
}
@@ -4576,7 +4576,7 @@ void constraints_set_active(ListBase *list, bConstraint *con)
bConstraint *c;
if (list) {
- for (c= list->first; c; c= c->next) {
+ for (c = list->first; c; c = c->next) {
if (c == con)
c->flag |= CONSTRAINT_ACTIVE;
else
@@ -4593,8 +4593,8 @@ void extract_proxylocal_constraints(ListBase *dst, ListBase *src)
bConstraint *con, *next;
/* for each tagged constraint, remove from src and move to dst */
- for (con= src->first; con; con= next) {
- next= con->next;
+ for (con = src->first; con; con = next) {
+ next = con->next;
/* check if tagged */
if (con->flag & CONSTRAINT_PROXY_LOCAL) {
@@ -4610,7 +4610,7 @@ short proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
/* Currently, constraints can only be on object or bone level */
if (ob && ob->proxy) {
if (ob->pose && pchan) {
- bArmature *arm= ob->data;
+ bArmature *arm = ob->data;
/* On bone-level, check if bone is on proxy-protected layer */
if ((pchan->bone) && (pchan->bone->layer & arm->layer_protected))
@@ -4636,21 +4636,21 @@ short proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
*/
void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime)
{
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintOb *cob;
bConstraintTarget *ct;
if (cti && cti->get_constraint_targets) {
/* make 'constraint-ob' */
- cob= MEM_callocN(sizeof(bConstraintOb), "tempConstraintOb");
- cob->type= ownertype;
+ cob = MEM_callocN(sizeof(bConstraintOb), "tempConstraintOb");
+ cob->type = ownertype;
cob->scene = scene;
switch (ownertype) {
case CONSTRAINT_OBTYPE_OBJECT: /* it is usually this case */
{
- cob->ob= (Object *)ownerdata;
- cob->pchan= NULL;
+ cob->ob = (Object *)ownerdata;
+ cob->pchan = NULL;
if (cob->ob) {
copy_m4_m4(cob->matrix, cob->ob->obmat);
copy_m4_m4(cob->startmat, cob->matrix);
@@ -4660,11 +4660,11 @@ void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n,
unit_m4(cob->startmat);
}
}
- break;
+ break;
case CONSTRAINT_OBTYPE_BONE: /* this may occur in some cases */
{
- cob->ob= NULL; /* this might not work at all :/ */
- cob->pchan= (bPoseChannel *)ownerdata;
+ cob->ob = NULL; /* this might not work at all :/ */
+ cob->pchan = (bPoseChannel *)ownerdata;
if (cob->pchan) {
copy_m4_m4(cob->matrix, cob->pchan->pose_mat);
copy_m4_m4(cob->startmat, cob->matrix);
@@ -4674,16 +4674,16 @@ void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n,
unit_m4(cob->startmat);
}
}
- break;
+ break;
}
/* get targets - we only need the first one though (and there should only be one) */
cti->get_constraint_targets(con, &targets);
/* only calculate the target matrix on the first target */
- ct= (bConstraintTarget *)targets.first;
+ ct = (bConstraintTarget *)targets.first;
while (ct && n-- > 0)
- ct= ct->next;
+ ct = ct->next;
if (ct) {
if (cti->get_target_matrix)
@@ -4705,26 +4705,26 @@ void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n,
/* Get the list of targets required for solving a constraint */
void get_constraint_targets_for_solving(bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime)
{
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct;
/* get targets
- * - constraints should use ct->matrix, not directly accessing values
+ * - constraints should use ct->matrix, not directly accessing values
* - ct->matrix members have not yet been calculated here!
*/
cti->get_constraint_targets(con, targets);
/* set matrices
- * - calculate if possible, otherwise just initialize as identity matrix
+ * - calculate if possible, otherwise just initialize as identity matrix
*/
if (cti->get_target_matrix) {
- for (ct= targets->first; ct; ct= ct->next)
+ for (ct = targets->first; ct; ct = ct->next)
cti->get_target_matrix(con, cob, ct, ctime);
}
else {
- for (ct= targets->first; ct; ct= ct->next)
+ for (ct = targets->first; ct; ct = ct->next)
unit_m4(ct->matrix);
}
}
@@ -4749,20 +4749,20 @@ void solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime)
return;
/* loop over available constraints, solving and blending them */
- for (con= conlist->first; con; con= con->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ for (con = conlist->first; con; con = con->next) {
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
/* these we can skip completely (invalid constraints...) */
if (cti == NULL) continue;
- if (con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF)) continue;
+ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
/* these constraints can't be evaluated anyway */
if (cti->evaluate_constraint == NULL) continue;
/* influence == 0 should be ignored */
if (con->enforce == 0.0f) continue;
/* influence of constraint
- * - value should have been set from animation data already
+ * - value should have been set from animation data already
*/
enf = con->enforce;
@@ -4791,9 +4791,9 @@ void solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime)
constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD);
/* Interpolate the enforcement, to blend result of constraint into final owner transform
- * - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]),
- * since some constraints may not convert the solution back to the input space before blending
- * but all are guaranteed to end up in good "worldspace" result
+ * - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]),
+ * since some constraints may not convert the solution back to the input space before blending
+ * but all are guaranteed to end up in good "worldspace" result
*/
/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka */
if (enf < 1.0f) {