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:
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index e98181be444..27f7cac2a8e 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -474,6 +474,7 @@ static IDProperty *IDP_CopyGroup(const IDProperty *prop)
BLI_assert(prop->type == IDP_GROUP);
newp = idp_generic_copy(prop);
newp->len = prop->len;
+ newp->subtype = prop->subtype;
for (link = prop->data.group.first; link; link = link->next) {
BLI_addtail(&newp->data.group, IDP_CopyProperty(link));
@@ -599,6 +600,31 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
}
/**
+ * Same as IDP_MergeGroup but recursively
+ */
+void IDP_MergeGroupValues(IDProperty *dest, IDProperty *src)
+{
+ IDProperty *prop;
+
+ BLI_assert(dest->type == IDP_GROUP);
+ BLI_assert(src->type == IDP_GROUP);
+
+ for (prop = src->data.group.first; prop; prop = prop->next) {
+ if (prop->type == IDP_GROUP) {
+ IDProperty *prop_exist = IDP_GetPropertyFromGroup(dest, prop->name);
+
+ if (prop_exist != NULL) {
+ IDP_MergeGroupValues(prop_exist, prop);
+ continue;
+ }
+ }
+
+ IDProperty *copy = IDP_CopyProperty(prop);
+ IDP_ReplaceInGroup(dest, copy);
+ }
+}
+
+/**
* If a property is missing in \a dest, add it.
*/
void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite)