Merge pull request #73588 from smosages/resolve-display-shader-settings-in-settings-editor

Define shader language project settings before creation of `TextShaderEditor` object.
This commit is contained in:
Rémi Verschelde 2023-05-09 19:28:17 +02:00
commit de14109862
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 10 additions and 5 deletions

View file

@ -1065,11 +1065,6 @@ void TextShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position)
}
TextShaderEditor::TextShaderEditor() {
GLOBAL_DEF("debug/shader_language/warnings/enable", true);
GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors", false);
for (int i = 0; i < (int)ShaderWarning::WARNING_MAX; i++) {
GLOBAL_DEF("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true);
}
_update_warnings(false);
shader_editor = memnew(ShaderTextEditor);

View file

@ -35,6 +35,7 @@
#include "core/variant/typed_array.h"
#include "servers/rendering/rendering_server_globals.h"
#include "servers/rendering/shader_language.h"
#include "servers/rendering/shader_warnings.h"
RenderingServer *RenderingServer::singleton = nullptr;
RenderingServer *(*RenderingServer::create_func)() = nullptr;
@ -2990,6 +2991,15 @@ void RenderingServer::init() {
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_lights_per_object", PROPERTY_HINT_RANGE, "2,1024,1"), 8);
GLOBAL_DEF_RST_BASIC("xr/shaders/enabled", false);
GLOBAL_DEF("debug/shader_language/warnings/enable", true);
GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors", false);
#ifdef DEBUG_ENABLED
for (int i = 0; i < (int)ShaderWarning::WARNING_MAX; i++) {
GLOBAL_DEF("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true);
}
#endif
}
RenderingServer::~RenderingServer() {