0.2.0-dev Download ZIP
72 lines ·4.0 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="EditorResourcePicker" inherits="HBoxContainer" api_type="editor" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Godot editor's control for selecting [Resource] type properties. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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. |
| 8 | [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. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="_handle_menu_selected" qualifiers="virtual"> |
| 14 | <return type="bool" /> |
| 15 | <param index="0" name="id" type="int" /> |
| 16 | <description> |
| 17 | This virtual method can be implemented to handle context menu items not handled by default. See [method _set_create_options]. |
| 18 | </description> |
| 19 | </method> |
| 20 | <method name="_set_create_options" qualifiers="virtual"> |
| 21 | <return type="void" /> |
| 22 | <param index="0" name="menu_node" type="Object" /> |
| 23 | <description> |
| 24 | This virtual method is called when updating the context menu of an [member editable] [EditorResourcePicker]. Implement this method to override the "New" items section with your own options. [param menu_node] is a reference to the [PopupMenu] node. |
| 25 | [b]Note:[/b] Implement [method _handle_menu_selected] to handle these custom items. |
| 26 | [b]Note:[/b] Relevant built-in options ("Load", "Copy", "Paste", etc.) are automatically added to the [param menu_node] afterwards, using their hard-coded IDs starting from [code]0[/code]. Custom options need to use non-colliding IDs to be handled properly. Using [code]id = 100 + custom_option_index[/code] is safe (this is what the default items in the "New" section use). |
| 27 | </description> |
| 28 | </method> |
| 29 | <method name="get_allowed_types" qualifiers="const"> |
| 30 | <return type="PackedStringArray" /> |
| 31 | <description> |
| 32 | 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. |
| 33 | </description> |
| 34 | </method> |
| 35 | <method name="set_toggle_pressed"> |
| 36 | <return type="void" /> |
| 37 | <param index="0" name="pressed" type="bool" /> |
| 38 | <description> |
| 39 | Sets the toggle mode state for the main button. Works only if [member toggle_mode] is set to [code]true[/code]. |
| 40 | </description> |
| 41 | </method> |
| 42 | </methods> |
| 43 | <members> |
| 44 | <member name="base_type" type="String" setter="set_base_type" getter="get_base_type" default=""""> |
| 45 | The base type of allowed resource types. Can be a comma-separated list of several options. |
| 46 | </member> |
| 47 | <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true" keywords="readonly, disabled, enabled"> |
| 48 | If [code]true[/code], the value can be selected and edited. |
| 49 | </member> |
| 50 | <member name="edited_resource" type="Resource" setter="set_edited_resource" getter="get_edited_resource"> |
| 51 | The edited resource value. |
| 52 | </member> |
| 53 | <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" default="false"> |
| 54 | 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. |
| 55 | </member> |
| 56 | </members> |
| 57 | <signals> |
| 58 | <signal name="resource_changed"> |
| 59 | <param index="0" name="resource" type="Resource" /> |
| 60 | <description> |
| 61 | Emitted when the value of the edited resource was changed. |
| 62 | </description> |
| 63 | </signal> |
| 64 | <signal name="resource_selected"> |
| 65 | <param index="0" name="resource" type="Resource" /> |
| 66 | <param index="1" name="inspect" type="bool" /> |
| 67 | <description> |
| 68 | 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. |
| 69 | </description> |
| 70 | </signal> |
| 71 | </signals> |
| 72 | </class> |