Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
EditorNode3DGizmoPlugin
Hereda: Resource < RefCounted < Object
Usado por el editor para definir los tipos de gizmo de Node3D.
Descripción
EditorNode3DGizmoPlugin te permite definir un nuevo tipo de Gizmo. Hay dos formas principales de hacerlo: extendiendo EditorNode3DGizmoPlugin para los gizmos más simples, o creando un nuevo tipo EditorNode3DGizmo. Véase el tutorial en la documentación para más información.
Para usar EditorNode3DGizmoPlugin, registralo usando la función EditorPlugin.add_node_3d_gizmo_plugin() primero.
Tutoriales
Métodos
void |
_begin_handle_action(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual |
_can_be_hidden() virtual const |
|
_can_commit_handle_on_click() virtual const |
|
void |
_commit_handle(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool, restore: Variant, cancel: bool) virtual |
void |
_commit_subgizmos(gizmo: EditorNode3DGizmo, ids: PackedInt32Array, restores: Array[Transform3D], cancel: bool) virtual |
_create_gizmo(for_node_3d: Node3D) virtual const |
|
_get_gizmo_name() virtual const |
|
_get_handle_name(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual const |
|
_get_handle_value(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual const |
|
_get_priority() virtual const |
|
_get_subgizmo_transform(gizmo: EditorNode3DGizmo, subgizmo_id: int) virtual const |
|
_has_gizmo(for_node_3d: Node3D) virtual const |
|
_is_handle_highlighted(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual const |
|
_is_selectable_when_hidden() virtual const |
|
void |
_redraw(gizmo: EditorNode3DGizmo) virtual |
void |
_set_handle(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool, camera: Camera3D, screen_pos: Vector2) virtual |
void |
_set_subgizmo_transform(gizmo: EditorNode3DGizmo, subgizmo_id: int, transform: Transform3D) virtual |
_subgizmos_intersect_frustum(gizmo: EditorNode3DGizmo, camera: Camera3D, frustum_planes: Array[Plane]) virtual const |
|
_subgizmos_intersect_ray(gizmo: EditorNode3DGizmo, camera: Camera3D, screen_pos: Vector2) virtual const |
|
void |
add_material(name: String, material: StandardMaterial3D) |
void |
create_handle_material(name: String, billboard: bool = false, texture: Texture2D = null) |
void |
create_icon_material(name: String, texture: Texture2D, on_top: bool = false, color: Color = Color(1, 1, 1, 1)) |
void |
create_material(name: String, color: Color, billboard: bool = false, on_top: bool = false, use_vertex_color: bool = false) |
get_material(name: String, gizmo: EditorNode3DGizmo = null) |
Descripciones de Métodos
void _begin_handle_action(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual 🔗
There is currently no description for this method. Please help us by contributing one!
Sobrescribe este método para definir si el gizmo (manejado por el plugin) puede ser escondido o no. Devuelve true si no está sobrescrito.
bool _can_commit_handle_on_click() virtual const 🔗
Override this method to define whether the gizmos should commit when the final handle position is the same as the initial one. Returns false if not overridden.
void _commit_handle(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool, restore: Variant, cancel: bool) virtual 🔗
Override this method to commit a handle being edited (handles must have been previously added by EditorNode3DGizmo.add_handles() during _redraw()). This usually means creating an 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 UndoRedo action.
The secondary argument is true when the committed handle is secondary (see EditorNode3DGizmo.add_handles() for more information).
Called for this plugin's active gizmos.
void _commit_subgizmos(gizmo: EditorNode3DGizmo, ids: PackedInt32Array, restores: Array[Transform3D], cancel: bool) virtual 🔗
Override this method to commit a group of subgizmos being edited (see _subgizmos_intersect_ray() and _subgizmos_intersect_frustum()). This usually means creating an UndoRedo action for the change, using the current transforms as "do" and the restores transforms as "undo".
If the cancel argument is true, the restores transforms should be directly set, without any UndoRedo action. As with all subgizmo methods, transforms are given in local space respect to the gizmo's Node3D. Called for this plugin's active gizmos.
EditorNode3DGizmo _create_gizmo(for_node_3d: Node3D) virtual const 🔗
Override this method to return a custom EditorNode3DGizmo for the 3D nodes of your choice, return null for the rest of nodes. See also _has_gizmo().
String _get_gizmo_name() virtual const 🔗
Sobrescribe este método para proporcionar el nombre que aparecerá en el menú de visibilidad del gizmo.
String _get_handle_name(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual const 🔗
Override this method to provide gizmo's handle names. The secondary argument is true when the requested handle is secondary (see EditorNode3DGizmo.add_handles() for more information). Called for this plugin's active gizmos.
Variant _get_handle_value(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) 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 _commit_handle().
The secondary argument is true when the requested handle is secondary (see EditorNode3DGizmo.add_handles() for more information).
Called for this plugin's active gizmos.
int _get_priority() virtual const 🔗
Override this method to set the gizmo's priority. Gizmos with higher priority will have precedence when processing inputs like handles or subgizmos selection.
All built-in editor gizmos return a priority of -1. If not overridden, this method will return 0, which means custom gizmos will automatically get higher priority than built-in gizmos.
Transform3D _get_subgizmo_transform(gizmo: EditorNode3DGizmo, subgizmo_id: int) virtual const 🔗
Override this method to return the current transform of a subgizmo. As with all subgizmo methods, the transform should be in local space respect to the gizmo's Node3D. This transform will be requested at the start of an edit and used in the restore argument in _commit_subgizmos(). Called for this plugin's active gizmos.
bool _has_gizmo(for_node_3d: Node3D) virtual const 🔗
Sobrescribe este método para definir qué nodos de Node3D tienen un gizmo de este plugin. Cada vez que se añade un nodo Node3D a una escena se llama a este método, si devuelve true el nodo obtiene un EditorNode3DGizmo genérico asignado y se añade a la lista de gizmos activos de este plugin.
bool _is_handle_highlighted(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool) virtual const 🔗
Override this method to return true whenever to given handle should be highlighted in the editor. The secondary argument is true when the requested handle is secondary (see EditorNode3DGizmo.add_handles() for more information). Called for this plugin's active gizmos.
Override this method to define whether Node3D with this gizmo should be selectable even when the gizmo is hidden.
void _redraw(gizmo: EditorNode3DGizmo) virtual 🔗
Override this method to add all the gizmo elements whenever a gizmo update is requested. It's common to call EditorNode3DGizmo.clear() at the beginning of this method and then add visual elements depending on the node's properties.
void _set_handle(gizmo: EditorNode3DGizmo, handle_id: int, secondary: bool, camera: Camera3D, screen_pos: Vector2) virtual 🔗
Override this method to update the node's properties when the user drags a gizmo handle (previously added with EditorNode3DGizmo.add_handles()). The provided screen_pos is the mouse position in screen coordinates and the camera can be used to convert it to raycasts.
The secondary argument is true when the edited handle is secondary (see EditorNode3DGizmo.add_handles() for more information).
Called for this plugin's active gizmos.
void _set_subgizmo_transform(gizmo: EditorNode3DGizmo, subgizmo_id: int, transform: Transform3D) virtual 🔗
Override this method to update the node properties during subgizmo editing (see _subgizmos_intersect_ray() and _subgizmos_intersect_frustum()). The transform is given in the Node3D's local coordinate system. Called for this plugin's active gizmos.
PackedInt32Array _subgizmos_intersect_frustum(gizmo: EditorNode3DGizmo, camera: Camera3D, frustum_planes: Array[Plane]) virtual const 🔗
Override this method to allow selecting subgizmos using mouse drag box selection. Given a camera and frustum_planes, this method should return which subgizmos are contained within the frustums. The frustum_planes argument consists of an array with all the Planes that make up the selection frustum. The returned value should contain a list of unique subgizmo identifiers, these identifiers can have any non-negative value and will be used in other virtual methods like _get_subgizmo_transform() or _commit_subgizmos(). Called for this plugin's active gizmos.
int _subgizmos_intersect_ray(gizmo: EditorNode3DGizmo, camera: Camera3D, screen_pos: Vector2) virtual const 🔗
Override this method to allow selecting subgizmos using mouse clicks. Given a camera and a screen_pos 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 _get_subgizmo_transform() or _commit_subgizmos(). Called for this plugin's active gizmos.
void add_material(name: String, material: StandardMaterial3D) 🔗
Añade un nuevo material a la lista de material interno para el plugin. Entonces se puede acceder a él con get_material(). No debe ser sobreescrito.
void create_handle_material(name: String, billboard: bool = false, texture: Texture2D = null) 🔗
Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with get_material() and used in EditorNode3DGizmo.add_handles(). Should not be overridden.
You can optionally provide a texture to use instead of the default icon.
void create_icon_material(name: String, texture: Texture2D, on_top: bool = false, color: Color = Color(1, 1, 1, 1)) 🔗
Crea un material de iconos con sus variantes (seleccionadas y/o editables) y las añade a la lista de material interno. Se puede acceder a ellas con get_material() y utilizarlas en EditorNode3DGizmo.add_unscaled_billboard(). No debe sobrescribirse.
void create_material(name: String, color: Color, billboard: bool = false, on_top: bool = false, use_vertex_color: bool = false) 🔗
Crea un material sin sombreado con sus variantes (seleccionadas y/o editables) y las añade a la lista de material interno. Se puede acceder a ellas con get_material() y utilizarlas en EditorNode3DGizmo.add_mesh() y EditorNode3DGizmo.add_lines(). No debe sobrescribirse.
StandardMaterial3D get_material(name: String, gizmo: EditorNode3DGizmo = null) 🔗
Obtiene el material de la lista interna de materiales. Si se proporciona un EditorNode3DGizmo, intentará obtener la variable correspondiente (seleccionada y/o editable).