diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lamp.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 2 |
6 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 038e9377ba4..a4eb40cbb38 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -93,6 +93,8 @@ void BKE_libblock_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r void *BKE_libblock_copy(struct Main *bmain, const struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /* "Deprecated" old API. */ void *BKE_libblock_copy_nolib(const struct ID *id, const bool do_action) ATTR_NONNULL(); +/* Special version. sued by datablock localization. */ +void *BKE_libblock_copy_for_localize(const struct ID *id); void BKE_libblock_rename(struct Main *bmain, struct ID *id, const char *name) ATTR_NONNULL(); void BLI_libblock_ensure_unique_name(struct Main *bmain, const char *name) ATTR_NONNULL(); diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 681ff3b619f..29f62519350 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -150,7 +150,7 @@ Lamp *BKE_lamp_localize(Lamp *la) * * NOTE: Only possible once nested node trees are fully converted to that too. */ - Lamp *lan = BKE_libblock_copy_nolib(&la->id, false); + Lamp *lan = BKE_libblock_copy_for_localize(&la->id); lan->curfalloff = curvemapping_copy(la->curfalloff); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index aa6cbcc343e..a76ac02e06f 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1362,6 +1362,16 @@ void *BKE_libblock_copy_nolib(const ID *id, const bool do_action) return idn; } +void *BKE_libblock_copy_for_localize(const ID *id) +{ + ID *idn; + BKE_libblock_copy_ex(NULL, id, &idn, (LIB_ID_CREATE_NO_MAIN | + LIB_ID_CREATE_NO_USER_REFCOUNT | + LIB_ID_COPY_ACTIONS | + LIB_ID_COPY_NO_ANIMDATA)); + return idn; +} + void BKE_library_free(Library *lib) { if (lib->packedfile) diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 6741ebf39d2..d45b19bc0bf 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -235,7 +235,7 @@ Material *BKE_material_localize(Material *ma) * * NOTE: Only possible once nested node trees are fully converted to that too. */ - Material *man = BKE_libblock_copy_nolib(&ma->id, false); + Material *man = BKE_libblock_copy_for_localize(&ma->id); man->texpaintslot = NULL; man->preview = NULL; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 5031b2de462..bd527ed8a44 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -476,7 +476,7 @@ Tex *BKE_texture_localize(Tex *tex) Tex *texn; - texn = BKE_libblock_copy_nolib(&tex->id, false); + texn = BKE_libblock_copy_for_localize(&tex->id); /* image texture: BKE_texture_free also doesn't decrease */ diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index f4c32987117..e7a4167087b 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -154,7 +154,7 @@ World *BKE_world_localize(World *wrld) World *wrldn; - wrldn = BKE_libblock_copy_nolib(&wrld->id, false); + wrldn = BKE_libblock_copy_for_localize(&wrld->id); if (wrld->nodetree) wrldn->nodetree = ntreeLocalize(wrld->nodetree); |