class_editorspatialgizmo.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/EditorSpatialGizmo.xml.
  6. .. _class_EditorSpatialGizmo:
  7. EditorSpatialGizmo
  8. ==================
  9. **Inherits:** :ref:`SpatialGizmo<class_SpatialGizmo>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Custom gizmo for editing Spatial objects.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` for more information.
  15. .. rst-class:: classref-reftable-group
  16. Methods
  17. -------
  18. .. table::
  19. :widths: auto
  20. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`add_collision_segments<class_EditorSpatialGizmo_method_add_collision_segments>` **(** :ref:`PoolVector3Array<class_PoolVector3Array>` segments **)** |
  22. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_collision_triangles<class_EditorSpatialGizmo_method_add_collision_triangles>` **(** :ref:`TriangleMesh<class_TriangleMesh>` triangles **)** |
  24. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>` **(** :ref:`PoolVector3Array<class_PoolVector3Array>` handles, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false **)** |
  26. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`add_lines<class_EditorSpatialGizmo_method_add_lines>` **(** :ref:`PoolVector3Array<class_PoolVector3Array>` lines, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`Color<class_Color>` modulate=Color( 1, 1, 1, 1 ) **)** |
  28. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`add_mesh<class_EditorSpatialGizmo_method_add_mesh>` **(** :ref:`Mesh<class_Mesh>` mesh, :ref:`bool<class_bool>` billboard=false, :ref:`SkinReference<class_SkinReference>` skeleton=null, :ref:`Material<class_Material>` material=null **)** |
  30. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`add_unscaled_billboard<class_EditorSpatialGizmo_method_add_unscaled_billboard>` **(** :ref:`Material<class_Material>` material, :ref:`float<class_float>` default_scale=1, :ref:`Color<class_Color>` modulate=Color( 1, 1, 1, 1 ) **)** |
  32. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`clear<class_EditorSpatialGizmo_method_clear>` **(** **)** |
  34. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`commit_handle<class_EditorSpatialGizmo_method_commit_handle>` **(** :ref:`int<class_int>` index, :ref:`Variant<class_Variant>` restore, :ref:`bool<class_bool>` cancel=false **)** |virtual| |
  36. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`String<class_String>` | :ref:`get_handle_name<class_EditorSpatialGizmo_method_get_handle_name>` **(** :ref:`int<class_int>` index **)** |virtual| |
  38. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Variant<class_Variant>` | :ref:`get_handle_value<class_EditorSpatialGizmo_method_get_handle_value>` **(** :ref:`int<class_int>` index **)** |virtual| |
  40. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` | :ref:`get_plugin<class_EditorSpatialGizmo_method_get_plugin>` **(** **)** |const| |
  42. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Spatial<class_Spatial>` | :ref:`get_spatial_node<class_EditorSpatialGizmo_method_get_spatial_node>` **(** **)** |const| |
  44. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`is_handle_highlighted<class_EditorSpatialGizmo_method_is_handle_highlighted>` **(** :ref:`int<class_int>` index **)** |virtual| |
  46. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`redraw<class_EditorSpatialGizmo_method_redraw>` **(** **)** |virtual| |
  48. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`set_handle<class_EditorSpatialGizmo_method_set_handle>` **(** :ref:`int<class_int>` index, :ref:`Camera<class_Camera>` camera, :ref:`Vector2<class_Vector2>` point **)** |virtual| |
  50. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_hidden<class_EditorSpatialGizmo_method_set_hidden>` **(** :ref:`bool<class_bool>` hidden **)** |
  52. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`set_spatial_node<class_EditorSpatialGizmo_method_set_spatial_node>` **(** :ref:`Node<class_Node>` node **)** |
  54. +-----------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. .. rst-class:: classref-section-separator
  56. ----
  57. .. rst-class:: classref-descriptions-group
  58. Method Descriptions
  59. -------------------
  60. .. _class_EditorSpatialGizmo_method_add_collision_segments:
  61. .. rst-class:: classref-method
  62. void **add_collision_segments** **(** :ref:`PoolVector3Array<class_PoolVector3Array>` segments **)**
  63. Adds the specified ``segments`` to the gizmo's collision shape for picking. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_EditorSpatialGizmo_method_add_collision_triangles:
  67. .. rst-class:: classref-method
  68. void **add_collision_triangles** **(** :ref:`TriangleMesh<class_TriangleMesh>` triangles **)**
  69. Adds collision triangles to the gizmo for picking. A :ref:`TriangleMesh<class_TriangleMesh>` can be generated from a regular :ref:`Mesh<class_Mesh>` too. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_EditorSpatialGizmo_method_add_handles:
  73. .. rst-class:: classref-method
  74. void **add_handles** **(** :ref:`PoolVector3Array<class_PoolVector3Array>` handles, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false **)**
  75. Adds a list of handles (points) which can be used to deform the object being edited.
  76. There are virtual functions which will be called upon editing of these handles. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_EditorSpatialGizmo_method_add_lines:
  80. .. rst-class:: classref-method
  81. void **add_lines** **(** :ref:`PoolVector3Array<class_PoolVector3Array>` lines, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`Color<class_Color>` modulate=Color( 1, 1, 1, 1 ) **)**
  82. Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_EditorSpatialGizmo_method_add_mesh:
  86. .. rst-class:: classref-method
  87. void **add_mesh** **(** :ref:`Mesh<class_Mesh>` mesh, :ref:`bool<class_bool>` billboard=false, :ref:`SkinReference<class_SkinReference>` skeleton=null, :ref:`Material<class_Material>` material=null **)**
  88. Adds a mesh to the gizmo with the specified ``billboard`` state, ``skeleton`` and ``material``. If ``billboard`` is ``true``, the mesh will rotate to always face the camera. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_EditorSpatialGizmo_method_add_unscaled_billboard:
  92. .. rst-class:: classref-method
  93. void **add_unscaled_billboard** **(** :ref:`Material<class_Material>` material, :ref:`float<class_float>` default_scale=1, :ref:`Color<class_Color>` modulate=Color( 1, 1, 1, 1 ) **)**
  94. Adds an unscaled billboard for visualization. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_EditorSpatialGizmo_method_clear:
  98. .. rst-class:: classref-method
  99. void **clear** **(** **)**
  100. Removes everything in the gizmo including meshes, collisions and handles.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_EditorSpatialGizmo_method_commit_handle:
  104. .. rst-class:: classref-method
  105. void **commit_handle** **(** :ref:`int<class_int>` index, :ref:`Variant<class_Variant>` restore, :ref:`bool<class_bool>` cancel=false **)** |virtual|
  106. Commit a handle being edited (handles must have been previously added by :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>`).
  107. If the ``cancel`` parameter is ``true``, an option to restore the edited value to the original is provided.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_EditorSpatialGizmo_method_get_handle_name:
  111. .. rst-class:: classref-method
  112. :ref:`String<class_String>` **get_handle_name** **(** :ref:`int<class_int>` index **)** |virtual|
  113. Gets the name of an edited handle (handles must have been previously added by :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>`).
  114. Handles can be named for reference to the user when editing.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_EditorSpatialGizmo_method_get_handle_value:
  118. .. rst-class:: classref-method
  119. :ref:`Variant<class_Variant>` **get_handle_value** **(** :ref:`int<class_int>` index **)** |virtual|
  120. Gets actual value of a handle. This value can be anything and used for eventually undoing the motion when calling :ref:`commit_handle<class_EditorSpatialGizmo_method_commit_handle>`.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_EditorSpatialGizmo_method_get_plugin:
  124. .. rst-class:: classref-method
  125. :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` **get_plugin** **(** **)** |const|
  126. Returns the :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` that owns this gizmo. It's useful to retrieve materials using :ref:`EditorSpatialGizmoPlugin.get_material<class_EditorSpatialGizmoPlugin_method_get_material>`.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_EditorSpatialGizmo_method_get_spatial_node:
  130. .. rst-class:: classref-method
  131. :ref:`Spatial<class_Spatial>` **get_spatial_node** **(** **)** |const|
  132. Returns the Spatial node associated with this gizmo.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_EditorSpatialGizmo_method_is_handle_highlighted:
  136. .. rst-class:: classref-method
  137. :ref:`bool<class_bool>` **is_handle_highlighted** **(** :ref:`int<class_int>` index **)** |virtual|
  138. Returns ``true`` if the handle at index ``index`` is highlighted by being hovered with the mouse.
  139. .. rst-class:: classref-item-separator
  140. ----
  141. .. _class_EditorSpatialGizmo_method_redraw:
  142. .. rst-class:: classref-method
  143. void **redraw** **(** **)** |virtual|
  144. This function is called when the :ref:`Spatial<class_Spatial>` this gizmo refers to changes (the :ref:`Spatial.update_gizmo<class_Spatial_method_update_gizmo>` is called).
  145. .. rst-class:: classref-item-separator
  146. ----
  147. .. _class_EditorSpatialGizmo_method_set_handle:
  148. .. rst-class:: classref-method
  149. void **set_handle** **(** :ref:`int<class_int>` index, :ref:`Camera<class_Camera>` camera, :ref:`Vector2<class_Vector2>` point **)** |virtual|
  150. This function is used when the user drags a gizmo handle (previously added with :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>`) in screen coordinates.
  151. The :ref:`Camera<class_Camera>` is also provided so screen coordinates can be converted to raycasts.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_EditorSpatialGizmo_method_set_hidden:
  155. .. rst-class:: classref-method
  156. void **set_hidden** **(** :ref:`bool<class_bool>` hidden **)**
  157. Sets the gizmo's hidden state. If ``true``, the gizmo will be hidden. If ``false``, it will be shown.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_EditorSpatialGizmo_method_set_spatial_node:
  161. .. rst-class:: classref-method
  162. void **set_spatial_node** **(** :ref:`Node<class_Node>` node **)**
  163. Sets the reference :ref:`Spatial<class_Spatial>` node for the gizmo. ``node`` must inherit from :ref:`Spatial<class_Spatial>`.
  164. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  165. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  166. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  167. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`