.. _doc_spatial_gizmo_plugins: Spatial gizmo plugins ===================== Introduction ------------ Spatial gizmo plugins are used by the editor and custom plugins to define the gizmos attached to any kind of Spatial node. This tutorial will show you the two main approaches to defining your own custom gizmos. The first option works well for simple gizmos and creates less clutter in your plugin structure, while the second one will let you store some per-gizmo data. .. note:: This tutorial assumes you already know how to make generic plugins. If in doubt, refer to the `doc_making_plugins` page. The EditorSpatialGizmoPlugin ---------------------------- Regardless of the approach we choose, we will need to create a new `EditorSpatialGizmoPlugin`. This will allow us to set a name for the new gizmo type and define other behaviors such as whether the gizmo can be hidden or not. This would be a basic setup: :: # MyCustomGizmoPlugin.gd extends EditorSpatialGizmoPlugin func get_name(): return "CustomNode" :: # MyCustomEditorPlugin.gd tool extends EditorPlugin const MyCustomGizmoPlugin = preload("res://addons/my-addon/MyCustomGizmoPlugin.gd") var gizmo_plugin = MyCustomGizmoPlugin.new() func _enter_tree(): add_spatial_gizmo_plugin(gizmo_plugin) func _exit_tree(): remove_spatial_gizmo_plugin(gizmo_plugin) For simple gizmos, just inheriting `EditorSpatialGizmoPlugin` is enough. If you want to store some per-gizmo data or you are porting a Godot 3.0 gizmo to 3.1+, you should go with the second approach. Simple approach --------------- The first step is to, in our custom gizmo plugin, override the `has_gizmo()