diff options
author | kobewi <kobewi4e@gmail.com> | 2022-06-06 15:22:57 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-06-07 14:14:03 +0200 |
commit | 83014f8901e04a1be7d4b8fecab1771f76125f12 (patch) | |
tree | b262a23e2c617270483dbca353de22721ae5b09a | |
parent | 4d2ecde3e22e2503715b0cec612dd8b767dce77a (diff) |
Add GLOBAL_DEF_INTERNAL to hide specific settings
-rw-r--r-- | core/config/project_settings.cpp | 19 | ||||
-rw-r--r-- | core/config/project_settings.h | 8 | ||||
-rw-r--r-- | doc/classes/ProjectSettings.xml | 9 | ||||
-rw-r--r-- | editor/editor_sectioned_inspector.cpp | 5 |
4 files changed, 30 insertions, 11 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index ff5ff83bf8..12d936d456 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -205,6 +205,11 @@ void ProjectSettings::set_as_basic(const String &p_name, bool p_basic) { props[p_name].basic = p_basic; } +void ProjectSettings::set_as_internal(const String &p_name, bool p_internal) { + ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + "."); + props[p_name].internal = p_internal; +} + void ProjectSettings::set_ignore_value_in_docs(const String &p_name, bool p_ignore) { ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + "."); #ifdef DEBUG_METHODS_ENABLED @@ -344,7 +349,7 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const { vc.name = E.key; vc.order = v->order; vc.type = v->variant.get_type(); - if (vc.name.begins_with("input/") || vc.name.begins_with("import/") || vc.name.begins_with("export/") || vc.name.begins_with("/remap") || vc.name.begins_with("/locale") || vc.name.begins_with("/autoload")) { + if (v->internal || vc.name.begins_with("input/") || vc.name.begins_with("importer_defaults/") || vc.name.begins_with("import/") || vc.name.begins_with("autoload/") || vc.name.begins_with("editor_plugins/") || vc.name.begins_with("shader_globals/")) { vc.flags = PROPERTY_USAGE_STORAGE; } else { vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE; @@ -890,7 +895,7 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) { ERR_FAIL_COND_V_MSG(p_path.is_empty(), ERR_INVALID_PARAMETER, "Project settings save path cannot be empty."); - PackedStringArray project_features = has_setting("application/config/features") ? (PackedStringArray)get_setting("application/config/features") : PackedStringArray(); + PackedStringArray project_features = get_setting("application/config/features"); // If there is no feature list currently present, force one to generate. if (project_features.is_empty()) { project_features = ProjectSettings::get_required_features(); @@ -994,7 +999,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 _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic, bool p_internal) { Variant ret; if (!ProjectSettings::get_singleton()->has_setting(p_var)) { ProjectSettings::get_singleton()->set(p_var, p_default); @@ -1006,6 +1011,7 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restar ProjectSettings::get_singleton()->set_as_basic(p_var, p_basic); ProjectSettings::get_singleton()->set_restart_if_changed(p_var, p_restart_if_changed); ProjectSettings::get_singleton()->set_ignore_value_in_docs(p_var, p_ignore_value_in_docs); + ProjectSettings::get_singleton()->set_as_internal(p_var, p_internal); return ret; } @@ -1151,7 +1157,7 @@ void ProjectSettings::_add_builtin_input_map() { action["events"] = events; String action_name = "input/" + E.key; - GLOBAL_DEF(action_name, action); + GLOBAL_DEF_INTERNAL(action_name, action); input_presets.push_back(action_name); } } @@ -1235,6 +1241,11 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("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"); + + // These properties will not show up in the dialog nor in the documentation. If you want to exclude whole groups, see _get_property_list() method. + GLOBAL_DEF_INTERNAL("application/config/features", PackedStringArray()); + GLOBAL_DEF_INTERNAL("internationalization/locale/translation_remaps", PackedStringArray()); + GLOBAL_DEF_INTERNAL("internationalization/locale/translations", PackedStringArray()); } ProjectSettings::~ProjectSettings() { diff --git a/core/config/project_settings.h b/core/config/project_settings.h index d9b1a9b81b..c3992a4db2 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -62,6 +62,7 @@ protected: int order = 0; bool persist = false; bool basic = false; + bool internal = false; Variant variant; Variant initial; bool hide_from_editor = false; @@ -141,6 +142,7 @@ public: void set_initial_value(const String &p_name, const Variant &p_value); void set_as_basic(const String &p_name, bool p_basic); + void set_as_internal(const String &p_name, bool p_internal); void set_restart_if_changed(const String &p_name, bool p_restart); void set_ignore_value_in_docs(const String &p_name, bool p_ignore); bool get_ignore_value_in_docs(const String &p_name) const; @@ -191,8 +193,8 @@ public: ~ProjectSettings(); }; -//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); +// 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); #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) @@ -204,4 +206,6 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restar #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) +#define GLOBAL_DEF_INTERNAL(m_var, m_value) _GLOBAL_DEF(m_var, m_value, false, false, false, true) + #endif // PROJECT_SETTINGS_H diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 98205e0e16..d1f8c18957 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -216,6 +216,9 @@ <member name="application/config/description" type="String" setter="" getter="" default=""""> The project's description, displayed as a tooltip in the Project Manager when hovering the project. </member> + <member name="application/config/features" type="PackedStringArray" setter="" getter=""> + List of internal features associated with the project, like [code]Double Precision[/code] or [code]C#[/code]. Not to be confused with feature tags. + </member> <member name="application/config/icon" type="String" setter="" getter="" default=""""> Icon used for the project, set when project loads. Exporters will also use this icon when possible. </member> @@ -811,6 +814,12 @@ <member name="internationalization/locale/test" type="String" setter="" getter="" default=""""> If non-empty, this locale will be used when running the project from the editor. </member> + <member name="internationalization/locale/translation_remaps" type="PackedStringArray" setter="" getter=""> + Locale-dependent resource remaps. Edit them in the "Localization" tab of Project Settings editor. + </member> + <member name="internationalization/locale/translations" type="PackedStringArray" setter="" getter=""> + List of translation files available in the project. Edit them in the "Localization" tab of Project Settings editor. + </member> <member name="internationalization/pseudolocalization/double_vowels" type="bool" setter="" getter="" default="false"> Double vowels in strings during pseudolocalization to simulate the lengthening of text due to localization. </member> diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index b7073665a8..801a1a4641 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -250,11 +250,6 @@ void SectionedInspector::update_category_list() { continue; } - // Filter out unnecessary ProjectSettings sections, as they already have their dedicated tabs. - if (pi.name.begins_with("autoload") || pi.name.begins_with("editor_plugins") || pi.name.begins_with("shader_globals")) { - continue; - } - if (!filter.is_empty() && !_property_path_matches(pi.name, filter, name_style)) { continue; } |