EditorResourcePicker.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorResourcePicker" inherits="HBoxContainer" version="4.0">
  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="void" />
  15. <argument 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. <argument index="0" name="menu_node" type="Object" />
  23. <description>
  24. 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.
  25. [b]Note:[/b] Implement [method _handle_menu_selected] to handle these custom items.
  26. </description>
  27. </method>
  28. <method name="get_allowed_types" qualifiers="const">
  29. <return type="PackedStringArray" />
  30. <description>
  31. 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.
  32. </description>
  33. </method>
  34. <method name="set_toggle_pressed">
  35. <return type="void" />
  36. <argument index="0" name="pressed" type="bool" />
  37. <description>
  38. Sets the toggle mode state for the main button. Works only if [member toggle_mode] is set to [code]true[/code].
  39. </description>
  40. </method>
  41. </methods>
  42. <members>
  43. <member name="base_type" type="String" setter="set_base_type" getter="get_base_type" default="&quot;&quot;">
  44. The base type of allowed resource types. Can be a comma-separated list of several options.
  45. </member>
  46. <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true">
  47. If [code]true[/code], the value can be selected and edited.
  48. </member>
  49. <member name="edited_resource" type="Resource" setter="set_edited_resource" getter="get_edited_resource">
  50. The edited resource value.
  51. </member>
  52. <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" default="false">
  53. 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.
  54. </member>
  55. </members>
  56. <signals>
  57. <signal name="resource_changed">
  58. <argument index="0" name="resource" type="Resource" />
  59. <description>
  60. Emitted when the value of the edited resource was changed.
  61. </description>
  62. </signal>
  63. <signal name="resource_selected">
  64. <argument index="0" name="resource" type="Resource" />
  65. <argument index="1" name="edit" type="bool" />
  66. <description>
  67. Emitted when the resource value was set and user clicked to edit it. When [code]edit[/code] is [code]true[/code], the signal was caused by the context menu "Edit" option.
  68. </description>
  69. </signal>
  70. </signals>
  71. </class>