diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-11 05:47:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-11 05:47:07 +0400 |
commit | 3216e4b202195ed88455d1b43b348a2cf8f40d77 (patch) | |
tree | 48b91e2916e48c74cc780f4ef2df538949bccf31 /source | |
parent | a15b3c4d111613993eca23d5f99600c2052469e7 (diff) |
API Cleanup: Use BKE_constraint prefix for constraint api
Diffstat (limited to 'source')
36 files changed, 161 insertions, 181 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 2aee502a71e..87da74dc119 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -108,50 +108,44 @@ typedef struct bConstraintTypeInfo { } bConstraintTypeInfo; /* Function Prototypes for bConstraintTypeInfo's */ -bConstraintTypeInfo *BKE_constraint_get_typeinfo(struct bConstraint *con); -bConstraintTypeInfo *BKE_get_constraint_typeinfo(int type); +bConstraintTypeInfo *BKE_constraint_typeinfo_get(struct bConstraint *con); +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 */ -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_copy_constraints(struct ListBase *dst, const struct ListBase *src, bool do_extern); -void BKE_relink_constraints(struct ListBase *list); -void BKE_id_loop_constraints(struct ListBase *list, ConstraintIDFunc func, void *userdata); -void BKE_free_constraint_data(struct bConstraint *con); +void BKE_constraints_free(struct ListBase *list); +void BKE_constraints_copy(struct ListBase *dst, const struct ListBase *src, bool do_extern); +void BKE_constraints_relink(struct ListBase *list); +void BKE_constraints_id_loop(struct ListBase *list, ConstraintIDFunc func, void *userdata); +void BKE_constraint_free_data(struct bConstraint *con); /* Constraint API function prototypes */ -struct bConstraint *BKE_constraints_get_active(struct ListBase *list); -void BKE_constraints_set_active(ListBase *list, struct bConstraint *con); -struct bConstraint *BKE_constraints_findByName(struct ListBase *list, const char *name); +struct bConstraint *BKE_constraints_active_get(struct ListBase *list); +void BKE_constraints_active_set(ListBase *list, struct bConstraint *con); +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_add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type); +struct bConstraint *BKE_constraint_add_for_object(struct Object *ob, 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); -void BKE_remove_constraints_type(ListBase *list, short type, bool last_only); +bool BKE_constraint_remove(ListBase *list, struct bConstraint *con); /* Constraints + Proxies function prototypes */ -void BKE_extract_proxylocal_constraints(struct ListBase *dst, struct ListBase *src); -bool BKE_proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan); +void BKE_constraints_proxylocal_extract(struct ListBase *dst, struct ListBase *src); +bool BKE_constraints_proxylocked_owner(struct Object *ob, struct bPoseChannel *pchan); /* Constraint Evaluation function prototypes */ 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_get_constraint_target_matrix(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_solve_constraints(struct ListBase *conlist, struct bConstraintOb *cob, 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_constraint_targets_for_solving_get(struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime); +void BKE_constraints_solve(struct ListBase *conlist, struct bConstraintOb *cob, float ctime); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index d5efa09bdc9..e0bbe697c27 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -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) { 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->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; } - BKE_free_constraints(&pchan->constraints); + BKE_constraints_free(&pchan->constraints); if (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; /* constraints */ - BKE_copy_constraints(&pchan->constraints, &pchan_from->constraints, true); + BKE_constraints_copy(&pchan->constraints, &pchan_from->constraints, true); /* id-properties */ if (pchan->prop) { diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 845781f9abc..a8f533b8f55 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -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 * 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. */ - BKE_extract_proxylocal_constraints(&proxylocal_constraints, &pchan->constraints); - BKE_copy_constraints(&pchanw.constraints, &pchanp->constraints, false); + BKE_constraints_proxylocal_extract(&proxylocal_constraints, &pchan->constraints); + BKE_constraints_copy(&pchanw.constraints, &pchanp->constraints, false); BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints); /* constraints - set target ob pointer to own object */ 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}; 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); /* 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 * - applies matrix back to pchan, and frees temporary struct used diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 694474d5656..ccc576e74b3 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -89,6 +89,12 @@ # include "BPY_extern.h" #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. * In such case curve_cache might not be ready yet, */ @@ -103,7 +109,7 @@ /* -------------- Naming -------------- */ /* 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)); } @@ -4235,7 +4241,7 @@ static void constraints_init_typeinfo(void) /* This function should be used for getting the appropriate type-info when only * 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? */ 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 * 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 */ if (con) - return BKE_get_constraint_typeinfo(con->type); + return BKE_constraint_typeinfo_from_type(con->type); else return NULL; } @@ -4276,7 +4282,7 @@ bConstraintTypeInfo *BKE_constraint_get_typeinfo(bConstraint *con) /* ---------- 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)) { 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, * unless DAG_relations_tag_update is called. */ -void BKE_free_constraint_data(bConstraint *con) +void BKE_constraint_free_data(bConstraint *con) { if (con->data) { - bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); if (cti) { /* 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 */ -void BKE_free_constraints(ListBase *list) +void BKE_constraints_free(ListBase *list) { bConstraint *con; /* Free constraint data and also any extra data */ for (con = list->first; con; con = con->next) - BKE_free_constraint_data(con); + BKE_constraint_free_data(con); /* Free the whole list */ BLI_freelistN(list); @@ -4322,10 +4328,10 @@ void BKE_free_constraints(ListBase *list) /* 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) { - BKE_free_constraint_data(con); + BKE_constraint_free_data(con); BLI_freelinkN(list, con); return 1; } @@ -4333,33 +4339,13 @@ bool BKE_remove_constraint(ListBase *list, bConstraint *con) 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 */ static bConstraint *add_new_constraint_internal(const char *name, short type) { 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; /* 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) */ 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 * Armature layer, we must tag newly added constraints with a flag which allows them * 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; /* make this constraint the active one */ - BKE_constraints_set_active(list, con); + BKE_constraints_active_set(list, con); } /* 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 */ -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) return NULL; @@ -4452,14 +4438,14 @@ bConstraint *BKE_add_pose_constraint(Object *ob, bPoseChannel *pchan, const char } /* 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); } /* ......... */ -/* 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)) { /* 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?) */ -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 */ - 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 */ -void BKE_id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *userdata) +void BKE_constraints_id_loop(ListBase *conlist, ConstraintIDFunc func, void *userdata) { bConstraint *con; 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->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)) { if (*idpoin && (*idpoin)->lib) 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)) { /* 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 */ -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; @@ -4521,7 +4507,7 @@ void BKE_copy_constraints(ListBase *dst, const ListBase *src, bool do_extern) BLI_duplicatelist(dst, src); 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 */ 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)); } /* finds the 'active' constraint in a constraint stack */ -bConstraint *BKE_constraints_get_active(ListBase *list) +bConstraint *BKE_constraints_active_get(ListBase *list) { 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) */ -void BKE_constraints_set_active(ListBase *list, bConstraint *con) +void BKE_constraints_active_set(ListBase *list, bConstraint *con) { bConstraint *c; @@ -4588,7 +4574,7 @@ void BKE_constraints_set_active(ListBase *list, bConstraint *con) /* -------- Constraints and Proxies ------- */ /* 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; @@ -4605,7 +4591,7 @@ void BKE_extract_proxylocal_constraints(ListBase *dst, ListBase *src) } /* 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 */ 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 * 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}; bConstraintOb *cob; 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 */ -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) { 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 * 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; 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 */ 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}; /* 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); /* 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 */ cti->evaluate_constraint(con, cob, &targets); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 69b07472ea9..df1695daf5b 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -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 (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}; bConstraintTarget *ct; @@ -796,7 +796,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O /* object constraints */ 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}; bConstraintTarget *ct; @@ -1978,7 +1978,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob) if (ob->constraints.first) { bConstraint *con; 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}; 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) { bConstraint *con; 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, CONSTRAINT_TYPE_OBJECTSOLVER)) { @@ -2854,7 +2854,7 @@ void DAG_pose_sort(Object *ob) addtoroot = 0; } 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}; bConstraintTarget *ct; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index a778a074722..10a1d306707 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -536,7 +536,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, int parent /* also update constraint targets */ 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}; if (cti && cti->get_constraint_targets) { diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 4787dbb0701..c6e53dfb7db 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -230,7 +230,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u pose_channel = pose_channel->next) { CALLBACK_INVOKE(pose_channel->custom, IDWALK_NOP); - BKE_id_loop_constraints(&pose_channel->constraints, + BKE_constraints_id_loop(&pose_channel->constraints, library_foreach_constraintObjectLooper, &data); } @@ -239,7 +239,7 @@ void BKE_library_foreach_ID_link(ID *id, LibraryIDLinkCallback callback, void *u modifiers_foreachIDLink(object, library_foreach_modifiersForeachIDLink, &data); - BKE_id_loop_constraints(&object->constraints, + BKE_constraints_id_loop(&object->constraints, library_foreach_constraintObjectLooper, &data); break; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index cae46199285..20b6f72a60b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -394,7 +394,7 @@ void BKE_object_free_ex(Object *ob, bool do_id_user) free_controllers(&ob->controllers); free_actuators(&ob->actuators); - BKE_free_constraints(&ob->constraints); + BKE_constraints_free(&ob->constraints); free_partdeflect(ob->pd); BKE_rigidbody_free_object(ob); @@ -500,7 +500,7 @@ void BKE_object_unlink(Object *ob) bPoseChannel *pchan; for (pchan = obt->pose->chanbase.first; pchan; pchan = pchan->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}; bConstraintTarget *ct; @@ -531,7 +531,7 @@ void BKE_object_unlink(Object *ob) sca_remove_ob_poin(obt, ob); 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}; bConstraintTarget *ct; @@ -1375,7 +1375,7 @@ static void copy_object_pose(Object *obn, Object *ob) } 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}; bConstraintTarget *ct; @@ -1487,7 +1487,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches) BKE_pose_rebuild(obn, obn->data); } 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->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)) { bConstraintOb *cob; 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); } @@ -3439,11 +3439,11 @@ void BKE_object_relink(Object *ob) if (ob->id.lib) return; - BKE_relink_constraints(&ob->constraints); + BKE_constraints_relink(&ob->constraints); if (ob->pose) { bPoseChannel *chan; 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); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 8a912a277ae..3d0045b838e 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -974,7 +974,7 @@ static bool subframe_updateObject(Scene *scene, Object *ob, int update_mesh, int /* also update constraint targets */ 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}; if (cti && cti->get_constraint_targets) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 614c04e6231..2c97d98f2a5 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2787,7 +2787,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) cld.fd = fd; 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) @@ -8223,7 +8223,7 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb) ced.fd = fd; 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 */ for (curcon = lb->first; curcon; curcon = curcon->next) { diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 0283d9b04fb..a054fa05284 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -541,7 +541,7 @@ void blo_do_version_old_trackto_to_constraints(Object *ob) { /* create new trackto constraint from the relationship */ 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; /* copy tracking settings from the object */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 46e735245b4..b4f7332dd1a 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1265,7 +1265,7 @@ static void write_constraints(WriteData *wd, ListBase *conlist) bConstraint *con; 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 */ if (cti && con->data) { diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 61a675d4c8f..1763d185508 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -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) { ListBase targets = {NULL, NULL}; - bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); 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 valid = true; - bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); /* these we can skip completely (invalid constraints...) */ if (cti == NULL) 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) { ListBase targets = {NULL, NULL}; - bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); if (cti && cti->get_constraint_targets) { bConstraintTarget *ct; diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index ea0f6cf0049..bbbbbf211c6 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -478,7 +478,7 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob) std::string name; short* type = 0; et->setData("type", type); - BKE_add_ob_constraint(ob, "Test_con", *type); + BKE_constraint_add_for_object(ob, "Test_con", *type); } } diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index a3bb02520da..1be90df1232 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -208,7 +208,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce) //not ideal: add the target object name as another parameter. //No real mapping in the .dae //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}; if (cti && cti->get_constraint_targets) { diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 52a8137f27f..16975eed75e 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -312,7 +312,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj /* does this constraint have a subtarget in * this armature? */ - bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index e5e4ee9bf08..52423c8fca7 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1221,7 +1221,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) } else { 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}; bConstraintTarget *ct; diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index c214dc35fbf..9afc45955bd 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -104,7 +104,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char * bConstraintTarget *ct; 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}; /* constraint targets */ diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 21f769bb3ed..9faf6d59bd0 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -73,7 +73,7 @@ static void joined_armature_fix_links_constraints( bConstraint *con; 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}; bConstraintTarget *ct; @@ -300,7 +300,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) if (ob->type == OB_ARMATURE) { for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->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}; bConstraintTarget *ct; @@ -338,7 +338,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) /* fix object-level constraints */ if (ob != origArm) { 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}; bConstraintTarget *ct; diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 8f71f722525..b18b21bd682 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -708,7 +708,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* DO SOME MAGIC HERE */ for (pchan = rg->ob->pose->chanbase.first; pchan; pchan = pchan->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}; bConstraintTarget *ct; @@ -833,7 +833,7 @@ static void RIG_reconnectControlBones(RigGraph *rg) /* DO SOME MAGIC HERE */ for (pchan = rg->ob->pose->chanbase.first; pchan; pchan = pchan->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}; bConstraintTarget *ct; diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index e004b37a307..4705d106248 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -424,7 +424,7 @@ static void pose_copy_menu(Scene *scene) /* copy constraints to tmpbase and apply 'local' tags before * 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)) { bConstraint *con; @@ -536,7 +536,7 @@ static void pose_copy_menu(Scene *scene) /* copy constraints to tmpbase and apply 'local' tags before * 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)) { /* add proxy-local tags */ for (con = tmp_constraints.first; con; con = con->next) diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index a852f47ba4b..c10c028c2ae 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -464,7 +464,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op { if (pchan->bone->flag & BONE_SELECTED) { 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}; bConstraintTarget *ct; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6284c1a0442..9fa26373ec5 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1112,7 +1112,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) // int rb_col; // UNUSED /* get constraint typeinfo */ - cti = BKE_constraint_get_typeinfo(con); + cti = BKE_constraint_typeinfo_get(con); if (cti == NULL) { /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ 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)); /* 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; else 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. */ - if (BKE_proxylocked_constraints_owner(ob, pchan)) { + if (BKE_constraints_proxylocked_owner(ob, pchan)) { if (con->prev) { prev_proxylock = (con->prev->flag & CONSTRAINT_PROXY_LOCAL) ? 0 : 1; } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 9b79b2e93da..2e5ca3b7a6b 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -143,7 +143,7 @@ ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan /* single constraint */ 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) -------------------- */ @@ -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 */ 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}; bConstraintTarget *ct; int num_targets, i; @@ -299,7 +299,7 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) /* Check all constraints - is constraint valid? */ if (conlist) { 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}; bConstraintTarget *ct; @@ -614,7 +614,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int 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) //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)) return; - BKE_constraints_set_active(lb, con); + BKE_constraints_active_set(lb, con); } 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); /* 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 */ - 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 */ @@ -1319,7 +1319,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) /* free constraints for all selected 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); } CTX_DATA_END; @@ -1356,7 +1356,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) /* do freeing */ 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); } 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 (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) */ 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 (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); } } @@ -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 */ if (pchan) - con = BKE_add_pose_constraint(ob, pchan, NULL, type); + con = BKE_constraint_add_for_pose(ob, pchan, NULL, type); 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 * - 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) { next = con->next; 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); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5b0bfef6330..8a8881fc6fc 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -990,7 +990,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) } else if (event == 22) { /* 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; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 7e138639cea..44d6bc00250 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -738,12 +738,12 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object bFollowPathConstraint *data; 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->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]); 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) { pcon = con->prev; 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) @@ -1186,7 +1186,7 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { 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->tar = obact; @@ -1207,7 +1207,7 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { 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->tar = obact; @@ -1229,7 +1229,7 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { 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->tar = obact; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index f66e5a74b41..43251ac930f 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2050,7 +2050,7 @@ static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat bool found = false; 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) continue; @@ -2081,7 +2081,7 @@ static Object *object_solver_camera(Scene *scene, Object *ob) bConstraint *con; 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) continue; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index fbd79798ab2..bb31e73f6a1 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7497,7 +7497,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short } } 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)) { ListBase targets = {NULL, NULL}; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8b0667a8992..3ee4cd2da00 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2478,8 +2478,8 @@ static void protectedQuaternionBits(short protectflag, float quat[4], const floa static void constraintTransLim(TransInfo *t, TransData *td) { if (td->con) { - bConstraintTypeInfo *ctiLoc = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); - bConstraintTypeInfo *ctiDist = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT); + bConstraintTypeInfo *ctiLoc = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_LOCLIMIT); + bConstraintTypeInfo *ctiDist = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_DISTLIMIT); bConstraintOb cob = {NULL}; bConstraint *con; @@ -2529,7 +2529,7 @@ static void constraintTransLim(TransInfo *t, TransData *td) } /* 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 */ 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) { if (td->con) { - bConstraintTypeInfo *cti = BKE_get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_ROTLIMIT); bConstraintOb cob; bConstraint *con; bool do_limit = false; @@ -2648,7 +2648,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) static void constraintSizeLim(TransInfo *t, TransData *td) { 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}; bConstraint *con; float size_sign[3], size_abs[3]; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 6f0208175b1..9333fceff5c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -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 */ data = con->data; if (targetless) { diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index c3b6df8ac85..80c508267f3 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -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 * 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 */ 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 */ 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) { /* don't solve IK when we are setting the pole angle */ diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index e1bc47b107f..dbc4100e287 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -551,7 +551,7 @@ static bool target_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Fram bConstraint *constraint = (bConstraint *)target->blenderConstraint; 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 // 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]; // 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 mul_m4_m4m4(polemat, imat, mat); // get the target in world space (was computed before as target object are defined before base object) diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 6d6ea80fec8..1a18a1d8a31 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -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 (list) - BKE_unique_constraint_name(con, list); + BKE_constraint_unique_name(con, list); } /* 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)) { bConstraint *con = (bConstraint *)ptr->data; - bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con); + bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 4a862928838..4a817806b89 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1284,20 +1284,20 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr) static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr) { 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); } static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value) { 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) { 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) @@ -1308,7 +1308,7 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, P return; } - BKE_remove_constraint(&object->constraints, con); + BKE_constraint_remove(&object->constraints, con); RNA_POINTER_INVALIDATE(con_ptr); 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) { - BKE_free_constraints(&object->constraints); + BKE_constraints_free(&object->constraints); ED_object_constraint_update(object); ED_object_constraint_set_active(object, NULL); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index a7be3daea20..18e4ac6b004 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -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) { 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); } static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value) { 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) @@ -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); */ /* TODO, pass object also */ /* 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) @@ -510,12 +510,12 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo return; } - BKE_remove_constraint(&pchan->constraints, con); + BKE_constraint_remove(&pchan->constraints, con); RNA_POINTER_INVALIDATE(con_ptr); 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); diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 3eb782961e3..0392280444d 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -120,8 +120,8 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) if (copy_constraint) { ListBase listb; // copy all constraint for backward compatibility - // BKE_copy_constraints NULLs listb, no need to make extern for this operation. - BKE_copy_constraints(&listb, &pchan->constraints, false); + // BKE_constraints_copy NULLs listb, no need to make extern for this operation. + BKE_constraints_copy(&listb, &pchan->constraints, false); pchan->constraints= listb; } else { @@ -288,7 +288,7 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter) case CONSTRAINT_TYPE_TRANSFORM: case CONSTRAINT_TYPE_DISTLIMIT: case CONSTRAINT_TYPE_TRANSLIKE: - cti = BKE_constraint_get_typeinfo(pcon); + cti = BKE_constraint_typeinfo_get(pcon); gametarget = gamesubtarget = NULL; if (cti && cti->get_constraint_targets) { ListBase listb = { NULL, NULL }; |