summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaosus <chaosus89@gmail.com>2019-04-26 10:53:40 +0300
committerChaosus <chaosus89@gmail.com>2019-04-26 10:53:40 +0300
commit7a9735eef485c0f00fea8db81cc38be3ce3e49ec (patch)
tree00b0c8c5f9961c88be77fdc89d650302bdb32005
parent9ef46996cdd94a596b9b4873c829393caf9e9974 (diff)
Fix uniform title color in visual shaders(regression)
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp29
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h1
2 files changed, 18 insertions, 12 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index e91b83bcd8..964303ba22 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -310,6 +310,21 @@ static Ref<StyleBoxEmpty> make_empty_stylebox(float p_margin_left = -1, float p_
return style;
}
+void VisualShaderEditor::_update_created_node(GraphNode *node) {
+
+ if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) {
+ Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode");
+ Color c = sb->get_border_color();
+ Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0);
+ mono_color.a = 0.85;
+ c = mono_color;
+
+ node->add_color_override("title_color", c);
+ c.a = 0.7;
+ node->add_color_override("close_color", c);
+ }
+}
+
void VisualShaderEditor::_update_graph() {
if (updating)
@@ -374,6 +389,7 @@ void VisualShaderEditor::_update_graph() {
Ref<VisualShaderNodeUniform> uniform = vsnode;
if (uniform.is_valid()) {
graph->add_child(node);
+ _update_created_node(node);
LineEdit *uniform_name = memnew(LineEdit);
uniform_name->set_text(uniform->get_uniform_name());
@@ -529,18 +545,7 @@ void VisualShaderEditor::_update_graph() {
if (!uniform.is_valid()) {
graph->add_child(node);
- }
-
- if (EditorSettings::get_singleton()->get("interface/theme/use_graph_node_headers")) {
- Ref<StyleBoxFlat> sb = node->get_stylebox("frame", "GraphNode");
- Color c = sb->get_border_color();
- Color mono_color = ((c.r + c.g + c.b) / 3) < 0.7 ? Color(1.0, 1.0, 1.0) : Color(0.0, 0.0, 0.0);
- mono_color.a = 0.85;
- c = mono_color;
-
- node->add_color_override("title_color", c);
- c.a = 0.7;
- node->add_color_override("close_color", c);
+ _update_created_node(node);
}
}
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index a00f020ebd..35041da2bd 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -179,6 +179,7 @@ class VisualShaderEditor : public VBoxContainer {
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool _is_available(int p_flags);
+ void _update_created_node(GraphNode *node);
protected:
void _notification(int p_what);