diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-24 17:00:01 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-24 17:04:46 +0300 |
commit | 56a336196dbd9d63e84ae8e0cb92b11b211dde6e (patch) | |
tree | f539927f2fbb4286b2b010326044f43600241add /source/blender/blenkernel/intern/idprop.c | |
parent | 90768c9b68c66885f55115c7a3209bc0f3c3aaf3 (diff) |
Add utility function to reset ID property value to a given one
This is similar to idproperty_reset() defined in layer.c, but it does not
re-alloc property itself.
We should replace idproperty_reset() with IDP_Reset() now.
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index b00a62a1a87..33a665ba06e 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1094,4 +1094,15 @@ void IDP_ClearProperty(IDProperty *prop) prop->len = prop->totallen = 0; } +void IDP_Reset(IDProperty *prop, const IDProperty *reference) +{ + if (prop == NULL) { + return; + } + IDP_ClearProperty(prop); + if (reference != NULL) { + IDP_MergeGroup(prop, reference, true); + } +} + /** \} */ |