@tool annotation and editor gizmos, you can provide a seamless editing experience for your custom nodes.
Creating Custom Node Types
Basic Custom Node
Create a custom node by extending an existing node type:Tool Scripts with @tool Annotation
The@tool annotation makes scripts run in the editor, enabling real-time visualization and editing:
Updating in the Editor
Use property setters to trigger updates when values change:Adding Custom Editor Gizmos
Gizmos provide visual handles and overlays for editing 3D nodes. Create a gizmo plugin by extendingEditorNode3DGizmoPlugin:
Register the Gizmo Plugin
Gizmo Materials
Create different material types for your gizmo:Advanced Gizmo Features
Subgizmos
Allow selecting and editing sub-parts of your node:Custom Property Editors
Create custom inspectors for your node’s properties:Custom Property Editor Control
Example: Complete Custom Node
Here’s a complete example combining all concepts:Best Practices
Always check Engine.is_editor_hint()
Always check Engine.is_editor_hint()
Separate editor-only code from runtime code to prevent performance issues and unexpected behavior.
Use queue_redraw() for visual updates
Use queue_redraw() for visual updates
Call
queue_redraw() in property setters to update the node’s appearance in the editor.Implement proper undo/redo
Implement proper undo/redo
Always use
EditorUndoRedoManager in gizmo commit methods to make changes undoable.Clean up resources
Clean up resources
Remove custom types, gizmos, and inspector plugins in
_exit_tree() to prevent memory leaks.Provide helpful gizmo names
Provide helpful gizmo names
Return descriptive names from
_get_gizmo_name() and _get_handle_name() for better UX.See Also
Editor Plugins
Learn how to create editor plugins
Editor Interface
Access editor interface components