Skip to content

Commit

Permalink
refactor(NodeView): use get_node()->children/inputs (cached!)
Browse files Browse the repository at this point in the history
  • Loading branch information
berdal84 committed Oct 20, 2024
1 parent 5f91f21 commit 66d75d3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ndbl/gui/NodeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,9 @@ Rect NodeView::get_rect_ex(tools::Space space, NodeViewFlags flags) const
if ( m_view_state.visible )
rects.push_back( this->get_rect(space) );

auto visit = [&](NodeView* view)
auto visit = [&](Node* node)
{
NodeView* view = node->get_component<NodeView>();
if( !view )
return;
if( !view->m_view_state.visible )
Expand All @@ -756,11 +757,11 @@ Rect NodeView::get_rect_ex(tools::Space space, NodeViewFlags flags) const
}
};

auto children = get_adjacent(SlotFlag_CHILD);
const std::vector<Node*>& children = get_node()->children();
std::for_each(children.begin(), children.end(), visit );

auto inputs = get_adjacent(SlotFlag_INPUT);
std::for_each(inputs.begin() , inputs.end() , visit );
const std::vector<Node*>& inputs = get_node()->inputs();
std::for_each(inputs.begin(), inputs.end() , visit );

Rect result = Rect::bbox(&rects);

Expand Down

0 comments on commit 66d75d3

Please sign in to comment.