How To Use EditorPlugin's edit() Method

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By scrubswithnosleeves

Hey All,

As the title says, I don’t understand how to use the edit() function from the EditorPlugin Class. If you could explain it that would be much appreciated.

The reason for my interest is to get my EditorInspectorPlugin to “notice” some nodes I am injecting into the inspector. The EditorInspectorPlugin description says:

“When an object is edited, the can_handle function is called”

I was trying to use it by calling it from the script of the node I was injecting into the inspector: EditorPlugin.edit(self) where EditorPlugin is an Autoload of the EditorPlugin.

:bust_in_silhouette: Reply From: Zylann

EditorPlugin.edit() is not a function you should call yourself. You can call it, but it will do nothing more than whatever you wrote inside. It’s a function the editor is calling, when you select something like a node, or a resource.

To tell Godot to start editing an object, I think you can call EditorInterface.inspect_object: EditorInterface — Godot Engine (stable) documentation in English
But I’m not really sure if that’s what you are trying to do.

Awesome! EditorInterface.inspect_object is what I was looking for.

scrubswithnosleeves | 2021-01-27 05:25