From 5f8663ec4b6f388637e462ca428c927779bd0c60 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 10 Jul 2021 20:28:05 +0200 Subject: [PATCH] Rename ProjectSettings macros to follow the singleton's rename The Globals singleton was renamed to ProjectSettings in 3.0. Additionally, this renames some of the macros to be more explicit (including for EditorSettings). This also adds comments above each macro, which will appear in many IDEs when hovering the macro names. --- core/config/project_settings.cpp | 58 ++--- core/config/project_settings.h | 60 ++++- core/debugger/remote_debugger.cpp | 8 +- core/debugger/remote_debugger_peer.cpp | 2 +- core/input/input.cpp | 2 +- core/io/file_access_network.cpp | 8 +- core/io/packet_peer.cpp | 2 +- core/io/stream_peer_tcp.cpp | 4 +- core/object/message_queue.cpp | 2 +- core/register_core_types.cpp | 6 +- core/string/translation.cpp | 4 +- drivers/alsa/audio_driver_alsa.cpp | 4 +- drivers/coreaudio/audio_driver_coreaudio.cpp | 8 +- .../pulseaudio/audio_driver_pulseaudio.cpp | 4 +- drivers/vulkan/rendering_device_vulkan.cpp | 8 +- drivers/wasapi/audio_driver_wasapi.cpp | 2 +- drivers/xaudio2/audio_driver_xaudio2.cpp | 4 +- editor/animation_track_editor.cpp | 2 +- editor/code_editor.cpp | 2 +- editor/debugger/editor_debugger_node.cpp | 6 +- editor/debugger/editor_profiler.cpp | 4 +- editor/debugger/editor_visual_profiler.cpp | 2 +- editor/editor_export.cpp | 4 +- editor/editor_feature_profile.cpp | 2 +- editor/editor_file_system.cpp | 6 +- editor/editor_help.cpp | 2 +- editor/editor_node.cpp | 116 +++++----- editor/editor_settings.cpp | 2 +- editor/editor_settings.h | 16 +- editor/fileserver/editor_file_server.cpp | 8 +- editor/filesystem_dock.cpp | 4 +- editor/import/editor_import_collada.cpp | 2 +- editor/node_3d_editor_gizmos.cpp | 54 ++--- .../animation_player_editor_plugin.cpp | 2 +- .../plugins/asset_library_editor_plugin.cpp | 8 +- editor/plugins/canvas_item_editor_plugin.cpp | 2 +- editor/plugins/mesh_library_editor_plugin.cpp | 2 +- editor/plugins/node_3d_editor_plugin.cpp | 18 +- editor/plugins/path_3d_editor_plugin.cpp | 2 +- editor/plugins/polygon_2d_editor_plugin.cpp | 2 +- editor/plugins/script_editor_plugin.cpp | 28 +-- editor/plugins/script_text_editor.cpp | 6 +- editor/plugins/shader_editor_plugin.cpp | 14 +- editor/plugins/theme_editor_preview.cpp | 4 +- editor/scene_tree_dock.cpp | 8 +- main/main.cpp | 218 +++++++++--------- modules/bullet/register_types.cpp | 2 +- modules/bullet/shape_bullet.cpp | 2 +- modules/bullet/space_bullet.cpp | 2 +- modules/csg/csg_gizmos.cpp | 2 +- modules/fbx/editor_scene_importer_fbx.cpp | 2 +- .../gdscript/editor/gdscript_highlighter.cpp | 6 +- modules/gdscript/gdscript.cpp | 12 +- modules/gdscript/gdscript_editor.cpp | 16 +- modules/gdscript/gdscript_parser.cpp | 4 +- .../gdscript_language_server.cpp | 8 +- .../gdscript_text_document.cpp | 2 +- modules/gridmap/grid_map_editor_plugin.cpp | 10 +- modules/lightmapper_rd/lightmapper_rd.cpp | 22 +- modules/lightmapper_rd/register_types.cpp | 22 +- modules/mono/csharp_script.cpp | 4 +- modules/mono/editor/editor_internal_calls.cpp | 4 +- modules/mono/mono_gd/gd_mono.cpp | 12 +- modules/raycast/raycast_occlusion_cull.cpp | 2 +- modules/visual_script/visual_script.cpp | 2 +- modules/webrtc/register_types.cpp | 2 +- modules/webrtc/webrtc_data_channel.cpp | 2 +- .../editor_debugger_server_websocket.cpp | 2 +- .../remote_debugger_peer_websocket.cpp | 2 +- platform/android/display_server_android.cpp | 2 +- platform/android/export/export.cpp | 14 +- platform/android/export/gradle_export_util.h | 2 +- platform/iphone/app_delegate.mm | 2 +- platform/iphone/display_layer.mm | 2 +- platform/iphone/display_server_iphone.mm | 6 +- platform/iphone/export/export.cpp | 2 +- .../iphone/godot_view_gesture_recognizer.mm | 2 +- platform/iphone/view_controller.mm | 2 +- .../javascript/audio_driver_javascript.cpp | 4 +- .../javascript/display_server_javascript.cpp | 2 +- platform/javascript/export/export.cpp | 14 +- platform/linuxbsd/display_server_x11.cpp | 4 +- platform/uwp/export/export.cpp | 8 +- platform/uwp/os_uwp.cpp | 2 +- platform/windows/export/export.cpp | 8 +- scene/3d/occluder_instance_3d.cpp | 2 +- scene/3d/xr_nodes.cpp | 2 +- scene/animation/animation_player.cpp | 2 +- scene/gui/control.cpp | 6 +- scene/gui/item_list.cpp | 4 +- scene/gui/line_edit.cpp | 8 +- scene/gui/popup_menu.cpp | 2 +- scene/gui/scroll_container.cpp | 4 +- scene/gui/text_edit.cpp | 8 +- scene/gui/tree.cpp | 2 +- scene/main/node.cpp | 6 +- scene/main/scene_tree.cpp | 48 ++-- scene/main/viewport.cpp | 2 +- scene/main/window.cpp | 4 +- scene/register_scene_types.cpp | 20 +- scene/resources/material.cpp | 2 +- scene/resources/shape_2d.cpp | 2 +- scene/resources/world_2d.cpp | 12 +- scene/resources/world_3d.cpp | 12 +- servers/audio/audio_driver_dummy.cpp | 4 +- servers/audio/audio_stream.cpp | 2 +- servers/audio_server.cpp | 14 +- .../physics_2d/physics_server_2d_wrap_mt.cpp | 2 +- servers/physics_2d/space_2d_sw.cpp | 6 +- .../physics_3d/physics_server_3d_wrap_mt.cpp | 2 +- servers/physics_3d/space_3d_sw.cpp | 6 +- servers/register_server_types.cpp | 10 +- servers/rendering/renderer_compositor.cpp | 2 +- servers/rendering/renderer_rd/effects_rd.cpp | 2 +- .../render_forward_clustered.cpp | 2 +- .../scene_shader_forward_clustered.cpp | 4 +- .../forward_mobile/render_forward_mobile.cpp | 2 +- .../scene_shader_forward_mobile.cpp | 4 +- .../renderer_rd/renderer_canvas_render_rd.cpp | 2 +- .../renderer_rd/renderer_compositor_rd.cpp | 12 +- .../renderer_rd/renderer_scene_gi_rd.cpp | 10 +- .../renderer_rd/renderer_scene_render_rd.cpp | 42 ++-- .../renderer_rd/renderer_scene_sky_rd.cpp | 6 +- .../renderer_rd/renderer_storage_rd.cpp | 8 +- .../renderer_rd/shader_compiler_rd.cpp | 4 +- servers/rendering/renderer_scene_cull.cpp | 4 +- servers/rendering/renderer_viewport.cpp | 4 +- servers/rendering_server.cpp | 166 ++++++------- 128 files changed, 733 insertions(+), 687 deletions(-) diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 29f53482fa08..ad809fce35a4 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -510,19 +510,19 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards) { Error err = _setup(p_path, p_main_pack, p_upwards); if (err == OK) { - String custom_settings = GLOBAL_DEF("application/config/project_settings_override", ""); + String custom_settings = PROJECT_DEFAULT("application/config/project_settings_override", ""); if (custom_settings != "") { _load_settings_text(custom_settings); } } - // Using GLOBAL_GET on every block for compressing can be slow, so assigning here. - Compression::zstd_long_distance_matching = GLOBAL_GET("compression/formats/zstd/long_distance_matching"); - Compression::zstd_level = GLOBAL_GET("compression/formats/zstd/compression_level"); - Compression::zstd_window_log_size = GLOBAL_GET("compression/formats/zstd/window_log_size"); + // Using PROJECT_GET on every block for compressing can be slow, so assigning here. + Compression::zstd_long_distance_matching = PROJECT_GET("compression/formats/zstd/long_distance_matching"); + Compression::zstd_level = PROJECT_GET("compression/formats/zstd/compression_level"); + Compression::zstd_window_log_size = PROJECT_GET("compression/formats/zstd/window_log_size"); - Compression::zlib_level = GLOBAL_GET("compression/formats/zlib/compression_level"); + Compression::zlib_level = PROJECT_GET("compression/formats/zlib/compression_level"); - Compression::gzip_level = GLOBAL_GET("compression/formats/gzip/compression_level"); + Compression::gzip_level = PROJECT_GET("compression/formats/gzip/compression_level"); return err; } @@ -913,7 +913,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust } } -Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic) { +Variant _PROJECT_DEFAULT(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic) { Variant ret; if (!ProjectSettings::get_singleton()->has_setting(p_var)) { ProjectSettings::get_singleton()->set(p_var, p_default); @@ -1070,7 +1070,7 @@ void ProjectSettings::_add_builtin_input_map() { action["events"] = events; String action_name = "input/" + E.key(); - GLOBAL_DEF(action_name, action); + PROJECT_DEFAULT(action_name, action); input_presets.push_back(action_name); } } @@ -1082,17 +1082,17 @@ ProjectSettings::ProjectSettings() { singleton = this; - GLOBAL_DEF_BASIC("application/config/name", ""); - GLOBAL_DEF_BASIC("application/config/description", ""); + PROJECT_DEFAULT_BASIC("application/config/name", ""); + PROJECT_DEFAULT_BASIC("application/config/description", ""); custom_prop_info["application/config/description"] = PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT); - GLOBAL_DEF_BASIC("application/run/main_scene", ""); + PROJECT_DEFAULT_BASIC("application/run/main_scene", ""); custom_prop_info["application/run/main_scene"] = PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res"); - GLOBAL_DEF("application/run/disable_stdout", false); - GLOBAL_DEF("application/run/disable_stderr", false); - GLOBAL_DEF("application/config/use_custom_user_dir", false); - GLOBAL_DEF("application/config/custom_user_dir_name", ""); - GLOBAL_DEF("application/config/project_settings_override", ""); - GLOBAL_DEF_BASIC("audio/buses/default_bus_layout", "res://default_bus_layout.tres"); + PROJECT_DEFAULT("application/run/disable_stdout", false); + PROJECT_DEFAULT("application/run/disable_stderr", false); + PROJECT_DEFAULT("application/config/use_custom_user_dir", false); + PROJECT_DEFAULT("application/config/custom_user_dir_name", ""); + PROJECT_DEFAULT("application/config/project_settings_override", ""); + PROJECT_DEFAULT_BASIC("audio/buses/default_bus_layout", "res://default_bus_layout.tres"); custom_prop_info["audio/buses/default_bus_layout"] = PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"); PackedStringArray extensions = PackedStringArray(); @@ -1102,12 +1102,12 @@ ProjectSettings::ProjectSettings() { } extensions.push_back("gdshader"); - GLOBAL_DEF("editor/run/main_run_args", ""); + PROJECT_DEFAULT("editor/run/main_run_args", ""); - GLOBAL_DEF("editor/script/search_in_file_extensions", extensions); + PROJECT_DEFAULT("editor/script/search_in_file_extensions", extensions); custom_prop_info["editor/script/search_in_file_extensions"] = PropertyInfo(Variant::PACKED_STRING_ARRAY, "editor/script/search_in_file_extensions"); - GLOBAL_DEF("editor/script/templates_search_path", "res://script_templates"); + PROJECT_DEFAULT("editor/script/templates_search_path", "res://script_templates"); custom_prop_info["editor/script/templates_search_path"] = PropertyInfo(Variant::STRING, "editor/script/templates_search_path", PROPERTY_HINT_DIR); _add_builtin_input_map(); @@ -1116,23 +1116,23 @@ ProjectSettings::ProjectSettings() { custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::INT, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"); custom_prop_info["display/window/vsync/vsync_mode"] = PropertyInfo(Variant::STRING, "display/window/vsync/vsync_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Adaptive,Mailbox"); custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded"); - GLOBAL_DEF("physics/2d/run_on_thread", false); - GLOBAL_DEF("physics/3d/run_on_thread", false); + PROJECT_DEFAULT("physics/2d/run_on_thread", false); + PROJECT_DEFAULT("physics/3d/run_on_thread", false); - GLOBAL_DEF("debug/settings/profiler/max_functions", 16384); + PROJECT_DEFAULT("debug/settings/profiler/max_functions", 16384); custom_prop_info["debug/settings/profiler/max_functions"] = PropertyInfo(Variant::INT, "debug/settings/profiler/max_functions", PROPERTY_HINT_RANGE, "128,65535,1"); - GLOBAL_DEF("compression/formats/zstd/long_distance_matching", Compression::zstd_long_distance_matching); + PROJECT_DEFAULT("compression/formats/zstd/long_distance_matching", Compression::zstd_long_distance_matching); custom_prop_info["compression/formats/zstd/long_distance_matching"] = PropertyInfo(Variant::BOOL, "compression/formats/zstd/long_distance_matching"); - GLOBAL_DEF("compression/formats/zstd/compression_level", Compression::zstd_level); + PROJECT_DEFAULT("compression/formats/zstd/compression_level", Compression::zstd_level); custom_prop_info["compression/formats/zstd/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zstd/compression_level", PROPERTY_HINT_RANGE, "1,22,1"); - GLOBAL_DEF("compression/formats/zstd/window_log_size", Compression::zstd_window_log_size); + PROJECT_DEFAULT("compression/formats/zstd/window_log_size", Compression::zstd_window_log_size); custom_prop_info["compression/formats/zstd/window_log_size"] = PropertyInfo(Variant::INT, "compression/formats/zstd/window_log_size", PROPERTY_HINT_RANGE, "10,30,1"); - GLOBAL_DEF("compression/formats/zlib/compression_level", Compression::zlib_level); + PROJECT_DEFAULT("compression/formats/zlib/compression_level", Compression::zlib_level); custom_prop_info["compression/formats/zlib/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/zlib/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); - GLOBAL_DEF("compression/formats/gzip/compression_level", Compression::gzip_level); + PROJECT_DEFAULT("compression/formats/gzip/compression_level", Compression::gzip_level); custom_prop_info["compression/formats/gzip/compression_level"] = PropertyInfo(Variant::INT, "compression/formats/gzip/compression_level", PROPERTY_HINT_RANGE, "-1,9,1"); } diff --git a/core/config/project_settings.h b/core/config/project_settings.h index ed8fb19fa0fc..54bb75c28960 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -179,16 +179,54 @@ class ProjectSettings : public Object { }; //not a macro any longer -Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false, bool p_ignore_value_in_docs = false, bool p_basic = false); -#define GLOBAL_DEF(m_var, m_value) _GLOBAL_DEF(m_var, m_value) -#define GLOBAL_DEF_RST(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true) -#define GLOBAL_DEF_NOVAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, true) -#define GLOBAL_DEF_RST_NOVAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true) -#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var) - -#define GLOBAL_DEF_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, true) -#define GLOBAL_DEF_RST_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, false, true) -#define GLOBAL_DEF_NOVAL_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, true, true) -#define GLOBAL_DEF_RST_NOVAL_BASIC(m_var, m_value) _GLOBAL_DEF(m_var, m_value, true, true, true) +Variant _PROJECT_DEFAULT(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false, bool p_ignore_value_in_docs = false, bool p_basic = false); + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Also requests a restart of the editor when changed using the Project Settings dialog. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT_RESTART(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, true) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Does not define a value for the class reference XML generation. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT_NO_VAL(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, false, true) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Also requests a restart of the editor when changed using the Project Settings dialog. +// Does not define a value for the class reference XML generation. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEF_RESTART_NO_VAL(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, true, true) + +// Returns the value of the project setting `m_var`, or Variant `null` if the setting doesn't exist. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_GET(m_var) ProjectSettings::get_singleton()->get(m_var) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Marks the setting as "basic" to make it appear by default in the Project Settings dialog. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT_BASIC(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, false, false, true) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Also requests a restart of the editor when changed using the Project Settings dialog. +// Marks the setting as "basic" to make it appear by default in the Project Settings dialog. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT_RESTART_BASIC(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, true, false, true) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Does not define a value for the class reference XML generation. +// Marks the setting as "basic" to make it appear by default in the Project Settings dialog. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT_NO_VAL_BASIC(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, false, true, true) + +// Returns the value of the project setting `m_var`, or `m_value` if the setting is not defined yet. +// Also requests a restart of the editor when changed using the Project Settings dialog. +// Does not define a value for the class reference XML generation. +// Marks the setting as "basic" to make it appear by default in the Project Settings dialog. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define PROJECT_DEFAULT_RESTART_NO_VAL_BASIC(m_var, m_value) _PROJECT_DEFAULT(m_var, m_value, true, true, true) #endif // PROJECT_SETTINGS_H diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index bdbb7766fa01..d25c2dda951a 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -265,7 +265,7 @@ struct RemoteDebugger::ScriptsProfiler { } ScriptsProfiler() { - info.resize(GLOBAL_GET("debug/settings/profiler/max_functions")); + info.resize(PROJECT_GET("debug/settings/profiler/max_functions")); ptrs.resize(info.size()); } }; @@ -921,9 +921,9 @@ Error RemoteDebugger::_profiler_capture(const String &p_cmd, const Array &p_data RemoteDebugger::RemoteDebugger(Ref p_peer) { peer = p_peer; - max_chars_per_second = GLOBAL_GET("network/limits/debugger/max_chars_per_second"); - max_errors_per_second = GLOBAL_GET("network/limits/debugger/max_errors_per_second"); - max_warnings_per_second = GLOBAL_GET("network/limits/debugger/max_warnings_per_second"); + max_chars_per_second = PROJECT_GET("network/limits/debugger/max_chars_per_second"); + max_errors_per_second = PROJECT_GET("network/limits/debugger/max_errors_per_second"); + max_warnings_per_second = PROJECT_GET("network/limits/debugger/max_warnings_per_second"); // Network Profiler network_profiler = memnew(NetworkProfiler); diff --git a/core/debugger/remote_debugger_peer.cpp b/core/debugger/remote_debugger_peer.cpp index ea5e32203cae..72526e1d22be 100644 --- a/core/debugger/remote_debugger_peer.cpp +++ b/core/debugger/remote_debugger_peer.cpp @@ -241,5 +241,5 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create(const String &p_uri) { } RemoteDebuggerPeer::RemoteDebuggerPeer() { - max_queued_messages = (int)GLOBAL_GET("network/limits/debugger/max_queued_messages"); + max_queued_messages = (int)PROJECT_GET("network/limits/debugger/max_queued_messages"); } diff --git a/core/input/input.cpp b/core/input/input.cpp index a712394b358d..565d22729849 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -164,7 +164,7 @@ void Input::_bind_methods() { void Input::get_argument_options(const StringName &p_function, int p_idx, List *r_options) const { #ifdef TOOLS_ENABLED - const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\""; + const String quote_style = EDITOR_DEFAULT("text_editor/completion/use_single_quotes", 0) ? "'" : "\""; String pf = p_function; if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 9ee3876c2f1e..bd15aeacc062 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -466,9 +466,9 @@ Error FileAccessNetwork::_set_unix_permissions(const String &p_file, uint32_t p_ } void FileAccessNetwork::configure() { - GLOBAL_DEF("network/remote_fs/page_size", 65536); + PROJECT_DEFAULT("network/remote_fs/page_size", 65536); ProjectSettings::get_singleton()->set_custom_property_info("network/remote_fs/page_size", PropertyInfo(Variant::INT, "network/remote_fs/page_size", PROPERTY_HINT_RANGE, "1,65536,1,or_greater")); //is used as denominator and can't be zero - GLOBAL_DEF("network/remote_fs/page_read_ahead", 4); + PROJECT_DEFAULT("network/remote_fs/page_read_ahead", 4); ProjectSettings::get_singleton()->set_custom_property_info("network/remote_fs/page_read_ahead", PropertyInfo(Variant::INT, "network/remote_fs/page_read_ahead", PROPERTY_HINT_RANGE, "0,8,1,or_greater")); } @@ -478,8 +478,8 @@ FileAccessNetwork::FileAccessNetwork() { id = nc->last_id++; nc->accesses[id] = this; nc->unlock_mutex(); - page_size = GLOBAL_GET("network/remote_fs/page_size"); - read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead"); + page_size = PROJECT_GET("network/remote_fs/page_size"); + read_ahead = PROJECT_GET("network/remote_fs/page_read_ahead"); } FileAccessNetwork::~FileAccessNetwork() { diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 8da44fd290ad..61367a0315b8 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -290,7 +290,7 @@ int PacketPeerStream::get_output_buffer_max_size() const { } PacketPeerStream::PacketPeerStream() { - int rbsize = GLOBAL_GET("network/limits/packet_peer_stream/max_buffer_po2"); + int rbsize = PROJECT_GET("network/limits/packet_peer_stream/max_buffer_po2"); ring_buffer.resize(rbsize); input_buffer.resize(1 << rbsize); diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 5b794274ca4f..7375f58d0c7d 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -60,7 +60,7 @@ void StreamPeerTCP::accept_socket(Ref p_sock, IPAddress p_host, uint1 _sock = p_sock; _sock->set_blocking_enabled(false); - timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/tcp/connect_timeout_seconds")) * 1000); + timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)PROJECT_GET("network/limits/tcp/connect_timeout_seconds")) * 1000); status = STATUS_CONNECTING; peer_host = p_host; @@ -99,7 +99,7 @@ Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) { _sock->set_blocking_enabled(false); } - timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/tcp/connect_timeout_seconds")) * 1000); + timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)PROJECT_GET("network/limits/tcp/connect_timeout_seconds")) * 1000); Error err = _sock->connect_to_host(p_host, p_port); if (err == OK) { diff --git a/core/object/message_queue.cpp b/core/object/message_queue.cpp index 4751c69f1eae..4c7e81464fa8 100644 --- a/core/object/message_queue.cpp +++ b/core/object/message_queue.cpp @@ -343,7 +343,7 @@ MessageQueue::MessageQueue() { ERR_FAIL_COND_MSG(singleton != nullptr, "A MessageQueue singleton already exists."); singleton = this; - buffer_size = GLOBAL_DEF_RST("memory/limits/message_queue/max_size_kb", DEFAULT_QUEUE_SIZE_KB); + buffer_size = PROJECT_DEFAULT_RESTART("memory/limits/message_queue/max_size_kb", DEFAULT_QUEUE_SIZE_KB); ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/message_queue/max_size_kb", PropertyInfo(Variant::INT, "memory/limits/message_queue/max_size_kb", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater")); buffer_size *= 1024; buffer = memnew_arr(uint8_t, buffer_size); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 1cbb0bb597b4..d175e18d7677 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -243,12 +243,12 @@ void register_core_types() { void register_core_settings() { // Since in register core types, globals may not be present. - GLOBAL_DEF("network/limits/tcp/connect_timeout_seconds", (30)); + PROJECT_DEFAULT("network/limits/tcp/connect_timeout_seconds", (30)); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/tcp/connect_timeout_seconds", PropertyInfo(Variant::INT, "network/limits/tcp/connect_timeout_seconds", PROPERTY_HINT_RANGE, "1,1800,1")); - GLOBAL_DEF_RST("network/limits/packet_peer_stream/max_buffer_po2", (16)); + PROJECT_DEFAULT_RESTART("network/limits/packet_peer_stream/max_buffer_po2", (16)); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/packet_peer_stream/max_buffer_po2", PropertyInfo(Variant::INT, "network/limits/packet_peer_stream/max_buffer_po2", PROPERTY_HINT_RANGE, "0,64,1,or_greater")); - GLOBAL_DEF("network/ssl/certificate_bundle_override", ""); + PROJECT_DEFAULT("network/ssl/certificate_bundle_override", ""); ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificate_bundle_override", PropertyInfo(Variant::STRING, "network/ssl/certificate_bundle_override", PROPERTY_HINT_FILE, "*.crt")); } diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 153f0190fd1d..c76c08a0154a 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -1204,14 +1204,14 @@ bool TranslationServer::_load_translations(const String &p_from) { } void TranslationServer::setup() { - String test = GLOBAL_DEF("internationalization/locale/test", ""); + String test = PROJECT_DEFAULT("internationalization/locale/test", ""); test = test.strip_edges(); if (test != "") { set_locale(test); } else { set_locale(OS::get_singleton()->get_locale()); } - fallback = GLOBAL_DEF("internationalization/locale/fallback", "en"); + fallback = PROJECT_DEFAULT("internationalization/locale/fallback", "en"); #ifdef TOOLS_ENABLED { String options = ""; diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index 61475c74e782..d7e7f7d8d5cd 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -44,7 +44,7 @@ extern int initialize_pulse(int verbose); #endif Error AudioDriverALSA::init_device() { - mix_rate = GLOBAL_GET("audio/driver/mix_rate"); + mix_rate = PROJECT_GET("audio/driver/mix_rate"); speaker_mode = SPEAKER_MODE_STEREO; channels = 2; @@ -110,7 +110,7 @@ Error AudioDriverALSA::init_device() { // In ALSA the period size seems to be the one that will determine the actual latency // Ref: https://www.alsa-project.org/main/index.php/FramesPeriods unsigned int periods = 2; - int latency = GLOBAL_GET("audio/driver/output_latency"); + int latency = PROJECT_GET("audio/driver/output_latency"); buffer_frames = closest_power_of_2(latency * mix_rate / 1000); buffer_size = buffer_frames * periods; period_size = buffer_frames; diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index 41397274220f..0649516ccb08 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -116,7 +116,7 @@ Error AudioDriverCoreAudio::init() { break; } - mix_rate = GLOBAL_GET("audio/driver/mix_rate"); + mix_rate = PROJECT_GET("audio/driver/mix_rate"); memset(&strdesc, 0, sizeof(strdesc)); strdesc.mFormatID = kAudioFormatLinearPCM; @@ -131,7 +131,7 @@ Error AudioDriverCoreAudio::init() { result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &strdesc, sizeof(strdesc)); ERR_FAIL_COND_V(result != noErr, FAILED); - int latency = GLOBAL_GET("audio/driver/output_latency"); + int latency = PROJECT_GET("audio/driver/output_latency"); // Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels) buffer_frames = closest_power_of_2(latency * mix_rate / 1000); @@ -157,7 +157,7 @@ Error AudioDriverCoreAudio::init() { result = AudioUnitInitialize(audio_unit); ERR_FAIL_COND_V(result != noErr, FAILED); - if (GLOBAL_GET("audio/driver/enable_input")) { + if (PROJECT_GET("audio/driver/enable_input")) { return capture_init(); } return OK; @@ -403,7 +403,7 @@ Error AudioDriverCoreAudio::capture_init() { break; } - mix_rate = GLOBAL_GET("audio/driver/mix_rate"); + mix_rate = PROJECT_GET("audio/driver/mix_rate"); memset(&strdesc, 0, sizeof(strdesc)); strdesc.mFormatID = kAudioFormatLinearPCM; diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 5e2431d44e30..05b569909781 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -217,7 +217,7 @@ Error AudioDriverPulseAudio::init_device() { break; } - int latency = GLOBAL_GET("audio/driver/output_latency"); + int latency = PROJECT_GET("audio/driver/output_latency"); buffer_frames = closest_power_of_2(latency * mix_rate / 1000); pa_buffer_size = buffer_frames * pa_map.channels; @@ -288,7 +288,7 @@ Error AudioDriverPulseAudio::init() { thread_exited = false; exit_thread = false; - mix_rate = GLOBAL_GET("audio/driver/mix_rate"); + mix_rate = PROJECT_GET("audio/driver/mix_rate"); pa_ml = pa_mainloop_new(); ERR_FAIL_COND_V(pa_ml == nullptr, ERR_CANT_OPEN); diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 6c1f1e485200..6905182adb16 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -8344,10 +8344,10 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context, bool p_local_de } } - staging_buffer_block_size = GLOBAL_DEF("rendering/vulkan/staging_buffer/block_size_kb", 256); + staging_buffer_block_size = PROJECT_DEFAULT("rendering/vulkan/staging_buffer/block_size_kb", 256); staging_buffer_block_size = MAX(4, staging_buffer_block_size); staging_buffer_block_size *= 1024; //kb -> bytes - staging_buffer_max_size = GLOBAL_DEF("rendering/vulkan/staging_buffer/max_size_mb", 128); + staging_buffer_max_size = PROJECT_DEFAULT("rendering/vulkan/staging_buffer/max_size_mb", 128); staging_buffer_max_size = MAX(1, staging_buffer_max_size); staging_buffer_max_size *= 1024 * 1024; @@ -8355,7 +8355,7 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context, bool p_local_de //validate enough blocks staging_buffer_max_size = staging_buffer_block_size * 4; } - texture_upload_region_size_px = GLOBAL_DEF("rendering/vulkan/staging_buffer/texture_upload_region_size_px", 64); + texture_upload_region_size_px = PROJECT_DEFAULT("rendering/vulkan/staging_buffer/texture_upload_region_size_px", 64); texture_upload_region_size_px = nearest_power_of_2_templated(texture_upload_region_size_px); frames_drawn = frame_count; //start from frame count, so everything else is immediately old @@ -8370,7 +8370,7 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context, bool p_local_de ERR_CONTINUE(err != OK); } - max_descriptors_per_pool = GLOBAL_DEF("rendering/vulkan/descriptor_pools/max_descriptors_per_pool", 64); + max_descriptors_per_pool = PROJECT_DEFAULT("rendering/vulkan/descriptor_pools/max_descriptors_per_pool", 64); //check to make sure DescriptorPoolKey is good static_assert(sizeof(uint64_t) * 3 >= UNIFORM_TYPE_MAX * sizeof(uint16_t)); diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 43c8722b066f..9741f5fa3ccb 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -387,7 +387,7 @@ Error AudioDriverWASAPI::finish_capture_device() { } Error AudioDriverWASAPI::init() { - mix_rate = GLOBAL_GET("audio/driver/mix_rate"); + mix_rate = PROJECT_GET("audio/driver/mix_rate"); Error err = init_render_device(); if (err != OK) { diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 1c7bf5d6c673..7d3a56ce900c 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -44,12 +44,12 @@ Error AudioDriverXAudio2::init() { pcm_open = false; samples_in = nullptr; - mix_rate = GLOBAL_GET("audio/driver/mix_rate"); + mix_rate = PROJECT_GET("audio/driver/mix_rate"); // FIXME: speaker_mode seems unused in the Xaudio2 driver so far speaker_mode = SPEAKER_MODE_STEREO; channels = 2; - int latency = GLOBAL_GET("audio/driver/output_latency"); + int latency = PROJECT_GET("audio/driver/output_latency"); buffer_size = closest_power_of_2(latency * mix_rate / 1000); samples_in = memnew_arr(int32_t, buffer_size * channels); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index f61fb6bab371..448e3613002b 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3415,7 +3415,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) { } } - if (bool(EDITOR_DEF("editors/animation/confirm_insert_track", true))) { + if (bool(EDITOR_DEFAULT("editors/animation/confirm_insert_track", true))) { //potential new key, does not exist if (num_tracks == 1) { insert_confirm_text->set_text(vformat(TTR("Create new track for %s and insert key?"), p_id.query)); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 03914bec3b67..8a53dc5da073 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1541,7 +1541,7 @@ void CodeTextEditor::_update_text_editor_theme() { text_editor->add_theme_color_override("code_folding_color", EDITOR_GET("text_editor/highlighting/code_folding_color")); text_editor->add_theme_color_override("search_result_color", EDITOR_GET("text_editor/highlighting/search_result_color")); text_editor->add_theme_color_override("search_result_border_color", EDITOR_GET("text_editor/highlighting/search_result_border_color")); - text_editor->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6)); + text_editor->add_theme_constant_override("line_spacing", EDITOR_DEFAULT("text_editor/theme/line_spacing", 6)); emit_signal("load_theme_settings"); _load_theme_settings(); } diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5f90680115eb..60f23ca39a9a 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -68,7 +68,7 @@ EditorDebuggerNode::EditorDebuggerNode() { empty.instantiate(); tabs->add_theme_style_override("panel", empty); - auto_switch_remote_scene_tree = EDITOR_DEF("debugger/auto_switch_to_remote_scene_tree", false); + auto_switch_remote_scene_tree = EDITOR_DEFAULT("debugger/auto_switch_to_remote_scene_tree", false); _add_debugger(); // Remote scene tree @@ -78,8 +78,8 @@ EditorDebuggerNode::EditorDebuggerNode() { EditorNode::get_singleton()->get_scene_tree_dock()->add_remote_tree_editor(remote_scene_tree); EditorNode::get_singleton()->get_scene_tree_dock()->connect("remote_tree_selected", callable_mp(this, &EditorDebuggerNode::request_remote_tree)); - remote_scene_tree_timeout = EDITOR_DEF("debugger/remote_scene_tree_refresh_interval", 1.0); - inspect_edited_object_timeout = EDITOR_DEF("debugger/remote_inspect_refresh_interval", 0.2); + remote_scene_tree_timeout = EDITOR_DEFAULT("debugger/remote_scene_tree_refresh_interval", 1.0); + inspect_edited_object_timeout = EDITOR_DEFAULT("debugger/remote_inspect_refresh_interval", 0.2); EditorNode *editor = EditorNode::get_singleton(); editor->get_undo_redo()->set_method_notify_callback(_method_changeds, this); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 5f4d1b6f36f6..6e9427f39936 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -653,13 +653,13 @@ EditorProfiler::EditorProfiler() { h_split->add_child(graph); graph->set_h_size_flags(SIZE_EXPAND_FILL); - int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024); + int metric_size = CLAMP(int(EDITOR_DEFAULT("debugger/profiler_frame_history_size", 600)), 60, 1024); frame_metrics.resize(metric_size); total_metrics = 0; last_metric = -1; hover_metric = -1; - EDITOR_DEF("debugger/profiler_frame_max_functions", 64); + EDITOR_DEFAULT("debugger/profiler_frame_max_functions", 64); frame_delay = memnew(Timer); frame_delay->set_wait_time(0.1); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index a0e8a3bd35a7..62ae83ec59e6 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -796,7 +796,7 @@ EditorVisualProfiler::EditorVisualProfiler() { h_split->add_child(graph); graph->set_h_size_flags(SIZE_EXPAND_FILL); - int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024); + int metric_size = CLAMP(int(EDITOR_DEFAULT("debugger/profiler_frame_history_size", 600)), 60, 1024); frame_metrics.resize(metric_size); last_metric = -1; //cursor_metric=-1; diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index fc483b46b72f..a59f97ba1ce1 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1980,7 +1980,7 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con return; } - bool convert = GLOBAL_GET("editor/export/convert_text_resources_to_binary"); + bool convert = PROJECT_GET("editor/export/convert_text_resources_to_binary"); if (!convert) { return; } @@ -2000,5 +2000,5 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con } EditorExportTextSceneToBinaryPlugin::EditorExportTextSceneToBinaryPlugin() { - GLOBAL_DEF("editor/export/convert_text_resources_to_binary", false); + PROJECT_DEFAULT("editor/export/convert_text_resources_to_binary", false); } diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 58d2b6e86eb5..0073cca30204 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -990,7 +990,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { export_profile->set_access(EditorFileDialog::ACCESS_FILESYSTEM); set_title(TTR("Manage Editor Feature Profiles")); - EDITOR_DEF("_default_feature_profile", ""); + EDITOR_DEFAULT("_default_feature_profile", ""); update_timer = memnew(Timer); update_timer->set_wait_time(1); //wait a second before updating editor diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index a2507f3cf2c6..985189693f4e 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1965,7 +1965,7 @@ void EditorFileSystem::reimport_files(const Vector &p_files) { reimport_files.sort(); - bool use_threads = GLOBAL_GET("editor/import/use_multiple_threads"); + bool use_threads = PROJECT_GET("editor/import/use_multiple_threads"); int from = 0; for (int i = 0; i < reimport_files.size(); i++) { @@ -2144,8 +2144,8 @@ void EditorFileSystem::_update_extensions() { EditorFileSystem::EditorFileSystem() { ResourceLoader::import = _resource_import; - reimport_on_missing_imported_files = GLOBAL_DEF("editor/import/reimport_missing_imported_files", true); - GLOBAL_DEF("editor/import/use_multiple_threads", true); + reimport_on_missing_imported_files = PROJECT_DEFAULT("editor/import/reimport_missing_imported_files", true); + PROJECT_DEFAULT("editor/import/use_multiple_threads", true); singleton = this; filesystem = memnew(EditorFileSystemDirectory); //like, empty filesystem->parent = nullptr; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 16db465a4a8a..a417284ec887 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1662,7 +1662,7 @@ void EditorHelp::_bind_methods() { EditorHelp::EditorHelp() { set_custom_minimum_size(Size2(150 * EDSCALE, 0)); - EDITOR_DEF("text_editor/help/sort_functions_alphabetically", true); + EDITOR_DEFAULT("text_editor/help/sort_functions_alphabetically", true); class_desc = memnew(RichTextLabel); add_child(class_desc); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index e7c0b02ae28f..7c0949a7103c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -443,70 +443,70 @@ void EditorNode::_unhandled_input(const Ref &p_event) { } void EditorNode::_update_from_settings() { - int current_filter = GLOBAL_GET("rendering/textures/canvas_textures/default_texture_filter"); + int current_filter = PROJECT_GET("rendering/textures/canvas_textures/default_texture_filter"); if (current_filter != scene_root->get_default_canvas_item_texture_filter()) { Viewport::DefaultCanvasItemTextureFilter tf = (Viewport::DefaultCanvasItemTextureFilter)current_filter; scene_root->set_default_canvas_item_texture_filter(tf); } - int current_repeat = GLOBAL_GET("rendering/textures/canvas_textures/default_texture_repeat"); + int current_repeat = PROJECT_GET("rendering/textures/canvas_textures/default_texture_repeat"); if (current_repeat != scene_root->get_default_canvas_item_texture_repeat()) { Viewport::DefaultCanvasItemTextureRepeat tr = (Viewport::DefaultCanvasItemTextureRepeat)current_repeat; scene_root->set_default_canvas_item_texture_repeat(tr); } - RS::DOFBokehShape dof_shape = RS::DOFBokehShape(int(GLOBAL_GET("rendering/camera/depth_of_field/depth_of_field_bokeh_shape"))); + RS::DOFBokehShape dof_shape = RS::DOFBokehShape(int(PROJECT_GET("rendering/camera/depth_of_field/depth_of_field_bokeh_shape"))); RS::get_singleton()->camera_effects_set_dof_blur_bokeh_shape(dof_shape); - RS::DOFBlurQuality dof_quality = RS::DOFBlurQuality(int(GLOBAL_GET("rendering/camera/depth_of_field/depth_of_field_bokeh_quality"))); - bool dof_jitter = GLOBAL_GET("rendering/camera/depth_of_field/depth_of_field_use_jitter"); + RS::DOFBlurQuality dof_quality = RS::DOFBlurQuality(int(PROJECT_GET("rendering/camera/depth_of_field/depth_of_field_bokeh_quality"))); + bool dof_jitter = PROJECT_GET("rendering/camera/depth_of_field/depth_of_field_use_jitter"); RS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter); - RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/environment/ssao/quality"))), GLOBAL_GET("rendering/environment/ssao/half_size"), GLOBAL_GET("rendering/environment/ssao/adaptive_target"), GLOBAL_GET("rendering/environment/ssao/blur_passes"), GLOBAL_GET("rendering/environment/ssao/fadeout_from"), GLOBAL_GET("rendering/environment/ssao/fadeout_to")); - RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/anti_aliasing/screen_space_roughness_limiter/enabled"), GLOBAL_GET("rendering/anti_aliasing/screen_space_roughness_limiter/amount"), GLOBAL_GET("rendering/anti_aliasing/screen_space_roughness_limiter/limit")); - bool glow_bicubic = int(GLOBAL_GET("rendering/environment/glow/upscale_mode")) > 0; + RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(PROJECT_GET("rendering/environment/ssao/quality"))), PROJECT_GET("rendering/environment/ssao/half_size"), PROJECT_GET("rendering/environment/ssao/adaptive_target"), PROJECT_GET("rendering/environment/ssao/blur_passes"), PROJECT_GET("rendering/environment/ssao/fadeout_from"), PROJECT_GET("rendering/environment/ssao/fadeout_to")); + RS::get_singleton()->screen_space_roughness_limiter_set_active(PROJECT_GET("rendering/anti_aliasing/screen_space_roughness_limiter/enabled"), PROJECT_GET("rendering/anti_aliasing/screen_space_roughness_limiter/amount"), PROJECT_GET("rendering/anti_aliasing/screen_space_roughness_limiter/limit")); + bool glow_bicubic = int(PROJECT_GET("rendering/environment/glow/upscale_mode")) > 0; RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic); - bool glow_high_quality = GLOBAL_GET("rendering/environment/glow/use_high_quality"); + bool glow_high_quality = PROJECT_GET("rendering/environment/glow/use_high_quality"); RS::get_singleton()->environment_glow_set_use_high_quality(glow_high_quality); - RS::EnvironmentSSRRoughnessQuality ssr_roughness_quality = RS::EnvironmentSSRRoughnessQuality(int(GLOBAL_GET("rendering/environment/screen_space_reflection/roughness_quality"))); + RS::EnvironmentSSRRoughnessQuality ssr_roughness_quality = RS::EnvironmentSSRRoughnessQuality(int(PROJECT_GET("rendering/environment/screen_space_reflection/roughness_quality"))); RS::get_singleton()->environment_set_ssr_roughness_quality(ssr_roughness_quality); - RS::SubSurfaceScatteringQuality sss_quality = RS::SubSurfaceScatteringQuality(int(GLOBAL_GET("rendering/environment/subsurface_scattering/subsurface_scattering_quality"))); + RS::SubSurfaceScatteringQuality sss_quality = RS::SubSurfaceScatteringQuality(int(PROJECT_GET("rendering/environment/subsurface_scattering/subsurface_scattering_quality"))); RS::get_singleton()->sub_surface_scattering_set_quality(sss_quality); - float sss_scale = GLOBAL_GET("rendering/environment/subsurface_scattering/subsurface_scattering_scale"); - float sss_depth_scale = GLOBAL_GET("rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale"); + float sss_scale = PROJECT_GET("rendering/environment/subsurface_scattering/subsurface_scattering_scale"); + float sss_depth_scale = PROJECT_GET("rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale"); RS::get_singleton()->sub_surface_scattering_set_scale(sss_scale, sss_depth_scale); - uint32_t directional_shadow_size = GLOBAL_GET("rendering/shadows/directional_shadow/size"); - uint32_t directional_shadow_16_bits = GLOBAL_GET("rendering/shadows/directional_shadow/16_bits"); + uint32_t directional_shadow_size = PROJECT_GET("rendering/shadows/directional_shadow/size"); + uint32_t directional_shadow_16_bits = PROJECT_GET("rendering/shadows/directional_shadow/16_bits"); RS::get_singleton()->directional_shadow_atlas_set_size(directional_shadow_size, directional_shadow_16_bits); - RS::ShadowQuality shadows_quality = RS::ShadowQuality(int(GLOBAL_GET("rendering/shadows/shadows/soft_shadow_quality"))); + RS::ShadowQuality shadows_quality = RS::ShadowQuality(int(PROJECT_GET("rendering/shadows/shadows/soft_shadow_quality"))); RS::get_singleton()->shadows_quality_set(shadows_quality); - RS::ShadowQuality directional_shadow_quality = RS::ShadowQuality(int(GLOBAL_GET("rendering/shadows/directional_shadow/soft_shadow_quality"))); + RS::ShadowQuality directional_shadow_quality = RS::ShadowQuality(int(PROJECT_GET("rendering/shadows/directional_shadow/soft_shadow_quality"))); RS::get_singleton()->directional_shadow_quality_set(directional_shadow_quality); - float probe_update_speed = GLOBAL_GET("rendering/lightmapping/probe_capture/update_speed"); + float probe_update_speed = PROJECT_GET("rendering/lightmapping/probe_capture/update_speed"); RS::get_singleton()->lightmap_set_probe_capture_update_speed(probe_update_speed); - RS::EnvironmentSDFGIFramesToConverge frames_to_converge = RS::EnvironmentSDFGIFramesToConverge(int(GLOBAL_GET("rendering/global_illumination/sdfgi/frames_to_converge"))); + RS::EnvironmentSDFGIFramesToConverge frames_to_converge = RS::EnvironmentSDFGIFramesToConverge(int(PROJECT_GET("rendering/global_illumination/sdfgi/frames_to_converge"))); RS::get_singleton()->environment_set_sdfgi_frames_to_converge(frames_to_converge); - RS::EnvironmentSDFGIRayCount ray_count = RS::EnvironmentSDFGIRayCount(int(GLOBAL_GET("rendering/global_illumination/sdfgi/probe_ray_count"))); + RS::EnvironmentSDFGIRayCount ray_count = RS::EnvironmentSDFGIRayCount(int(PROJECT_GET("rendering/global_illumination/sdfgi/probe_ray_count"))); RS::get_singleton()->environment_set_sdfgi_ray_count(ray_count); - RS::VoxelGIQuality voxel_gi_quality = RS::VoxelGIQuality(int(GLOBAL_GET("rendering/global_illumination/voxel_gi/quality"))); + RS::VoxelGIQuality voxel_gi_quality = RS::VoxelGIQuality(int(PROJECT_GET("rendering/global_illumination/voxel_gi/quality"))); RS::get_singleton()->voxel_gi_set_quality(voxel_gi_quality); - RS::get_singleton()->environment_set_volumetric_fog_volume_size(GLOBAL_GET("rendering/environment/volumetric_fog/volume_size"), GLOBAL_GET("rendering/environment/volumetric_fog/volume_depth")); - RS::get_singleton()->environment_set_volumetric_fog_filter_active(bool(GLOBAL_GET("rendering/environment/volumetric_fog/use_filter"))); - RS::get_singleton()->canvas_set_shadow_texture_size(GLOBAL_GET("rendering/2d/shadow_atlas/size")); + RS::get_singleton()->environment_set_volumetric_fog_volume_size(PROJECT_GET("rendering/environment/volumetric_fog/volume_size"), PROJECT_GET("rendering/environment/volumetric_fog/volume_depth")); + RS::get_singleton()->environment_set_volumetric_fog_filter_active(bool(PROJECT_GET("rendering/environment/volumetric_fog/use_filter"))); + RS::get_singleton()->canvas_set_shadow_texture_size(PROJECT_GET("rendering/2d/shadow_atlas/size")); - bool use_half_res_gi = GLOBAL_DEF("rendering/global_illumination/gi/use_half_resolution", false); + bool use_half_res_gi = PROJECT_DEFAULT("rendering/global_illumination/gi/use_half_resolution", false); RS::get_singleton()->gi_set_use_half_resolution(use_half_res_gi); - bool snap_2d_transforms = GLOBAL_GET("rendering/2d/snap/snap_2d_transforms_to_pixel"); + bool snap_2d_transforms = PROJECT_GET("rendering/2d/snap/snap_2d_transforms_to_pixel"); scene_root->set_snap_2d_transforms_to_pixel(snap_2d_transforms); - bool snap_2d_vertices = GLOBAL_GET("rendering/2d/snap/snap_2d_vertices_to_pixel"); + bool snap_2d_vertices = PROJECT_GET("rendering/2d/snap/snap_2d_vertices_to_pixel"); scene_root->set_snap_2d_vertices_to_pixel(snap_2d_vertices); - Viewport::SDFOversize sdf_oversize = Viewport::SDFOversize(int(GLOBAL_GET("rendering/2d/sdf/oversize"))); + Viewport::SDFOversize sdf_oversize = Viewport::SDFOversize(int(PROJECT_GET("rendering/2d/sdf/oversize"))); scene_root->set_sdf_oversize(sdf_oversize); - Viewport::SDFScale sdf_scale = Viewport::SDFScale(int(GLOBAL_GET("rendering/2d/sdf/scale"))); + Viewport::SDFScale sdf_scale = Viewport::SDFScale(int(PROJECT_GET("rendering/2d/sdf/scale"))); scene_root->set_sdf_scale(sdf_scale); - float lod_threshold = GLOBAL_GET("rendering/mesh_lod/lod_change/threshold_pixels"); + float lod_threshold = PROJECT_GET("rendering/mesh_lod/lod_change/threshold_pixels"); scene_root->set_lod_threshold(lod_threshold); } @@ -4678,7 +4678,7 @@ bool EditorNode::has_scenes_in_session() { bool EditorNode::ensure_main_scene(bool p_from_native) { pick_main_scene->set_meta("from_native", p_from_native); //whether from play button or native run - String main_scene = GLOBAL_DEF("application/run/main_scene", ""); + String main_scene = PROJECT_DEFAULT("application/run/main_scene", ""); if (main_scene == "") { current_option = -1; @@ -4740,7 +4740,7 @@ bool EditorNode::is_run_playing() const { String EditorNode::get_run_playing_scene() const { String run_filename = editor_run.get_running_scene(); if (run_filename == "" && is_run_playing()) { - run_filename = GLOBAL_DEF("application/run/main_scene", ""); // Must be the main scene then. + run_filename = PROJECT_DEFAULT("application/run/main_scene", ""); // Must be the main scene then. } return run_filename; @@ -5865,33 +5865,33 @@ EditorNode::EditorNode() { ClassDB::set_class_enabled("RootMotionView", true); //defs here, use EDITOR_GET in logic - EDITOR_DEF_RST("interface/scene_tabs/always_show_close_button", false); - EDITOR_DEF_RST("interface/scene_tabs/resize_if_many_tabs", true); - EDITOR_DEF_RST("interface/scene_tabs/minimum_width", 50); - EDITOR_DEF("run/output/always_clear_output_on_play", true); - EDITOR_DEF("run/output/always_open_output_on_play", true); - EDITOR_DEF("run/output/always_close_output_on_stop", true); - EDITOR_DEF("run/auto_save/save_before_running", true); - EDITOR_DEF("interface/editor/save_on_focus_loss", false); - EDITOR_DEF_RST("interface/editor/save_each_scene_on_quit", true); - EDITOR_DEF("interface/editor/show_update_spinner", false); - EDITOR_DEF("interface/editor/update_continuously", false); - EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", false); - EDITOR_DEF_RST("interface/scene_tabs/show_thumbnail_on_hover", true); - EDITOR_DEF_RST("interface/inspector/capitalize_properties", true); - EDITOR_DEF_RST("interface/inspector/default_float_step", 0.001); + EDITOR_DEFAULT_RESTART("interface/scene_tabs/always_show_close_button", false); + EDITOR_DEFAULT_RESTART("interface/scene_tabs/resize_if_many_tabs", true); + EDITOR_DEFAULT_RESTART("interface/scene_tabs/minimum_width", 50); + EDITOR_DEFAULT("run/output/always_clear_output_on_play", true); + EDITOR_DEFAULT("run/output/always_open_output_on_play", true); + EDITOR_DEFAULT("run/output/always_close_output_on_stop", true); + EDITOR_DEFAULT("run/auto_save/save_before_running", true); + EDITOR_DEFAULT("interface/editor/save_on_focus_loss", false); + EDITOR_DEFAULT_RESTART("interface/editor/save_each_scene_on_quit", true); + EDITOR_DEFAULT("interface/editor/show_update_spinner", false); + EDITOR_DEFAULT("interface/editor/update_continuously", false); + EDITOR_DEFAULT_RESTART("interface/scene_tabs/restore_scenes_on_load", false); + EDITOR_DEFAULT_RESTART("interface/scene_tabs/show_thumbnail_on_hover", true); + EDITOR_DEFAULT_RESTART("interface/inspector/capitalize_properties", true); + EDITOR_DEFAULT_RESTART("interface/inspector/default_float_step", 0.001); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "interface/inspector/default_float_step", PROPERTY_HINT_RANGE, "0,1,0")); - EDITOR_DEF_RST("interface/inspector/disable_folding", false); - EDITOR_DEF_RST("interface/inspector/auto_unfold_foreign_scenes", true); - EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false); - EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true); - EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true); - EDITOR_DEF("interface/inspector/resources_to_open_in_new_inspector", "Script,MeshLibrary"); - EDITOR_DEF("interface/inspector/default_color_picker_mode", 0); + EDITOR_DEFAULT_RESTART("interface/inspector/disable_folding", false); + EDITOR_DEFAULT_RESTART("interface/inspector/auto_unfold_foreign_scenes", true); + EDITOR_DEFAULT("interface/inspector/horizontal_vector2_editing", false); + EDITOR_DEFAULT("interface/inspector/horizontal_vector_types_editing", true); + EDITOR_DEFAULT("interface/inspector/open_resources_in_current_inspector", true); + EDITOR_DEFAULT("interface/inspector/resources_to_open_in_new_inspector", "Script,MeshLibrary"); + EDITOR_DEFAULT("interface/inspector/default_color_picker_mode", 0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_color_picker_mode", PROPERTY_HINT_ENUM, "RGB,HSV,RAW", PROPERTY_USAGE_DEFAULT)); - EDITOR_DEF("interface/inspector/default_color_picker_shape", (int32_t)ColorPicker::SHAPE_VHS_CIRCLE); + EDITOR_DEFAULT("interface/inspector/default_color_picker_shape", (int32_t)ColorPicker::SHAPE_VHS_CIRCLE); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "interface/inspector/default_color_picker_shape", PROPERTY_HINT_ENUM, "HSV Rectangle,HSV Rectangle Wheel,VHS Circle", PROPERTY_USAGE_DEFAULT)); - EDITOR_DEF("run/auto_save/save_before_running", true); + EDITOR_DEFAULT("run/auto_save/save_before_running", true); theme_base = memnew(Control); add_child(theme_base); @@ -6089,8 +6089,8 @@ EditorNode::EditorNode() { scene_tabs->set_select_with_rmb(true); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_LEFT); - scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/scene_tabs/always_show_close_button", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY)); - scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE); + scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEFAULT("interface/scene_tabs/always_show_close_button", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY)); + scene_tabs->set_min_width(int(EDITOR_DEFAULT("interface/scene_tabs/minimum_width", 50)) * EDSCALE); scene_tabs->set_drag_to_rearrange_enabled(true); scene_tabs->connect("tab_changed", callable_mp(this, &EditorNode::_scene_tab_changed)); scene_tabs->connect("right_button_pressed", callable_mp(this, &EditorNode::_scene_tab_script_edited)); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 080563f37514..0b9ccf31ef7c 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1128,7 +1128,7 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian } } -Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed) { +Variant _EDITOR_DEFAULT(const String &p_setting, const Variant &p_default, bool p_restart_if_changed) { Variant ret = p_default; if (EditorSettings::get_singleton()->has_setting(p_setting)) { ret = EditorSettings::get_singleton()->get(p_setting); diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 3a28c18b2748..d7c1db5d46b1 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -190,15 +190,23 @@ class EditorSettings : public Resource { ~EditorSettings(); }; +// Returns the value of the editor setting `m_var`, or `m_value` if the setting is not defined yet. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define EDITOR_DEFAULT(m_var, m_value) _EDITOR_DEFAULT(m_var, Variant(m_value)) + +// Returns the value of the editor setting `m_var`, or `m_value` if the setting is not defined yet. +// Also requests a restart of the editor when changed using the Editor Settings dialog. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. +#define EDITOR_DEFAULT_RESTART(m_var, m_value) _EDITOR_DEFAULT(m_var, Variant(m_value), true) //not a macro any longer +Variant _EDITOR_DEFAULT(const String &p_setting, const Variant &p_default, bool p_restart_if_changed = false); -#define EDITOR_DEF(m_var, m_val) _EDITOR_DEF(m_var, Variant(m_val)) -#define EDITOR_DEF_RST(m_var, m_val) _EDITOR_DEF(m_var, Variant(m_val), true) -Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed = false); - +// Returns the value of the editor setting `m_var`, or Variant `null` if the setting doesn't exist. +// Consider casting this macro's return value to a specific type to improve safety and avoid crashes. #define EDITOR_GET(m_var) _EDITOR_GET(m_var) Variant _EDITOR_GET(const String &p_setting); +// Returns `true` if the InputEvent `p_ev` matches the editor shortcut with String path `p_name`, `false` otherwise. #define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev)) Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode = 0); Ref ED_GET_SHORTCUT(const String &p_path); diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp index 8f019a95fda6..0efbc85991dd 100644 --- a/editor/fileserver/editor_file_server.cpp +++ b/editor/fileserver/editor_file_server.cpp @@ -298,8 +298,8 @@ void EditorFileServer::_thread_start(void *s) { void EditorFileServer::start() { stop(); - port = EDITOR_DEF("filesystem/file_server/port", 6010); - password = EDITOR_DEF("filesystem/file_server/password", ""); + port = EDITOR_DEFAULT("filesystem/file_server/port", 6010); + password = EDITOR_DEFAULT("filesystem/file_server/password", ""); cmd = CMD_ACTIVATE; } @@ -318,8 +318,8 @@ EditorFileServer::EditorFileServer() { cmd = CMD_NONE; thread.start(_thread_start, this); - EDITOR_DEF("filesystem/file_server/port", 6010); - EDITOR_DEF("filesystem/file_server/password", ""); + EDITOR_DEFAULT("filesystem/file_server/port", 6010); + EDITOR_DEFAULT("filesystem/file_server/password", ""); } EditorFileServer::~EditorFileServer() { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 3dc854d6bd72..094dcc12d0b1 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1307,7 +1307,7 @@ void FileSystemDock::_update_project_settings_after_move(const Map prop_info = ProjectSettings::get_singleton()->get_custom_property_info(); for (const Map::Element *E = prop_info.front(); E; E = E->next()) { if (E->get().hint == PROPERTY_HINT_FILE) { - String old_path = GLOBAL_GET(E->key()); + String old_path = PROJECT_GET(E->key()); if (p_renames.has(old_path)) { ProjectSettings::get_singleton()->set_setting(E->key(), p_renames[old_path]); } @@ -1321,7 +1321,7 @@ void FileSystemDock::_update_project_settings_after_move(const Mapget().name.begins_with("autoload/")) { // If the autoload resource paths has a leading "*", it indicates that it is a Singleton, // so we have to handle both cases when updating. - String autoload = GLOBAL_GET(E->get().name); + String autoload = PROJECT_GET(E->get().name); String autoload_singleton = autoload.substr(1, autoload.length()); if (p_renames.has(autoload)) { ProjectSettings::get_singleton()->set_setting(E->get().name, p_renames[autoload]); diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index ddf89f077b80..cbadb2b6bd95 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -198,7 +198,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(PROJECT_DEFAULT("collada/use_ambient", false))) { return OK; } //well, it's an ambient light.. diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 2a399f4b0350..fcc69ed154ad 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -1048,7 +1048,7 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// player gizmo AudioStreamPlayer3DGizmoPlugin::AudioStreamPlayer3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/stream_player_3d", Color(0.4, 0.8, 1)); create_icon_material("stream_player_3d_icon", Node3DEditor::get_singleton()->get_theme_icon("Gizmo3DSamplePlayer", "EditorIcons")); create_material("stream_player_3d_material_primary", gizmo_color); @@ -1185,7 +1185,7 @@ void AudioStreamPlayer3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ////// Camera3DGizmoPlugin::Camera3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/camera", Color(0.8, 0.4, 0.8)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/camera", Color(0.8, 0.4, 0.8)); create_material("camera_material", gizmo_color); create_handle_material("handles"); @@ -1464,7 +1464,7 @@ void MeshInstance3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// OccluderInstance3DGizmoPlugin::OccluderInstance3DGizmoPlugin() { - create_material("line_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/occluder", Color(0.8, 0.5, 1))); + create_material("line_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/occluder", Color(0.8, 0.5, 1))); } bool OccluderInstance3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { @@ -1613,7 +1613,7 @@ void Position3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// Skeleton3DGizmoPlugin::Skeleton3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/skeleton", Color(1, 0.8, 0.4)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/skeleton", Color(1, 0.8, 0.4)); create_material("skeleton_material", gizmo_color); } @@ -1767,7 +1767,7 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// PhysicalBone3DGizmoPlugin::PhysicalBone3DGizmoPlugin() { - create_material("joint_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1))); + create_material("joint_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1))); } bool PhysicalBone3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { @@ -1900,7 +1900,7 @@ void PhysicalBone3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// RayCast3DGizmoPlugin::RayCast3DGizmoPlugin() { - const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + const Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); @@ -1954,7 +1954,7 @@ void SpringArm3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { } SpringArm3DGizmoPlugin::SpringArm3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); } @@ -1973,7 +1973,7 @@ int SpringArm3DGizmoPlugin::get_priority() const { ///// VehicleWheel3DGizmoPlugin::VehicleWheel3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); } @@ -2044,7 +2044,7 @@ void VehicleWheel3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { /////////// SoftBody3DGizmoPlugin::SoftBody3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); create_handle_material("handles"); } @@ -2124,7 +2124,7 @@ bool SoftBody3DGizmoPlugin::is_handle_highlighted(const EditorNode3DGizmo *p_giz /////////// VisibleOnScreenNotifier3DGizmoPlugin::VisibleOnScreenNotifier3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/visibility_notifier", Color(0.8, 0.5, 0.7)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/visibility_notifier", Color(0.8, 0.5, 0.7)); create_material("visibility_notifier_material", gizmo_color); gizmo_color.a = 0.1; create_material("visibility_notifier_solid_material", gizmo_color); @@ -2311,7 +2311,7 @@ void CPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// GPUParticles3DGizmoPlugin::GPUParticles3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particles", Color(0.8, 0.7, 0.4)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/particles", Color(0.8, 0.7, 0.4)); create_material("particles_material", gizmo_color); gizmo_color.a = 0.1; create_material("particles_solid_material", gizmo_color); @@ -2478,7 +2478,7 @@ void GPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// GPUParticlesCollision3DGizmoPlugin::GPUParticlesCollision3DGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particle_collision", Color(0.5, 0.7, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/particle_collision", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); gizmo_color.a = 0.15; create_material("shape_material_internal", gizmo_color); @@ -2736,7 +2736,7 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// ReflectionProbeGizmoPlugin::ReflectionProbeGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/reflection_probe", Color(0.6, 1, 0.5)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/reflection_probe", Color(0.6, 1, 0.5)); create_material("reflection_probe_material", gizmo_color); @@ -2928,7 +2928,7 @@ void ReflectionProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// DecalGizmoPlugin::DecalGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/decal", Color(0.6, 0.5, 1.0)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/decal", Color(0.6, 0.5, 1.0)); create_material("decal_material", gizmo_color); @@ -3061,7 +3061,7 @@ void DecalGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { /////////////////////////////// VoxelGIGizmoPlugin::VoxelGIGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/voxel_gi", Color(0.5, 1, 0.6)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/voxel_gi", Color(0.5, 1, 0.6)); create_material("voxel_gi_material", gizmo_color); @@ -3241,7 +3241,7 @@ void VoxelGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// LightmapGIGizmoPlugin::LightmapGIGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/lightmap_lines", Color(0.5, 0.6, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/lightmap_lines", Color(0.5, 0.6, 1)); gizmo_color.a = 0.1; create_material("lightmap_lines", gizmo_color); @@ -3433,7 +3433,7 @@ void LightmapGIGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///////// LightmapProbeGizmoPlugin::LightmapProbeGizmoPlugin() { - Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/lightprobe_lines", Color(0.5, 0.6, 1)); + Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/lightprobe_lines", Color(0.5, 0.6, 1)); gizmo_color.a = 0.3; create_material("lightprobe_lines", gizmo_color); @@ -3529,7 +3529,7 @@ void LightmapProbeGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// CollisionObject3DGizmoPlugin::CollisionObject3DGizmoPlugin() { - const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + const Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); @@ -3580,7 +3580,7 @@ void CollisionObject3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// CollisionShape3DGizmoPlugin::CollisionShape3DGizmoPlugin() { - const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + const Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); @@ -4181,7 +4181,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { ///// CollisionPolygon3DGizmoPlugin::CollisionPolygon3DGizmoPlugin() { - const Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); + const Color gizmo_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/shape", Color(0.5, 0.7, 1)); create_material("shape_material", gizmo_color); const float gizmo_value = gizmo_color.get_v(); const Color gizmo_color_disabled = Color(gizmo_value, gizmo_value, gizmo_value, 0.65); @@ -4229,10 +4229,10 @@ void CollisionPolygon3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { //// NavigationRegion3DGizmoPlugin::NavigationRegion3DGizmoPlugin() { - create_material("navigation_edge_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge", Color(0.5, 1, 1))); - create_material("navigation_edge_material_disabled", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_edge_disabled", Color(0.7, 0.7, 0.7))); - create_material("navigation_solid_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid", Color(0.5, 1, 1, 0.4))); - create_material("navigation_solid_material_disabled", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/navigation_solid_disabled", Color(0.7, 0.7, 0.7, 0.4))); + create_material("navigation_edge_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/navigation_edge", Color(0.5, 1, 1))); + create_material("navigation_edge_material_disabled", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/navigation_edge_disabled", Color(0.7, 0.7, 0.7))); + create_material("navigation_solid_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/navigation_solid", Color(0.5, 1, 1, 0.4))); + create_material("navigation_solid_material_disabled", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/navigation_solid_disabled", Color(0.7, 0.7, 0.7, 0.4))); } bool NavigationRegion3DGizmoPlugin::has_gizmo(Node3D *p_spatial) { @@ -4580,9 +4580,9 @@ void JointGizmosDrawer::draw_cone(const Transform3D &p_offset, const Basis &p_ba //// Joint3DGizmoPlugin::Joint3DGizmoPlugin() { - create_material("joint_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1))); - create_material("joint_body_a_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint_body_a", Color(0.6, 0.8, 1))); - create_material("joint_body_b_material", EDITOR_DEF("editors/3d_gizmos/gizmo_colors/joint_body_b", Color(0.6, 0.9, 1))); + create_material("joint_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/joint", Color(0.5, 0.8, 1))); + create_material("joint_body_a_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/joint_body_a", Color(0.6, 0.8, 1))); + create_material("joint_body_b_material", EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/joint_body_b", Color(0.6, 0.9, 1))); update_timer = memnew(Timer); update_timer->set_name("JointGizmoUpdateTimer"); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 2b92943f7ecb..d716ebd962f9 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1401,7 +1401,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { // Render every past/future step with the capture shader. RS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, onion.capture.material->get_rid()); - onion.capture.material->set_shader_param("bkg_color", GLOBAL_GET("rendering/environment/defaults/default_clear_color")); + onion.capture.material->set_shader_param("bkg_color", PROJECT_GET("rendering/environment/defaults/default_clear_color")); onion.capture.material->set_shader_param("differences_only", onion.differences_only); onion.capture.material->set_shader_param("present", onion.differences_only ? RS::get_singleton()->viewport_get_texture(present_rid) : RID()); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index cd61ebd41816..7d85d56edd88 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -530,7 +530,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { download = memnew(HTTPRequest); add_child(download); download->connect("request_completed", callable_mp(this, &EditorAssetLibraryItemDownload::_http_download_completed)); - download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + download->set_use_threads(EDITOR_DEFAULT("asset_library/use_threads", true)); download_error = memnew(AcceptDialog); add_child(download_error); @@ -601,7 +601,7 @@ void EditorAssetLibrary::_update_repository_options() { Dictionary default_urls; default_urls["godotengine.org"] = "https://godotengine.org/asset-library/api"; default_urls["localhost"] = "http://127.0.0.1/asset-library/api"; - Dictionary available_urls = _EDITOR_DEF("asset_library/available_urls", default_urls, true); + Dictionary available_urls = _EDITOR_DEFAULT("asset_library/available_urls", default_urls, true); repository->clear(); Array keys = available_urls.keys(); for (int i = 0; i < available_urls.size(); i++) { @@ -866,7 +866,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag iq.image_index = p_image_index; iq.image_type = p_type; iq.request = memnew(HTTPRequest); - iq.request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + iq.request->set_use_threads(EDITOR_DEFAULT("asset_library/use_threads", true)); iq.target = p_for; iq.queue_id = ++last_queue_id; @@ -1475,7 +1475,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { request = memnew(HTTPRequest); add_child(request); - request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true)); + request->set_use_threads(EDITOR_DEFAULT("asset_library/use_threads", true)); request->connect("request_completed", callable_mp(this, &EditorAssetLibrary::_http_request_completed)); last_queue_id = 0; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 7282475ddf47..c48de5abef38 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3682,7 +3682,7 @@ void CanvasItemEditor::set_current_tool(Tool p_tool) { void CanvasItemEditor::_notification(int p_what) { if (p_what == NOTIFICATION_PHYSICS_PROCESS) { - EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels")); + EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(PROJECT_GET("gui/common/snap_controls_to_pixels")); bool has_container_parents = false; int nb_control = 0; diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 5d1d29cbc878..ca2d688d59a2 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -294,7 +294,7 @@ void MeshLibraryEditorPlugin::make_visible(bool p_visible) { } MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { - EDITOR_DEF("editors/grid_map/preview_size", 64); + EDITOR_DEFAULT("editors/grid_map/preview_size", 64); mesh_library_editor = memnew(MeshLibraryEditor(p_node)); p_node->get_main_control()->add_child(mesh_library_editor); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index a7177faafab3..7a2b01cb16d3 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2252,7 +2252,7 @@ void Node3DEditorViewport::scale_freelook_speed(real_t scale) { Point2i Node3DEditorViewport::_get_warped_mouse_motion(const Ref &p_ev_mouse_motion) const { Point2i relative; - if (bool(EDITOR_DEF("editors/3d/navigation/warped_mouse_panning", false))) { + if (bool(EDITOR_DEFAULT("editors/3d/navigation/warped_mouse_panning", false))) { relative = Input::get_singleton()->warp_mouse_motion(p_ev_mouse_motion, surface->get_global_rect()); } else { relative = p_ev_mouse_motion->get_relative(); @@ -2376,12 +2376,12 @@ void Node3DEditorViewport::_project_settings_changed() { const int msaa_mode = ProjectSettings::get_singleton()->get("rendering/anti_aliasing/quality/msaa"); viewport->set_msaa(Viewport::MSAA(msaa_mode)); - const int ssaa_mode = GLOBAL_GET("rendering/anti_aliasing/quality/screen_space_aa"); + const int ssaa_mode = PROJECT_GET("rendering/anti_aliasing/quality/screen_space_aa"); viewport->set_screen_space_aa(Viewport::ScreenSpaceAA(ssaa_mode)); - const bool use_debanding = GLOBAL_GET("rendering/anti_aliasing/quality/use_debanding"); + const bool use_debanding = PROJECT_GET("rendering/anti_aliasing/quality/use_debanding"); viewport->set_use_debanding(use_debanding); - const bool use_occlusion_culling = GLOBAL_GET("rendering/occlusion_culling/use_occlusion_culling"); + const bool use_occlusion_culling = PROJECT_GET("rendering/occlusion_culling/use_occlusion_culling"); viewport->set_use_occlusion_culling(use_occlusion_culling); } @@ -7088,11 +7088,11 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { set_process_unhandled_key_input(true); add_to_group("_spatial_editor_group"); - EDITOR_DEF("editors/3d/manipulator_gizmo_size", 80); + EDITOR_DEFAULT("editors/3d/manipulator_gizmo_size", 80); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/3d/manipulator_gizmo_size", PROPERTY_HINT_RANGE, "16,160,1")); - EDITOR_DEF("editors/3d/manipulator_gizmo_opacity", 0.9); + EDITOR_DEFAULT("editors/3d/manipulator_gizmo_opacity", 0.9); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::FLOAT, "editors/3d/manipulator_gizmo_opacity", PROPERTY_HINT_RANGE, "0,1,0.01")); - EDITOR_DEF("editors/3d/navigation/show_viewport_rotation_gizmo", true); + EDITOR_DEFAULT("editors/3d/navigation/show_viewport_rotation_gizmo", true); over_gizmo_handle = -1; { @@ -7393,7 +7393,7 @@ Node3DEditorPlugin::~Node3DEditorPlugin() { } void EditorNode3DGizmoPlugin::create_material(const String &p_name, const Color &p_color, bool p_billboard, bool p_on_top, bool p_use_vertex_color) { - Color instantiated_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/instantiated", Color(0.7, 0.7, 0.7, 0.6)); + Color instantiated_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/instantiated", Color(0.7, 0.7, 0.7, 0.6)); Vector> mats; @@ -7435,7 +7435,7 @@ void EditorNode3DGizmoPlugin::create_material(const String &p_name, const Color } void EditorNode3DGizmoPlugin::create_icon_material(const String &p_name, const Ref &p_texture, bool p_on_top, const Color &p_albedo) { - Color instantiated_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/instantiated", Color(0.7, 0.7, 0.7, 0.6)); + Color instantiated_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/instantiated", Color(0.7, 0.7, 0.7, 0.6)); Vector> icons; diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 82b51f8a0667..be35a4059ff1 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -641,7 +641,7 @@ int Path3DGizmoPlugin::get_priority() const { } Path3DGizmoPlugin::Path3DGizmoPlugin() { - Color path_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8)); + Color path_color = EDITOR_DEFAULT("editors/3d_gizmos/gizmo_colors/path", Color(0.5, 0.5, 1.0, 0.8)); create_material("path_material", path_color); create_material("path_thin_material", Color(0.5, 0.5, 0.5)); create_handle_material("handles", false, Node3DEditor::get_singleton()->get_theme_icon("EditorPathSmoothHandle", "EditorIcons")); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index 1a13a028c8ad..1602ab9ce8e2 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1041,7 +1041,7 @@ void Polygon2DEditor::_uv_draw() { for (int i = 0; i < uvs.size(); i++) { int next = uv_draw_max > 0 ? (i + 1) % uv_draw_max : 0; - if (i < uv_draw_max && uv_drag && uv_move_current == UV_MODE_EDIT_POINT && EDITOR_DEF("editors/poly_editor/show_previous_outline", true)) { + if (i < uv_draw_max && uv_drag && uv_move_current == UV_MODE_EDIT_POINT && EDITOR_DEFAULT("editors/poly_editor/show_previous_outline", true)) { uv_edit_draw->draw_line(mtx.xform(points_prev[i]), mtx.xform(points_prev[next]), prev_color, Math::round(EDSCALE)); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 498d5b0711ce..08fc786dc2d5 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -963,7 +963,7 @@ bool ScriptEditor::_test_script_times_on_disk(RES p_for_script) { bool need_ask = false; bool need_reload = false; - bool use_autoreload = bool(EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change", false)); + bool use_autoreload = bool(EDITOR_DEFAULT("text_editor/files/auto_reload_scripts_on_external_change", false)); for (int i = 0; i < tab_container->get_child_count(); i++) { ScriptEditorBase *se = Object::cast_to(tab_container->get_child(i)); @@ -2500,7 +2500,7 @@ void ScriptEditor::_editor_settings_changed() { _update_script_colors(); _update_script_names(); - ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/files/auto_reload_and_parse_scripts_on_save", true)); + ScriptServer::set_reload_scripts_on_save(EDITOR_DEFAULT("text_editor/files/auto_reload_and_parse_scripts_on_save", true)); } void ScriptEditor::_filesystem_changed() { @@ -2829,7 +2829,7 @@ void ScriptEditor::_make_script_list_context_menu() { } void ScriptEditor::set_window_layout(Ref p_layout) { - if (!bool(EDITOR_DEF("text_editor/files/restore_scripts_on_load", true))) { + if (!bool(EDITOR_DEFAULT("text_editor/files/restore_scripts_on_load", true))) { return; } @@ -3705,20 +3705,20 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { script_editor->hide(); - EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change", true); - ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/files/auto_reload_and_parse_scripts_on_save", true)); - EDITOR_DEF("text_editor/files/open_dominant_script_on_scene_change", true); - EDITOR_DEF("text_editor/external/use_external_editor", false); - EDITOR_DEF("text_editor/external/exec_path", ""); - EDITOR_DEF("text_editor/script_list/script_temperature_enabled", true); - EDITOR_DEF("text_editor/script_list/script_temperature_history_size", 15); - EDITOR_DEF("text_editor/script_list/group_help_pages", true); + EDITOR_DEFAULT("text_editor/files/auto_reload_scripts_on_external_change", true); + ScriptServer::set_reload_scripts_on_save(EDITOR_DEFAULT("text_editor/files/auto_reload_and_parse_scripts_on_save", true)); + EDITOR_DEFAULT("text_editor/files/open_dominant_script_on_scene_change", true); + EDITOR_DEFAULT("text_editor/external/use_external_editor", false); + EDITOR_DEFAULT("text_editor/external/exec_path", ""); + EDITOR_DEFAULT("text_editor/script_list/script_temperature_enabled", true); + EDITOR_DEFAULT("text_editor/script_list/script_temperature_history_size", 15); + EDITOR_DEFAULT("text_editor/script_list/group_help_pages", true); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/script_list/sort_scripts_by", PROPERTY_HINT_ENUM, "Name,Path,None")); - EDITOR_DEF("text_editor/script_list/sort_scripts_by", 0); + EDITOR_DEFAULT("text_editor/script_list/sort_scripts_by", 0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "text_editor/script_list/list_script_names_as", PROPERTY_HINT_ENUM, "Name,Parent Directory And Name,Full Path")); - EDITOR_DEF("text_editor/script_list/list_script_names_as", 0); + EDITOR_DEFAULT("text_editor/script_list/list_script_names_as", 0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_path", PROPERTY_HINT_GLOBAL_FILE)); - EDITOR_DEF("text_editor/external/exec_flags", "{file}"); + EDITOR_DEFAULT("text_editor/external/exec_flags", "{file}"); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_flags", PROPERTY_HINT_PLACEHOLDER_TEXT, "Call flags with placeholders: {project}, {file}, {col}, {line}.")); ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index cc0fbcc634d9..a9333ca677d7 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -428,7 +428,7 @@ void ScriptTextEditor::_validate_script() { warnings_panel->clear(); // Add missing connections. - if (GLOBAL_GET("debug/gdscript/warnings/enable").booleanize()) { + if (PROJECT_GET("debug/gdscript/warnings/enable").booleanize()) { Node *base = get_tree()->get_edited_scene_root(); if (base && missing_connections.size() > 0) { warnings_panel->push_table(1); @@ -505,7 +505,7 @@ void ScriptTextEditor::_validate_script() { } errors_panel->pop(); // Table - bool highlight_safe = EDITOR_DEF("text_editor/highlighting/highlight_type_safe_lines", true); + bool highlight_safe = EDITOR_DEFAULT("text_editor/highlighting/highlight_type_safe_lines", true); bool last_is_safe = false; for (int i = 0; i < te->get_line_count(); i++) { if (errors.is_empty()) { @@ -1444,7 +1444,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data } if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) { - const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\""; + const String quote_style = EDITOR_DEFAULT("text_editor/completion/use_single_quotes", false) ? "'" : "\""; Array files = d["files"]; String text_to_drop; diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index c1216a9732df..a96964c0d554 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -435,13 +435,13 @@ void ShaderEditor::_project_settings_changed() { void ShaderEditor::_update_warnings(bool p_validate) { bool changed = false; - bool warnings_enabled = GLOBAL_GET("debug/shader_language/warnings/enable").booleanize(); + bool warnings_enabled = PROJECT_GET("debug/shader_language/warnings/enable").booleanize(); if (warnings_enabled != saved_warnings_enabled) { saved_warnings_enabled = warnings_enabled; changed = true; } - bool treat_warning_as_errors = GLOBAL_GET("debug/shader_language/warnings/treat_warnings_as_errors").booleanize(); + bool treat_warning_as_errors = PROJECT_GET("debug/shader_language/warnings/treat_warnings_as_errors").booleanize(); if (treat_warning_as_errors != saved_treat_warning_as_errors) { saved_treat_warning_as_errors = treat_warning_as_errors; changed = true; @@ -451,7 +451,7 @@ void ShaderEditor::_update_warnings(bool p_validate) { for (int i = 0; i < ShaderWarning::WARNING_MAX; i++) { ShaderWarning::Code code = (ShaderWarning::Code)i; - bool value = GLOBAL_GET("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code(code).to_lower()); + bool value = PROJECT_GET("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code(code).to_lower()); if (saved_warnings[code] != value) { saved_warnings[code] = value; @@ -479,7 +479,7 @@ void ShaderEditor::_check_for_external_edit() { return; } - bool use_autoreload = bool(EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change", false)); + bool use_autoreload = bool(EDITOR_DEFAULT("text_editor/files/auto_reload_scripts_on_external_change", false)); if (shader->get_last_modified_time() != FileAccess::get_modified_time(shader->get_path())) { if (use_autoreload) { _reload_shader_from_disk(); @@ -640,10 +640,10 @@ void ShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position) { } ShaderEditor::ShaderEditor(EditorNode *p_node) { - GLOBAL_DEF("debug/shader_language/warnings/enable", true); - GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors", false); + PROJECT_DEFAULT("debug/shader_language/warnings/enable", true); + PROJECT_DEFAULT("debug/shader_language/warnings/treat_warnings_as_errors", false); for (int i = 0; i < (int)ShaderWarning::WARNING_MAX; i++) { - GLOBAL_DEF("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true); + PROJECT_DEFAULT("debug/shader_language/warnings/" + ShaderWarning::get_name_from_code((ShaderWarning::Code)i).to_lower(), true); } _update_warnings(false); diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 0b02150444f4..51390bc7c023 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -59,7 +59,7 @@ void ThemeEditorPreview::_propagate_redraw(Control *p_at) { void ThemeEditorPreview::_refresh_interval() { // In case the project settings have changed. - preview_bg->set_color(GLOBAL_GET("rendering/environment/defaults/default_clear_color")); + preview_bg->set_color(PROJECT_GET("rendering/environment/defaults/default_clear_color")); _propagate_redraw(preview_bg); _propagate_redraw(preview_content); @@ -201,7 +201,7 @@ ThemeEditorPreview::ThemeEditorPreview() { preview_bg = memnew(ColorRect); preview_bg->set_anchors_and_offsets_preset(PRESET_WIDE); - preview_bg->set_color(GLOBAL_GET("rendering/environment/defaults/default_clear_color")); + preview_bg->set_color(PROJECT_GET("rendering/environment/defaults/default_clear_color")); preview_root->add_child(preview_bg); preview_content = memnew(MarginContainer); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 3f66f1f3750b..4a6f4cadc26d 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1540,7 +1540,7 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List(p_base)) { AnimationPlayer *ap = Object::cast_to(p_base); @@ -3285,9 +3285,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel profile_allow_editing = true; profile_allow_script_editing = true; - EDITOR_DEF("interface/editors/show_scene_tree_root_selection", true); - EDITOR_DEF("interface/editors/derive_script_globals_by_name", true); - EDITOR_DEF("_use_favorites_root_selection", false); + EDITOR_DEFAULT("interface/editors/show_scene_tree_root_selection", true); + EDITOR_DEFAULT("interface/editors/derive_script_globals_by_name", true); + EDITOR_DEFAULT("_use_favorites_root_selection", false); Resource::_update_configuration_warning = _update_configuration_warning; } diff --git a/main/main.cpp b/main/main.cpp index 2b5f8d93155e..789941b28a2a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -402,7 +402,7 @@ Error Main::test_setup() { globals = memnew(ProjectSettings); - GLOBAL_DEF("debug/settings/crash_handler/message", + PROJECT_DEFAULT("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues")); translation_server = memnew(TranslationServer); @@ -554,10 +554,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // Only flush stdout in debug builds by default, as spamming `print()` will // decrease performance if this is enabled. - GLOBAL_DEF_RST("application/run/flush_stdout_on_print", false); - GLOBAL_DEF_RST("application/run/flush_stdout_on_print.debug", true); + PROJECT_DEFAULT_RESTART("application/run/flush_stdout_on_print", false); + PROJECT_DEFAULT_RESTART("application/run/flush_stdout_on_print.debug", true); - GLOBAL_DEF("debug/settings/crash_handler/message", + PROJECT_DEFAULT("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues")); MAIN_PRINT("Main: Parse CMDLine"); @@ -1087,31 +1087,31 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // Initialize user data dir. OS::get_singleton()->ensure_user_data_dir(); - GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); + PROJECT_DEFAULT("memory/limits/multithreaded_server/rid_pool_prealloc", 60); ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/multithreaded_server/rid_pool_prealloc", PropertyInfo(Variant::INT, "memory/limits/multithreaded_server/rid_pool_prealloc", PROPERTY_HINT_RANGE, "0,500,1")); // No negative and limit to 500 due to crashes - GLOBAL_DEF("network/limits/debugger/max_chars_per_second", 32768); + PROJECT_DEFAULT("network/limits/debugger/max_chars_per_second", 32768); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_chars_per_second", PropertyInfo(Variant::INT, "network/limits/debugger/max_chars_per_second", PROPERTY_HINT_RANGE, "0, 4096, 1, or_greater")); - GLOBAL_DEF("network/limits/debugger/max_queued_messages", 2048); + PROJECT_DEFAULT("network/limits/debugger/max_queued_messages", 2048); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_queued_messages", PropertyInfo(Variant::INT, "network/limits/debugger/max_queued_messages", PROPERTY_HINT_RANGE, "0, 8192, 1, or_greater")); - GLOBAL_DEF("network/limits/debugger/max_errors_per_second", 400); + PROJECT_DEFAULT("network/limits/debugger/max_errors_per_second", 400); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_errors_per_second", PropertyInfo(Variant::INT, "network/limits/debugger/max_errors_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater")); - GLOBAL_DEF("network/limits/debugger/max_warnings_per_second", 400); + PROJECT_DEFAULT("network/limits/debugger/max_warnings_per_second", 400); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_warnings_per_second", PropertyInfo(Variant::INT, "network/limits/debugger/max_warnings_per_second", @@ -1143,29 +1143,29 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } #endif - GLOBAL_DEF("debug/file_logging/enable_file_logging", false); + PROJECT_DEFAULT("debug/file_logging/enable_file_logging", false); // Only file logging by default on desktop platforms as logs can't be // accessed easily on mobile/Web platforms (if at all). // This also prevents logs from being created for the editor instance, as feature tags // are disabled while in the editor (even if they should logically apply). - GLOBAL_DEF("debug/file_logging/enable_file_logging.pc", true); - GLOBAL_DEF("debug/file_logging/log_path", "user://logs/godot.log"); - GLOBAL_DEF("debug/file_logging/max_log_files", 5); + PROJECT_DEFAULT("debug/file_logging/enable_file_logging.pc", true); + PROJECT_DEFAULT("debug/file_logging/log_path", "user://logs/godot.log"); + PROJECT_DEFAULT("debug/file_logging/max_log_files", 5); ProjectSettings::get_singleton()->set_custom_property_info("debug/file_logging/max_log_files", PropertyInfo(Variant::INT, "debug/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater")); //no negative numbers if (!project_manager && !editor && FileAccess::get_create_func(FileAccess::ACCESS_USERDATA) && - GLOBAL_GET("debug/file_logging/enable_file_logging")) { + PROJECT_GET("debug/file_logging/enable_file_logging")) { // Don't create logs for the project manager as they would be written to // the current working directory, which is inconvenient. - String base_path = GLOBAL_GET("debug/file_logging/log_path"); - int max_files = GLOBAL_GET("debug/file_logging/max_log_files"); + String base_path = PROJECT_GET("debug/file_logging/log_path"); + int max_files = PROJECT_GET("debug/file_logging/max_log_files"); OS::get_singleton()->add_logger(memnew(RotatedFileLogger(base_path, max_files))); } - if (main_args.size() == 0 && String(GLOBAL_GET("application/run/main_scene")) == "") { + if (main_args.size() == 0 && String(PROJECT_GET("application/run/main_scene")) == "") { #ifdef TOOLS_ENABLED if (!editor && !project_manager) { #endif @@ -1201,36 +1201,36 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph register_core_extensions(); //before display - GLOBAL_DEF("rendering/driver/driver_name", "Vulkan"); + PROJECT_DEFAULT("rendering/driver/driver_name", "Vulkan"); ProjectSettings::get_singleton()->set_custom_property_info("rendering/driver/driver_name", PropertyInfo(Variant::STRING, "rendering/driver/driver_name", PROPERTY_HINT_ENUM, "Vulkan")); if (display_driver == "") { - display_driver = GLOBAL_GET("rendering/driver/driver_name"); + display_driver = PROJECT_GET("rendering/driver/driver_name"); } - GLOBAL_DEF_BASIC("display/window/size/width", 1024); + PROJECT_DEFAULT_BASIC("display/window/size/width", 1024); ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/width", PropertyInfo(Variant::INT, "display/window/size/width", PROPERTY_HINT_RANGE, "0,7680,or_greater")); // 8K resolution - GLOBAL_DEF_BASIC("display/window/size/height", 600); + PROJECT_DEFAULT_BASIC("display/window/size/height", 600); ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/height", PropertyInfo(Variant::INT, "display/window/size/height", PROPERTY_HINT_RANGE, "0,4320,or_greater")); // 8K resolution - GLOBAL_DEF_BASIC("display/window/size/resizable", true); - GLOBAL_DEF_BASIC("display/window/size/borderless", false); - GLOBAL_DEF_BASIC("display/window/size/fullscreen", false); - GLOBAL_DEF("display/window/size/always_on_top", false); - GLOBAL_DEF("display/window/size/test_width", 0); + PROJECT_DEFAULT_BASIC("display/window/size/resizable", true); + PROJECT_DEFAULT_BASIC("display/window/size/borderless", false); + PROJECT_DEFAULT_BASIC("display/window/size/fullscreen", false); + PROJECT_DEFAULT("display/window/size/always_on_top", false); + PROJECT_DEFAULT("display/window/size/test_width", 0); ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/test_width", PropertyInfo(Variant::INT, "display/window/size/test_width", PROPERTY_HINT_RANGE, "0,7680,or_greater")); // 8K resolution - GLOBAL_DEF("display/window/size/test_height", 0); + PROJECT_DEFAULT("display/window/size/test_height", 0); ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/test_height", PropertyInfo(Variant::INT, "display/window/size/test_height", @@ -1239,8 +1239,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (use_custom_res) { if (!force_res) { - window_size.width = GLOBAL_GET("display/window/size/width"); - window_size.height = GLOBAL_GET("display/window/size/height"); + window_size.width = PROJECT_GET("display/window/size/width"); + window_size.height = PROJECT_GET("display/window/size/height"); if (globals->has_setting("display/window/size/test_width") && globals->has_setting("display/window/size/test_height")) { @@ -1255,31 +1255,31 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } - if (!bool(GLOBAL_GET("display/window/size/resizable"))) { + if (!bool(PROJECT_GET("display/window/size/resizable"))) { window_flags |= DisplayServer::WINDOW_FLAG_RESIZE_DISABLED_BIT; } - if (bool(GLOBAL_GET("display/window/size/borderless"))) { + if (bool(PROJECT_GET("display/window/size/borderless"))) { window_flags |= DisplayServer::WINDOW_FLAG_BORDERLESS_BIT; } - if (bool(GLOBAL_GET("display/window/size/fullscreen"))) { + if (bool(PROJECT_GET("display/window/size/fullscreen"))) { window_mode = DisplayServer::WINDOW_MODE_FULLSCREEN; } - if (bool(GLOBAL_GET("display/window/size/always_on_top"))) { + if (bool(PROJECT_GET("display/window/size/always_on_top"))) { window_flags |= DisplayServer::WINDOW_FLAG_ALWAYS_ON_TOP_BIT; } } - GLOBAL_DEF("internationalization/rendering/force_right_to_left_layout_direction", false); - GLOBAL_DEF("internationalization/locale/include_text_server_data", false); + PROJECT_DEFAULT("internationalization/rendering/force_right_to_left_layout_direction", false); + PROJECT_DEFAULT("internationalization/locale/include_text_server_data", false); if (!force_lowdpi) { - OS::get_singleton()->_allow_hidpi = GLOBAL_DEF("display/window/dpi/allow_hidpi", false); + OS::get_singleton()->_allow_hidpi = PROJECT_DEFAULT("display/window/dpi/allow_hidpi", false); } /* todo restore - OS::get_singleton()->_allow_layered = GLOBAL_DEF("display/window/per_pixel_transparency/allowed", false); - video_mode.layered = GLOBAL_DEF("display/window/per_pixel_transparency/enabled", false); + OS::get_singleton()->_allow_layered = PROJECT_DEFAULT("display/window/per_pixel_transparency/allowed", false); + video_mode.layered = PROJECT_DEFAULT("display/window/per_pixel_transparency/enabled", false); */ if (editor || project_manager) { // The editor and project manager always detect and use hiDPI if needed @@ -1287,9 +1287,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->_allow_layered = false; } - OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); + OS::get_singleton()->_keep_screen_on = PROJECT_DEFAULT("display/window/energy_saving/keep_screen_on", true); if (rtm == -1) { - rtm = GLOBAL_DEF("rendering/driver/threads/thread_model", OS::RENDER_THREAD_SAFE); + rtm = PROJECT_DEFAULT("rendering/driver/threads/thread_model", OS::RENDER_THREAD_SAFE); } if (rtm >= 0 && rtm < 3) { @@ -1317,7 +1317,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } if (audio_driver == "") { // specified in project.godot - audio_driver = GLOBAL_DEF_RST_NOVAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name()); + audio_driver = PROJECT_DEF_RESTART_NO_VAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name()); } for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { @@ -1332,10 +1332,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } { - window_orientation = DisplayServer::ScreenOrientation(int(GLOBAL_DEF_BASIC("display/window/handheld/orientation", DisplayServer::ScreenOrientation::SCREEN_LANDSCAPE))); + window_orientation = DisplayServer::ScreenOrientation(int(PROJECT_DEFAULT_BASIC("display/window/handheld/orientation", DisplayServer::ScreenOrientation::SCREEN_LANDSCAPE))); } { - String vsync_mode = GLOBAL_DEF("display/window/vsync/vsync_mode", "Enabled"); + String vsync_mode = PROJECT_DEFAULT("display/window/vsync/vsync_mode", "Enabled"); if (vsync_mode == "Disabled") { window_vsync_mode = DisplayServer::VSYNC_DISABLED; @@ -1350,26 +1350,26 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph window_vsync_mode = DisplayServer::VSYNC_ENABLED; } } - Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF_BASIC("physics/common/physics_fps", 60)); + Engine::get_singleton()->set_iterations_per_second(PROJECT_DEFAULT_BASIC("physics/common/physics_fps", 60)); ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_fps", PropertyInfo(Variant::INT, "physics/common/physics_fps", PROPERTY_HINT_RANGE, "1,1000,1")); - Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5)); - Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0)); + Engine::get_singleton()->set_physics_jitter_fix(PROJECT_DEFAULT("physics/common/physics_jitter_fix", 0.5)); + Engine::get_singleton()->set_target_fps(PROJECT_DEFAULT("debug/settings/fps/force_fps", 0)); ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/fps/force_fps", PropertyInfo(Variant::INT, "debug/settings/fps/force_fps", PROPERTY_HINT_RANGE, "0,1000,1")); - GLOBAL_DEF("debug/settings/stdout/print_fps", false); - GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false); + PROJECT_DEFAULT("debug/settings/stdout/print_fps", false); + PROJECT_DEFAULT("debug/settings/stdout/verbose_stdout", false); if (!OS::get_singleton()->_verbose_stdout) { // Not manually overridden. - OS::get_singleton()->_verbose_stdout = GLOBAL_GET("debug/settings/stdout/verbose_stdout"); + OS::get_singleton()->_verbose_stdout = PROJECT_GET("debug/settings/stdout/verbose_stdout"); } if (frame_delay == 0) { - frame_delay = GLOBAL_DEF("application/run/frame_delay_msec", 0); + frame_delay = PROJECT_DEFAULT("application/run/frame_delay_msec", 0); ProjectSettings::get_singleton()->set_custom_property_info("application/run/frame_delay_msec", PropertyInfo(Variant::INT, "application/run/frame_delay_msec", @@ -1377,17 +1377,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph "0,100,1,or_greater")); // No negative numbers } - OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false)); + OS::get_singleton()->set_low_processor_usage_mode(PROJECT_DEFAULT("application/run/low_processor_mode", false)); OS::get_singleton()->set_low_processor_usage_mode_sleep_usec( - GLOBAL_DEF("application/run/low_processor_mode_sleep_usec", 6900)); // Roughly 144 FPS + PROJECT_DEFAULT("application/run/low_processor_mode_sleep_usec", 6900)); // Roughly 144 FPS ProjectSettings::get_singleton()->set_custom_property_info("application/run/low_processor_mode_sleep_usec", PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater")); // No negative numbers - GLOBAL_DEF("display/window/ios/hide_home_indicator", true); - GLOBAL_DEF("input_devices/pointing/ios/touch_delay", 0.150); + PROJECT_DEFAULT("display/window/ios/hide_home_indicator", true); + PROJECT_DEFAULT("input_devices/pointing/ios/touch_delay", 0.150); Engine::get_singleton()->set_frame_delay(frame_delay); @@ -1477,7 +1477,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { /* Determine text driver */ if (text_driver == "") { - text_driver = GLOBAL_GET("internationalization/rendering/text_driver"); + text_driver = PROJECT_GET("internationalization/rendering/text_driver"); } if (text_driver != "") { @@ -1569,13 +1569,13 @@ Error Main::setup2(Thread::ID p_main_tid_override) { /* Initialize Pen Tablet Driver */ { - GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver", ""); - GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver.Windows", ""); + PROJECT_DEF_RESTART_NO_VAL("input_devices/pen_tablet/driver", ""); + PROJECT_DEF_RESTART_NO_VAL("input_devices/pen_tablet/driver.Windows", ""); ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pen_tablet/driver.Windows", PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.Windows", PROPERTY_HINT_ENUM, "wintab,winink")); } if (tablet_driver == "") { // specified in project.godot - tablet_driver = GLOBAL_GET("input_devices/pen_tablet/driver"); + tablet_driver = PROJECT_GET("input_devices/pen_tablet/driver"); if (tablet_driver == "") { tablet_driver = DisplayServer::get_singleton()->tablet_get_driver_name(0); } @@ -1657,13 +1657,13 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: Load Boot Image"); - Color clear = GLOBAL_DEF("rendering/environment/defaults/default_clear_color", Color(0.3, 0.3, 0.3)); + Color clear = PROJECT_DEFAULT("rendering/environment/defaults/default_clear_color", Color(0.3, 0.3, 0.3)); RenderingServer::get_singleton()->set_default_clear_color(clear); if (show_logo) { //boot logo! - String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String()); - bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true); - bool boot_logo_filter = GLOBAL_DEF("application/boot_splash/use_filter", true); + String boot_logo_path = PROJECT_DEFAULT("application/boot_splash/image", String()); + bool boot_logo_scale = PROJECT_DEFAULT("application/boot_splash/fullsize", true); + bool boot_logo_filter = PROJECT_DEFAULT("application/boot_splash/use_filter", true); ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", @@ -1683,10 +1683,10 @@ Error Main::setup2(Thread::ID p_main_tid_override) { #if defined(TOOLS_ENABLED) && !defined(NO_EDITOR_SPLASH) const Color boot_bg_color = - GLOBAL_DEF("application/boot_splash/bg_color", + PROJECT_DEFAULT("application/boot_splash/bg_color", (editor || project_manager) ? boot_splash_editor_bg_color : boot_splash_bg_color); #else - const Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color); + const Color boot_bg_color = PROJECT_DEFAULT("application/boot_splash/bg_color", boot_splash_bg_color); #endif if (boot_logo.is_valid()) { RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale, @@ -1716,20 +1716,20 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: DCC"); RenderingServer::get_singleton()->set_default_clear_color( - GLOBAL_DEF("rendering/environment/defaults/default_clear_color", Color(0.3, 0.3, 0.3))); + PROJECT_DEFAULT("rendering/environment/defaults/default_clear_color", Color(0.3, 0.3, 0.3))); - GLOBAL_DEF("application/config/icon", String()); + PROJECT_DEFAULT("application/config/icon", String()); ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp,*.svg,*.svgz")); - GLOBAL_DEF("application/config/macos_native_icon", String()); + PROJECT_DEFAULT("application/config/macos_native_icon", String()); ProjectSettings::get_singleton()->set_custom_property_info("application/config/macos_native_icon", PropertyInfo(Variant::STRING, "application/config/macos_native_icon", PROPERTY_HINT_FILE, "*.icns")); - GLOBAL_DEF("application/config/windows_native_icon", String()); + PROJECT_DEFAULT("application/config/windows_native_icon", String()); ProjectSettings::get_singleton()->set_custom_property_info("application/config/windows_native_icon", PropertyInfo(Variant::STRING, "application/config/windows_native_icon", @@ -1737,7 +1737,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { Input *id = Input::get_singleton(); if (id) { - if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) && + if (bool(PROJECT_DEFAULT("input_devices/pointing/emulate_touch_from_mouse", false)) && !(editor || project_manager)) { bool found_touchscreen = false; for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) { @@ -1751,7 +1751,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { } } - id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input_devices/pointing/emulate_mouse_from_touch", true))); + id->set_emulate_mouse_from_touch(bool(PROJECT_DEFAULT("input_devices/pointing/emulate_mouse_from_touch", true))); } MAIN_PRINT("Main: Load Translations and Remaps"); @@ -1782,9 +1782,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) { register_platform_apis(); register_module_types(); - GLOBAL_DEF("display/mouse_cursor/custom_image", String()); - GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2()); - GLOBAL_DEF("display/mouse_cursor/tooltip_position_offset", Point2(10, 10)); + PROJECT_DEFAULT("display/mouse_cursor/custom_image", String()); + PROJECT_DEFAULT("display/mouse_cursor/custom_image_hotspot", Vector2()); + PROJECT_DEFAULT("display/mouse_cursor/tooltip_position_offset", Point2(10, 10)); ProjectSettings::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", @@ -1948,14 +1948,14 @@ bool Main::start() { // Hack to define Mono-specific project settings even on non-Mono builds, // so that we don't lose their descriptions and default values in DocData. // Default values should be synced with mono_gd/gd_mono.cpp. - GLOBAL_DEF("mono/debugger_agent/port", 23685); - GLOBAL_DEF("mono/debugger_agent/wait_for_debugger", false); - GLOBAL_DEF("mono/debugger_agent/wait_timeout", 3000); - GLOBAL_DEF("mono/profiler/args", "log:calls,alloc,sample,output=output.mlpd"); - GLOBAL_DEF("mono/profiler/enabled", false); - GLOBAL_DEF("mono/unhandled_exception_policy", 0); + PROJECT_DEFAULT("mono/debugger_agent/port", 23685); + PROJECT_DEFAULT("mono/debugger_agent/wait_for_debugger", false); + PROJECT_DEFAULT("mono/debugger_agent/wait_timeout", 3000); + PROJECT_DEFAULT("mono/profiler/args", "log:calls,alloc,sample,output=output.mlpd"); + PROJECT_DEFAULT("mono/profiler/enabled", false); + PROJECT_DEFAULT("mono/unhandled_exception_policy", 0); // From editor/csharp_project.cpp. - GLOBAL_DEF("mono/project/auto_update_project", true); + PROJECT_DEFAULT("mono/project/auto_update_project", true); #endif DocTools doc; @@ -2016,8 +2016,8 @@ bool Main::start() { } #endif - if (script == "" && game_path == "" && String(GLOBAL_GET("application/run/main_scene")) != "") { - game_path = GLOBAL_GET("application/run/main_scene"); + if (script == "" && game_path == "" && String(PROJECT_GET("application/run/main_scene")) != "") { + game_path = PROJECT_GET("application/run/main_scene"); } #ifdef TOOLS_ENABLED @@ -2034,7 +2034,7 @@ bool Main::start() { if (editor) { main_loop = memnew(SceneTree); } - String main_loop_type = GLOBAL_DEF("application/run/main_loop_type", "SceneTree"); + String main_loop_type = PROJECT_DEFAULT("application/run/main_loop_type", "SceneTree"); if (script != "") { Ref