Godot Version
4.2.2
Question
I’m trying to figure out how to emulate using the mouse to select objects inside of EditorPlugin. Basically my plugin is intercepting mouse events, but sometimes I want it to emulate the default behavior of the Godot editor. Is there any way for me to tell the editor to selected the object under the mouse cursor when it is clicked? I tried using the ray casting code, but that only works for physics objects.
You can inject input one of two ways. Viewports have push_input and Input has parse_input_event.
Also viewports have the gui_get_focus_owner which will I think do what you want with the raycast idea.
I don’t think that pushing more input events will help since my addon handles dragging and it would be complicated figuring out the right sequence of events to emulate. (I won’t know if I want to select things until after the mouse up event, so there’s no way to pass the mouse motion events before then without it affecting my addon).
It would be better if I could just call a method which returns everything selectable along a ray or within a frustum. I’m not sure how gui_get_focus_owner
will help - the docs say it will just return the currently selected component.