EditorResourcePicker.xml 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorResourcePicker" inherits="HBoxContainer" 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="can_drop_data_fw" qualifiers="const">
  14. <return type="bool" />
  15. <argument index="0" name="position" type="Vector2" />
  16. <argument index="1" name="data" type="Variant" />
  17. <argument index="2" name="from" type="Control" />
  18. <description>
  19. </description>
  20. </method>
  21. <method name="drop_data_fw">
  22. <return type="void" />
  23. <argument index="0" name="position" type="Vector2" />
  24. <argument index="1" name="data" type="Variant" />
  25. <argument index="2" name="from" type="Control" />
  26. <description>
  27. </description>
  28. </method>
  29. <method name="get_allowed_types" qualifiers="const">
  30. <return type="PoolStringArray" />
  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="get_drag_data_fw">
  36. <return type="Variant" />
  37. <argument index="0" name="position" type="Vector2" />
  38. <argument index="1" name="from" type="Control" />
  39. <description>
  40. </description>
  41. </method>
  42. <method name="handle_menu_selected" qualifiers="virtual">
  43. <return type="bool" />
  44. <argument index="0" name="id" type="int" />
  45. <description>
  46. This virtual method can be implemented to handle context menu items not handled by default. See [method set_create_options].
  47. </description>
  48. </method>
  49. <method name="set_create_options" qualifiers="virtual">
  50. <return type="void" />
  51. <argument index="0" name="menu_node" type="Object" />
  52. <description>
  53. 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.
  54. [b]Note:[/b] Implement [method handle_menu_selected] to handle these custom items.
  55. </description>
  56. </method>
  57. <method name="set_toggle_pressed">
  58. <return type="void" />
  59. <argument index="0" name="pressed" type="bool" />
  60. <description>
  61. Sets the toggle mode state for the main button. Works only if [member toggle_mode] is set to [code]true[/code].
  62. </description>
  63. </method>
  64. </methods>
  65. <members>
  66. <member name="base_type" type="String" setter="set_base_type" getter="get_base_type" default="&quot;&quot;">
  67. The base type of allowed resource types. Can be a comma-separated list of several options.
  68. </member>
  69. <member name="editable" type="bool" setter="set_editable" getter="is_editable" default="true">
  70. If [code]true[/code], the value can be selected and edited.
  71. </member>
  72. <member name="edited_resource" type="Resource" setter="set_edited_resource" getter="get_edited_resource">
  73. The edited resource value.
  74. </member>
  75. <member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" default="false">
  76. 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.
  77. </member>
  78. </members>
  79. <signals>
  80. <signal name="resource_changed">
  81. <argument index="0" name="resource" type="Resource" />
  82. <description>
  83. Emitted when the value of the edited resource was changed.
  84. </description>
  85. </signal>
  86. <signal name="resource_selected">
  87. <argument index="0" name="resource" type="Resource" />
  88. <argument index="1" name="edit" type="bool" />
  89. <description>
  90. 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.
  91. </description>
  92. </signal>
  93. </signals>
  94. <constants>
  95. </constants>
  96. </class>