diff options
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 27f7cac2a8e..a3bd15252cb 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -600,32 +600,8 @@ 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. + * Do it recursively. */ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) { @@ -636,13 +612,29 @@ void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overw if (do_overwrite) { 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_MergeGroup(prop_exist, prop, do_overwrite); + continue; + } + } + IDProperty *copy = IDP_CopyProperty(prop); IDP_ReplaceInGroup(dest, copy); } } else { for (prop = src->data.group.first; prop; prop = prop->next) { - if (IDP_GetPropertyFromGroup(dest, prop->name) == NULL) { + IDProperty *prop_exist = IDP_GetPropertyFromGroup(dest, prop->name); + if (prop_exist != NULL) { + if (prop->type == IDP_GROUP) { + IDP_MergeGroup(prop_exist, prop, do_overwrite); + continue; + } + } + else { IDProperty *copy = IDP_CopyProperty(prop); dest->len++; BLI_addtail(&dest->data.group, copy); |