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

Deselecting a node while working with signals #21950

Closed
saranvdev opened this issue Sep 10, 2018 · 2 comments · Fixed by #54071
Closed

Deselecting a node while working with signals #21950

saranvdev opened this issue Sep 10, 2018 · 2 comments · Fixed by #54071

Comments

@saranvdev
Copy link

Godot version:
3.1.dev-1

OS/device including version:
Arch Linux

Issue description:
Node gets deselected after any action related to signals. Connecting them, editing, etc.

Steps to reproduce:

  1. Select a node,
  2. Connect a signal,
  3. Node is deselected now (at least window says so, even if it is still highlighted)
    imgur-2018_09_10-20 48 38
@akien-mga
Copy link
Member

That's still reproducible in 3.3. I agree that it would be nice if the focus could be preserved.

@akien-mga
Copy link
Member

Here the relevant part of the stacktrace of what happens when connecting a signal to a node's script:

(gdb) bt
#0  NodeDock::set_node (this=0xa01e2a0, p_node=0x0) at editor/node_dock.cpp:69
#1  0x0000000002a88482 in EditorNode::_edit_current (this=0x7eed400) at editor/editor_node.cpp:1980
#2  0x0000000002a87dcc in EditorNode::push_item (this=0x7eed400, p_object=0xba503b0, p_property=..., p_inspector_only=false) at editor/editor_node.cpp:1907
#3  0x0000000002fabdd2 in ScriptEditor::_add_callback (this=0xa8506f0, p_obj=0xba49e10, p_function=..., p_args=...) at editor/plugins/script_editor_plugin.cpp:2277
#4  0x0000000002fcb3e0 in MethodBind3<Object*, String const&, PoolVector<String> const&>::call (this=0x7bcce10, p_object=0xa8506f0, p_args=0x7fffffffa750, p_arg_count=3, r_error=...)
    at ./core/method_bind.gen.inc:2429
#5  0x0000000004324728 in Object::call (this=0xa8506f0, p_method=..., p_args=0x7fffffffa750, p_argcount=3, r_error=...) at core/object.cpp:918
#6  0x0000000004326488 in Object::emit_signal (this=0x7eed400, p_name=..., p_args=0x7fffffffa750, p_argcount=3) at core/object.cpp:1226
#7  0x0000000004326b49 in Object::emit_signal (this=0x7eed400, p_name=..., p_arg1=..., p_arg2=..., p_arg3=..., p_arg4=..., p_arg5=...) at core/object.cpp:1281
#8  0x00000000032b841c in ConnectionsDock::_make_or_edit_connection (this=0xa021680) at editor/connections_dialog.cpp:587
...

ConnectionsDock::_make_or_edit_connection emits a signal which is intercepted by ScriptEditor and connected to its _add_callback, which pushes the script to EditorNode to have it opened in the script editor. That replaces the edited item which is no longer the originally selected node.

So to implement the enhancement discussed here, one would need either to figure out a more direct way to ensure that the script is opened properly to insert the new method, or save the previously edited object and pop it back (it might be in the editor_history stack).

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

Successfully merging a pull request may close this issue.

4 participants