reckfellENGINE

EditorEntity3DGizmoPlugin

An editor gizmo handler for lines, handles and Entity3D picking.

On this page
class EditorEntity3DGizmoPluginReckfellSharpEditorInherits Resource

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.

Complete C# example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

EditorEntity3DGizmoPluginConstructor
# EditorEntity3DGizmoPlugin
C#
public EditorEntity3DGizmoPlugin();

Methods24

AddMaterialvoid
# AddMaterial
C#
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.

Parameters
NameTypeDefault
namestring—
materialStandardMaterial3D—
CreateHandleMaterialvoid
# CreateHandleMaterial
C#
public void CreateHandleMaterial(string name, bool billboard = false, Texture2D texture = null);

Create a handle material once during initialization.

Parameters
NameTypeDefault
namestring—
billboardboolfalse
textureTexture2Dnull
name

The handle-material key.

billboard

The handle billboard setting.

texture

The handle texture, or null for the editor default.

CreateIconMaterialvoid
# CreateIconMaterial
C#
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.

Parameters
NameTypeDefault
namestring—
textureTexture2D—
onTopboolfalse
colorColor?default
color

If the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).

CreateMaterialvoid
# CreateMaterial
C#
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.

Parameters
NameTypeDefault
namestring—
colorColor—
billboardboolfalse
onTopboolfalse
useVertexColorboolfalse
name

The material key within the plugin.

color

The base color; instantiated scenes can use the editor color.

billboard

Face toward the camera; false by default.

onTop

Disable depth testing to draw over geometry.

useVertexColor

Use vertex colors.

GetMaterialStandardMaterial3D
# GetMaterial
C#
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.

Parameters
NameTypeDefault
namestring—
gizmoEditorEntity3DGizmonull
name

The previously created material key.

gizmo

The gizmo used to select a variant, or null. Do not dispose the active material during redraw.

Returns StandardMaterial3D

The material for the key and state.

_BeginHandleActionvoid
# _BeginHandleAction
C#
public virtual void _BeginHandleAction(EditorEntity3DGizmo gizmo, int handleId, bool secondary);
Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
handleIdint—
secondarybool—
_CanBeHiddenbool
# _CanBeHidden
C#
public virtual bool _CanBeHidden();

Allow hiding this gizmo type through the editor; true by default. This does not change game Entity visibility.

Returns bool

true when hiding is allowed.

_CanCommitHandleOnClickbool
# _CanCommitHandleOnClick
C#
public virtual bool _CanCommitHandleOnClick();

Allow committing when the final handle position equals the starting position. The default is false; separately check whether data changed.

Returns bool

true to allow that commit.

_CommitHandlevoid
# _CommitHandle
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
handleIdint—
secondarybool—
restoreVariant—
cancelbool—
gizmo

The gizmo receiving this callback.

handleId

The handle ID from AddHandles(), not an Entity index.

secondary

true for a secondary handle.

restore

The initial snapshot from _GetHandleValue().

cancel

true for cancellation; false for acceptance.

_CommitSubgizmosvoid
# _CommitSubgizmos
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
idsint[]—
restoresReckfell.Collections.Array<Transform3D>—
cancelbool—
_CreateGizmoEditorEntity3DGizmo
# _CreateGizmo
C#
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.

Parameters
NameTypeDefault
forNode3DEntity3D—
forNode3D

The Entity3D requesting a gizmo.

Returns EditorEntity3DGizmo

A gizmo instance, or null.

_GetGizmoNamestring
# _GetGizmoName
C#
public virtual string _GetGizmoName();

The gizmo type name in the editor visibility menu; this does not rename an Entity.

Returns string

The gizmo type name.

_GetHandleNamestring
# _GetHandleName
C#
public virtual string _GetHandleName(EditorEntity3DGizmo gizmo, int handleId, bool secondary);

Set a handle label. Keep ID and secondary consistent with AddHandles().

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
handleIdint—
secondarybool—
gizmo

The gizmo receiving this callback.

handleId

The handle ID from AddHandles(), not an Entity index.

secondary

true for a secondary handle.

Returns string

The handle label.

_GetHandleValueVariant
# _GetHandleValue
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
handleIdint—
secondarybool—
gizmo

The gizmo receiving this callback.

handleId

The handle ID from AddHandles(), not an Entity index.

secondary

true for a secondary handle.

Returns Variant

A Variant sufficient to restore the value.

_GetPriorityint
# _GetPriority
C#
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.

Returns int

The numerical priority.

_GetSubgizmoTransformTransform3D
# _GetSubgizmoTransform
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
subgizmoIdint—
Returns Transform3D
_HasGizmobool
# _HasGizmo
C#
public virtual bool _HasGizmo(Entity3D forNode3D);

Choose Entity3D objects for this plugin's standard gizmo instance. A separate _CreateGizmo() override handles selection itself.

Parameters
NameTypeDefault
forNode3DEntity3D—
forNode3D

The edited scene Entity3D being checked.

Returns bool

true for a supported Entity3D.

_IsHandleHighlightedbool
# _IsHandleHighlighted
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
handleIdint—
secondarybool—
Returns bool
_IsSelectableWhenHiddenbool
# _IsSelectableWhenHidden
C#
public virtual bool _IsSelectableWhenHidden();

Allow picking a hidden gizmo; false by default. This is editor selection, not physics collision.

Returns bool

true to allow hidden-gizmo picking.

_Redrawvoid
# _Redraw
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
gizmo

The gizmo receiving this callback.

_SetHandlevoid
# _SetHandle
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
handleIdint—
secondarybool—
cameraCamera3D—
screenPosVector2—
gizmo

The gizmo receiving this callback.

handleId

The handle ID from AddHandles(), not an Entity index.

secondary

true for a secondary handle.

camera

The edited 3D view camera.

screenPos

A position in the corresponding viewport coordinates, not a world point.

_SetSubgizmoTransformvoid
# _SetSubgizmoTransform
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
subgizmoIdint—
transformTransform3D—
_SubgizmosIntersectFrustumint[]
# _SubgizmosIntersectFrustum
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
cameraCamera3D—
frustumPlanesReckfell.Collections.Array<Plane>—
Returns int[]
_SubgizmosIntersectRayint
# _SubgizmosIntersectRay
C#
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.

Parameters
NameTypeDefault
gizmoEditorEntity3DGizmo—
cameraCamera3D—
screenPosVector2—
Returns int
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.