diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-11-23 23:42:05 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-06-03 16:18:26 +0300 |
commit | d040e1da4f6133a8b81a1016b4e80220bed8ace3 (patch) | |
tree | 2dc7d2ca4e7fe0d06766e81bd8eb204fee65745b /source/blender/draw/engines | |
parent | 284a3431aeee3e6a922d26415afcb50d0bf30b66 (diff) |
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
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_extra.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 5d8ba06e181..b68ccf6e4d9 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -1310,12 +1310,11 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb, } else { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon); + ListBase targets = {NULL, NULL}; - if ((cti && cti->get_constraint_targets) && (curcon->ui_expand_flag & (1 << 0))) { - ListBase targets = {NULL, NULL}; + if ((curcon->ui_expand_flag & (1 << 0)) && BKE_constraint_targets_get(curcon, &targets)) { bConstraintTarget *ct; - cti->get_constraint_targets(curcon, &targets); for (ct = targets.first; ct; ct = ct->next) { /* calculate target's matrix */ @@ -1328,9 +1327,7 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb, OVERLAY_extra_line_dashed(cb, ct->matrix[3], ob->obmat[3], constraint_color); } - if (cti->flush_constraint_targets) { - cti->flush_constraint_targets(curcon, &targets, 1); - } + BKE_constraint_targets_flush(curcon, &targets, 1); } } } |