-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose CreateDialog
by adding EditorCreateDialog
singleton (accessed via EditorInterface
).
#99926
Expose CreateDialog
by adding EditorCreateDialog
singleton (accessed via EditorInterface
).
#99926
Conversation
CreateDialog
by adding EditorCreateDialog
as its interface class.CreateDialog
by adding EditorCreateDialog
singleton (accessed via EditorInterface
).
606e786
to
9e634eb
Compare
32e0f0a
to
1644db6
Compare
Can't the dialog be exposed via a method, like we did with SceneTreeDialog ( |
It can, but i forgot to update this in the top post. I'll update it soon. |
…a EditorInterface
…ow() and get_search_options()
25b3adb
to
0d88cf2
Compare
That doesn't really answer my question. |
This is good for addons that needs a custom create dialog, but for those who needs native changes, I mean, for tweaks on the native create dialogs, singleton is still the best solution from my own perspective of experience. |
Like what tweaks? The current properties can be replaced by arguments, like in my example. |
Or I can say, to "override" the native create dialogs. |
A fresh idea just hit me. Well, the next push will come soon. |
Superseded by #100135 |
Closes: godotengine/godot-proposals#11238 (Will be done via an addon if this gets merged)
Exposes
CreateDialog
in another way: By adding a new classEditorCreateDialog
as a singleton that can only be accessed viaEditorInterface
, with some singals and methods.Signals
created
: Emitted when an objects is created from the create dialog.favourites_updated
: Emitted when the content of "favourites" slot gets updated.Methods
add_type_to_blacklist(type_name: StringName)
: Adds a type to the blacklist and update the search result of the create dialog. The type in the blacklist will not be displayed in the create dialog.remove_type_from_blacklist(type_name: StringName)
: Removes a type from the blacklist. The type removed from the blacklist will get recovery of being displayed in the create dialog.set_type_custom_suffix(type_name: StringName, custom_suffix: String)
: Sets the custom suffix of the type in the create dialog. The item will display its suffix with higher priority. If the custom suffix is an empty string, the suffix will be hidden. This is useful for labeling the node by someone, or from some addon, or being used as a "namespace".get_type_custom_suffix(type_name: StringName)
: Returns the custom suffix of the type in the create dialog.clear_all_type_custom_suffixes()
: Removes all custom suffixes in the create dialog from all types (If the type is a script type, then it will fall back to showing the file name of the script).get_search_options
: Returns the "result list" (Tree
) that is used in the create dialog.get_dialog_window
: Returns the create dialog window. (ConfirmationDialog
)Why not exposing
CreateDialog
Exposing
CreateDialog
seems to be a much more easier and direct way. However, when a user is trying instantiating it withnew()
by mistake, the whole engine will crash. To make users' engines safe,EditorCreateDialog
provides a safer box where users will receive an error if they are trying to instantiate anEditorCreateDialog
without passing in aCreateDialog
instance, which is not exposed to the engine, and the instance create by mistake will be deleted immediately. A user should never try instantiatingEditorCreateDialog
, even though it's safe for them.Getting the instance of
EditorCreateDialog
A user can get access to it by calling
EditorInterface.get_create_dialog()
.WIPs