Skip to content

Commit

Permalink
optimized documentation, avoid Dictionary gts being used globally f…
Browse files Browse the repository at this point in the history
…or the scope in `_configure_search_option_item(...)` to save as much ram as possible (?)
  • Loading branch information
Lazy-Rabbit-2001 committed Dec 17, 2024
1 parent 84b8bc1 commit 63bf5a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -952,14 +952,16 @@
Changing this value allows setting up a multi-project scenario where there are multiple [code].csproj[/code]. Keep in mind that the Godot project is considered one of the C# projects in the workspace and it's root directory should contain the [code]project.godot[/code] and [code].csproj[/code] next to each other.
</member>
<member name="editor/create_dialog/global_type_blocklist" type="PackedStringArray" setter="" getter="" default="PackedStringArray()">
A create dialog will hide all types in the blocklist.
Types in the global type blocklist will be hidden from all create dialogs, no matter if the dialogs are native or popped up by calling [method EditorInterface.popup_create_dialog].
[b]Note:[/b] Trying to list the base type (the root item in the dialog tree item component) will hide all types derived from the base type from the create dialog.
[b]Note:[/b] If you have used [method EditorInterface.popup_create_dialog], and its parameter [code]type_blocklist[/code] has the same element as one in the global type blocklist, the parameter [code]type_blocklist[/code] will be preferred over the global type blocklist.
</member>
<member name="editor/create_dialog/global_type_suffixes" type="Dictionary" setter="" getter="" default="{}">
A create dialog will set a custom suffix to a specific type name. The suffix will follow the name of the type item with braces.
Types in the global type suffixes map list will contain a custom suffix following the type name in all create dialogs, no matter if the dialogs are native or popped up by calling [method EditorInterface.popup_create_dialog].
If a type is global and comes from a script, whose suffix should have been its file name, the suffix will be set to the mapped one.
[b]Note:[/b] As built-in types and GDExtension types does not have a suffix, the custom suffix will be removed if the type is not in the map list.
[b]Note:[/b] The keys of the dictionary should be [StringName]s and the values should be [String]s, otherwise it would lead to unexpected behaviors.
[b]Note:[/b] If you have used [method EditorInterface.popup_create_dialog], and its parameter [code]type_suffixes[/code] has the same key as one in the global type suffixes list, the value in the parameter [code]type_suffixes[/code] will be preferred over the value in the global type blocklist.
</member>
<member name="editor/export/convert_text_resources_to_binary" type="bool" setter="" getter="" default="true">
If [code]true[/code], text resource ([code]tres[/code]) and text scene ([code]tscn[/code]) files are converted to their corresponding binary format on export. This decreases file sizes and speeds up loading slightly.
Expand Down
15 changes: 10 additions & 5 deletions editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,16 @@ void CreateDialog::_add_type(const StringName &p_type, TypeCategory p_type_categ
void CreateDialog::_configure_search_option_item(TreeItem *r_item, const StringName &p_type, TypeCategory p_type_category) {
bool script_type = ScriptServer::is_global_class(p_type);
bool is_abstract = false;
Dictionary gts = GLOBAL_GET("editor/create_dialog/global_type_suffixes");
if (p_type_category == TypeCategory::CPP_TYPE) {
r_item->set_text(0, p_type);
String suffix;
if (custom_type_suffixes.has(p_type)) {
suffix = custom_type_suffixes.get(p_type);
} else if (gts.has(p_type)) {
suffix = gts[p_type];
} else {
Dictionary gts = GLOBAL_GET("editor/create_dialog/global_type_suffixes");
if (gts.has(p_type)) {
suffix = gts[p_type];
}
}
if (!suffix.is_empty()) {
r_item->set_suffix(0, "(" + suffix + ")");
Expand All @@ -322,8 +324,11 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const StringN
if (scr.is_valid()) {
if (custom_type_suffixes.has(p_type)) {
suffix = custom_type_suffixes.get(p_type);
} else if (gts.has(p_type)) {
suffix = gts[p_type];
} else {
Dictionary gts = GLOBAL_GET("editor/create_dialog/global_type_suffixes");
if (gts.has(p_type)) {
suffix = gts[p_type];
}
}
}
if (!suffix.is_empty()) {
Expand Down

0 comments on commit 63bf5a6

Please sign in to comment.