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

AnimationPlayer emiting signal in the editor #13394

Closed
henriiquecampos opened this issue Nov 29, 2017 · 12 comments
Closed

AnimationPlayer emiting signal in the editor #13394

henriiquecampos opened this issue Nov 29, 2017 · 12 comments

Comments

@henriiquecampos
Copy link
Contributor

Windows 10, Godot 2.1.4

I think the the AnimationPlayer finished signal is being emitted within the editor without we set any tool script.

I made a simple scene connecting the finished signal to the queue_free of the root node of the scene. When I play the animation, both through the end and to the beginning, Godot crashes.

Steps to reproduce:

  1. Create a scene with a Label
  2. Add an AnimationPlayer as child
  3. Create an animation
  4. Connect finished signal to the queue_free method using the editor interface
  5. Play the animation
@reduz
Copy link
Member

reduz commented Nov 29, 2017 via email

@reduz
Copy link
Member

reduz commented Nov 29, 2017 via email

@henriiquecampos
Copy link
Contributor Author

This isn't expected really, it shouldn't emit it into the editor, or at least the node shouldn't be freed in the editor. The editor crashes, I guess, because of the freed root. But it strange that it is being triggered without a tool script, as far as I know, AnimationPlayer is the only node that triggers that.

@henriiquecampos
Copy link
Contributor Author

henriiquecampos commented Nov 29, 2017

Nope, tried with a Sprite and it also triggers the queue_free with its texture_changed signal.

So maybe...check for ! is_editor_hint to queue_free nodes?

I tested it with a child node, Godot doesn't crash but the node is freed from the editor's SceneTree
bug_demo

@reduz
Copy link
Member

reduz commented Nov 29, 2017 via email

@henriiquecampos
Copy link
Contributor Author

Seems like the perfect solution. Would it work for tool scripts?

I mean, if I connect a signal within the editor but call a method in a tool script, will this method be called?

@reduz
Copy link
Member

reduz commented Nov 29, 2017 via email

@henriiquecampos
Copy link
Contributor Author

henriiquecampos commented Nov 29, 2017

But the signal would be connected through the editor, only the method would be in code. I think I misexpressed myself :P

@reduz
Copy link
Member

reduz commented Nov 29, 2017

the fix is just making connnections with the persist flag not emit in editor mode

@reduz
Copy link
Member

reduz commented Nov 29, 2017

or maybe not, if you make a plugin using the editor itself to edit the UI, that will make it stop working, so i am not very sure.

@henriiquecampos
Copy link
Contributor Author

henriiquecampos commented Nov 29, 2017

Maybe let users set a flag to tell if the signal shall be executed in the editor?

I think it would be convenient to add just a CheckButton while connecting signals using the editor's interface, there's plenty of space to use it. And use it as an extra argument for connect ?

@akien-mga
Copy link
Member

Duplicate of #13070.

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

No branches or pull requests

3 participants