Depsgraph: Fixes for render pipeline building

- Need to assign current scene in the builder: it is used to
  route relations for object's customdata.

- Tweak relation from scene to object for the customdaat: this
  didn't work before because the render pipeline scene has no
	view layer component.

Fixes T65044: Crash when Rendering (F12)
This commit is contained in:
Sergey Sharybin 2019-05-24 10:58:09 +02:00
parent db8aa7b851
commit ba58b9d2af
Notes: blender-bot 2023-02-14 05:44:22 +01:00
Referenced by issue #65044, Crash when Rendering (F12)
4 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,7 @@ namespace DEG {
void DepsgraphNodeBuilder::build_scene_render(Scene *scene)
{
scene_ = scene;
const bool build_compositor = (scene->r.scemode & R_DOCOMP);
IDNode *id_node = add_id_node(&scene->id);
id_node->linked_state = DEG_ID_LINKED_DIRECTLY;

View File

@ -1858,7 +1858,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
/* Special case: modifiers evaluation queries scene for various things like
* data mask to be used. We add relation here to ensure object is never
* evaluated prior to Scene's CoW is ready. */
OperationKey scene_key(&scene_->id, NodeType::LAYER_COLLECTIONS, OperationCode::VIEW_LAYER_EVAL);
OperationKey scene_key(&scene_->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
Relation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation");
rel->flag |= RELATION_FLAG_NO_FLUSH;
/* Modifiers */

View File

@ -29,6 +29,7 @@ namespace DEG {
void DepsgraphRelationBuilder::build_scene_render(Scene *scene)
{
scene_ = scene;
const bool build_compositor = (scene->r.scemode & R_DOCOMP);
build_scene_parameters(scene);
if (build_compositor) {

View File

@ -127,6 +127,11 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
/* Scene parameters, compositor and such. */
build_scene_compositor(scene);
build_scene_parameters(scene);
/* Make final scene evaluation dependent on view layer evaluation. */
OperationKey scene_view_layer_key(
&scene->id, NodeType::LAYER_COLLECTIONS, OperationCode::VIEW_LAYER_EVAL);
OperationKey scene_eval_key(&scene->id, NodeType::PARAMETERS, OperationCode::SCENE_EVAL);
add_relation(scene_view_layer_key, scene_eval_key, "View Layer -> Scene Eval");
/* Build all set scenes. */
if (scene->set != NULL) {
ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);