-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check before redrawing graph node slot stylebox #65600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with my feedback.
Side note: I'd prefer refreshing slot_info
and cache_y
first, before issuing a redraw, but not sure what repercussions that has without reading the code more in depth
scene/gui/graph_node.cpp
Outdated
@@ -392,7 +392,7 @@ void GraphNode::_notification(int p_what) { | |||
} | |||
|
|||
// Draw slot stylebox. | |||
if (s.draw_stylebox) { | |||
if (s.draw_stylebox && get_child_count() != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion, change line 370 instead
if (E.key < 0 || E.key >= cache_y.size() || get_child_count() == 0) {
continue;
}
OR add an if-clause before that if-clause in line 370:
if (get_child_count() == 0) {
break;
}
Reason is: slot_info
and cache_y
are outdated / dirty, and not yet recalculated
EDIT: if it's desirable to draw slots at least once, even if there are no children, then the 2nd proposal with the break
can be added in line 393 instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I'll move the check to line 370 as per the first proposal. That was my original idea but I wasn't sure how that might affect other things dependent on the code between 370 and 395. Seems like it's no problem!
Looks good! Could you squash the commits? See PR workflow for instructions. |
Sorry, we apparently had another PR that fixed it, see #69284. Thanks for your contribution nonetheless! |
Fixes #65557
Ensure Graph Nodes have more than 0 children before redrawing slot styleboxes. There is already a check in place to ensure the slot's key is not greater than
cache_y.size()
, but it seems the cache isn't updated before redrawing occurs. Possibly a better fix would be to make sure the cache is updated before redrawing? Not sure, pretty new to the engine still.