Fix connection lines glitch in visual shaders

This commit is contained in:
Chaosus 2019-04-24 11:23:01 +03:00
parent 93e7eb0ddb
commit 3a3df84d3b
1 changed files with 6 additions and 1 deletions

View File

@ -351,7 +351,6 @@ void VisualShaderEditor::_update_graph() {
Ref<VisualShaderNode> vsnode = visual_shader->get_node(type, nodes[n_i]); Ref<VisualShaderNode> vsnode = visual_shader->get_node(type, nodes[n_i]);
GraphNode *node = memnew(GraphNode); GraphNode *node = memnew(GraphNode);
graph->add_child(node);
/*if (!vsnode->is_connected("changed", this, "_node_changed")) { /*if (!vsnode->is_connected("changed", this, "_node_changed")) {
vsnode->connect("changed", this, "_node_changed", varray(vsnode->get_instance_id()), CONNECT_DEFERRED); vsnode->connect("changed", this, "_node_changed", varray(vsnode->get_instance_id()), CONNECT_DEFERRED);
@ -374,6 +373,8 @@ void VisualShaderEditor::_update_graph() {
Ref<VisualShaderNodeUniform> uniform = vsnode; Ref<VisualShaderNodeUniform> uniform = vsnode;
if (uniform.is_valid()) { if (uniform.is_valid()) {
graph->add_child(node);
LineEdit *uniform_name = memnew(LineEdit); LineEdit *uniform_name = memnew(LineEdit);
uniform_name->set_text(uniform->get_uniform_name()); uniform_name->set_text(uniform->get_uniform_name());
node->add_child(uniform_name); node->add_child(uniform_name);
@ -537,6 +538,10 @@ void VisualShaderEditor::_update_graph() {
error_label->set_text(error); error_label->set_text(error);
node->add_child(error_label); node->add_child(error_label);
} }
if (!uniform.is_valid()) {
graph->add_child(node);
}
} }
for (List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) { for (List<VisualShader::Connection>::Element *E = connections.front(); E; E = E->next()) {