From cd0aaab48c789cbca3e6ddfa5e0daf1e4cb6b0db Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 24 Aug 2023 22:39:40 +0200 Subject: [PATCH] Cleanup some GLOBAL_DEFs --- core/config/project_settings.cpp | 2 ++ doc/classes/ProjectSettings.xml | 3 +++ editor/gui/editor_run_bar.cpp | 2 +- editor/import/editor_import_collada.cpp | 2 +- modules/webrtc/register_types.cpp | 8 +------- modules/webrtc/webrtc_data_channel.cpp | 2 +- modules/webrtc/webrtc_data_channel.h | 2 -- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 9ffbac3553e8..5ba800ebfeeb 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1398,6 +1398,8 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0); + GLOBAL_DEF("collada/use_ambient", false); + // These properties will not show up in the dialog. If you want to exclude whole groups, use add_hidden_prefix(). GLOBAL_DEF_INTERNAL("application/config/features", PackedStringArray()); GLOBAL_DEF_INTERNAL("internationalization/locale/translation_remaps", PackedStringArray()); diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 6f900e06dd1b..87c642c6d30c 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -400,6 +400,9 @@ Setting to hardcode audio delay when playing video. Best to leave this untouched unless you know what you are doing. + + If [code]true[/code], ambient lights will be imported from COLLADA models as [DirectionalLight3D]. If [code]false[/code], ambient lights will be ignored. + The default compression level for gzip. Affects compressed scenes and resources. Higher levels result in smaller files at the cost of compression speed. Decompression speed is mostly unaffected by the compression level. [code]-1[/code] uses the default gzip compression level, which is identical to [code]6[/code] but could change in the future due to underlying zlib updates. diff --git a/editor/gui/editor_run_bar.cpp b/editor/gui/editor_run_bar.cpp index 4dfe40f0ad61..497c92d9517d 100644 --- a/editor/gui/editor_run_bar.cpp +++ b/editor/gui/editor_run_bar.cpp @@ -220,7 +220,7 @@ void EditorRunBar::_run_scene(const String &p_scene_path) { return; } - run_filename = GLOBAL_DEF_BASIC("application/run/main_scene", ""); + run_filename = GLOBAL_GET("application/run/main_scene"); } break; } diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 5f714e448855..62343777a9dd 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -208,7 +208,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) { return OK; //do nothing not needed } - if (!bool(GLOBAL_DEF("collada/use_ambient", false))) { + if (!bool(GLOBAL_GET("collada/use_ambient"))) { return OK; } //well, it's an ambient light.. diff --git a/modules/webrtc/register_types.cpp b/modules/webrtc/register_types.cpp index 687c7b711eea..28ce36f1e812 100644 --- a/modules/webrtc/register_types.cpp +++ b/modules/webrtc/register_types.cpp @@ -42,11 +42,7 @@ void initialize_webrtc_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return; } - -#define SET_HINT(NAME, _VAL_, _MAX_) \ - GLOBAL_DEF(PropertyInfo(Variant::INT, NAME, PROPERTY_HINT_RANGE, "2," #_MAX_ ",1,or_greater"), _VAL_); - - SET_HINT(WRTC_IN_BUF, 64, 4096); + GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/webrtc/max_channel_in_buffer_kb", PROPERTY_HINT_RANGE, "2,4096,1,or_greater"), 64); ClassDB::register_custom_instance_class(); GDREGISTER_CLASS(WebRTCPeerConnectionExtension); @@ -55,8 +51,6 @@ void initialize_webrtc_module(ModuleInitializationLevel p_level) { GDREGISTER_CLASS(WebRTCDataChannelExtension); GDREGISTER_CLASS(WebRTCMultiplayerPeer); - -#undef SET_HINT } void uninitialize_webrtc_module(ModuleInitializationLevel p_level) { diff --git a/modules/webrtc/webrtc_data_channel.cpp b/modules/webrtc/webrtc_data_channel.cpp index bebf5c27413c..6c0d0bea37a4 100644 --- a/modules/webrtc/webrtc_data_channel.cpp +++ b/modules/webrtc/webrtc_data_channel.cpp @@ -61,7 +61,7 @@ void WebRTCDataChannel::_bind_methods() { } WebRTCDataChannel::WebRTCDataChannel() { - _in_buffer_shift = nearest_shift((int)GLOBAL_GET(WRTC_IN_BUF) - 1) + 10; + _in_buffer_shift = nearest_shift((int)GLOBAL_GET("network/limits/webrtc/max_channel_in_buffer_kb") - 1) + 10; } WebRTCDataChannel::~WebRTCDataChannel() { diff --git a/modules/webrtc/webrtc_data_channel.h b/modules/webrtc/webrtc_data_channel.h index e884c8425d41..f35461a5a0f3 100644 --- a/modules/webrtc/webrtc_data_channel.h +++ b/modules/webrtc/webrtc_data_channel.h @@ -33,8 +33,6 @@ #include "core/io/packet_peer.h" -#define WRTC_IN_BUF PNAME("network/limits/webrtc/max_channel_in_buffer_kb") - class WebRTCDataChannel : public PacketPeer { GDCLASS(WebRTCDataChannel, PacketPeer);