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/editors/armature/pose_select.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/armature/pose_select.c') diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 8790a10f3e5..b6b5d3ee495 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -680,13 +680,10 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) { if (pchan->bone->flag & BONE_SELECTED) { for (con = pchan->constraints.first; con; con = con->next) { - 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) { Object *ob = ct->tar; @@ -702,9 +699,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op } } - if (cti->flush_constraint_targets) { - cti->flush_constraint_targets(con, &targets, 1); - } + BKE_constraint_targets_flush(con, &targets, 1); } } } -- cgit v1.2.3