Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_node_runtime.hh
| Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | public: | ||||
| /** Initial locx for insert offset animation. */ | /** Initial locx for insert offset animation. */ | ||||
| float anim_init_locx; | float anim_init_locx; | ||||
| /** Offset that will be added to locx for insert offset animation. */ | /** Offset that will be added to locx for insert offset animation. */ | ||||
| float anim_ofsx; | float anim_ofsx; | ||||
| /** List of cached internal links (input to output), for muted nodes and operators. */ | /** List of cached internal links (input to output), for muted nodes and operators. */ | ||||
| Vector<bNodeLink *> internal_links; | Vector<bNodeLink *> internal_links; | ||||
| /** Eagerly maintained cache of the node's index in the tree. */ | |||||
| int index_in_tree = -1; | |||||
| /** Only valid if #topology_cache_is_dirty is false. */ | /** Only valid if #topology_cache_is_dirty is false. */ | ||||
| Vector<bNodeSocket *> inputs; | Vector<bNodeSocket *> inputs; | ||||
| Vector<bNodeSocket *> outputs; | Vector<bNodeSocket *> outputs; | ||||
| Map<StringRefNull, bNodeSocket *> inputs_by_identifier; | Map<StringRefNull, bNodeSocket *> inputs_by_identifier; | ||||
| Map<StringRefNull, bNodeSocket *> outputs_by_identifier; | Map<StringRefNull, bNodeSocket *> outputs_by_identifier; | ||||
| int index_in_tree = -1; | |||||
| bool has_available_linked_inputs = false; | bool has_available_linked_inputs = false; | ||||
| bool has_available_linked_outputs = false; | bool has_available_linked_outputs = false; | ||||
| Vector<bNode *> direct_children_in_frame; | Vector<bNode *> direct_children_in_frame; | ||||
| bNodeTree *owner_tree = nullptr; | bNodeTree *owner_tree = nullptr; | ||||
| }; | }; | ||||
| namespace node_tree_runtime { | namespace node_tree_runtime { | ||||
| ▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name #bNode Inline Methods | /** \name #bNode Inline Methods | ||||
| * \{ */ | * \{ */ | ||||
| inline int bNode::index() const | |||||
| { | |||||
| 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_as(this->identifier)); | |||||
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.