diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-10 20:44:59 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-10 20:45:52 +0300 |
commit | 0621c13b3e60284e0116c4c3aeb11b175f903d52 (patch) | |
tree | 61b46be55a5bf10a9c123018108d14f2fc2b3285 /source/blender/blenkernel/intern/scene.c | |
parent | 14bd92b12f0fa2382c7157ebc00f7adb644c2e85 (diff) |
Add proper handling of liboverrides to Scene deep copy.
Followup to rB74ec37b70cbc8dc2, also missed a case in collection
deepcopy then.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index b6b478f727e..7cf424f53e0 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -751,6 +751,7 @@ void BKE_scene_copy_data_eevee(Scene *sce_dst, const Scene *sce_src) Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type) { + const bool is_scene_liboverride = ID_IS_OVERRIDE_LIBRARY(sce); Scene *sce_copy; /* TODO this should/could most likely be replaced by call to more generic code at some point... @@ -833,6 +834,9 @@ Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type) LISTBASE_FOREACH ( FreestyleLineSet *, lineset, &view_layer_dst->freestyle_config.linesets) { if (lineset->linestyle) { + if (is_scene_liboverride && ID_IS_LINKED(lineset->linestyle)) { + continue; + } id_us_min(&lineset->linestyle->id); BKE_id_copy_ex( bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, LIB_ID_COPY_ACTIONS); @@ -842,14 +846,19 @@ Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type) /* Full copy of world (included animations) */ if (sce_copy->world) { - id_us_min(&sce_copy->world->id); - BKE_id_copy_ex(bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS); + if (!is_scene_liboverride || !ID_IS_LINKED(sce_copy->world)) { + id_us_min(&sce_copy->world->id); + BKE_id_copy_ex( + bmain, (ID *)sce_copy->world, (ID **)&sce_copy->world, LIB_ID_COPY_ACTIONS); + } } /* Full copy of GreasePencil. */ if (sce_copy->gpd) { - id_us_min(&sce_copy->gpd->id); - BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, LIB_ID_COPY_ACTIONS); + if (!is_scene_liboverride || !ID_IS_LINKED(sce_copy->gpd)) { + id_us_min(&sce_copy->gpd->id); + BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, LIB_ID_COPY_ACTIONS); + } } /* Deep-duplicate collections and objects (using preferences' settings for which sub-data to |