SceneTreeDock will now only attach scripts to the selected node if the ScriptCreateDialog was opened from the SceneTreeDock #30196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found that the SceneTreeDock previously did not account for whether it was the one that opened the ScriptCreateDialog, when attaching scripts. This meant that if a editor plugin opened the ScriptCreateDialog, and a script was actually created from this, the SceneTreeDock would add that script to any selected nodes.
This fixes the issue by having the SceneTreeDock listen for the
script_created
signal only when it was the one who opened the dialog.I am not sure if the way I made this fix is the best way, so feedback would be appreciated if there's a better way I could do this.
This also changes ScriptCreateDialog to emit the
script_created
signal before thepopup_hide
signal, rather than the other way around, when a script is created/loaded successfully. As far as I'm aware, this shouldn't break much of anything (except those specifically relying on thepopup_hide
signal coming first, which I'm not sure would make sense anyways sincepopup_hide
typically indicates that the dialog was cancelled).I put this change in this PR as its own commit because I'm not sure putting it in its own PR would be better, as this PR would just end up relying on that PR being merged first anyways, plus I'm not sure how "Try to make simple PRs that handle one specific topic" would apply here. Please let me know if putting this sort of stuff in their own PRs would be preferred in the future.