API Cleanup: Use BKE_constraint prefix for constraint api

This commit is contained in:
2014-04-11 11:47:07 +10:00
parent a15b3c4d11
commit 3216e4b202
36 changed files with 161 additions and 181 deletions

View File

@@ -108,50 +108,44 @@ typedef struct bConstraintTypeInfo {
} bConstraintTypeInfo; } bConstraintTypeInfo;
/* Function Prototypes for bConstraintTypeInfo's */ /* Function Prototypes for bConstraintTypeInfo's */
bConstraintTypeInfo *BKE_constraint_get_typeinfo(struct bConstraint *con); bConstraintTypeInfo *BKE_constraint_typeinfo_get(struct bConstraint *con);
bConstraintTypeInfo *BKE_get_constraint_typeinfo(int type); bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type);
/* ---------------------------------------------------------------------------- */
/* Useful macros for testing various common flag combinations */
/* Constraint Target Macros */
#define VALID_CONS_TARGET(ct) ((ct) && (ct->tar))
/* ---------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------- */
/* Constraint function prototypes */ /* Constraint function prototypes */
void BKE_unique_constraint_name(struct bConstraint *con, struct ListBase *list); void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list);
void BKE_free_constraints(struct ListBase *list); void BKE_constraints_free(struct ListBase *list);
void BKE_copy_constraints(struct ListBase *dst, const struct ListBase *src, bool do_extern); void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern);
void BKE_relink_constraints(struct ListBase *list); void BKE_constraints_relink(struct ListBase *list);
void BKE_id_loop_constraints(struct ListBase *list, ConstraintIDFunc func, void *userdata); void BKE_constraints_id_loop(struct ListBase *list, ConstraintIDFunc func, void *userdata);
void BKE_free_constraint_data(struct bConstraint *con); void BKE_constraint_free_data(struct bConstraint *con);
/* Constraint API function prototypes */ /* Constraint API function prototypes */
struct bConstraint *BKE_constraints_get_active(struct ListBase *list); struct bConstraint *BKE_constraints_active_get(struct ListBase *list);
void BKE_constraints_set_active(ListBase *list, struct bConstraint *con); void BKE_constraints_active_set(ListBase *list, struct bConstraint *con);
struct bConstraint *BKE_constraints_findByName(struct ListBase *list, const char *name); struct bConstraint *BKE_constraints_find_name(struct ListBase *list, const char *name);
struct bConstraint *BKE_add_ob_constraint(struct Object *ob, const char *name, short type); struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, const char *name, short type);
struct bConstraint *BKE_add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type); struct bConstraint *BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type);
bool BKE_remove_constraint(ListBase *list, struct bConstraint *con); bool BKE_constraint_remove(ListBase *list, struct bConstraint *con);
void BKE_remove_constraints_type(ListBase *list, short type, bool last_only);
/* Constraints + Proxies function prototypes */ /* Constraints + Proxies function prototypes */
void BKE_extract_proxylocal_constraints(struct ListBase *dst, struct ListBase *src); void BKE_constraints_proxylocal_extract(struct ListBase *dst, struct ListBase *src);
bool BKE_proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan); bool BKE_constraints_proxylocked_owner(struct Object *ob, struct bPoseChannel *pchan);
/* Constraint Evaluation function prototypes */ /* Constraint Evaluation function prototypes */
struct bConstraintOb *BKE_constraints_make_evalob(struct Scene *scene, struct Object *ob, void *subdata, short datatype); struct bConstraintOb *BKE_constraints_make_evalob(struct Scene *scene, struct Object *ob, void *subdata, short datatype);
void BKE_constraints_clear_evalob(struct bConstraintOb *cob); void BKE_constraints_clear_evalob(struct bConstraintOb *cob);
void BKE_constraint_mat_convertspace(struct Object *ob, struct bPoseChannel *pchan, float mat[4][4], short from, short to); void BKE_constraint_mat_convertspace(struct Object *ob, struct bPoseChannel *pchan, float mat[4][4], short from, short to);
void BKE_get_constraint_target_matrix(struct Scene *scene, struct bConstraint *con, int n, short ownertype, void *ownerdata, float mat[4][4], float ctime); void BKE_constraint_target_matrix_get(struct Scene *scene, struct bConstraint *con, int n, short ownertype, void *ownerdata, float mat[4][4], float ctime);
void BKE_get_constraint_targets_for_solving(struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime); void BKE_constraint_targets_for_solving_get(struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime);
void BKE_solve_constraints(struct ListBase *conlist, struct bConstraintOb *cob, float ctime); void BKE_constraints_solve(struct ListBase *conlist, struct bConstraintOb *cob, float ctime);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -604,7 +604,7 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, const bool copy_constraints)
for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) {
if (copy_constraints) { if (copy_constraints) {
BKE_copy_constraints(&listb, &pchan->constraints, true); // BKE_copy_constraints NULLs listb BKE_constraints_copy(&listb, &pchan->constraints, true); // BKE_constraints_copy NULLs listb
pchan->constraints = listb; pchan->constraints = listb;
pchan->mpath = NULL; /* motion paths should not get copied yet... */ pchan->mpath = NULL; /* motion paths should not get copied yet... */
} }
@@ -727,7 +727,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user)
pchan->mpath = NULL; pchan->mpath = NULL;
} }
BKE_free_constraints(&pchan->constraints); BKE_constraints_free(&pchan->constraints);
if (pchan->prop) { if (pchan->prop) {
IDP_FreeProperty(pchan->prop); IDP_FreeProperty(pchan->prop);
@@ -843,7 +843,7 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
pchan->iklinweight = pchan_from->iklinweight; pchan->iklinweight = pchan_from->iklinweight;
/* constraints */ /* constraints */
BKE_copy_constraints(&pchan->constraints, &pchan_from->constraints, true); BKE_constraints_copy(&pchan->constraints, &pchan_from->constraints, true);
/* id-properties */ /* id-properties */
if (pchan->prop) { if (pchan->prop) {

View File

@@ -1659,16 +1659,16 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
* 2. copy proxy-pchan's constraints on-to new * 2. copy proxy-pchan's constraints on-to new
* 3. add extracted local constraints back on top * 3. add extracted local constraints back on top
* *
* Note for BKE_copy_constraints: when copying constraints, disable 'do_extern' otherwise * Note for BKE_constraints_copy: when copying constraints, disable 'do_extern' otherwise
* we get the libs direct linked in this blend. * we get the libs direct linked in this blend.
*/ */
BKE_extract_proxylocal_constraints(&proxylocal_constraints, &pchan->constraints); BKE_constraints_proxylocal_extract(&proxylocal_constraints, &pchan->constraints);
BKE_copy_constraints(&pchanw.constraints, &pchanp->constraints, false); BKE_constraints_copy(&pchanw.constraints, &pchanp->constraints, false);
BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints); BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints);
/* constraints - set target ob pointer to own object */ /* constraints - set target ob pointer to own object */
for (con = pchanw.constraints.first; con; con = con->next) { for (con = pchanw.constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -2473,7 +2473,7 @@ void BKE_pose_where_is_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float
cob = BKE_constraints_make_evalob(scene, ob, pchan, CONSTRAINT_OBTYPE_BONE); cob = BKE_constraints_make_evalob(scene, ob, pchan, CONSTRAINT_OBTYPE_BONE);
/* Solve PoseChannel's Constraints */ /* Solve PoseChannel's Constraints */
BKE_solve_constraints(&pchan->constraints, cob, ctime); /* ctime doesnt alter objects */ BKE_constraints_solve(&pchan->constraints, cob, ctime); /* ctime doesnt alter objects */
/* cleanup after Constraint Solving /* cleanup after Constraint Solving
* - applies matrix back to pchan, and frees temporary struct used * - applies matrix back to pchan, and frees temporary struct used

View File

@@ -89,6 +89,12 @@
# include "BPY_extern.h" # include "BPY_extern.h"
#endif #endif
/* ---------------------------------------------------------------------------- */
/* Useful macros for testing various common flag combinations */
/* Constraint Target Macros */
#define VALID_CONS_TARGET(ct) ((ct) && (ct->tar))
/* Workaround for cyclic depenndnecy with curves. /* Workaround for cyclic depenndnecy with curves.
* In such case curve_cache might not be ready yet, * In such case curve_cache might not be ready yet,
*/ */
@@ -103,7 +109,7 @@
/* -------------- Naming -------------- */ /* -------------- Naming -------------- */
/* Find the first available, non-duplicate name for a given constraint */ /* Find the first available, non-duplicate name for a given constraint */
void BKE_unique_constraint_name(bConstraint *con, ListBase *list) void BKE_constraint_unique_name(bConstraint *con, ListBase *list)
{ {
BLI_uniquename(list, con, DATA_("Const"), '.', offsetof(bConstraint, name), sizeof(con->name)); BLI_uniquename(list, con, DATA_("Const"), '.', offsetof(bConstraint, name), sizeof(con->name));
} }
@@ -4235,7 +4241,7 @@ static void constraints_init_typeinfo(void)
/* This function should be used for getting the appropriate type-info when only /* This function should be used for getting the appropriate type-info when only
* a constraint type is known * a constraint type is known
*/ */
bConstraintTypeInfo *BKE_get_constraint_typeinfo(int type) bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
{ {
/* initialize the type-info list? */ /* initialize the type-info list? */
if (CTI_INIT) { if (CTI_INIT) {
@@ -4260,11 +4266,11 @@ bConstraintTypeInfo *BKE_get_constraint_typeinfo(int type)
/* This function should always be used to get the appropriate type-info, as it /* This function should always be used to get the appropriate type-info, as it
* has checks which prevent segfaults in some weird cases. * has checks which prevent segfaults in some weird cases.
*/ */
bConstraintTypeInfo *BKE_constraint_get_typeinfo(bConstraint *con) bConstraintTypeInfo *BKE_constraint_typeinfo_get(bConstraint *con)
{ {
/* only return typeinfo for valid constraints */ /* only return typeinfo for valid constraints */
if (con) if (con)
return BKE_get_constraint_typeinfo(con->type); return BKE_constraint_typeinfo_from_type(con->type);
else else
return NULL; return NULL;
} }
@@ -4276,7 +4282,7 @@ bConstraintTypeInfo *BKE_constraint_get_typeinfo(bConstraint *con)
/* ---------- Data Management ------- */ /* ---------- Data Management ------- */
/* helper function for BKE_free_constraint_data() - unlinks references */ /* helper function for BKE_constraint_free_data() - unlinks references */
static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData)) static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData))
{ {
if (*idpoin && is_reference) if (*idpoin && is_reference)
@@ -4287,10 +4293,10 @@ static void con_unlink_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_re
* be sure to run BIK_clear_data() when freeing an IK constraint, * be sure to run BIK_clear_data() when freeing an IK constraint,
* unless DAG_relations_tag_update is called. * unless DAG_relations_tag_update is called.
*/ */
void BKE_free_constraint_data(bConstraint *con) void BKE_constraint_free_data(bConstraint *con)
{ {
if (con->data) { if (con->data) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (cti) { if (cti) {
/* perform any special freeing constraint may have */ /* perform any special freeing constraint may have */
@@ -4308,13 +4314,13 @@ void BKE_free_constraint_data(bConstraint *con)
} }
/* Free all constraints from a constraint-stack */ /* Free all constraints from a constraint-stack */
void BKE_free_constraints(ListBase *list) void BKE_constraints_free(ListBase *list)
{ {
bConstraint *con; bConstraint *con;
/* Free constraint data and also any extra data */ /* Free constraint data and also any extra data */
for (con = list->first; con; con = con->next) for (con = list->first; con; con = con->next)
BKE_free_constraint_data(con); BKE_constraint_free_data(con);
/* Free the whole list */ /* Free the whole list */
BLI_freelistN(list); BLI_freelistN(list);
@@ -4322,10 +4328,10 @@ void BKE_free_constraints(ListBase *list)
/* Remove the specified constraint from the given constraint stack */ /* Remove the specified constraint from the given constraint stack */
bool BKE_remove_constraint(ListBase *list, bConstraint *con) bool BKE_constraint_remove(ListBase *list, bConstraint *con)
{ {
if (con) { if (con) {
BKE_free_constraint_data(con); BKE_constraint_free_data(con);
BLI_freelinkN(list, con); BLI_freelinkN(list, con);
return 1; return 1;
} }
@@ -4333,33 +4339,13 @@ bool BKE_remove_constraint(ListBase *list, bConstraint *con)
return 0; return 0;
} }
/* Remove all the constraints of the specified type from the given constraint stack */
void BKE_remove_constraints_type(ListBase *list, short type, bool last_only)
{
bConstraint *con, *conp;
if (list == NULL)
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;
if (con->type == type) {
BKE_remove_constraint(list, con);
if (last_only)
return;
}
}
}
/* ......... */ /* ......... */
/* Creates a new constraint, initializes its data, and returns it */ /* 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"); bConstraint *con = MEM_callocN(sizeof(bConstraint), "Constraint");
bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(type); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(type);
const char *newName; const char *newName;
/* Set up a generic constraint datablock */ /* Set up a generic constraint datablock */
@@ -4409,17 +4395,17 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch
* (otherwise unique-naming code will fail, since it assumes element exists in list) * (otherwise unique-naming code will fail, since it assumes element exists in list)
*/ */
BLI_addtail(list, con); BLI_addtail(list, con);
BKE_unique_constraint_name(con, list); BKE_constraint_unique_name(con, list);
/* if the target list is a list on some PoseChannel belonging to a proxy-protected /* if the target list is a list on some PoseChannel belonging to a proxy-protected
* Armature layer, we must tag newly added constraints with a flag which allows them * Armature layer, we must tag newly added constraints with a flag which allows them
* to persist after proxy syncing has been done * to persist after proxy syncing has been done
*/ */
if (BKE_proxylocked_constraints_owner(ob, pchan)) if (BKE_constraints_proxylocked_owner(ob, pchan))
con->flag |= CONSTRAINT_PROXY_LOCAL; con->flag |= CONSTRAINT_PROXY_LOCAL;
/* make this constraint the active one */ /* make this constraint the active one */
BKE_constraints_set_active(list, con); BKE_constraints_active_set(list, con);
} }
/* set type+owner specific immutable settings */ /* set type+owner specific immutable settings */
@@ -4443,7 +4429,7 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch
/* ......... */ /* ......... */
/* Add new constraint for the given bone */ /* Add new constraint for the given bone */
bConstraint *BKE_add_pose_constraint(Object *ob, bPoseChannel *pchan, const char *name, short type) bConstraint *BKE_constraint_add_for_pose(Object *ob, bPoseChannel *pchan, const char *name, short type)
{ {
if (pchan == NULL) if (pchan == NULL)
return NULL; return NULL;
@@ -4452,14 +4438,14 @@ bConstraint *BKE_add_pose_constraint(Object *ob, bPoseChannel *pchan, const char
} }
/* Add new constraint for the given object */ /* Add new constraint for the given object */
bConstraint *BKE_add_ob_constraint(Object *ob, const char *name, short type) bConstraint *BKE_constraint_add_for_object(Object *ob, const char *name, short type)
{ {
return add_new_constraint(ob, NULL, name, type); return add_new_constraint(ob, NULL, name, type);
} }
/* ......... */ /* ......... */
/* helper for BKE_relink_constraints() - call ID_NEW() on every ID reference the constraint has */ /* helper for BKE_constraints_relink() - call ID_NEW() on every ID reference the constraint has */
static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userdata)) static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userdata))
{ {
/* ID_NEW() expects a struct with inline "id" member as first /* ID_NEW() expects a struct with inline "id" member as first
@@ -4473,20 +4459,20 @@ static void con_relink_id_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(
} }
/* Reassign links that constraints have to other data (called during file loading?) */ /* Reassign links that constraints have to other data (called during file loading?) */
void BKE_relink_constraints(ListBase *conlist) void BKE_constraints_relink(ListBase *conlist)
{ {
/* just a wrapper around ID-loop for just calling ID_NEW() on all ID refs */ /* just a wrapper around ID-loop for just calling ID_NEW() on all ID refs */
BKE_id_loop_constraints(conlist, con_relink_id_cb, NULL); BKE_constraints_id_loop(conlist, con_relink_id_cb, NULL);
} }
/* Run the given callback on all ID-blocks in list of constraints */ /* Run the given callback on all ID-blocks in list of constraints */
void BKE_id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *userdata) void BKE_constraints_id_loop(ListBase *conlist, ConstraintIDFunc func, void *userdata)
{ {
bConstraint *con; bConstraint *con;
for (con = conlist->first; con; con = con->next) { for (con = conlist->first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (cti) { if (cti) {
if (cti->id_looper) if (cti->id_looper)
@@ -4497,14 +4483,14 @@ void BKE_id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *use
/* ......... */ /* ......... */
/* helper for BKE_copy_constraints(), to be used for making sure that ID's are valid */ /* helper for BKE_constraints_copy(), to be used for making sure that ID's are valid */
static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userData)) static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userData))
{ {
if (*idpoin && (*idpoin)->lib) if (*idpoin && (*idpoin)->lib)
id_lib_extern(*idpoin); id_lib_extern(*idpoin);
} }
/* helper for BKE_copy_constraints(), to be used for making sure that usercounts of copied ID's are fixed up */ /* helper for BKE_constraints_copy(), to be used for making sure that usercounts of copied ID's are fixed up */
static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData)) static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *UNUSED(userData))
{ {
/* increment usercount if this is a reference type */ /* increment usercount if this is a reference type */
@@ -4513,7 +4499,7 @@ static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, bool i
} }
/* duplicate all of the constraints in a constraint stack */ /* duplicate all of the constraints in a constraint stack */
void BKE_copy_constraints(ListBase *dst, const ListBase *src, bool do_extern) void BKE_constraints_copy(ListBase *dst, const ListBase *src, bool do_extern)
{ {
bConstraint *con, *srccon; bConstraint *con, *srccon;
@@ -4521,7 +4507,7 @@ void BKE_copy_constraints(ListBase *dst, const ListBase *src, bool do_extern)
BLI_duplicatelist(dst, src); BLI_duplicatelist(dst, src);
for (con = dst->first, srccon = src->first; con && srccon; srccon = srccon->next, con = con->next) { for (con = dst->first, srccon = src->first; con && srccon; srccon = srccon->next, con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
/* make a new copy of the constraint's data */ /* make a new copy of the constraint's data */
con->data = MEM_dupallocN(con->data); con->data = MEM_dupallocN(con->data);
@@ -4548,13 +4534,13 @@ void BKE_copy_constraints(ListBase *dst, const ListBase *src, bool do_extern)
/* ......... */ /* ......... */
bConstraint *BKE_constraints_findByName(ListBase *list, const char *name) bConstraint *BKE_constraints_find_name(ListBase *list, const char *name)
{ {
return BLI_findstring(list, name, offsetof(bConstraint, name)); return BLI_findstring(list, name, offsetof(bConstraint, name));
} }
/* finds the 'active' constraint in a constraint stack */ /* finds the 'active' constraint in a constraint stack */
bConstraint *BKE_constraints_get_active(ListBase *list) bConstraint *BKE_constraints_active_get(ListBase *list)
{ {
bConstraint *con; bConstraint *con;
@@ -4571,7 +4557,7 @@ bConstraint *BKE_constraints_get_active(ListBase *list)
} }
/* Set the given constraint as the active one (clearing all the others) */ /* Set the given constraint as the active one (clearing all the others) */
void BKE_constraints_set_active(ListBase *list, bConstraint *con) void BKE_constraints_active_set(ListBase *list, bConstraint *con)
{ {
bConstraint *c; bConstraint *c;
@@ -4588,7 +4574,7 @@ void BKE_constraints_set_active(ListBase *list, bConstraint *con)
/* -------- Constraints and Proxies ------- */ /* -------- Constraints and Proxies ------- */
/* Rescue all constraints tagged as being CONSTRAINT_PROXY_LOCAL (i.e. added to bone that's proxy-synced in this file) */ /* Rescue all constraints tagged as being CONSTRAINT_PROXY_LOCAL (i.e. added to bone that's proxy-synced in this file) */
void BKE_extract_proxylocal_constraints(ListBase *dst, ListBase *src) void BKE_constraints_proxylocal_extract(ListBase *dst, ListBase *src)
{ {
bConstraint *con, *next; bConstraint *con, *next;
@@ -4605,7 +4591,7 @@ void BKE_extract_proxylocal_constraints(ListBase *dst, ListBase *src)
} }
/* Returns if the owner of the constraint is proxy-protected */ /* Returns if the owner of the constraint is proxy-protected */
bool BKE_proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan) bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan)
{ {
/* Currently, constraints can only be on object or bone level */ /* Currently, constraints can only be on object or bone level */
if (ob && ob->proxy) { if (ob && ob->proxy) {
@@ -4634,9 +4620,9 @@ bool BKE_proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
* None of the actual calculations of the matrices should be done here! Also, this function is * None of the actual calculations of the matrices should be done here! Also, this function is
* not to be used by any new constraints, particularly any that have multiple targets. * not to be used by any new constraints, particularly any that have multiple targets.
*/ */
void BKE_get_constraint_target_matrix(Scene *scene, bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime) void BKE_constraint_target_matrix_get(Scene *scene, bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime)
{ {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintOb *cob; bConstraintOb *cob;
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -4701,9 +4687,9 @@ void BKE_get_constraint_target_matrix(Scene *scene, bConstraint *con, int index,
} }
/* Get the list of targets required for solving a constraint */ /* Get the list of targets required for solving a constraint */
void BKE_get_constraint_targets_for_solving(bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime) void BKE_constraint_targets_for_solving_get(bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime)
{ {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (cti && cti->get_constraint_targets) { if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -4736,7 +4722,7 @@ void BKE_get_constraint_targets_for_solving(bConstraint *con, bConstraintOb *cob
* BKE_constraints_make_evalob and BKE_constraints_clear_evalob should be called before and * BKE_constraints_make_evalob and BKE_constraints_clear_evalob should be called before and
* after running this function, to sort out cob * after running this function, to sort out cob
*/ */
void BKE_solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime) void BKE_constraints_solve(ListBase *conlist, bConstraintOb *cob, float ctime)
{ {
bConstraint *con; bConstraint *con;
float oldmat[4][4]; float oldmat[4][4];
@@ -4748,7 +4734,7 @@ void BKE_solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime)
/* loop over available constraints, solving and blending them */ /* loop over available constraints, solving and blending them */
for (con = conlist->first; con; con = con->next) { for (con = conlist->first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
/* these we can skip completely (invalid constraints...) */ /* these we can skip completely (invalid constraints...) */
@@ -4771,7 +4757,7 @@ void BKE_solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime)
BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace); BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace);
/* prepare targets for constraint solving */ /* prepare targets for constraint solving */
BKE_get_constraint_targets_for_solving(con, cob, &targets, ctime); BKE_constraint_targets_for_solving_get(con, cob, &targets, ctime);
/* Solve the constraint and put result in cob->matrix */ /* Solve the constraint and put result in cob->matrix */
cti->evaluate_constraint(con, cob, &targets); cti->evaluate_constraint(con, cob, &targets);

View File

@@ -508,7 +508,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -796,7 +796,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* object constraints */ /* object constraints */
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -1978,7 +1978,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob)
if (ob->constraints.first) { if (ob->constraints.first) {
bConstraint *con; bConstraint *con;
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -2481,7 +2481,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id)
for (obt = bmain->object.first; obt; obt = obt->id.next) { for (obt = bmain->object.first; obt; obt = obt->id.next) {
bConstraint *con; bConstraint *con;
for (con = obt->constraints.first; con; con = con->next) { for (con = obt->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER,
CONSTRAINT_TYPE_OBJECTSOLVER)) CONSTRAINT_TYPE_OBJECTSOLVER))
{ {
@@ -2854,7 +2854,7 @@ void DAG_pose_sort(Object *ob)
addtoroot = 0; addtoroot = 0;
} }
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -536,7 +536,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, int parent
/* also update constraint targets */ /* also update constraint targets */
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
if (cti && cti->get_constraint_targets) { if (cti && cti->get_constraint_targets) {

View File

@@ -230,7 +230,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
pose_channel = pose_channel->next) pose_channel = pose_channel->next)
{ {
CALLBACK_INVOKE(pose_channel->custom, IDWALK_NOP); CALLBACK_INVOKE(pose_channel->custom, IDWALK_NOP);
BKE_id_loop_constraints(&pose_channel->constraints, BKE_constraints_id_loop(&pose_channel->constraints,
library_foreach_constraintObjectLooper, library_foreach_constraintObjectLooper,
&data); &data);
} }
@@ -239,7 +239,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u
modifiers_foreachIDLink(object, modifiers_foreachIDLink(object,
library_foreach_modifiersForeachIDLink, library_foreach_modifiersForeachIDLink,
&data); &data);
BKE_id_loop_constraints(&object->constraints, BKE_constraints_id_loop(&object->constraints,
library_foreach_constraintObjectLooper, library_foreach_constraintObjectLooper,
&data); &data);
break; break;

View File

@@ -394,7 +394,7 @@ void BKE_object_free_ex(Object *ob, bool do_id_user)
free_controllers(&ob->controllers); free_controllers(&ob->controllers);
free_actuators(&ob->actuators); free_actuators(&ob->actuators);
BKE_free_constraints(&ob->constraints); BKE_constraints_free(&ob->constraints);
free_partdeflect(ob->pd); free_partdeflect(ob->pd);
BKE_rigidbody_free_object(ob); BKE_rigidbody_free_object(ob);
@@ -500,7 +500,7 @@ void BKE_object_unlink(Object *ob)
bPoseChannel *pchan; bPoseChannel *pchan;
for (pchan = obt->pose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = obt->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -531,7 +531,7 @@ void BKE_object_unlink(Object *ob)
sca_remove_ob_poin(obt, ob); sca_remove_ob_poin(obt, ob);
for (con = obt->constraints.first; con; con = con->next) { for (con = obt->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -1375,7 +1375,7 @@ static void copy_object_pose(Object *obn, Object *ob)
} }
for (con = chan->constraints.first; con; con = con->next) { for (con = chan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -1487,7 +1487,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
BKE_pose_rebuild(obn, obn->data); BKE_pose_rebuild(obn, obn->data);
} }
defgroup_copy_list(&obn->defbase, &ob->defbase); defgroup_copy_list(&obn->defbase, &ob->defbase);
BKE_copy_constraints(&obn->constraints, &ob->constraints, true); BKE_constraints_copy(&obn->constraints, &ob->constraints, true);
obn->mode = 0; obn->mode = 0;
obn->sculpt = NULL; obn->sculpt = NULL;
@@ -2349,7 +2349,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime,
if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) { if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
bConstraintOb *cob; bConstraintOb *cob;
cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
BKE_solve_constraints(&ob->constraints, cob, ctime); BKE_constraints_solve(&ob->constraints, cob, ctime);
BKE_constraints_clear_evalob(cob); BKE_constraints_clear_evalob(cob);
} }
@@ -3439,11 +3439,11 @@ void BKE_object_relink(Object *ob)
if (ob->id.lib) if (ob->id.lib)
return; return;
BKE_relink_constraints(&ob->constraints); BKE_constraints_relink(&ob->constraints);
if (ob->pose) { if (ob->pose) {
bPoseChannel *chan; bPoseChannel *chan;
for (chan = ob->pose->chanbase.first; chan; chan = chan->next) { for (chan = ob->pose->chanbase.first; chan; chan = chan->next) {
BKE_relink_constraints(&chan->constraints); BKE_constraints_relink(&chan->constraints);
} }
} }
modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL); modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL);

View File

@@ -974,7 +974,7 @@ static bool subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int
/* also update constraint targets */ /* also update constraint targets */
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
if (cti && cti->get_constraint_targets) { if (cti && cti->get_constraint_targets) {

View File

@@ -2787,7 +2787,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
cld.fd = fd; cld.fd = fd;
cld.id = id; cld.id = id;
BKE_id_loop_constraints(conlist, lib_link_constraint_cb, &cld); BKE_constraints_id_loop(conlist, lib_link_constraint_cb, &cld);
} }
static void direct_link_constraints(FileData *fd, ListBase *lb) static void direct_link_constraints(FileData *fd, ListBase *lb)
@@ -8223,7 +8223,7 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb)
ced.fd = fd; ced.fd = fd;
ced.mainvar = mainvar; ced.mainvar = mainvar;
BKE_id_loop_constraints(lb, expand_constraint_cb, &ced); BKE_constraints_id_loop(lb, expand_constraint_cb, &ced);
/* deprecated manual expansion stuff */ /* deprecated manual expansion stuff */
for (curcon = lb->first; curcon; curcon = curcon->next) { for (curcon = lb->first; curcon; curcon = curcon->next) {

View File

@@ -541,7 +541,7 @@ void blo_do_version_old_trackto_to_constraints(Object *ob)
{ {
/* create new trackto constraint from the relationship */ /* create new trackto constraint from the relationship */
if (ob->track) { if (ob->track) {
bConstraint *con = BKE_add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO); bConstraint *con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
bTrackToConstraint *data = con->data; bTrackToConstraint *data = con->data;
/* copy tracking settings from the object */ /* copy tracking settings from the object */

View File

@@ -1265,7 +1265,7 @@ static void write_constraints(WriteData *wd, ListBase *conlist)
bConstraint *con; bConstraint *con;
for (con=conlist->first; con; con=con->next) { for (con=conlist->first; con; con=con->next) {
bConstraintTypeInfo *cti= BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti= BKE_constraint_typeinfo_get(con);
/* Write the specific data */ /* Write the specific data */
if (cti && con->data) { if (cti && con->data) {

View File

@@ -187,7 +187,7 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
for (con = (bConstraint *)conlist->first; con; con = con->next) { for (con = (bConstraint *)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (!validateConstraints(con)) continue; if (!validateConstraints(con)) continue;
@@ -1526,7 +1526,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
bool AnimationExporter::validateConstraints(bConstraint *con) bool AnimationExporter::validateConstraints(bConstraint *con)
{ {
bool valid = true; bool valid = true;
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
/* these we can skip completely (invalid constraints...) */ /* these we can skip completely (invalid constraints...) */
if (cti == NULL) valid = false; if (cti == NULL) valid = false;
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) valid = false; if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) valid = false;
@@ -1545,7 +1545,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
for (con = (bConstraint *)conlist->first; con; con = con->next) { for (con = (bConstraint *)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (cti && cti->get_constraint_targets) { if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -478,7 +478,7 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
std::string name; std::string name;
short* type = 0; short* type = 0;
et->setData("type", type); et->setData("type", type);
BKE_add_ob_constraint(ob, "Test_con", *type); BKE_constraint_add_for_object(ob, "Test_con", *type);
} }
} }

View File

@@ -208,7 +208,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
//not ideal: add the target object name as another parameter. //not ideal: add the target object name as another parameter.
//No real mapping in the .dae //No real mapping in the .dae
//Need support for multiple target objects also. //Need support for multiple target objects also.
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
if (cti && cti->get_constraint_targets) { if (cti && cti->get_constraint_targets) {

View File

@@ -312,7 +312,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj
/* does this constraint have a subtarget in /* does this constraint have a subtarget in
* this armature? * this armature?
*/ */
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -1221,7 +1221,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
} }
else { else {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -104,7 +104,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char *
bConstraintTarget *ct; bConstraintTarget *ct;
for (curcon = conlist->first; curcon; curcon = curcon->next) { for (curcon = conlist->first; curcon; curcon = curcon->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
/* constraint targets */ /* constraint targets */

View File

@@ -73,7 +73,7 @@ static void joined_armature_fix_links_constraints(
bConstraint *con; bConstraint *con;
for (con = lb->first; con; con = con->next) { for (con = lb->first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -300,7 +300,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
if (ob->type == OB_ARMATURE) { if (ob->type == OB_ARMATURE) {
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -338,7 +338,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
/* fix object-level constraints */ /* fix object-level constraints */
if (ob != origArm) { if (ob != origArm) {
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -708,7 +708,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* DO SOME MAGIC HERE */ /* DO SOME MAGIC HERE */
for (pchan = rg->ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = rg->ob->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -833,7 +833,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* DO SOME MAGIC HERE */ /* DO SOME MAGIC HERE */
for (pchan = rg->ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (pchan = rg->ob->pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -424,7 +424,7 @@ static void pose_copy_menu(Scene *scene)
/* copy constraints to tmpbase and apply 'local' tags before /* copy constraints to tmpbase and apply 'local' tags before
* appending to list of constraints for this channel * appending to list of constraints for this channel
*/ */
BKE_copy_constraints(&tmp_constraints, &pchanact->constraints, true); BKE_constraints_copy(&tmp_constraints, &pchanact->constraints, true);
if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) { if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
bConstraint *con; bConstraint *con;
@@ -536,7 +536,7 @@ static void pose_copy_menu(Scene *scene)
/* copy constraints to tmpbase and apply 'local' tags before /* copy constraints to tmpbase and apply 'local' tags before
* appending to list of constraints for this channel * appending to list of constraints for this channel
*/ */
BKE_copy_constraints(&tmp_constraints, &const_copy, true); BKE_constraints_copy(&tmp_constraints, &const_copy, true);
if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) { if ((ob->proxy) && (pchan->bone->layer & arm->layer_protected)) {
/* add proxy-local tags */ /* add proxy-local tags */
for (con = tmp_constraints.first; con; con = con->next) for (con = tmp_constraints.first; con; con = con->next)

View File

@@ -464,7 +464,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
{ {
if (pchan->bone->flag & BONE_SELECTED) { if (pchan->bone->flag & BONE_SELECTED) {
for (con = pchan->constraints.first; con; con = con->next) { for (con = pchan->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -1112,7 +1112,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
// int rb_col; // UNUSED // int rb_col; // UNUSED
/* get constraint typeinfo */ /* get constraint typeinfo */
cti = BKE_constraint_get_typeinfo(con); cti = BKE_constraint_typeinfo_get(con);
if (cti == NULL) { if (cti == NULL) {
/* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */
BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? IFACE_("Null") : IFACE_("Unknown"), sizeof(typestr)); BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? IFACE_("Null") : IFACE_("Unknown"), sizeof(typestr));
@@ -1121,7 +1121,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
BLI_strncpy(typestr, IFACE_(cti->name), sizeof(typestr)); BLI_strncpy(typestr, IFACE_(cti->name), sizeof(typestr));
/* determine whether constraint is proxy protected or not */ /* determine whether constraint is proxy protected or not */
if (BKE_proxylocked_constraints_owner(ob, pchan)) if (BKE_constraints_proxylocked_owner(ob, pchan))
proxy_protected = (con->flag & CONSTRAINT_PROXY_LOCAL) == 0; proxy_protected = (con->flag & CONSTRAINT_PROXY_LOCAL) == 0;
else else
proxy_protected = 0; proxy_protected = 0;
@@ -1184,7 +1184,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
* *
* Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose. * Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose.
*/ */
if (BKE_proxylocked_constraints_owner(ob, pchan)) { if (BKE_constraints_proxylocked_owner(ob, pchan)) {
if (con->prev) { if (con->prev) {
prev_proxylock = (con->prev->flag & CONSTRAINT_PROXY_LOCAL) ? 0 : 1; prev_proxylock = (con->prev->flag & CONSTRAINT_PROXY_LOCAL) ? 0 : 1;
} }

View File

@@ -143,7 +143,7 @@ ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan
/* single constraint */ /* single constraint */
bConstraint *get_active_constraint(Object *ob) bConstraint *get_active_constraint(Object *ob)
{ {
return BKE_constraints_get_active(get_active_constraints(ob)); return BKE_constraints_active_get(get_active_constraints(ob));
} }
/* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */ /* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */
@@ -227,7 +227,7 @@ static void update_pyconstraint_cb(void *arg1, void *arg2)
/* helper function for add_constriant - sets the last target for the active constraint */ /* helper function for add_constriant - sets the last target for the active constraint */
static void set_constraint_nth_target(bConstraint *con, Object *target, const char subtarget[], int index) static void set_constraint_nth_target(bConstraint *con, Object *target, const char subtarget[], int index)
{ {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
int num_targets, i; int num_targets, i;
@@ -299,7 +299,7 @@ static void test_constraints(Object *owner, bPoseChannel *pchan)
/* Check all constraints - is constraint valid? */ /* Check all constraints - is constraint valid? */
if (conlist) { if (conlist) {
for (curcon = conlist->first; curcon; curcon = curcon->next) { for (curcon = conlist->first; curcon; curcon = curcon->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;
@@ -614,7 +614,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
list = get_active_constraints(ob); list = get_active_constraints(ob);
} }
con = BKE_constraints_findByName(list, constraint_name); con = BKE_constraints_find_name(list, constraint_name);
//if (G.debug & G_DEBUG) //if (G.debug & G_DEBUG)
//printf("constraint found = %p, %s\n", (void *)con, (con) ? con->name : "<Not found>"); //printf("constraint found = %p, %s\n", (void *)con, (con) ? con->name : "<Not found>");
@@ -1135,7 +1135,7 @@ void ED_object_constraint_set_active(Object *ob, bConstraint *con)
if ((lb && con) && (con->flag & CONSTRAINT_ACTIVE)) if ((lb && con) && (con->flag & CONSTRAINT_ACTIVE))
return; return;
BKE_constraints_set_active(lb, con); BKE_constraints_active_set(lb, con);
} }
void ED_object_constraint_update(Object *ob) void ED_object_constraint_update(Object *ob)
@@ -1174,9 +1174,9 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
/* free the constraint */ /* free the constraint */
if (BKE_remove_constraint(lb, con)) { if (BKE_constraint_remove(lb, con)) {
/* there's no active constraint now, so make sure this is the case */ /* there's no active constraint now, so make sure this is the case */
BKE_constraints_set_active(lb, NULL); BKE_constraints_active_set(lb, NULL);
ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */ ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */
@@ -1319,7 +1319,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* free constraints for all selected bones */ /* free constraints for all selected bones */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{ {
BKE_free_constraints(&pchan->constraints); BKE_constraints_free(&pchan->constraints);
pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_SPLINEIK | PCHAN_HAS_CONST); pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_SPLINEIK | PCHAN_HAS_CONST);
} }
CTX_DATA_END; CTX_DATA_END;
@@ -1356,7 +1356,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* do freeing */ /* do freeing */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{ {
BKE_free_constraints(&ob->constraints); BKE_constraints_free(&ob->constraints);
DAG_id_tag_update(&ob->id, OB_RECALC_OB); DAG_id_tag_update(&ob->id, OB_RECALC_OB);
} }
CTX_DATA_END; CTX_DATA_END;
@@ -1400,7 +1400,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
{ {
/* if we're not handling the object we're copying from, copy all constraints over */ /* if we're not handling the object we're copying from, copy all constraints over */
if (pchan != chan) { if (pchan != chan) {
BKE_copy_constraints(&chan->constraints, &pchan->constraints, true); BKE_constraints_copy(&chan->constraints, &pchan->constraints, true);
/* update flags (need to add here, not just copy) */ /* update flags (need to add here, not just copy) */
chan->constflag |= pchan->constflag; chan->constflag |= pchan->constflag;
} }
@@ -1440,7 +1440,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
{ {
/* if we're not handling the object we're copying from, copy all constraints over */ /* if we're not handling the object we're copying from, copy all constraints over */
if (obact != ob) { if (obact != ob) {
BKE_copy_constraints(&ob->constraints, &obact->constraints, true); BKE_constraints_copy(&ob->constraints, &obact->constraints, true);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
} }
} }
@@ -1650,9 +1650,9 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* create a new constraint of the type requried, and add it to the active/given constraints list */ /* create a new constraint of the type requried, and add it to the active/given constraints list */
if (pchan) if (pchan)
con = BKE_add_pose_constraint(ob, pchan, NULL, type); con = BKE_constraint_add_for_pose(ob, pchan, NULL, type);
else else
con = BKE_add_ob_constraint(ob, NULL, type); con = BKE_constraint_add_for_object(ob, NULL, type);
/* get the first selected object/bone, and make that the target /* get the first selected object/bone, and make that the target
* - apart from the buttons-window add buttons, we shouldn't add in this way * - apart from the buttons-window add buttons, we shouldn't add in this way
@@ -1948,7 +1948,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
for (con = pchan->constraints.first; con; con = next) { for (con = pchan->constraints.first; con; con = next) {
next = con->next; next = con->next;
if (con->type == CONSTRAINT_TYPE_KINEMATIC) { if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
BKE_remove_constraint(&pchan->constraints, con); BKE_constraint_remove(&pchan->constraints, con);
} }
} }
pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET); pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET);

View File

@@ -990,7 +990,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
} }
else if (event == 22) { else if (event == 22) {
/* Copy the constraint channels over */ /* Copy the constraint channels over */
BKE_copy_constraints(&base->object->constraints, &ob->constraints, true); BKE_constraints_copy(&base->object->constraints, &ob->constraints, true);
do_depgraph_update = true; do_depgraph_update = true;
} }

View File

@@ -738,12 +738,12 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
bFollowPathConstraint *data; bFollowPathConstraint *data;
float cmat[4][4], vec[3]; float cmat[4][4], vec[3];
con = BKE_add_ob_constraint(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH); con = BKE_constraint_add_for_object(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH);
data = con->data; data = con->data;
data->tar = par; data->tar = par;
BKE_get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra); BKE_constraint_target_matrix_get(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
sub_v3_v3v3(vec, ob->obmat[3], cmat[3]); sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
copy_v3_v3(ob->loc, vec); copy_v3_v3(ob->loc, vec);
@@ -1130,7 +1130,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
for (con = ob->constraints.last; con; con = pcon) { for (con = ob->constraints.last; con; con = pcon) {
pcon = con->prev; pcon = con->prev;
if (ELEM3(con->type, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_DAMPTRACK)) if (ELEM3(con->type, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_DAMPTRACK))
BKE_remove_constraint(&ob->constraints, con); BKE_constraint_remove(&ob->constraints, con);
} }
if (type == 1) if (type == 1)
@@ -1186,7 +1186,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{ {
if (ob != obact) { if (ob != obact) {
con = BKE_add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK); con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
data = con->data; data = con->data;
data->tar = obact; data->tar = obact;
@@ -1207,7 +1207,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{ {
if (ob != obact) { if (ob != obact) {
con = BKE_add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO); con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
data = con->data; data = con->data;
data->tar = obact; data->tar = obact;
@@ -1229,7 +1229,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{ {
if (ob != obact) { if (ob != obact) {
con = BKE_add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK); con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
data = con->data; data = con->data;
data->tar = obact; data->tar = obact;

View File

@@ -2050,7 +2050,7 @@ static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat
bool found = false; bool found = false;
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (!cti) if (!cti)
continue; continue;
@@ -2081,7 +2081,7 @@ static Object *object_solver_camera(Scene *scene, Object *ob)
bConstraint *con; bConstraint *con;
for (con = ob->constraints.first; con; con = con->next) { for (con = ob->constraints.first; con; con = con->next) {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (!cti) if (!cti)
continue; continue;

View File

@@ -7497,7 +7497,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
} }
} }
else { else {
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon);
if ((cti && cti->get_constraint_targets) && (curcon->flag & CONSTRAINT_EXPAND)) { if ((cti && cti->get_constraint_targets) && (curcon->flag & CONSTRAINT_EXPAND)) {
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};

View File

@@ -2478,8 +2478,8 @@ static void protectedQuaternionBits(short protectflag, float quat[4], const floa
static void constraintTransLim(TransInfo *t, TransData *td) static void constraintTransLim(TransInfo *t, TransData *td)
{ {
if (td->con) { if (td->con) {
bConstraintTypeInfo *ctiLoc = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); bConstraintTypeInfo *ctiLoc = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_LOCLIMIT);
bConstraintTypeInfo *ctiDist = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT); bConstraintTypeInfo *ctiDist = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_DISTLIMIT);
bConstraintOb cob = {NULL}; bConstraintOb cob = {NULL};
bConstraint *con; bConstraint *con;
@@ -2529,7 +2529,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
} }
/* get constraint targets if needed */ /* get constraint targets if needed */
BKE_get_constraint_targets_for_solving(con, &cob, &targets, ctime); BKE_constraint_targets_for_solving_get(con, &cob, &targets, ctime);
/* do constraint */ /* do constraint */
cti->evaluate_constraint(con, &cob, &targets); cti->evaluate_constraint(con, &cob, &targets);
@@ -2581,7 +2581,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
{ {
if (td->con) { if (td->con) {
bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_ROTLIMIT);
bConstraintOb cob; bConstraintOb cob;
bConstraint *con; bConstraint *con;
bool do_limit = false; bool do_limit = false;
@@ -2648,7 +2648,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
static void constraintSizeLim(TransInfo *t, TransData *td) static void constraintSizeLim(TransInfo *t, TransData *td)
{ {
if (td->con && td->ext) { if (td->con && td->ext) {
bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_SIZELIMIT);
bConstraintOb cob = {NULL}; bConstraintOb cob = {NULL};
bConstraint *con; bConstraint *con;
float size_sign[3], size_abs[3]; float size_sign[3], size_abs[3];

View File

@@ -884,7 +884,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
} }
} }
con = BKE_add_pose_constraint(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC); con = BKE_constraint_add_for_pose(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */ pchan->constflag |= (PCHAN_HAS_IK | PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */
data = con->data; data = con->data;
if (targetless) { if (targetless) {

View File

@@ -374,7 +374,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
/* 1.0=ctime, we pass on object for auto-ik (owner-type here is object, even though /* 1.0=ctime, we pass on object for auto-ik (owner-type here is object, even though
* strictly speaking, it is a posechannel) * strictly speaking, it is a posechannel)
*/ */
BKE_get_constraint_target_matrix(scene, target->con, 0, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0); BKE_constraint_target_matrix_get(scene, target->con, 0, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
/* and set and transform goal */ /* and set and transform goal */
mul_m4_m4m4(goal, goalinv, rootmat); mul_m4_m4m4(goal, goalinv, rootmat);
@@ -385,7 +385,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
/* same for pole vector target */ /* same for pole vector target */
if (data->poletar) { if (data->poletar) {
BKE_get_constraint_target_matrix(scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0); BKE_constraint_target_matrix_get(scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
if (data->flag & CONSTRAINT_IK_SETANGLE) { if (data->flag & CONSTRAINT_IK_SETANGLE) {
/* don't solve IK when we are setting the pole angle */ /* don't solve IK when we are setting the pole angle */

View File

@@ -551,7 +551,7 @@ static bool target_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Fram
bConstraint *constraint = (bConstraint *)target->blenderConstraint; bConstraint *constraint = (bConstraint *)target->blenderConstraint;
float tarmat[4][4]; float tarmat[4][4];
BKE_get_constraint_target_matrix(target->blscene, constraint, 0, CONSTRAINT_OBTYPE_OBJECT, target->owner, tarmat, 1.0); BKE_constraint_target_matrix_get(target->blscene, constraint, 0, CONSTRAINT_OBTYPE_OBJECT, target->owner, tarmat, 1.0);
// rootmat contains the target pose in world coordinate // rootmat contains the target pose in world coordinate
// if enforce is != 1.0, blend the target position with the end effector position // if enforce is != 1.0, blend the target position with the end effector position
@@ -620,7 +620,7 @@ static bool base_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Frame&
IK_Channel &rootchan = ikscene->channels[0]; IK_Channel &rootchan = ikscene->channels[0];
// get polar target matrix in world space // get polar target matrix in world space
BKE_get_constraint_target_matrix(ikscene->blscene, ikscene->polarConstraint, 1, CONSTRAINT_OBTYPE_OBJECT, ikscene->blArmature, mat, 1.0); BKE_constraint_target_matrix_get(ikscene->blscene, ikscene->polarConstraint, 1, CONSTRAINT_OBTYPE_OBJECT, ikscene->blArmature, mat, 1.0);
// convert to armature space // convert to armature space
mul_m4_m4m4(polemat, imat, mat); mul_m4_m4m4(polemat, imat, mat);
// get the target in world space (was computed before as target object are defined before base object) // get the target in world space (was computed before as target object are defined before base object)

View File

@@ -237,7 +237,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
/* if we have the list, check for unique name, otherwise give up */ /* if we have the list, check for unique name, otherwise give up */
if (list) if (list)
BKE_unique_constraint_name(con, list); BKE_constraint_unique_name(con, list);
} }
/* fix all the animation data which may link to this */ /* fix all the animation data which may link to this */
@@ -323,7 +323,7 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C),
PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
{ {
bConstraint *con = (bConstraint *)ptr->data; bConstraint *con = (bConstraint *)ptr->data;
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
ListBase targets = {NULL, NULL}; ListBase targets = {NULL, NULL};
bConstraintTarget *ct; bConstraintTarget *ct;

View File

@@ -1284,20 +1284,20 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr) static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
{ {
Object *ob = (Object *)ptr->id.data; Object *ob = (Object *)ptr->id.data;
bConstraint *con = BKE_constraints_get_active(&ob->constraints); bConstraint *con = BKE_constraints_active_get(&ob->constraints);
return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con); return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
} }
static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value) static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
{ {
Object *ob = (Object *)ptr->id.data; Object *ob = (Object *)ptr->id.data;
BKE_constraints_set_active(&ob->constraints, (bConstraint *)value.data); BKE_constraints_active_set(&ob->constraints, (bConstraint *)value.data);
} }
static bConstraint *rna_Object_constraints_new(Object *object, int type) static bConstraint *rna_Object_constraints_new(Object *object, int type)
{ {
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object); WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
return BKE_add_ob_constraint(object, NULL, type); return BKE_constraint_add_for_object(object, NULL, type);
} }
static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr) static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr)
@@ -1308,7 +1308,7 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, P
return; return;
} }
BKE_remove_constraint(&object->constraints, con); BKE_constraint_remove(&object->constraints, con);
RNA_POINTER_INVALIDATE(con_ptr); RNA_POINTER_INVALIDATE(con_ptr);
ED_object_constraint_update(object); ED_object_constraint_update(object);
@@ -1318,7 +1318,7 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, P
static void rna_Object_constraints_clear(Object *object) static void rna_Object_constraints_clear(Object *object)
{ {
BKE_free_constraints(&object->constraints); BKE_constraints_free(&object->constraints);
ED_object_constraint_update(object); ED_object_constraint_update(object);
ED_object_constraint_set_active(object, NULL); ED_object_constraint_set_active(object, NULL);

View File

@@ -481,14 +481,14 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r
static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr) static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
{ {
bPoseChannel *pchan = (bPoseChannel *)ptr->data; bPoseChannel *pchan = (bPoseChannel *)ptr->data;
bConstraint *con = BKE_constraints_get_active(&pchan->constraints); bConstraint *con = BKE_constraints_active_get(&pchan->constraints);
return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con); return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
} }
static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value) static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value)
{ {
bPoseChannel *pchan = (bPoseChannel *)ptr->data; bPoseChannel *pchan = (bPoseChannel *)ptr->data;
BKE_constraints_set_active(&pchan->constraints, (bConstraint *)value.data); BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
} }
static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type) static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type)
@@ -496,7 +496,7 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ
/*WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); */ /*WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); */
/* TODO, pass object also */ /* TODO, pass object also */
/* TODO, new pose bones don't have updated draw flags */ /* TODO, new pose bones don't have updated draw flags */
return BKE_add_pose_constraint(NULL, pchan, NULL, type); return BKE_constraint_add_for_pose(NULL, pchan, NULL, type);
} }
static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr) static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, PointerRNA *con_ptr)
@@ -510,12 +510,12 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo
return; return;
} }
BKE_remove_constraint(&pchan->constraints, con); BKE_constraint_remove(&pchan->constraints, con);
RNA_POINTER_INVALIDATE(con_ptr); RNA_POINTER_INVALIDATE(con_ptr);
ED_object_constraint_update(ob); ED_object_constraint_update(ob);
BKE_constraints_set_active(&pchan->constraints, NULL); /* XXX, is this really needed? - Campbell */ BKE_constraints_active_set(&pchan->constraints, NULL); /* XXX, is this really needed? - Campbell */
WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id); WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id);

View File

@@ -120,8 +120,8 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
if (copy_constraint) { if (copy_constraint) {
ListBase listb; ListBase listb;
// copy all constraint for backward compatibility // copy all constraint for backward compatibility
// BKE_copy_constraints NULLs listb, no need to make extern for this operation. // BKE_constraints_copy NULLs listb, no need to make extern for this operation.
BKE_copy_constraints(&listb, &pchan->constraints, false); BKE_constraints_copy(&listb, &pchan->constraints, false);
pchan->constraints= listb; pchan->constraints= listb;
} }
else { else {
@@ -288,7 +288,7 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
case CONSTRAINT_TYPE_TRANSFORM: case CONSTRAINT_TYPE_TRANSFORM:
case CONSTRAINT_TYPE_DISTLIMIT: case CONSTRAINT_TYPE_DISTLIMIT:
case CONSTRAINT_TYPE_TRANSLIKE: case CONSTRAINT_TYPE_TRANSLIKE:
cti = BKE_constraint_get_typeinfo(pcon); cti = BKE_constraint_typeinfo_get(pcon);
gametarget = gamesubtarget = NULL; gametarget = gamesubtarget = NULL;
if (cti && cti->get_constraint_targets) { if (cti && cti->get_constraint_targets) {
ListBase listb = { NULL, NULL }; ListBase listb = { NULL, NULL };