Merge pull request #61818 from KoBeWi/secret_prefix_stash

Made hidden ProjectSettings groups more explicit
This commit is contained in:
Rémi Verschelde 2023-08-29 15:05:38 +02:00
commit 8ebb34707a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
6 changed files with 30 additions and 2 deletions

View File

@ -249,6 +249,11 @@ bool ProjectSettings::get_ignore_value_in_docs(const String &p_name) const {
#endif #endif
} }
void ProjectSettings::add_hidden_prefix(const String &p_prefix) {
ERR_FAIL_COND_MSG(hidden_prefixes.find(p_prefix) > -1, vformat("Hidden prefix '%s' already exists.", p_prefix));
hidden_prefixes.push_back(p_prefix);
}
String ProjectSettings::globalize_path(const String &p_path) const { String ProjectSettings::globalize_path(const String &p_path) const {
if (p_path.begins_with("res://")) { if (p_path.begins_with("res://")) {
if (!resource_path.is_empty()) { if (!resource_path.is_empty()) {
@ -388,7 +393,18 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const {
vc.name = E.key; vc.name = E.key;
vc.order = v->order; vc.order = v->order;
vc.type = v->variant.get_type(); vc.type = v->variant.get_type();
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/")) {
bool internal = v->internal;
if (!internal) {
for (const String &F : hidden_prefixes) {
if (vc.name.begins_with(F)) {
internal = true;
break;
}
}
}
if (internal) {
vc.flags = PROPERTY_USAGE_STORAGE; vc.flags = PROPERTY_USAGE_STORAGE;
} else { } else {
vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE; vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE;
@ -1382,11 +1398,13 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);
// 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. // These properties will not show up in the dialog. If you want to exclude whole groups, use add_hidden_prefix().
GLOBAL_DEF_INTERNAL("application/config/features", PackedStringArray()); GLOBAL_DEF_INTERNAL("application/config/features", PackedStringArray());
GLOBAL_DEF_INTERNAL("internationalization/locale/translation_remaps", PackedStringArray()); GLOBAL_DEF_INTERNAL("internationalization/locale/translation_remaps", PackedStringArray());
GLOBAL_DEF_INTERNAL("internationalization/locale/translations", PackedStringArray()); GLOBAL_DEF_INTERNAL("internationalization/locale/translations", PackedStringArray());
GLOBAL_DEF_INTERNAL("internationalization/locale/translations_pot_files", PackedStringArray()); GLOBAL_DEF_INTERNAL("internationalization/locale/translations_pot_files", PackedStringArray());
ProjectSettings::get_singleton()->add_hidden_prefix("input/");
} }
ProjectSettings::~ProjectSettings() { ProjectSettings::~ProjectSettings() {

View File

@ -104,6 +104,7 @@ protected:
HashSet<String> custom_features; HashSet<String> custom_features;
HashMap<StringName, LocalVector<Pair<StringName, StringName>>> feature_overrides; HashMap<StringName, LocalVector<Pair<StringName, StringName>>> feature_overrides;
LocalVector<String> hidden_prefixes;
HashMap<StringName, AutoloadInfo> autoloads; HashMap<StringName, AutoloadInfo> autoloads;
Array global_class_list; Array global_class_list;
@ -168,6 +169,7 @@ public:
void set_restart_if_changed(const String &p_name, bool p_restart); 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); void set_ignore_value_in_docs(const String &p_name, bool p_ignore);
bool get_ignore_value_in_docs(const String &p_name) const; bool get_ignore_value_in_docs(const String &p_name) const;
void add_hidden_prefix(const String &p_prefix);
String get_project_data_dir_name() const; String get_project_data_dir_name() const;
String get_project_data_path() const; String get_project_data_path() const;

View File

@ -816,6 +816,8 @@ void EditorAutoloadSettings::_bind_methods() {
} }
EditorAutoloadSettings::EditorAutoloadSettings() { EditorAutoloadSettings::EditorAutoloadSettings() {
ProjectSettings::get_singleton()->add_hidden_prefix("autoload/");
// Make first cache // Make first cache
List<PropertyInfo> props; List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props); ProjectSettings::get_singleton()->get_property_list(&props);

View File

@ -205,6 +205,8 @@ void EditorPluginSettings::_bind_methods() {
} }
EditorPluginSettings::EditorPluginSettings() { EditorPluginSettings::EditorPluginSettings() {
ProjectSettings::get_singleton()->add_hidden_prefix("editor_plugins/");
plugin_config_dialog = memnew(PluginConfigDialog); plugin_config_dialog = memnew(PluginConfigDialog);
plugin_config_dialog->config(""); plugin_config_dialog->config("");
add_child(plugin_config_dialog); add_child(plugin_config_dialog);

View File

@ -199,6 +199,8 @@ void ImportDefaultsEditor::clear() {
} }
ImportDefaultsEditor::ImportDefaultsEditor() { ImportDefaultsEditor::ImportDefaultsEditor() {
ProjectSettings::get_singleton()->add_hidden_prefix("importer_defaults/");
HBoxContainer *hb = memnew(HBoxContainer); HBoxContainer *hb = memnew(HBoxContainer);
hb->add_child(memnew(Label(TTR("Importer:")))); hb->add_child(memnew(Label(TTR("Importer:"))));
importers = memnew(OptionButton); importers = memnew(OptionButton);

View File

@ -424,6 +424,8 @@ void ShaderGlobalsEditor::_notification(int p_what) {
} }
ShaderGlobalsEditor::ShaderGlobalsEditor() { ShaderGlobalsEditor::ShaderGlobalsEditor() {
ProjectSettings::get_singleton()->add_hidden_prefix("shader_globals/");
HBoxContainer *add_menu_hb = memnew(HBoxContainer); HBoxContainer *add_menu_hb = memnew(HBoxContainer);
add_child(add_menu_hb); add_child(add_menu_hb);