diff options
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
3 files changed, 40 insertions, 8 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 097c377ece4..16510d5f9a6 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -178,6 +178,9 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) if (GS(id_orig->name) == ID_OB) { flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY; } + if (GS(id_orig->name) == ID_NT) { + flag |= ID_RECALC_NTREE_OUTPUT; + } } /* Restore recalc flags from original ID, which could possibly contain recalc flags set by * an operator and then were carried on by the undo system. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 67f454b608b..80be781da48 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1741,14 +1741,19 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) /* Animation, */ build_animdata(&ntree->id); /* Output update. */ - ID *id_cow = get_cow_id(&ntree->id); - add_operation_node(&ntree->id, - NodeType::NTREE_OUTPUT, - OperationCode::NTREE_OUTPUT, - [id_cow](::Depsgraph * /*depsgraph*/) { - bNodeTree *ntree_cow = reinterpret_cast<bNodeTree *>(id_cow); - bke::node_tree_runtime::handle_node_tree_output_changed(*ntree_cow); - }); + add_operation_node(&ntree->id, NodeType::NTREE_OUTPUT, OperationCode::NTREE_OUTPUT); + if (ntree->type == NTREE_GEOMETRY) { + ID *id_cow = get_cow_id(&ntree->id); + add_operation_node(&ntree->id, + NodeType::NTREE_GEOMETRY_PREPROCESS, + OperationCode::NTREE_GEOMETRY_PREPROCESS, + [id_cow](::Depsgraph * /*depsgraph*/) { + bNodeTree *ntree_cow = reinterpret_cast<bNodeTree *>(id_cow); + bke::node_tree_runtime::preprocess_geometry_node_tree_for_evaluation( + *ntree_cow); + }); + } + /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { build_idproperties(bnode->prop); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 39dad18ff2b..e5b03bd5291 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1723,6 +1723,11 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) if (GS(id_ptr->name) == ID_NT) { ComponentKey ntree_output_key(id_ptr, NodeType::NTREE_OUTPUT); add_relation(driver_key, ntree_output_key, "Drivers -> NTree Output"); + if (reinterpret_cast<bNodeTree *>(id_ptr)->type == NTREE_GEOMETRY) { + OperationKey ntree_geo_preprocess_key( + id, NodeType::NTREE_GEOMETRY_PREPROCESS, OperationCode::NTREE_GEOMETRY_PREPROCESS); + add_relation(driver_key, ntree_geo_preprocess_key, "Drivers -> NTree Geo Preprocess"); + } } } @@ -2611,6 +2616,16 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) build_animdata(&ntree->id); build_parameters(&ntree->id); OperationKey ntree_output_key(&ntree->id, NodeType::NTREE_OUTPUT, OperationCode::NTREE_OUTPUT); + OperationKey ntree_geo_preprocess_key( + &ntree->id, NodeType::NTREE_GEOMETRY_PREPROCESS, OperationCode::NTREE_GEOMETRY_PREPROCESS); + if (ntree->type == NTREE_GEOMETRY) { + OperationKey ntree_cow_key(&ntree->id, NodeType::COPY_ON_WRITE, OperationCode::COPY_ON_WRITE); + add_relation(ntree_cow_key, ntree_geo_preprocess_key, "COW -> Preprocess"); + add_relation(ntree_geo_preprocess_key, + ntree_output_key, + "Preprocess -> Output", + RELATION_FLAG_NO_FLUSH); + } /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { build_idproperties(bnode->prop); @@ -2687,6 +2702,12 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) * the output). Currently, we lack the infrastructure to check for these cases efficiently. * That can be added later. */ add_relation(group_output_key, ntree_output_key, "Group Node"); + if (group_ntree->type == NTREE_GEOMETRY) { + OperationKey group_preprocess_key(&group_ntree->id, + NodeType::NTREE_GEOMETRY_PREPROCESS, + OperationCode::NTREE_GEOMETRY_PREPROCESS); + add_relation(group_preprocess_key, ntree_geo_preprocess_key, "Group Node Preprocess"); + } } else { BLI_assert_msg(0, "Unknown ID type used for node"); @@ -2703,6 +2724,9 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) if (check_id_has_anim_component(&ntree->id)) { ComponentKey animation_key(&ntree->id, NodeType::ANIMATION); add_relation(animation_key, ntree_output_key, "NTree Shading Parameters"); + if (ntree->type == NTREE_GEOMETRY) { + add_relation(animation_key, ntree_geo_preprocess_key, "NTree Animation -> Preprocess"); + } } } |