Merge pull request #42490 from Chaosus/vs_fix_func

Fix VisualShaderNode::set_output_port_connected
This commit is contained in:
Yuri Roubinsky 2020-10-02 09:24:36 +03:00 committed by GitHub
commit 76c308f47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -65,20 +65,16 @@ bool VisualShaderNode::is_port_separator(int p_index) const {
bool VisualShaderNode::is_output_port_connected(int p_port) const {
if (connected_output_ports.has(p_port)) {
return connected_output_ports[p_port];
return connected_output_ports[p_port] > 0;
}
return false;
}
void VisualShaderNode::set_output_port_connected(int p_port, bool p_connected) {
if (p_connected) {
connected_output_ports[p_port] = true;
++connected_output_count;
connected_output_ports[p_port]++;
} else {
--connected_output_count;
if (connected_output_count == 0) {
connected_output_ports[p_port] = false;
}
connected_output_ports[p_port]--;
}
}

View File

@ -193,8 +193,7 @@ class VisualShaderNode : public Resource {
Map<int, Variant> default_input_values;
Map<int, bool> connected_input_ports;
Map<int, bool> connected_output_ports;
int connected_output_count = 0;
Map<int, int> connected_output_ports;
protected:
bool simple_decl = true;