summaryrefslogtreecommitdiff
path: root/editor/plugins/visual_shader_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-12-17 08:10:20 +0100
committerGitHub <noreply@github.com>2018-12-17 08:10:20 +0100
commit38f8269e1bb64abf757f5a16723e67ffb3744905 (patch)
tree3114bea377a413316d26d4342b27339db716d6c8 /editor/plugins/visual_shader_editor_plugin.cpp
parent7fdb324647dbd98cfd17998e4781175a33c398ea (diff)
parent9d4a996a08e5bab69b7cb405cf7a8590e50b0fe5 (diff)
Merge pull request #24410 from YeldhamDev/graph_editors_title_fix
Fix titles in graph editors being invisible when headers are enabled
Diffstat (limited to 'editor/plugins/visual_shader_editor_plugin.cpp')
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index d3295c0f51..aff465728b 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -341,6 +341,18 @@ void VisualShaderEditor::_update_graph() {
node->add_child(hb);
node->set_slot(i + port_offset, valid_left, port_left, type_color[port_left], valid_right, port_right, type_color[port_right]);
+
+ 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(MARGIN_TOP);
+ 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);
+ }
}
if (vsnode->get_output_port_for_preview() >= 0) {
@@ -605,6 +617,9 @@ void VisualShaderEditor::_notification(int p_what) {
error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
+
+ if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree())
+ _update_graph();
}
if (p_what == NOTIFICATION_PROCESS) {