Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/idprop.c
| Show First 20 Lines • Show All 594 Lines • ▼ Show 20 Lines | |||||
| void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) | void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) | ||||
| { | { | ||||
| IDProperty *prop_exist = IDP_GetPropertyFromGroup(group, prop->name); | IDProperty *prop_exist = IDP_GetPropertyFromGroup(group, prop->name); | ||||
| IDP_ReplaceInGroup_ex(group, prop, prop_exist); | IDP_ReplaceInGroup_ex(group, prop, prop_exist); | ||||
| } | } | ||||
| /** | /** | ||||
| * Same as IDP_MergeGroup but recursively | |||||
| */ | |||||
| void IDP_MergeGroupValues(IDProperty *dest, IDProperty *src) | |||||
campbellbarton: Would name `IDP_MergeGroupRecursive` (otherwise its not real obvious what the difference is to… | |||||
| { | |||||
| 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. | * If a property is missing in \a dest, add it. | ||||
| */ | */ | ||||
| void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) | void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) | ||||
| { | { | ||||
| IDProperty *prop; | IDProperty *prop; | ||||
| BLI_assert(dest->type == IDP_GROUP); | BLI_assert(dest->type == IDP_GROUP); | ||||
| BLI_assert(src->type == IDP_GROUP); | BLI_assert(src->type == IDP_GROUP); | ||||
| ▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines | |||||
Would name IDP_MergeGroupRecursive (otherwise its not real obvious what the difference is to IDP_MergeGroup)