From d040e1da4f6133a8b81a1016b4e80220bed8ace3 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Mon, 23 Nov 2020 23:42:05 +0300 Subject: Constraints: introduce wrapper functions to access target lists. Instead of directly accessing constraint-specific callbacks in code all over blender, introduce two wrappers to retrieve and free the target list. This incidentally revealed a place within the Collada exporter in BCAnimationSampler.cpp that didn't clean up after retrieving the targets, resulting in a small memory leak. Fixing this should be the only functional change in this commit. This was split off from D9732. Differential Revision: https://developer.blender.org/D13844 --- source/blender/makesrna/intern/rna_constraint.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 24f226eb6e6..1420ef36493 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -598,22 +598,17 @@ static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSE bool *UNUSED(r_free)) { bConstraint *con = (bConstraint *)ptr->data; - const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; - if (cti && cti->get_constraint_targets) { - cti->get_constraint_targets(con, &targets); - + if (BKE_constraint_targets_get(con, &targets)) { for (ct = targets.first; ct; ct = ct->next) { if (ct->tar && ct->tar->type == OB_ARMATURE) { break; } } - if (cti->flush_constraint_targets) { - cti->flush_constraint_targets(con, &targets, 1); - } + BKE_constraint_targets_flush(con, &targets, 1); if (ct) { return target_space_pchan_items; -- cgit v1.2.3