Merge pull request #97763 from Geometror/fix-gn-child-vis-conn-update

Fix `GraphEdit` connections not updating when a child of `GraphNode` goes invisible or changes size
This commit is contained in:
Thaddeus Crews
2025-04-21 08:24:24 -05:00
3 changed files with 10 additions and 5 deletions
+3 -5
View File
@@ -202,10 +202,6 @@ void GraphNode::_resort() {
selected_slot = -1;
}
if (children_count == 0) {
return;
}
int stretch_max = new_size.height - (children_count - 1) * separation;
int stretch_diff = stretch_max - stretch_min;
@@ -293,6 +289,7 @@ void GraphNode::_resort() {
queue_accessibility_update();
queue_redraw();
port_pos_dirty = true;
emit_signal(SNAME("slot_sizes_changed"));
}
void GraphNode::draw_port(int p_slot_index, Point2i p_pos, bool p_left, const Color &p_color) {
@@ -987,7 +984,7 @@ void GraphNode::_port_pos_update() {
slot_count = 0; // Reset the slot count, which is the index of the current slot.
for (int i = 0; i < get_child_count(false); i++) {
Control *child = as_sortable_control(get_child(i, false), SortableVisibilityMode::IGNORE);
Control *child = as_sortable_control(get_child(i, false), SortableVisibilityMode::VISIBLE_IN_TREE);
if (!child) {
continue;
}
@@ -1241,6 +1238,7 @@ void GraphNode::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ignore_invalid_connection_type"), "set_ignore_invalid_connection_type", "is_ignoring_valid_connection_type");
ADD_SIGNAL(MethodInfo("slot_updated", PropertyInfo(Variant::INT, "slot_index")));
ADD_SIGNAL(MethodInfo("slot_sizes_changed"));
BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, GraphNode, panel);
BIND_THEME_ITEM(Theme::DATA_TYPE_STYLEBOX, GraphNode, panel_selected);