diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-01-24 14:49:49 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-01-24 14:49:49 +0300 |
commit | 11df5443e5d062e5a08714433eed37b9a78c15ba (patch) | |
tree | ed6e2b692a8dba659db40589c560762b9ee92d3f /source/blender/blenkernel | |
parent | cf84db61a6baf160fc3521e5b5a4121609b9ea8d (diff) | |
parent | 18343c230d2c447f61fb60994b107f6a1adc01e7 (diff) |
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_idprop.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 94c2a94d420..2b02895043f 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -83,6 +83,8 @@ void IDP_FreeString(struct IDProperty *prop) ATTR_NONNULL(); typedef void (*IDPWalkFunc)(void *userData, IDProperty *idp); +void IDP_AssignID(IDProperty *prop, ID *id, const int flag); + /*-------- Group Functions -------*/ /** Sync values from one group to another, only where they match */ diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 1125047be32..e3b27236616 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -461,6 +461,21 @@ static IDProperty *IDP_CopyID(const IDProperty *prop, const int flag) return newp; } +void IDP_AssignID(IDProperty *prop, ID *id, const int flag) +{ + BLI_assert(prop->type == IDP_ID); + + if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0 && IDP_Id(prop) != NULL) { + id_us_min(IDP_Id(prop)); + } + + prop->data.pointer = id; + + if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { + id_us_plus(IDP_Id(prop)); + } +} + /** \} */ /* -------------------------------------------------------------------- */ |