IDProperties: Add utils to duplicate content of one IDProp into another.
This commit is contained in:
parent
0bd736e5da
commit
8afa42b05a
|
@ -127,6 +127,7 @@ struct IDProperty *IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNU
|
|||
ATTR_NONNULL();
|
||||
struct IDProperty *IDP_CopyProperty_ex(const struct IDProperty *prop,
|
||||
const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
void IDP_CopyPropertyContent(IDProperty *dst, IDProperty *src) ATTR_NONNULL();
|
||||
|
||||
bool IDP_EqualsProperties_ex(IDProperty *prop1,
|
||||
IDProperty *prop2,
|
||||
|
|
|
@ -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! */
|
||||
|
|
Loading…
Reference in New Issue