Skip to content
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

SceneTreeDock will now only attach scripts to the selected node if the ScriptCreateDialog was opened from the SceneTreeDock #30196

Merged

Conversation

LikeLakers2
Copy link
Contributor

@LikeLakers2 LikeLakers2 commented Jun 29, 2019

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 the popup_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 the popup_hide signal coming first, which I'm not sure would make sense anyways since popup_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.

@LikeLakers2
Copy link
Contributor Author

LikeLakers2 commented Jun 30, 2019

It appears I actually somehow broke adding scripts, upon further inspection. Looking into that.

Fixed. It turns out that the popup_hide signal was triggering before the script_created signal. As I would presume that the popup_hide signal should normally indicate cancelling, that's what I used it for, and that's how I would presume many editor plugins would handle it too -- but saying we cancelled before we say we succeeded makes no sense. So now script_created is triggered before popup_hide.

@LikeLakers2 LikeLakers2 force-pushed the scenetreedock-script-creation-bugfix branch from 9e7442c to 8de98c9 Compare June 30, 2019 02:53
@LikeLakers2 LikeLakers2 force-pushed the scenetreedock-script-creation-bugfix branch from 8de98c9 to 410054d Compare June 30, 2019 03:20
@akien-mga akien-mga added this to the 3.2 milestone Jun 30, 2019
@LikeLakers2
Copy link
Contributor Author

@akien-mga Not sure if you noticed while adding the 3.2 milestone, but I believe this PR is ready for merging (unless of course there's some barrier to merging that I'm not aware of).

@akien-mga akien-mga merged commit 0268a48 into godotengine:master Jul 1, 2019
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants