Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-11-23 23:42:05 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2022-06-03 16:18:26 +0300
commitd040e1da4f6133a8b81a1016b4e80220bed8ace3 (patch)
tree2dc7d2ca4e7fe0d06766e81bd8eb204fee65745b /source/blender/blenkernel/BKE_constraint.h
parent284a3431aeee3e6a922d26415afcb50d0bf30b66 (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/blenkernel/BKE_constraint.h')
-rw-r--r--source/blender/blenkernel/BKE_constraint.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index ce1f4c2b98c..737b05fee0c 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -307,6 +307,25 @@ void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph,
void *ownerdata,
float mat[4][4],
float ctime);
+
+/**
+ * Retrieves the list of all constraint targets, including the custom space target.
+ * Must be followed by a call to BKE_constraint_targets_flush to free memory.
+ *
+ * \param r_targets Pointer to the list to be initialized with target data.
+ * \returns the number of targets stored in the list.
+ */
+int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets);
+
+/**
+ * Copies changed data from the list produced by BKE_constraint_targets_get back to the constraint
+ * data structures and frees memory.
+ *
+ * \param targets List of targets filled by BKE_constraint_targets_get.
+ * \param no_copy Only free memory without copying changes (read-only mode).
+ */
+void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy);
+
/**
* Get the list of targets required for solving a constraint.
*/