diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_node_runtime.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_node_runtime.hh | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh index f2e551a9f32..194820aa4ba 100644 --- a/source/blender/blenkernel/BKE_node_runtime.hh +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -21,6 +21,7 @@ struct bNodeType; namespace blender::nodes { struct FieldInferencingInterface; class NodeDeclaration; +struct GeometryNodesLazyFunctionGraphInfo; } // namespace blender::nodes namespace blender::bke { @@ -49,6 +50,15 @@ class bNodeTreeRuntime : NonCopyable, NonMovable { std::unique_ptr<nodes::FieldInferencingInterface> field_inferencing_interface; /** + * For geometry nodes, a lazy function graph with some additional info is cached. This is used to + * evaluate the node group. Caching it here allows us to reuse the preprocessed node tree in case + * its used multiple times. + */ + std::mutex geometry_nodes_lazy_function_graph_info_mutex; + std::unique_ptr<nodes::GeometryNodesLazyFunctionGraphInfo> + geometry_nodes_lazy_function_graph_info; + + /** * Protects access to all topology cache variables below. This is necessary so that the cache can * be updated on a const #bNodeTree. */ @@ -70,6 +80,7 @@ class bNodeTreeRuntime : NonCopyable, NonMovable { MultiValueMap<const bNodeType *, bNode *> nodes_by_type; Vector<bNode *> toposort_left_to_right; Vector<bNode *> toposort_right_to_left; + Vector<bNode *> group_nodes; bool has_link_cycle = false; bool has_undefined_nodes_or_sockets = false; bNode *group_output_node = nullptr; @@ -148,6 +159,12 @@ class bNodeRuntime : NonCopyable, NonMovable { namespace node_tree_runtime { +/** + * Is executed when the depsgraph determines that something in the node group changed that will + * affect the output. + */ +void handle_node_tree_output_changed(bNodeTree &tree_cow); + class AllowUsingOutdatedInfo : NonCopyable, NonMovable { private: const bNodeTree &tree_; @@ -241,6 +258,18 @@ inline blender::Span<bNode *> bNodeTree::all_nodes() return this->runtime->nodes; } +inline blender::Span<const bNode *> bNodeTree::group_nodes() const +{ + BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this)); + return this->runtime->group_nodes; +} + +inline blender::Span<bNode *> bNodeTree::group_nodes() +{ + BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this)); + return this->runtime->group_nodes; +} + inline bool bNodeTree::has_link_cycle() const { BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this)); @@ -413,7 +442,6 @@ inline blender::Span<const bNodeLink *> bNode::internal_links_span() const inline const blender::nodes::NodeDeclaration *bNode::declaration() const { - BLI_assert(this->runtime->declaration != nullptr); return this->runtime->declaration; } |