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¶
Inherits: Resource < RefCounted < Object
A class used by the editor to define Node3D gizmo types.
Description¶
EditorNode3DGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending EditorNode3DGizmoPlugin for the simpler gizmos, or creating a new EditorNode3DGizmo type. See the tutorial in the documentation for more info.
To use EditorNode3DGizmoPlugin, register it using the EditorPlugin.add_node_3d_gizmo_plugin method first.
Tutorials¶
Methods¶
_can_be_hidden ( ) virtual const |
|
void |
_commit_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Variant restore, bool cancel ) virtual |
void |
_commit_subgizmos ( EditorNode3DGizmo gizmo, PackedInt32Array ids, Transform3D[] restores, bool cancel ) virtual |
_create_gizmo ( Node3D for_node_3d ) virtual const |
|
_get_gizmo_name ( ) virtual const |
|
_get_handle_name ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const |
|
_get_handle_value ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const |
|
_get_priority ( ) virtual const |
|
_get_subgizmo_transform ( EditorNode3DGizmo gizmo, int subgizmo_id ) virtual const |
|
_has_gizmo ( Node3D for_node_3d ) virtual const |
|
_is_handle_highlighted ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) virtual const |
|
_is_selectable_when_hidden ( ) virtual const |
|
void |
_redraw ( EditorNode3DGizmo gizmo ) virtual |
void |
_set_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Camera3D camera, Vector2 screen_pos ) virtual |
void |
_set_subgizmo_transform ( EditorNode3DGizmo gizmo, int subgizmo_id, Transform3D transform ) virtual |
_subgizmos_intersect_frustum ( EditorNode3DGizmo gizmo, Camera3D camera, Plane[] frustum_planes ) virtual const |
|
_subgizmos_intersect_ray ( EditorNode3DGizmo gizmo, Camera3D camera, Vector2 screen_pos ) virtual const |
|
void |
add_material ( String name, StandardMaterial3D material ) |
void |
create_handle_material ( String name, bool billboard=false, Texture2D texture=null ) |
void |
create_icon_material ( String name, Texture2D texture, bool on_top=false, Color color=Color(1, 1, 1, 1) ) |
void |
create_material ( String name, Color color, bool billboard=false, bool on_top=false, bool use_vertex_color=false ) |
get_material ( String name, EditorNode3DGizmo gizmo=null ) |
Method Descriptions¶
Override this method to define whether the gizmos handled by this plugin can be hidden or not. Returns true
if not overridden.
void _commit_handle ( EditorNode3DGizmo gizmo, int handle_id, bool secondary, Variant restore, bool cancel ) 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 ( EditorNode3DGizmo gizmo, PackedInt32Array ids, Transform3D[] restores, bool cancel ) 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 ( Node3D for_node_3d ) virtual const
Override this method to return a custom EditorNode3DGizmo for the spatial nodes of your choice, return null
for the rest of nodes. See also _has_gizmo.
String _get_gizmo_name ( ) virtual const
Override this method to provide the name that will appear in the gizmo visibility menu.
String _get_handle_name ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) 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 ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) 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 ( EditorNode3DGizmo gizmo, int subgizmo_id ) 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 ( Node3D for_node_3d ) virtual const
Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a Node3D node is added to a scene this method is called, if it returns true
the node gets a generic EditorNode3DGizmo assigned and is added to this plugin's list of active gizmos.
bool _is_handle_highlighted ( EditorNode3DGizmo gizmo, int handle_id, bool secondary ) 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.