pandemonium_engine/doc/classes/EditorSpatialGizmoPlugin.xml

222 lines
12 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorSpatialGizmoPlugin" inherits="Resource" version="3.5">
<brief_description>
Used by the editor to define Spatial gizmo types.
</brief_description>
<description>
[EditorSpatialGizmoPlugin] allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info.
To use [EditorSpatialGizmoPlugin], register it using the [method EditorPlugin.add_spatial_gizmo_plugin] method first.
</description>
<tutorials>
<link>$DOCS_URL/tutorials/plugins/editor/spatial_gizmos.html</link>
</tutorials>
<methods>
<method name="add_material">
<return type="void" />
<argument index="0" name="name" type="String" />
<argument index="1" name="material" type="SpatialMaterial" />
<description>
Adds a new material to the internal material list for the plugin. It can then be accessed with [method get_material]. Should not be overridden.
</description>
</method>
<method name="can_be_hidden" qualifiers="virtual">
<return type="bool" />
<description>
Override this method to define whether the gizmos handled by this plugin can be hidden or not. Returns [code]true[/code] if not overridden.
</description>
</method>
<method name="commit_handle" qualifiers="virtual">
<return type="void" />
<argument index="0" name="gizmo" type="EditorSpatialGizmo" />
<argument index="1" name="id" type="int" />
<argument index="2" name="restore" type="Variant" />
<argument index="3" name="cancel" type="bool" default="false" />
<description>
Override this method to commit a handle being edited (handles must have been previously added by [method EditorSpatialGizmo.add_handles] during [method _redraw]). This usually means creating an [UndoRedo] action for the change, using the current handle value as "do" and the [code]restore[/code] argument as "undo".
If the [code]cancel[/code] argument is [code]true[/code], the [code]restore[/code] value should be directly set, without any [UndoRedo] action. Called for this plugin's active gizmos.
</description>
</method>
<method name="commit_subgizmos" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
</argument>
<argument index="1" name="ids" type="PoolIntArray">
</argument>
<argument index="2" name="restore" type="Array">
</argument>
<argument index="3" name="cancel" type="bool" default="false">
</argument>
<description>
Override this method to commit a group of subgizmos being edited (see [method _subgizmos_intersect_ray] and [method _subgizmos_intersect_frustum]). This usually means creating an [UndoRedo] action for the change, using the current transforms as "do" and the [code]restore[/code] transforms as "undo".
If the [code]cancel[/code] argument is [code]true[/code], the [code]restore[/code] transforms should be directly set, without any [UndoRedo] action. Called for this plugin's active gizmos.
</description>
</method>
<method name="create_gizmo" qualifiers="virtual">
<return type="EditorSpatialGizmo" />
<argument index="0" name="spatial" type="Spatial" />
<description>
Override this method to return a custom [EditorSpatialGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo].
</description>
</method>
<method name="create_handle_material">
<return type="void" />
<argument index="0" name="name" type="String" />
<argument index="1" name="billboard" type="bool" default="false" />
<argument index="2" name="texture" type="Texture" default="null" />
<description>
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 [method get_material] and used in [method EditorSpatialGizmo.add_handles]. Should not be overridden.
You can optionally provide a texture to use instead of the default icon.
</description>
</method>
<method name="create_icon_material">
<return type="void" />
<argument index="0" name="name" type="String" />
<argument index="1" name="texture" type="Texture" />
<argument index="2" name="on_top" type="bool" default="false" />
<argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )" />
<description>
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 [method get_material] and used in [method EditorSpatialGizmo.add_unscaled_billboard]. Should not be overridden.
</description>
</method>
<method name="create_material">
<return type="void" />
<argument index="0" name="name" type="String" />
<argument index="1" name="color" type="Color" />
<argument index="2" name="billboard" type="bool" default="false" />
<argument index="3" name="on_top" type="bool" default="false" />
<argument index="4" name="use_vertex_color" type="bool" default="false" />
<description>
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 [method get_material] and used in [method EditorSpatialGizmo.add_mesh] and [method EditorSpatialGizmo.add_lines]. Should not be overridden.
</description>
</method>
<method name="get_handle_name" qualifiers="virtual">
<return type="String" />
<argument index="0" name="gizmo" type="EditorSpatialGizmo" />
<argument index="1" name="id" type="int" />
<description>
Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
</description>
</method>
<method name="get_handle_value" qualifiers="virtual">
<return type="Variant" />
<argument index="0" name="gizmo" type="EditorSpatialGizmo" />
<argument index="1" name="id" type="int" />
<description>
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 [code]restore[/code] argument in [method _commit_handle]. Called for this plugin's active gizmos.
</description>
</method>
<method name="get_material">
<return type="SpatialMaterial" />
<argument index="0" name="name" type="String" />
<argument index="1" name="gizmo" type="EditorSpatialGizmo" default="null" />
<description>
Gets material from the internal list of materials. If an [EditorSpatialGizmo] is provided, it will try to get the corresponding variant (selected and/or editable).
</description>
</method>
<method name="get_name" qualifiers="virtual">
<return type="String" />
<description>
Override this method to provide the name that will appear in the gizmo visibility menu.
</description>
</method>
<method name="get_priority" qualifiers="virtual">
<return type="int" />
<description>
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 [code]-1[/code]. If not overridden, this method will return [code]0[/code], which means custom gizmos will automatically get higher priority than built-in gizmos.
</description>
</method>
<method name="_get_subgizmo_transform" qualifiers="virtual">
<return type="Transform">
</return>
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
</argument>
<argument index="1" name="id" type="int">
</argument>
<description>
Override this method to return the current transform of a subgizmo. This transform will be requested at the start of an edit and used in the [code]restore[/code] argument in [method _commit_subgizmos]. Called for this plugin's active gizmos.
</description>
</method>
<method name="has_gizmo" qualifiers="virtual">
<return type="bool" />
<argument index="0" name="spatial" type="Spatial" />
<description>
Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a [Spatial] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorSpatialGizmo] assigned and is added to this plugin's list of active gizmos.
</description>
</method>
<method name="is_handle_highlighted" qualifiers="virtual">
<return type="bool" />
<argument index="0" name="gizmo" type="EditorSpatialGizmo" />
<argument index="1" name="id" type="int" />
<description>
Override this method to return [code]true[/code] whenever to given handle should be highlighted in the editor. Called for this plugin's active gizmos.
</description>
</method>
<method name="is_selectable_when_hidden" qualifiers="virtual">
<return type="bool" />
<description>
Override this method to define whether a Spatial with this gizmo should be selectable even when the gizmo is hidden.
</description>
</method>
<method name="redraw" qualifiers="virtual">
<return type="void" />
<argument index="0" name="gizmo" type="EditorSpatialGizmo" />
<description>
Override this method to add all the gizmo elements whenever a gizmo update is requested. It's common to call [method EditorSpatialGizmo.clear] at the beginning of this method and then add visual elements depending on the node's properties.
</description>
</method>
<method name="set_handle" qualifiers="virtual">
<return type="void" />
<argument index="0" name="gizmo" type="EditorSpatialGizmo" />
<argument index="1" name="id" type="int" />
<argument index="2" name="camera" type="Camera" />
<argument index="3" name="point" type="Vector2" />
<description>
Override this method to update the node's properties when the user drags a gizmo handle (previously added with [method EditorSpatialGizmo.add_handles]). The provided [code]point[/code] is the mouse position in screen coordinates and the [code]camera[/code] can be used to convert it to raycasts. Called for this plugin's active gizmos.
</description>
</method>
<method name="_set_subgizmo_transform" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
</argument>
<argument index="1" name="id" type="int">
</argument>
<argument index="2" name="transform" type="Transform">
</argument>
<description>
Override this method to update the node properties during subgizmo editing (see [method _subgizmos_intersect_ray] and [method _subgizmos_intersect_frustum]). The [code]transform[/code] is given in the Spatial's local coordinate system. Called for this plugin's active gizmos.
</description>
</method>
<method name="_subgizmos_intersect_frustum" qualifiers="virtual">
<return type="PoolIntArray">
</return>
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
</argument>
<argument index="1" name="camera" type="Camera">
</argument>
<argument index="2" name="frustum" type="Array">
</argument>
<description>
Override this method to allow selecting subgizmos using mouse drag box selection. Given a [code]camera[/code] and a [code]frustum[/code], this method should return which subgizmos are contained within the frustum. The [code]frustum[/code] argument consists of an [code]Array[/code] with all the [code]Plane[/code]s 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 [method _get_subgizmo_transform] or [method _commit_subgizmos]. Called for this plugin's active gizmos.
</description>
</method>
<method name="_subgizmos_intersect_ray" qualifiers="virtual">
<return type="int">
</return>
<argument index="0" name="gizmo" type="EditorSpatialGizmo">
</argument>
<argument index="1" name="camera" type="Camera">
</argument>
<argument index="2" name="point" type="Vector2">
</argument>
<description>
Override this method to allow selecting subgizmos using mouse clicks. Given a [code]camera[/code] and a [code]point[/code] 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 [method _get_subgizmo_transform] or [method _commit_subgizmos]. Called for this plugin's active gizmos.
</description>
</method>
</methods>
<constants>
</constants>
</class>