0 votes

im trying to bind to the "selection changed" event inside an editor plugin:

func _enter_tree():
    dock = preload("res://xxx.tscn").instance()
    add_control_to_dock( DOCK_SLOT_RIGHT_BL, dock)

    var s
    s = get_selection() // seems to work (no error msg)
    var arr = s.get_selected_nodes()  //seems to work (no error msg)
    connect("selection_changed",s,"selected_changed1") //error: described below

func selected_changed1():

the error i get when trying to connect to the event is:

ERROR: In Object of type "EditorPlugin": Attempt to connect nonexistent signal  "selection_changed" to method "EditorSelection.selected_changed1"

but in editor_data.cpp i find:

void EditorSelection::_bind_methods() {


in Engine by (64 points)
edited by

1 Answer

+2 votes
Best answer

This is how I do it in 2.1.2:

get_selection().connect("selection_changed", self, "_on_selection_changed")
by (488 points)
selected by

This is correct. The reason is because "selection_changed" is a signal on the class EditorSelection.


You get one with a call to 'get_selection()' inside the EditorPlugin.

tnx for the really fast answer :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.