Merge pull request #22239 from Chaosus/fix_vs_connection
Disconnects previous visual shader node before making a new connection
This commit is contained in:
commit
14632cf88f
|
@ -510,6 +510,17 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in
|
|||
}
|
||||
|
||||
undo_redo->create_action("Nodes Connected");
|
||||
|
||||
List<VisualShader::Connection> conns;
|
||||
visual_shader->get_node_connections(type, &conns);
|
||||
|
||||
for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
|
||||
if (E->get().to_node == to && E->get().to_port == p_to_index) {
|
||||
undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
|
||||
undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
|
||||
}
|
||||
}
|
||||
|
||||
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, from, p_from_index, to, p_to_index);
|
||||
undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, from, p_from_index, to, p_to_index);
|
||||
undo_redo->add_do_method(this, "_update_graph");
|
||||
|
|
Loading…
Reference in New Issue