diff options
Diffstat (limited to 'core/config')
-rw-r--r-- | core/config/project_settings.cpp | 23 | ||||
-rw-r--r-- | core/config/project_settings.h | 4 |
2 files changed, 17 insertions, 10 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index d0de39a79d..1a0b11dd1f 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1048,6 +1048,12 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restar return ret; } +Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic, bool p_internal) { + Variant ret = _GLOBAL_DEF(p_info.name, p_default, p_restart_if_changed, p_ignore_value_in_docs, p_basic, p_internal); + ProjectSettings::get_singleton()->set_custom_property_info(p_info); + return ret; +} + Vector<String> ProjectSettings::get_optimizer_presets() const { List<PropertyInfo> pi; ProjectSettings::get_singleton()->get_property_list(&pi); @@ -1082,13 +1088,13 @@ void ProjectSettings::_add_property_info_bind(const Dictionary &p_info) { pinfo.hint_string = p_info["hint_string"]; } - set_custom_property_info(pinfo.name, pinfo); + set_custom_property_info(pinfo); } -void ProjectSettings::set_custom_property_info(const String &p_prop, const PropertyInfo &p_info) { - ERR_FAIL_COND(!props.has(p_prop)); - custom_prop_info[p_prop] = p_info; - custom_prop_info[p_prop].name = p_prop; +void ProjectSettings::set_custom_property_info(const PropertyInfo &p_info) { + const String &prop_name = p_info.name; + ERR_FAIL_COND(!props.has(prop_name)); + custom_prop_info[prop_name] = p_info; } const HashMap<StringName, PropertyInfo> &ProjectSettings::get_custom_property_info() const { @@ -1298,12 +1304,11 @@ ProjectSettings::ProjectSettings() { String("Please include this when reporting the bug to the project developer.")); GLOBAL_DEF("debug/settings/crash_handler/message.editor", String("Please include this when reporting the bug on: https://github.com/godotengine/godot/issues")); - GLOBAL_DEF_RST("rendering/occlusion_culling/bvh_build_quality", 2); - GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60); + GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/occlusion_culling/bvh_build_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), 2); + GLOBAL_DEF(PropertyInfo(Variant::INT, "memory/limits/multithreaded_server/rid_pool_prealloc", PROPERTY_HINT_RANGE, "0,500,1"), 60); // No negative and limit to 500 due to crashes. GLOBAL_DEF_RST("internationalization/rendering/force_right_to_left_layout_direction", false); - GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec", 2000); - ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/incremental_search_max_interval_msec", PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater")); // No negative numbers. + GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"), 2000); GLOBAL_DEF("rendering/rendering_device/staging_buffer/block_size_kb", 256); GLOBAL_DEF("rendering/rendering_device/staging_buffer/max_size_mb", 128); diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 960dfe0395..e7d7b50eaf 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -173,7 +173,7 @@ public: Error load_custom(const String &p_path); Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true); Error save(); - void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info); + void set_custom_property_info(const PropertyInfo &p_info); const HashMap<StringName, PropertyInfo> &get_custom_property_info() const; uint64_t get_last_saved_time() { return last_save_time; } @@ -199,6 +199,8 @@ public: // 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, bool p_internal = false); +Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p_restart_if_changed = false, bool p_ignore_value_in_docs = false, bool p_basic = false, bool p_internal = 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) |