Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/constraint.c
| Show First 20 Lines • Show All 6,185 Lines • ▼ Show 20 Lines | |||||
| bool BKE_constraint_is_nonlocal_in_liboverride(const Object *ob, const bConstraint *con) | bool BKE_constraint_is_nonlocal_in_liboverride(const Object *ob, const bConstraint *con) | ||||
| { | { | ||||
| return (ID_IS_OVERRIDE_LIBRARY(ob) && | return (ID_IS_OVERRIDE_LIBRARY(ob) && | ||||
| (con == NULL || (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) == 0)); | (con == NULL || (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) == 0)); | ||||
| } | } | ||||
| /* -------- Target-Matrix Stuff ------- */ | /* -------- Target-Matrix Stuff ------- */ | ||||
| int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets) | |||||
| { | |||||
| r_targets->first = r_targets->last = NULL; | |||||
sybren: Use `BLI_listbase_clear()`. | |||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | |||||
Done Inline ActionsFlip the condition, return early. Same for the other ones, so that the happy flow is going straight down instead of indenting more and more. sybren: Flip the condition, return early. Same for the other ones, so that the happy flow is going… | |||||
| if (!cti) { | |||||
| return 0; | |||||
| } | |||||
| int count = 0; | |||||
| /* Constraint-specific targets. */ | |||||
| if (cti->get_constraint_targets) { | |||||
| count = cti->get_constraint_targets(con, r_targets); | |||||
| } | |||||
| return count; | |||||
Not Done Inline ActionsSimplify: /* Constraint-specific targets. */ if (cti->get_constraint_targets == NULL) { return 0; } return cti->get_constraint_targets(con, r_targets); sybren: Simplify:
```lang=c
/* Constraint-specific targets. */
if (cti->get_constraint_targets ==… | |||||
Done Inline ActionsIt's written this way so a further planned patch (as mentioned this is a part of D9732 split off to simplify review, and I will immediately rebase that one after committing) can simply insert some code without refactoring it again. angavrilov: It's written this way so a further planned patch (as mentioned this is a part of D9732 split… | |||||
| } | |||||
| void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy) | |||||
| { | |||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | |||||
| if (!cti) { | |||||
| return; | |||||
| } | |||||
| /* Release the constraint-specific targets. */ | |||||
| if (cti->flush_constraint_targets) { | |||||
| cti->flush_constraint_targets(con, targets, no_copy); | |||||
| } | |||||
| } | |||||
| void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, | void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| bConstraint *con, | bConstraint *con, | ||||
| int index, | int index, | ||||
| short ownertype, | short ownertype, | ||||
| void *ownerdata, | void *ownerdata, | ||||
| float mat[4][4], | float mat[4][4], | ||||
| float ctime) | float ctime) | ||||
| ▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines | |||||
Use BLI_listbase_clear().