diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-10-05 15:34:34 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-10-05 15:34:34 -0300 |
commit | 3d87b70f7a8cadaab581c481fcc51622e8043ee0 (patch) | |
tree | 0dcf539804decaf77f74086774a32c64872e7c11 /core/project_settings.cpp | |
parent | 928efe06d672d8afeb595f75878746a51e4dc2ce (diff) |
Added the set/get_setting function in Editor/Project settings. Renamed has() to has_setting. Fixes #11844
Diffstat (limited to 'core/project_settings.cpp')
-rw-r--r-- | core/project_settings.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 3e27597e74..ff2be87b07 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -420,7 +420,7 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { return OK; } -bool ProjectSettings::has(String p_var) const { +bool ProjectSettings::has_setting(String p_var) const { _THREAD_SAFE_METHOD_ @@ -800,7 +800,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) { Variant ret; - if (ProjectSettings::get_singleton()->has(p_var)) { + if (ProjectSettings::get_singleton()->has_setting(p_var)) { ret = ProjectSettings::get_singleton()->get(p_var); } else { ProjectSettings::get_singleton()->set(p_var, p_default); @@ -907,9 +907,19 @@ Variant ProjectSettings::property_get_revert(const String &p_name) { return props[p_name].initial; } +void ProjectSettings::set_setting(const String &p_setting, const Variant &p_value) { + set(p_setting, p_value); +} + +Variant ProjectSettings::get_setting(const String &p_setting) const { + return get(p_setting); +} + void ProjectSettings::_bind_methods() { - ClassDB::bind_method(D_METHOD("has", "name"), &ProjectSettings::has); + ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting); + ClassDB::bind_method(D_METHOD("set_setting", "name", "value"), &ProjectSettings::set_setting); + ClassDB::bind_method(D_METHOD("get_setting", "name"), &ProjectSettings::get_setting); ClassDB::bind_method(D_METHOD("set_order", "name", "position"), &ProjectSettings::set_order); ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order); ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value); |