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:
authorBastien Montagne <bastien@blender.org>2020-09-18 16:11:31 +0300
committerBastien Montagne <bastien@blender.org>2020-09-20 17:26:39 +0300
commit8afa42b05a260eb4b77327b296e19b24b74b123b (patch)
tree45e7fc9637c0fd76676091a04e14fc098eda9bb3 /source/blender/blenkernel/intern/idprop.c
parent0bd736e5da6da801f8dd4ba9b4cf9bf17f2daa64 (diff)
IDProperties: Add utils to duplicate content of one IDProp into another.
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 189eef5e175..a3e7d8c794d 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -787,6 +787,19 @@ IDProperty *IDP_CopyProperty(const IDProperty *prop)
return IDP_CopyProperty_ex(prop, 0);
}
+/**
+ * Copy content from source IDProperty into destination one, freeing destination property's content
+ * first.
+ */
+void IDP_CopyPropertyContent(IDProperty *dst, IDProperty *src)
+{
+ IDProperty *idprop_tmp = IDP_CopyProperty(src);
+ idprop_tmp->prev = dst->prev;
+ idprop_tmp->next = dst->next;
+ SWAP(IDProperty, *dst, *idprop_tmp);
+ IDP_FreeProperty(idprop_tmp);
+}
+
/* Updates ID pointers after an object has been copied */
/* TODO Nuke this once its only user has been correctly converted
* to use generic ID management from BKE_library! */