#how to use EditorResourcePicker

1 messages · Page 1 of 1 (latest)

unreal tusk
#

In the documentation ( https://docs.godotengine.org/en/4.3/classes/class_editorresourcepicker.html#class-editorresourcepicker-property-edited-resource ) it says

Can be used with EditorInspectorPlugin to recreate the same behavior.

Note: This Control does not include any editor for the resource, as editing is controlled by the Inspector dock itself or sub-Inspectors.

I've some experience with EditorInspectorPlugins now, but I don't understand how I'm supposed to "recreate the behavior", as the docs say.
Specifically, I have an EditorProperty and it produces a custom control scene for some custom type of mine.

now that custom type of mine has a Resource member, and i want it to be editable right where the custom type field is exposed on some Node's script that I click on in the viewport.
so i add an EditorResourcePicker in the EditorProperty.
I can set the ResourcePicker's edited_resource property to point to my Resource. and it shows it corretly.

But, like the doc says, the control does not include any editor for the resource.
how would i add such an editor, so that i can change the resource?

marble nymph
#

If it's a resource to be edited directly, best bet is to use standard export

@export var my_res: MyResource

Then it'll give you the standard sub-editor

#

(currently there's no practical way to create a sub-editor. Technically it can be done but it's so complicated it's not worth it)

unreal tusk
marble nymph
#

The actual functionality is an unexposed class called EditorPropertyResource that is tightly integrated with the inspector dock.

marble nymph
unreal tusk
#

thanks. at this point i'm just curious to have a general idea how it would be done.
so, the way would be to modify the engine code itself and make my custom godot build?

marble nymph