Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_node_runtime.hh
| Show First 20 Lines • Show All 457 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name #bNode Inline Methods | /** \name #bNode Inline Methods | ||||
| * \{ */ | * \{ */ | ||||
| inline int bNode::index() const | |||||
| { | |||||
| BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this)); | |||||
| const int index = this->runtime->index_in_tree; | |||||
| /* The order of nodes should always be consistent with the `nodes_by_id` vector. */ | |||||
| BLI_assert(index == this->runtime->owner_tree->runtime->nodes_by_id.index_of(this)); | |||||
JacquesLucke: Given that `nodes_by_id` is updated eagerly, maybe the node index should also be updated… | |||||
| return index; | |||||
| } | |||||
| inline blender::Span<bNodeSocket *> bNode::input_sockets() | inline blender::Span<bNodeSocket *> bNode::input_sockets() | ||||
| { | { | ||||
| BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this)); | BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this)); | ||||
| return this->runtime->inputs; | return this->runtime->inputs; | ||||
| } | } | ||||
| inline blender::Span<bNodeSocket *> bNode::output_sockets() | inline blender::Span<bNodeSocket *> bNode::output_sockets() | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 255 Lines • Show Last 20 Lines | |||||
Given that nodes_by_id is updated eagerly, maybe the node index should also be updated eagerly? Seems like that should happen in exactly the same places.