class_editorspatialgizmo.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the EditorSpatialGizmo.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorSpatialGizmo:
  6. EditorSpatialGizmo
  7. ==================
  8. **Inherits:** :ref:`SpatialGizmo<class_SpatialGizmo>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. Custom gizmo for editing Spatial objects.
  10. Description
  11. -----------
  12. Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` for more information.
  13. Methods
  14. -------
  15. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`add_collision_segments<class_EditorSpatialGizmo_method_add_collision_segments>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` segments **)** |
  17. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`add_collision_triangles<class_EditorSpatialGizmo_method_add_collision_triangles>` **(** :ref:`TriangleMesh<class_TriangleMesh>` triangles **)** |
  19. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` handles, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false **)** |
  21. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`add_lines<class_EditorSpatialGizmo_method_add_lines>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` lines, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`Color<class_Color>` modulate=Color( 1, 1, 1, 1 ) **)** |
  23. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`add_mesh<class_EditorSpatialGizmo_method_add_mesh>` **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`bool<class_bool>` billboard=false, :ref:`SkinReference<class_SkinReference>` skeleton=null, :ref:`Material<class_Material>` material=null **)** |
  25. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | 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 ) **)** |
  27. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`clear<class_EditorSpatialGizmo_method_clear>` **(** **)** |
  29. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | 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 |
  31. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`String<class_String>` | :ref:`get_handle_name<class_EditorSpatialGizmo_method_get_handle_name>` **(** :ref:`int<class_int>` index **)** virtual |
  33. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Variant<class_Variant>` | :ref:`get_handle_value<class_EditorSpatialGizmo_method_get_handle_value>` **(** :ref:`int<class_int>` index **)** virtual |
  35. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` | :ref:`get_plugin<class_EditorSpatialGizmo_method_get_plugin>` **(** **)** const |
  37. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Spatial<class_Spatial>` | :ref:`get_spatial_node<class_EditorSpatialGizmo_method_get_spatial_node>` **(** **)** const |
  39. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`is_handle_highlighted<class_EditorSpatialGizmo_method_is_handle_highlighted>` **(** :ref:`int<class_int>` index **)** virtual |
  41. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`redraw<class_EditorSpatialGizmo_method_redraw>` **(** **)** virtual |
  43. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | 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 |
  45. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_hidden<class_EditorSpatialGizmo_method_set_hidden>` **(** :ref:`bool<class_bool>` hidden **)** |
  47. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_spatial_node<class_EditorSpatialGizmo_method_set_spatial_node>` **(** :ref:`Node<class_Node>` node **)** |
  49. +-----------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. Method Descriptions
  51. -------------------
  52. .. _class_EditorSpatialGizmo_method_add_collision_segments:
  53. - void **add_collision_segments** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` segments **)**
  54. ----
  55. .. _class_EditorSpatialGizmo_method_add_collision_triangles:
  56. - void **add_collision_triangles** **(** :ref:`TriangleMesh<class_TriangleMesh>` triangles **)**
  57. 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>`.
  58. ----
  59. .. _class_EditorSpatialGizmo_method_add_handles:
  60. - void **add_handles** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` handles, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false **)**
  61. Adds a list of handles (points) which can be used to deform the object being edited.
  62. There are virtual functions which will be called upon editing of these handles. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  63. ----
  64. .. _class_EditorSpatialGizmo_method_add_lines:
  65. - void **add_lines** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` lines, :ref:`Material<class_Material>` material, :ref:`bool<class_bool>` billboard=false, :ref:`Color<class_Color>` modulate=Color( 1, 1, 1, 1 ) **)**
  66. 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>`.
  67. ----
  68. .. _class_EditorSpatialGizmo_method_add_mesh:
  69. - void **add_mesh** **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`bool<class_bool>` billboard=false, :ref:`SkinReference<class_SkinReference>` skeleton=null, :ref:`Material<class_Material>` material=null **)**
  70. ----
  71. .. _class_EditorSpatialGizmo_method_add_unscaled_billboard:
  72. - 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 ) **)**
  73. Adds an unscaled billboard for visualization. Call this function during :ref:`redraw<class_EditorSpatialGizmo_method_redraw>`.
  74. ----
  75. .. _class_EditorSpatialGizmo_method_clear:
  76. - void **clear** **(** **)**
  77. ----
  78. .. _class_EditorSpatialGizmo_method_commit_handle:
  79. - void **commit_handle** **(** :ref:`int<class_int>` index, :ref:`Variant<class_Variant>` restore, :ref:`bool<class_bool>` cancel=false **)** virtual
  80. Commit a handle being edited (handles must have been previously added by :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>`).
  81. If the ``cancel`` parameter is ``true``, an option to restore the edited value to the original is provided.
  82. ----
  83. .. _class_EditorSpatialGizmo_method_get_handle_name:
  84. - :ref:`String<class_String>` **get_handle_name** **(** :ref:`int<class_int>` index **)** virtual
  85. Gets the name of an edited handle (handles must have been previously added by :ref:`add_handles<class_EditorSpatialGizmo_method_add_handles>`).
  86. Handles can be named for reference to the user when editing.
  87. ----
  88. .. _class_EditorSpatialGizmo_method_get_handle_value:
  89. - :ref:`Variant<class_Variant>` **get_handle_value** **(** :ref:`int<class_int>` index **)** virtual
  90. 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>`.
  91. ----
  92. .. _class_EditorSpatialGizmo_method_get_plugin:
  93. - :ref:`EditorSpatialGizmoPlugin<class_EditorSpatialGizmoPlugin>` **get_plugin** **(** **)** const
  94. 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>`.
  95. ----
  96. .. _class_EditorSpatialGizmo_method_get_spatial_node:
  97. - :ref:`Spatial<class_Spatial>` **get_spatial_node** **(** **)** const
  98. Returns the Spatial node associated with this gizmo.
  99. ----
  100. .. _class_EditorSpatialGizmo_method_is_handle_highlighted:
  101. - :ref:`bool<class_bool>` **is_handle_highlighted** **(** :ref:`int<class_int>` index **)** virtual
  102. Gets whether a handle is highlighted or not.
  103. ----
  104. .. _class_EditorSpatialGizmo_method_redraw:
  105. - void **redraw** **(** **)** virtual
  106. This function is called when the Spatial this gizmo refers to changes (the :ref:`Spatial.update_gizmo<class_Spatial_method_update_gizmo>` is called).
  107. ----
  108. .. _class_EditorSpatialGizmo_method_set_handle:
  109. - void **set_handle** **(** :ref:`int<class_int>` index, :ref:`Camera<class_Camera>` camera, :ref:`Vector2<class_Vector2>` point **)** virtual
  110. 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.
  111. The :ref:`Camera<class_Camera>` is also provided so screen coordinates can be converted to raycasts.
  112. ----
  113. .. _class_EditorSpatialGizmo_method_set_hidden:
  114. - void **set_hidden** **(** :ref:`bool<class_bool>` hidden **)**
  115. ----
  116. .. _class_EditorSpatialGizmo_method_set_spatial_node:
  117. - void **set_spatial_node** **(** :ref:`Node<class_Node>` node **)**