class_editorproperty.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorProperty.xml.
  6. .. _class_EditorProperty:
  7. EditorProperty
  8. ==============
  9. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Custom control for editing properties that can be added to the :ref:`EditorInspector<class_EditorInspector>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A custom control for editing properties that can be added to the :ref:`EditorInspector<class_EditorInspector>`. It is added via :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>`.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-----------------------------+-----------------------------------------------------------------+-----------+
  21. | :ref:`bool<class_bool>` | :ref:`checkable<class_EditorProperty_property_checkable>` | ``false`` |
  22. +-----------------------------+-----------------------------------------------------------------+-----------+
  23. | :ref:`bool<class_bool>` | :ref:`checked<class_EditorProperty_property_checked>` | ``false`` |
  24. +-----------------------------+-----------------------------------------------------------------+-----------+
  25. | :ref:`bool<class_bool>` | :ref:`deletable<class_EditorProperty_property_deletable>` | ``false`` |
  26. +-----------------------------+-----------------------------------------------------------------+-----------+
  27. | :ref:`bool<class_bool>` | :ref:`draw_warning<class_EditorProperty_property_draw_warning>` | ``false`` |
  28. +-----------------------------+-----------------------------------------------------------------+-----------+
  29. | :ref:`bool<class_bool>` | :ref:`keying<class_EditorProperty_property_keying>` | ``false`` |
  30. +-----------------------------+-----------------------------------------------------------------+-----------+
  31. | :ref:`String<class_String>` | :ref:`label<class_EditorProperty_property_label>` | ``""`` |
  32. +-----------------------------+-----------------------------------------------------------------+-----------+
  33. | :ref:`bool<class_bool>` | :ref:`read_only<class_EditorProperty_property_read_only>` | ``false`` |
  34. +-----------------------------+-----------------------------------------------------------------+-----------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | |void| | :ref:`_set_read_only<class_EditorProperty_private_method__set_read_only>`\ (\ read_only\: :ref:`bool<class_bool>`\ ) |virtual| |
  42. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | |void| | :ref:`_update_property<class_EditorProperty_private_method__update_property>`\ (\ ) |virtual| |
  44. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`add_focusable<class_EditorProperty_method_add_focusable>`\ (\ control\: :ref:`Control<class_Control>`\ ) |
  46. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | |void| | :ref:`emit_changed<class_EditorProperty_method_emit_changed>`\ (\ property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`, field\: :ref:`StringName<class_StringName>` = &"", changing\: :ref:`bool<class_bool>` = false\ ) |
  48. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Object<class_Object>` | :ref:`get_edited_object<class_EditorProperty_method_get_edited_object>`\ (\ ) |
  50. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`StringName<class_StringName>` | :ref:`get_edited_property<class_EditorProperty_method_get_edited_property>`\ (\ ) |const| |
  52. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | |void| | :ref:`set_bottom_editor<class_EditorProperty_method_set_bottom_editor>`\ (\ editor\: :ref:`Control<class_Control>`\ ) |
  54. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | |void| | :ref:`update_property<class_EditorProperty_method_update_property>`\ (\ ) |
  56. +-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. .. rst-class:: classref-section-separator
  58. ----
  59. .. rst-class:: classref-descriptions-group
  60. Signals
  61. -------
  62. .. _class_EditorProperty_signal_multiple_properties_changed:
  63. .. rst-class:: classref-signal
  64. **multiple_properties_changed**\ (\ properties\: :ref:`PackedStringArray<class_PackedStringArray>`, value\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_EditorProperty_signal_multiple_properties_changed>`
  65. Emit it if you want multiple properties modified at the same time. Do not use if added via :ref:`EditorInspectorPlugin._parse_property<class_EditorInspectorPlugin_private_method__parse_property>`.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_EditorProperty_signal_object_id_selected:
  69. .. rst-class:: classref-signal
  70. **object_id_selected**\ (\ property\: :ref:`StringName<class_StringName>`, id\: :ref:`int<class_int>`\ ) :ref:`🔗<class_EditorProperty_signal_object_id_selected>`
  71. Used by sub-inspectors. Emit it if what was selected was an Object ID.
  72. .. rst-class:: classref-item-separator
  73. ----
  74. .. _class_EditorProperty_signal_property_can_revert_changed:
  75. .. rst-class:: classref-signal
  76. **property_can_revert_changed**\ (\ property\: :ref:`StringName<class_StringName>`, can_revert\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_EditorProperty_signal_property_can_revert_changed>`
  77. Emitted when the revertability (i.e., whether it has a non-default value and thus is displayed with a revert icon) of a property has changed.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_EditorProperty_signal_property_changed:
  81. .. rst-class:: classref-signal
  82. **property_changed**\ (\ property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`, field\: :ref:`StringName<class_StringName>`, changing\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_EditorProperty_signal_property_changed>`
  83. Do not emit this manually, use the :ref:`emit_changed<class_EditorProperty_method_emit_changed>` method instead.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_EditorProperty_signal_property_checked:
  87. .. rst-class:: classref-signal
  88. **property_checked**\ (\ property\: :ref:`StringName<class_StringName>`, checked\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_EditorProperty_signal_property_checked>`
  89. Emitted when a property was checked. Used internally.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_EditorProperty_signal_property_deleted:
  93. .. rst-class:: classref-signal
  94. **property_deleted**\ (\ property\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EditorProperty_signal_property_deleted>`
  95. Emitted when a property was deleted. Used internally.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_EditorProperty_signal_property_favorited:
  99. .. rst-class:: classref-signal
  100. **property_favorited**\ (\ property\: :ref:`StringName<class_StringName>`, favorited\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_EditorProperty_signal_property_favorited>`
  101. Emit it if you want to mark a property as favorited, making it appear at the top of the inspector.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_EditorProperty_signal_property_keyed:
  105. .. rst-class:: classref-signal
  106. **property_keyed**\ (\ property\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_EditorProperty_signal_property_keyed>`
  107. Emit it if you want to add this value as an animation key (check for keying being enabled first).
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_EditorProperty_signal_property_keyed_with_value:
  111. .. rst-class:: classref-signal
  112. **property_keyed_with_value**\ (\ property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_EditorProperty_signal_property_keyed_with_value>`
  113. Emit it if you want to key a property with a single value.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_EditorProperty_signal_property_pinned:
  117. .. rst-class:: classref-signal
  118. **property_pinned**\ (\ property\: :ref:`StringName<class_StringName>`, pinned\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_EditorProperty_signal_property_pinned>`
  119. Emit it if you want to mark (or unmark) the value of a property for being saved regardless of being equal to the default value.
  120. The default value is the one the property will get when the node is just instantiated and can come from an ancestor scene in the inheritance/instantiation chain, a script or a builtin class.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_EditorProperty_signal_resource_selected:
  124. .. rst-class:: classref-signal
  125. **resource_selected**\ (\ path\: :ref:`String<class_String>`, resource\: :ref:`Resource<class_Resource>`\ ) :ref:`🔗<class_EditorProperty_signal_resource_selected>`
  126. If you want a sub-resource to be edited, emit this signal with the resource.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_EditorProperty_signal_selected:
  130. .. rst-class:: classref-signal
  131. **selected**\ (\ path\: :ref:`String<class_String>`, focusable_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_EditorProperty_signal_selected>`
  132. Emitted when selected. Used internally.
  133. .. rst-class:: classref-section-separator
  134. ----
  135. .. rst-class:: classref-descriptions-group
  136. Property Descriptions
  137. ---------------------
  138. .. _class_EditorProperty_property_checkable:
  139. .. rst-class:: classref-property
  140. :ref:`bool<class_bool>` **checkable** = ``false`` :ref:`🔗<class_EditorProperty_property_checkable>`
  141. .. rst-class:: classref-property-setget
  142. - |void| **set_checkable**\ (\ value\: :ref:`bool<class_bool>`\ )
  143. - :ref:`bool<class_bool>` **is_checkable**\ (\ )
  144. Used by the inspector, set to ``true`` when the property is checkable.
  145. .. rst-class:: classref-item-separator
  146. ----
  147. .. _class_EditorProperty_property_checked:
  148. .. rst-class:: classref-property
  149. :ref:`bool<class_bool>` **checked** = ``false`` :ref:`🔗<class_EditorProperty_property_checked>`
  150. .. rst-class:: classref-property-setget
  151. - |void| **set_checked**\ (\ value\: :ref:`bool<class_bool>`\ )
  152. - :ref:`bool<class_bool>` **is_checked**\ (\ )
  153. Used by the inspector, set to ``true`` when the property is checked.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_EditorProperty_property_deletable:
  157. .. rst-class:: classref-property
  158. :ref:`bool<class_bool>` **deletable** = ``false`` :ref:`🔗<class_EditorProperty_property_deletable>`
  159. .. rst-class:: classref-property-setget
  160. - |void| **set_deletable**\ (\ value\: :ref:`bool<class_bool>`\ )
  161. - :ref:`bool<class_bool>` **is_deletable**\ (\ )
  162. Used by the inspector, set to ``true`` when the property can be deleted by the user.
  163. .. rst-class:: classref-item-separator
  164. ----
  165. .. _class_EditorProperty_property_draw_warning:
  166. .. rst-class:: classref-property
  167. :ref:`bool<class_bool>` **draw_warning** = ``false`` :ref:`🔗<class_EditorProperty_property_draw_warning>`
  168. .. rst-class:: classref-property-setget
  169. - |void| **set_draw_warning**\ (\ value\: :ref:`bool<class_bool>`\ )
  170. - :ref:`bool<class_bool>` **is_draw_warning**\ (\ )
  171. Used by the inspector, set to ``true`` when the property is drawn with the editor theme's warning color. This is used for editable children's properties.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_EditorProperty_property_keying:
  175. .. rst-class:: classref-property
  176. :ref:`bool<class_bool>` **keying** = ``false`` :ref:`🔗<class_EditorProperty_property_keying>`
  177. .. rst-class:: classref-property-setget
  178. - |void| **set_keying**\ (\ value\: :ref:`bool<class_bool>`\ )
  179. - :ref:`bool<class_bool>` **is_keying**\ (\ )
  180. Used by the inspector, set to ``true`` when the property can add keys for animation.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_EditorProperty_property_label:
  184. .. rst-class:: classref-property
  185. :ref:`String<class_String>` **label** = ``""`` :ref:`🔗<class_EditorProperty_property_label>`
  186. .. rst-class:: classref-property-setget
  187. - |void| **set_label**\ (\ value\: :ref:`String<class_String>`\ )
  188. - :ref:`String<class_String>` **get_label**\ (\ )
  189. Set this property to change the label (if you want to show one).
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_EditorProperty_property_read_only:
  193. .. rst-class:: classref-property
  194. :ref:`bool<class_bool>` **read_only** = ``false`` :ref:`🔗<class_EditorProperty_property_read_only>`
  195. .. rst-class:: classref-property-setget
  196. - |void| **set_read_only**\ (\ value\: :ref:`bool<class_bool>`\ )
  197. - :ref:`bool<class_bool>` **is_read_only**\ (\ )
  198. Used by the inspector, set to ``true`` when the property is read-only.
  199. .. rst-class:: classref-section-separator
  200. ----
  201. .. rst-class:: classref-descriptions-group
  202. Method Descriptions
  203. -------------------
  204. .. _class_EditorProperty_private_method__set_read_only:
  205. .. rst-class:: classref-method
  206. |void| **_set_read_only**\ (\ read_only\: :ref:`bool<class_bool>`\ ) |virtual| :ref:`🔗<class_EditorProperty_private_method__set_read_only>`
  207. Called when the read-only status of the property is changed. It may be used to change custom controls into a read-only or modifiable state.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_EditorProperty_private_method__update_property:
  211. .. rst-class:: classref-method
  212. |void| **_update_property**\ (\ ) |virtual| :ref:`🔗<class_EditorProperty_private_method__update_property>`
  213. When this virtual function is called, you must update your editor.
  214. .. rst-class:: classref-item-separator
  215. ----
  216. .. _class_EditorProperty_method_add_focusable:
  217. .. rst-class:: classref-method
  218. |void| **add_focusable**\ (\ control\: :ref:`Control<class_Control>`\ ) :ref:`🔗<class_EditorProperty_method_add_focusable>`
  219. If any of the controls added can gain keyboard focus, add it here. This ensures that focus will be restored if the inspector is refreshed.
  220. .. rst-class:: classref-item-separator
  221. ----
  222. .. _class_EditorProperty_method_emit_changed:
  223. .. rst-class:: classref-method
  224. |void| **emit_changed**\ (\ property\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`, field\: :ref:`StringName<class_StringName>` = &"", changing\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_EditorProperty_method_emit_changed>`
  225. If one or several properties have changed, this must be called. ``field`` is used in case your editor can modify fields separately (as an example, Vector3.x). The ``changing`` argument avoids the editor requesting this property to be refreshed (leave as ``false`` if unsure).
  226. .. rst-class:: classref-item-separator
  227. ----
  228. .. _class_EditorProperty_method_get_edited_object:
  229. .. rst-class:: classref-method
  230. :ref:`Object<class_Object>` **get_edited_object**\ (\ ) :ref:`🔗<class_EditorProperty_method_get_edited_object>`
  231. Gets the edited object.
  232. .. rst-class:: classref-item-separator
  233. ----
  234. .. _class_EditorProperty_method_get_edited_property:
  235. .. rst-class:: classref-method
  236. :ref:`StringName<class_StringName>` **get_edited_property**\ (\ ) |const| :ref:`🔗<class_EditorProperty_method_get_edited_property>`
  237. Gets the edited property. If your editor is for a single property (added via :ref:`EditorInspectorPlugin._parse_property<class_EditorInspectorPlugin_private_method__parse_property>`), then this will return the property.
  238. .. rst-class:: classref-item-separator
  239. ----
  240. .. _class_EditorProperty_method_set_bottom_editor:
  241. .. rst-class:: classref-method
  242. |void| **set_bottom_editor**\ (\ editor\: :ref:`Control<class_Control>`\ ) :ref:`🔗<class_EditorProperty_method_set_bottom_editor>`
  243. Puts the ``editor`` control below the property label. The control must be previously added using :ref:`Node.add_child<class_Node_method_add_child>`.
  244. .. rst-class:: classref-item-separator
  245. ----
  246. .. _class_EditorProperty_method_update_property:
  247. .. rst-class:: classref-method
  248. |void| **update_property**\ (\ ) :ref:`🔗<class_EditorProperty_method_update_property>`
  249. Forces refresh of the property display.
  250. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  251. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  252. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  253. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  254. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  255. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  256. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  257. .. |void| replace:: :abbr:`void (No return value.)`