summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaosus <chaosus89@gmail.com>2019-08-01 08:53:49 +0300
committerChaosus <chaosus89@gmail.com>2019-08-01 11:03:23 +0300
commit82e2efe591aa31603fa62477eec05510903ebd03 (patch)
tree51d220eff517b1d48f440f1c1d4b35e98ffdd9c2
parent507e41e6986b75a81d66ff82dc5754a6909818e3 (diff)
Some visual fixes for Expression node
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index a23805f7e2..d3cdecfea9 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -438,7 +438,7 @@ void VisualShaderEditor::_update_graph() {
int port_offset = 0;
if (is_group) {
- port_offset++;
+ port_offset += 2;
}
Ref<VisualShaderNodeUniform> uniform = vsnode;
@@ -477,6 +477,11 @@ void VisualShaderEditor::_update_graph() {
}
if (is_group) {
+
+ offset = memnew(Control);
+ offset->set_custom_minimum_size(Size2(0, 6 * EDSCALE));
+ node->add_child(offset);
+
HBoxContainer *hb2 = memnew(HBoxContainer);
Button *add_input_btn = memnew(Button);
@@ -524,6 +529,7 @@ void VisualShaderEditor::_update_graph() {
}
HBoxContainer *hb = memnew(HBoxContainer);
+ hb->add_constant_override("separation", 7 * EDSCALE);
Variant default_value;
@@ -559,7 +565,6 @@ void VisualShaderEditor::_update_graph() {
}
if (i == 0 && custom_editor) {
-
hb->add_child(custom_editor);
custom_editor->set_h_size_flags(SIZE_EXPAND_FILL);
} else {
@@ -567,7 +572,6 @@ void VisualShaderEditor::_update_graph() {
if (valid_left) {
if (is_group) {
-
OptionButton *type_box = memnew(OptionButton);
hb->add_child(type_box);
type_box->add_item(TTR("Scalar"));
@@ -580,9 +584,9 @@ void VisualShaderEditor::_update_graph() {
LineEdit *name_box = memnew(LineEdit);
hb->add_child(name_box);
- name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
+ name_box->set_custom_minimum_size(Size2(65 * EDSCALE, 0));
+ name_box->set_h_size_flags(SIZE_EXPAND_FILL);
name_box->set_text(name_left);
- name_box->set_expand_to_text_length(true);
name_box->connect("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i));
name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false));
@@ -600,8 +604,6 @@ void VisualShaderEditor::_update_graph() {
}
}
- hb->add_spacer();
-
if (valid_right) {
if (is_group) {
Button *remove_btn = memnew(Button);
@@ -612,9 +614,9 @@ void VisualShaderEditor::_update_graph() {
LineEdit *name_box = memnew(LineEdit);
hb->add_child(name_box);
- name_box->set_custom_minimum_size(Size2(60 * EDSCALE, 0));
+ name_box->set_custom_minimum_size(Size2(65 * EDSCALE, 0));
+ name_box->set_h_size_flags(SIZE_EXPAND_FILL);
name_box->set_text(name_right);
- name_box->set_expand_to_text_length(true);
name_box->connect("text_entered", this, "_change_output_port_name", varray(name_box, nodes[n_i], i));
name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, true));
@@ -675,7 +677,7 @@ void VisualShaderEditor::_update_graph() {
}
offset = memnew(Control);
- offset->set_custom_minimum_size(Size2(0, 5 * EDSCALE));
+ offset->set_custom_minimum_size(Size2(0, 4 * EDSCALE));
node->add_child(offset);
String error = vsnode->get_warning(visual_shader->get_mode(), type);
@@ -692,12 +694,14 @@ void VisualShaderEditor::_update_graph() {
expression_node->set_control(expression_box, 0);
node->add_child(expression_box);
+ Color background_color = EDITOR_GET("text_editor/highlighting/background_color");
Color text_color = EDITOR_GET("text_editor/highlighting/text_color");
Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color");
expression_box->set_syntax_coloring(true);
+ expression_box->add_color_override("background_color", background_color);
for (List<String>::Element *E = keyword_list.front(); E; E = E->next()) {
@@ -1010,7 +1014,7 @@ void VisualShaderEditor::_node_resized(const Vector2 &p_new_size, int p_type, in
}
undo_redo->create_action(TTR("Resize VisualShader node"), UndoRedo::MERGE_ENDS);
- undo_redo->add_do_method(this, "_set_node_size", p_type, p_node, p_new_size / EDSCALE);
+ undo_redo->add_do_method(this, "_set_node_size", p_type, p_node, p_new_size);
undo_redo->add_undo_method(this, "_set_node_size", p_type, p_node, node->get_size());
undo_redo->commit_action();
}