Merge pull request #105910 from lawnjelly/global_get_fast4
Add `GLOBAL_GET` cached macros.
This commit is contained in:
commit
f4f1471b57
48 changed files with 110 additions and 77 deletions
|
|
@ -296,6 +296,8 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
|
|||
for (int i = 0; i < custom_feature_array.size(); i++) {
|
||||
custom_features.insert(custom_feature_array[i]);
|
||||
}
|
||||
|
||||
_version++;
|
||||
_queue_changed();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -341,6 +343,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
|
|||
}
|
||||
}
|
||||
|
||||
_version++;
|
||||
_queue_changed();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ class ProjectSettings : public Object {
|
|||
|
||||
bool is_changed = false;
|
||||
|
||||
// Starting version from 1 ensures that all callers can reset their tested version to 0,
|
||||
// and will always detect the initial project settings as a "change".
|
||||
uint32_t _version = 1;
|
||||
|
||||
public:
|
||||
typedef HashMap<String, Variant> CustomMap;
|
||||
static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot";
|
||||
|
|
@ -218,6 +222,9 @@ public:
|
|||
String get_scene_groups_cache_path() const;
|
||||
void load_scene_groups_cache();
|
||||
|
||||
// Testing a version allows fast cached GET_GLOBAL macros.
|
||||
uint32_t get_version() const { return _version; }
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
|
||||
#endif
|
||||
|
|
@ -243,3 +250,26 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p
|
|||
#define GLOBAL_DEF_RST_NOVAL_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true, true)
|
||||
|
||||
#define GLOBAL_DEF_INTERNAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, false, true)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Cached versions of GLOBAL_GET.
|
||||
// Cached but uses a typed variable for storage, this can be more efficient.
|
||||
// Variables prefixed with _ggc_ to avoid shadowing warnings.
|
||||
#define GLOBAL_GET_CACHED(m_type, m_setting_name) ([](const char *p_name) -> m_type {\
|
||||
static_assert(std::is_trivially_destructible<m_type>::value, "GLOBAL_GET_CACHED must use a trivial type that allows static lifetime.");\
|
||||
static m_type _ggc_local_var;\
|
||||
static uint32_t _ggc_local_version = 0;\
|
||||
static SpinLock _ggc_spin;\
|
||||
uint32_t _ggc_new_version = ProjectSettings::get_singleton()->get_version();\
|
||||
if (_ggc_local_version != _ggc_new_version) {\
|
||||
_ggc_spin.lock();\
|
||||
_ggc_local_version = _ggc_new_version;\
|
||||
_ggc_local_var = ProjectSettings::get_singleton()->get_setting_with_override(p_name);\
|
||||
m_type _ggc_temp = _ggc_local_var;\
|
||||
_ggc_spin.unlock();\
|
||||
return _ggc_temp;\
|
||||
}\
|
||||
_ggc_spin.lock();\
|
||||
m_type _ggc_temp2 = _ggc_local_var;\
|
||||
_ggc_spin.unlock();\
|
||||
return _ggc_temp2; })(m_setting_name)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void RasterizerGLES3::begin_frame(double frame_step) {
|
|||
|
||||
time_total += frame_step;
|
||||
|
||||
double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs");
|
||||
double time_roll_over = GLOBAL_GET_CACHED(double, "rendering/limits/time/time_rollover_secs");
|
||||
time_total = Math::fmod(time_total, time_roll_over);
|
||||
|
||||
canvas->set_time(time_total);
|
||||
|
|
|
|||
|
|
@ -4532,7 +4532,7 @@ Control *EditorHelpBitTooltip::show_tooltip(Control *p_target, const String &p_s
|
|||
// Copy-paste from `Viewport::_gui_show_tooltip()`.
|
||||
void EditorHelpBitTooltip::popup_under_cursor() {
|
||||
Point2 mouse_pos = get_mouse_position();
|
||||
Point2 tooltip_offset = GLOBAL_GET("display/mouse_cursor/tooltip_position_offset");
|
||||
Point2 tooltip_offset = GLOBAL_GET_CACHED(Point2, "display/mouse_cursor/tooltip_position_offset");
|
||||
Rect2 r(mouse_pos + tooltip_offset, get_contents_minimum_size());
|
||||
r.size = r.size.min(get_max_size());
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void EditorLocaleDialog::_update_tree() {
|
|||
|
||||
int filter = SHOW_ALL_LOCALES;
|
||||
if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/locale_filter_mode")) {
|
||||
filter = GLOBAL_GET("internationalization/locale/locale_filter_mode");
|
||||
filter = GLOBAL_GET_CACHED(int, "internationalization/locale/locale_filter_mode");
|
||||
}
|
||||
Array f_lang_all;
|
||||
if (ProjectSettings::get_singleton()->has_setting("internationalization/locale/language_filter")) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ Node *EditorSceneFormatImporterUFBX::import_scene(const String &p_path, uint32_t
|
|||
const HashMap<StringName, Variant> &p_options,
|
||||
List<String> *r_missing_deps, Error *r_err) {
|
||||
// FIXME: Hack to work around GH-86309.
|
||||
if (p_options.has("fbx/importer") && int(p_options["fbx/importer"]) == FBX_IMPORTER_FBX2GLTF && GLOBAL_GET("filesystem/import/fbx2gltf/enabled")) {
|
||||
if (p_options.has("fbx/importer") && int(p_options["fbx/importer"]) == FBX_IMPORTER_FBX2GLTF && GLOBAL_GET_CACHED(bool, "filesystem/import/fbx2gltf/enabled")) {
|
||||
Ref<EditorSceneFormatImporterFBX2GLTF> fbx2gltf_importer;
|
||||
fbx2gltf_importer.instantiate();
|
||||
Node *scene = fbx2gltf_importer->import_scene(p_path, p_flags, p_options, r_missing_deps, r_err);
|
||||
|
|
|
|||
|
|
@ -3701,7 +3701,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a
|
|||
String base_name = is_self && !p_call->is_super ? "self" : base_type.to_string();
|
||||
#ifdef SUGGEST_GODOT4_RENAMES
|
||||
String rename_hint;
|
||||
if (GLOBAL_GET("debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
const char *renamed_function_name = check_for_renamed_identifier(p_call->function_name, p_call->type);
|
||||
if (renamed_function_name) {
|
||||
rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", String(renamed_function_name) + "()");
|
||||
|
|
@ -4048,7 +4048,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
|
|||
if (!valid && base.is_hard_type()) {
|
||||
#ifdef SUGGEST_GODOT4_RENAMES
|
||||
String rename_hint;
|
||||
if (GLOBAL_GET("debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type);
|
||||
if (renamed_identifier_name) {
|
||||
rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", renamed_identifier_name);
|
||||
|
|
@ -4092,7 +4092,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
|
|||
if (base.is_hard_type()) {
|
||||
#ifdef SUGGEST_GODOT4_RENAMES
|
||||
String rename_hint;
|
||||
if (GLOBAL_GET("debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type);
|
||||
if (renamed_identifier_name) {
|
||||
rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", renamed_identifier_name);
|
||||
|
|
@ -4608,7 +4608,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
|
|||
// Not found.
|
||||
#ifdef SUGGEST_GODOT4_RENAMES
|
||||
String rename_hint;
|
||||
if (GLOBAL_GET("debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "debug/gdscript/warnings/renamed_in_godot_4_hint")) {
|
||||
const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type);
|
||||
if (renamed_identifier_name) {
|
||||
rename_hint = " " + vformat(R"(Did you mean to use "%s"?)", renamed_identifier_name);
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ void GDScriptParser::push_warning(const Node *p_source, GDScriptWarning::Code p_
|
|||
if (is_ignoring_warnings) {
|
||||
return;
|
||||
}
|
||||
if (GLOBAL_GET("debug/gdscript/warnings/exclude_addons") && script_path.begins_with("res://addons/")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "debug/gdscript/warnings/exclude_addons") && script_path.begins_with("res://addons/")) {
|
||||
return;
|
||||
}
|
||||
GDScriptWarning::WarnLevel warn_level = (GDScriptWarning::WarnLevel)(int)GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(p_code));
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ static bool _test_blender_path(const String &p_path, String *r_err = nullptr) {
|
|||
}
|
||||
|
||||
bool EditorFileSystemImportFormatSupportQueryBlend::is_active() const {
|
||||
bool blend_enabled = GLOBAL_GET("filesystem/import/blender/enabled");
|
||||
bool blend_enabled = GLOBAL_GET_CACHED(bool, "filesystem/import/blender/enabled");
|
||||
|
||||
if (blend_enabled && !_test_blender_path(EDITOR_GET("filesystem/import/blender/blender_path").operator String())) {
|
||||
// Intending to import Blender, but blend not configured.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ HashMap<String, bool *> OpenXREyeGazeInteractionExtension::get_requested_extensi
|
|||
|
||||
// Only enable this extension when requested.
|
||||
// We still register our meta data or the action map editor will fail.
|
||||
if (GLOBAL_GET("xr/openxr/extensions/eye_gaze_interaction") && (!OS::get_singleton()->has_feature("mobile") || OS::get_singleton()->has_feature(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "xr/openxr/extensions/eye_gaze_interaction") && (!OS::get_singleton()->has_feature("mobile") || OS::get_singleton()->has_feature(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME))) {
|
||||
request_extensions[XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME] = &available;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env,
|
|||
// Unlike PCVR, there's no additional 2D screen onto which to render the boot logo,
|
||||
// so we skip this step if xr is enabled.
|
||||
if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {
|
||||
xr_enabled = GLOBAL_GET("xr/shaders/enabled");
|
||||
xr_enabled = GLOBAL_GET_CACHED(bool, "xr/shaders/enabled");
|
||||
} else {
|
||||
xr_enabled = XRServer::get_xr_mode() == XRServer::XRMODE_ON;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4807,7 +4807,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||
return 0; // Prevent from happening.
|
||||
case SC_KEYMENU:
|
||||
Engine *engine = Engine::get_singleton();
|
||||
if (((lParam >> 16) <= 0) && !engine->is_project_manager_hint() && !engine->is_editor_hint() && !GLOBAL_GET("application/run/enable_alt_space_menu")) {
|
||||
if (((lParam >> 16) <= 0) && !engine->is_project_manager_hint() && !engine->is_editor_hint() && !GLOBAL_GET_CACHED(bool, "application/run/enable_alt_space_menu")) {
|
||||
return 0;
|
||||
}
|
||||
if (!_get_mods().has_flag(WinKeyModifierMask::ALT) || !(GetAsyncKeyState(VK_SPACE) & (1 << 15))) {
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ void AudioStreamPlayer2D::_bind_methods() {
|
|||
|
||||
AudioStreamPlayer2D::AudioStreamPlayer2D() {
|
||||
internal = memnew(AudioStreamPlayerInternal(this, callable_mp(this, &AudioStreamPlayer2D::play), callable_mp(this, &AudioStreamPlayer2D::stop), true));
|
||||
cached_global_panning_strength = GLOBAL_GET("audio/general/2d_panning_strength");
|
||||
cached_global_panning_strength = GLOBAL_GET_CACHED(float, "audio/general/2d_panning_strength");
|
||||
set_hide_clip_children(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ Point2 Camera2D::get_camera_screen_center() const {
|
|||
|
||||
Size2 Camera2D::_get_camera_screen_size() const {
|
||||
if (is_part_of_edited_scene()) {
|
||||
return Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));
|
||||
return Size2(GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_width"), GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_height"));
|
||||
}
|
||||
return get_viewport_rect().size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -920,7 +920,7 @@ AudioStreamPlayer3D::AudioStreamPlayer3D() {
|
|||
internal = memnew(AudioStreamPlayerInternal(this, callable_mp(this, &AudioStreamPlayer3D::play), callable_mp(this, &AudioStreamPlayer3D::stop), true));
|
||||
velocity_tracker.instantiate();
|
||||
set_disable_scale(true);
|
||||
cached_global_panning_strength = GLOBAL_GET("audio/general/3d_panning_strength");
|
||||
cached_global_panning_strength = GLOBAL_GET_CACHED(float, "audio/general/3d_panning_strength");
|
||||
}
|
||||
|
||||
AudioStreamPlayer3D::~AudioStreamPlayer3D() {
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ uint32_t Light3D::get_cull_mask() const {
|
|||
void Light3D::set_color(const Color &p_color) {
|
||||
color = p_color;
|
||||
|
||||
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
Color combined = color.srgb_to_linear();
|
||||
combined *= correlated_color.srgb_to_linear();
|
||||
RS::get_singleton()->light_set_color(light, combined.linear_to_srgb());
|
||||
|
|
@ -257,7 +257,7 @@ Color _color_from_temperature(float p_temperature) {
|
|||
|
||||
void Light3D::set_temperature(const float p_temperature) {
|
||||
temperature = p_temperature;
|
||||
if (!GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
return;
|
||||
}
|
||||
correlated_color = _color_from_temperature(temperature);
|
||||
|
|
@ -334,7 +334,7 @@ void Light3D::_validate_property(PropertyInfo &p_property) const {
|
|||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
if (!GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units") && (p_property.name == "light_intensity_lumens" || p_property.name == "light_intensity_lux" || p_property.name == "light_temperature")) {
|
||||
if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units") && (p_property.name == "light_intensity_lumens" || p_property.name == "light_intensity_lux" || p_property.name == "light_temperature")) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ OccluderInstance3D::BakeError OccluderInstance3D::bake_scene(Node *p_from_node,
|
|||
PackedStringArray OccluderInstance3D::get_configuration_warnings() const {
|
||||
PackedStringArray warnings = VisualInstance3D::get_configuration_warnings();
|
||||
|
||||
if (!bool(GLOBAL_GET("rendering/occlusion_culling/use_occlusion_culling"))) {
|
||||
if (!bool(GLOBAL_GET_CACHED(bool, "rendering/occlusion_culling/use_occlusion_culling"))) {
|
||||
warnings.push_back(RTR("Occlusion culling is disabled in the Project Settings, which means occlusion culling won't be performed in the root viewport.\nTo resolve this, open the Project Settings and enable Rendering > Occlusion Culling > Use Occlusion Culling."));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ float VoxelGI::_get_camera_exposure_normalization() {
|
|||
float exposure_normalization = 1.0;
|
||||
if (camera_attributes.is_valid()) {
|
||||
exposure_normalization = camera_attributes->get_exposure_multiplier();
|
||||
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
exposure_normalization = camera_attributes->calculate_exposure_normalization();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ Voxelizer::MaterialCache Voxelizer::_get_material_cache(Ref<Material> p_material
|
|||
|
||||
Color emission_col = mat->get_emission();
|
||||
float emission_energy = mat->get_emission_energy_multiplier() * exposure_normalization;
|
||||
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
emission_energy *= mat->get_emission_intensity();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -636,8 +636,8 @@ bool AnimationMixer::_update_caches() {
|
|||
List<StringName> sname_list;
|
||||
get_animation_list(&sname_list);
|
||||
|
||||
bool check_path = GLOBAL_GET("animation/warnings/check_invalid_track_paths");
|
||||
bool check_angle_interpolation = GLOBAL_GET("animation/warnings/check_angle_interpolation_type_conflicting");
|
||||
bool check_path = GLOBAL_GET_CACHED(bool, "animation/warnings/check_invalid_track_paths");
|
||||
bool check_angle_interpolation = GLOBAL_GET_CACHED(bool, "animation/warnings/check_angle_interpolation_type_conflicting");
|
||||
|
||||
Node *parent = get_node_or_null(root_node);
|
||||
if (!parent) {
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ void BaseButton::shortcut_input(const Ref<InputEvent> &p_event) {
|
|||
shortcut_feedback_timer = memnew(Timer);
|
||||
shortcut_feedback_timer->set_one_shot(true);
|
||||
add_child(shortcut_feedback_timer);
|
||||
shortcut_feedback_timer->set_wait_time(GLOBAL_GET("gui/timers/button_shortcut_feedback_highlight_time"));
|
||||
shortcut_feedback_timer->set_wait_time(GLOBAL_GET_CACHED(double, "gui/timers/button_shortcut_feedback_highlight_time"));
|
||||
shortcut_feedback_timer->connect("timeout", callable_mp(this, &BaseButton::_shortcut_feedback_timeout));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include "scene/theme/theme_db.h"
|
||||
|
||||
void CodeEdit::_apply_project_settings() {
|
||||
symbol_tooltip_timer->set_wait_time(GLOBAL_GET("gui/timers/tooltip_delay_sec"));
|
||||
symbol_tooltip_timer->set_wait_time(GLOBAL_GET_CACHED(double, "gui/timers/tooltip_delay_sec"));
|
||||
}
|
||||
|
||||
void CodeEdit::_notification(int p_what) {
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ Rect2 Control::get_parent_anchorable_rect() const {
|
|||
Node *scene_root_parent = edited_scene_root ? edited_scene_root->get_parent() : nullptr;
|
||||
|
||||
if (scene_root_parent && get_viewport() == scene_root_parent->get_viewport()) {
|
||||
parent_rect.size = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));
|
||||
parent_rect.size = Size2(GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_width"), GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_height"));
|
||||
} else {
|
||||
parent_rect = get_viewport()->get_visible_rect();
|
||||
}
|
||||
|
|
@ -3391,14 +3391,14 @@ bool Control::is_layout_rtl() const {
|
|||
data.is_rtl_dirty = false;
|
||||
if (data.layout_dir == LAYOUT_DIRECTION_INHERITED) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (is_part_of_edited_scene() && GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (is_part_of_edited_scene() && GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
data.is_rtl = true;
|
||||
return data.is_rtl;
|
||||
}
|
||||
if (is_inside_tree()) {
|
||||
Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
||||
if (edited_scene_root == this) {
|
||||
int proj_root_layout_direction = GLOBAL_GET(SNAME("internationalization/rendering/root_node_layout_direction"));
|
||||
int proj_root_layout_direction = GLOBAL_GET_CACHED(int, "internationalization/rendering/root_node_layout_direction");
|
||||
if (proj_root_layout_direction == 1) {
|
||||
data.is_rtl = false;
|
||||
} else if (proj_root_layout_direction == 2) {
|
||||
|
|
@ -3414,7 +3414,7 @@ bool Control::is_layout_rtl() const {
|
|||
}
|
||||
}
|
||||
#else
|
||||
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
data.is_rtl = true;
|
||||
return data.is_rtl;
|
||||
}
|
||||
|
|
@ -3447,14 +3447,14 @@ bool Control::is_layout_rtl() const {
|
|||
data.is_rtl = TS->is_locale_right_to_left(locale);
|
||||
}
|
||||
} else if (data.layout_dir == LAYOUT_DIRECTION_APPLICATION_LOCALE) {
|
||||
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
data.is_rtl = true;
|
||||
} else {
|
||||
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
||||
data.is_rtl = TS->is_locale_right_to_left(locale);
|
||||
}
|
||||
} else if (data.layout_dir == LAYOUT_DIRECTION_SYSTEM_LOCALE) {
|
||||
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
const_cast<Control *>(this)->data.is_rtl = true;
|
||||
} else {
|
||||
String locale = OS::get_singleton()->get_locale();
|
||||
|
|
|
|||
|
|
@ -921,7 +921,7 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) {
|
|||
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
||||
uint64_t diff = now - search_time_msec;
|
||||
|
||||
if (diff < uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec")) * 2) {
|
||||
if (diff < uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec")) * 2) {
|
||||
for (int i = current - 1; i >= 0; i--) {
|
||||
if (CAN_SELECT(i) && items[i].text.begins_with(search_string)) {
|
||||
set_current(i);
|
||||
|
|
@ -968,7 +968,7 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) {
|
|||
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
||||
uint64_t diff = now - search_time_msec;
|
||||
|
||||
if (diff < uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec")) * 2) {
|
||||
if (diff < uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec")) * 2) {
|
||||
for (int i = current + 1; i < items.size(); i++) {
|
||||
if (CAN_SELECT(i) && items[i].text.begins_with(search_string)) {
|
||||
set_current(i);
|
||||
|
|
@ -1113,7 +1113,7 @@ void ItemList::gui_input(const Ref<InputEvent> &p_event) {
|
|||
if (allow_search && k.is_valid() && k->get_unicode()) {
|
||||
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
||||
uint64_t diff = now - search_time_msec;
|
||||
uint64_t max_interval = uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec"));
|
||||
uint64_t max_interval = uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec"));
|
||||
search_time_msec = now;
|
||||
|
||||
if (diff > max_interval) {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ Popup::~Popup() {
|
|||
PackedStringArray PopupPanel::get_configuration_warnings() const {
|
||||
PackedStringArray warnings = Popup::get_configuration_warnings();
|
||||
|
||||
if (!DisplayServer::get_singleton()->is_window_transparency_available() && !GLOBAL_GET("display/window/subwindows/embed_subwindows")) {
|
||||
if (!DisplayServer::get_singleton()->is_window_transparency_available() && !GLOBAL_GET_CACHED(bool, "display/window/subwindows/embed_subwindows")) {
|
||||
Ref<StyleBoxFlat> sb = theme_cache.panel_style;
|
||||
if (sb.is_valid() && (sb->get_shadow_size() > 0 || sb->get_corner_radius(CORNER_TOP_LEFT) > 0 || sb->get_corner_radius(CORNER_TOP_RIGHT) > 0 || sb->get_corner_radius(CORNER_BOTTOM_LEFT) > 0 || sb->get_corner_radius(CORNER_BOTTOM_RIGHT) > 0)) {
|
||||
warnings.push_back(RTR("The current theme style has shadows and/or rounded corners for popups, but those won't display correctly if \"display/window/per_pixel_transparency/allowed\" isn't enabled in the Project Settings, nor if it isn't supported."));
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
|||
if (allow_search && k.is_valid() && k->get_unicode() && k->is_pressed()) {
|
||||
uint64_t now = OS::get_singleton()->get_ticks_msec();
|
||||
uint64_t diff = now - search_time_msec;
|
||||
uint64_t max_interval = uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec"));
|
||||
uint64_t max_interval = uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec"));
|
||||
search_time_msec = now;
|
||||
|
||||
if (diff > max_interval) {
|
||||
|
|
@ -2905,7 +2905,7 @@ String PopupMenu::get_tooltip(const Point2 &p_pos) const {
|
|||
PackedStringArray PopupMenu::get_configuration_warnings() const {
|
||||
PackedStringArray warnings = Popup::get_configuration_warnings();
|
||||
|
||||
if (!DisplayServer::get_singleton()->is_window_transparency_available() && !GLOBAL_GET("display/window/subwindows/embed_subwindows")) {
|
||||
if (!DisplayServer::get_singleton()->is_window_transparency_available() && !GLOBAL_GET_CACHED(bool, "display/window/subwindows/embed_subwindows")) {
|
||||
Ref<StyleBoxFlat> sb = theme_cache.panel_style;
|
||||
if (sb.is_valid() && (sb->get_shadow_size() > 0 || sb->get_corner_radius(CORNER_TOP_LEFT) > 0 || sb->get_corner_radius(CORNER_TOP_RIGHT) > 0 || sb->get_corner_radius(CORNER_BOTTOM_LEFT) > 0 || sb->get_corner_radius(CORNER_BOTTOM_RIGHT) > 0)) {
|
||||
warnings.push_back(RTR("The current theme style has shadows and/or rounded corners for popups, but those won't display correctly if \"display/window/per_pixel_transparency/allowed\" isn't enabled in the Project Settings, nor if it isn't supported."));
|
||||
|
|
|
|||
|
|
@ -824,7 +824,7 @@ ScrollContainer::ScrollContainer() {
|
|||
focus_panel->set_visible(draw_focus_border);
|
||||
add_child(focus_panel, false, INTERNAL_MODE_BACK);
|
||||
|
||||
deadzone = GLOBAL_GET("gui/common/default_scroll_deadzone");
|
||||
deadzone = GLOBAL_GET_CACHED(int, "gui/common/default_scroll_deadzone");
|
||||
|
||||
set_clip_contents(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9127,10 +9127,10 @@ TextEdit::TextEdit(const String &p_placeholder) {
|
|||
idle_detect = memnew(Timer);
|
||||
add_child(idle_detect, false, INTERNAL_MODE_FRONT);
|
||||
idle_detect->set_one_shot(true);
|
||||
idle_detect->set_wait_time(GLOBAL_GET("gui/timers/text_edit_idle_detect_sec"));
|
||||
idle_detect->set_wait_time(GLOBAL_GET_CACHED(double, "gui/timers/text_edit_idle_detect_sec"));
|
||||
idle_detect->connect("timeout", callable_mp(this, &TextEdit::_push_current_op));
|
||||
|
||||
undo_stack_max_size = GLOBAL_GET("gui/common/text_edit_undo_stack_max_size");
|
||||
undo_stack_max_size = GLOBAL_GET_CACHED(int, "gui/common/text_edit_undo_stack_max_size");
|
||||
|
||||
set_placeholder(p_placeholder);
|
||||
|
||||
|
|
|
|||
|
|
@ -5960,7 +5960,7 @@ TreeItem *Tree::get_item_with_metadata(const Variant &p_find, int p_column) cons
|
|||
void Tree::_do_incr_search(const String &p_add) {
|
||||
uint64_t time = OS::get_singleton()->get_ticks_usec() / 1000; // Convert to msec.
|
||||
uint64_t diff = time - last_keypress;
|
||||
if (diff > uint64_t(GLOBAL_GET("gui/timers/incremental_search_max_interval_msec"))) {
|
||||
if (diff > uint64_t(GLOBAL_GET_CACHED(uint64_t, "gui/timers/incremental_search_max_interval_msec"))) {
|
||||
incr_search = p_add;
|
||||
} else if (incr_search != p_add) {
|
||||
incr_search += p_add;
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ bool SceneTree::process(double p_time) {
|
|||
#ifdef TOOLS_ENABLED
|
||||
#ifndef _3D_DISABLED
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
String env_path = GLOBAL_GET(SNAME("rendering/environment/defaults/default_environment"));
|
||||
String env_path = GLOBAL_GET("rendering/environment/defaults/default_environment");
|
||||
env_path = env_path.strip_edges(); // User may have added a space or two.
|
||||
|
||||
bool can_load = true;
|
||||
|
|
|
|||
|
|
@ -1661,7 +1661,7 @@ void Viewport::_gui_show_tooltip_at(const Point2i &p_pos) {
|
|||
}
|
||||
Size2 scale = get_popup_base_transform().get_scale();
|
||||
real_t popup_scale = MIN(scale.x, scale.y);
|
||||
Point2 tooltip_offset = GLOBAL_GET("display/mouse_cursor/tooltip_position_offset");
|
||||
Point2 tooltip_offset = GLOBAL_GET_CACHED(Point2, "display/mouse_cursor/tooltip_position_offset");
|
||||
tooltip_offset *= popup_scale;
|
||||
Rect2 r(gui.tooltip_pos + tooltip_offset, gui.tooltip_popup->get_contents_minimum_size());
|
||||
Rect2i vr;
|
||||
|
|
|
|||
|
|
@ -953,7 +953,7 @@ void Window::set_visible(bool p_visible) {
|
|||
embedder = embedder_vp;
|
||||
if (initial_position != WINDOW_INITIAL_POSITION_ABSOLUTE) {
|
||||
if (is_in_edited_scene_root()) {
|
||||
Size2 screen_size = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));
|
||||
Size2 screen_size = Size2(GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_width"), GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_height"));
|
||||
position = (screen_size - size) / 2;
|
||||
} else {
|
||||
position = (embedder->get_visible_rect().size - size) / 2;
|
||||
|
|
@ -1483,7 +1483,7 @@ void Window::_notification(int p_what) {
|
|||
if (embedder) {
|
||||
if (initial_position != WINDOW_INITIAL_POSITION_ABSOLUTE) {
|
||||
if (is_in_edited_scene_root()) {
|
||||
Size2 screen_size = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));
|
||||
Size2 screen_size = Size2(GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_width"), GLOBAL_GET_CACHED(real_t, "display/window/size/viewport_height"));
|
||||
position = (screen_size - size) / 2;
|
||||
} else {
|
||||
position = (embedder->get_visible_rect().size - size) / 2;
|
||||
|
|
@ -2853,13 +2853,13 @@ bool Window::is_layout_rtl() const {
|
|||
ERR_READ_THREAD_GUARD_V(false);
|
||||
if (layout_dir == LAYOUT_DIRECTION_INHERITED) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (is_part_of_edited_scene() && GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (is_part_of_edited_scene() && GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
return true;
|
||||
}
|
||||
if (is_inside_tree()) {
|
||||
Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
||||
if (edited_scene_root == this) {
|
||||
int proj_root_layout_direction = GLOBAL_GET(SNAME("internationalization/rendering/root_node_layout_direction"));
|
||||
int proj_root_layout_direction = GLOBAL_GET_CACHED(int, "internationalization/rendering/root_node_layout_direction");
|
||||
if (proj_root_layout_direction == 1) {
|
||||
return false;
|
||||
} else if (proj_root_layout_direction == 2) {
|
||||
|
|
@ -2874,7 +2874,7 @@ bool Window::is_layout_rtl() const {
|
|||
}
|
||||
}
|
||||
#else
|
||||
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2904,14 +2904,14 @@ bool Window::is_layout_rtl() const {
|
|||
return TS->is_locale_right_to_left(locale);
|
||||
}
|
||||
} else if (layout_dir == LAYOUT_DIRECTION_APPLICATION_LOCALE) {
|
||||
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
return true;
|
||||
} else {
|
||||
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
||||
return TS->is_locale_right_to_left(locale);
|
||||
}
|
||||
} else if (layout_dir == LAYOUT_DIRECTION_SYSTEM_LOCALE) {
|
||||
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||
if (GLOBAL_GET_CACHED(bool, "internationalization/rendering/force_right_to_left_layout_direction")) {
|
||||
return true;
|
||||
} else {
|
||||
String locale = OS::get_singleton()->get_locale();
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ void Shape2D::_bind_methods() {
|
|||
}
|
||||
|
||||
bool Shape2D::is_collision_outline_enabled() {
|
||||
return GLOBAL_GET("debug/shapes/collision/draw_2d_outlines");
|
||||
return GLOBAL_GET_CACHED(bool, "debug/shapes/collision/draw_2d_outlines");
|
||||
}
|
||||
|
||||
Shape2D::Shape2D(const RID &p_rid) {
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ PrimitiveMesh::PrimitiveMesh() {
|
|||
mesh = RenderingServer::get_singleton()->mesh_create();
|
||||
|
||||
ERR_FAIL_NULL(ProjectSettings::get_singleton());
|
||||
texel_size = float(GLOBAL_GET("rendering/lightmapping/primitive_meshes/texel_size"));
|
||||
texel_size = float(GLOBAL_GET_CACHED(float, "rendering/lightmapping/primitive_meshes/texel_size"));
|
||||
if (texel_size <= 0.0) {
|
||||
texel_size = 0.2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ RID ProceduralSkyMaterial::get_shader_rid() const {
|
|||
}
|
||||
|
||||
void ProceduralSkyMaterial::_validate_property(PropertyInfo &p_property) const {
|
||||
if ((p_property.name == "sky_luminance" || p_property.name == "ground_luminance") && !GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if ((p_property.name == "sky_luminance" || p_property.name == "ground_luminance") && !GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
|
|
@ -652,7 +652,7 @@ RID PhysicalSkyMaterial::get_shader_rid() const {
|
|||
}
|
||||
|
||||
void PhysicalSkyMaterial::_validate_property(PropertyInfo &p_property) const {
|
||||
if (p_property.name == "exposure_value" && !GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (p_property.name == "exposure_value" && !GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ float CameraAttributes::get_exposure_sensitivity() const {
|
|||
void CameraAttributes::_update_exposure() {
|
||||
float exposure_normalization = 1.0;
|
||||
// Ignore physical properties if not using physical light units.
|
||||
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
exposure_normalization = calculate_exposure_normalization();
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ RID CameraAttributes::get_rid() const {
|
|||
}
|
||||
|
||||
void CameraAttributes::_validate_property(PropertyInfo &p_property) const {
|
||||
if (!GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units") && p_property.name == "exposure_sensitivity") {
|
||||
if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units") && p_property.name == "exposure_sensitivity") {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
|
||||
return;
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ void CameraAttributesPhysical::_update_auto_exposure() {
|
|||
}
|
||||
|
||||
void CameraAttributesPhysical::_validate_property(PropertyInfo &property) const {
|
||||
if (!GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units") && (property.name == "exposure_aperture" || property.name == "exposure_shutter_speed")) {
|
||||
if (!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units") && (property.name == "exposure_aperture" || property.name == "exposure_shutter_speed")) {
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ float Environment::get_bg_intensity() const {
|
|||
}
|
||||
|
||||
void Environment::_update_bg_energy() {
|
||||
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
RS::get_singleton()->environment_set_bg_energy(environment, bg_energy_multiplier, bg_intensity);
|
||||
} else {
|
||||
RS::get_singleton()->environment_set_bg_energy(environment, bg_energy_multiplier, 1.0);
|
||||
|
|
@ -1158,7 +1158,7 @@ void Environment::_validate_property(PropertyInfo &p_property) const {
|
|||
}
|
||||
}
|
||||
|
||||
if (p_property.name == "background_intensity" && !GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (p_property.name == "background_intensity" && !GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2068,7 +2068,7 @@ Color BaseMaterial3D::get_emission() const {
|
|||
void BaseMaterial3D::set_emission_energy_multiplier(float p_emission_energy_multiplier) {
|
||||
emission_energy_multiplier = p_emission_energy_multiplier;
|
||||
|
||||
if (GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
_material_set_param(shader_names->emission_energy, p_emission_energy_multiplier * emission_intensity);
|
||||
} else {
|
||||
_material_set_param(shader_names->emission_energy, p_emission_energy_multiplier);
|
||||
|
|
@ -2080,7 +2080,7 @@ float BaseMaterial3D::get_emission_energy_multiplier() const {
|
|||
}
|
||||
|
||||
void BaseMaterial3D::set_emission_intensity(float p_emission_intensity) {
|
||||
ERR_FAIL_COND_EDMSG(!GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units"), "Cannot set material emission intensity when Physical Light Units disabled.");
|
||||
ERR_FAIL_COND_EDMSG(!GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units"), "Cannot set material emission intensity when Physical Light Units disabled.");
|
||||
emission_intensity = p_emission_intensity;
|
||||
_material_set_param(shader_names->emission_energy, emission_energy_multiplier * emission_intensity);
|
||||
}
|
||||
|
|
@ -2449,7 +2449,7 @@ void BaseMaterial3D::_validate_property(PropertyInfo &p_property) const {
|
|||
_validate_feature("refraction", FEATURE_REFRACTION, p_property);
|
||||
_validate_feature("detail", FEATURE_DETAIL, p_property);
|
||||
|
||||
if (p_property.name == "emission_intensity" && !GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
if (p_property.name == "emission_intensity" && !GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/use_physical_light_units")) {
|
||||
p_property.usage = PROPERTY_USAGE_NONE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ void PortableCompressedTexture2D::create_from_image(const Ref<Image> &p_image, C
|
|||
switch (p_compression_mode) {
|
||||
case COMPRESSION_MODE_LOSSLESS:
|
||||
case COMPRESSION_MODE_LOSSY: {
|
||||
bool lossless_force_png = GLOBAL_GET("rendering/textures/lossless_compression/force_png") ||
|
||||
bool lossless_force_png = GLOBAL_GET_CACHED(bool, "rendering/textures/lossless_compression/force_png") ||
|
||||
!Image::_webp_mem_loader_func; // WebP module disabled.
|
||||
bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit.
|
||||
for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) {
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ void AudioStreamPlaybackMicrophone::start(double p_from_pos) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!GLOBAL_GET("audio/driver/enable_input")) {
|
||||
if (!GLOBAL_GET_CACHED(bool, "audio/driver/enable_input")) {
|
||||
WARN_PRINT("You must enable the project setting \"audio/driver/enable_input\" to use audio capture.");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1862,7 +1862,7 @@ void AudioServer::get_argument_options(const StringName &p_function, int p_idx,
|
|||
#endif
|
||||
|
||||
AudioServer::PlaybackType AudioServer::get_default_playback_type() const {
|
||||
int playback_type = GLOBAL_GET("audio/general/default_playback_type");
|
||||
int playback_type = GLOBAL_GET_CACHED(int, "audio/general/default_playback_type");
|
||||
ERR_FAIL_COND_V_MSG(
|
||||
playback_type < 0 || playback_type >= PlaybackType::PLAYBACK_TYPE_MAX,
|
||||
PlaybackType::PLAYBACK_TYPE_STREAM,
|
||||
|
|
|
|||
|
|
@ -2041,7 +2041,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
|
|||
|
||||
bool debug_voxelgis = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_VOXEL_GI_ALBEDO || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_VOXEL_GI_LIGHTING || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_VOXEL_GI_EMISSION;
|
||||
bool debug_sdfgi_probes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SDFGI_PROBES;
|
||||
bool depth_pre_pass = bool(GLOBAL_GET("rendering/driver/depth_prepass/enable")) && depth_framebuffer.is_valid();
|
||||
bool depth_pre_pass = bool(GLOBAL_GET_CACHED(bool, "rendering/driver/depth_prepass/enable")) && depth_framebuffer.is_valid();
|
||||
|
||||
SceneShaderForwardClustered::ShaderSpecialization base_specialization = scene_shader.default_specialization;
|
||||
base_specialization.use_depth_fog = p_render_data->environment.is_valid() && environment_get_fog_mode(p_render_data->environment) == RS::EnvironmentFogMode::ENV_FOG_MODE_DEPTH;
|
||||
|
|
@ -3932,9 +3932,9 @@ void RenderForwardClustered::GeometryInstanceForwardClustered::_mark_dirty() {
|
|||
}
|
||||
|
||||
void RenderForwardClustered::_update_global_pipeline_data_requirements_from_project() {
|
||||
const int msaa_3d_mode = GLOBAL_GET("rendering/anti_aliasing/quality/msaa_3d");
|
||||
const bool directional_shadow_16_bits = GLOBAL_GET("rendering/lights_and_shadows/directional_shadow/16_bits");
|
||||
const bool positional_shadow_16_bits = GLOBAL_GET("rendering/lights_and_shadows/positional_shadow/atlas_16_bits");
|
||||
const int msaa_3d_mode = GLOBAL_GET_CACHED(int, "rendering/anti_aliasing/quality/msaa_3d");
|
||||
const bool directional_shadow_16_bits = GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/directional_shadow/16_bits");
|
||||
const bool positional_shadow_16_bits = GLOBAL_GET_CACHED(bool, "rendering/lights_and_shadows/positional_shadow/atlas_16_bits");
|
||||
global_pipeline_data_required.use_16_bit_shadows = directional_shadow_16_bits || positional_shadow_16_bits;
|
||||
global_pipeline_data_required.use_32_bit_shadows = !directional_shadow_16_bits || !positional_shadow_16_bits;
|
||||
global_pipeline_data_required.texture_samples = RenderSceneBuffersRD::msaa_to_samples(RS::ViewportMSAA(msaa_3d_mode));
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ void SceneShaderForwardClustered::ShaderData::_create_pipeline(PipelineKey p_pip
|
|||
depth_stencil_state.depth_compare_operator = RD::COMPARE_OP_GREATER_OR_EQUAL;
|
||||
depth_stencil_state.enable_depth_write = depth_draw != DEPTH_DRAW_DISABLED ? true : false;
|
||||
}
|
||||
bool depth_pre_pass_enabled = bool(GLOBAL_GET("rendering/driver/depth_prepass/enable"));
|
||||
bool depth_pre_pass_enabled = bool(GLOBAL_GET_CACHED(bool, "rendering/driver/depth_prepass/enable"));
|
||||
|
||||
RD::RenderPrimitive primitive_rd_table[RS::PRIMITIVE_MAX] = {
|
||||
RD::RENDER_PRIMITIVE_POINTS,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void RendererCompositorRD::begin_frame(double frame_step) {
|
|||
delta = frame_step;
|
||||
time += frame_step;
|
||||
|
||||
double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs");
|
||||
double time_roll_over = GLOBAL_GET_CACHED(double, "rendering/limits/time/time_rollover_secs");
|
||||
time = Math::fmod(time, time_roll_over);
|
||||
|
||||
canvas->set_time(time);
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ void RendererSceneRenderRD::render_scene(const Ref<RenderSceneBuffers> &p_render
|
|||
|
||||
// Also, take into account resolution scaling for the multiplier, since we have more leeway with quality
|
||||
// degradation visibility. Conversely, allow upwards scaling, too, for increased mesh detail at high res.
|
||||
const float scaling_3d_scale = GLOBAL_GET("rendering/scaling_3d/scale");
|
||||
const float scaling_3d_scale = GLOBAL_GET_CACHED(float, "rendering/scaling_3d/scale");
|
||||
scene_data.lod_distance_multiplier = lod_distance_multiplier * (1.0 / scaling_3d_scale);
|
||||
|
||||
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD) {
|
||||
|
|
@ -1480,7 +1480,7 @@ bool RendererSceneRenderRD::is_volumetric_supported() const {
|
|||
}
|
||||
|
||||
uint32_t RendererSceneRenderRD::get_max_elements() const {
|
||||
return GLOBAL_GET("rendering/limits/cluster_builder/max_clustered_elements");
|
||||
return GLOBAL_GET_CACHED(uint32_t, "rendering/limits/cluster_builder/max_clustered_elements");
|
||||
}
|
||||
|
||||
RendererSceneRenderRD::RendererSceneRenderRD() {
|
||||
|
|
|
|||
|
|
@ -2374,7 +2374,7 @@ MaterialStorage::Samplers MaterialStorage::samplers_rd_allocate(float p_mipmap_b
|
|||
Samplers samplers;
|
||||
samplers.mipmap_bias = p_mipmap_bias;
|
||||
samplers.anisotropic_filtering_level = (int)anisotropic_filtering_level;
|
||||
samplers.use_nearest_mipmap_filter = GLOBAL_GET("rendering/textures/default_filters/use_nearest_mipmap_filter");
|
||||
samplers.use_nearest_mipmap_filter = GLOBAL_GET_CACHED(bool, "rendering/textures/default_filters/use_nearest_mipmap_filter");
|
||||
|
||||
RD::SamplerFilter mip_filter = samplers.use_nearest_mipmap_filter ? RD::SAMPLER_FILTER_NEAREST : RD::SAMPLER_FILTER_LINEAR;
|
||||
float anisotropy_max = float(1 << samplers.anisotropic_filtering_level);
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
|||
#endif // XR_DISABLED
|
||||
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
RSG::texture_storage->set_default_clear_color(GLOBAL_GET("rendering/environment/defaults/default_clear_color"));
|
||||
RSG::texture_storage->set_default_clear_color(GLOBAL_GET_CACHED(Color, "rendering/environment/defaults/default_clear_color"));
|
||||
}
|
||||
|
||||
if (sorted_active_viewports_dirty) {
|
||||
|
|
|
|||
|
|
@ -4210,7 +4210,7 @@ bool RenderingDevice::compute_pipeline_is_valid(RID p_pipeline) {
|
|||
/****************/
|
||||
|
||||
uint32_t RenderingDevice::_get_swap_chain_desired_count() const {
|
||||
return MAX(2U, uint32_t(GLOBAL_GET("rendering/rendering_device/vsync/swapchain_image_count")));
|
||||
return MAX(2U, uint32_t(GLOBAL_GET_CACHED(uint32_t, "rendering/rendering_device/vsync/swapchain_image_count")));
|
||||
}
|
||||
|
||||
Error RenderingDevice::screen_create(DisplayServer::WindowID p_screen) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue