Nodes: add owner_tree method to nodes

This commit is contained in:
Jacques Lucke
2022-09-07 10:24:34 +02:00
parent 2b43173fa9
commit 17d8028181
2 changed files with 8 additions and 0 deletions

View File

@@ -361,6 +361,12 @@ inline const bNodeSocket &bNode::output_by_identifier(blender::StringRef identif
return *this->runtime->outputs_by_identifier.lookup_as(identifier);
}
inline const bNodeTree &bNode::owner_tree() const
{
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
return *this->runtime->owner_tree;
}
inline blender::StringRefNull bNode::label_or_name() const
{
if (this->label[0] == '\0') {

View File

@@ -410,6 +410,8 @@ typedef struct bNode {
/** Lookup socket of this node by its identifier. */
const bNodeSocket &input_by_identifier(blender::StringRef identifier) const;
const bNodeSocket &output_by_identifier(blender::StringRef identifier) const;
/** Node tree this node belongs to. */
const bNodeTree &owner_tree() const;
#endif
} bNode;