EditorEntity3DGizmoPlugin
An editor gizmo handler for lines, handles and Entity3D picking.
Register an instance through EditorPlugin.AddEntity3DGizmoPlugin(). For a simple gizmo, override _HasGizmo(), _Redraw() and handle methods. For per-object state, return a custom EditorEntity3DGizmo from _CreateGizmo().
Geometry uses Entity3D local space. Gizmo collision data serves editor picking, not game physics. Record Do/Undo through the editor manager on acceptance; directly restore the initial snapshot on cancellation.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
EditorEntity3DGizmoPluginConstructor
public EditorEntity3DGizmoPlugin();Methods24
AddMaterialvoid
public void AddMaterial(string name, StandardMaterial3D material);Adds a new material to the internal material list for the plugin. It can then be accessed with EditorEntity3DGizmoPlugin.GetMaterial. Should not be overridden.
| Name | Type | Default |
|---|---|---|
name | string | — |
material | StandardMaterial3D | — |
CreateHandleMaterialvoid
public void CreateHandleMaterial(string name, bool billboard = false, Texture2D texture = null);Create a handle material once during initialization.
| Name | Type | Default |
|---|---|---|
name | string | — |
billboard | bool | false |
texture | Texture2D | null |
nameThe handle-material key.
billboardThe handle billboard setting.
textureThe handle texture, or null for the editor default.
CreateIconMaterialvoid
public void CreateIconMaterial(string name, Texture2D texture, bool onTop = false, Color? color = default);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 EditorEntity3DGizmoPlugin.GetMaterial and used in EditorEntity3DGizmo.AddUnscaledBillboard. Should not be overridden.
| Name | Type | Default |
|---|---|---|
name | string | — |
texture | Texture2D | — |
onTop | bool | false |
color | Color? | default |
colorIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
CreateMaterialvoid
public void CreateMaterial(string name, Color color, bool billboard = false, bool onTop = false, bool useVertexColor = false);Create line-material variants for selection and editability. Call during initialization, then retrieve a variant with GetMaterial(name, gizmo) during redraw.
| Name | Type | Default |
|---|---|---|
name | string | — |
color | Color | — |
billboard | bool | false |
onTop | bool | false |
useVertexColor | bool | false |
nameThe material key within the plugin.
colorThe base color; instantiated scenes can use the editor color.
billboardFace toward the camera; false by default.
onTopDisable depth testing to draw over geometry.
useVertexColorUse vertex colors.
GetMaterialStandardMaterial3D
public StandardMaterial3D GetMaterial(string name, EditorEntity3DGizmo gizmo = null);Return a previously created material accounting for the supplied gizmo's selection and editability. Without a gizmo, return the first variant.
| Name | Type | Default |
|---|---|---|
name | string | — |
gizmo | EditorEntity3DGizmo | null |
nameThe previously created material key.
gizmoThe gizmo used to select a variant, or null. Do not dispose the active material during redraw.
StandardMaterial3DThe material for the key and state.
_BeginHandleActionvoid
public virtual void _BeginHandleAction(EditorEntity3DGizmo gizmo, int handleId, bool secondary);| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
handleId | int | — |
secondary | bool | — |
public virtual bool _CanBeHidden();Allow hiding this gizmo type through the editor; true by default. This does not change game Entity visibility.
booltrue when hiding is allowed.
_CanCommitHandleOnClickbool
public virtual bool _CanCommitHandleOnClick();Allow committing when the final handle position equals the starting position. The default is false; separately check whether data changed.
booltrue to allow that commit.
_CommitHandlevoid
public virtual void _CommitHandle(EditorEntity3DGizmo gizmo, int handleId, bool secondary, Variant restore, bool cancel);Finish editing: on cancel, directly restore the snapshot without new history. Otherwise record the final value as Do and the original as Undo through the editor manager. Skip a history entry when data did not change.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
handleId | int | — |
secondary | bool | — |
restore | Variant | — |
cancel | bool | — |
gizmoThe gizmo receiving this callback.
handleIdThe handle ID from AddHandles(), not an Entity index.
secondarytrue for a secondary handle.
restoreThe initial snapshot from _GetHandleValue().
canceltrue for cancellation; false for acceptance.
_CommitSubgizmosvoid
public virtual void _CommitSubgizmos(EditorEntity3DGizmo gizmo, int[] ids, Reckfell.Collections.Array<Transform3D> restores, bool cancel);Override this method to commit a group of subgizmos being edited (see EditorEntity3DGizmoPlugin._SubgizmosIntersectRay and EditorEntity3DGizmoPlugin._SubgizmosIntersectFrustum). 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 Entity3D. Called for this plugin's active gizmos.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
ids | int[] | — |
restores | Reckfell.Collections.Array<Transform3D> | — |
cancel | bool | — |
_CreateGizmoEditorEntity3DGizmo
public virtual EditorEntity3DGizmo _CreateGizmo(Entity3D forNode3D);Create a custom EditorEntity3DGizmo for per-object state. Return null for unrelated Entities. This is an alternative to the simple _HasGizmo() approach.
| Name | Type | Default |
|---|---|---|
forNode3D | Entity3D | — |
forNode3DThe Entity3D requesting a gizmo.
EditorEntity3DGizmoA gizmo instance, or null.
_GetGizmoNamestring
public virtual string _GetGizmoName();The gizmo type name in the editor visibility menu; this does not rename an Entity.
stringThe gizmo type name.
_GetHandleNamestring
public virtual string _GetHandleName(EditorEntity3DGizmo gizmo, int handleId, bool secondary);Set a handle label. Keep ID and secondary consistent with AddHandles().
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
handleId | int | — |
secondary | bool | — |
gizmoThe gizmo receiving this callback.
handleIdThe handle ID from AddHandles(), not an Entity index.
secondarytrue for a secondary handle.
stringThe handle label.
_GetHandleValueVariant
public virtual Variant _GetHandleValue(EditorEntity3DGizmo gizmo, int handleId, bool secondary);Return the initial snapshot before editing. The editor passes it as restore to _CommitHandle(); do not substitute the previous frame's value.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
handleId | int | — |
secondary | bool | — |
gizmoThe gizmo receiving this callback.
handleIdThe handle ID from AddHandles(), not an Entity index.
secondarytrue for a secondary handle.
VariantA Variant sufficient to restore the value.
_GetPriorityint
public virtual int _GetPriority();Set handle-input and subgizmo-selection priority. Higher values take precedence; the default is 0. This is not material draw order.
intThe numerical priority.
_GetSubgizmoTransformTransform3D
public virtual Transform3D _GetSubgizmoTransform(EditorEntity3DGizmo gizmo, int subgizmoId);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 Entity3D. This transform will be requested at the start of an edit and used in the restore argument in EditorEntity3DGizmoPlugin._CommitSubgizmos. Called for this plugin's active gizmos.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
subgizmoId | int | — |
Transform3D_HasGizmobool
public virtual bool _HasGizmo(Entity3D forNode3D);Choose Entity3D objects for this plugin's standard gizmo instance. A separate _CreateGizmo() override handles selection itself.
| Name | Type | Default |
|---|---|---|
forNode3D | Entity3D | — |
forNode3DThe edited scene Entity3D being checked.
booltrue for a supported Entity3D.
_IsHandleHighlightedbool
public virtual bool _IsHandleHighlighted(EditorEntity3DGizmo gizmo, int handleId, bool secondary);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 EditorEntity3DGizmo.AddHandles for more information). Called for this plugin's active gizmos.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
handleId | int | — |
secondary | bool | — |
boolpublic virtual bool _IsSelectableWhenHidden();Allow picking a hidden gizmo; false by default. This is editor selection, not physics collision.
booltrue to allow hidden-gizmo picking.
_Redrawvoid
public virtual void _Redraw(EditorEntity3DGizmo gizmo);Rebuild gizmo geometry: Clear() first, then local lines, picking data and handles. Create materials during initialization, not on every redraw.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
gizmoThe gizmo receiving this callback.
_SetHandlevoid
public virtual void _SetHandle(EditorEntity3DGizmo gizmo, int handleId, bool secondary, Camera3D camera, Vector2 screenPos);Update data while the handle moves. Convert the camera ray into the edited property's coordinate space; do not create an Undo action each frame.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
handleId | int | — |
secondary | bool | — |
camera | Camera3D | — |
screenPos | Vector2 | — |
gizmoThe gizmo receiving this callback.
handleIdThe handle ID from AddHandles(), not an Entity index.
secondarytrue for a secondary handle.
cameraThe edited 3D view camera.
screenPosA position in the corresponding viewport coordinates, not a world point.
_SetSubgizmoTransformvoid
public virtual void _SetSubgizmoTransform(EditorEntity3DGizmo gizmo, int subgizmoId, Transform3D transform);Override this method to update the node properties during subgizmo editing (see EditorEntity3DGizmoPlugin._SubgizmosIntersectRay and EditorEntity3DGizmoPlugin._SubgizmosIntersectFrustum). The transform is given in the Entity3D's local coordinate system. Called for this plugin's active gizmos.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
subgizmoId | int | — |
transform | Transform3D | — |
_SubgizmosIntersectFrustumint[]
public virtual int[] _SubgizmosIntersectFrustum(EditorEntity3DGizmo gizmo, Camera3D camera, Reckfell.Collections.Array<Plane> frustumPlanes);Override this method to allow selecting subgizmos using mouse drag box selection. Given a camera and frustum_planes, this method should return which subgizmos are contained within the frustums. The frustum_planes argument consists of an array with all the Planes 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 EditorEntity3DGizmoPlugin._GetSubgizmoTransform or EditorEntity3DGizmoPlugin._CommitSubgizmos. Called for this plugin's active gizmos.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
camera | Camera3D | — |
frustumPlanes | Reckfell.Collections.Array<Plane> | — |
int[]_SubgizmosIntersectRayint
public virtual int _SubgizmosIntersectRay(EditorEntity3DGizmo gizmo, Camera3D camera, Vector2 screenPos);Override this method to allow selecting subgizmos using mouse clicks. Given a camera and a screen_pos 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 EditorEntity3DGizmoPlugin._GetSubgizmoTransform or EditorEntity3DGizmoPlugin._CommitSubgizmos. Called for this plugin's active gizmos.
| Name | Type | Default |
|---|---|---|
gizmo | EditorEntity3DGizmo | — |
camera | Camera3D | — |
screenPos | Vector2 | — |
int