Fix (unreported) crash when making object single user in some cases.

Issue would happen in case affected object is linked to collections that
are shared between different scenes' ViewLayers. When switching back to
another scene after making single user, you'd get immediate crash.
This commit is contained in:
Bastien Montagne 2019-03-26 14:39:43 +01:00
parent 6f7392312c
commit 5d455a7a90
1 changed files with 7 additions and 2 deletions

View File

@ -1670,9 +1670,14 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
/* active camera */
ID_NEW_REMAP(scene->camera);
if (v3d) ID_NEW_REMAP(v3d->camera);
if (v3d) {
ID_NEW_REMAP(v3d->camera);
}
BKE_scene_collection_sync(scene);
/* Making single user may affect other scenes if they share with current one some collections in their ViewLayer. */
for (Scene *sce = bmain->scenes.first; sce != NULL; sce = sce->id.next) {
BKE_scene_collection_sync(sce);
}
}
/* not an especially efficient function, only added so the single user