Merge pull request #46827 from lawnjelly/proj_settings_alias
Add GLOBAL_DEF_ALIAS and alias for rename of pixel_snap
This commit is contained in:
commit
9952a5039a
3 changed files with 19 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue