class_editorproperty.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the EditorProperty.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorProperty:
  6. EditorProperty
  7. ==============
  8. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Custom control to edit properties for adding into the inspector.
  10. Description
  11. -----------
  12. This control allows property editing for one or multiple properties into :ref:`EditorInspector<class_EditorInspector>`. It is added via :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>`.
  13. Properties
  14. ----------
  15. +-----------------------------+-----------------------------------------------------------+-----------+
  16. | :ref:`bool<class_bool>` | :ref:`checkable<class_EditorProperty_property_checkable>` | ``false`` |
  17. +-----------------------------+-----------------------------------------------------------+-----------+
  18. | :ref:`bool<class_bool>` | :ref:`checked<class_EditorProperty_property_checked>` | ``false`` |
  19. +-----------------------------+-----------------------------------------------------------+-----------+
  20. | :ref:`bool<class_bool>` | :ref:`draw_red<class_EditorProperty_property_draw_red>` | ``false`` |
  21. +-----------------------------+-----------------------------------------------------------+-----------+
  22. | :ref:`bool<class_bool>` | :ref:`keying<class_EditorProperty_property_keying>` | ``false`` |
  23. +-----------------------------+-----------------------------------------------------------+-----------+
  24. | :ref:`String<class_String>` | :ref:`label<class_EditorProperty_property_label>` | ``""`` |
  25. +-----------------------------+-----------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`read_only<class_EditorProperty_property_read_only>` | ``false`` |
  27. +-----------------------------+-----------------------------------------------------------+-----------+
  28. Methods
  29. -------
  30. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`add_focusable<class_EditorProperty_method_add_focusable>` **(** :ref:`Control<class_Control>` control **)** |
  32. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`emit_changed<class_EditorProperty_method_emit_changed>` **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value, :ref:`String<class_String>` field="", :ref:`bool<class_bool>` changing=false **)** |
  34. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Object<class_Object>` | :ref:`get_edited_object<class_EditorProperty_method_get_edited_object>` **(** **)** |
  36. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`String<class_String>` | :ref:`get_edited_property<class_EditorProperty_method_get_edited_property>` **(** **)** |
  38. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`String<class_String>` | :ref:`get_tooltip_text<class_EditorProperty_method_get_tooltip_text>` **(** **)** |const| |
  40. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_bottom_editor<class_EditorProperty_method_set_bottom_editor>` **(** :ref:`Control<class_Control>` editor **)** |
  42. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`update_property<class_EditorProperty_method_update_property>` **(** **)** |virtual| |
  44. +-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. Signals
  46. -------
  47. .. _class_EditorProperty_signal_multiple_properties_changed:
  48. - **multiple_properties_changed** **(** :ref:`PoolStringArray<class_PoolStringArray>` properties, :ref:`Array<class_Array>` value **)**
  49. Emit it if you want multiple properties modified at the same time. Do not use if added via :ref:`EditorInspectorPlugin.parse_property<class_EditorInspectorPlugin_method_parse_property>`.
  50. ----
  51. .. _class_EditorProperty_signal_object_id_selected:
  52. - **object_id_selected** **(** :ref:`String<class_String>` property, :ref:`int<class_int>` id **)**
  53. Used by sub-inspectors. Emit it if what was selected was an Object ID.
  54. ----
  55. .. _class_EditorProperty_signal_property_changed:
  56. - **property_changed** **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)**
  57. Do not emit this manually, use the :ref:`emit_changed<class_EditorProperty_method_emit_changed>` method instead.
  58. ----
  59. .. _class_EditorProperty_signal_property_checked:
  60. - **property_checked** **(** :ref:`String<class_String>` property, :ref:`String<class_String>` bool **)**
  61. Emitted when a property was checked. Used internally.
  62. ----
  63. .. _class_EditorProperty_signal_property_keyed:
  64. - **property_keyed** **(** :ref:`String<class_String>` property **)**
  65. Emit it if you want to add this value as an animation key (check for keying being enabled first).
  66. ----
  67. .. _class_EditorProperty_signal_property_keyed_with_value:
  68. - **property_keyed_with_value** **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value **)**
  69. Emit it if you want to key a property with a single value.
  70. ----
  71. .. _class_EditorProperty_signal_resource_selected:
  72. - **resource_selected** **(** :ref:`String<class_String>` path, :ref:`Resource<class_Resource>` resource **)**
  73. If you want a sub-resource to be edited, emit this signal with the resource.
  74. ----
  75. .. _class_EditorProperty_signal_selected:
  76. - **selected** **(** :ref:`String<class_String>` path, :ref:`int<class_int>` focusable_idx **)**
  77. Emitted when selected. Used internally.
  78. Property Descriptions
  79. ---------------------
  80. .. _class_EditorProperty_property_checkable:
  81. - :ref:`bool<class_bool>` **checkable**
  82. +-----------+----------------------+
  83. | *Default* | ``false`` |
  84. +-----------+----------------------+
  85. | *Setter* | set_checkable(value) |
  86. +-----------+----------------------+
  87. | *Getter* | is_checkable() |
  88. +-----------+----------------------+
  89. Used by the inspector, set to ``true`` when the property is checkable.
  90. ----
  91. .. _class_EditorProperty_property_checked:
  92. - :ref:`bool<class_bool>` **checked**
  93. +-----------+--------------------+
  94. | *Default* | ``false`` |
  95. +-----------+--------------------+
  96. | *Setter* | set_checked(value) |
  97. +-----------+--------------------+
  98. | *Getter* | is_checked() |
  99. +-----------+--------------------+
  100. Used by the inspector, set to ``true`` when the property is checked.
  101. ----
  102. .. _class_EditorProperty_property_draw_red:
  103. - :ref:`bool<class_bool>` **draw_red**
  104. +-----------+---------------------+
  105. | *Default* | ``false`` |
  106. +-----------+---------------------+
  107. | *Setter* | set_draw_red(value) |
  108. +-----------+---------------------+
  109. | *Getter* | is_draw_red() |
  110. +-----------+---------------------+
  111. 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.
  112. ----
  113. .. _class_EditorProperty_property_keying:
  114. - :ref:`bool<class_bool>` **keying**
  115. +-----------+-------------------+
  116. | *Default* | ``false`` |
  117. +-----------+-------------------+
  118. | *Setter* | set_keying(value) |
  119. +-----------+-------------------+
  120. | *Getter* | is_keying() |
  121. +-----------+-------------------+
  122. Used by the inspector, set to ``true`` when the property can add keys for animation.
  123. ----
  124. .. _class_EditorProperty_property_label:
  125. - :ref:`String<class_String>` **label**
  126. +-----------+------------------+
  127. | *Default* | ``""`` |
  128. +-----------+------------------+
  129. | *Setter* | set_label(value) |
  130. +-----------+------------------+
  131. | *Getter* | get_label() |
  132. +-----------+------------------+
  133. Set this property to change the label (if you want to show one).
  134. ----
  135. .. _class_EditorProperty_property_read_only:
  136. - :ref:`bool<class_bool>` **read_only**
  137. +-----------+----------------------+
  138. | *Default* | ``false`` |
  139. +-----------+----------------------+
  140. | *Setter* | set_read_only(value) |
  141. +-----------+----------------------+
  142. | *Getter* | is_read_only() |
  143. +-----------+----------------------+
  144. Used by the inspector, set to ``true`` when the property is read-only.
  145. Method Descriptions
  146. -------------------
  147. .. _class_EditorProperty_method_add_focusable:
  148. - void **add_focusable** **(** :ref:`Control<class_Control>` control **)**
  149. 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.
  150. ----
  151. .. _class_EditorProperty_method_emit_changed:
  152. - void **emit_changed** **(** :ref:`String<class_String>` property, :ref:`Variant<class_Variant>` value, :ref:`String<class_String>` field="", :ref:`bool<class_bool>` changing=false **)**
  153. 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).
  154. ----
  155. .. _class_EditorProperty_method_get_edited_object:
  156. - :ref:`Object<class_Object>` **get_edited_object** **(** **)**
  157. Gets the edited object.
  158. ----
  159. .. _class_EditorProperty_method_get_edited_property:
  160. - :ref:`String<class_String>` **get_edited_property** **(** **)**
  161. Gets the edited property. If your editor is for a single property (added via :ref:`EditorInspectorPlugin.parse_property<class_EditorInspectorPlugin_method_parse_property>`), then this will return the property.
  162. ----
  163. .. _class_EditorProperty_method_get_tooltip_text:
  164. - :ref:`String<class_String>` **get_tooltip_text** **(** **)** |const|
  165. Must be implemented to provide a custom tooltip to the property editor.
  166. ----
  167. .. _class_EditorProperty_method_set_bottom_editor:
  168. - void **set_bottom_editor** **(** :ref:`Control<class_Control>` editor **)**
  169. Puts the ``editor`` control below the property label. The control must be previously added using :ref:`Node.add_child<class_Node_method_add_child>`.
  170. ----
  171. .. _class_EditorProperty_method_update_property:
  172. - void **update_property** **(** **)** |virtual|
  173. When this virtual function is called, you must update your editor.
  174. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  175. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  176. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`