123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- :github_url: hide
- .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the EditorNode3DGizmo.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_EditorNode3DGizmo:
- EditorNode3DGizmo
- =================
- **Inherits:** :ref:`Node3DGizmo<class_Node3DGizmo>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Gizmo for editing Node3D objects.
- Description
- -----------
- Gizmo that is used for providing custom visualization and editing (handles and subgizmos) for Node3D objects. Can be overridden to create custom gizmos, but for simple gizmos creating a :ref:`EditorNode3DGizmoPlugin<class_EditorNode3DGizmoPlugin>` is usually recommended.
- Methods
- -------
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`_commit_handle<class_EditorNode3DGizmo_method__commit_handle>` **(** :ref:`int<class_int>` id, :ref:`Variant<class_Variant>` restore, :ref:`bool<class_bool>` cancel **)** |virtual| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`_commit_subgizmos<class_EditorNode3DGizmo_method__commit_subgizmos>` **(** :ref:`PackedInt32Array<class_PackedInt32Array>` ids, :ref:`Transform3D[]<class_Transform3D>` restores, :ref:`bool<class_bool>` cancel **)** |virtual| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`_get_handle_name<class_EditorNode3DGizmo_method__get_handle_name>` **(** :ref:`int<class_int>` id **)** |virtual| |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_Variant>` | :ref:`_get_handle_value<class_EditorNode3DGizmo_method__get_handle_value>` **(** :ref:`int<class_int>` id **)** |virtual| |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Transform3D<class_Transform3D>` | :ref:`_get_subgizmo_transform<class_EditorNode3DGizmo_method__get_subgizmo_transform>` **(** :ref:`int<class_int>` id **)** |virtual| |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`_is_handle_highlighted<class_EditorNode3DGizmo_method__is_handle_highlighted>` **(** :ref:`int<class_int>` id **)** |virtual| |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>` **(** **)** |virtual| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`_set_handle<class_EditorNode3DGizmo_method__set_handle>` **(** :ref:`int<class_int>` id, :ref:`Camera3D<class_Camera3D>` camera, :ref:`Vector2<class_Vector2>` point **)** |virtual| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`_set_subgizmo_transform<class_EditorNode3DGizmo_method__set_subgizmo_transform>` **(** :ref:`int<class_int>` id, :ref:`Transform3D<class_Transform3D>` transform **)** |virtual| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`_subgizmos_intersect_frustum<class_EditorNode3DGizmo_method__subgizmos_intersect_frustum>` **(** :ref:`Camera3D<class_Camera3D>` camera, :ref:`Plane[]<class_Plane>` frustum **)** |virtual| |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`_subgizmos_intersect_ray<class_EditorNode3DGizmo_method__subgizmos_intersect_ray>` **(** :ref:`Camera3D<class_Camera3D>` camera, :ref:`Vector2<class_Vector2>` point **)** |virtual| |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_collision_segments<class_EditorNode3DGizmo_method_add_collision_segments>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` segments **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_collision_triangles<class_EditorNode3DGizmo_method_add_collision_triangles>` **(** :ref:`TriangleMesh<class_TriangleMesh>` triangles **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_handles<class_EditorNode3DGizmo_method_add_handles>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` handles, :ref:`Material<class_Material>` material, :ref:`PackedInt32Array<class_PackedInt32Array>` ids, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_lines<class_EditorNode3DGizmo_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) **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_mesh<class_EditorNode3DGizmo_method_add_mesh>` **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`Material<class_Material>` material=null, :ref:`Transform3D<class_Transform3D>` transform=Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0), :ref:`SkinReference<class_SkinReference>` skeleton=null **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_unscaled_billboard<class_EditorNode3DGizmo_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) **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear<class_EditorNode3DGizmo_method_clear>` **(** **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`EditorNode3DGizmoPlugin<class_EditorNode3DGizmoPlugin>` | :ref:`get_plugin<class_EditorNode3DGizmo_method_get_plugin>` **(** **)** |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Node3D<class_Node3D>` | :ref:`get_spatial_node<class_EditorNode3DGizmo_method_get_spatial_node>` **(** **)** |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_subgizmo_selection<class_EditorNode3DGizmo_method_get_subgizmo_selection>` **(** **)** |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_subgizmo_selected<class_EditorNode3DGizmo_method_is_subgizmo_selected>` **(** :ref:`int<class_int>` id **)** |const| |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_hidden<class_EditorNode3DGizmo_method_set_hidden>` **(** :ref:`bool<class_bool>` hidden **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_spatial_node<class_EditorNode3DGizmo_method_set_spatial_node>` **(** :ref:`Node<class_Node>` node **)** |
- +---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Method Descriptions
- -------------------
- .. _class_EditorNode3DGizmo_method__commit_handle:
- - void **_commit_handle** **(** :ref:`int<class_int>` id, :ref:`Variant<class_Variant>` restore, :ref:`bool<class_bool>` cancel **)** |virtual|
- Override this method to commit a handle being edited (handles must have been previously added by :ref:`add_handles<class_EditorNode3DGizmo_method_add_handles>`). This usually means creating an :ref:`UndoRedo<class_UndoRedo>` action for the change, using the current handle value as "do" and the ``restore`` argument as "undo".
- If the ``cancel`` argument is ``true``, the ``restore`` value should be directly set, without any :ref:`UndoRedo<class_UndoRedo>` action.
- ----
- .. _class_EditorNode3DGizmo_method__commit_subgizmos:
- - void **_commit_subgizmos** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` ids, :ref:`Transform3D[]<class_Transform3D>` restores, :ref:`bool<class_bool>` cancel **)** |virtual|
- Override this method to commit a group of subgizmos being edited (see :ref:`_subgizmos_intersect_ray<class_EditorNode3DGizmo_method__subgizmos_intersect_ray>` and :ref:`_subgizmos_intersect_frustum<class_EditorNode3DGizmo_method__subgizmos_intersect_frustum>`). This usually means creating an :ref:`UndoRedo<class_UndoRedo>` action for the change, using the current transforms as "do" and the ``restore`` transforms as "undo".
- If the ``cancel`` argument is ``true``, the ``restore`` transforms should be directly set, without any :ref:`UndoRedo<class_UndoRedo>` action.
- ----
- .. _class_EditorNode3DGizmo_method__get_handle_name:
- - :ref:`String<class_String>` **_get_handle_name** **(** :ref:`int<class_int>` id **)** |virtual| |const|
- Override this method to return the name of an edited handle (handles must have been previously added by :ref:`add_handles<class_EditorNode3DGizmo_method_add_handles>`).
- Handles can be named for reference to the user when editing.
- ----
- .. _class_EditorNode3DGizmo_method__get_handle_value:
- - :ref:`Variant<class_Variant>` **_get_handle_value** **(** :ref:`int<class_int>` id **)** |virtual| |const|
- Override this method to return the current value of a handle. This value will be requested at the start of an edit and used as the ``restore`` argument in :ref:`_commit_handle<class_EditorNode3DGizmo_method__commit_handle>`.
- ----
- .. _class_EditorNode3DGizmo_method__get_subgizmo_transform:
- - :ref:`Transform3D<class_Transform3D>` **_get_subgizmo_transform** **(** :ref:`int<class_int>` id **)** |virtual| |const|
- Override this method to return the current transform of a subgizmo. This transform will be requested at the start of an edit and used as the ``restore`` argument in :ref:`_commit_subgizmos<class_EditorNode3DGizmo_method__commit_subgizmos>`.
- ----
- .. _class_EditorNode3DGizmo_method__is_handle_highlighted:
- - :ref:`bool<class_bool>` **_is_handle_highlighted** **(** :ref:`int<class_int>` id **)** |virtual| |const|
- Override this method to return ``true`` whenever the given handle should be highlighted in the editor.
- ----
- .. _class_EditorNode3DGizmo_method__redraw:
- - void **_redraw** **(** **)** |virtual|
- Override this method to add all the gizmo elements whenever a gizmo update is requested. It's common to call :ref:`clear<class_EditorNode3DGizmo_method_clear>` at the beginning of this method and then add visual elements depending on the node's properties.
- ----
- .. _class_EditorNode3DGizmo_method__set_handle:
- - void **_set_handle** **(** :ref:`int<class_int>` id, :ref:`Camera3D<class_Camera3D>` camera, :ref:`Vector2<class_Vector2>` point **)** |virtual|
- Override this method to update the node properties when the user drags a gizmo handle (previously added with :ref:`add_handles<class_EditorNode3DGizmo_method_add_handles>`). The provided ``point`` is the mouse position in screen coordinates and the ``camera`` can be used to convert it to raycasts.
- ----
- .. _class_EditorNode3DGizmo_method__set_subgizmo_transform:
- - void **_set_subgizmo_transform** **(** :ref:`int<class_int>` id, :ref:`Transform3D<class_Transform3D>` transform **)** |virtual|
- Override this method to update the node properties during subgizmo editing (see :ref:`_subgizmos_intersect_ray<class_EditorNode3DGizmo_method__subgizmos_intersect_ray>` and :ref:`_subgizmos_intersect_frustum<class_EditorNode3DGizmo_method__subgizmos_intersect_frustum>`). The ``transform`` is given in the Node3D's local coordinate system.
- ----
- .. _class_EditorNode3DGizmo_method__subgizmos_intersect_frustum:
- - :ref:`PackedInt32Array<class_PackedInt32Array>` **_subgizmos_intersect_frustum** **(** :ref:`Camera3D<class_Camera3D>` camera, :ref:`Plane[]<class_Plane>` frustum **)** |virtual| |const|
- Override this method to allow selecting subgizmos using mouse drag box selection. Given a ``camera`` and a ``frustum``, this method should return which subgizmos are contained within the frustum. The ``frustum`` argument consists of an ``Array`` with all the ``Plane``\ s that make up the selection frustum. The returned value should contain a list of unique subgizmo identifiers, which can have any non-negative value and will be used in other virtual methods like :ref:`_get_subgizmo_transform<class_EditorNode3DGizmo_method__get_subgizmo_transform>` or :ref:`_commit_subgizmos<class_EditorNode3DGizmo_method__commit_subgizmos>`.
- ----
- .. _class_EditorNode3DGizmo_method__subgizmos_intersect_ray:
- - :ref:`int<class_int>` **_subgizmos_intersect_ray** **(** :ref:`Camera3D<class_Camera3D>` camera, :ref:`Vector2<class_Vector2>` point **)** |virtual| |const|
- Override this method to allow selecting subgizmos using mouse clicks. Given a ``camera`` and a ``point`` in screen coordinates, this method should return which subgizmo should be selected. The returned value should be a unique subgizmo identifier, which can have any non-negative value and will be used in other virtual methods like :ref:`_get_subgizmo_transform<class_EditorNode3DGizmo_method__get_subgizmo_transform>` or :ref:`_commit_subgizmos<class_EditorNode3DGizmo_method__commit_subgizmos>`.
- ----
- .. _class_EditorNode3DGizmo_method_add_collision_segments:
- - void **add_collision_segments** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` segments **)**
- Adds the specified ``segments`` to the gizmo's collision shape for picking. Call this method during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_add_collision_triangles:
- - void **add_collision_triangles** **(** :ref:`TriangleMesh<class_TriangleMesh>` triangles **)**
- 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 method during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_add_handles:
- - void **add_handles** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` handles, :ref:`Material<class_Material>` material, :ref:`PackedInt32Array<class_PackedInt32Array>` ids, :ref:`bool<class_bool>` billboard=false, :ref:`bool<class_bool>` secondary=false **)**
- Adds a list of handles (points) which can be used to edit the properties of the gizmo's Node3D. The ``ids`` argument can be used to specify a custom identifier for each handle, if an empty ``Array`` is passed, the ids will be assigned automatically from the ``handles`` argument order.
- There are virtual methods which will be called upon editing of these handles. Call this method during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_add_lines:
- - 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) **)**
- Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this method during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_add_mesh:
- - void **add_mesh** **(** :ref:`ArrayMesh<class_ArrayMesh>` mesh, :ref:`Material<class_Material>` material=null, :ref:`Transform3D<class_Transform3D>` transform=Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0), :ref:`SkinReference<class_SkinReference>` skeleton=null **)**
- Adds a mesh to the gizmo with the specified ``material``, local ``transform`` and ``skeleton``. Call this method during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_add_unscaled_billboard:
- - 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) **)**
- Adds an unscaled billboard for visualization and selection. Call this method during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_clear:
- - void **clear** **(** **)**
- Removes everything in the gizmo including meshes, collisions and handles.
- ----
- .. _class_EditorNode3DGizmo_method_get_plugin:
- - :ref:`EditorNode3DGizmoPlugin<class_EditorNode3DGizmoPlugin>` **get_plugin** **(** **)** |const|
- Returns the :ref:`EditorNode3DGizmoPlugin<class_EditorNode3DGizmoPlugin>` that owns this gizmo. It's useful to retrieve materials using :ref:`EditorNode3DGizmoPlugin.get_material<class_EditorNode3DGizmoPlugin_method_get_material>`.
- ----
- .. _class_EditorNode3DGizmo_method_get_spatial_node:
- - :ref:`Node3D<class_Node3D>` **get_spatial_node** **(** **)** |const|
- Returns the Node3D node associated with this gizmo.
- ----
- .. _class_EditorNode3DGizmo_method_get_subgizmo_selection:
- - :ref:`PackedInt32Array<class_PackedInt32Array>` **get_subgizmo_selection** **(** **)** |const|
- Returns a list of the currently selected subgizmos. Can be used to highlight selected elements during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_is_subgizmo_selected:
- - :ref:`bool<class_bool>` **is_subgizmo_selected** **(** :ref:`int<class_int>` id **)** |const|
- Returns ``true`` if the given subgizmo is currently selected. Can be used to highlight selected elements during :ref:`_redraw<class_EditorNode3DGizmo_method__redraw>`.
- ----
- .. _class_EditorNode3DGizmo_method_set_hidden:
- - void **set_hidden** **(** :ref:`bool<class_bool>` hidden **)**
- Sets the gizmo's hidden state. If ``true``, the gizmo will be hidden. If ``false``, it will be shown.
- ----
- .. _class_EditorNode3DGizmo_method_set_spatial_node:
- - void **set_spatial_node** **(** :ref:`Node<class_Node>` node **)**
- Sets the reference :ref:`Node3D<class_Node3D>` node for the gizmo. ``node`` must inherit from :ref:`Node3D<class_Node3D>`.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|