diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 5a3ee7835ba..0d09d03f767 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -894,6 +894,21 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust } } +Variant _GLOBAL_DEF_ALIAS(const String &p_var, const String &p_old_name, const Variant &p_default, bool p_restart_if_changed) { + // if the new name setting isn't present, try the old one + if (!ProjectSettings::get_singleton()->has_setting(p_var)) { + + if (ProjectSettings::get_singleton()->has_setting(p_old_name)) { + + // if the old setting is present, get the value and set it in the new setting + Variant value = ProjectSettings::get_singleton()->get(p_old_name); + ProjectSettings::get_singleton()->set(p_var, value); + } + } + + return _GLOBAL_DEF(p_var, p_default, p_restart_if_changed); +} + Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed) { Variant ret; diff --git a/core/project_settings.h b/core/project_settings.h index 8fe12fde56e..3e8d7849e6b 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -163,8 +163,11 @@ public: //not a macro any longer Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed = false); +Variant _GLOBAL_DEF_ALIAS(const String &p_var, const String &p_old_name, const Variant &p_default, bool p_restart_if_changed = 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_ALIAS(m_var, m_old_name, m_value) _GLOBAL_DEF_ALIAS(m_var, m_old_name, m_value) +#define GLOBAL_DEF_ALIAS_RST(m_var, m_old_name, m_value) _GLOBAL_DEF(m_var, m_old_name, m_value, true) #define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var) #endif diff --git a/main/main.cpp b/main/main.cpp index 9453fe4eb10..c763c02c28b 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1126,7 +1126,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->_allow_layered = false; } - Engine::get_singleton()->_gpu_pixel_snap = GLOBAL_DEF("rendering/2d/snapping/use_gpu_pixel_snap", false); + Engine::get_singleton()->_gpu_pixel_snap = GLOBAL_DEF_ALIAS("rendering/2d/snapping/use_gpu_pixel_snap", "rendering/quality/2d/use_pixel_snap", false); OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); if (rtm == -1) {