diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-17 14:08:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-17 14:20:11 +0300 |
commit | 6ee2d10005a9e3f47ba6eed53d4e56b9e76f9842 (patch) | |
tree | cc14235e919a16242ac0d832bcab3c0a80195cf8 /source | |
parent | df5fae1fcc9a45c2a38faa1e61522afa70830346 (diff) |
Fix T69974: crashes in .blend files where 3D viewport was split
This was caused by a missing copy of the recently adding 3D viewport shading
ID properties.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 25 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 4 |
3 files changed, 32 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 71668f77efe..faf3d12fdad 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -318,6 +318,10 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons flag_subdata); } + if (sce_src->display.shading.prop) { + sce_dst->display.shading.prop = IDP_CopyProperty(sce_src->display.shading.prop); + } + BKE_sound_reset_scene_runtime(sce_dst); /* Copy sequencer, this is local data! */ diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 62428690206..074809d10c4 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3856,7 +3856,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) { /* Versioning code until next subversion bump goes here. */ - if (!DNA_struct_elem_find( fd->filesdna, "LayerCollection", "short", "local_collections_bits")) { LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { @@ -3867,5 +3866,29 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* Fix wrong 3D viewport copying causing corrupt pointers (T69974). */ + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_VIEW3D) { + View3D *v3d = (View3D *)sl; + + for (ScrArea *sa_other = screen->areabase.first; sa_other; sa_other = sa_other->next) { + for (SpaceLink *sl_other = sa_other->spacedata.first; sl_other; + sl_other = sl_other->next) { + if (sl != sl_other && sl_other->spacetype == SPACE_VIEW3D) { + View3D *v3d_other = (View3D *)sl_other; + + if (v3d->shading.prop == v3d_other->shading.prop) { + v3d_other->shading.prop = NULL; + } + } + } + } + } + } + } + } } } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index cfd0bf9a012..f398a122e61 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -345,6 +345,10 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl) v3dn->shading.type = OB_SOLID; } + if (v3dn->shading.prop) { + v3dn->shading.prop = IDP_CopyProperty(v3do->shading.prop); + } + /* copy or clear inside new stuff */ v3dn->runtime.properties_storage = NULL; |