diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-07-10 16:10:17 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-07-10 16:11:58 +0300 |
commit | 806bc4b433965b73973a612fda826e13f60a2817 (patch) | |
tree | 20636abc231d28f43c61b705486f0986cdbe1229 /source/blender/blenkernel | |
parent | 9a4cfc3e77fdf369da57d821b4fb4be0f4dd14bd (diff) |
Fix (unreported) Scene copying doing very stupid things with World and LineStyle usercounts.
Really, really, really need to get rid of this usercount handling
everywhere, hopefully incomming ID copying rewrite will help sanitize
that mess. But fix was needed for 2.79 release!
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 44b71416bf0..c105b630251 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -188,7 +188,9 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) scen = BKE_libblock_copy(bmain, &sce->id); BLI_duplicatelist(&(scen->base), &(sce->base)); - id_us_plus((ID *)scen->world); + if (type != SCE_COPY_FULL) { + id_us_plus((ID *)scen->world); + } id_us_plus((ID *)scen->set); /* id_us_plus((ID *)scen->gm.dome.warptext); */ /* XXX Not refcounted? see readfile.c */ @@ -240,7 +242,8 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) if (type == SCE_COPY_FULL) { for (lineset = new_srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { if (lineset->linestyle) { - id_us_plus((ID *)lineset->linestyle); + /* Has been incremented by BKE_freestyle_config_copy(). */ + id_us_min(lineset->linestyle); lineset->linestyle = BKE_linestyle_copy(bmain, lineset->linestyle); } } @@ -333,7 +336,6 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) /* world */ if (type == SCE_COPY_FULL) { if (scen->world) { - id_us_plus((ID *)scen->world); scen->world = BKE_world_copy(bmain, scen->world); BKE_animdata_copy_id_action((ID *)scen->world, false); } |