2021-05-17 20:25:38 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 21:18:53 +08:00
<class name= "EditorResourcePicker" inherits= "HBoxContainer" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2021-05-17 20:25:38 +08:00
<brief_description >
Godot editor's control for selecting [Resource] type properties.
</brief_description>
<description >
2021-05-19 20:19:07 +08:00
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.
2021-05-17 20:25:38 +08:00
</description>
<tutorials >
</tutorials>
<methods >
2021-06-13 07:32:28 +08:00
<method name= "_handle_menu_selected" qualifiers= "virtual" >
2021-12-30 01:27:44 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "id" type= "int" />
2021-05-19 20:19:07 +08:00
<description >
2021-06-13 07:32:28 +08:00
This virtual method can be implemented to handle context menu items not handled by default. See [method _set_create_options].
2021-05-19 20:19:07 +08:00
</description>
</method>
2021-06-13 07:32:28 +08:00
<method name= "_set_create_options" qualifiers= "virtual" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "menu_node" type= "Object" />
2021-05-19 20:19:07 +08:00
<description >
2022-08-13 00:07:53 +08:00
This virtual method is called when updating the context menu of [EditorResourcePicker]. Implement this method to override the "New ..." items with your own options. [param menu_node] is a reference to the [PopupMenu] node.
2021-06-13 07:32:28 +08:00
[b]Note:[/b] Implement [method _handle_menu_selected] to handle these custom items.
</description>
</method>
<method name= "get_allowed_types" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "PackedStringArray" />
2021-06-13 07:32:28 +08:00
<description >
Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned.
2021-05-19 20:19:07 +08:00
</description>
</method>
<method name= "set_toggle_pressed" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "pressed" type= "bool" />
2021-05-19 20:19:07 +08:00
<description >
Sets the toggle mode state for the main button. Works only if [member toggle_mode] is set to [code]true[/code].
</description>
</method>
2021-05-17 20:25:38 +08:00
</methods>
<members >
<member name= "base_type" type= "String" setter= "set_base_type" getter= "get_base_type" default= """" >
The base type of allowed resource types. Can be a comma-separated list of several options.
</member>
<member name= "editable" type= "bool" setter= "set_editable" getter= "is_editable" default= "true" >
If [code]true[/code], the value can be selected and edited.
</member>
<member name= "edited_resource" type= "Resource" setter= "set_edited_resource" getter= "get_edited_resource" >
The edited resource value.
</member>
2021-05-19 20:19:07 +08:00
<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>
2021-05-17 20:25:38 +08:00
</members>
<signals >
<signal name= "resource_changed" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "resource" type= "Resource" />
2021-05-17 20:25:38 +08:00
<description >
Emitted when the value of the edited resource was changed.
</description>
</signal>
<signal name= "resource_selected" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "resource" type= "Resource" />
2022-04-29 14:06:48 +08:00
<param index= "1" name= "inspect" type= "bool" />
2021-05-17 20:25:38 +08:00
<description >
2022-04-29 14:06:48 +08:00
Emitted when the resource value was set and user clicked to edit it. When [param inspect] is [code]true[/code], the signal was caused by the context menu "Edit" or "Inspect" option.
2021-05-17 20:25:38 +08:00
</description>
</signal>
</signals>
</class>