diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-19 14:58:01 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-19 14:58:01 +0300 |
commit | 0f8a57de68f706f73c25c8c456113f25ed634662 (patch) | |
tree | 834d9b1e1049d3118c57dfe3eb88fd369b814d0f /source/blender | |
parent | 335e454db65571e16756d7b287e81bc4dea6b7e6 (diff) | |
parent | 1cddab18ded9489f2f29b0655698f2e2e4e2076a (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/lamp.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 2 |
7 files changed, 27 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 3d0d5f87f15..42596e3f33a 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -145,6 +145,8 @@ void BKE_lamp_copy_data(Main *bmain, Lamp *la_dst, const Lamp *la_src, const int la_dst->curfalloff = 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, false); } diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index f929672e830..667352b6ddb 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -538,13 +538,23 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con ID_IP /* Deprecated */ BLI_assert(test || (r_newid != NULL)); - if (r_newid != NULL && (flag & LIB_ID_CREATE_NO_ALLOCATE) == 0) { - *r_newid = NULL; - } + /* Early output is source is NULL. */ if (id == NULL) { return false; } - + /* Make sure destination pointer is all good. */ + if ((flag & LIB_ID_CREATE_NO_ALLOCATE) == 0) { + if (r_newid != NULL) { + *r_newid = NULL; + } + } + else { + if (r_newid != NULL && *r_newid != NULL) { + /* Allow some garbage non-initialized memory to go in. */ + const size_t size = BKE_libblock_get_alloc_info(GS(id->name), NULL); + memset(*r_newid, 0, size); + } + } if (ELEM(GS(id->name), LIB_ID_TYPES_NOCOPY)) { return false; } diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 1b1a12e702a..f07cb97d476 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -175,7 +175,10 @@ void BKE_linestyle_copy_data( *linestyle_dst->mtex[a] = *linestyle_src->mtex[a]; } } + 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, false); } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3a742520471..d37c7a392ee 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -247,6 +247,8 @@ void BKE_material_copy_data(Main *bmain, Material *ma_dst, const Material *ma_sr } 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, false); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index f49ba37faaa..d3aa7e8501d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -311,6 +311,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, false); BKE_libblock_relink_ex(bmain, sce_dst->nodetree, (void *)(&sce_src->id), &sce_dst->id, false); } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 8f0334a4752..50bb3a5f10d 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -883,6 +883,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, false); } diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index cbe00e3bbc6..4abd2a01d40 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -136,6 +136,8 @@ void BKE_world_copy_data(Main *bmain, World *wrld_dst, const World *wrld_src, co } 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, false); } |