-
-
Notifications
You must be signed in to change notification settings - Fork 98
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 SceneTreeDialog to scripting #7636
Comments
This is kind of a crux here, exposing internal components is a major tying up of the functionality and interface of things, which has to have a very good reason I really think editor functionality should be exposed through the editor interface, and not by directly exposing the classes themselves |
For other use-cases for this and #7635, my add-on animation-player-refactor needed to recreate both the
There are also addons like the popular aseprite-wizard or my own animated-sprite-2-player which needs a way to select an I think for editor tools that deals with editing the scene, having these options would make development much more convenient. |
What do you mean by the editor I interface? I doesn't super matter to me how dialogues like |
Literally |
Thanks for the support @poohcom1. Out of curiosity, how did you manage to implement |
Ah yes, that makes sense :) I'm still a little unclear on your proposal: do you want to add to |
No that ties in with the required behaviour of |
@nlupugla I had a more specific use-case so it's probably not what you're looking for. My property selector was only for AnimationPlayer tracks, so I just had to check the tracks for the properties I wanted to display and verify via I'm not 100% sure if I understand your requirements for listing only non-object Variants, but I don't see why you couldn't use
I agree that a feature like this is probably best implemented via the editor interface, although I'm not sure what it would look like since the whole process is asynchronous as we need to somehow retrieve the selected node later. We could do something like |
Let's keep each topic to each proposal shall we? The dialog uses signals already so it is asynchronous already in its use Edit: An alternative method would be to create a method like so: |
Fair point :) Thanks for the extra info poohcom1. |
@AThousandShips @raulsntos @YuriSizov I updated my OP with a proposed API addition for Also is there any preference around whether I implement this in the currently link PR versus creating a new PR that reflects the different implementation.? |
Describe the project you are working on
An addon built with GDExtension that helps users create saving and loading systems for their games.
Describe the problem or limitation you are having in your project
I want to use the engine's
SceneTreeDialog
to provide a UI where users can select nodes in a scene they want to save/load.I can imagine this dialog would be useful in other plugins/addons as well (although admittedly I can't think of a concrete example other than my own project mentioned above).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Exposing
SceneTreeDialog
to scripting will allow users to select which nodes they want to save/load using a familiar UI; the same one used in AnimationPlayer and MultiplayerSynchronizer.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Simply expose the existing
SceneTreeDialog
https://github.com/godotengine/godot/blob/fc99492d3066098e938449b10e02f8e01d07e2d1/editor/gui/scene_tree_editor.cpp#L1515C4-L1515C4 to scripting. See proposed implementation in draft PR godotengine/godot#81489.Edit: I received feedback that exposing
SceneTreeDialog
directly is not a good idea because it couples the implementation with the API. Instead, it was recommended that I incorporate some ofSceneTreeDialog
's functionality intoEditorInterface
. Here are my proposed additions toEditorInterface
.A few notes on the API
Array[Node]
instead of just aNode
let's you infer that the dialog was canceled (by checking whether the array is empty) and also allows multiple nodes to be selected in principle.Array[NodePath]
instead of anArray[Node]
if it makes more sense.popup_dialog_scene_tree
as opposed topopup_scenetree_dialog
(which is a function in the C++ source code) so that any future editor dialog functions added toEditorInterface
in this way (eg:popup_dialog_property_selector
) will appear near each other when sorted alphabetically.popup_dialog_scene_tree
.If this enhancement will not be used often, can it be worked around with a few lines of script?
It's more than a few lines of script to recreate the
SceneTreeDialog
.Is there a reason why this should be core and not an add-on in the asset library?
N/A
The text was updated successfully, but these errors were encountered: