diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-24 16:00:49 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-24 16:00:49 +0300 |
commit | c0ddbf39c4e175537de89d63be60bd3bc20fbace (patch) | |
tree | bfcf12143ce2f8b6f0ed15c80af7151eea03eb51 /source | |
parent | a47a7f2a7beb0e17d903e058b791aa6eae96bf55 (diff) |
Fix T53646: Blender 2.8 multiple crashes in auto UVs generation
Make sure scene and view_layer set for depsgraph before running editors
update. This is required since tagging might happen before we created depsgraph.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index f63a4c90427..38f43f5720b 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -379,6 +379,20 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag) id_tag_update_ntree_special(bmain, graph, id, flag); } +/* TODO(sergey): Consider storing scene and view layer at depsgraph allocation + * time. + */ +void deg_ensure_scene_view_layer(Depsgraph *graph, + Scene *scene, + ViewLayer *view_layer) +{ + if (!graph->need_update) { + return; + } + graph->scene = scene; + graph->view_layer = view_layer; +} + void deg_id_tag_update(Main *bmain, ID *id, int flag) { deg_graph_id_tag_update(bmain, NULL, id, flag); @@ -389,6 +403,11 @@ void deg_id_tag_update(Main *bmain, ID *id, int flag) view_layer, false); if (depsgraph != NULL) { + /* Make sure depsgraph is pointing to a correct scene and + * view layer. This is mainly required in cases when depsgraph + * was not built yet. + */ + deg_ensure_scene_view_layer(depsgraph, scene, view_layer); deg_graph_id_tag_update(bmain, depsgraph, id, flag); } } |