Skip to content
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

Fix GraphNode slot index inconsistency. #83892

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scene/gui/graph_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {

// Determine slot height.
int slot_index = graph_node->get_input_port_slot(j);
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index));
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false));

port_size.height = MAX(port_size.height, child ? child->get_size().y : 0);

Expand All @@ -612,7 +612,7 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {

// Determine slot height.
int slot_index = graph_node->get_output_port_slot(j);
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index));
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false));
port_size.height = MAX(port_size.height, child ? child->get_size().y : 0);

if (is_in_output_hotzone(graph_node, j, p_point / zoom, port_size)) {
Expand Down Expand Up @@ -643,7 +643,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {

// Determine slot height.
int slot_index = graph_node->get_output_port_slot(j);
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index));
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false));
port_size.height = MAX(port_size.height, child ? child->get_size().y : 0);

if (is_in_output_hotzone(graph_node, j, click_pos, port_size)) {
Expand Down Expand Up @@ -700,7 +700,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {

// Determine slot height.
int slot_index = graph_node->get_input_port_slot(j);
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index));
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false));
port_size.height = MAX(port_size.height, child ? child->get_size().y : 0);

if (is_in_input_hotzone(graph_node, j, click_pos, port_size)) {
Expand Down Expand Up @@ -777,7 +777,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {

// Determine slot height.
int slot_index = graph_node->get_output_port_slot(j);
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index));
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false));
port_size.height = MAX(port_size.height, child ? child->get_size().y : 0);

int type = graph_node->get_output_port_type(j);
Expand All @@ -801,7 +801,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {

// Determine slot height.
int slot_index = graph_node->get_input_port_slot(j);
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index));
Control *child = Object::cast_to<Control>(graph_node->get_child(slot_index, false));
port_size.height = MAX(port_size.height, child ? child->get_size().y : 0);

int type = graph_node->get_input_port_type(j);
Expand Down
4 changes: 2 additions & 2 deletions scene/gui/graph_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,15 @@ void GraphNode::_port_pos_update() {
port_cache.pos = Point2i(edgeofs, vertical_ofs + size.height / 2);
port_cache.type = slot_table[i].type_left;
port_cache.color = slot_table[i].color_left;
port_cache.slot_index = child->get_index(); // Index with internal nodes included.
port_cache.slot_index = child->get_index(false);
left_port_cache.push_back(port_cache);
}
if (slot_table[i].enable_right) {
PortCache port_cache;
port_cache.pos = Point2i(get_size().width - edgeofs, vertical_ofs + size.height / 2);
port_cache.type = slot_table[i].type_right;
port_cache.color = slot_table[i].color_right;
port_cache.slot_index = child->get_index(); // Index with internal nodes included.
port_cache.slot_index = child->get_index(false);
right_port_cache.push_back(port_cache);
}
}
Expand Down
Loading