diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/light.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 10 |
6 files changed, 36 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c index 75c9e0e42a5..07ec8d70af1 100644 --- a/source/blender/blenkernel/intern/light.c +++ b/source/blender/blenkernel/intern/light.c @@ -108,12 +108,15 @@ Light *BKE_light_add(Main *bmain, const char *name) */ void BKE_light_copy_data(Main *bmain, Light *la_dst, const Light *la_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + la_dst->curfalloff = BKE_curvemapping_copy(la_src->curfalloff); if (la_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag); + BKE_id_copy_ex(bmain, (ID *)la_src->nodetree, (ID **)&la_dst->nodetree, flag_private_id_data); } if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 7bfe5a7c8ff..e5fa5ff08b0 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -167,6 +167,8 @@ void BKE_linestyle_copy_data(struct Main *bmain, { /* We never handle usercount here for own data. */ const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; for (int a = 0; a < MAX_MTEX; a++) { if (linestyle_src->mtex[a]) { @@ -176,9 +178,10 @@ void BKE_linestyle_copy_data(struct Main *bmain, } if (linestyle_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)linestyle_src->nodetree, (ID **)&linestyle_dst->nodetree, flag); + BKE_id_copy_ex(bmain, + (ID *)linestyle_src->nodetree, + (ID **)&linestyle_dst->nodetree, + flag_private_id_data); } LineStyleModifier *m; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index a2d13ea182b..c12541b3b22 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -198,10 +198,13 @@ Material *BKE_material_add_gpencil(Main *bmain, const char *name) */ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + if (ma_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)&ma_dst->nodetree, flag); + BKE_id_copy_ex(bmain, (ID *)ma_src->nodetree, (ID **)&ma_dst->nodetree, flag_private_id_data); } if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ef49c958d37..bfffe21ef56 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -239,6 +239,8 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons { /* We never handle usercount here for own data. */ const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; sce_dst->ed = NULL; sce_dst->depsgraph_hash = NULL; @@ -265,9 +267,8 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons BKE_keyingsets_copy(&(sce_dst->keyingsets), &(sce_src->keyingsets)); if (sce_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag); + BKE_id_copy_ex( + bmain, (ID *)sce_src->nodetree, (ID **)&sce_dst->nodetree, flag_private_id_data); BKE_libblock_relink_ex(bmain, sce_dst->nodetree, (void *)(&sce_src->id), diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index ad7c5e3f660..5c03b7730aa 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -423,6 +423,11 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot) */ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + if (!BKE_texture_is_image_user(tex_src)) { tex_dst->ima = NULL; } @@ -434,9 +439,8 @@ void BKE_texture_copy_data(Main *bmain, Tex *tex_dst, const Tex *tex_src, const if (tex_src->nodetree->execdata) { ntreeTexEndExecTree(tex_src->nodetree->execdata); } - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)tex_src->nodetree, (ID **)&tex_dst->nodetree, flag); + BKE_id_copy_ex( + bmain, (ID *)tex_src->nodetree, (ID **)&tex_dst->nodetree, flag_private_id_data); } if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 109d615ae83..31fc87d7021 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -106,10 +106,14 @@ World *BKE_world_add(Main *bmain, const char *name) */ void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, const int flag) { + /* We never handle usercount here for own data. */ + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; + /* We always need allocation of our private ID data. */ + const int flag_private_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE; + if (wrld_src->nodetree) { - /* Note: nodetree is *not* in bmain, however this specific case is handled at lower level - * (see BKE_libblock_copy_ex()). */ - BKE_id_copy_ex(bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag); + BKE_id_copy_ex( + bmain, (ID *)wrld_src->nodetree, (ID **)&wrld_dst->nodetree, flag_private_id_data); } BLI_listbase_clear(&wrld_dst->gpumaterial); |