Use EditorResourcePicker in the Inspector

This commit is contained in:
Yuri Sizov
2021-05-19 15:19:07 +03:00
parent 896d84bd15
commit e9206a55ea
9 changed files with 362 additions and 800 deletions

View File

@ -4,8 +4,8 @@
Godot editor's control for selecting [Resource] type properties.
</brief_description>
<description>
This is a [Control] node similar to the one used in the Inspector dock when editing [Resource]s. It provides options for creating, loading, saving and converting resources.
[b]Note:[/b] It does not include an editor for the resource.
This [Control] node is used in the editor's Inspector dock to allow editing of [Resource] type properties. It provides options for creating, loading, saving and converting resources. Can be used with [EditorInspectorPlugin] to recreate the same behavior.
[b]Note:[/b] This [Control] does not include any editor for the resource, as editing is controlled by the Inspector dock itself or sub-Inspectors.
</description>
<tutorials>
</tutorials>
@ -51,6 +51,34 @@
<description>
</description>
</method>
<method name="handle_menu_selected" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="id" type="int">
</argument>
<description>
This virtual method can be implemented to handle context menu items not handled by default. See [method set_create_options].
</description>
</method>
<method name="set_create_options" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="menu_node" type="Object">
</argument>
<description>
This virtual method is called when updating the context menu of [EditorResourcePicker]. Implement this method to override the "New ..." items with your own options. [code]menu_node[/code] is a reference to the [PopupMenu] node.
[b]Note:[/b] Implement [method handle_menu_selected] to handle these custom items.
</description>
</method>
<method name="set_toggle_pressed">
<return type="void">
</return>
<argument index="0" name="pressed" type="bool">
</argument>
<description>
Sets the toggle mode state for the main button. Works only if [member toggle_mode] is set to [code]true[/code].
</description>
</method>
</methods>
<members>
<member name="base_type" type="String" setter="set_base_type" getter="get_base_type" default="&quot;&quot;">
@ -62,6 +90,9 @@
<member name="edited_resource" type="Resource" setter="set_edited_resource" getter="get_edited_resource">
The edited resource value.
</member>
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" default="false">
If [code]true[/code], the main button with the resource preview works in the toggle mode. Use [method set_toggle_pressed] to manually set the state.
</member>
</members>
<signals>
<signal name="resource_changed">