Fix (unreported) bad halding of ID usercounts when fully copying a scene.

This commit is contained in:
Bastien Montagne 2018-10-24 08:43:20 +02:00
parent 35d7211bfa
commit 65d4314b8e
1 changed files with 4 additions and 0 deletions

View File

@ -402,6 +402,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
for (SceneRenderLayer *srl_dst = sce_copy->r.layers.first; srl_dst; srl_dst = srl_dst->next) {
for (FreestyleLineSet *lineset = srl_dst->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
if (lineset->linestyle) {
id_us_min(&lineset->linestyle->id);
/* XXX Not copying anim/actions here? */
BKE_id_copy_ex(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, 0, false);
}
@ -410,12 +411,14 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int 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, false);
}
/* Full copy of GreasePencil. */
/* XXX Not copying anim/actions here? */
if (sce_copy->gpd) {
id_us_min(&sce_copy->gpd->id);
BKE_id_copy_ex(bmain, (ID *)sce_copy->gpd, (ID **)&sce_copy->gpd, 0, false);
}
}
@ -430,6 +433,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
* are done outside of blenkernel with ED_objects_single_users! */
/* camera */
/* XXX This is most certainly useless? Object have not yet been duplicated... */
if (ELEM(type, SCE_COPY_LINK_DATA, SCE_COPY_FULL)) {
ID_NEW_REMAP(sce_copy->camera);
}