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.
This commit is contained in:
Sergey Sharybin
2018-01-24 14:00:49 +01:00
parent a47a7f2a7b
commit c0ddbf39c4

View File

@@ -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);
}
}