.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.

.. _class_EditorSpatialGizmo:

EditorSpatialGizmo
==================

**Inherits:** :ref:`SpatialGizmo<class_spatialgizmo>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`

**Category:** Core

Brief Description
-----------------

Custom gizmo for editing Spatial objects.

Member Functions
----------------

+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`add_collision_segments<class_EditorSpatialGizmo_add_collision_segments>`  **(** :ref:`Vector3Array<class_vector3array>` segments  **)**                                                            |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`add_collision_triangles<class_EditorSpatialGizmo_add_collision_triangles>`  **(** TriangleMesh triangles  **)**                                                                                    |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`add_handles<class_EditorSpatialGizmo_add_handles>`  **(** :ref:`Vector3Array<class_vector3array>` handles, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false  **)** |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`add_lines<class_EditorSpatialGizmo_add_lines>`  **(** :ref:`Vector3Array<class_vector3array>` lines, :ref:`Material<class_material>` material, :ref:`bool<class_bool>` billboard=false  **)**      |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`add_mesh<class_EditorSpatialGizmo_add_mesh>`  **(** :ref:`Mesh<class_mesh>` mesh, :ref:`bool<class_bool>` billboard=false, :ref:`RID<class_rid>` skeleton=RID()  **)**                             |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`add_unscaled_billboard<class_EditorSpatialGizmo_add_unscaled_billboard>`  **(** :ref:`Material<class_material>` material, :ref:`float<class_float>` default_scale=1  **)**                         |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`clear<class_EditorSpatialGizmo_clear>`  **(** **)**                                                                                                                                                |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`commit_handle<class_EditorSpatialGizmo_commit_handle>`  **(** :ref:`int<class_int>` index, :ref:`Variant<class_variant>` restore, :ref:`bool<class_bool>` cancel  **)** virtual                    |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_string>`    | :ref:`get_handle_name<class_EditorSpatialGizmo_get_handle_name>`  **(** :ref:`int<class_int>` index  **)** virtual                                                                                       |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_variant>`  | :ref:`get_handle_value<class_EditorSpatialGizmo_get_handle_value>`  **(** :ref:`int<class_int>` index  **)** virtual                                                                                     |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`redraw<class_EditorSpatialGizmo_redraw>`  **(** **)** virtual                                                                                                                                      |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`set_handle<class_EditorSpatialGizmo_set_handle>`  **(** :ref:`int<class_int>` index, :ref:`Camera<class_camera>` camera, :ref:`Vector2<class_vector2>` point  **)** virtual                        |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void                           | :ref:`set_spatial_node<class_EditorSpatialGizmo_set_spatial_node>`  **(** :ref:`Spatial<class_spatial>` node  **)**                                                                                      |
+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Description
-----------

Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. These are created by :ref:`EditorPlugin.create_spatial_gizmo<class_EditorPlugin_create_spatial_gizmo>`.

Member Function Description
---------------------------

.. _class_EditorSpatialGizmo_add_collision_segments:

- void  **add_collision_segments**  **(** :ref:`Vector3Array<class_vector3array>` segments  **)**

.. _class_EditorSpatialGizmo_add_collision_triangles:

- void  **add_collision_triangles**  **(** TriangleMesh triangles  **)**

Add collision triangles to the gizmo for picking. A TriangleMesh can be generated from a regular :ref:`Mesh<class_mesh>` too. Call this function during :ref:`redraw<class_EditorSpatialGizmo_redraw>`.

.. _class_EditorSpatialGizmo_add_handles:

- void  **add_handles**  **(** :ref:`Vector3Array<class_vector3array>` handles, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false  **)**

Add a list of handles (points) which can be used to deform the object being edited.

There are virtual functions which will be called upon editing of these handles. Call this function during :ref:`redraw<class_EditorSpatialGizmo_redraw>`.

.. _class_EditorSpatialGizmo_add_lines:

- void  **add_lines**  **(** :ref:`Vector3Array<class_vector3array>` lines, :ref:`Material<class_material>` material, :ref:`bool<class_bool>` billboard=false  **)**

Add 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_redraw>`.

.. _class_EditorSpatialGizmo_add_mesh:

- void  **add_mesh**  **(** :ref:`Mesh<class_mesh>` mesh, :ref:`bool<class_bool>` billboard=false, :ref:`RID<class_rid>` skeleton=RID()  **)**

Add a mesh to the gizmo, this is used for visualization. Call this function during :ref:`redraw<class_EditorSpatialGizmo_redraw>`.

.. _class_EditorSpatialGizmo_add_unscaled_billboard:

- void  **add_unscaled_billboard**  **(** :ref:`Material<class_material>` material, :ref:`float<class_float>` default_scale=1  **)**

Add an unscaled billboard for visualization. Call this function during :ref:`redraw<class_EditorSpatialGizmo_redraw>`.

.. _class_EditorSpatialGizmo_clear:

- void  **clear**  **(** **)**

.. _class_EditorSpatialGizmo_commit_handle:

- void  **commit_handle**  **(** :ref:`int<class_int>` index, :ref:`Variant<class_variant>` restore, :ref:`bool<class_bool>` cancel  **)** virtual

Commit a handle being edited (handles must have been prevously added by :ref:`add_handles<class_EditorSpatialGizmo_add_handles>`).

If the cancel parameter is true, an option to restore the edited value to the original is provided.

.. _class_EditorSpatialGizmo_get_handle_name:

- :ref:`String<class_string>`  **get_handle_name**  **(** :ref:`int<class_int>` index  **)** virtual

Get the name of an edited handle (handles must have been previously added by :ref:`add_handles<class_EditorSpatialGizmo_add_handles>`).

Handles can be named for reference to the user when editing.

.. _class_EditorSpatialGizmo_get_handle_value:

- :ref:`Variant<class_variant>`  **get_handle_value**  **(** :ref:`int<class_int>` index  **)** virtual

Get actual value of a handle. This value can be anything and used for eventually undoing the motion when calling :ref:`commit_handle<class_EditorSpatialGizmo_commit_handle>`

.. _class_EditorSpatialGizmo_redraw:

- void  **redraw**  **(** **)** virtual

This function is called when the Spatial this gizmo refers to changes (the :ref:`Spatial.update_gizmo<class_Spatial_update_gizmo>` is called).

.. _class_EditorSpatialGizmo_set_handle:

- void  **set_handle**  **(** :ref:`int<class_int>` index, :ref:`Camera<class_camera>` camera, :ref:`Vector2<class_vector2>` point  **)** virtual

This function is used when the user drags a gizmo handle (previously added with :ref:`add_handles<class_EditorSpatialGizmo_add_handles>`) in screen coordinates.

The :ref:`Camera<class_camera>` is also provided so screen coordinates can be converted to raycasts.

.. _class_EditorSpatialGizmo_set_spatial_node:

- void  **set_spatial_node**  **(** :ref:`Spatial<class_spatial>` node  **)**

Call this function once and upon creation of the gizmo, otherwise no other function will work. The argument is the node being edited by the gizmo.


