summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/core_bind.cpp14
-rw-r--r--core/core_bind.h3
-rw-r--r--core/crypto/crypto.cpp18
-rw-r--r--core/crypto/crypto.h20
-rw-r--r--core/object/object.cpp41
-rw-r--r--core/object/script_language_extension.h2
-rw-r--r--core/register_core_types.cpp2
-rw-r--r--core/string/translation_po.cpp90
-rw-r--r--core/string/translation_po.h14
-rw-r--r--doc/classes/Color.xml8
-rw-r--r--doc/classes/OS.xml14
-rw-r--r--doc/classes/ProjectSettings.xml2
-rw-r--r--doc/classes/SpriteFrames.xml4
-rw-r--r--doc/classes/TLSOptions.xml36
-rw-r--r--doc/classes/Vector2.xml2
-rw-r--r--doc/classes/Vector3.xml2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp3
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h6
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp3
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h2
-rw-r--r--drivers/gles3/shader_gles3.cpp5
-rw-r--r--drivers/gles3/shader_gles3.h2
-rw-r--r--drivers/gles3/storage/config.cpp17
-rw-r--r--drivers/gles3/storage/config.h11
-rw-r--r--drivers/gles3/storage/material_storage.cpp9
-rw-r--r--drivers/gles3/storage/particles_storage.h3
-rw-r--r--drivers/gles3/storage/utilities.cpp5
-rw-r--r--editor/animation_bezier_editor.cpp6
-rw-r--r--editor/animation_track_editor.cpp175
-rw-r--r--editor/animation_track_editor.h1
-rw-r--r--editor/animation_track_editor_plugins.cpp96
-rw-r--r--editor/code_editor.cpp28
-rw-r--r--editor/connections_dialog.cpp4
-rw-r--r--editor/debugger/editor_debugger_node.cpp8
-rw-r--r--editor/debugger/editor_performance_profiler.cpp4
-rw-r--r--editor/debugger/editor_profiler.cpp2
-rw-r--r--editor/debugger/editor_visual_profiler.cpp6
-rw-r--r--editor/debugger/script_editor_debugger.cpp8
-rw-r--r--editor/editor_asset_installer.cpp2
-rw-r--r--editor/editor_audio_buses.cpp12
-rw-r--r--editor/editor_autoload_settings.cpp6
-rw-r--r--editor/editor_command_palette.cpp2
-rw-r--r--editor/editor_help.cpp12
-rw-r--r--editor/editor_inspector.cpp22
-rw-r--r--editor/editor_log.cpp2
-rw-r--r--editor/editor_native_shader_source_visualizer.cpp4
-rw-r--r--editor/editor_node.cpp28
-rw-r--r--editor/editor_node.h23
-rw-r--r--editor/editor_properties.cpp40
-rw-r--r--editor/editor_resource_picker.cpp8
-rw-r--r--editor/editor_settings_dialog.cpp4
-rw-r--r--editor/engine_update_label.cpp4
-rw-r--r--editor/export/editor_export_platform.cpp4
-rw-r--r--editor/export/export_template_manager.cpp10
-rw-r--r--editor/export/project_export.cpp10
-rw-r--r--editor/fbx_importer_manager.cpp4
-rw-r--r--editor/find_in_files.cpp16
-rw-r--r--editor/gui/editor_object_selector.cpp6
-rw-r--r--editor/gui/editor_spin_slider.cpp10
-rw-r--r--editor/gui/editor_validation_panel.cpp8
-rw-r--r--editor/gui/editor_zoom_widget.cpp2
-rw-r--r--editor/import/audio_stream_import_settings.cpp8
-rw-r--r--editor/import/dynamic_font_import_settings.cpp18
-rw-r--r--editor/import_dock.cpp6
-rw-r--r--editor/input_event_configuration_dialog.cpp4
-rw-r--r--editor/inspector_dock.cpp8
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp8
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp8
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp6
-rw-r--r--editor/plugins/animation_library_editor.cpp4
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp8
-rw-r--r--editor/plugins/audio_stream_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp26
-rw-r--r--editor/plugins/curve_editor_plugin.cpp18
-rw-r--r--editor/plugins/editor_preview_plugins.cpp4
-rw-r--r--editor/plugins/font_config_plugin.cpp6
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp40
-rw-r--r--editor/plugins/script_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_editor_plugin.cpp6
-rw-r--r--editor/plugins/texture_layered_editor_plugin.cpp2
-rw-r--r--editor/plugins/theme_editor_plugin.cpp4
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp1
-rw-r--r--editor/plugins/tiles/tile_data_editors.cpp4
-rw-r--r--editor/plugins/tiles/tile_map_layer_editor.cpp6
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp2
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp8
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp41
-rw-r--r--editor/project_manager.cpp10
-rw-r--r--editor/project_manager/project_dialog.cpp6
-rw-r--r--editor/project_manager/project_list.cpp8
-rw-r--r--editor/project_manager/quick_settings_dialog.cpp4
-rw-r--r--editor/project_settings_editor.cpp2
-rw-r--r--editor/rename_dialog.cpp6
-rw-r--r--editor/themes/editor_fonts.cpp19
-rw-r--r--editor/themes/editor_theme_manager.cpp58
-rw-r--r--editor/window_wrapper.cpp6
-rw-r--r--modules/csg/csg_shape.cpp5
-rw-r--r--modules/csg/doc_classes/CSGShape3D.xml2
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp2
-rw-r--r--modules/gdscript/gdscript.cpp14
-rw-r--r--modules/gltf/editor/editor_scene_importer_blend.cpp4
-rw-r--r--modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp2
-rw-r--r--modules/mbedtls/tls_context_mbedtls.cpp12
-rw-r--r--modules/multiplayer/editor/editor_network_profiler.cpp4
-rw-r--r--modules/navigation/nav_map.cpp30
-rw-r--r--modules/text_server_adv/text_server_adv.cpp27
-rw-r--r--platform/linuxbsd/x11/gl_manager_x11.cpp2
-rw-r--r--platform/windows/gl_manager_windows_native.cpp4
-rw-r--r--scene/2d/parallax_layer.cpp4
-rw-r--r--scene/3d/label_3d.cpp2
-rw-r--r--scene/3d/physical_bone_simulator_3d.cpp18
-rw-r--r--scene/animation/animation_blend_space_1d.cpp2
-rw-r--r--scene/animation/animation_blend_space_2d.cpp6
-rw-r--r--scene/animation/animation_mixer.cpp27
-rw-r--r--scene/gui/rich_text_label.cpp21
-rw-r--r--scene/gui/tab_container.cpp4
-rw-r--r--scene/main/node.cpp8
-rw-r--r--scene/resources/visual_shader.cpp53
-rw-r--r--scene/resources/visual_shader.h9
-rw-r--r--scene/scene_string_names.cpp3
-rw-r--r--scene/scene_string_names.h3
-rw-r--r--scene/theme/default_theme.cpp126
-rw-r--r--servers/physics_2d/godot_body_2d.cpp4
-rw-r--r--servers/physics_3d/godot_body_3d.cpp4
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp19
-rw-r--r--servers/rendering/renderer_canvas_render.h9
-rw-r--r--servers/rendering/renderer_compositor.cpp5
-rw-r--r--servers/rendering/renderer_compositor.h2
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp2
-rw-r--r--servers/rendering/shader_types.cpp32
-rw-r--r--servers/rendering_server.cpp2
134 files changed, 997 insertions, 768 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index e8a6a5075b..a1b7b81111 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -194,6 +194,18 @@ void ResourceSaver::_bind_methods() {
////// OS //////
+PackedByteArray OS::get_entropy(int p_bytes) {
+ PackedByteArray pba;
+ pba.resize(p_bytes);
+ Error err = ::OS::get_singleton()->get_entropy(pba.ptrw(), p_bytes);
+ ERR_FAIL_COND_V(err != OK, PackedByteArray());
+ return pba;
+}
+
+String OS::get_system_ca_certificates() {
+ return ::OS::get_singleton()->get_system_ca_certificates();
+}
+
PackedStringArray OS::get_connected_midi_inputs() {
return ::OS::get_singleton()->get_connected_midi_inputs();
}
@@ -573,6 +585,8 @@ String OS::get_unique_id() const {
OS *OS::singleton = nullptr;
void OS::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_entropy", "size"), &OS::get_entropy);
+ ClassDB::bind_method(D_METHOD("get_system_ca_certificates"), &OS::get_system_ca_certificates);
ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &OS::get_connected_midi_inputs);
ClassDB::bind_method(D_METHOD("open_midi_inputs"), &OS::open_midi_inputs);
ClassDB::bind_method(D_METHOD("close_midi_inputs"), &OS::close_midi_inputs);
diff --git a/core/core_bind.h b/core/core_bind.h
index febc33a9c1..b142a2fbbd 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -134,6 +134,9 @@ public:
RENDERING_DRIVER_D3D12,
};
+ PackedByteArray get_entropy(int p_bytes);
+ String get_system_ca_certificates();
+
virtual PackedStringArray get_connected_midi_inputs();
virtual void open_midi_inputs();
virtual void close_midi_inputs();
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index 7fef819159..d3d0079410 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -72,31 +72,26 @@ void X509Certificate::_bind_methods() {
Ref<TLSOptions> TLSOptions::client(Ref<X509Certificate> p_trusted_chain, const String &p_common_name_override) {
Ref<TLSOptions> opts;
opts.instantiate();
+ opts->mode = MODE_CLIENT;
opts->trusted_ca_chain = p_trusted_chain;
opts->common_name = p_common_name_override;
- opts->verify_mode = TLS_VERIFY_FULL;
return opts;
}
Ref<TLSOptions> TLSOptions::client_unsafe(Ref<X509Certificate> p_trusted_chain) {
Ref<TLSOptions> opts;
opts.instantiate();
+ opts->mode = MODE_CLIENT_UNSAFE;
opts->trusted_ca_chain = p_trusted_chain;
- if (p_trusted_chain.is_null()) {
- opts->verify_mode = TLS_VERIFY_NONE;
- } else {
- opts->verify_mode = TLS_VERIFY_CERT;
- }
return opts;
}
Ref<TLSOptions> TLSOptions::server(Ref<CryptoKey> p_own_key, Ref<X509Certificate> p_own_certificate) {
Ref<TLSOptions> opts;
opts.instantiate();
- opts->server_mode = true;
+ opts->mode = MODE_SERVER;
opts->own_certificate = p_own_certificate;
opts->private_key = p_own_key;
- opts->verify_mode = TLS_VERIFY_NONE;
return opts;
}
@@ -104,6 +99,13 @@ void TLSOptions::_bind_methods() {
ClassDB::bind_static_method("TLSOptions", D_METHOD("client", "trusted_chain", "common_name_override"), &TLSOptions::client, DEFVAL(Ref<X509Certificate>()), DEFVAL(String()));
ClassDB::bind_static_method("TLSOptions", D_METHOD("client_unsafe", "trusted_chain"), &TLSOptions::client_unsafe, DEFVAL(Ref<X509Certificate>()));
ClassDB::bind_static_method("TLSOptions", D_METHOD("server", "key", "certificate"), &TLSOptions::server);
+
+ ClassDB::bind_method(D_METHOD("is_server"), &TLSOptions::is_server);
+ ClassDB::bind_method(D_METHOD("is_unsafe_client"), &TLSOptions::is_unsafe_client);
+ ClassDB::bind_method(D_METHOD("get_common_name_override"), &TLSOptions::get_common_name_override);
+ ClassDB::bind_method(D_METHOD("get_trusted_ca_chain"), &TLSOptions::get_trusted_ca_chain);
+ ClassDB::bind_method(D_METHOD("get_private_key"), &TLSOptions::get_private_key);
+ ClassDB::bind_method(D_METHOD("get_own_certificate"), &TLSOptions::get_own_certificate);
}
/// HMACContext
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index fbd01be86d..16649422cf 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -72,17 +72,15 @@ public:
class TLSOptions : public RefCounted {
GDCLASS(TLSOptions, RefCounted);
-public:
- enum TLSVerifyMode {
- TLS_VERIFY_NONE = 0,
- TLS_VERIFY_CERT = 1,
- TLS_VERIFY_FULL = 2,
+private:
+ enum Mode {
+ MODE_CLIENT = 0,
+ MODE_CLIENT_UNSAFE = 1,
+ MODE_SERVER = 2,
};
-private:
- bool server_mode = false;
+ Mode mode = MODE_CLIENT;
String common_name;
- TLSVerifyMode verify_mode = TLS_VERIFY_FULL;
Ref<X509Certificate> trusted_ca_chain;
Ref<X509Certificate> own_certificate;
Ref<CryptoKey> private_key;
@@ -95,12 +93,12 @@ public:
static Ref<TLSOptions> client_unsafe(Ref<X509Certificate> p_trusted_chain);
static Ref<TLSOptions> server(Ref<CryptoKey> p_own_key, Ref<X509Certificate> p_own_certificate);
- TLSVerifyMode get_verify_mode() const { return verify_mode; }
- String get_common_name() const { return common_name; }
+ String get_common_name_override() const { return common_name; }
Ref<X509Certificate> get_trusted_ca_chain() const { return trusted_ca_chain; }
Ref<X509Certificate> get_own_certificate() const { return own_certificate; }
Ref<CryptoKey> get_private_key() const { return private_key; }
- bool is_server() const { return server_mode; }
+ bool is_server() const { return mode == MODE_SERVER; }
+ bool is_unsafe_client() const { return mode == MODE_CLIENT_UNSAFE; }
};
class HMACContext : public RefCounted {
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 0383753f38..97a3a405b9 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -236,20 +236,12 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid
}
if (_extension && _extension->set) {
-// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it.
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wignored-qualifiers"
-#endif
- if (_extension->set(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (const GDExtensionVariantPtr)&p_value)) {
+ if (_extension->set(_extension_instance, (GDExtensionConstStringNamePtr)&p_name, (GDExtensionConstVariantPtr)&p_value)) {
if (r_valid) {
*r_valid = true;
}
return;
}
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
}
// Try built-in setter.
@@ -323,21 +315,12 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const {
}
}
if (_extension && _extension->get) {
-// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it.
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wignored-qualifiers"
-#endif
-
- if (_extension->get(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) {
+ if (_extension->get(_extension_instance, (GDExtensionConstStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) {
if (r_valid) {
*r_valid = true;
}
return ret;
}
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
}
// Try built-in getter.
@@ -575,19 +558,11 @@ bool Object::property_can_revert(const StringName &p_name) const {
}
}
-// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it.
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wignored-qualifiers"
-#endif
if (_extension && _extension->property_can_revert) {
- if (_extension->property_can_revert(_extension_instance, (const GDExtensionStringNamePtr)&p_name)) {
+ if (_extension->property_can_revert(_extension_instance, (GDExtensionConstStringNamePtr)&p_name)) {
return true;
}
}
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
return _property_can_revertv(p_name);
}
@@ -601,19 +576,11 @@ Variant Object::property_get_revert(const StringName &p_name) const {
}
}
-// C style pointer casts should never trigger a compiler warning because the risk is assumed by the user, so GCC should keep quiet about it.
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wignored-qualifiers"
-#endif
if (_extension && _extension->property_get_revert) {
- if (_extension->property_get_revert(_extension_instance, (const GDExtensionStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) {
+ if (_extension->property_get_revert(_extension_instance, (GDExtensionConstStringNamePtr)&p_name, (GDExtensionVariantPtr)&ret)) {
return ret;
}
}
-#if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
if (_property_get_revertv(p_name, ret)) {
return ret;
diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h
index 8fd26c3d2c..c9344f5799 100644
--- a/core/object/script_language_extension.h
+++ b/core/object/script_language_extension.h
@@ -646,7 +646,7 @@ public:
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) override {
int ret = 0;
- GDVIRTUAL_REQUIRED_CALL(_profiling_get_accumulated_data, p_info_arr, p_info_max, ret);
+ GDVIRTUAL_REQUIRED_CALL(_profiling_get_frame_data, p_info_arr, p_info_max, ret);
return ret;
}
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 8a55e4de8f..c0a86e9fb7 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -444,8 +444,8 @@ void unregister_core_types() {
unregister_global_constants();
- ClassDB::cleanup();
ResourceCache::clear();
+ ClassDB::cleanup();
CoreStringNames::free();
StringName::cleanup();
diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp
index 06fd4717d7..8e275505b0 100644
--- a/core/string/translation_po.cpp
+++ b/core/string/translation_po.cpp
@@ -140,43 +140,87 @@ int TranslationPO::_get_plural_index(int p_n) const {
input_val.clear();
input_val.push_back(p_n);
- Variant result;
- for (int i = 0; i < equi_tests.size(); i++) {
- Error err = expr->parse(equi_tests[i], input_name);
- ERR_FAIL_COND_V_MSG(err != OK, 0, "Cannot parse expression. Error: " + expr->get_error_text());
+ return _eq_test(equi_tests, 0);
+}
- result = expr->execute(input_val);
- ERR_FAIL_COND_V_MSG(expr->has_execute_failed(), 0, "Cannot evaluate expression.");
+int TranslationPO::_eq_test(const Ref<EQNode> &p_node, const Variant &p_result) const {
+ if (p_node.is_valid()) {
+ Error err = expr->parse(p_node->regex, input_name);
+ ERR_FAIL_COND_V_MSG(err != OK, 0, vformat("Cannot parse expression \"%s\". Error: %s", p_node->regex, expr->get_error_text()));
- // Last expression. Variant result will either map to a bool or an integer, in both cases returning it will give the correct plural index.
- if (i + 1 == equi_tests.size()) {
- return result;
- }
+ Variant result = expr->execute(input_val);
+ ERR_FAIL_COND_V_MSG(expr->has_execute_failed(), 0, vformat("Cannot evaluate expression \"%s\".", p_node->regex));
if (bool(result)) {
- return i;
+ return _eq_test(p_node->left, result);
+ } else {
+ return _eq_test(p_node->right, result);
}
+ } else {
+ return p_result;
+ }
+}
+
+int TranslationPO::_find_unquoted(const String &p_src, char32_t p_chr) const {
+ const int len = p_src.length();
+ if (len == 0) {
+ return -1;
}
- ERR_FAIL_V_MSG(0, "Unexpected. Function should have returned. Please report this bug.");
+ const char32_t *src = p_src.get_data();
+ bool in_quote = false;
+ for (int i = 0; i < len; i++) {
+ if (in_quote) {
+ if (src[i] == ')') {
+ in_quote = false;
+ }
+ } else {
+ if (src[i] == '(') {
+ in_quote = true;
+ } else if (src[i] == p_chr) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
}
-void TranslationPO::_cache_plural_tests(const String &p_plural_rule) {
+void TranslationPO::_cache_plural_tests(const String &p_plural_rule, Ref<EQNode> &p_node) {
// Some examples of p_plural_rule passed in can have the form:
// "n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5" (Arabic)
// "n >= 2" (French) // When evaluating the last, especially careful with this one.
// "n != 1" (English)
- int first_ques_mark = p_plural_rule.find("?");
+
+ String rule = p_plural_rule;
+ if (rule.begins_with("(") && rule.ends_with(")")) {
+ int bcount = 0;
+ for (int i = 1; i < rule.length() - 1 && bcount >= 0; i++) {
+ if (rule[i] == '(') {
+ bcount++;
+ } else if (rule[i] == ')') {
+ bcount--;
+ }
+ }
+ if (bcount == 0) {
+ rule = rule.substr(1, rule.length() - 2);
+ }
+ }
+
+ int first_ques_mark = _find_unquoted(rule, '?');
+ int first_colon = _find_unquoted(rule, ':');
+
if (first_ques_mark == -1) {
- equi_tests.push_back(p_plural_rule.strip_edges());
+ p_node->regex = rule.strip_edges();
return;
}
- String equi_test = p_plural_rule.substr(0, first_ques_mark).strip_edges();
- equi_tests.push_back(equi_test);
+ p_node->regex = rule.substr(0, first_ques_mark).strip_edges();
- String after_colon = p_plural_rule.substr(p_plural_rule.find(":") + 1, p_plural_rule.length());
- _cache_plural_tests(after_colon);
+ p_node->left.instantiate();
+ _cache_plural_tests(rule.substr(first_ques_mark + 1, first_colon - first_ques_mark - 1).strip_edges(), p_node->left);
+ p_node->right.instantiate();
+ _cache_plural_tests(rule.substr(first_colon + 1).strip_edges(), p_node->right);
}
void TranslationPO::set_plural_rule(const String &p_plural_rule) {
@@ -188,12 +232,12 @@ void TranslationPO::set_plural_rule(const String &p_plural_rule) {
int expression_start = p_plural_rule.find("=", first_semi_col) + 1;
int second_semi_col = p_plural_rule.rfind(";");
- plural_rule = p_plural_rule.substr(expression_start, second_semi_col - expression_start);
+ plural_rule = p_plural_rule.substr(expression_start, second_semi_col - expression_start).strip_edges();
// Setup the cache to make evaluating plural rule faster later on.
- plural_rule = plural_rule.replacen("(", "");
- plural_rule = plural_rule.replacen(")", "");
- _cache_plural_tests(plural_rule);
+ equi_tests.instantiate();
+ _cache_plural_tests(plural_rule, equi_tests);
+
expr.instantiate();
input_name.push_back("n");
}
diff --git a/core/string/translation_po.h b/core/string/translation_po.h
index 73f9b33a87..ba820c6ee4 100644
--- a/core/string/translation_po.h
+++ b/core/string/translation_po.h
@@ -50,7 +50,17 @@ class TranslationPO : public Translation {
String plural_rule;
// Cache temporary variables related to _get_plural_index() to make it faster
- Vector<String> equi_tests;
+ class EQNode : public RefCounted {
+ public:
+ String regex;
+ Ref<EQNode> left;
+ Ref<EQNode> right;
+ };
+ Ref<EQNode> equi_tests;
+
+ int _find_unquoted(const String &p_src, char32_t p_chr) const;
+ int _eq_test(const Ref<EQNode> &p_node, const Variant &p_result) const;
+
Vector<String> input_name;
mutable Ref<Expression> expr;
mutable Array input_val;
@@ -59,7 +69,7 @@ class TranslationPO : public Translation {
mutable int last_plural_n = -1; // Set it to an impossible value at the beginning.
mutable int last_plural_mapped_index = 0;
- void _cache_plural_tests(const String &p_plural_rule);
+ void _cache_plural_tests(const String &p_plural_rule, Ref<EQNode> &p_node);
int _get_plural_index(int p_n) const;
Vector<String> _get_message_list() const override;
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index 37beca5f81..3f0ccc0b5e 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -203,7 +203,7 @@
<return type="Color" />
<param index="0" name="hex" type="int" />
<description>
- Returns the [Color] associated with the provided [param hex] integer in 32-bit RGBA format (8 bits per channel).
+ Returns the [Color] associated with the provided [param hex] integer in 32-bit RGBA format (8 bits per channel). This method is the inverse of [method to_rgba32].
In GDScript and C#, the [int] is best visualized with hexadecimal notation ([code]"0x"[/code] prefix, making it [code]"0xRRGGBBAA"[/code]).
[codeblocks]
[gdscript]
@@ -223,7 +223,7 @@
<return type="Color" />
<param index="0" name="hex" type="int" />
<description>
- Returns the [Color] associated with the provided [param hex] integer in 64-bit RGBA format (16 bits per channel).
+ Returns the [Color] associated with the provided [param hex] integer in 64-bit RGBA format (16 bits per channel). This method is the inverse of [method to_rgba64].
In GDScript and C#, the [int] is best visualized with hexadecimal notation ([code]"0x"[/code] prefix, making it [code]"0xRRRRGGGGBBBBAAAA"[/code]).
</description>
</method>
@@ -441,7 +441,7 @@
<method name="to_rgba32" qualifiers="const">
<return type="int" />
<description>
- Returns the color converted to a 32-bit integer in RGBA format (each component is 8 bits). RGBA is Godot's default format.
+ Returns the color converted to a 32-bit integer in RGBA format (each component is 8 bits). RGBA is Godot's default format. This method is the inverse of [method hex].
[codeblocks]
[gdscript]
var color = Color(1, 0.5, 0.2)
@@ -457,7 +457,7 @@
<method name="to_rgba64" qualifiers="const">
<return type="int" />
<description>
- Returns the color converted to a 64-bit integer in RGBA format (each component is 16 bits). RGBA is Godot's default format.
+ Returns the color converted to a 64-bit integer in RGBA format (each component is 16 bits). RGBA is Godot's default format. This method is the inverse of [method hex64].
[codeblocks]
[gdscript]
var color = Color(1, 0.5, 0.2)
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 7c69bc6ed2..3d048e2f63 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -262,6 +262,14 @@
[b]Note:[/b] This method is not supported on the Web platform. It returns an empty string.
</description>
</method>
+ <method name="get_entropy">
+ <return type="PackedByteArray" />
+ <param index="0" name="size" type="int" />
+ <description>
+ Generates a [PackedByteArray] of cryptographically secure random bytes with given [param size].
+ [b]Note:[/b] Generating large quantities of bytes using this method can result in locking and entropy of lower quality on most platforms. Using [method Crypto.generate_random_bytes] is preferred in most cases.
+ </description>
+ </method>
<method name="get_environment" qualifiers="const">
<return type="String" />
<param index="0" name="variable" type="String" />
@@ -455,6 +463,12 @@
Returns the amount of static memory being used by the program in bytes. Only works in debug builds.
</description>
</method>
+ <method name="get_system_ca_certificates">
+ <return type="String" />
+ <description>
+ Returns the list of certification authorities trusted by the operating system as a string of concatenated certificates in PEM format.
+ </description>
+ </method>
<method name="get_system_dir" qualifiers="const">
<return type="String" />
<param index="0" name="dir" type="int" enum="OS.SystemDir" />
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index c8a11427b9..84542b755c 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -2634,6 +2634,8 @@
[b]Note:[/b] This setting is only effective when using the Forward+ rendering method, not Mobile and Compatibility.
</member>
<member name="rendering/limits/global_shader_variables/buffer_size" type="int" setter="" getter="" default="65536">
+ The maximum number of uniforms that can be used by the global shader uniform buffer. Each item takes up one slot. In other words, a single uniform float and a uniform vec4 will take the same amount of space in the buffer.
+ [b]Note:[/b] When using the Compatibility backend, most mobile devices (and all web exports) will be limited to a maximum size of 1024 due to hardware constraints.
</member>
<member name="rendering/limits/opengl/max_lights_per_object" type="int" setter="" getter="" default="8">
Max number of omnilights and spotlights renderable per object. At the default value of 8, this means that each surface can be affected by up to 8 omnilights and 8 spotlights. This is further limited by hardware support and [member rendering/limits/opengl/max_renderable_lights]. Setting this low will slightly reduce memory usage, may decrease shader compile times, and may result in faster rendering on low-end, mobile, or web devices.
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index 93c4a6e8de..fd8c15c560 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -23,7 +23,7 @@
<param index="2" name="duration" type="float" default="1.0" />
<param index="3" name="at_position" type="int" default="-1" />
<description>
- Adds a frame to the [param anim] animation. If [param at_position] is [code]-1[/code], the frame will be added to the end of the animation.
+ Adds a frame to the [param anim] animation. If [param at_position] is [code]-1[/code], the frame will be added to the end of the animation. [param duration] specifies the relative duration, see [method get_frame_duration] for details.
</description>
</method>
<method name="clear">
@@ -139,7 +139,7 @@
<param index="2" name="texture" type="Texture2D" />
<param index="3" name="duration" type="float" default="1.0" />
<description>
- Sets the [param texture] and the [param duration] of the frame [param idx] in the [param anim] animation.
+ Sets the [param texture] and the [param duration] of the frame [param idx] in the [param anim] animation. [param duration] specifies the relative duration, see [method get_frame_duration] for details.
</description>
</method>
</methods>
diff --git a/doc/classes/TLSOptions.xml b/doc/classes/TLSOptions.xml
index aed100ec07..3bc0bb7e03 100644
--- a/doc/classes/TLSOptions.xml
+++ b/doc/classes/TLSOptions.xml
@@ -40,6 +40,42 @@
[b]Note:[/b] On the Web platform, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature.
</description>
</method>
+ <method name="get_common_name_override" qualifiers="const">
+ <return type="String" />
+ <description>
+ Returns the common name (domain name) override specified when creating with [method TLSOptions.client].
+ </description>
+ </method>
+ <method name="get_own_certificate" qualifiers="const">
+ <return type="X509Certificate" />
+ <description>
+ Returns the [X509Certificate] specified when creating with [method TLSOptions.server].
+ </description>
+ </method>
+ <method name="get_private_key" qualifiers="const">
+ <return type="CryptoKey" />
+ <description>
+ Returns the [CryptoKey] specified when creating with [method TLSOptions.server].
+ </description>
+ </method>
+ <method name="get_trusted_ca_chain" qualifiers="const">
+ <return type="X509Certificate" />
+ <description>
+ Returns the CA [X509Certificate] chain specified when creating with [method TLSOptions.client] or [method TLSOptions.client_unsafe].
+ </description>
+ </method>
+ <method name="is_server" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if created with [method TLSOptions.server], [code]false[/code] otherwise.
+ </description>
+ </method>
+ <method name="is_unsafe_client" qualifiers="const">
+ <return type="bool" />
+ <description>
+ Returns [code]true[/code] if created with [method TLSOptions.client_unsafe], [code]false[/code] otherwise.
+ </description>
+ </method>
<method name="server" qualifiers="static">
<return type="TLSOptions" />
<param index="0" name="key" type="CryptoKey" />
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index a7df54e880..78183ae36c 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -196,7 +196,7 @@
<param index="0" name="with" type="Vector2" />
<description>
Returns the dot product of this vector and [param with]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player.
- The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
+ The dot product will be [code]0[/code] for a right angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned.
[b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code].
</description>
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 1692ba3ece..c04fcd0b24 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -171,7 +171,7 @@
<param index="0" name="with" type="Vector3" />
<description>
Returns the dot product of this vector and [param with]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player.
- The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
+ The dot product will be [code]0[/code] for a right angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned.
[b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code].
</description>
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 5fabeb94f5..941b1a1b28 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -2742,8 +2742,7 @@ RasterizerCanvasGLES3::RasterizerCanvasGLES3() {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
- int uniform_max_size = config->max_uniform_buffer_size;
- if (uniform_max_size < 65536) {
+ if (config->max_uniform_buffer_size < 65536) {
data.max_lights_per_render = 64;
} else {
data.max_lights_per_render = 256;
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index a3762e828e..7fc9992c3d 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -157,6 +157,8 @@ class RasterizerCanvasGLES3 : public RendererCanvasRender {
float atlas_rect[4];
};
+ static_assert(sizeof(LightUniform) % 16 == 0, "2D light UBO size must be a multiple of 16 bytes");
+
public:
enum {
BASE_UNIFORM_LOCATION = 0,
@@ -186,6 +188,8 @@ public:
uint32_t pad2;
};
+ static_assert(sizeof(StateBuffer) % 16 == 0, "2D state UBO size must be a multiple of 16 bytes");
+
struct PolygonBuffers {
GLuint vertex_buffer = 0;
GLuint vertex_array = 0;
@@ -230,6 +234,8 @@ public:
uint32_t lights[4];
};
+ static_assert(sizeof(InstanceData) == 128, "2D instance data struct size must be 128 bytes");
+
struct Data {
GLuint canvas_quad_vertices;
GLuint canvas_quad_array;
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index 071765a03c..ae39c86d44 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -398,8 +398,7 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display
// Viewport doesn't cover entire window so clear window to black before blitting.
// Querying the actual window size from the DisplayServer would deadlock in separate render thread mode,
// so let's set the biggest viewport the implementation supports, to be sure the window is fully covered.
- GLsizei max_vp[2] = {};
- glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_vp);
+ Size2i max_vp = GLES3::Utilities::get_singleton()->get_maximum_viewport_size();
glViewport(0, 0, max_vp[0], max_vp[1]);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index b6c7a0c5a5..4c70c43244 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -428,6 +428,7 @@ private:
bool pancake_shadows;
};
static_assert(sizeof(UBO) % 16 == 0, "Scene UBO size must be a multiple of 16 bytes");
+ static_assert(sizeof(UBO) < 16384, "Scene UBO size must be 16384 bytes or smaller");
struct MultiviewUBO {
float projection_matrix_view[RendererSceneRender::MAX_RENDER_VIEWS][16];
@@ -435,6 +436,7 @@ private:
float eye_offset[RendererSceneRender::MAX_RENDER_VIEWS][4];
};
static_assert(sizeof(MultiviewUBO) % 16 == 0, "Multiview UBO size must be a multiple of 16 bytes");
+ static_assert(sizeof(MultiviewUBO) < 16384, "MultiviewUBO size must be 16384 bytes or smaller");
struct TonemapUBO {
float exposure = 1.0;
diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp
index 876309d22c..4a15ed827a 100644
--- a/drivers/gles3/shader_gles3.cpp
+++ b/drivers/gles3/shader_gles3.cpp
@@ -37,6 +37,7 @@
#include "core/io/file_access.h"
#include "drivers/gles3/rasterizer_gles3.h"
+#include "drivers/gles3/storage/config.h"
static String _mkid(const String &p_id) {
String id = "m_" + p_id.replace("__", "_dus_");
@@ -801,7 +802,9 @@ void ShaderGLES3::initialize(const String &p_general_defines, int p_base_texture
print_verbose("Shader '" + name + "' SHA256: " + base_sha256);
}
- glGetInteger64v(GL_MAX_TEXTURE_IMAGE_UNITS, &max_image_units);
+ GLES3::Config *config = GLES3::Config::get_singleton();
+ ERR_FAIL_NULL(config);
+ max_image_units = config->max_texture_image_units;
}
void ShaderGLES3::set_shader_cache_dir(const String &p_dir) {
diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h
index 8968e76c12..9ee939e343 100644
--- a/drivers/gles3/shader_gles3.h
+++ b/drivers/gles3/shader_gles3.h
@@ -148,7 +148,7 @@ private:
static bool shader_cache_save_debug;
bool shader_cache_dir_valid = false;
- int64_t max_image_units = 0;
+ GLint max_image_units = 0;
enum StageType {
STAGE_TYPE_VERTEX,
diff --git a/drivers/gles3/storage/config.cpp b/drivers/gles3/storage/config.cpp
index 07e6d04cb7..1a14902c7c 100644
--- a/drivers/gles3/storage/config.cpp
+++ b/drivers/gles3/storage/config.cpp
@@ -45,9 +45,9 @@ Config::Config() {
singleton = this;
{
- int64_t max_extensions = 0;
- glGetInteger64v(GL_NUM_EXTENSIONS, &max_extensions);
- for (int64_t i = 0; i < max_extensions; i++) {
+ GLint max_extensions = 0;
+ glGetIntegerv(GL_NUM_EXTENSIONS, &max_extensions);
+ for (int i = 0; i < max_extensions; i++) {
const GLubyte *s = glGetStringi(GL_EXTENSIONS, i);
if (!s) {
break;
@@ -80,11 +80,14 @@ Config::Config() {
rgtc_supported = extensions.has("GL_EXT_texture_compression_rgtc") || extensions.has("GL_ARB_texture_compression_rgtc") || extensions.has("EXT_texture_compression_rgtc");
}
- glGetInteger64v(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units);
- glGetInteger64v(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_image_units);
- glGetInteger64v(GL_MAX_TEXTURE_SIZE, &max_texture_size);
+ glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units);
+ glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_image_units);
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
+ glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
glGetInteger64v(GL_MAX_UNIFORM_BLOCK_SIZE, &max_uniform_buffer_size);
- glGetInteger64v(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
+
+ // sanity clamp buffer size to 16K..1MB
+ max_uniform_buffer_size = CLAMP(max_uniform_buffer_size, 16384, 1048576);
support_anisotropic_filter = extensions.has("GL_EXT_texture_filter_anisotropic");
if (support_anisotropic_filter) {
diff --git a/drivers/gles3/storage/config.h b/drivers/gles3/storage/config.h
index ee7b1b26ed..0c9f9bc275 100644
--- a/drivers/gles3/storage/config.h
+++ b/drivers/gles3/storage/config.h
@@ -57,11 +57,12 @@ public:
bool use_nearest_mip_filter = false;
bool use_depth_prepass = true;
- int64_t max_vertex_texture_image_units = 0;
- int64_t max_texture_image_units = 0;
- int64_t max_texture_size = 0;
- int64_t max_viewport_size[2] = { 0, 0 };
- int64_t max_uniform_buffer_size = 0;
+ GLint max_vertex_texture_image_units = 0;
+ GLint max_texture_image_units = 0;
+ GLint max_texture_size = 0;
+ GLint max_viewport_size[2] = { 0, 0 };
+ GLint64 max_uniform_buffer_size = 0;
+
int64_t max_renderable_elements = 0;
int64_t max_renderable_lights = 0;
int64_t max_lights_per_object = 0;
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index 996c205042..bacf607c66 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -1055,6 +1055,7 @@ void MaterialData::update_parameters_internal(const HashMap<StringName, Variant>
ubo_data.resize(p_ubo_size);
if (ubo_data.size()) {
+ ERR_FAIL_COND(p_ubo_size > uint32_t(Config::get_singleton()->max_uniform_buffer_size));
memset(ubo_data.ptrw(), 0, ubo_data.size()); //clear
}
}
@@ -1108,10 +1109,10 @@ MaterialStorage::MaterialStorage() {
static_assert(sizeof(GlobalShaderUniforms::Value) == 16);
- global_shader_uniforms.buffer_size = MAX(4096, (int)GLOBAL_GET("rendering/limits/global_shader_variables/buffer_size"));
- if (global_shader_uniforms.buffer_size > uint32_t(Config::get_singleton()->max_uniform_buffer_size)) {
- global_shader_uniforms.buffer_size = uint32_t(Config::get_singleton()->max_uniform_buffer_size);
- WARN_PRINT("Project setting \"rendering/limits/global_shader_variables/buffer_size\" exceeds maximum uniform buffer size of: " + itos(Config::get_singleton()->max_uniform_buffer_size));
+ global_shader_uniforms.buffer_size = MAX(16, (int)GLOBAL_GET("rendering/limits/global_shader_variables/buffer_size"));
+ if (global_shader_uniforms.buffer_size * sizeof(GlobalShaderUniforms::Value) > uint32_t(Config::get_singleton()->max_uniform_buffer_size)) {
+ global_shader_uniforms.buffer_size = uint32_t(Config::get_singleton()->max_uniform_buffer_size) / sizeof(GlobalShaderUniforms::Value);
+ WARN_PRINT("Project setting \"rendering/limits/global_shader_variables/buffer_size\" exceeds maximum uniform buffer size of: " + itos(Config::get_singleton()->max_uniform_buffer_size / sizeof(GlobalShaderUniforms::Value)) + ". Falling back on maximum buffer size.");
}
global_shader_uniforms.buffer_values = memnew_arr(GlobalShaderUniforms::Value, global_shader_uniforms.buffer_size);
diff --git a/drivers/gles3/storage/particles_storage.h b/drivers/gles3/storage/particles_storage.h
index ca347ed070..086f5f7936 100644
--- a/drivers/gles3/storage/particles_storage.h
+++ b/drivers/gles3/storage/particles_storage.h
@@ -145,6 +145,9 @@ private:
Collider colliders[MAX_COLLIDERS];
};
+ static_assert(sizeof(ParticlesFrameParams) % 16 == 0, "ParticlesFrameParams size must be a multiple of 16 bytes");
+ static_assert(sizeof(ParticlesFrameParams) < 16384, "ParticlesFrameParams must be 16384 bytes or smaller");
+
struct Particles {
RS::ParticlesMode mode = RS::PARTICLES_MODE_3D;
bool inactive = true;
diff --git a/drivers/gles3/storage/utilities.cpp b/drivers/gles3/storage/utilities.cpp
index 356dc06733..7f0be36466 100644
--- a/drivers/gles3/storage/utilities.cpp
+++ b/drivers/gles3/storage/utilities.cpp
@@ -463,10 +463,7 @@ String Utilities::get_video_adapter_api_version() const {
Size2i Utilities::get_maximum_viewport_size() const {
Config *config = Config::get_singleton();
- if (!config) {
- return Size2i();
- }
-
+ ERR_FAIL_NULL_V(config, Size2i());
return Size2i(config->max_viewport_size[0], config->max_viewport_size[1]);
}
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 2136a843b6..ffd609d925 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -242,9 +242,9 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
draw_rect(Rect2(Point2(), get_size()), accent, false, Math::round(EDSCALE));
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
int hsep = get_theme_constant(SNAME("h_separation"), SNAME("ItemList"));
int vsep = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
Color linecolor = color;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index d45f1d7a78..8e7d1e30cd 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1435,9 +1435,9 @@ void AnimationTimelineEdit::_notification(int p_what) {
return;
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
int zoomw = key_range;
float scale = get_zoom_scale();
@@ -1627,8 +1627,8 @@ void AnimationTimelineEdit::set_animation(const Ref<Animation> &p_animation, boo
Size2 AnimationTimelineEdit::get_minimum_size() const {
Size2 ms = add_track->get_minimum_size();
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
ms.height = MAX(ms.height, font->get_height(font_size));
ms.width = get_buttons_width() + add_track->get_minimum_size().width + get_editor_theme_icon(SNAME("Hsize"))->get_width() + 2;
return ms;
@@ -1983,9 +1983,9 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_style_box(get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles)), Rect2(Point2(1 * EDSCALE, 0), get_size() - Size2(1 * EDSCALE, 0)));
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
int hsep = get_theme_constant(SNAME("h_separation"), SNAME("ItemList"));
Color linecolor = color;
linecolor.a = 0.2;
@@ -2323,7 +2323,7 @@ void AnimationTrackEdit::draw_key_link(int p_index, float p_pixels_sec, int p_x,
return;
}
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
color.a = 0.5;
int from_x = MAX(p_x, p_clip_left);
@@ -2360,9 +2360,9 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2);
if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
color.a = 0.5;
Dictionary d = animation->track_get_key_value(track, p_index);
@@ -2485,8 +2485,8 @@ NodePath AnimationTrackEdit::get_path() const {
Size2 AnimationTrackEdit::get_minimum_size() const {
Ref<Texture2D> texture = get_editor_theme_icon(SNAME("Object"));
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
int max_h = MAX(texture->get_height(), font->get_height(font_size));
@@ -2826,6 +2826,9 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
menu->reset_size();
+ moving_selection_attempt = false;
+ moving_selection = false;
+
Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height);
menu->set_position(popup_pos);
menu->popup();
@@ -2872,6 +2875,9 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
menu->reset_size();
+ moving_selection_attempt = false;
+ moving_selection = false;
+
Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height);
menu->set_position(popup_pos);
menu->popup();
@@ -2889,6 +2895,9 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
menu->add_icon_item(get_editor_theme_icon(SNAME("InterpWrapLoop")), TTR("Wrap Loop Interp"), MENU_LOOP_WRAP);
menu->reset_size();
+ moving_selection_attempt = false;
+ moving_selection = false;
+
Vector2 popup_pos = get_screen_position() + loop_wrap_rect.position + Vector2(0, loop_wrap_rect.size.height);
menu->set_position(popup_pos);
menu->popup();
@@ -2943,6 +2952,9 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
menu->reset_size();
+ moving_selection_attempt = false;
+ moving_selection = false;
+
menu->set_position(get_screen_position() + get_local_mouse_position());
menu->popup();
@@ -2965,6 +2977,10 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
path->set_text(animation->track_get_path(track));
Vector2 theme_ofs = path->get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"))->get_offset();
+
+ moving_selection_attempt = false;
+ moving_selection = false;
+
path_popup->set_position(get_screen_position() + path_rect.position - theme_ofs);
path_popup->set_size(path_rect.size);
path_popup->popup();
@@ -3402,10 +3418,10 @@ void AnimationTrackEditGroup::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int separation = get_theme_constant(SNAME("h_separation"), SNAME("ItemList"));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
if (root) {
Node *n = root->get_node_or_null(node);
@@ -3467,8 +3483,8 @@ void AnimationTrackEditGroup::set_type_and_name(const Ref<Texture2D> &p_type, co
}
Size2 AnimationTrackEditGroup::get_minimum_size() const {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList"));
return Vector2(0, MAX(font->get_height(font_size), icon_size.y) + separation);
@@ -4425,7 +4441,7 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
}
}
- float time = timeline->get_play_position();
+ float time = p_id.time == FLT_MAX ? timeline->get_play_position() : p_id.time;
Variant value;
switch (p_id.type) {
@@ -4433,7 +4449,9 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
case Animation::TYPE_ROTATION_3D:
case Animation::TYPE_SCALE_3D:
case Animation::TYPE_BLEND_SHAPE:
- case Animation::TYPE_VALUE: {
+ case Animation::TYPE_VALUE:
+ case Animation::TYPE_AUDIO:
+ case Animation::TYPE_ANIMATION: {
value = p_id.value;
} break;
@@ -4449,10 +4467,9 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
bezier_edit_icon->set_disabled(false);
} break;
- case Animation::TYPE_ANIMATION: {
- value = p_id.value;
- } break;
default: {
+ // Other track types shouldn't use this code path.
+ DEV_ASSERT(false);
}
}
@@ -5185,87 +5202,68 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
p_ofs += SECOND_DECIMAL;
}
- EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
+ Node *node = root->get_node_or_null(animation->track_get_path(p_track));
+ if (!node) {
+ EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a key."));
+ return;
+ }
+
+ // Special handling for this one.
+ if (animation->track_get_type(p_track) == Animation::TYPE_METHOD) {
+ method_selector->select_method_from_instance(node);
+
+ insert_key_from_track_call_ofs = p_ofs;
+ insert_key_from_track_call_track = p_track;
+ return;
+ }
+
+ InsertData id;
+ id.path = animation->track_get_path(p_track);
+ id.advance = false;
+ id.track_idx = p_track;
+ id.type = animation->track_get_type(p_track);
+ // TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
+ id.query = vformat(TTR("node '%s'"), node->get_name());
+ id.time = p_ofs;
+ // id.value is filled in each case handled below.
+
switch (animation->track_get_type(p_track)) {
case Animation::TYPE_POSITION_3D: {
- if (!root->has_node(animation->track_get_path(p_track))) {
- EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a key."));
- return;
- }
- Node3D *base = Object::cast_to<Node3D>(root->get_node(animation->track_get_path(p_track)));
+ Node3D *base = Object::cast_to<Node3D>(node);
if (!base) {
EditorNode::get_singleton()->show_warning(TTR("Track is not of type Node3D, can't insert key"));
return;
}
- Vector3 pos = base->get_position();
-
- undo_redo->create_action(TTR("Add Position Key"));
- undo_redo->add_do_method(animation.ptr(), "position_track_insert_key", p_track, p_ofs, pos);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
-
+ id.value = base->get_position();
} break;
case Animation::TYPE_ROTATION_3D: {
- if (!root->has_node(animation->track_get_path(p_track))) {
- EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a key."));
- return;
- }
- Node3D *base = Object::cast_to<Node3D>(root->get_node(animation->track_get_path(p_track)));
+ Node3D *base = Object::cast_to<Node3D>(node);
if (!base) {
EditorNode::get_singleton()->show_warning(TTR("Track is not of type Node3D, can't insert key"));
return;
}
- Quaternion rot = base->get_transform().basis.operator Quaternion();
-
- undo_redo->create_action(TTR("Add Rotation Key"));
- undo_redo->add_do_method(animation.ptr(), "rotation_track_insert_key", p_track, p_ofs, rot);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
-
+ id.value = base->get_transform().basis.operator Quaternion();
} break;
case Animation::TYPE_SCALE_3D: {
- if (!root->has_node(animation->track_get_path(p_track))) {
- EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a key."));
- return;
- }
- Node3D *base = Object::cast_to<Node3D>(root->get_node(animation->track_get_path(p_track)));
+ Node3D *base = Object::cast_to<Node3D>(node);
if (!base) {
EditorNode::get_singleton()->show_warning(TTR("Track is not of type Node3D, can't insert key"));
return;
}
- undo_redo->create_action(TTR("Add Scale Key"));
- undo_redo->add_do_method(animation.ptr(), "scale_track_insert_key", p_track, p_ofs, base->get_scale());
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
-
+ id.value = base->get_scale();
} break;
case Animation::TYPE_BLEND_SHAPE:
case Animation::TYPE_VALUE: {
NodePath bp;
- Variant value;
- _find_hint_for_track(p_track, bp, &value);
-
- undo_redo->create_action(TTR("Add Track Key"));
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, value);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
-
+ _find_hint_for_track(p_track, bp, &id.value);
} break;
case Animation::TYPE_METHOD: {
- if (!root->has_node(animation->track_get_path(p_track))) {
- EditorNode::get_singleton()->show_warning(TTR("Track path is invalid, so can't add a method key."));
- return;
- }
Node *base = root->get_node_or_null(animation->track_get_path(p_track));
ERR_FAIL_NULL(base);
@@ -5287,12 +5285,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
arr[3] = 0.25;
arr[4] = 0;
- undo_redo->create_action(TTR("Add Track Key"));
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, arr);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
-
+ id.value = arr;
} break;
case Animation::TYPE_AUDIO: {
Dictionary ak;
@@ -5300,22 +5293,18 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
ak["start_offset"] = 0;
ak["end_offset"] = 0;
- undo_redo->create_action(TTR("Add Track Key"));
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, ak);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
+ id.value = ak;
} break;
case Animation::TYPE_ANIMATION: {
- StringName anim = "[stop]";
-
- undo_redo->create_action(TTR("Add Track Key"));
- undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, anim);
- undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation);
- undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", p_track, p_ofs);
- undo_redo->commit_action();
+ id.value = StringName("[stop]");
} break;
+ default: {
+ // All track types should be handled by now.
+ DEV_ASSERT(false);
+ }
}
+
+ _query_insert(id);
}
void AnimationTrackEditor::_add_method_key(const String &p_method) {
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 1498a948f5..4c7c1a58f8 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -464,6 +464,7 @@ class AnimationTrackEditor : public VBoxContainer {
Animation::TrackType type;
NodePath path;
int track_idx = 0;
+ float time = FLT_MAX; // Defaults to current timeline position.
Variant value;
String query;
bool advance = false;
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index 7a53f4dded..0297aaaf7f 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -82,14 +82,14 @@ void AnimationTrackEditBool::draw_key(int p_index, float p_pixels_sec, int p_x,
/// COLOR ///
int AnimationTrackEditColor::get_key_height() const {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return font->get_height(font_size) * 0.8;
}
Rect2 AnimationTrackEditColor::get_key_rect(int p_index, float p_pixels_sec) {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
return Rect2(-fh / 2, 0, fh, get_size().height);
}
@@ -99,8 +99,8 @@ bool AnimationTrackEditColor::is_key_selectable_by_distance() const {
}
void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = (font->get_height(font_size) * 0.8);
fh /= 3;
@@ -168,8 +168,8 @@ void AnimationTrackEditColor::draw_key_link(int p_index, float p_pixels_sec, int
void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, bool p_selected, int p_clip_left, int p_clip_right) {
Color color = get_animation()->track_get_key_value(get_track(), p_index);
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
Rect2 rect(Vector2(p_x - fh / 2, int(get_size().height - fh) / 2), Size2(fh, fh));
@@ -207,8 +207,8 @@ int AnimationTrackEditAudio::get_key_height() const {
return AnimationTrackEdit::get_key_height();
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return int(font->get_height(font_size) * 1.5);
}
@@ -240,8 +240,8 @@ Rect2 AnimationTrackEditAudio::get_key_rect(int p_index, float p_pixels_sec) {
return Rect2(0, 0, len * p_pixels_sec, get_size().height);
} else {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
return Rect2(0, 0, fh, get_size().height);
}
@@ -304,8 +304,8 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
return;
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
float fh = int(font->get_height(font_size) * 1.5);
Rect2 rect = Rect2(from_x, (get_size().height - fh) / 2, to_x - from_x, fh);
draw_rect(rect, Color(0.25, 0.25, 0.25));
@@ -334,12 +334,12 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x,
draw_rect(rect, accent, false);
}
} else {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
draw_rect_clipped(rect, color);
if (p_selected) {
@@ -367,8 +367,8 @@ int AnimationTrackEditSpriteFrame::get_key_height() const {
return AnimationTrackEdit::get_key_height();
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return int(font->get_height(font_size) * 2);
}
@@ -435,8 +435,8 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se
size = size.floor();
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int height = int(font->get_height(font_size) * 2);
int width = height * size.width / size.height;
@@ -526,8 +526,8 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
region.size = texture->get_size();
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int height = int(font->get_height(font_size) * 2);
int width = height * region.size.width / region.size.height;
@@ -570,8 +570,8 @@ int AnimationTrackEditSubAnim::get_key_height() const {
return AnimationTrackEdit::get_key_height();
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return int(font->get_height(font_size) * 1.5);
}
@@ -599,8 +599,8 @@ Rect2 AnimationTrackEditSubAnim::get_key_rect(int p_index, float p_pixels_sec) {
return Rect2(0, 0, len * p_pixels_sec, get_size().height);
} else {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
return Rect2(0, 0, fh, get_size().height);
}
@@ -654,13 +654,13 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_
return;
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 1.5;
Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh);
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
Color bg = color;
bg.r = 1 - color.r;
bg.g = 1 - color.g;
@@ -705,12 +705,12 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_
draw_rect(rect, accent, false);
}
} else {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
draw_rect_clipped(rect, color);
if (p_selected) {
@@ -783,7 +783,7 @@ void AnimationTrackEditVolumeDB::draw_key_link(int p_index, float p_pixels_sec,
int y_from = (get_size().height - tex_h) / 2;
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
color.a *= 0.7;
draw_line(Point2(from_x, y_from + h * tex_h), Point2(to_x, y_from + h_n * tex_h), color, 2);
@@ -804,8 +804,8 @@ void AnimationTrackEditTypeAudio::_preview_changed(ObjectID p_which) {
}
int AnimationTrackEditTypeAudio::get_key_height() const {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return int(font->get_height(font_size) * 1.5);
}
@@ -870,8 +870,8 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int
}
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
float fh = int(font->get_height(font_size) * 1.5);
Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);
@@ -1175,8 +1175,8 @@ int AnimationTrackEditTypeAnimation::get_key_height() const {
return AnimationTrackEdit::get_key_height();
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return int(font->get_height(font_size) * 1.5);
}
@@ -1204,8 +1204,8 @@ Rect2 AnimationTrackEditTypeAnimation::get_key_rect(int p_index, float p_pixels_
return Rect2(0, 0, len * p_pixels_sec, get_size().height);
} else {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
return Rect2(0, 0, fh, get_size().height);
}
@@ -1259,13 +1259,13 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec,
return;
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 1.5;
Rect2 rect(from_x, int(get_size().height - fh) / 2, to_x - from_x, fh);
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
Color bg = color;
bg.r = 1 - color.r;
bg.g = 1 - color.g;
@@ -1310,12 +1310,12 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec,
draw_rect(rect, accent, false);
}
} else {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
int fh = font->get_height(font_size) * 0.8;
Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh));
- Color color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
draw_rect_clipped(rect, color);
if (p_selected) {
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 0e272429a3..58887e3714 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -115,7 +115,7 @@ void FindReplaceBar::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
- matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ matches_label->add_theme_color_override(SceneStringName(font_color), results_count > 0 ? get_theme_color(SceneStringName(font_color), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} break;
case NOTIFICATION_PREDELETE: {
@@ -338,7 +338,7 @@ void FindReplaceBar::_replace_all() {
}
text_editor->set_v_scroll(vsval);
- matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ matches_label->add_theme_color_override(SceneStringName(font_color), rc > 0 ? get_theme_color(SceneStringName(font_color), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
matches_label->set_text(vformat(TTR("%d replaced."), rc));
callable_mp((Object *)text_editor, &Object::connect).call_deferred("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed), 0U);
@@ -437,7 +437,7 @@ void FindReplaceBar::_update_matches_display() {
} else {
matches_label->show();
- matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ matches_label->add_theme_color_override(SceneStringName(font_color), results_count > 0 ? get_theme_color(SceneStringName(font_color), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
if (results_count == 0) {
matches_label->set_text(TTR("No match"));
@@ -1430,17 +1430,17 @@ void CodeTextEditor::_update_text_editor_theme() {
for (int i = 0; i < count; i++) {
Control *n = Object::cast_to<Control>(status_bar->get_child(i));
if (n) {
- n->add_theme_font_override(SNAME("font"), status_bar_font);
- n->add_theme_font_size_override(SNAME("font_size"), status_bar_font_size);
+ n->add_theme_font_override(SceneStringName(font), status_bar_font);
+ n->add_theme_font_size_override(SceneStringName(font_size), status_bar_font_size);
}
}
const Color &error_color = get_theme_color(SNAME("error_color"), EditorStringName(Editor));
const Color &warning_color = get_theme_color(SNAME("warning_color"), EditorStringName(Editor));
- error->add_theme_color_override(SNAME("font_color"), error_color);
- error_button->add_theme_color_override(SNAME("font_color"), error_color);
- warning_button->add_theme_color_override(SNAME("font_color"), warning_color);
+ error->add_theme_color_override(SceneStringName(font_color), error_color);
+ error_button->add_theme_color_override(SceneStringName(font_color), error_color);
+ warning_button->add_theme_color_override(SceneStringName(font_color), warning_color);
_update_font_ligatures();
}
@@ -1448,7 +1448,7 @@ void CodeTextEditor::_update_text_editor_theme() {
void CodeTextEditor::_update_font_ligatures() {
int ot_mode = EDITOR_GET("interface/editor/code_font_contextual_ligatures");
- Ref<FontVariation> fc = text_editor->get_theme_font(SNAME("font"));
+ Ref<FontVariation> fc = text_editor->get_theme_font(SceneStringName(font));
if (fc.is_valid()) {
switch (ot_mode) {
case 1: { // Disable ligatures.
@@ -1633,12 +1633,12 @@ void CodeTextEditor::remove_all_bookmarks() {
}
void CodeTextEditor::_zoom_in() {
- int s = text_editor->get_theme_font_size("font_size");
+ int s = text_editor->get_theme_font_size(SceneStringName(font_size));
_zoom_to(zoom_factor * (s + MAX(1.0f, EDSCALE)) / s);
}
void CodeTextEditor::_zoom_out() {
- int s = text_editor->get_theme_font_size("font_size");
+ int s = text_editor->get_theme_font_size(SceneStringName(font_size));
_zoom_to(zoom_factor * (s - MAX(1.0f, EDSCALE)) / s);
}
@@ -1664,10 +1664,10 @@ void CodeTextEditor::set_zoom_factor(float p_zoom_factor) {
zoom_button->set_text(itos(Math::round(zoom_factor * 100)) + " %");
- if (text_editor->has_theme_font_size_override("font_size")) {
- text_editor->remove_theme_font_size_override("font_size");
+ if (text_editor->has_theme_font_size_override(SceneStringName(font_size))) {
+ text_editor->remove_theme_font_size_override(SceneStringName(font_size));
}
- text_editor->add_theme_font_size_override("font_size", new_font_size);
+ text_editor->add_theme_font_size_override(SceneStringName(font_size), new_font_size);
}
float CodeTextEditor::get_zoom_factor() {
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index cede2c0ab6..b7afa1096b 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -670,8 +670,8 @@ void ConnectDialog::init(const ConnectionData &p_cd, const PackedStringArray &p_
void ConnectDialog::popup_dialog(const String &p_for_signal) {
from_signal->set_text(p_for_signal);
- warning_label->add_theme_color_override("font_color", warning_label->get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
- error_label->add_theme_color_override("font_color", error_label->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ warning_label->add_theme_color_override(SceneStringName(font_color), warning_label->get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ error_label->add_theme_color_override(SceneStringName(font_color), error_label->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
filter_nodes->clear();
if (!advanced->is_pressed()) {
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 3f8df5e313..d3bd18c0e8 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -416,20 +416,20 @@ void EditorDebuggerNode::_update_errors() {
if (error_count == 0 && warning_count == 0) {
debugger_button->set_text(TTR("Debugger"));
- debugger_button->remove_theme_color_override("font_color");
+ debugger_button->remove_theme_color_override(SceneStringName(font_color));
debugger_button->set_icon(Ref<Texture2D>());
} else {
debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
if (error_count >= 1 && warning_count >= 1) {
debugger_button->set_icon(get_editor_theme_icon(SNAME("ErrorWarning")));
// Use error color to represent the highest level of severity reported.
- debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ debugger_button->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} else if (error_count >= 1) {
debugger_button->set_icon(get_editor_theme_icon(SNAME("Error")));
- debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ debugger_button->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} else {
debugger_button->set_icon(get_editor_theme_icon(SNAME("Warning")));
- debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ debugger_button->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
}
}
last_error_count = error_count;
diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp
index 332e8f2ffc..1ea9a66534 100644
--- a/editor/debugger/editor_performance_profiler.cpp
+++ b/editor/debugger/editor_performance_profiler.cpp
@@ -113,8 +113,8 @@ void EditorPerformanceProfiler::_monitor_draw() {
info_message->hide();
Ref<StyleBox> graph_style_box = get_theme_stylebox(CoreStringName(normal), SNAME("TextEdit"));
- Ref<Font> graph_font = get_theme_font(SNAME("font"), SNAME("TextEdit"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("TextEdit"));
+ Ref<Font> graph_font = get_theme_font(SceneStringName(font), SNAME("TextEdit"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("TextEdit"));
int columns = int(Math::ceil(Math::sqrt(float(active.size()))));
int rows = int(Math::ceil(float(active.size()) / float(columns)));
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index 0e2a7ee599..1a1817d69d 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -425,7 +425,7 @@ void EditorProfiler::_notification(int p_what) {
activate->set_icon(get_editor_theme_icon(SNAME("Play")));
clear_button->set_icon(get_editor_theme_icon(SNAME("Clear")));
- theme_cache.seek_line_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ theme_cache.seek_line_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
theme_cache.seek_line_color.a = 0.8;
theme_cache.seek_line_hover_color = theme_cache.seek_line_color;
theme_cache.seek_line_hover_color.a = 0.4;
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 38f1061a72..7e105c516a 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -446,9 +446,9 @@ void EditorVisualProfiler::_graph_tex_draw() {
return;
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- const Color color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ const Color color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
if (seeking) {
int max_frames = frame_metrics.size();
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index e35ca590b3..ff9b4c73a6 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -825,13 +825,13 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, uint64_t p_thread
void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType p_type) {
switch (p_type) {
case MESSAGE_ERROR:
- reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ reason->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
break;
case MESSAGE_WARNING:
- reason->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ reason->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
break;
default:
- reason->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
+ reason->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
}
reason->set_text(p_reason);
@@ -869,7 +869,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
vmem_export->set_icon(get_editor_theme_icon(SNAME("Save")));
search->set_right_icon(get_editor_theme_icon(SNAME("Search")));
- reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ reason->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
TreeItem *error_root = error_tree->get_root();
if (error_root) {
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index 8f675cf548..8662ad75b2 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -601,7 +601,7 @@ void EditorAssetInstaller::_notification(int p_what) {
} else {
show_source_files_button->set_icon(get_editor_theme_icon(SNAME("Forward")));
}
- asset_conflicts_link->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ asset_conflicts_link->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
generic_extension_icon = get_editor_theme_icon(SNAME("Object"));
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index a4994d1f92..db59606ffc 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -105,7 +105,7 @@ void EditorAudioBus::_notification(int p_what) {
bus_options->set_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
- audio_value_preview_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("TooltipLabel")));
+ audio_value_preview_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), SNAME("TooltipLabel")));
audio_value_preview_label->add_theme_color_override("font_shadow_color", get_theme_color(SNAME("font_shadow_color"), SNAME("TooltipLabel")));
audio_value_preview_box->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("TooltipPanel")));
@@ -1419,8 +1419,8 @@ void EditorAudioMeterNotches::add_notch(float p_normalized_offset, float p_db_va
}
Size2 EditorAudioMeterNotches::get_minimum_size() const {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
float font_height = font->get_height(font_size);
float width = 0;
@@ -1440,10 +1440,10 @@ Size2 EditorAudioMeterNotches::get_minimum_size() const {
void EditorAudioMeterNotches::_update_theme_item_cache() {
Control::_update_theme_item_cache();
- theme_cache.notch_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ theme_cache.notch_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
- theme_cache.font = get_theme_font(SNAME("font"), SNAME("Label"));
- theme_cache.font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ theme_cache.font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ theme_cache.font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
}
void EditorAudioMeterNotches::_bind_methods() {
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index a5c4831db7..746afe0737 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -753,12 +753,12 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
}
if (!FileAccess::exists(p_path)) {
- EditorNode::get_singleton()->show_warning(TTR("Can't add Autoload:") + "\n" + vformat(TTR("%s is an invalid path. File does not exist."), path));
+ EditorNode::get_singleton()->show_warning(TTR("Can't add Autoload:") + "\n" + vformat(TTR("%s is an invalid path. File does not exist."), p_path));
return false;
}
if (!p_path.begins_with("res://")) {
- EditorNode::get_singleton()->show_warning(TTR("Can't add Autoload:") + "\n" + vformat(TTR("%s is an invalid path. Not in resource path (res://)."), path));
+ EditorNode::get_singleton()->show_warning(TTR("Can't add Autoload:") + "\n" + vformat(TTR("%s is an invalid path. Not in resource path (res://)."), p_path));
return false;
}
@@ -884,7 +884,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
error_message = memnew(Label);
error_message->hide();
error_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
- error_message->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
+ error_message->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
add_child(error_message);
Label *l = memnew(Label);
diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp
index badab92fb0..9e100b6a67 100644
--- a/editor/editor_command_palette.cpp
+++ b/editor/editor_command_palette.cpp
@@ -140,7 +140,7 @@ void EditorCommandPalette::_update_command_search(const String &search_text) {
ti->set_metadata(0, entries[i].key_name);
ti->set_text_alignment(1, HORIZONTAL_ALIGNMENT_RIGHT);
ti->set_text(1, shortcut_text);
- Color c = get_theme_color(SNAME("font_color"), EditorStringName(Editor)) * Color(1, 1, 1, 0.5);
+ Color c = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)) * Color(1, 1, 1, 0.5);
ti->set_custom_color(1, c);
}
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 3dc8584096..f58e471633 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -3969,12 +3969,12 @@ void EditorHelpHighlighter::reset_cache() {
#ifdef MODULE_GDSCRIPT_ENABLED
highlight_data_caches[LANGUAGE_GDSCRIPT].clear();
- text_edits[LANGUAGE_GDSCRIPT]->add_theme_color_override("font_color", text_color);
+ text_edits[LANGUAGE_GDSCRIPT]->add_theme_color_override(SceneStringName(font_color), text_color);
#endif
#ifdef MODULE_MONO_ENABLED
highlight_data_caches[LANGUAGE_CSHARP].clear();
- text_edits[LANGUAGE_CSHARP]->add_theme_color_override("font_color", text_color);
+ text_edits[LANGUAGE_CSHARP]->add_theme_color_override(SceneStringName(font_color), text_color);
#endif
}
@@ -3983,7 +3983,7 @@ EditorHelpHighlighter::EditorHelpHighlighter() {
#ifdef MODULE_GDSCRIPT_ENABLED
TextEdit *gdscript_text_edit = memnew(TextEdit);
- gdscript_text_edit->add_theme_color_override("font_color", text_color);
+ gdscript_text_edit->add_theme_color_override(SceneStringName(font_color), text_color);
Ref<GDScript> gdscript;
gdscript.instantiate();
@@ -4000,7 +4000,7 @@ EditorHelpHighlighter::EditorHelpHighlighter() {
#ifdef MODULE_MONO_ENABLED
TextEdit *csharp_text_edit = memnew(TextEdit);
- csharp_text_edit->add_theme_color_override("font_color", text_color);
+ csharp_text_edit->add_theme_color_override(SceneStringName(font_color), text_color);
// See GH-89610.
//Ref<CSharpScript> csharp;
@@ -4094,7 +4094,7 @@ void FindBar::_notification(int p_what) {
hide_button->set_texture_hover(get_editor_theme_icon(SNAME("Close")));
hide_button->set_texture_pressed(get_editor_theme_icon(SNAME("Close")));
hide_button->set_custom_minimum_size(hide_button->get_texture_normal()->get_size());
- matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ matches_label->add_theme_color_override(SceneStringName(font_color), results_count > 0 ? get_theme_color(SceneStringName(font_color), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -4162,7 +4162,7 @@ void FindBar::_update_matches_label() {
} else {
matches_label->show();
- matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ matches_label->add_theme_color_override(SceneStringName(font_color), results_count > 0 ? get_theme_color(SceneStringName(font_color), SNAME("Label")) : get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
matches_label->set_text(vformat(results_count == 1 ? TTR("%d match.") : TTR("%d matches."), results_count));
}
}
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 7f21bb9ca8..9e85b276be 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -69,8 +69,8 @@ bool EditorInspector::_property_path_matches(const String &p_property_path, cons
Size2 EditorProperty::get_minimum_size() const {
Size2 ms;
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
ms.height = label.is_empty() ? 0 : font->get_height(font_size) + 4 * EDSCALE;
for (int i = 0; i < get_child_count(); i++) {
@@ -132,8 +132,8 @@ void EditorProperty::_notification(int p_what) {
{
int child_room = size.width * (1.0 - split_ratio);
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
int height = label.is_empty() ? 0 : font->get_height(font_size) + 4 * EDSCALE;
bool no_children = true;
@@ -240,8 +240,8 @@ void EditorProperty::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
bool rtl = is_layout_rtl();
Size2 size = get_size();
@@ -1251,7 +1251,7 @@ void EditorInspectorCategory::_notification(int p_what) {
w -= hs + icon_size;
}
- Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
+ Color color = get_theme_color(SceneStringName(font_color), SNAME("Tree"));
if (is_layout_rtl()) {
ofs = get_size().width - ofs - w;
}
@@ -1452,7 +1452,7 @@ void EditorInspectorSection::_notification(int p_what) {
Ref<Font> font = get_theme_font(SNAME("bold"), EditorStringName(EditorFonts));
int font_size = get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts));
- Color font_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color font_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
if (folded && revertable_properties.size()) {
int label_width = font->get_string_size(label, HORIZONTAL_ALIGNMENT_LEFT, available, font_size, TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_CONSTRAIN_ELLIPSIS).x;
@@ -1545,8 +1545,8 @@ Size2 EditorInspectorSection::get_minimum_size() const {
ms = ms.max(minsize);
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Tree"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Tree"));
ms.height += font->get_height(font_size) + get_theme_constant(SNAME("v_separation"), SNAME("Tree"));
ms.width += get_theme_constant(SNAME("inspector_margin"), EditorStringName(Editor));
@@ -2252,7 +2252,7 @@ void EditorInspectorArray::_setup() {
if (numbered) {
ae.number = memnew(Label);
- ae.number->add_theme_font_override("font", numbers_font);
+ ae.number->add_theme_font_override(SceneStringName(font), numbers_font);
ae.number->set_custom_minimum_size(Size2(numbers_min_w, 0));
ae.number->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
ae.number->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 166d09af30..4223f1a08a 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -124,7 +124,7 @@ void EditorLog::_update_theme() {
theme_cache.error_icon = get_editor_theme_icon(SNAME("Error"));
theme_cache.warning_color = get_theme_color(SNAME("warning_color"), EditorStringName(Editor));
theme_cache.warning_icon = get_editor_theme_icon(SNAME("Warning"));
- theme_cache.message_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor)) * Color(1, 1, 1, 0.6);
+ theme_cache.message_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)) * Color(1, 1, 1, 0.6);
}
void EditorLog::_editor_settings_changed() {
diff --git a/editor/editor_native_shader_source_visualizer.cpp b/editor/editor_native_shader_source_visualizer.cpp
index 37c8bffe3d..3d7d37c94e 100644
--- a/editor/editor_native_shader_source_visualizer.cpp
+++ b/editor/editor_native_shader_source_visualizer.cpp
@@ -96,8 +96,8 @@ void EditorNativeShaderSourceVisualizer::_inspect_shader(RID p_shader) {
CodeEdit *code_edit = memnew(CodeEdit);
code_edit->set_editable(false);
code_edit->set_syntax_highlighter(syntax_highlighter);
- code_edit->add_theme_font_override("font", get_theme_font("source", EditorStringName(EditorFonts)));
- code_edit->add_theme_font_size_override("font_size", get_theme_font_size("source_size", EditorStringName(EditorFonts)));
+ code_edit->add_theme_font_override(SceneStringName(font), get_theme_font("source", EditorStringName(EditorFonts)));
+ code_edit->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size("source_size", EditorStringName(EditorFonts)));
code_edit->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6));
// Appearance: Caret
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d5e1242406..54ba06afd8 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -543,6 +543,8 @@ void EditorNode::_update_theme(bool p_skip_creation) {
tb->set_icon(theme->get_icon(p_editor->get_name(), EditorStringName(EditorIcons)));
}
}
+
+ _update_renderer_color();
}
editor_dock_manager->update_tab_styles();
@@ -3322,6 +3324,13 @@ void EditorNode::_exit_editor(int p_exit_code) {
// Dim the editor window while it's quitting to make it clearer that it's busy.
dim_editor(true);
+ // Unload addons before quitting to allow cleanup.
+ for (const KeyValue<String, EditorPlugin *> &E : addon_name_to_plugin) {
+ print_verbose(vformat("Unloading addon: %s", E.key));
+ remove_editor_plugin(E.value, false);
+ memdelete(E.value);
+ }
+
get_tree()->quit(p_exit_code);
}
@@ -3537,7 +3546,7 @@ void EditorNode::add_extension_editor_plugin(const StringName &p_class_name) {
void EditorNode::remove_extension_editor_plugin(const StringName &p_class_name) {
// If we're exiting, the editor plugins will get cleaned up anyway, so don't do anything.
- if (singleton->exiting) {
+ if (!singleton || singleton->exiting) {
return;
}
@@ -6177,15 +6186,12 @@ Vector<Ref<EditorResourceConversionPlugin>> EditorNode::find_resource_conversion
void EditorNode::_update_renderer_color() {
String rendering_method = renderer->get_selected_metadata();
- // TODO: Use theme colors instead of hardcoded values.
if (rendering_method == "forward_plus") {
- renderer->add_theme_color_override("font_color", Color::hex(0x5d8c3fff));
- }
- if (rendering_method == "mobile") {
- renderer->add_theme_color_override("font_color", Color::hex(0xa5557dff));
- }
- if (rendering_method == "gl_compatibility") {
- renderer->add_theme_color_override("font_color", Color::hex(0x5586a4ff));
+ renderer->add_theme_color_override(SceneStringName(font_color), theme->get_color(SNAME("forward_plus_color"), EditorStringName(Editor)));
+ } else if (rendering_method == "mobile") {
+ renderer->add_theme_color_override(SceneStringName(font_color), theme->get_color(SNAME("mobile_color"), EditorStringName(Editor)));
+ } else if (rendering_method == "gl_compatibility") {
+ renderer->add_theme_color_override(SceneStringName(font_color), theme->get_color(SNAME("gl_compatibility_color"), EditorStringName(Editor)));
}
}
@@ -6993,8 +6999,8 @@ EditorNode::EditorNode() {
if (can_expand && global_menu) {
project_title = memnew(Label);
- project_title->add_theme_font_override("font", theme->get_font(SNAME("bold"), EditorStringName(EditorFonts)));
- project_title->add_theme_font_size_override("font_size", theme->get_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)));
+ project_title->add_theme_font_override(SceneStringName(font), theme->get_font(SNAME("bold"), EditorStringName(EditorFonts)));
+ project_title->add_theme_font_size_override(SceneStringName(font_size), theme->get_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)));
project_title->set_focus_mode(Control::FOCUS_NONE);
project_title->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
project_title->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 899da99450..2127d30765 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -928,12 +928,29 @@ public:
struct EditorProgress {
String task;
- bool step(const String &p_state, int p_step = -1, bool p_force_refresh = true) { return EditorNode::progress_task_step(task, p_state, p_step, p_force_refresh); }
+ bool step(const String &p_state, int p_step = -1, bool p_force_refresh = true) {
+ if (Thread::is_main_thread()) {
+ return EditorNode::progress_task_step(task, p_state, p_step, p_force_refresh);
+ } else {
+ EditorNode::progress_task_step_bg(task, p_step);
+ return false;
+ }
+ }
EditorProgress(const String &p_task, const String &p_label, int p_amount, bool p_can_cancel = false) {
- EditorNode::progress_add_task(p_task, p_label, p_amount, p_can_cancel);
+ if (Thread::is_main_thread()) {
+ EditorNode::progress_add_task(p_task, p_label, p_amount, p_can_cancel);
+ } else {
+ EditorNode::progress_add_task_bg(p_task, p_label, p_amount);
+ }
task = p_task;
}
- ~EditorProgress() { EditorNode::progress_end_task(task); }
+ ~EditorProgress() {
+ if (Thread::is_main_thread()) {
+ EditorNode::progress_end_task(task);
+ } else {
+ EditorNode::progress_end_task_bg(task);
+ }
+ }
};
class EditorPluginList : public Object {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index ecc31bb0e2..54d1e0a513 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -165,8 +165,8 @@ void EditorPropertyMultilineText::_open_big_text() {
big_text = memnew(TextEdit);
if (expression) {
big_text->set_syntax_highlighter(text->get_syntax_highlighter());
- big_text->add_theme_font_override("font", get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
- big_text->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
+ big_text->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
+ big_text->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
}
big_text->connect("text_changed", callable_mp(this, &EditorPropertyMultilineText::_big_text_changed));
big_text->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY);
@@ -204,15 +204,15 @@ void EditorPropertyMultilineText::_notification(int p_what) {
font = get_theme_font(SNAME("expression"), EditorStringName(EditorFonts));
font_size = get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts));
- text->add_theme_font_override("font", font);
- text->add_theme_font_size_override("font_size", font_size);
+ text->add_theme_font_override(SceneStringName(font), font);
+ text->add_theme_font_size_override(SceneStringName(font_size), font_size);
if (big_text) {
- big_text->add_theme_font_override("font", font);
- big_text->add_theme_font_size_override("font_size", font_size);
+ big_text->add_theme_font_override(SceneStringName(font), font);
+ big_text->add_theme_font_size_override(SceneStringName(font_size), font_size);
}
} else {
- font = get_theme_font(SNAME("font"), SNAME("TextEdit"));
- font_size = get_theme_font_size(SNAME("font_size"), SNAME("TextEdit"));
+ font = get_theme_font(SceneStringName(font), SNAME("TextEdit"));
+ font_size = get_theme_font_size(SceneStringName(font_size), SNAME("TextEdit"));
}
text->set_custom_minimum_size(Vector2(0, font->get_height(font_size) * 6));
} break;
@@ -858,8 +858,8 @@ EditorPropertyLayersGrid::EditorPropertyLayersGrid() {
}
Size2 EditorPropertyLayersGrid::get_grid_size() const {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
return Vector2(0, font->get_height(font_size) * 3);
}
@@ -998,7 +998,7 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
Color color = get_theme_color(read_only ? SNAME("highlight_disabled_color") : SNAME("highlight_color"), EditorStringName(Editor));
- Color text_color = get_theme_color(read_only ? SNAME("font_disabled_color") : SNAME("font_color"), EditorStringName(Editor));
+ Color text_color = get_theme_color(read_only ? SNAME("font_disabled_color") : SceneStringName(font_color), EditorStringName(Editor));
text_color.a *= 0.5;
Color text_color_on = get_theme_color(read_only ? SNAME("font_disabled_color") : SNAME("font_hover_color"), EditorStringName(Editor));
@@ -1029,8 +1029,8 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
draw_rect(rect2, color);
flag_rects.push_back(rect2);
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Vector2 offset;
offset.y = rect2.size.y * 0.75;
@@ -1570,14 +1570,14 @@ void EditorPropertyEasing::_draw_easing() {
const float exp = get_edited_property_value();
- const Ref<Font> f = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- const Color font_color = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit"));
+ const Ref<Font> f = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ const Color font_color = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SceneStringName(font_color), SNAME("LineEdit"));
Color line_color;
if (dragging) {
line_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
} else {
- line_color = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit")) * Color(1, 1, 1, 0.9);
+ line_color = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SceneStringName(font_color), SNAME("LineEdit")) * Color(1, 1, 1, 0.9);
}
Vector<Point2> points;
@@ -1670,7 +1670,7 @@ void EditorPropertyEasing::_notification(int p_what) {
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveInOut")), "Ease In-Out", EASING_IN_OUT);
preset->add_icon_item(get_editor_theme_icon(SNAME("CurveOutIn")), "Ease Out-In", EASING_OUT_IN);
}
- easing_draw->set_custom_minimum_size(Size2(0, get_theme_font(SNAME("font"), SNAME("Label"))->get_height(get_theme_font_size(SNAME("font_size"), SNAME("Label"))) * 2));
+ easing_draw->set_custom_minimum_size(Size2(0, get_theme_font(SceneStringName(font), SNAME("Label"))->get_height(get_theme_font_size(SceneStringName(font_size), SNAME("Label"))) * 2));
} break;
}
}
@@ -2078,9 +2078,9 @@ void EditorPropertyQuaternion::_notification(int p_what) {
euler[i]->add_theme_color_override("label_color", colors[i]);
}
edit_button->set_icon(get_editor_theme_icon(SNAME("Edit")));
- euler_label->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("property_color"), SNAME("EditorProperty")));
+ euler_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("property_color"), SNAME("EditorProperty")));
warning->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
- warning->add_theme_color_override(SNAME("font_color"), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ warning->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} break;
}
}
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp
index fbd9d84e26..8cde63039b 100644
--- a/editor/editor_resource_picker.cpp
+++ b/editor/editor_resource_picker.cpp
@@ -1231,8 +1231,8 @@ void EditorAudioStreamPicker::_notification(int p_what) {
void EditorAudioStreamPicker::_update_resource() {
EditorResourcePicker::_update_resource();
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Ref<AudioStream> audio_stream = get_edited_resource();
if (audio_stream.is_valid() && audio_stream->get_length() > 0.0) {
set_assign_button_min_size(Size2(1, font->get_height(font_size) * 3));
@@ -1250,12 +1250,12 @@ void EditorAudioStreamPicker::_preview_draw() {
return;
}
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
get_assign_button()->set_text("");
Size2i size = stream_preview_rect->get_size();
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
Rect2 rect(Point2(), size);
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index 7f9310f715..51138171fb 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -213,7 +213,7 @@ void EditorSettingsDialog::_update_icons() {
restart_close_button->set_icon(shortcuts->get_editor_theme_icon(SNAME("Close")));
restart_container->add_theme_style_override(SceneStringName(panel), shortcuts->get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
restart_icon->set_texture(shortcuts->get_editor_theme_icon(SNAME("StatusWarning")));
- restart_label->add_theme_color_override("font_color", shortcuts->get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ restart_label->add_theme_color_override(SceneStringName(font_color), shortcuts->get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
}
void EditorSettingsDialog::_event_config_confirmed() {
@@ -307,7 +307,7 @@ void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const S
shortcut_item->set_text(1, sc_text);
if (sc_text == "None") {
// Fade out unassigned shortcut labels for easier visual grepping.
- shortcut_item->set_custom_color(1, shortcuts->get_theme_color(SNAME("font_color"), SNAME("Label")) * Color(1, 1, 1, 0.5));
+ shortcut_item->set_custom_color(1, shortcuts->get_theme_color(SceneStringName(font_color), SNAME("Label")) * Color(1, 1, 1, 0.5));
}
if (p_allow_revert) {
diff --git a/editor/engine_update_label.cpp b/editor/engine_update_label.cpp
index c9dfe1f521..958093410a 100644
--- a/editor/engine_update_label.cpp
+++ b/editor/engine_update_label.cpp
@@ -166,7 +166,7 @@ void EngineUpdateLabel::_set_message(const String &p_message, const Color &p_col
if (is_disabled()) {
add_theme_color_override("font_disabled_color", p_color);
} else {
- add_theme_color_override("font_color", p_color);
+ add_theme_color_override(SceneStringName(font_color), p_color);
}
set_text(p_message);
}
@@ -264,7 +264,7 @@ void EngineUpdateLabel::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
- theme_cache.default_color = get_theme_color("font_color", "Button");
+ theme_cache.default_color = get_theme_color(SceneStringName(font_color), "Button");
theme_cache.disabled_color = get_theme_color("font_disabled_color", "Button");
theme_cache.error_color = get_theme_color("error_color", EditorStringName(Editor));
theme_cache.update_color = get_theme_color("warning_color", EditorStringName(Editor));
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index 5a95b553e9..527544fea3 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -99,12 +99,12 @@ bool EditorExportPlatform::fill_log_messages(RichTextLabel *p_log, Error p_err)
p_log->set_table_column_expand(1, true);
for (int m = 0; m < msg_count; m++) {
EditorExportPlatform::ExportMessage msg = get_message(m);
- Color color = p_log->get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color color = p_log->get_theme_color(SceneStringName(font_color), SNAME("Label"));
Ref<Texture> icon;
switch (msg.msg_type) {
case EditorExportPlatform::EXPORT_MESSAGE_INFO: {
- color = p_log->get_theme_color(SNAME("font_color"), EditorStringName(Editor)) * Color(1, 1, 1, 0.6);
+ color = p_log->get_theme_color(SceneStringName(font_color), EditorStringName(Editor)) * Color(1, 1, 1, 0.6);
} break;
case EditorExportPlatform::EXPORT_MESSAGE_WARNING: {
icon = p_log->get_editor_theme_icon(SNAME("Warning"));
diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp
index 588d99f08f..e84044f7e1 100644
--- a/editor/export/export_template_manager.cpp
+++ b/editor/export/export_template_manager.cpp
@@ -366,9 +366,9 @@ void ExportTemplateManager::_set_current_progress_status(const String &p_status,
if (p_error) {
download_progress_bar->hide();
- download_progress_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ download_progress_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} else {
- download_progress_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Label")));
+ download_progress_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), SNAME("Label")));
}
}
@@ -810,9 +810,9 @@ void ExportTemplateManager::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
- current_value->add_theme_font_override("font", get_theme_font(SNAME("main"), EditorStringName(EditorFonts)));
- current_missing_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
- current_installed_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
+ current_value->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("main"), EditorStringName(EditorFonts)));
+ current_missing_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ current_installed_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
mirror_options_button->set_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
} break;
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 7787512cc2..4266c0f69c 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -68,7 +68,7 @@ void ProjectExportTextureFormatError::_bind_methods() {
void ProjectExportTextureFormatError::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
- texture_format_error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ texture_format_error_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
} break;
}
}
@@ -1437,7 +1437,7 @@ ProjectExportDialog::ProjectExportDialog() {
script_key->connect("text_changed", callable_mp(this, &ProjectExportDialog::_script_encryption_key_changed));
script_key_error = memnew(Label);
script_key_error->set_text(String::utf8("• ") + TTR("Invalid Encryption Key (must be 64 hexadecimal characters long)"));
- script_key_error->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
+ script_key_error->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
sec_vb->add_margin_child(TTR("Encryption Key (256-bits as hexadecimal):"), script_key);
sec_vb->add_child(script_key_error);
sections->add_child(sec_scroll_container);
@@ -1539,12 +1539,12 @@ ProjectExportDialog::ProjectExportDialog() {
export_error = memnew(Label);
main_vb->add_child(export_error);
export_error->hide();
- export_error->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
+ export_error->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
export_warning = memnew(Label);
main_vb->add_child(export_warning);
export_warning->hide();
- export_warning->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor)));
+ export_warning->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor)));
export_templates_error = memnew(HBoxContainer);
main_vb->add_child(export_templates_error);
@@ -1552,7 +1552,7 @@ ProjectExportDialog::ProjectExportDialog() {
Label *export_error2 = memnew(Label);
export_templates_error->add_child(export_error2);
- export_error2->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
+ export_error2->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
export_error2->set_text(String::utf8("• ") + TTR("Export templates for this platform are missing:") + " ");
result_dialog = memnew(AcceptDialog);
diff --git a/editor/fbx_importer_manager.cpp b/editor/fbx_importer_manager.cpp
index 1fded345c8..a8dbb3212c 100644
--- a/editor/fbx_importer_manager.cpp
+++ b/editor/fbx_importer_manager.cpp
@@ -93,11 +93,11 @@ void FBXImporterManager::_validate_path(const String &p_path) {
if (success) {
path_status->set_text(TTR("FBX2glTF executable is valid."));
- path_status->add_theme_color_override("font_color", path_status->get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
+ path_status->add_theme_color_override(SceneStringName(font_color), path_status->get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
get_ok_button()->set_disabled(false);
} else {
path_status->set_text(error);
- path_status->add_theme_color_override("font_color", path_status->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ path_status->add_theme_color_override(SceneStringName(font_color), path_status->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
get_ok_button()->set_disabled(true);
}
}
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index e9edcab52f..17b6eb5081 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -714,10 +714,10 @@ void FindInFilesPanel::stop_search() {
void FindInFilesPanel::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
- _search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), EditorStringName(EditorFonts)));
- _search_text_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), EditorStringName(EditorFonts)));
- _results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), EditorStringName(EditorFonts)));
- _results_display->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("source_size"), EditorStringName(EditorFonts)));
+ _search_text_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("source"), EditorStringName(EditorFonts)));
+ _search_text_label->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("source_size"), EditorStringName(EditorFonts)));
+ _results_display->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("source"), EditorStringName(EditorFonts)));
+ _results_display->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("source_size"), EditorStringName(EditorFonts)));
// Rebuild search tree.
if (!_finder->get_search_text().is_empty()) {
@@ -750,7 +750,7 @@ void FindInFilesPanel::_on_result_found(const String &fpath, int line_number, in
file_item = E->value;
}
- Color file_item_color = _results_display->get_theme_color(SNAME("font_color")) * Color(1, 1, 1, 0.67);
+ Color file_item_color = _results_display->get_theme_color(SceneStringName(font_color)) * Color(1, 1, 1, 0.67);
file_item->set_custom_color(0, file_item_color);
file_item->set_selectable(0, false);
@@ -796,8 +796,8 @@ void FindInFilesPanel::draw_result_text(Object *item_obj, Rect2 rect) {
}
Result r = E->value;
String item_text = item->get_text(_with_replace ? 1 : 0);
- Ref<Font> font = _results_display->get_theme_font(SNAME("font"));
- int font_size = _results_display->get_theme_font_size(SNAME("font_size"));
+ Ref<Font> font = _results_display->get_theme_font(SceneStringName(font));
+ int font_size = _results_display->get_theme_font_size(SceneStringName(font_size));
Rect2 match_rect = rect;
match_rect.position.x += font->get_string_size(item_text.left(r.begin_trimmed), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x - 1;
@@ -815,7 +815,7 @@ void FindInFilesPanel::_on_item_edited() {
TreeItem *item = _results_display->get_selected();
// Change opacity to half if checkbox is checked, otherwise full.
- Color use_color = _results_display->get_theme_color(SNAME("font_color"));
+ Color use_color = _results_display->get_theme_color(SceneStringName(font_color));
if (!item->is_checked(0)) {
use_color.a *= 0.5;
}
diff --git a/editor/gui/editor_object_selector.cpp b/editor/gui/editor_object_selector.cpp
index 434aef1419..5b303760b0 100644
--- a/editor/gui/editor_object_selector.cpp
+++ b/editor/gui/editor_object_selector.cpp
@@ -38,8 +38,8 @@
#include "scene/gui/margin_container.h"
Size2 EditorObjectSelector::get_minimum_size() const {
- Ref<Font> font = get_theme_font(SNAME("font"));
- int font_size = get_theme_font_size(SNAME("font_size"));
+ Ref<Font> font = get_theme_font(SceneStringName(font));
+ int font_size = get_theme_font_size(SceneStringName(font_size));
return Button::get_minimum_size() + Size2(0, font->get_height(font_size));
}
@@ -205,7 +205,7 @@ void EditorObjectSelector::_notification(int p_what) {
int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor));
current_object_icon->set_custom_minimum_size(Size2(icon_size, icon_size));
- current_object_label->add_theme_font_override("font", get_theme_font(SNAME("main"), EditorStringName(EditorFonts)));
+ current_object_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("main"), EditorStringName(EditorFonts)));
sub_objects_icon->set_texture(get_theme_icon(SNAME("arrow"), SNAME("OptionButton")));
sub_objects_menu->add_theme_constant_override("icon_max_width", icon_size);
} break;
diff --git a/editor/gui/editor_spin_slider.cpp b/editor/gui/editor_spin_slider.cpp
index a838299288..6c85641d3a 100644
--- a/editor/gui/editor_spin_slider.cpp
+++ b/editor/gui/editor_spin_slider.cpp
@@ -314,8 +314,8 @@ void EditorSpinSlider::_draw_spin_slider() {
if (!flat) {
draw_style_box(sb, Rect2(Vector2(), size));
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("LineEdit"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("LineEdit"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("LineEdit"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("LineEdit"));
int sep_base = 4 * EDSCALE;
int sep = sep_base + sb->get_offset().x; //make it have the same margin on both sides, looks better
@@ -328,7 +328,7 @@ void EditorSpinSlider::_draw_spin_slider() {
int vofs = (size.height - font->get_height(font_size)) / 2 + font->get_ascent(font_size);
- Color fc = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SNAME("font_color"), SNAME("LineEdit"));
+ Color fc = get_theme_color(is_read_only() ? SNAME("font_uneditable_color") : SceneStringName(font_color), SNAME("LineEdit"));
Color lc = get_theme_color(is_read_only() ? SNAME("read_only_label_color") : SNAME("label_color"));
if (flat && !label.is_empty()) {
@@ -514,8 +514,8 @@ LineEdit *EditorSpinSlider::get_line_edit() {
Size2 EditorSpinSlider::get_minimum_size() const {
Ref<StyleBox> sb = get_theme_stylebox(CoreStringName(normal), SNAME("LineEdit"));
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("LineEdit"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("LineEdit"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("LineEdit"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("LineEdit"));
Size2 ms = sb->get_minimum_size();
ms.height += font->get_height(font_size);
diff --git a/editor/gui/editor_validation_panel.cpp b/editor/gui/editor_validation_panel.cpp
index 80bb08517c..969cb43952 100644
--- a/editor/gui/editor_validation_panel.cpp
+++ b/editor/gui/editor_validation_panel.cpp
@@ -108,17 +108,17 @@ void EditorValidationPanel::set_message(int p_id, const String &p_text, MessageT
switch (p_type) {
case MSG_OK:
- label->add_theme_color_override(SNAME("font_color"), theme_cache.valid_color);
+ label->add_theme_color_override(SceneStringName(font_color), theme_cache.valid_color);
break;
case MSG_WARNING:
- label->add_theme_color_override(SNAME("font_color"), theme_cache.warning_color);
+ label->add_theme_color_override(SceneStringName(font_color), theme_cache.warning_color);
break;
case MSG_ERROR:
- label->add_theme_color_override(SNAME("font_color"), theme_cache.error_color);
+ label->add_theme_color_override(SceneStringName(font_color), theme_cache.error_color);
valid = false;
break;
case MSG_INFO:
- label->remove_theme_color_override(SNAME("font_color"));
+ label->remove_theme_color_override(SceneStringName(font_color));
break;
}
}
diff --git a/editor/gui/editor_zoom_widget.cpp b/editor/gui/editor_zoom_widget.cpp
index 73afbc3ab5..341da7bfaf 100644
--- a/editor/gui/editor_zoom_widget.cpp
+++ b/editor/gui/editor_zoom_widget.cpp
@@ -211,7 +211,7 @@ EditorZoomWidget::EditorZoomWidget() {
zoom_reset->add_theme_style_override(SceneStringName(pressed), empty_stylebox);
zoom_reset->add_theme_constant_override("outline_size", Math::ceil(2 * EDSCALE));
zoom_reset->add_theme_color_override("font_outline_color", Color(0, 0, 0));
- zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1));
+ zoom_reset->add_theme_color_override(SceneStringName(font_color), Color(1, 1, 1));
zoom_reset->set_shortcut(ED_GET_SHORTCUT("canvas_item_editor/zoom_100_percent"));
zoom_reset->set_shortcut_context(this);
diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp
index 6353e63695..7b30e68155 100644
--- a/editor/import/audio_stream_import_settings.cpp
+++ b/editor/import/audio_stream_import_settings.cpp
@@ -52,13 +52,13 @@ void AudioStreamImportSettingsDialog::_notification(int p_what) {
color_rect->set_color(get_theme_color(SNAME("dark_color_1"), EditorStringName(Editor)));
_current_label->begin_bulk_theme_override();
- _current_label->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
- _current_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
+ _current_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
+ _current_label->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
_current_label->end_bulk_theme_override();
_duration_label->begin_bulk_theme_override();
- _duration_label->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
- _duration_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
+ _duration_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
+ _duration_label->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
_duration_label->end_bulk_theme_override();
zoom_in->set_icon(get_editor_theme_icon(SNAME("ZoomMore")));
diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp
index 9b6a7b9a93..7f7f27343f 100644
--- a/editor/import/dynamic_font_import_settings.cpp
+++ b/editor/import/dynamic_font_import_settings.cpp
@@ -487,8 +487,8 @@ void DynamicFontImportSettingsDialog::_main_prop_changed(const String &p_edited_
}
}
- font_preview_label->add_theme_font_override("font", font_preview);
- font_preview_label->add_theme_font_size_override("font_size", 200 * EDSCALE);
+ font_preview_label->add_theme_font_override(SceneStringName(font), font_preview);
+ font_preview_label->add_theme_font_size_override(SceneStringName(font_size), 200 * EDSCALE);
font_preview_label->queue_redraw();
}
@@ -643,7 +643,7 @@ void DynamicFontImportSettingsDialog::_change_text_opts() {
font_main_text->set_variation_face_index(import_variation_data->get("variation_face_index"));
font_main_text->set_variation_transform(import_variation_data->get("variation_transform"));
- text_edit->add_theme_font_override("font", font_main_text);
+ text_edit->add_theme_font_override(SceneStringName(font), font_main_text);
}
void DynamicFontImportSettingsDialog::_glyph_update_lbl() {
@@ -837,7 +837,7 @@ void DynamicFontImportSettingsDialog::_edit_range(int32_t p_start, int32_t p_end
item->set_selectable(col + 1, true);
item->set_custom_font(col + 1, font_main_big);
- item->set_custom_font_size(col + 1, get_theme_font_size(SNAME("font_size")) * 2);
+ item->set_custom_font_size(col + 1, get_theme_font_size(SceneStringName(font_size)) * 2);
col++;
if (col == 16) {
@@ -929,7 +929,7 @@ void DynamicFontImportSettingsDialog::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
add_var->set_icon(get_editor_theme_icon(SNAME("Add")));
- label_warn->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ label_warn->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} break;
}
}
@@ -1097,7 +1097,7 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
font_main->set_data(font_data);
font_main->set_multichannel_signed_distance_field(false);
- text_edit->add_theme_font_override("font", font_main);
+ text_edit->add_theme_font_override(SceneStringName(font), font_main);
base_path = p_path;
@@ -1119,7 +1119,7 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
inspector_text->edit(text_settings_data.ptr());
- int gww = get_theme_font(SNAME("font"))->get_string_size("00000").x + 50;
+ int gww = get_theme_font(SceneStringName(font))->get_string_size("00000").x + 50;
glyph_table->set_column_custom_minimum_width(0, gww);
glyph_table->clear();
vars_list->clear();
@@ -1226,8 +1226,8 @@ void DynamicFontImportSettingsDialog::open_settings(const String &p_path) {
font_preview->set_subpixel_positioning((TextServer::SubpixelPositioning)import_settings_data->get("subpixel_positioning").operator int());
font_preview->set_oversampling(import_settings_data->get("oversampling"));
}
- font_preview_label->add_theme_font_override("font", font_preview);
- font_preview_label->add_theme_font_size_override("font_size", 200 * EDSCALE);
+ font_preview_label->add_theme_font_override(SceneStringName(font), font_preview);
+ font_preview_label->add_theme_font_size_override(SceneStringName(font_size), 200 * EDSCALE);
font_preview_label->queue_redraw();
_variations_validate();
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 2347c715a8..9dc7c43684 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -726,7 +726,7 @@ void ImportDock::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
import_opts->edit(params);
- label_warning->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ label_warning->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} break;
}
}
@@ -739,12 +739,12 @@ void ImportDock::_set_dirty(bool p_dirty) {
if (p_dirty) {
// Add a dirty marker to notify the user that they should reimport the selected resource to see changes.
import->set_text(TTR("Reimport") + " (*)");
- import->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ import->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
import->set_tooltip_text(TTR("You have pending changes that haven't been applied yet. Click Reimport to apply changes made to the import options.\nSelecting another resource in the FileSystem dock without clicking Reimport first will discard changes made in the Import dock."));
} else {
// Remove the dirty marker on the Reimport button.
import->set_text(TTR("Reimport"));
- import->remove_theme_color_override("font_color");
+ import->remove_theme_color_override(SceneStringName(font_color));
import->set_tooltip_text("");
}
}
diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp
index 2ecce2f739..f23d593fb7 100644
--- a/editor/input_event_configuration_dialog.cpp
+++ b/editor/input_event_configuration_dialog.cpp
@@ -583,7 +583,7 @@ void InputEventConfigurationDialog::_notification(int p_what) {
icon_cache.joypad_button = get_editor_theme_icon(SNAME("JoyButton"));
icon_cache.joypad_axis = get_editor_theme_icon(SNAME("JoyAxis"));
- event_as_text->add_theme_font_override("font", get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)));
+ event_as_text->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)));
_update_input_list();
} break;
@@ -646,7 +646,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
event_as_text->set_custom_minimum_size(Size2(500, 0) * EDSCALE);
event_as_text->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
event_as_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
- event_as_text->add_theme_font_size_override("font_size", 18 * EDSCALE);
+ event_as_text->add_theme_font_size_override(SceneStringName(font_size), 18 * EDSCALE);
main_vbox->add_child(event_as_text);
event_listener = memnew(EventListenerLineEdit);
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index ad2e16636b..43b5cb711e 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -451,10 +451,10 @@ void InspectorDock::_notification(int p_what) {
search->set_right_icon(get_editor_theme_icon(SNAME("Search")));
if (info_is_warning) {
info->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
- info->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} else {
info->set_icon(get_editor_theme_icon(SNAME("NodeInfo")));
- info->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), EditorStringName(Editor)));
+ info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), EditorStringName(Editor)));
}
} break;
}
@@ -481,10 +481,10 @@ void InspectorDock::set_info(const String &p_button_text, const String &p_messag
if (info_is_warning) {
info->set_icon(get_editor_theme_icon(SNAME("NodeWarning")));
- info->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
} else {
info->set_icon(get_editor_theme_icon(SNAME("NodeInfo")));
- info->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), EditorStringName(Editor)));
+ info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), EditorStringName(Editor)));
}
if (!p_button_text.is_empty() && !p_message.is_empty()) {
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index b1279e4192..fbdf42a717 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -579,7 +579,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl
String num = String::num(vertex.vertex);
Size2 num_size = font->get_string_size(num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
const float outline_size = 4;
- Color font_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color font_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
Color outline_color = font_color.inverted();
p_overlay->draw_string_outline(font, point - num_size * 0.5, num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, outline_size, outline_color);
p_overlay->draw_string(font, point - num_size * 0.5, num, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 52ea7ff0ba..de031c1a57 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -217,12 +217,12 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() {
return;
}
- Color linecolor = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color linecolor = get_theme_color(SceneStringName(font_color), SNAME("Label"));
Color linecolor_soft = linecolor;
linecolor_soft.a *= 0.5;
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Ref<Texture2D> icon = get_editor_theme_icon(SNAME("KeyValue"));
Ref<Texture2D> icon_selected = get_editor_theme_icon(SNAME("KeySelected"));
@@ -574,7 +574,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
error_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
- error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ error_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
tool_blend->set_icon(get_editor_theme_icon(SNAME("EditPivot")));
tool_select->set_icon(get_editor_theme_icon(SNAME("ToolSelect")));
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index ef61a95ee7..318e132095 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -445,11 +445,11 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() {
return;
}
- Color linecolor = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Color linecolor = get_theme_color(SceneStringName(font_color), SNAME("Label"));
Color linecolor_soft = linecolor;
linecolor_soft.a *= 0.5;
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Ref<Texture2D> icon = get_editor_theme_icon(SNAME("KeyValue"));
Ref<Texture2D> icon_selected = get_editor_theme_icon(SNAME("KeySelected"));
@@ -796,7 +796,7 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
error_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
- error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ error_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
tool_blend->set_icon(get_editor_theme_icon(SNAME("EditPivot")));
tool_select->set_icon(get_editor_theme_icon(SNAME("ToolSelect")));
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 28e1eeccc4..4e19458ea4 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -165,7 +165,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
name->set_editable(!read_only);
name->set_expand_to_text_length_enabled(true);
node->add_child(name);
- node->set_slot(0, false, 0, Color(), true, read_only ? -1 : 0, get_theme_color(SNAME("font_color"), SNAME("Label")));
+ node->set_slot(0, false, 0, Color(), true, read_only ? -1 : 0, get_theme_color(SceneStringName(font_color), SNAME("Label")));
name->connect("text_submitted", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed).bind(agnode), CONNECT_DEFERRED);
name->connect(SceneStringName(focus_exited), callable_mp(this, &AnimationNodeBlendTreeEditor::_node_renamed_focus_out).bind(agnode), CONNECT_DEFERRED);
name->connect("text_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed), CONNECT_DEFERRED);
@@ -186,7 +186,7 @@ void AnimationNodeBlendTreeEditor::update_graph() {
Label *in_name = memnew(Label);
node->add_child(in_name);
in_name->set_text(agnode->get_input_name(i));
- node->set_slot(base + i, true, read_only ? -1 : 0, get_theme_color(SNAME("font_color"), SNAME("Label")), false, 0, Color());
+ node->set_slot(base + i, true, read_only ? -1 : 0, get_theme_color(SceneStringName(font_color), SNAME("Label")), false, 0, Color());
}
List<PropertyInfo> pinfo;
@@ -943,7 +943,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
error_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
- error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ error_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
if (is_visible_in_tree()) {
update_graph();
diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp
index a2f1fa5614..a00dbe2754 100644
--- a/editor/plugins/animation_library_editor.cpp
+++ b/editor/plugins/animation_library_editor.cpp
@@ -76,7 +76,7 @@ void AnimationLibraryEditor::_add_library_validate(const String &p_name) {
}
if (error != "") {
- add_library_validate->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ add_library_validate->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
add_library_validate->set_text(error);
add_library_dialog->get_ok_button()->set_disabled(true);
} else {
@@ -89,7 +89,7 @@ void AnimationLibraryEditor::_add_library_validate(const String &p_name) {
add_library_validate->set_text(TTR("Library name is valid."));
}
}
- add_library_validate->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
+ add_library_validate->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
add_library_dialog->get_ok_button()->set_disabled(false);
}
}
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 8be010c00b..1ae5298a55 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1269,7 +1269,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
panel->add_theme_style_override(SceneStringName(panel), theme_cache.panel_style);
error_panel->add_theme_style_override(SceneStringName(panel), theme_cache.error_panel_style);
- error_label->add_theme_color_override("font_color", theme_cache.error_color);
+ error_label->add_theme_color_override(SceneStringName(font_color), theme_cache.error_color);
tool_select->set_icon(theme_cache.tool_icon_select);
tool_create->set_icon(theme_cache.tool_icon_create);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 25c173ed35..2dce0904e4 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -91,9 +91,9 @@ void EditorAssetLibraryItem::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
icon->set_texture_normal(get_editor_theme_icon(SNAME("ProjectIconLoading")));
- category->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
- author->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
- price->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
+ category->add_theme_color_override(SceneStringName(font_color), Color(0.5, 0.5, 0.5));
+ author->add_theme_color_override(SceneStringName(font_color), Color(0.5, 0.5, 0.5));
+ price->add_theme_color_override(SceneStringName(font_color), Color(0.5, 0.5, 0.5));
if (author->get_default_cursor_shape() == CURSOR_ARROW) {
// Disable visible feedback if author link isn't clickable.
@@ -457,7 +457,7 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("AssetLib")));
- status->add_theme_color_override("font_color", get_theme_color(SNAME("status_color"), SNAME("AssetLib")));
+ status->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("status_color"), SNAME("AssetLib")));
dismiss_button->set_texture_normal(get_theme_icon(SNAME("dismiss"), SNAME("AssetLib")));
} break;
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp
index af6bbb679a..f691bad3c3 100644
--- a/editor/plugins/audio_stream_editor_plugin.cpp
+++ b/editor/plugins/audio_stream_editor_plugin.cpp
@@ -47,8 +47,8 @@ void AudioStreamEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
Ref<Font> font = get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts));
- _current_label->add_theme_font_override(SNAME("font"), font);
- _duration_label->add_theme_font_override(SNAME("font"), font);
+ _current_label->add_theme_font_override(SceneStringName(font), font);
+ _duration_label->add_theme_font_override(SceneStringName(font), font);
_play_button->set_icon(get_editor_theme_icon(SNAME("MainPlay")));
_stop_button->set_icon(get_editor_theme_icon(SNAME("Stop")));
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 5c7d02dcfa..196df7f33e 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2786,10 +2786,10 @@ Control::CursorShape CanvasItemEditor::get_cursor_shape(const Point2 &p_pos) con
}
void CanvasItemEditor::_draw_text_at_position(Point2 p_position, const String &p_string, Side p_side) {
- Color color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
color.a = 0.8;
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Size2 text_size = font->get_string_size(p_string, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
switch (p_side) {
case SIDE_LEFT:
@@ -2855,7 +2855,7 @@ void CanvasItemEditor::_draw_guides() {
}
// Dragged guide.
- Color text_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color text_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
Color outline_color = text_color.inverted();
const float outline_size = 2;
if (drag_type == DRAG_DOUBLE_GUIDE || drag_type == DRAG_V_GUIDE) {
@@ -2894,8 +2894,8 @@ void CanvasItemEditor::_draw_smart_snapping() {
void CanvasItemEditor::_draw_rulers() {
Color bg_color = get_theme_color(SNAME("dark_color_2"), EditorStringName(Editor));
- Color graduation_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor)).lerp(bg_color, 0.5);
- Color font_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color graduation_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)).lerp(bg_color, 0.5);
+ Color font_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
font_color.a = 0.8;
Ref<Font> font = get_theme_font(SNAME("rulers"), EditorStringName(EditorFonts));
int font_size = get_theme_font_size(SNAME("rulers_size"), EditorStringName(EditorFonts));
@@ -3074,7 +3074,7 @@ void CanvasItemEditor::_draw_ruler_tool() {
Ref<Font> font = get_theme_font(SNAME("bold"), EditorStringName(EditorFonts));
int font_size = 1.3 * get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts));
- Color font_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color font_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
Color font_secondary_color = font_color;
font_secondary_color.set_v(font_secondary_color.get_v() > 0.5 ? 0.7 : 0.3);
Color outline_color = font_color.inverted();
@@ -3741,8 +3741,8 @@ void CanvasItemEditor::_draw_hover() {
Ref<Texture2D> node_icon = hovering_results[i].icon;
String node_name = hovering_results[i].name;
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Size2 node_name_size = font->get_string_size(node_name, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
Size2 item_size = Size2(icon_size.x + 4 + node_name_size.x, MAX(icon_size.y, node_name_size.y - 3));
@@ -3815,8 +3815,8 @@ void CanvasItemEditor::_draw_message() {
return;
}
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Point2 msgpos = Point2(RULER_WIDTH + 5 * EDSCALE, viewport->get_size().y - 20 * EDSCALE);
viewport->draw_string(font, msgpos + Point2(1, 1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
viewport->draw_string(font, msgpos + Point2(-1, -1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
@@ -6218,7 +6218,7 @@ void CanvasItemEditorViewport::_update_theme() {
check->set_icon(get_editor_theme_icon(check->get_text()));
}
- label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
}
void CanvasItemEditorViewport::_notification(int p_what) {
@@ -6295,7 +6295,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(CanvasItemEditor *p_canvas_it
canvas_item_editor->get_controls_container()->add_child(label);
label_desc = memnew(Label);
- label_desc->add_theme_color_override("font_color", Color(0.6f, 0.6f, 0.6f, 1));
+ label_desc->add_theme_color_override(SceneStringName(font_color), Color(0.6f, 0.6f, 0.6f, 1));
label_desc->add_theme_color_override("font_shadow_color", Color(0.2f, 0.2f, 0.2f, 1));
label_desc->add_theme_constant_override("shadow_outline_size", 1 * EDSCALE);
label_desc->add_theme_constant_override("line_spacing", 0);
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 278543dc36..99157793ba 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -658,8 +658,8 @@ void CurveEdit::set_selected_index(int p_index) {
}
void CurveEdit::update_view_transform() {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
const real_t margin = font->get_height(font_size) + 2 * EDSCALE;
@@ -820,10 +820,10 @@ void CurveEdit::_redraw() {
// Draw number markings.
draw_set_transform_matrix(Transform2D());
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
float font_height = font->get_height(font_size);
- Color text_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color text_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
for (int i = 0; i <= grid_steps.x; ++i) {
real_t x = i * step_size.x;
@@ -841,8 +841,8 @@ void CurveEdit::_redraw() {
// The scaling up ensures that the curve rendering doesn't break when we use a quad line to draw it.
draw_set_transform_matrix(Transform2D(0, get_view_pos(Vector2(0, 0))));
- const Color line_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
- const Color edge_line_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor)) * Color(1, 1, 1, 0.75);
+ const Color line_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
+ const Color edge_line_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)) * Color(1, 1, 1, 0.75);
CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color);
plot_curve_accurate(**curve, 2.f, (get_view_pos(Vector2(1, curve->get_max_value())) - get_view_pos(Vector2(0, curve->get_min_value()))) / Vector2(1, curve->get_range()), plot_func);
@@ -852,7 +852,7 @@ void CurveEdit::_redraw() {
bool shift_pressed = Input::get_singleton()->is_key_pressed(Key::SHIFT);
- const Color point_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ const Color point_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
for (int i = 0; i < curve->get_point_count(); ++i) {
Vector2 pos = get_view_pos(curve->get_point_position(i));
@@ -873,7 +873,7 @@ void CurveEdit::_redraw() {
// Draw tangents if not dragging a point, or if holding a point without having moved it yet.
if (grabbing == GRAB_NONE || initial_grab_pos == point_pos || selected_tangent_index != TANGENT_NONE) {
const Color selected_tangent_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor)).darkened(0.25);
- const Color tangent_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor)).darkened(0.25);
+ const Color tangent_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)).darkened(0.25);
if (selected_index != 0) {
Vector2 control_pos = get_tangent_view_pos(selected_index, TANGENT_LEFT);
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index f2b38536b5..7ac924571d 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -97,6 +97,10 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from,
return Ref<Texture2D>();
}
+ if (!atex->get_region().has_area()) {
+ return Ref<Texture2D>();
+ }
+
img = atlas->get_region(atex->get_region());
} else {
Ref<Texture2D> tex = p_from;
diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp
index 6d1e102808..15b268337f 100644
--- a/editor/plugins/font_config_plugin.cpp
+++ b/editor/plugins/font_config_plugin.cpp
@@ -892,9 +892,9 @@ void FontPreview::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_DRAW: {
// Draw font name (style).
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
- Color text_color = get_theme_color(SNAME("font_color"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
+ Color text_color = get_theme_color(SceneStringName(font_color), SNAME("Label"));
// Draw font preview.
bool prev_ok = true;
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 05b7fa08ca..0887075e8b 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1639,11 +1639,7 @@ void Node3DEditorViewport::input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (m.is_valid()) {
- if (_edit.mode == TRANSFORM_ROTATE) {
- _edit.mouse_pos = m->get_position(); // rotate should not wrap
- } else {
- _edit.mouse_pos += _get_warped_mouse_motion(p_event);
- }
+ _edit.mouse_pos += _get_warped_mouse_motion(p_event);
update_transform(_get_key_modifier(m) == Key::SHIFT);
}
}
@@ -2971,14 +2967,14 @@ void Node3DEditorViewport::_notification(int p_what) {
// Middle point is at 15 ms.
cpu_time_label->set_text(vformat(TTR("CPU Time: %s ms"), rtos(cpu_time).pad_decimals(2)));
cpu_time_label->add_theme_color_override(
- "font_color",
+ SceneStringName(font_color),
frame_time_gradient->get_color_at_offset(
Math::remap(cpu_time, 0, 30, 0, 1)));
gpu_time_label->set_text(vformat(TTR("GPU Time: %s ms"), rtos(gpu_time).pad_decimals(2)));
// Middle point is at 15 ms.
gpu_time_label->add_theme_color_override(
- "font_color",
+ SceneStringName(font_color),
frame_time_gradient->get_color_at_offset(
Math::remap(gpu_time, 0, 30, 0, 1)));
@@ -2986,7 +2982,7 @@ void Node3DEditorViewport::_notification(int p_what) {
fps_label->set_text(vformat(TTR("FPS: %d"), fps));
// Middle point is at 60 FPS.
fps_label->add_theme_color_override(
- "font_color",
+ SceneStringName(font_color),
frame_time_gradient->get_color_at_offset(
Math::remap(fps, 110, 10, 0, 1)));
}
@@ -3150,8 +3146,8 @@ void Node3DEditorViewport::_draw() {
RID ci = surface->get_canvas_item();
if (message_time > 0) {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Point2 msgpos = Point2(5, get_size().y - 20);
font->draw_string(ci, msgpos + Point2(1, 1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
font->draw_string(ci, msgpos + Point2(-1, -1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
@@ -3229,8 +3225,8 @@ void Node3DEditorViewport::_draw() {
*surface,
1.0 - logscale_t,
get_editor_theme_icon(SNAME("ViewportSpeed")),
- get_theme_font(SNAME("font"), SNAME("Label")),
- get_theme_font_size(SNAME("font_size"), SNAME("Label")),
+ get_theme_font(SceneStringName(font), SNAME("Label")),
+ get_theme_font_size(SceneStringName(font_size), SNAME("Label")),
vformat("%s m/s", String::num(freelook_speed).pad_decimals(precision)),
Color(1.0, 0.95, 0.7));
}
@@ -3252,8 +3248,8 @@ void Node3DEditorViewport::_draw() {
*surface,
logscale_t,
get_editor_theme_icon(SNAME("ViewportZoom")),
- get_theme_font(SNAME("font"), SNAME("Label")),
- get_theme_font_size(SNAME("font_size"), SNAME("Label")),
+ get_theme_font(SceneStringName(font), SNAME("Label")),
+ get_theme_font_size(SceneStringName(font_size), SNAME("Label")),
vformat("%s m", String::num(cursor.distance).pad_decimals(precision)),
Color(0.7, 0.95, 1.0));
}
@@ -5391,7 +5387,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
zoom_limit_label = memnew(Label);
zoom_limit_label->set_text(TTR("To zoom further, change the camera's clipping planes (View -> Settings...)"));
zoom_limit_label->set_name("ZoomLimitMessageLabel");
- zoom_limit_label->add_theme_color_override("font_color", Color(1, 1, 1, 1));
+ zoom_limit_label->add_theme_color_override(SceneStringName(font_color), Color(1, 1, 1, 1));
zoom_limit_label->hide();
bottom_center_vbox->add_child(zoom_limit_label);
@@ -5399,7 +5395,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
preview_material_label->set_anchors_and_offsets_preset(LayoutPreset::PRESET_BOTTOM_LEFT);
preview_material_label->set_offset(Side::SIDE_TOP, -70 * EDSCALE);
preview_material_label->set_text(TTR("Overriding material..."));
- preview_material_label->add_theme_color_override("font_color", Color(1, 1, 1, 1));
+ preview_material_label->add_theme_color_override(SceneStringName(font_color), Color(1, 1, 1, 1));
preview_material_label->hide();
surface->add_child(preview_material_label);
@@ -5408,7 +5404,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
preview_material_label_desc->set_offset(Side::SIDE_TOP, -50 * EDSCALE);
Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL;
preview_material_label_desc->set_text(vformat(TTR("Drag and drop to override the material of any geometry node.\nHold %s when dropping to override a specific surface."), find_keycode_name(key)));
- preview_material_label_desc->add_theme_color_override("font_color", Color(0.8, 0.8, 0.8, 1));
+ preview_material_label_desc->add_theme_color_override(SceneStringName(font_color), Color(0.8, 0.8, 0.8, 1));
preview_material_label_desc->add_theme_constant_override("line_spacing", 0);
preview_material_label_desc->hide();
surface->add_child(preview_material_label_desc);
@@ -7806,8 +7802,8 @@ void Node3DEditor::_update_theme() {
environ_button->set_icon(get_editor_theme_icon(SNAME("PreviewEnvironment")));
sun_environ_settings->set_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
- sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
- environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+ sun_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));
+ environ_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));
sun_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
environ_sky_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), EditorStringName(Editor))));
@@ -7854,8 +7850,8 @@ void Node3DEditor::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
_update_theme();
_update_gizmos_menu_theme();
- sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
- environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window")));
+ sun_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));
+ environ_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title_font"), SNAME("Window")));
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
@@ -8435,6 +8431,7 @@ Node3DEditor::Node3DEditor() {
VBoxContainer *vbc = this;
custom_camera = nullptr;
+ ERR_FAIL_COND_MSG(singleton != nullptr, "A Node3DEditor singleton already exists.");
singleton = this;
editor_selection = EditorNode::get_singleton()->get_editor_selection();
editor_selection->add_editor_plugin(this);
@@ -9064,6 +9061,7 @@ void fragment() {
clear(); // Make sure values are initialized. Will call _snap_update() for us.
}
Node3DEditor::~Node3DEditor() {
+ singleton = nullptr;
memdelete(preview_node);
if (preview_sun_dangling && preview_sun) {
memdelete(preview_sun);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 334b253316..f4e354ac48 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2079,7 +2079,7 @@ void ScriptEditor::_update_script_colors() {
int hist_size = EDITOR_GET("text_editor/script_list/script_temperature_history_size");
Color hot_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor));
hot_color.set_s(hot_color.get_s() * 0.9);
- Color cold_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ Color cold_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
for (int i = 0; i < script_list->get_item_count(); i++) {
int c = script_list->get_item_metadata(i);
diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp
index dc021daaad..d1bc5f2d05 100644
--- a/editor/plugins/texture_3d_editor_plugin.cpp
+++ b/editor/plugins/texture_3d_editor_plugin.cpp
@@ -162,7 +162,7 @@ Texture3DEditor::Texture3DEditor() {
info = memnew(Label);
info->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info->set_v_grow_direction(GROW_DIRECTION_BEGIN);
- info->add_theme_color_override("font_color", Color(1, 1, 1, 1));
+ info->add_theme_color_override(SceneStringName(font_color), Color(1, 1, 1, 1));
info->add_theme_color_override("font_shadow_color", Color(0, 0, 0, 0.5));
info->add_theme_constant_override("shadow_outline_size", 1);
info->add_theme_constant_override("shadow_offset_x", 2);
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 38d9bb84f4..e9d7aa9eb8 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -58,7 +58,7 @@ void TexturePreview::_notification(int p_what) {
if (metadata_label) {
Ref<Font> metadata_label_font = get_theme_font(SNAME("expression"), EditorStringName(EditorFonts));
- metadata_label->add_theme_font_override("font", metadata_label_font);
+ metadata_label->add_theme_font_override(SceneStringName(font), metadata_label_font);
}
checkerboard->set_texture(get_editor_theme_icon(SNAME("Checkerboard")));
@@ -145,10 +145,10 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
p_texture->connect_changed(callable_mp(this, &TexturePreview::_update_metadata_label_text));
// It's okay that these colors are static since the grid color is static too.
- metadata_label->add_theme_color_override("font_color", Color::named("white"));
+ metadata_label->add_theme_color_override(SceneStringName(font_color), Color::named("white"));
metadata_label->add_theme_color_override("font_shadow_color", Color::named("black"));
- metadata_label->add_theme_font_size_override("font_size", 14 * EDSCALE);
+ metadata_label->add_theme_font_size_override(SceneStringName(font_size), 14 * EDSCALE);
metadata_label->add_theme_color_override("font_outline_color", Color::named("black"));
metadata_label->add_theme_constant_override("outline_size", 8 * EDSCALE);
metadata_label->set_h_size_flags(Control::SIZE_SHRINK_END);
diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp
index 2e9040445a..11e476f54d 100644
--- a/editor/plugins/texture_layered_editor_plugin.cpp
+++ b/editor/plugins/texture_layered_editor_plugin.cpp
@@ -238,7 +238,7 @@ TextureLayeredEditor::TextureLayeredEditor() {
info = memnew(Label);
info->set_h_grow_direction(GROW_DIRECTION_BEGIN);
info->set_v_grow_direction(GROW_DIRECTION_BEGIN);
- info->add_theme_color_override("font_color", Color(1, 1, 1, 1));
+ info->add_theme_color_override(SceneStringName(font_color), Color(1, 1, 1, 1));
info->add_theme_color_override("font_shadow_color", Color(0, 0, 0, 0.5));
info->add_theme_constant_override("shadow_outline_size", 1);
info->add_theme_constant_override("shadow_offset_x", 2);
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index b307832ff6..1fd6c3589e 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -856,7 +856,7 @@ void ThemeItemImportTree::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
select_icons_warning_icon->set_texture(get_editor_theme_icon(SNAME("StatusWarning")));
- select_icons_warning->add_theme_color_override("font_color", get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
+ select_icons_warning->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
import_items_filter->set_right_icon(get_editor_theme_icon(SNAME("Search")));
@@ -2497,7 +2497,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_
item_rename_cancel_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_canceled).bind(p_data_type, p_item_name, item_name_container));
item_rename_cancel_button->hide();
} else {
- item_name->add_theme_color_override("font_color", get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
+ item_name->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("font_disabled_color"), EditorStringName(Editor)));
Button *item_override_button = memnew(Button);
item_override_button->set_icon(get_editor_theme_icon(SNAME("Add")));
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index 52b58b74a3..3942baed8a 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -311,6 +311,7 @@ RID TileAtlasView::_get_canvas_item_to_draw(const TileData *p_for_data, const Ca
RID ci_rid = RS::get_singleton()->canvas_item_create();
RS::get_singleton()->canvas_item_set_parent(ci_rid, p_base_item->get_canvas_item());
RS::get_singleton()->canvas_item_set_material(ci_rid, mat->get_rid());
+ RS::get_singleton()->canvas_item_set_default_texture_filter(ci_rid, RS::CanvasItemTextureFilter(p_base_item->get_texture_filter_in_tree()));
p_material_map[mat] = ci_rid;
return ci_rid;
}
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp
index df90383678..d210741e64 100644
--- a/editor/plugins/tiles/tile_data_editors.cpp
+++ b/editor/plugins/tiles/tile_data_editors.cpp
@@ -245,8 +245,8 @@ void GenericTilePolygonEditor::_base_control_draw() {
// Draw the text on top of the selected point.
if (tinted_polygon_index >= 0) {
- Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
String text = multiple_polygon_mode ? vformat("%d:%d", tinted_polygon_index, tinted_point_index) : vformat("%d", tinted_point_index);
Size2 text_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size);
base_control->draw_string(font, xform.xform(polygons[tinted_polygon_index][tinted_point_index]) - text_size * 0.5, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1.0, 1.0, 1.0, 0.5));
diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp
index 6cf0bec535..fa06c52e3e 100644
--- a/editor/plugins/tiles/tile_map_layer_editor.cpp
+++ b/editor/plugins/tiles/tile_map_layer_editor.cpp
@@ -994,8 +994,8 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p
}
}
- Ref<Font> font = p_overlay->get_theme_font(SNAME("font"), SNAME("Label"));
- int font_size = p_overlay->get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Ref<Font> font = p_overlay->get_theme_font(SceneStringName(font), SNAME("Label"));
+ int font_size = p_overlay->get_theme_font_size(SceneStringName(font_size), SNAME("Label"));
Point2 msgpos = Point2(20 * EDSCALE, p_overlay->get_size().y - 20 * EDSCALE);
String text = tile_set->local_to_map(edited_layer->get_local_mouse_position());
@@ -4333,7 +4333,7 @@ void TileMapLayerEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
}
// Draw the IDs for debug.
- /*Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
+ /*Ref<Font> font = get_theme_font(SceneStringName(font), SNAME("Label"));
for (int x = displayed_rect.position.x; x < (displayed_rect.position.x + displayed_rect.size.x); x++) {
for (int y = displayed_rect.position.y; y < (displayed_rect.position.y + displayed_rect.size.y); y++) {
p_overlay->draw_string(font, xform.xform(tile_set->map_to_local(Vector2(x, y))) + Vector2i(-tile_shape_size.x / 2, 0), vformat("%s", Vector2(x, y)));
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 9774b7dcec..0003900ac9 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -929,7 +929,7 @@ void TileSetAtlasSourceEditor::_tile_data_editor_dropdown_button_draw() {
if (tile_data_editor_dropdown_button->has_focus()) {
clr = get_theme_color(SNAME("font_focus_color"));
} else {
- clr = get_theme_color(SNAME("font_color"));
+ clr = get_theme_color(SceneStringName(font_color));
}
}
}
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index 1e88916672..3dfd2bcc04 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -176,7 +176,7 @@ void VersionControlEditorPlugin::_update_set_up_warning(const String &p_new_text
set_up_ssh_passphrase->get_text().is_empty();
if (empty_settings) {
- set_up_warning_text->add_theme_color_override(SNAME("font_color"), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor)));
+ set_up_warning_text->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor)));
set_up_warning_text->set_text(TTR("Remote settings are empty. VCS features that use the network may not work."));
} else {
set_up_warning_text->set_text("");
@@ -680,7 +680,7 @@ void VersionControlEditorPlugin::_display_diff_split_view(List<EditorVCSInterfac
bool has_change = diff_line.status != " ";
static const Color red = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor));
static const Color green = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("success_color"), EditorStringName(Editor));
- static const Color white = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("font_color"), SNAME("Label")) * Color(1, 1, 1, 0.6);
+ static const Color white = EditorNode::get_singleton()->get_editor_theme()->get_color(SceneStringName(font_color), SNAME("Label")) * Color(1, 1, 1, 0.6);
if (diff_line.old_line_no >= 0) {
diff->push_cell();
@@ -763,7 +763,7 @@ void VersionControlEditorPlugin::_display_diff_unified_view(List<EditorVCSInterf
} else if (diff_line.status == "-") {
color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor));
} else {
- color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("font_color"), SNAME("Label"));
+ color = EditorNode::get_singleton()->get_editor_theme()->get_color(SceneStringName(font_color), SNAME("Label"));
color *= Color(1, 1, 1, 0.6);
}
@@ -1461,7 +1461,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor));
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor));
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor));
- change_type_to_color[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("font_color"), EditorStringName(Editor));
+ change_type_to_color[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_editor_theme()->get_color(SceneStringName(font_color), EditorStringName(Editor));
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_UNMERGED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor));
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusSuccess"), EditorStringName(EditorIcons));
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 290e0a3239..0f98c45ac1 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -567,10 +567,10 @@ void VisualShaderGraphPlugin::update_theme() {
Ref<Font> label_font = EditorNode::get_singleton()->get_editor_theme()->get_font("main_msdf", EditorStringName(EditorFonts));
Ref<Font> label_bold_font = EditorNode::get_singleton()->get_editor_theme()->get_font("main_bold_msdf", EditorStringName(EditorFonts));
- vs_msdf_fonts_theme->set_font("font", "Label", label_font);
- vs_msdf_fonts_theme->set_font("font", "GraphNodeTitleLabel", label_bold_font);
- vs_msdf_fonts_theme->set_font("font", "LineEdit", label_font);
- vs_msdf_fonts_theme->set_font("font", "Button", label_font);
+ vs_msdf_fonts_theme->set_font(SceneStringName(font), "Label", label_font);
+ vs_msdf_fonts_theme->set_font(SceneStringName(font), "GraphNodeTitleLabel", label_bold_font);
+ vs_msdf_fonts_theme->set_font(SceneStringName(font), "LineEdit", label_font);
+ vs_msdf_fonts_theme->set_font(SceneStringName(font), "Button", label_font);
}
bool VisualShaderGraphPlugin::is_node_has_parameter_instances_relatively(VisualShader::Type p_type, int p_node) const {
@@ -806,6 +806,11 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
parameter_ref->update_parameter_type();
}
+ Ref<VisualShaderNodeVarying> varying = vsnode;
+ if (varying.is_valid()) {
+ varying->set_shader_rid(visual_shader->get_rid());
+ }
+
Ref<VisualShaderNodeParameter> parameter = vsnode;
HBoxContainer *hb = nullptr;
@@ -1144,7 +1149,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
if (vsnode->is_input_port_default(j, mode) && !port_left_used) {
Label *hint_label = memnew(Label);
hint_label->set_text(TTR("[default]"));
- hint_label->add_theme_color_override("font_color", editor->get_theme_color(SNAME("font_readonly_color"), SNAME("TextEdit")));
+ hint_label->add_theme_color_override(SceneStringName(font_color), editor->get_theme_color(SNAME("font_readonly_color"), SNAME("TextEdit")));
hint_label->add_theme_style_override(CoreStringName(normal), editor->get_theme_stylebox(SNAME("label_style"), SNAME("VShaderEditor")));
hb->add_child(hint_label);
}
@@ -1352,7 +1357,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
}
if (!error.is_empty()) {
Label *error_label = memnew(Label);
- error_label->add_theme_color_override("font_color", editor->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ error_label->add_theme_color_override(SceneStringName(font_color), editor->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
error_label->set_text(error);
error_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD);
node->add_child(error_label);
@@ -1389,9 +1394,9 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool
}
expression_box->begin_bulk_theme_override();
- expression_box->add_theme_font_override("font", editor->get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
- expression_box->add_theme_font_size_override("font_size", editor->get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
- expression_box->add_theme_color_override("font_color", text_color);
+ expression_box->add_theme_font_override(SceneStringName(font), editor->get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
+ expression_box->add_theme_font_size_override(SceneStringName(font_size), editor->get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
+ expression_box->add_theme_color_override(SceneStringName(font_color), text_color);
expression_box->end_bulk_theme_override();
expression_syntax_highlighter->set_number_color(number_color);
@@ -3859,13 +3864,13 @@ void VisualShaderEditor::_remove_varying(const String &p_name) {
}
void VisualShaderEditor::_update_varyings() {
- VisualShaderNodeVarying::clear_varyings();
+ VisualShaderNodeVarying::clear_varyings(visual_shader->get_rid());
for (int i = 0; i < visual_shader->get_varyings_count(); i++) {
const VisualShader::Varying *var = visual_shader->get_varying_by_index(i);
if (var != nullptr) {
- VisualShaderNodeVarying::add_varying(var->name, var->mode, var->type);
+ VisualShaderNodeVarying::add_varying(visual_shader->get_rid(), var->name, var->mode, var->type);
}
}
}
@@ -4901,7 +4906,7 @@ void VisualShaderEditor::_notification(int p_what) {
Color error_color = get_theme_color(SNAME("error_color"), EditorStringName(Editor));
preview_text->add_theme_color_override("background_color", background_color);
- varying_error_label->add_theme_color_override("font_color", error_color);
+ varying_error_label->add_theme_color_override(SceneStringName(font_color), error_color);
for (const String &E : keyword_list) {
if (ShaderLanguage::is_control_flow_keyword(E)) {
@@ -4912,9 +4917,9 @@ void VisualShaderEditor::_notification(int p_what) {
}
preview_text->begin_bulk_theme_override();
- preview_text->add_theme_font_override("font", get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
- preview_text->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
- preview_text->add_theme_color_override("font_color", text_color);
+ preview_text->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("expression"), EditorStringName(EditorFonts)));
+ preview_text->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("expression_size"), EditorStringName(EditorFonts)));
+ preview_text->add_theme_color_override(SceneStringName(font_color), text_color);
preview_text->end_bulk_theme_override();
syntax_highlighter->set_number_color(number_color);
@@ -4931,9 +4936,9 @@ void VisualShaderEditor::_notification(int p_what) {
error_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Panel")));
error_label->begin_bulk_theme_override();
- error_label->add_theme_font_override("font", get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
- error_label->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
- error_label->add_theme_color_override("font_color", error_color);
+ error_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
+ error_label->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("status_source_size"), EditorStringName(EditorFonts)));
+ error_label->add_theme_color_override(SceneStringName(font_color), error_color);
error_label->end_bulk_theme_override();
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 79066608f9..be979f0f15 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -230,15 +230,15 @@ void ProjectManager::_update_theme(bool p_skip_creation) {
// Project list.
{
- loading_label->add_theme_font_override("font", get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)));
+ loading_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)));
project_list_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("project_list"), SNAME("ProjectManager")));
empty_list_create_project->set_icon(get_editor_theme_icon(SNAME("Add")));
empty_list_import_project->set_icon(get_editor_theme_icon(SNAME("Load")));
empty_list_open_assetlib->set_icon(get_editor_theme_icon(SNAME("AssetLib")));
- empty_list_online_warning->add_theme_font_override("font", get_theme_font(SNAME("italic"), EditorStringName(EditorFonts)));
- empty_list_online_warning->add_theme_color_override("font_color", get_theme_color(SNAME("font_placeholder_color"), EditorStringName(Editor)));
+ empty_list_online_warning->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("italic"), EditorStringName(EditorFonts)));
+ empty_list_online_warning->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("font_placeholder_color"), EditorStringName(Editor)));
// Top bar.
search_box->set_right_icon(get_editor_theme_icon(SNAME("Search")));
@@ -256,8 +256,8 @@ void ProjectManager::_update_theme(bool p_skip_creation) {
erase_missing_btn->set_icon(get_editor_theme_icon(SNAME("Clear")));
create_tag_btn->set_icon(get_editor_theme_icon("Add"));
- tag_error->add_theme_color_override("font_color", get_theme_color("error_color", EditorStringName(Editor)));
- tag_edit_error->add_theme_color_override("font_color", get_theme_color("error_color", EditorStringName(Editor)));
+ tag_error->add_theme_color_override(SceneStringName(font_color), get_theme_color("error_color", EditorStringName(Editor)));
+ tag_edit_error->add_theme_color_override(SceneStringName(font_color), get_theme_color("error_color", EditorStringName(Editor)));
create_btn->add_theme_constant_override("h_separation", get_theme_constant(SNAME("sidebar_button_icon_separation"), SNAME("ProjectManager")));
import_btn->add_theme_constant_override("h_separation", get_theme_constant(SNAME("sidebar_button_icon_separation"), SNAME("ProjectManager")));
diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp
index 99aa83a09c..90424aa2b8 100644
--- a/editor/project_manager/project_dialog.cpp
+++ b/editor/project_manager/project_dialog.cpp
@@ -54,15 +54,15 @@ void ProjectDialog::_set_message(const String &p_msg, MessageType p_type, InputT
Ref<Texture2D> new_icon;
switch (p_type) {
case MESSAGE_ERROR: {
- msg->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ msg->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
new_icon = get_editor_theme_icon(SNAME("StatusError"));
} break;
case MESSAGE_WARNING: {
- msg->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ msg->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
new_icon = get_editor_theme_icon(SNAME("StatusWarning"));
} break;
case MESSAGE_SUCCESS: {
- msg->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
+ msg->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
new_icon = get_editor_theme_icon(SNAME("StatusSuccess"));
} break;
}
diff --git a/editor/project_manager/project_list.cpp b/editor/project_manager/project_list.cpp
index 0480be508a..092a6a1a18 100644
--- a/editor/project_manager/project_list.cpp
+++ b/editor/project_manager/project_list.cpp
@@ -57,12 +57,12 @@ void ProjectListItemControl::_notification(int p_what) {
}
project_title->begin_bulk_theme_override();
- project_title->add_theme_font_override("font", get_theme_font(SNAME("title"), EditorStringName(EditorFonts)));
- project_title->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("title_size"), EditorStringName(EditorFonts)));
- project_title->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Tree")));
+ project_title->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("title"), EditorStringName(EditorFonts)));
+ project_title->add_theme_font_size_override(SceneStringName(font_size), get_theme_font_size(SNAME("title_size"), EditorStringName(EditorFonts)));
+ project_title->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), SNAME("Tree")));
project_title->end_bulk_theme_override();
- project_path->add_theme_color_override("font_color", get_theme_color(SNAME("font_color"), SNAME("Tree")));
+ project_path->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), SNAME("Tree")));
project_unsupported_features->set_texture(get_editor_theme_icon(SNAME("NodeWarning")));
favorite_button->set_texture_normal(get_editor_theme_icon(SNAME("Favorites")));
diff --git a/editor/project_manager/quick_settings_dialog.cpp b/editor/project_manager/quick_settings_dialog.cpp
index c9a43f863e..59b329c739 100644
--- a/editor/project_manager/quick_settings_dialog.cpp
+++ b/editor/project_manager/quick_settings_dialog.cpp
@@ -183,8 +183,8 @@ void QuickSettingsDialog::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
settings_list_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("Background"), EditorStringName(EditorStyles)));
- restart_required_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
- custom_theme_label->add_theme_color_override("font_color", get_theme_color(SNAME("font_placeholder_color"), EditorStringName(Editor)));
+ restart_required_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ custom_theme_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("font_placeholder_color"), EditorStringName(Editor)));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 6a6e2b83ab..26b5797d44 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -589,7 +589,7 @@ void ProjectSettingsEditor::_update_theme() {
restart_close_button->set_icon(get_editor_theme_icon(SNAME("Close")));
restart_container->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree")));
restart_icon->set_texture(get_editor_theme_icon(SNAME("StatusWarning")));
- restart_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ restart_label->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
type_box->clear();
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index edefaa61a8..9259ab13ab 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -399,9 +399,9 @@ void RenameDialog::_update_preview(const String &new_text) {
// New name is identical to the old one. Don't color it as much to avoid distracting the user.
const Color accent_color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("accent_color"), EditorStringName(Editor));
const Color text_color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("default_color"), SNAME("RichTextLabel"));
- lbl_preview->add_theme_color_override("font_color", accent_color.lerp(text_color, 0.5));
+ lbl_preview->add_theme_color_override(SceneStringName(font_color), accent_color.lerp(text_color, 0.5));
} else {
- lbl_preview->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("success_color"), EditorStringName(Editor)));
+ lbl_preview->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("success_color"), EditorStringName(Editor)));
}
}
@@ -487,7 +487,7 @@ void RenameDialog::_error_handler(void *p_self, const char *p_func, const char *
self->has_errors = true;
self->lbl_preview_title->set_text(TTR("Regular Expression Error:"));
- self->lbl_preview->add_theme_color_override("font_color", EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
+ self->lbl_preview->add_theme_color_override(SceneStringName(font_color), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor)));
self->lbl_preview->set_text(vformat(TTR("At character %s"), err_str));
}
diff --git a/editor/themes/editor_fonts.cpp b/editor/themes/editor_fonts.cpp
index 3f43d3e25b..71a050bc23 100644
--- a/editor/themes/editor_fonts.cpp
+++ b/editor/themes/editor_fonts.cpp
@@ -36,6 +36,7 @@
#include "editor/themes/builtin_fonts.gen.h"
#include "editor/themes/editor_scale.h"
#include "scene/resources/font.h"
+#include "scene/scene_string_names.h"
Ref<FontFile> load_external_font(const String &p_path, TextServer::Hinting p_hinting, TextServer::FontAntialiasing p_aa, bool p_autohint, TextServer::SubpixelPositioning p_font_subpixel_positioning, bool p_font_disable_embedded_bitmaps, bool p_msdf = false, TypedArray<Font> *r_fallbacks = nullptr) {
Ref<FontFile> font;
@@ -401,24 +402,24 @@ void editor_register_fonts(const Ref<Theme> &p_theme) {
p_theme->set_font_size("title_size", EditorStringName(EditorFonts), default_font_size + 1 * EDSCALE);
p_theme->set_type_variation("MainScreenButton", "Button");
- p_theme->set_font("font", "MainScreenButton", bold_fc);
- p_theme->set_font_size("font_size", "MainScreenButton", default_font_size + 2 * EDSCALE);
+ p_theme->set_font(SceneStringName(font), "MainScreenButton", bold_fc);
+ p_theme->set_font_size(SceneStringName(font_size), "MainScreenButton", default_font_size + 2 * EDSCALE);
// Labels.
- p_theme->set_font("font", "Label", default_fc);
+ p_theme->set_font(SceneStringName(font), "Label", default_fc);
p_theme->set_type_variation("HeaderSmall", "Label");
- p_theme->set_font("font", "HeaderSmall", bold_fc);
- p_theme->set_font_size("font_size", "HeaderSmall", default_font_size);
+ p_theme->set_font(SceneStringName(font), "HeaderSmall", bold_fc);
+ p_theme->set_font_size(SceneStringName(font_size), "HeaderSmall", default_font_size);
p_theme->set_type_variation("HeaderMedium", "Label");
- p_theme->set_font("font", "HeaderMedium", bold_fc);
- p_theme->set_font_size("font_size", "HeaderMedium", default_font_size + 1 * EDSCALE);
+ p_theme->set_font(SceneStringName(font), "HeaderMedium", bold_fc);
+ p_theme->set_font_size(SceneStringName(font_size), "HeaderMedium", default_font_size + 1 * EDSCALE);
p_theme->set_type_variation("HeaderLarge", "Label");
- p_theme->set_font("font", "HeaderLarge", bold_fc);
- p_theme->set_font_size("font_size", "HeaderLarge", default_font_size + 3 * EDSCALE);
+ p_theme->set_font(SceneStringName(font), "HeaderLarge", bold_fc);
+ p_theme->set_font_size(SceneStringName(font_size), "HeaderLarge", default_font_size + 3 * EDSCALE);
p_theme->set_font("normal_font", "RichTextLabel", default_fc);
p_theme->set_font("bold_font", "RichTextLabel", bold_fc);
diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp
index 10b7c64999..6d8a8fdb38 100644
--- a/editor/themes/editor_theme_manager.cpp
+++ b/editor/themes/editor_theme_manager.cpp
@@ -474,7 +474,7 @@ void EditorThemeManager::_create_shared_styles(const Ref<EditorTheme> &p_theme,
p_config.font_placeholder_color = Color(p_config.mono_color.r, p_config.mono_color.g, p_config.mono_color.b, 0.6);
p_config.font_outline_color = Color(0, 0, 0, 0);
- p_theme->set_color("font_color", EditorStringName(Editor), p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), EditorStringName(Editor), p_config.font_color);
p_theme->set_color("font_focus_color", EditorStringName(Editor), p_config.font_focus_color);
p_theme->set_color("font_hover_color", EditorStringName(Editor), p_config.font_hover_color);
p_theme->set_color("font_pressed_color", EditorStringName(Editor), p_config.font_pressed_color);
@@ -694,7 +694,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// TooltipPanel is also used for custom tooltips, while TooltipLabel
// is only relevant for default tooltips.
- p_theme->set_color("font_color", "TooltipLabel", p_config.font_hover_color);
+ p_theme->set_color(SceneStringName(font_color), "TooltipLabel", p_config.font_hover_color);
p_theme->set_color("font_shadow_color", "TooltipLabel", Color(0, 0, 0, 0));
Ref<StyleBoxFlat> style_tooltip = p_config.popup_style->duplicate();
@@ -719,7 +719,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("focus", "Button", p_config.button_style_focus);
p_theme->set_stylebox("disabled", "Button", p_config.button_style_disabled);
- p_theme->set_color("font_color", "Button", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "Button", p_config.font_color);
p_theme->set_color("font_hover_color", "Button", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "Button", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "Button", p_config.font_focus_color);
@@ -747,7 +747,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("focus", "MenuButton", p_config.panel_container_style);
p_theme->set_stylebox("disabled", "MenuButton", p_config.panel_container_style);
- p_theme->set_color("font_color", "MenuButton", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "MenuButton", p_config.font_color);
p_theme->set_color("font_hover_color", "MenuButton", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "MenuButton", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "MenuButton", p_config.font_focus_color);
@@ -762,7 +762,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox(SceneStringName(pressed), "MenuBar", p_config.button_style_pressed);
p_theme->set_stylebox("disabled", "MenuBar", p_config.button_style_disabled);
- p_theme->set_color("font_color", "MenuBar", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "MenuBar", p_config.font_color);
p_theme->set_color("font_hover_color", "MenuBar", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "MenuBar", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "MenuBar", p_config.font_focus_color);
@@ -804,7 +804,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("pressed_mirrored", "OptionButton", option_button_pressed_style);
p_theme->set_stylebox("disabled_mirrored", "OptionButton", option_button_disabled_style);
- p_theme->set_color("font_color", "OptionButton", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "OptionButton", p_config.font_color);
p_theme->set_color("font_hover_color", "OptionButton", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "OptionButton", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "OptionButton", p_config.font_focus_color);
@@ -843,7 +843,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_icon("unchecked_mirrored", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOffMirrored"), EditorStringName(EditorIcons)));
p_theme->set_icon("unchecked_disabled_mirrored", "CheckButton", p_theme->get_icon(SNAME("GuiToggleOffDisabledMirrored"), EditorStringName(EditorIcons)));
- p_theme->set_color("font_color", "CheckButton", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "CheckButton", p_config.font_color);
p_theme->set_color("font_hover_color", "CheckButton", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "CheckButton", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "CheckButton", p_config.font_focus_color);
@@ -880,7 +880,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_icon("radio_checked_disabled", "CheckBox", p_theme->get_icon(SNAME("GuiRadioCheckedDisabled"), EditorStringName(EditorIcons)));
p_theme->set_icon("radio_unchecked_disabled", "CheckBox", p_theme->get_icon(SNAME("GuiRadioUncheckedDisabled"), EditorStringName(EditorIcons)));
- p_theme->set_color("font_color", "CheckBox", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "CheckBox", p_config.font_color);
p_theme->set_color("font_hover_color", "CheckBox", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "CheckBox", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "CheckBox", p_config.font_focus_color);
@@ -902,7 +902,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// LinkButton.
p_theme->set_stylebox("focus", "LinkButton", p_config.base_empty_style);
- p_theme->set_color("font_color", "LinkButton", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "LinkButton", p_config.font_color);
p_theme->set_color("font_hover_color", "LinkButton", p_config.font_hover_color);
p_theme->set_color("font_hover_pressed_color", "LinkButton", p_config.font_hover_pressed_color);
p_theme->set_color("font_focus_color", "LinkButton", p_config.font_focus_color);
@@ -944,7 +944,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("custom_button_hover", "Tree", p_config.button_style);
p_theme->set_color("custom_button_font_highlight", "Tree", p_config.font_hover_color);
- p_theme->set_color("font_color", "Tree", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "Tree", p_config.font_color);
p_theme->set_color("font_selected_color", "Tree", p_config.mono_color);
p_theme->set_color("font_disabled_color", "Tree", p_config.font_disabled_color);
p_theme->set_color("font_outline_color", "Tree", p_config.font_outline_color);
@@ -1047,7 +1047,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("selected_focus", "ItemList", style_tree_focus);
p_theme->set_stylebox("selected", "ItemList", style_tree_selected);
p_theme->set_stylebox("hovered", "ItemList", style_itemlist_hover);
- p_theme->set_color("font_color", "ItemList", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "ItemList", p_config.font_color);
p_theme->set_color("font_hovered_color", "ItemList", p_config.mono_color);
p_theme->set_color("font_selected_color", "ItemList", p_config.mono_color);
p_theme->set_color("font_outline_color", "ItemList", p_config.font_outline_color);
@@ -1194,7 +1194,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_icon("clear", "LineEdit", p_theme->get_icon(SNAME("GuiClose"), EditorStringName(EditorIcons)));
- p_theme->set_color("font_color", "LineEdit", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "LineEdit", p_config.font_color);
p_theme->set_color("font_selected_color", "LineEdit", p_config.mono_color);
p_theme->set_color("font_uneditable_color", "LineEdit", p_config.font_readonly_color);
p_theme->set_color("font_placeholder_color", "LineEdit", p_config.font_placeholder_color);
@@ -1217,7 +1217,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_icon("tab", "TextEdit", p_theme->get_icon(SNAME("GuiTab"), EditorStringName(EditorIcons)));
p_theme->set_icon("space", "TextEdit", p_theme->get_icon(SNAME("GuiSpace"), EditorStringName(EditorIcons)));
- p_theme->set_color("font_color", "TextEdit", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "TextEdit", p_config.font_color);
p_theme->set_color("font_readonly_color", "TextEdit", p_config.font_readonly_color);
p_theme->set_color("font_placeholder_color", "TextEdit", p_config.font_placeholder_color);
p_theme->set_color("font_outline_color", "TextEdit", p_config.font_outline_color);
@@ -1348,7 +1348,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox("labeled_separator_left", "PopupMenu", style_popup_labeled_separator_left);
p_theme->set_stylebox("labeled_separator_right", "PopupMenu", style_popup_labeled_separator_right);
- p_theme->set_color("font_color", "PopupMenu", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "PopupMenu", p_config.font_color);
p_theme->set_color("font_hover_color", "PopupMenu", p_config.font_hover_color);
p_theme->set_color("font_accelerator_color", "PopupMenu", p_config.font_disabled_color);
p_theme->set_color("font_disabled_color", "PopupMenu", p_config.font_disabled_color);
@@ -1458,7 +1458,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
p_theme->set_stylebox(CoreStringName(normal), "Label", p_config.base_empty_style);
- p_theme->set_color("font_color", "Label", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "Label", p_config.font_color);
p_theme->set_color("font_shadow_color", "Label", Color(0, 0, 0, 0));
p_theme->set_color("font_outline_color", "Label", p_config.font_outline_color);
@@ -1476,7 +1476,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// ProgressBar.
p_theme->set_stylebox("background", "ProgressBar", make_stylebox(p_theme->get_icon(SNAME("GuiProgressBar"), EditorStringName(EditorIcons)), 4, 4, 4, 4, 0, 0, 0, 0));
p_theme->set_stylebox("fill", "ProgressBar", make_stylebox(p_theme->get_icon(SNAME("GuiProgressFill"), EditorStringName(EditorIcons)), 6, 6, 6, 6, 2, 1, 2, 1));
- p_theme->set_color("font_color", "ProgressBar", p_config.font_color);
+ p_theme->set_color(SceneStringName(font_color), "ProgressBar", p_config.font_color);
p_theme->set_color("font_outline_color", "ProgressBar", p_config.font_outline_color);
p_theme->set_constant("outline_size", "ProgressBar", 0);
@@ -1632,7 +1632,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// GraphNode's title Label.
p_theme->set_type_variation("GraphNodeTitleLabel", "Label");
p_theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0));
- p_theme->set_color("font_color", "GraphNodeTitleLabel", p_config.dark_theme ? p_config.font_color : Color(1, 1, 1)); // Also use a bright font color for light themes.
+ p_theme->set_color(SceneStringName(font_color), "GraphNodeTitleLabel", p_config.dark_theme ? p_config.font_color : Color(1, 1, 1)); // Also use a bright font color for light themes.
p_theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0.35));
p_theme->set_constant("shadow_outline_size", "GraphNodeTitleLabel", 4);
p_theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", 0);
@@ -1664,8 +1664,8 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
// GraphFrame's title Label.
p_theme->set_type_variation("GraphFrameTitleLabel", "Label");
p_theme->set_stylebox(CoreStringName(normal), "GraphFrameTitleLabel", memnew(StyleBoxEmpty));
- p_theme->set_font_size("font_size", "GraphFrameTitleLabel", 22);
- p_theme->set_color("font_color", "GraphFrameTitleLabel", Color(1, 1, 1));
+ p_theme->set_font_size(SceneStringName(font_size), "GraphFrameTitleLabel", 22);
+ p_theme->set_color(SceneStringName(font_color), "GraphFrameTitleLabel", Color(1, 1, 1));
p_theme->set_color("font_shadow_color", "GraphFrameTitleLabel", Color(0, 0, 0, 0));
p_theme->set_color("font_outline_color", "GraphFrameTitleLabel", Color(1, 1, 1));
p_theme->set_constant("shadow_offset_x", "GraphFrameTitleLabel", 1 * EDSCALE);
@@ -1891,8 +1891,8 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// Header LinkButton variation.
p_theme->set_type_variation("HeaderSmallLink", "LinkButton");
- p_theme->set_font("font", "HeaderSmallLink", p_theme->get_font(SNAME("font"), SNAME("HeaderSmall")));
- p_theme->set_font_size("font_size", "HeaderSmallLink", p_theme->get_font_size(SNAME("font_size"), SNAME("HeaderSmall")));
+ p_theme->set_font(SceneStringName(font), "HeaderSmallLink", p_theme->get_font(SceneStringName(font), SNAME("HeaderSmall")));
+ p_theme->set_font_size(SceneStringName(font_size), "HeaderSmallLink", p_theme->get_font_size(SceneStringName(font_size), SNAME("HeaderSmall")));
// Flat button variations.
{
@@ -1971,8 +1971,8 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// Top bar selectors.
{
p_theme->set_type_variation("TopBarOptionButton", "OptionButton");
- p_theme->set_font("font", "TopBarOptionButton", p_theme->get_font(SNAME("bold"), EditorStringName(EditorFonts)));
- p_theme->set_font_size("font_size", "TopBarOptionButton", p_theme->get_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)));
+ p_theme->set_font(SceneStringName(font), "TopBarOptionButton", p_theme->get_font(SNAME("bold"), EditorStringName(EditorFonts)));
+ p_theme->set_font_size(SceneStringName(font_size), "TopBarOptionButton", p_theme->get_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)));
}
// Complex editor windows.
@@ -2102,7 +2102,7 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// EditorInspectorSection.
Color inspector_section_color = p_config.font_color.lerp(Color(0.5, 0.5, 0.5), 0.35);
- p_theme->set_color("font_color", "EditorInspectorSection", inspector_section_color);
+ p_theme->set_color(SceneStringName(font_color), "EditorInspectorSection", inspector_section_color);
Color inspector_indent_color = p_config.accent_color;
inspector_indent_color.a = 0.2;
@@ -2358,8 +2358,8 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
sm_node_end_style->set_border_color(p_config.error_color);
p_theme->set_stylebox("node_frame_end", "GraphStateMachine", sm_node_end_style);
- p_theme->set_font("node_title_font", "GraphStateMachine", p_theme->get_font(SNAME("font"), SNAME("Label")));
- p_theme->set_font_size("node_title_font_size", "GraphStateMachine", p_theme->get_font_size(SNAME("font_size"), SNAME("Label")));
+ p_theme->set_font("node_title_font", "GraphStateMachine", p_theme->get_font(SceneStringName(font), SNAME("Label")));
+ p_theme->set_font_size("node_title_font_size", "GraphStateMachine", p_theme->get_font_size(SceneStringName(font_size), SNAME("Label")));
p_theme->set_color("node_title_font_color", "GraphStateMachine", p_config.font_color);
p_theme->set_color("transition_color", "GraphStateMachine", p_config.font_color);
@@ -2482,8 +2482,8 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref<EditorTheme> &p_
}
// Now theme is loaded, apply it to CodeEdit.
- p_theme->set_font("font", "CodeEdit", p_theme->get_font(SNAME("source"), EditorStringName(EditorFonts)));
- p_theme->set_font_size("font_size", "CodeEdit", p_theme->get_font_size(SNAME("source_size"), EditorStringName(EditorFonts)));
+ p_theme->set_font(SceneStringName(font), "CodeEdit", p_theme->get_font(SNAME("source"), EditorStringName(EditorFonts)));
+ p_theme->set_font_size(SceneStringName(font_size), "CodeEdit", p_theme->get_font_size(SNAME("source_size"), EditorStringName(EditorFonts)));
/* clang-format off */
p_theme->set_icon("tab", "CodeEdit", p_theme->get_icon(SNAME("GuiTab"), EditorStringName(EditorIcons)));
@@ -2512,7 +2512,7 @@ void EditorThemeManager::_populate_text_editor_styles(const Ref<EditorTheme> &p_
p_theme->set_color("completion_existing_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_existing_color"));
p_theme->set_color("completion_scroll_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_scroll_color"));
p_theme->set_color("completion_scroll_hovered_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/completion_scroll_hovered_color"));
- p_theme->set_color("font_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/text_color"));
+ p_theme->set_color(SceneStringName(font_color), "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/text_color"));
p_theme->set_color("line_number_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/line_number_color"));
p_theme->set_color("caret_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/caret_color"));
p_theme->set_color("font_selected_color", "CodeEdit", EDITOR_GET("text_editor/theme/highlighting/text_selected_color"));
diff --git a/editor/window_wrapper.cpp b/editor/window_wrapper.cpp
index b75d641509..9496ba016c 100644
--- a/editor/window_wrapper.cpp
+++ b/editor/window_wrapper.cpp
@@ -348,7 +348,7 @@ void ScreenSelect::_build_advanced_menu() {
}
// Populate screen list.
- const real_t height = real_t(get_theme_font_size("font_size")) * 1.5;
+ const real_t height = real_t(get_theme_font_size(SceneStringName(font_size))) * 1.5;
int current_screen = get_window()->get_current_screen();
for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
@@ -365,7 +365,7 @@ void ScreenSelect::_build_advanced_menu() {
if (i == current_screen) {
Color accent_color = get_theme_color("accent_color", EditorStringName(Editor));
- button->add_theme_color_override("font_color", accent_color);
+ button->add_theme_color_override(SceneStringName(font_color), accent_color);
}
button->connect(SceneStringName(pressed), callable_mp(this, &ScreenSelect::_emit_screen_signal).bind(i));
@@ -393,7 +393,7 @@ void ScreenSelect::_notification(int p_what) {
set_icon(get_editor_theme_icon("MakeFloating"));
popup_background->add_theme_style_override(SceneStringName(panel), get_theme_stylebox("PanelForeground", EditorStringName(EditorStyles)));
- const real_t popup_height = real_t(get_theme_font_size("font_size")) * 2.0;
+ const real_t popup_height = real_t(get_theme_font_size(SceneStringName(font_size))) * 2.0;
popup->set_min_size(Size2(0, popup_height * 3));
} break;
}
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 8d2847ab1a..296cda627a 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -141,7 +141,12 @@ bool CSGShape3D::is_root_shape() const {
}
void CSGShape3D::set_snap(float p_snap) {
+ if (snap == p_snap) {
+ return;
+ }
+
snap = p_snap;
+ _make_dirty();
}
float CSGShape3D::get_snap() const {
diff --git a/modules/csg/doc_classes/CSGShape3D.xml b/modules/csg/doc_classes/CSGShape3D.xml
index 0414aa362d..f9017e47c7 100644
--- a/modules/csg/doc_classes/CSGShape3D.xml
+++ b/modules/csg/doc_classes/CSGShape3D.xml
@@ -73,7 +73,7 @@
The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent.
</member>
<member name="snap" type="float" setter="set_snap" getter="get_snap" default="0.001">
- Snap makes the mesh vertices snap to a given distance so that the faces of two meshes can be perfectly aligned. A lower value results in greater precision but may be harder to adjust.
+ Snap makes the mesh vertices snap to a given distance so that the faces of two meshes can be perfectly aligned. A lower value results in greater precision but may be harder to adjust. The top-level CSG shape's snap value is used for the entire CSG tree.
</member>
<member name="use_collision" type="bool" setter="set_use_collision" getter="is_using_collision" default="false">
Adds a collision shape to the physics engine for our CSG shape. This will always act like a static body. Note that the collision shape is still active even if the CSG shape itself is hidden. See also [member collision_mask] and [member collision_priority].
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index f83b784f85..eecce70202 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -690,7 +690,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
color_regions.clear();
color_region_cache.clear();
- font_color = text_edit->get_theme_color(SNAME("font_color"));
+ font_color = text_edit->get_theme_color(SceneStringName(font_color));
symbol_color = EDITOR_GET("text_editor/theme/highlighting/symbol_color");
function_color = EDITOR_GET("text_editor/theme/highlighting/function_color");
number_color = EDITOR_GET("text_editor/theme/highlighting/number_color");
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 0c58b41fcb..20d424894a 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -771,8 +771,16 @@ Error GDScript::reload(bool p_keep_state) {
if (GDScriptCache::has_parser(source_path)) {
Error err = OK;
Ref<GDScriptParserRef> parser_ref = GDScriptCache::get_parser(source_path, GDScriptParserRef::EMPTY, err);
- if (parser_ref.is_valid() && parser_ref->get_source_hash() != source.hash()) {
- GDScriptCache::remove_parser(source_path);
+ if (parser_ref.is_valid()) {
+ uint32_t source_hash;
+ if (!binary_tokens.is_empty()) {
+ source_hash = hash_djb2_buffer(binary_tokens.ptr(), binary_tokens.size());
+ } else {
+ source_hash = source.hash();
+ }
+ if (parser_ref->get_source_hash() != source_hash) {
+ GDScriptCache::remove_parser(source_path);
+ }
}
}
}
@@ -987,7 +995,7 @@ bool GDScript::_get(const StringName &p_name, Variant &r_ret) const {
bool GDScript::_set(const StringName &p_name, const Variant &p_value) {
if (p_name == GDScriptLanguage::get_singleton()->strings._script_source) {
set_source_code(p_value);
- reload();
+ reload(true);
return true;
}
diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp
index 822e11ea4b..4ad00c719b 100644
--- a/modules/gltf/editor/editor_scene_importer_blend.cpp
+++ b/modules/gltf/editor/editor_scene_importer_blend.cpp
@@ -395,10 +395,10 @@ void EditorFileSystemImportFormatSupportQueryBlend::_validate_path(String p_path
path_status->set_text(error);
if (success) {
- path_status->add_theme_color_override("font_color", path_status->get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
+ path_status->add_theme_color_override(SceneStringName(font_color), path_status->get_theme_color(SNAME("success_color"), EditorStringName(Editor)));
configure_blender_dialog->get_ok_button()->set_disabled(false);
} else {
- path_status->add_theme_color_override("font_color", path_status->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ path_status->add_theme_color_override(SceneStringName(font_color), path_status->get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
configure_blender_dialog->get_ok_button()->set_disabled(true);
}
}
diff --git a/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp b/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp
index cd3814879a..28b875a4ad 100644
--- a/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp
+++ b/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp
@@ -161,7 +161,7 @@ void AudioStreamInteractiveTransitionEditor::_update_transitions() {
return;
}
int clip_count = audio_stream_interactive->get_clip_count();
- Color font_color = tree->get_theme_color("font_color", "Tree");
+ Color font_color = tree->get_theme_color(SceneStringName(font_color), "Tree");
Color font_color_default = font_color;
font_color_default.a *= 0.5;
Ref<Texture> fade_icons[5] = {
diff --git a/modules/mbedtls/tls_context_mbedtls.cpp b/modules/mbedtls/tls_context_mbedtls.cpp
index aab082f488..eaea7b9293 100644
--- a/modules/mbedtls/tls_context_mbedtls.cpp
+++ b/modules/mbedtls/tls_context_mbedtls.cpp
@@ -152,21 +152,23 @@ Error TLSContextMbedTLS::init_client(int p_transport, const String &p_hostname,
ERR_FAIL_COND_V(p_options.is_null() || p_options->is_server(), ERR_INVALID_PARAMETER);
int authmode = MBEDTLS_SSL_VERIFY_REQUIRED;
- if (p_options->get_verify_mode() == TLSOptions::TLS_VERIFY_NONE) {
+ bool unsafe = p_options->is_unsafe_client();
+ if (unsafe && p_options->get_trusted_ca_chain().is_valid()) {
authmode = MBEDTLS_SSL_VERIFY_NONE;
}
Error err = _setup(MBEDTLS_SSL_IS_CLIENT, p_transport, authmode);
ERR_FAIL_COND_V(err != OK, err);
- if (p_options->get_verify_mode() == TLSOptions::TLS_VERIFY_FULL) {
- String cn = p_options->get_common_name();
+ if (unsafe) {
+ // No hostname verification for unsafe clients.
+ mbedtls_ssl_set_hostname(&tls, nullptr);
+ } else {
+ String cn = p_options->get_common_name_override();
if (cn.is_empty()) {
cn = p_hostname;
}
mbedtls_ssl_set_hostname(&tls, cn.utf8().get_data());
- } else {
- mbedtls_ssl_set_hostname(&tls, nullptr);
}
X509CertificateMbedTLS *cas = nullptr;
diff --git a/modules/multiplayer/editor/editor_network_profiler.cpp b/modules/multiplayer/editor/editor_network_profiler.cpp
index 75941207c7..d5d4b465d8 100644
--- a/modules/multiplayer/editor/editor_network_profiler.cpp
+++ b/modules/multiplayer/editor/editor_network_profiler.cpp
@@ -74,8 +74,8 @@ void EditorNetworkProfiler::_update_theme_item_cache() {
theme_cache.incoming_bandwidth_icon = get_theme_icon(SNAME("ArrowDown"), EditorStringName(EditorIcons));
theme_cache.outgoing_bandwidth_icon = get_theme_icon(SNAME("ArrowUp"), EditorStringName(EditorIcons));
- theme_cache.incoming_bandwidth_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
- theme_cache.outgoing_bandwidth_color = get_theme_color(SNAME("font_color"), EditorStringName(Editor));
+ theme_cache.incoming_bandwidth_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
+ theme_cache.outgoing_bandwidth_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor));
}
void EditorNetworkProfiler::_refresh() {
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index 1779be2cc2..f0184a155b 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -627,24 +627,20 @@ Vector3 NavMap::get_closest_point_to_segment(const Vector3 &p_from, const Vector
closest_point_d = d;
}
}
- }
-
- if (use_collision == false) {
- for (size_t point_id = 0; point_id < p.points.size(); point_id += 1) {
- Vector3 a, b;
-
- Geometry3D::get_closest_points_between_segments(
- p_from,
- p_to,
- p.points[point_id].pos,
- p.points[(point_id + 1) % p.points.size()].pos,
- a,
- b);
+ // If segment does not itersect face, check the distance from segment's endpoints.
+ else if (!use_collision) {
+ const Vector3 p_from_closest = f.get_closest_point_to(p_from);
+ const real_t d_p_from = p_from.distance_to(p_from_closest);
+ if (closest_point_d > d_p_from) {
+ closest_point = p_from_closest;
+ closest_point_d = d_p_from;
+ }
- const real_t d = a.distance_to(b);
- if (d < closest_point_d) {
- closest_point_d = d;
- closest_point = b;
+ const Vector3 p_to_closest = f.get_closest_point_to(p_to);
+ const real_t d_p_to = p_to.distance_to(p_to_closest);
+ if (closest_point_d > d_p_to) {
+ closest_point = p_to_closest;
+ closest_point_d = d_p_to;
}
}
}
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 361d88af90..33ba2da761 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -6052,6 +6052,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
unsigned int last_cluster_index = 0;
bool last_cluster_valid = true;
+ double adv_rem = 0.0;
for (unsigned int i = 0; i < glyph_count; i++) {
if ((i > 0) && (last_cluster_id != glyph_info[i].cluster)) {
if (p_direction == HB_DIRECTION_RTL || p_direction == HB_DIRECTION_BTT) {
@@ -6097,21 +6098,31 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
gl.index = glyph_info[i].codepoint;
if (gl.index != 0) {
_ensure_glyph(fd, fss, gl.index | mod);
+ if (subpos) {
+ gl.x_off = (double)glyph_pos[i].x_offset / (64.0 / scale);
+ } else if (p_sd->orientation == ORIENTATION_HORIZONTAL) {
+ gl.x_off = Math::round(adv_rem + ((double)glyph_pos[i].x_offset / (64.0 / scale)));
+ } else {
+ gl.x_off = Math::round((double)glyph_pos[i].x_offset / (64.0 / scale));
+ }
+ if (p_sd->orientation == ORIENTATION_HORIZONTAL) {
+ gl.y_off = -Math::round((double)glyph_pos[i].y_offset / (64.0 / scale));
+ } else {
+ gl.y_off = -Math::round(adv_rem + ((double)glyph_pos[i].y_offset / (64.0 / scale)));
+ }
if (p_sd->orientation == ORIENTATION_HORIZONTAL) {
if (subpos) {
gl.advance = (double)glyph_pos[i].x_advance / (64.0 / scale) + ea;
} else {
- gl.advance = Math::round((double)glyph_pos[i].x_advance / (64.0 / scale) + ea);
+ double full_adv = adv_rem + ((double)glyph_pos[i].x_advance / (64.0 / scale) + ea);
+ gl.advance = Math::round(full_adv);
+ adv_rem = full_adv - gl.advance;
}
} else {
- gl.advance = -Math::round((double)glyph_pos[i].y_advance / (64.0 / scale));
- }
- if (subpos) {
- gl.x_off = (double)glyph_pos[i].x_offset / (64.0 / scale);
- } else {
- gl.x_off = Math::round((double)glyph_pos[i].x_offset / (64.0 / scale));
+ double full_adv = adv_rem + ((double)glyph_pos[i].y_advance / (64.0 / scale));
+ gl.advance = -Math::round(full_adv);
+ adv_rem = full_adv + gl.advance;
}
- gl.y_off = -Math::round((double)glyph_pos[i].y_offset / (64.0 / scale));
if (p_sd->orientation == ORIENTATION_HORIZONTAL) {
gl.y_off += _font_get_baseline_offset(gl.font_rid) * (double)(_font_get_ascent(gl.font_rid, gl.font_size) + _font_get_descent(gl.font_rid, gl.font_size));
} else {
diff --git a/platform/linuxbsd/x11/gl_manager_x11.cpp b/platform/linuxbsd/x11/gl_manager_x11.cpp
index febb7ae584..738ebffa02 100644
--- a/platform/linuxbsd/x11/gl_manager_x11.cpp
+++ b/platform/linuxbsd/x11/gl_manager_x11.cpp
@@ -357,7 +357,7 @@ void GLManager_X11::set_use_vsync(bool p_use) {
GLXDrawable drawable = glXGetCurrentDrawable();
glXSwapIntervalEXT(disp.x11_display, drawable, val);
} else {
- WARN_PRINT("Could not set V-Sync mode. V-Sync is not supported.");
+ WARN_PRINT_ONCE("Could not set V-Sync mode, as changing V-Sync mode is not supported by the graphics driver.");
return;
}
use_vsync = p_use;
diff --git a/platform/windows/gl_manager_windows_native.cpp b/platform/windows/gl_manager_windows_native.cpp
index b45d254fc6..c8d7534e26 100644
--- a/platform/windows/gl_manager_windows_native.cpp
+++ b/platform/windows/gl_manager_windows_native.cpp
@@ -510,10 +510,10 @@ void GLManagerNative_Windows::set_use_vsync(DisplayServer::WindowID p_window_id,
win.use_vsync = p_use;
if (!wglSwapIntervalEXT(p_use ? 1 : 0)) {
- WARN_PRINT("Could not set V-Sync mode.");
+ WARN_PRINT_ONCE("Could not set V-Sync mode, as changing V-Sync mode is not supported by the graphics driver.");
}
} else {
- WARN_PRINT("Could not set V-Sync mode. V-Sync is not supported.");
+ WARN_PRINT_ONCE("Could not set V-Sync mode, as changing V-Sync mode is not supported by the graphics driver.");
}
}
diff --git a/scene/2d/parallax_layer.cpp b/scene/2d/parallax_layer.cpp
index e2a7e9e154..dfe321a435 100644
--- a/scene/2d/parallax_layer.cpp
+++ b/scene/2d/parallax_layer.cpp
@@ -71,8 +71,8 @@ void ParallaxLayer::_update_mirroring() {
if (pb) {
RID c = pb->get_canvas();
RID ci = get_canvas_item();
- Point2 mirrorScale = mirroring * get_scale();
- RenderingServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirrorScale);
+ Point2 mirror_scale = mirroring * orig_scale;
+ RenderingServer::get_singleton()->canvas_set_item_mirroring(c, ci, mirror_scale);
RenderingServer::get_singleton()->canvas_item_set_interpolated(ci, false);
}
}
diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp
index 0f2ce829eb..54adafbefb 100644
--- a/scene/3d/label_3d.cpp
+++ b/scene/3d/label_3d.cpp
@@ -796,7 +796,7 @@ Ref<Font> Label3D::_get_font_or_default() const {
return font_override;
}
- const StringName theme_name = "font";
+ const StringName theme_name = SceneStringName(font);
List<StringName> theme_types;
ThemeDB::get_singleton()->get_native_type_dependencies(get_class_name(), &theme_types);
diff --git a/scene/3d/physical_bone_simulator_3d.cpp b/scene/3d/physical_bone_simulator_3d.cpp
index ef3c51b032..ffe79e0892 100644
--- a/scene/3d/physical_bone_simulator_3d.cpp
+++ b/scene/3d/physical_bone_simulator_3d.cpp
@@ -367,6 +367,20 @@ void PhysicalBoneSimulator3D::_process_modification() {
}
} else {
ERR_FAIL_COND(skeleton->get_bone_count() != bones.size());
+ for (int i = 0; i < skeleton->get_bone_count(); i++) {
+ if (!bones[i].physical_bone) {
+ continue;
+ }
+ skeleton->set_bone_global_pose(i, bones[i].global_pose);
+ }
+
+ // TODO:
+ // The above method is performance heavy and needs to be improved.
+ // Ideally, the processing of set_bone_global_pose within Skeleton3D should be improved,
+ // but the workaround available now is to convert the global pose to a local pose on the SkeletonModifier side.
+ // However, the follow method needs recursive processing for deformations within PhysicalBoneSimulator3D to account for update order.
+ /*
+ ERR_FAIL_COND(skeleton->get_bone_count() != bones.size());
LocalVector<Transform3D> local_poses;
for (int i = 0; i < skeleton->get_bone_count(); i++) {
Transform3D pt;
@@ -376,10 +390,14 @@ void PhysicalBoneSimulator3D::_process_modification() {
local_poses.push_back(pt.affine_inverse() * bones[i].global_pose);
}
for (int i = 0; i < skeleton->get_bone_count(); i++) {
+ if (!bones[i].physical_bone) {
+ continue;
+ }
skeleton->set_bone_pose_position(i, local_poses[i].origin);
skeleton->set_bone_pose_rotation(i, local_poses[i].basis.get_rotation_quaternion());
skeleton->set_bone_pose_scale(i, local_poses[i].basis.get_scale());
}
+ */
}
}
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
index 36343edd11..ff19eb8c12 100644
--- a/scene/animation/animation_blend_space_1d.cpp
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -278,7 +278,7 @@ void AnimationNodeBlendSpace1D::_add_blend_point(int p_index, const Ref<Animatio
}
AnimationNode::NodeTimeInfo AnimationNodeBlendSpace1D::_process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) {
- if (blend_points_used == 0) {
+ if (!blend_points_used) {
return NodeTimeInfo();
}
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index 9c5787b97c..0a6546f7da 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -448,6 +448,10 @@ void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vect
AnimationNode::NodeTimeInfo AnimationNodeBlendSpace2D::_process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) {
_update_triangles();
+ if (!blend_points_used) {
+ return NodeTimeInfo();
+ }
+
Vector2 blend_pos = get_parameter(blend_position);
int cur_closest = get_parameter(closest);
NodeTimeInfo mind; //time of min distance point
@@ -455,7 +459,7 @@ AnimationNode::NodeTimeInfo AnimationNodeBlendSpace2D::_process(const AnimationM
AnimationMixer::PlaybackInfo pi = p_playback_info;
if (blend_mode == BLEND_MODE_INTERPOLATED) {
- if (triangles.size() == 0) {
+ if (triangles.is_empty()) {
return NodeTimeInfo();
}
diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp
index 5074145168..afd292e552 100644
--- a/scene/animation/animation_mixer.cpp
+++ b/scene/animation/animation_mixer.cpp
@@ -1426,13 +1426,32 @@ void AnimationMixer::_blend_process(double p_delta, bool p_update_only) {
bool is_value = ttype == Animation::TYPE_VALUE;
bool is_discrete = is_value && a->value_track_get_update_mode(i) == Animation::UPDATE_DISCRETE;
bool force_continuous = callback_mode_discrete == ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS;
- if (t->is_variant_interpolatable && (!is_discrete || force_continuous)) {
+ if (!is_discrete || force_continuous) {
t->use_continuous = true;
- Variant value = is_value ? a->value_track_interpolate(i, time, is_discrete && force_continuous ? backward : false) : Variant(a->bezier_track_interpolate(i, time));
- value = post_process_key_value(a, i, value, t->object_id);
- if (value == Variant()) {
+
+ Variant value;
+ if (t->is_variant_interpolatable) {
+ value = is_value ? a->value_track_interpolate(i, time, is_discrete && force_continuous ? backward : false) : Variant(a->bezier_track_interpolate(i, time));
+ value = post_process_key_value(a, i, value, t->object_id);
+ if (value == Variant()) {
+ continue;
+ }
+ } else {
+ // Discrete track sets the value in the current _blend_process() function,
+ // but Force Continuous track does not set the value here because the value must be set in the _blend_apply() function later.
+ int idx = a->track_find_key(i, time, Animation::FIND_MODE_NEAREST, false, backward);
+ if (idx < 0) {
+ continue;
+ }
+ value = a->track_get_key_value(i, idx);
+ value = post_process_key_value(a, i, value, t->object_id);
+ if (value == Variant()) {
+ continue;
+ }
+ t->value = value;
continue;
}
+
// Special case for angle interpolation.
if (t->is_using_angle) {
// For blending consistency, it prevents rotation of more than 180 degrees from init_value.
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index d69fa78d9d..04153ba758 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -408,7 +408,7 @@ float RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font
_set_table_size(table, available_width);
int row_idx = (table->align_to_row < 0) ? table->rows_baseline.size() - 1 : table->align_to_row;
- if (table->rows_baseline.size() != 0 && row_idx < (int)table->rows_baseline.size() - 1) {
+ if (table->rows_baseline.size() != 0 && row_idx < (int)table->rows_baseline.size()) {
l.text_buf->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, Math::round(table->rows_baseline[row_idx]));
} else {
l.text_buf->resize_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align);
@@ -632,7 +632,7 @@ float RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
_set_table_size(table, available_width);
int row_idx = (table->align_to_row < 0) ? table->rows_baseline.size() - 1 : table->align_to_row;
- if (table->rows_baseline.size() != 0 && row_idx < (int)table->rows_baseline.size() - 1) {
+ if (table->rows_baseline.size() != 0 && row_idx < (int)table->rows_baseline.size()) {
l.text_buf->add_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, t_char_count, Math::round(table->rows_baseline[row_idx]));
} else {
l.text_buf->add_object(it->rid, Size2(table->total_width, table->total_height), table->inline_align, t_char_count);
@@ -724,7 +724,7 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
p_table->rows.clear();
p_table->rows_baseline.clear();
- Vector2 offset;
+ Vector2 offset = Vector2(theme_cache.table_h_separation * 0.5, theme_cache.table_v_separation * 0.5).floor();
float row_height = 0.0;
for (const List<Item *>::Element *E = p_table->subitems.front(); E; E = E->next()) {
@@ -767,12 +767,12 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
row_height = MAX(yofs, row_height);
// Add row height after last column of the row or last cell of the table.
if (column == col_count - 1 || E->next() == nullptr) {
- offset.x = 0;
+ offset.x = Math::floor(theme_cache.table_h_separation * 0.5);
row_height += theme_cache.table_v_separation;
p_table->total_height += row_height;
offset.y += row_height;
p_table->rows.push_back(row_height);
- p_table->rows_baseline.push_back(p_table->total_height - row_height + row_baseline);
+ p_table->rows_baseline.push_back(p_table->total_height - row_height + row_baseline + Math::floor(theme_cache.table_v_separation * 0.5));
row_height = 0;
}
idx++;
@@ -942,7 +942,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
Color odd_row_bg = theme_cache.table_odd_row_bg;
Color even_row_bg = theme_cache.table_even_row_bg;
Color border = theme_cache.table_border;
- int h_separation = theme_cache.table_h_separation;
+ float h_separation = theme_cache.table_h_separation;
+ float v_separation = theme_cache.table_v_separation;
int col_count = table->columns.size();
int row_count = table->rows.size();
@@ -962,17 +963,17 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
if (row % 2 == 0) {
Color c = frame->odd_row_bg != Color(0, 0, 0, 0) ? frame->odd_row_bg : odd_row_bg;
if (c.a > 0.0) {
- draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), c, true);
+ draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position - Vector2(h_separation * 0.5, v_separation * 0.5).floor(), Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), c, true);
}
} else {
Color c = frame->even_row_bg != Color(0, 0, 0, 0) ? frame->even_row_bg : even_row_bg;
if (c.a > 0.0) {
- draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), c, true);
+ draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position - Vector2(h_separation * 0.5, v_separation * 0.5).floor(), Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), c, true);
}
}
Color bc = frame->border != Color(0, 0, 0, 0) ? frame->border : border;
if (bc.a > 0.0) {
- draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position, Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), bc, false);
+ draw_rect(Rect2(p_ofs + rect.position + off + coff - frame->padding.position - Vector2(h_separation * 0.5, v_separation * 0.5).floor(), Size2(table->columns[col].width + h_separation + frame->padding.position.x + frame->padding.size.x, table->rows[row])), bc, false);
}
}
@@ -1534,7 +1535,7 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
if (rtl) {
coff.x = rect.size.width - table->columns[col].width - coff.x;
}
- Rect2 crect = Rect2(rect.position + coff - frame->padding.position, Size2(table->columns[col].width + theme_cache.table_h_separation, table->rows[row] + theme_cache.table_v_separation) + frame->padding.position + frame->padding.size);
+ Rect2 crect = Rect2(rect.position + coff - frame->padding.position - Vector2(theme_cache.table_h_separation * 0.5, theme_cache.table_h_separation * 0.5).floor(), Size2(table->columns[col].width + theme_cache.table_h_separation, table->rows[row] + theme_cache.table_v_separation) + frame->padding.position + frame->padding.size);
if (col == col_count - 1) {
if (rtl) {
crect.size.x = crect.position.x + crect.size.x;
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 58724cf4e9..23b99d1e53 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -243,8 +243,8 @@ void TabContainer::_on_theme_changed() {
tab_bar->add_theme_color_override(SNAME("font_disabled_color"), theme_cache.font_disabled_color);
tab_bar->add_theme_color_override(SNAME("font_outline_color"), theme_cache.font_outline_color);
- tab_bar->add_theme_font_override(SNAME("font"), theme_cache.tab_font);
- tab_bar->add_theme_font_size_override(SNAME("font_size"), theme_cache.tab_font_size);
+ tab_bar->add_theme_font_override(SceneStringName(font), theme_cache.tab_font);
+ tab_bar->add_theme_font_size_override(SceneStringName(font_size), theme_cache.tab_font_size);
tab_bar->add_theme_constant_override(SNAME("h_separation"), theme_cache.icon_separation);
tab_bar->add_theme_constant_override(SNAME("icon_max_width"), theme_cache.icon_max_width);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index c6e5a4603e..ae8e2a493d 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2777,12 +2777,12 @@ Node *Node::duplicate(int p_flags) const {
ERR_THREAD_GUARD_V(nullptr);
Node *dupe = _duplicate(p_flags);
+ _duplicate_properties(this, this, dupe, p_flags);
+
if (dupe && (p_flags & DUPLICATE_SIGNALS)) {
_duplicate_signals(this, dupe);
}
- _duplicate_properties(this, this, dupe, p_flags);
-
return dupe;
}
@@ -2795,6 +2795,8 @@ Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, con
int flags = DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS | DUPLICATE_USE_INSTANTIATION | DUPLICATE_FROM_EDITOR;
Node *dupe = _duplicate(flags, &r_duplimap);
+ _duplicate_properties(this, this, dupe, flags);
+
// This is used by SceneTreeDock's paste functionality. When pasting to foreign scene, resources are duplicated.
if (!p_resource_remap.is_empty()) {
remap_node_resources(dupe, p_resource_remap);
@@ -2805,8 +2807,6 @@ Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, con
// if the emitter node comes later in tree order than the receiver
_duplicate_signals(this, dupe);
- _duplicate_properties(this, this, dupe, flags);
-
return dupe;
}
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index a54f1d376c..bedac4e933 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1861,7 +1861,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
}
for (const KeyValue<String, Varying> &E : varyings) {
- p_list->push_back(PropertyInfo(Variant::STRING, vformat("%s/%s", PNAME("varyings"), E.key)));
+ p_list->push_back(PropertyInfo(Variant::STRING, vformat("%s/%s", PNAME("varyings"), E.key), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
}
for (int i = 0; i < TYPE_MAX; i++) {
@@ -2620,7 +2620,7 @@ void VisualShader::_update_shader() const {
default:
break;
}
- global_code += E.key + ";\n";
+ global_code += vformat("var_%s;\n", E.key);
}
global_code += "\n";
@@ -2689,7 +2689,7 @@ void VisualShader::_update_shader() const {
default:
break;
}
- varying_code += vformat(" %s = %s;\n", E.key, code2);
+ varying_code += vformat(" var_%s = %s;\n", E.key, code2);
}
is_empty_func = false;
}
@@ -5048,18 +5048,18 @@ VisualShaderNodeGlobalExpression::VisualShaderNodeGlobalExpression() {
////////////// Varying
-List<VisualShaderNodeVarying::Varying> varyings;
+RBMap<RID, List<VisualShaderNodeVarying::Varying>> varyings;
-void VisualShaderNodeVarying::add_varying(const String &p_name, VisualShader::VaryingMode p_mode, VisualShader::VaryingType p_type) { // static
- varyings.push_back({ p_name, p_mode, p_type });
+void VisualShaderNodeVarying::add_varying(RID p_shader_rid, const String &p_name, VisualShader::VaryingMode p_mode, VisualShader::VaryingType p_type) { // static
+ varyings[p_shader_rid].push_back({ p_name, p_mode, p_type });
}
-void VisualShaderNodeVarying::clear_varyings() { // static
- varyings.clear();
+void VisualShaderNodeVarying::clear_varyings(RID p_shader_rid) { // static
+ varyings[p_shader_rid].clear();
}
-bool VisualShaderNodeVarying::has_varying(const String &p_name) { // static
- for (const VisualShaderNodeVarying::Varying &E : varyings) {
+bool VisualShaderNodeVarying::has_varying(RID p_shader_rid, const String &p_name) { // static
+ for (const VisualShaderNodeVarying::Varying &E : varyings[p_shader_rid]) {
if (E.name == p_name) {
return true;
}
@@ -5067,19 +5067,23 @@ bool VisualShaderNodeVarying::has_varying(const String &p_name) { // static
return false;
}
+void VisualShaderNodeVarying::set_shader_rid(const RID &p_shader_rid) {
+ shader_rid = p_shader_rid;
+}
+
int VisualShaderNodeVarying::get_varyings_count() const {
- return varyings.size();
+ return varyings[shader_rid].size();
}
String VisualShaderNodeVarying::get_varying_name_by_index(int p_idx) const {
- if (p_idx >= 0 && p_idx < varyings.size()) {
- return varyings.get(p_idx).name;
+ if (p_idx >= 0 && p_idx < varyings[shader_rid].size()) {
+ return varyings[shader_rid].get(p_idx).name;
}
return "";
}
VisualShader::VaryingType VisualShaderNodeVarying::get_varying_type_by_name(const String &p_name) const {
- for (const VisualShaderNodeVarying::Varying &varying : varyings) {
+ for (const VisualShaderNodeVarying::Varying &varying : varyings[shader_rid]) {
if (varying.name == p_name) {
return varying.type;
}
@@ -5088,14 +5092,14 @@ VisualShader::VaryingType VisualShaderNodeVarying::get_varying_type_by_name(cons
}
VisualShader::VaryingType VisualShaderNodeVarying::get_varying_type_by_index(int p_idx) const {
- if (p_idx >= 0 && p_idx < varyings.size()) {
- return varyings.get(p_idx).type;
+ if (p_idx >= 0 && p_idx < varyings[shader_rid].size()) {
+ return varyings[shader_rid].get(p_idx).type;
}
return VisualShader::VARYING_TYPE_FLOAT;
}
VisualShader::VaryingMode VisualShaderNodeVarying::get_varying_mode_by_name(const String &p_name) const {
- for (const VisualShaderNodeVarying::Varying &varying : varyings) {
+ for (const VisualShaderNodeVarying::Varying &varying : varyings[shader_rid]) {
if (varying.name == p_name) {
return varying.mode;
}
@@ -5104,15 +5108,15 @@ VisualShader::VaryingMode VisualShaderNodeVarying::get_varying_mode_by_name(cons
}
VisualShader::VaryingMode VisualShaderNodeVarying::get_varying_mode_by_index(int p_idx) const {
- if (p_idx >= 0 && p_idx < varyings.size()) {
- return varyings.get(p_idx).mode;
+ if (p_idx >= 0 && p_idx < varyings[shader_rid].size()) {
+ return varyings[shader_rid].get(p_idx).mode;
}
return VisualShader::VARYING_MODE_VERTEX_TO_FRAG_LIGHT;
}
VisualShaderNodeVarying::PortType VisualShaderNodeVarying::get_port_type_by_index(int p_idx) const {
- if (p_idx >= 0 && p_idx < varyings.size()) {
- return get_port_type(varyings.get(p_idx).type, 0);
+ if (p_idx >= 0 && p_idx < varyings[shader_rid].size()) {
+ return get_port_type(varyings[shader_rid].get(p_idx).type, 0);
}
return PORT_TYPE_SCALAR;
}
@@ -5239,7 +5243,7 @@ String VisualShaderNodeVaryingSetter::generate_code(Shader::Mode p_mode, VisualS
if (varying_name == "[None]") {
return code;
}
- code += vformat(" %s = %s;\n", varying_name, p_input_vars[0]);
+ code += vformat(" var_%s = %s;\n", varying_name, p_input_vars[0]);
return code;
}
@@ -5284,7 +5288,7 @@ String VisualShaderNodeVaryingGetter::generate_code(Shader::Mode p_mode, VisualS
String from = varying_name;
String from2;
- if (varying_name == "[None]") {
+ if (varying_name == "[None]" || p_for_preview) {
switch (varying_type) {
case VisualShader::VARYING_TYPE_FLOAT:
from = "0.0";
@@ -5313,8 +5317,9 @@ String VisualShaderNodeVaryingGetter::generate_code(Shader::Mode p_mode, VisualS
default:
break;
}
+ return vformat(" %s = %s;\n", p_output_vars[0], from);
}
- return vformat(" %s = %s;\n", p_output_vars[0], from);
+ return vformat(" %s = var_%s;\n", p_output_vars[0], from);
}
VisualShaderNodeVaryingGetter::VisualShaderNodeVaryingGetter() {
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 18cdc8342b..9cd8f86d0f 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -910,13 +910,16 @@ public:
};
protected:
+ RID shader_rid;
VisualShader::VaryingType varying_type = VisualShader::VARYING_TYPE_FLOAT;
String varying_name = "[None]";
public: // internal
- static void add_varying(const String &p_name, VisualShader::VaryingMode p_mode, VisualShader::VaryingType p_type);
- static void clear_varyings();
- static bool has_varying(const String &p_name);
+ static void add_varying(RID p_shader_rid, const String &p_name, VisualShader::VaryingMode p_mode, VisualShader::VaryingType p_type);
+ static void clear_varyings(RID p_shader_rid);
+ static bool has_varying(RID p_shader_rid, const String &p_name);
+
+ void set_shader_rid(const RID &p_shader);
int get_varyings_count() const;
String get_varying_name_by_index(int p_idx) const;
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index c6a2151de5..6a05aa78da 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -101,6 +101,9 @@ SceneStringNames::SceneStringNames() {
area_exited = StaticCString::create("area_exited");
line_separation = StaticCString::create("line_separation");
+ font = StaticCString::create("font");
+ font_size = StaticCString::create("font_size");
+ font_color = StaticCString::create("font_color");
frame_changed = StaticCString::create("frame_changed");
texture_changed = StaticCString::create("texture_changed");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 9af5422391..db11ec36a3 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -70,6 +70,9 @@ public:
StringName updated;
StringName line_separation;
+ StringName font;
+ StringName font_size;
+ StringName font_color;
StringName mouse_entered;
StringName mouse_exited;
diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cpp
index 5315b0acc9..b2a3843b02 100644
--- a/scene/theme/default_theme.cpp
+++ b/scene/theme/default_theme.cpp
@@ -165,11 +165,11 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("disabled", "Button", button_disabled);
theme->set_stylebox("focus", "Button", focus);
- theme->set_font("font", "Button", Ref<Font>());
- theme->set_font_size("font_size", "Button", -1);
+ theme->set_font(SceneStringName(font), "Button", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "Button", -1);
theme->set_constant("outline_size", "Button", 0);
- theme->set_color("font_color", "Button", control_font_color);
+ theme->set_color(SceneStringName(font_color), "Button", control_font_color);
theme->set_color("font_pressed_color", "Button", control_font_pressed_color);
theme->set_color("font_hover_color", "Button", control_font_hover_color);
theme->set_color("font_focus_color", "Button", control_font_focus_color);
@@ -195,11 +195,11 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox(SceneStringName(pressed), "MenuBar", button_pressed);
theme->set_stylebox("disabled", "MenuBar", button_disabled);
- theme->set_font("font", "MenuBar", Ref<Font>());
- theme->set_font_size("font_size", "MenuBar", -1);
+ theme->set_font(SceneStringName(font), "MenuBar", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "MenuBar", -1);
theme->set_constant("outline_size", "MenuBar", 0);
- theme->set_color("font_color", "MenuBar", control_font_color);
+ theme->set_color(SceneStringName(font_color), "MenuBar", control_font_color);
theme->set_color("font_pressed_color", "MenuBar", control_font_pressed_color);
theme->set_color("font_hover_color", "MenuBar", control_font_hover_color);
theme->set_color("font_focus_color", "MenuBar", control_font_focus_color);
@@ -213,10 +213,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("focus", "LinkButton", focus);
- theme->set_font("font", "LinkButton", Ref<Font>());
- theme->set_font_size("font_size", "LinkButton", -1);
+ theme->set_font(SceneStringName(font), "LinkButton", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "LinkButton", -1);
- theme->set_color("font_color", "LinkButton", control_font_color);
+ theme->set_color(SceneStringName(font_color), "LinkButton", control_font_color);
theme->set_color("font_pressed_color", "LinkButton", control_font_pressed_color);
theme->set_color("font_hover_color", "LinkButton", control_font_hover_color);
theme->set_color("font_focus_color", "LinkButton", control_font_focus_color);
@@ -250,10 +250,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("arrow", "OptionButton", icons["option_button_arrow"]);
- theme->set_font("font", "OptionButton", Ref<Font>());
- theme->set_font_size("font_size", "OptionButton", -1);
+ theme->set_font(SceneStringName(font), "OptionButton", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "OptionButton", -1);
- theme->set_color("font_color", "OptionButton", control_font_color);
+ theme->set_color(SceneStringName(font_color), "OptionButton", control_font_color);
theme->set_color("font_pressed_color", "OptionButton", control_font_pressed_color);
theme->set_color("font_hover_color", "OptionButton", control_font_hover_color);
theme->set_color("font_hover_pressed_color", "OptionButton", control_font_pressed_color);
@@ -274,10 +274,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("disabled", "MenuButton", button_disabled);
theme->set_stylebox("focus", "MenuButton", focus);
- theme->set_font("font", "MenuButton", Ref<Font>());
- theme->set_font_size("font_size", "MenuButton", -1);
+ theme->set_font(SceneStringName(font), "MenuButton", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "MenuButton", -1);
- theme->set_color("font_color", "MenuButton", control_font_color);
+ theme->set_color(SceneStringName(font_color), "MenuButton", control_font_color);
theme->set_color("font_pressed_color", "MenuButton", control_font_pressed_color);
theme->set_color("font_hover_color", "MenuButton", control_font_hover_color);
theme->set_color("font_focus_color", "MenuButton", control_font_focus_color);
@@ -310,10 +310,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("radio_unchecked", "CheckBox", icons["radio_unchecked"]);
theme->set_icon("radio_unchecked_disabled", "CheckBox", icons["radio_unchecked_disabled"]);
- theme->set_font("font", "CheckBox", Ref<Font>());
- theme->set_font_size("font_size", "CheckBox", -1);
+ theme->set_font(SceneStringName(font), "CheckBox", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "CheckBox", -1);
- theme->set_color("font_color", "CheckBox", control_font_color);
+ theme->set_color(SceneStringName(font_color), "CheckBox", control_font_color);
theme->set_color("font_pressed_color", "CheckBox", control_font_pressed_color);
theme->set_color("font_hover_color", "CheckBox", control_font_hover_color);
theme->set_color("font_hover_pressed_color", "CheckBox", control_font_pressed_color);
@@ -347,10 +347,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("unchecked_mirrored", "CheckButton", icons["toggle_off_mirrored"]);
theme->set_icon("unchecked_disabled_mirrored", "CheckButton", icons["toggle_off_disabled_mirrored"]);
- theme->set_font("font", "CheckButton", Ref<Font>());
- theme->set_font_size("font_size", "CheckButton", -1);
+ theme->set_font(SceneStringName(font), "CheckButton", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "CheckButton", -1);
- theme->set_color("font_color", "CheckButton", control_font_color);
+ theme->set_color(SceneStringName(font_color), "CheckButton", control_font_color);
theme->set_color("font_pressed_color", "CheckButton", control_font_pressed_color);
theme->set_color("font_hover_color", "CheckButton", control_font_hover_color);
theme->set_color("font_hover_pressed_color", "CheckButton", control_font_pressed_color);
@@ -387,10 +387,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// Label
theme->set_stylebox(CoreStringName(normal), "Label", memnew(StyleBoxEmpty));
- theme->set_font("font", "Label", Ref<Font>());
- theme->set_font_size("font_size", "Label", -1);
+ theme->set_font(SceneStringName(font), "Label", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "Label", -1);
- theme->set_color("font_color", "Label", Color(1, 1, 1));
+ theme->set_color(SceneStringName(font_color), "Label", Color(1, 1, 1));
theme->set_color("font_shadow_color", "Label", Color(0, 0, 0, 0));
theme->set_color("font_outline_color", "Label", Color(0, 0, 0));
@@ -401,13 +401,13 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("line_spacing", "Label", Math::round(3 * scale));
theme->set_type_variation("HeaderSmall", "Label");
- theme->set_font_size("font_size", "HeaderSmall", default_font_size + 4);
+ theme->set_font_size(SceneStringName(font_size), "HeaderSmall", default_font_size + 4);
theme->set_type_variation("HeaderMedium", "Label");
- theme->set_font_size("font_size", "HeaderMedium", default_font_size + 8);
+ theme->set_font_size(SceneStringName(font_size), "HeaderMedium", default_font_size + 8);
theme->set_type_variation("HeaderLarge", "Label");
- theme->set_font_size("font_size", "HeaderLarge", default_font_size + 12);
+ theme->set_font_size(SceneStringName(font_size), "HeaderLarge", default_font_size + 12);
// LineEdit
@@ -425,10 +425,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
style_line_edit_read_only->set_border_color(style_pressed_color * Color(1, 1, 1, 0.5));
theme->set_stylebox("read_only", "LineEdit", style_line_edit_read_only);
- theme->set_font("font", "LineEdit", Ref<Font>());
- theme->set_font_size("font_size", "LineEdit", -1);
+ theme->set_font(SceneStringName(font), "LineEdit", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "LineEdit", -1);
- theme->set_color("font_color", "LineEdit", control_font_color);
+ theme->set_color(SceneStringName(font_color), "LineEdit", control_font_color);
theme->set_color("font_selected_color", "LineEdit", control_font_pressed_color);
theme->set_color("font_uneditable_color", "LineEdit", control_font_disabled_color);
theme->set_color("font_placeholder_color", "LineEdit", control_font_placeholder_color);
@@ -449,10 +449,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("background", "ProgressBar", make_flat_stylebox(style_disabled_color, 2, 2, 2, 2, 6));
theme->set_stylebox("fill", "ProgressBar", make_flat_stylebox(style_progress_color, 2, 2, 2, 2, 6));
- theme->set_font("font", "ProgressBar", Ref<Font>());
- theme->set_font_size("font_size", "ProgressBar", -1);
+ theme->set_font(SceneStringName(font), "ProgressBar", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "ProgressBar", -1);
- theme->set_color("font_color", "ProgressBar", control_font_hover_color);
+ theme->set_color(SceneStringName(font_color), "ProgressBar", control_font_hover_color);
theme->set_color("font_outline_color", "ProgressBar", Color(0, 0, 0));
theme->set_constant("outline_size", "ProgressBar", 0);
@@ -466,11 +466,11 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("tab", "TextEdit", icons["text_edit_tab"]);
theme->set_icon("space", "TextEdit", icons["text_edit_space"]);
- theme->set_font("font", "TextEdit", Ref<Font>());
- theme->set_font_size("font_size", "TextEdit", -1);
+ theme->set_font(SceneStringName(font), "TextEdit", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "TextEdit", -1);
theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0));
- theme->set_color("font_color", "TextEdit", control_font_color);
+ theme->set_color(SceneStringName(font_color), "TextEdit", control_font_color);
theme->set_color("font_selected_color", "TextEdit", Color(0, 0, 0, 0));
theme->set_color("font_readonly_color", "TextEdit", control_font_disabled_color);
theme->set_color("font_placeholder_color", "TextEdit", control_font_placeholder_color);
@@ -505,8 +505,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("folded_code_region", "CodeEdit", icons["region_folded"]);
theme->set_icon("folded_eol_icon", "CodeEdit", icons["text_edit_ellipsis"]);
- theme->set_font("font", "CodeEdit", Ref<Font>());
- theme->set_font_size("font_size", "CodeEdit", -1);
+ theme->set_font(SceneStringName(font), "CodeEdit", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "CodeEdit", -1);
theme->set_color("background_color", "CodeEdit", Color(0, 0, 0, 0));
theme->set_color("completion_background_color", "CodeEdit", Color(0.17, 0.16, 0.2));
@@ -514,7 +514,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("completion_existing_color", "CodeEdit", Color(0.87, 0.87, 0.87, 0.13));
theme->set_color("completion_scroll_color", "CodeEdit", control_font_pressed_color * Color(1, 1, 1, 0.29));
theme->set_color("completion_scroll_hovered_color", "CodeEdit", control_font_pressed_color * Color(1, 1, 1, 0.4));
- theme->set_color("font_color", "CodeEdit", control_font_color);
+ theme->set_color(SceneStringName(font_color), "CodeEdit", control_font_color);
theme->set_color("font_selected_color", "CodeEdit", Color(0, 0, 0, 0));
theme->set_color("font_readonly_color", "CodeEdit", Color(control_font_color.r, control_font_color.g, control_font_color.b, 0.5f));
theme->set_color("font_placeholder_color", "CodeEdit", control_font_placeholder_color);
@@ -699,12 +699,12 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("submenu", "PopupMenu", icons["popup_menu_arrow_right"]);
theme->set_icon("submenu_mirrored", "PopupMenu", icons["popup_menu_arrow_left"]);
- theme->set_font("font", "PopupMenu", Ref<Font>());
+ theme->set_font(SceneStringName(font), "PopupMenu", Ref<Font>());
theme->set_font("font_separator", "PopupMenu", Ref<Font>());
- theme->set_font_size("font_size", "PopupMenu", -1);
+ theme->set_font_size(SceneStringName(font_size), "PopupMenu", -1);
theme->set_font_size("font_separator_size", "PopupMenu", -1);
- theme->set_color("font_color", "PopupMenu", control_font_color);
+ theme->set_color(SceneStringName(font_color), "PopupMenu", control_font_color);
theme->set_color("font_accelerator_color", "PopupMenu", Color(0.7, 0.7, 0.7, 0.8));
theme->set_color("font_disabled_color", "PopupMenu", Color(0.4, 0.4, 0.4, 0.8));
theme->set_color("font_hover_color", "PopupMenu", control_font_color);
@@ -749,9 +749,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_type_variation("GraphNodeTitleLabel", "Label");
theme->set_stylebox(CoreStringName(normal), "GraphNodeTitleLabel", make_empty_stylebox(0, 0, 0, 0));
- theme->set_font("font", "GraphNodeTitleLabel", Ref<Font>());
- theme->set_font_size("font_size", "GraphNodeTitleLabel", -1);
- theme->set_color("font_color", "GraphNodeTitleLabel", control_font_color);
+ theme->set_font(SceneStringName(font), "GraphNodeTitleLabel", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "GraphNodeTitleLabel", -1);
+ theme->set_color(SceneStringName(font_color), "GraphNodeTitleLabel", control_font_color);
theme->set_color("font_shadow_color", "GraphNodeTitleLabel", Color(0, 0, 0, 0));
theme->set_color("font_outline_color", "GraphNodeTitleLabel", Color(0, 0, 0));
theme->set_constant("shadow_offset_x", "GraphNodeTitleLabel", Math::round(1 * scale));
@@ -780,8 +780,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_type_variation("GraphFrameTitleLabel", "Label");
theme->set_stylebox(CoreStringName(normal), "GraphFrameTitleLabel", memnew(StyleBoxEmpty));
- theme->set_font_size("font_size", "GraphFrameTitleLabel", 22);
- theme->set_color("font_color", "GraphFrameTitleLabel", Color(1, 1, 1));
+ theme->set_font_size(SceneStringName(font_size), "GraphFrameTitleLabel", 22);
+ theme->set_color(SceneStringName(font_color), "GraphFrameTitleLabel", Color(1, 1, 1));
theme->set_color("font_shadow_color", "GraphFrameTitleLabel", Color(0, 0, 0, 0));
theme->set_color("font_outline_color", "GraphFrameTitleLabel", Color(1, 1, 1));
theme->set_constant("shadow_offset_x", "GraphFrameTitleLabel", 1 * scale);
@@ -819,12 +819,12 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("arrow_collapsed_mirrored", "Tree", icons["arrow_left"]);
theme->set_font("title_button_font", "Tree", Ref<Font>());
- theme->set_font("font", "Tree", Ref<Font>());
- theme->set_font_size("font_size", "Tree", -1);
+ theme->set_font(SceneStringName(font), "Tree", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "Tree", -1);
theme->set_font_size("title_button_font_size", "Tree", -1);
theme->set_color("title_button_color", "Tree", control_font_color);
- theme->set_color("font_color", "Tree", control_font_low_color);
+ theme->set_color(SceneStringName(font_color), "Tree", control_font_low_color);
theme->set_color("font_selected_color", "Tree", control_font_pressed_color);
theme->set_color("font_disabled_color", "Tree", control_font_disabled_color);
theme->set_color("font_outline_color", "Tree", Color(0, 0, 0));
@@ -869,10 +869,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("icon_margin", "ItemList", Math::round(4 * scale));
theme->set_constant(SceneStringName(line_separation), "ItemList", Math::round(2 * scale));
- theme->set_font("font", "ItemList", Ref<Font>());
- theme->set_font_size("font_size", "ItemList", -1);
+ theme->set_font(SceneStringName(font), "ItemList", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "ItemList", -1);
- theme->set_color("font_color", "ItemList", control_font_lower_color);
+ theme->set_color(SceneStringName(font_color), "ItemList", control_font_lower_color);
theme->set_color("font_hovered_color", "ItemList", control_font_hover_color);
theme->set_color("font_selected_color", "ItemList", control_font_pressed_color);
theme->set_color("font_outline_color", "ItemList", Color(0, 0, 0));
@@ -917,8 +917,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("menu", "TabContainer", icons["tabs_menu"]);
theme->set_icon("menu_highlight", "TabContainer", icons["tabs_menu_hl"]);
- theme->set_font("font", "TabContainer", Ref<Font>());
- theme->set_font_size("font_size", "TabContainer", -1);
+ theme->set_font(SceneStringName(font), "TabContainer", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "TabContainer", -1);
theme->set_color("font_selected_color", "TabContainer", control_font_hover_color);
theme->set_color("font_hovered_color", "TabContainer", control_font_hover_color);
@@ -949,8 +949,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("drop_mark", "TabBar", icons["tabs_drop_mark"]);
theme->set_icon("close", "TabBar", icons["close"]);
- theme->set_font("font", "TabBar", Ref<Font>());
- theme->set_font_size("font_size", "TabBar", -1);
+ theme->set_font(SceneStringName(font), "TabBar", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "TabBar", -1);
theme->set_color("font_selected_color", "TabBar", control_font_hover_color);
theme->set_color("font_hovered_color", "TabBar", control_font_hover_color);
@@ -1058,10 +1058,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_stylebox("disabled", "ColorPickerButton", button_disabled);
theme->set_stylebox("focus", "ColorPickerButton", focus);
- theme->set_font("font", "ColorPickerButton", Ref<Font>());
- theme->set_font_size("font_size", "ColorPickerButton", -1);
+ theme->set_font(SceneStringName(font), "ColorPickerButton", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "ColorPickerButton", -1);
- theme->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1));
+ theme->set_color(SceneStringName(font_color), "ColorPickerButton", Color(1, 1, 1, 1));
theme->set_color("font_pressed_color", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1));
theme->set_color("font_hover_color", "ColorPickerButton", Color(1, 1, 1, 1));
theme->set_color("font_focus_color", "ColorPickerButton", Color(1, 1, 1, 1));
@@ -1089,10 +1089,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
make_flat_stylebox(Color(0, 0, 0, 0.5), 2 * default_margin, 0.5 * default_margin, 2 * default_margin, 0.5 * default_margin));
theme->set_type_variation("TooltipLabel", "Label");
- theme->set_font_size("font_size", "TooltipLabel", -1);
- theme->set_font("font", "TooltipLabel", Ref<Font>());
+ theme->set_font_size(SceneStringName(font_size), "TooltipLabel", -1);
+ theme->set_font(SceneStringName(font), "TooltipLabel", Ref<Font>());
- theme->set_color("font_color", "TooltipLabel", control_font_color);
+ theme->set_color(SceneStringName(font_color), "TooltipLabel", control_font_color);
theme->set_color("font_shadow_color", "TooltipLabel", Color(0, 0, 0, 0));
theme->set_color("font_outline_color", "TooltipLabel", Color(0, 0, 0));
diff --git a/servers/physics_2d/godot_body_2d.cpp b/servers/physics_2d/godot_body_2d.cpp
index 01996dc43c..c401e6eee7 100644
--- a/servers/physics_2d/godot_body_2d.cpp
+++ b/servers/physics_2d/godot_body_2d.cpp
@@ -616,6 +616,8 @@ void GodotBody2D::integrate_velocities(real_t p_step) {
return;
}
+ ERR_FAIL_NULL(get_space());
+
if (fi_callback_data || body_state_callback.is_valid()) {
get_space()->body_add_to_state_query_list(&direct_state_query_list);
}
@@ -705,6 +707,8 @@ bool GodotBody2D::sleep_test(real_t p_step) {
return false;
}
+ ERR_FAIL_NULL_V(get_space(), true);
+
if (Math::abs(angular_velocity) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
still_time += p_step;
diff --git a/servers/physics_3d/godot_body_3d.cpp b/servers/physics_3d/godot_body_3d.cpp
index 407957b904..669c4b985b 100644
--- a/servers/physics_3d/godot_body_3d.cpp
+++ b/servers/physics_3d/godot_body_3d.cpp
@@ -675,6 +675,8 @@ void GodotBody3D::integrate_velocities(real_t p_step) {
return;
}
+ ERR_FAIL_NULL(get_space());
+
if (fi_callback_data || body_state_callback.is_valid()) {
get_space()->body_add_to_state_query_list(&direct_state_query_list);
}
@@ -784,6 +786,8 @@ bool GodotBody3D::sleep_test(real_t p_step) {
return false;
}
+ ERR_FAIL_NULL_V(get_space(), true);
+
if (Math::abs(angular_velocity.length()) < get_space()->get_body_angular_velocity_sleep_threshold() && Math::abs(linear_velocity.length_squared()) < get_space()->get_body_linear_velocity_sleep_threshold() * get_space()->get_body_linear_velocity_sleep_threshold()) {
still_time += p_step;
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp
index f872219425..e92050a323 100644
--- a/servers/rendering/renderer_canvas_cull.cpp
+++ b/servers/rendering/renderer_canvas_cull.cpp
@@ -79,7 +79,7 @@ void RendererCanvasCull::_render_canvas_item_tree(RID p_to_render_target, Canvas
}
}
-void _collect_ysort_children(RendererCanvasCull::Item *p_canvas_item, Transform2D p_transform, RendererCanvasCull::Item *p_material_owner, const Color &p_modulate, RendererCanvasCull::Item **r_items, int &r_index, int p_z) {
+void _collect_ysort_children(RendererCanvasCull::Item *p_canvas_item, const Transform2D &p_transform, RendererCanvasCull::Item *p_material_owner, const Color &p_modulate, RendererCanvasCull::Item **r_items, int &r_index, int p_z) {
int child_item_count = p_canvas_item->child_items.size();
RendererCanvasCull::Item **child_items = p_canvas_item->child_items.ptrw();
for (int i = 0; i < child_item_count; i++) {
@@ -94,6 +94,11 @@ void _collect_ysort_children(RendererCanvasCull::Item *p_canvas_item, Transform2
child_items[i]->ysort_index = r_index;
child_items[i]->ysort_parent_abs_z_index = p_z;
+ if (!child_items[i]->repeat_source) {
+ child_items[i]->repeat_size = p_canvas_item->repeat_size;
+ child_items[i]->repeat_times = p_canvas_item->repeat_times;
+ }
+
// Y sorted canvas items are flattened into r_items. Calculate their absolute z index to use when rendering r_items.
if (child_items[i]->z_relative) {
abs_z = CLAMP(p_z + child_items[i]->z_index, RS::CANVAS_ITEM_Z_MIN, RS::CANVAS_ITEM_Z_MAX);
@@ -270,12 +275,12 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
} else {
ci->repeat_size = repeat_size;
ci->repeat_times = repeat_times;
+ }
- if (repeat_size.x || repeat_size.y) {
- Size2 scale = final_xform.get_scale();
- rect.size += repeat_size * repeat_times / scale;
- rect.position -= repeat_size / scale * (repeat_times / 2);
- }
+ if (repeat_size.x || repeat_size.y) {
+ Size2 scale = final_xform.get_scale();
+ rect.size += repeat_size * repeat_times / scale;
+ rect.position -= repeat_size / scale * (repeat_times / 2);
}
if (snapping_2d_transforms_to_pixel) {
@@ -352,7 +357,7 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
sorter.sort(child_items, child_item_count);
for (i = 0; i < child_item_count; i++) {
- _cull_canvas_item(child_items[i], final_xform * child_items[i]->ysort_xform, p_clip_rect, modulate * child_items[i]->ysort_modulate, child_items[i]->ysort_parent_abs_z_index, r_z_list, r_z_last_list, (Item *)ci->final_clip_owner, (Item *)child_items[i]->material_owner, false, p_canvas_cull_mask, repeat_size, repeat_times);
+ _cull_canvas_item(child_items[i], final_xform * child_items[i]->ysort_xform, p_clip_rect, modulate * child_items[i]->ysort_modulate, child_items[i]->ysort_parent_abs_z_index, r_z_list, r_z_last_list, (Item *)ci->final_clip_owner, (Item *)child_items[i]->material_owner, false, p_canvas_cull_mask, child_items[i]->repeat_size, child_items[i]->repeat_times);
}
} else {
RendererCanvasRender::Item *canvas_group_from = nullptr;
diff --git a/servers/rendering/renderer_canvas_render.h b/servers/rendering/renderer_canvas_render.h
index 4a56548932..cb8180f989 100644
--- a/servers/rendering/renderer_canvas_render.h
+++ b/servers/rendering/renderer_canvas_render.h
@@ -545,8 +545,13 @@ public:
virtual void set_debug_redraw(bool p_enabled, double p_time, const Color &p_color) = 0;
- RendererCanvasRender() { singleton = this; }
- virtual ~RendererCanvasRender() {}
+ RendererCanvasRender() {
+ ERR_FAIL_COND_MSG(singleton != nullptr, "A RendererCanvasRender singleton already exists.");
+ singleton = this;
+ }
+ virtual ~RendererCanvasRender() {
+ singleton = nullptr;
+ }
};
#endif // RENDERER_CANVAS_RENDER_H
diff --git a/servers/rendering/renderer_compositor.cpp b/servers/rendering/renderer_compositor.cpp
index d364de5633..428cecead1 100644
--- a/servers/rendering/renderer_compositor.cpp
+++ b/servers/rendering/renderer_compositor.cpp
@@ -47,6 +47,7 @@ bool RendererCompositor::is_xr_enabled() const {
}
RendererCompositor::RendererCompositor() {
+ ERR_FAIL_COND_MSG(singleton != nullptr, "A RendererCompositor singleton already exists.");
singleton = this;
#ifndef _3D_DISABLED
@@ -57,3 +58,7 @@ RendererCompositor::RendererCompositor() {
}
#endif // _3D_DISABLED
}
+
+RendererCompositor::~RendererCompositor() {
+ singleton = nullptr;
+}
diff --git a/servers/rendering/renderer_compositor.h b/servers/rendering/renderer_compositor.h
index 3c49e31516..ab789d5b4d 100644
--- a/servers/rendering/renderer_compositor.h
+++ b/servers/rendering/renderer_compositor.h
@@ -110,7 +110,7 @@ public:
static RendererCompositor *get_singleton() { return singleton; }
RendererCompositor();
- virtual ~RendererCompositor() {}
+ virtual ~RendererCompositor();
};
#endif // RENDERER_COMPOSITOR_H
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index 14d138181f..84ea6a5da2 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -299,6 +299,7 @@ RendererCompositorRD::RendererCompositorRD() {
}
}
+ ERR_FAIL_COND_MSG(singleton != nullptr, "A RendererCompositorRD singleton already exists.");
singleton = this;
utilities = memnew(RendererRD::Utilities);
@@ -330,6 +331,7 @@ RendererCompositorRD::RendererCompositorRD() {
}
RendererCompositorRD::~RendererCompositorRD() {
+ singleton = nullptr;
memdelete(uniform_set_cache);
memdelete(framebuffer_cache);
ShaderRD::set_shader_cache_dir(String());
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
index ab9cf666ec..de396cd18b 100644
--- a/servers/rendering/shader_types.cpp
+++ b/servers/rendering/shader_types.cpp
@@ -77,12 +77,12 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["INSTANCE_CUSTOM"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VERTEX_ID"] = constt(ShaderLanguage::TYPE_INT);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["ROUGHNESS"] = ShaderLanguage::TYPE_FLOAT;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["BONE_INDICES"] = ShaderLanguage::TYPE_UVEC4;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["BONE_WEIGHTS"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM0"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM1"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM2"] = ShaderLanguage::TYPE_VEC4;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM3"] = ShaderLanguage::TYPE_VEC4;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["BONE_INDICES"] = constt(ShaderLanguage::TYPE_UVEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["BONE_WEIGHTS"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM0"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM1"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM2"] = constt(ShaderLanguage::TYPE_VEC4);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CUSTOM3"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].can_discard = false;
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].main_function = true;
@@ -99,11 +99,11 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["MAIN_CAM_INV_VIEW_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NODE_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_DIRECTION_WORLD"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_VISIBLE_LAYERS"] = ShaderLanguage::TYPE_UINT;
- shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NODE_POSITION_VIEW"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NODE_POSITION_WORLD"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_POSITION_WORLD"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_DIRECTION_WORLD"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_VISIBLE_LAYERS"] = constt(ShaderLanguage::TYPE_UINT);
+ shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["NODE_POSITION_VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_INDEX"] = constt(ShaderLanguage::TYPE_INT);
shader_modes[RS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEW_MONO_LEFT"] = constt(ShaderLanguage::TYPE_INT);
@@ -147,11 +147,11 @@ ShaderTypes::ShaderTypes() {
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["SCREEN_UV"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2);
- shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NODE_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_POSITION_WORLD"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_DIRECTION_WORLD"] = ShaderLanguage::TYPE_VEC3;
- shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_VISIBLE_LAYERS"] = ShaderLanguage::TYPE_UINT;
- shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NODE_POSITION_VIEW"] = ShaderLanguage::TYPE_VEC3;
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NODE_POSITION_WORLD"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_POSITION_WORLD"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_DIRECTION_WORLD"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["CAMERA_VISIBLE_LAYERS"] = constt(ShaderLanguage::TYPE_UINT);
+ shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["NODE_POSITION_VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_INDEX"] = constt(ShaderLanguage::TYPE_INT);
shader_modes[RS::SHADER_SPATIAL].functions["fragment"].built_ins["VIEW_MONO_LEFT"] = constt(ShaderLanguage::TYPE_INT);
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 7637d4e7da..dd3491f62c 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -3610,7 +3610,7 @@ void RenderingServer::init() {
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/subsurface_scattering/subsurface_scattering_scale", PROPERTY_HINT_RANGE, "0.001,1,0.001"), 0.05);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale", PROPERTY_HINT_RANGE, "0.001,1,0.001"), 0.01);
- GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/limits/global_shader_variables/buffer_size", PROPERTY_HINT_RANGE, "1,1048576,1"), 65536);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/limits/global_shader_variables/buffer_size", PROPERTY_HINT_RANGE, "16,1048576,1"), 65536);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/lightmapping/probe_capture/update_speed", PROPERTY_HINT_RANGE, "0.001,256,0.001"), 15);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/lightmapping/primitive_meshes/texel_size", PROPERTY_HINT_RANGE, "0.001,100,0.001"), 0.2);