summaryrefslogtreecommitdiff
path: root/editor/plugins/shader_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-01-03 17:43:05 +0100
committerGitHub <noreply@github.com>2022-01-03 17:43:05 +0100
commitde066d56a2304b51d8a36e175c565bb7f7f1b11b (patch)
tree4796f639af298ce3744bee4e478aa6347a37f9e1 /editor/plugins/shader_editor_plugin.cpp
parent1032c2c434ec882905b1ab2426d8ce3043dd6958 (diff)
parentfd9c92d4ab32a908a69f6f7fadf65d77c43a6b54 (diff)
Merge pull request #56153 from Chaosus/shader_uniform_limit_warning
Add a shader warning when the uniform buffer limit is exceeded
Diffstat (limited to 'editor/plugins/shader_editor_plugin.cpp')
-rw-r--r--editor/plugins/shader_editor_plugin.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index d5ee52dfab..26c8b02a64 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -293,15 +293,20 @@ void ShaderTextEditor::_update_warning_panel() {
}
warning_count++;
+ int line = w.get_line();
// First cell.
warnings_panel->push_cell();
- warnings_panel->push_meta(w.get_line() - 1);
warnings_panel->push_color(warnings_panel->get_theme_color(SNAME("warning_color"), SNAME("Editor")));
- warnings_panel->add_text(TTR("Line") + " " + itos(w.get_line()));
- warnings_panel->add_text(" (" + w.get_name() + "):");
+ if (line != -1) {
+ warnings_panel->push_meta(line - 1);
+ warnings_panel->add_text(TTR("Line") + " " + itos(line));
+ warnings_panel->add_text(" (" + w.get_name() + "):");
+ warnings_panel->pop(); // Meta goto.
+ } else {
+ warnings_panel->add_text(w.get_name() + ":");
+ }
warnings_panel->pop(); // Color.
- warnings_panel->pop(); // Meta goto.
warnings_panel->pop(); // Cell.
// Second cell.