Fix GraphEdit connections not updating when a child of GraphNode goes invisible or changes size

This commit is contained in:
Hendrik Brucker
2025-04-15 18:31:17 +02:00
parent e5ccaa79e2
commit 867fbd8be3
3 changed files with 10 additions and 5 deletions

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) {
@ -986,7 +983,7 @@ void GraphNode::_port_pos_update() {
int slot_index = 0;
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;
}
@ -1238,6 +1235,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);