godot.EditorSpatialGizmoPlugin
allows you to define a new type of Gizmo. There are two main ways to do so: extending godot.EditorSpatialGizmoPlugin
for the simpler gizmos, or creating a new godot.EditorSpatialGizmo
type. See the tutorial in the documentation for more info.
To use godot.EditorSpatialGizmoPlugin
, register it using the godot.EditorPlugin.addSpatialGizmoPlugin
method first.
Constructor
Methods
addMaterial(name:String, material:SpatialMaterial):Void
Adds a new material to the internal material list for the plugin. It can then be accessed with godot.EditorSpatialGizmoPlugin.getMaterial
. Should not be overridden.
canBeHidden():Bool
Override this method to define whether the gizmo can be hidden or not. Returns true
if not overridden.
commitHandle(gizmo:EditorSpatialGizmo, index:Int, restore:Dynamic, cancel:Bool):Void
Override this method to commit gizmo handles. Called for this plugin's active gizmos.
createGizmo(spatial:Spatial):EditorSpatialGizmo
Override this method to return a custom godot.EditorSpatialGizmo
for the spatial nodes of your choice, return null
for the rest of nodes. See also godot.EditorSpatialGizmoPlugin.hasGizmo
.
createHandleMaterial(name:String, ?billboard:Bool, ?texture:Texture):Void
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 godot.EditorSpatialGizmoPlugin.getMaterial
and used in godot.EditorSpatialGizmo.addHandles
. Should not be overridden.
You can optionally provide a texture to use instead of the default icon.
createIconMaterial(name:String, texture:Texture, ?onTop:Bool, ?color:Color):Void
Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with godot.EditorSpatialGizmoPlugin.getMaterial
and used in godot.EditorSpatialGizmo.addUnscaledBillboard
. Should not be overridden.
Parameters:
color | If the parameter is null, then the default value is new Color(1, 1, 1, 1) |
---|
createMaterial(name:String, color:Color, ?billboard:Bool, ?onTop:Bool, ?useVertexColor:Bool):Void
Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with godot.EditorSpatialGizmoPlugin.getMaterial
and used in godot.EditorSpatialGizmo.addMesh
and godot.EditorSpatialGizmo.addLines
. Should not be overridden.
getHandleName(gizmo:EditorSpatialGizmo, index:Int):String
Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
getHandleValue(gizmo:EditorSpatialGizmo, index:Int):Dynamic
Gets actual value of a handle from gizmo. Called for this plugin's active gizmos.
getMaterial(name:String, ?gizmo:EditorSpatialGizmo):SpatialMaterial
Gets material from the internal list of materials. If an godot.EditorSpatialGizmo
is provided, it will try to get the corresponding variant (selected and/or editable).
getName():String
Override this method to provide the name that will appear in the gizmo visibility menu.
getPriority():Int
Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used.
All built-in editor gizmos return a priority of -1
. If not overridden, this method will return 0
, which means custom gizmos will automatically override built-in gizmos.
hasGizmo(spatial:Spatial):Bool
Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a godot.Spatial
node is added to a scene this method is called, if it returns true
the node gets a generic godot.EditorSpatialGizmo
assigned and is added to this plugin's list of active gizmos.
isHandleHighlighted(gizmo:EditorSpatialGizmo, index:Int):Bool
Gets whether a handle is highlighted or not. Called for this plugin's active gizmos.
isSelectableWhenHidden():Bool
Override this method to define whether a Spatial with this gizmo should be selectable even when the gizmo is hidden.
redraw(gizmo:EditorSpatialGizmo):Void
Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
setHandle(gizmo:EditorSpatialGizmo, index:Int, camera:Camera, point:Vector2):Void
Update the value of a handle after it has been updated. Called for this plugin's active gizmos.