EditorEntity3DGizmo
An instance of editor helper geometry for one Entity3D.
Contains lines, picking data and handles bound to an Entity3D. Usually created by EditorEntity3DGizmoPlugin; derive a separate class for per-object state or logic.
Clear old data during redraw and add geometry in local coordinates. A gizmo does not create a game mesh or physics collider.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
EditorEntity3DGizmoConstructor
public EditorEntity3DGizmo();Methods29
AddCollisionSegments2 overloads
public void AddCollisionSegments(Vector3[] segments);Add local segments for editor gizmo picking. This is picking geometry, not a game physics collider. Call during redraw.
| Name | Type | Default |
|---|---|---|
segments | Vector3[] | — |
segmentsPairs of local segment endpoints.
public void AddCollisionSegments(ReadOnlySpan<Vector3> segments);Add local segments for editor gizmo picking. This is picking geometry, not a game physics collider. Call during redraw.
| Name | Type | Default |
|---|---|---|
segments | ReadOnlySpan<Vector3> | — |
segmentsPairs of local segment endpoints.
AddCollisionTrianglesvoid
public void AddCollisionTriangles(TriangleMesh triangles);Adds collision triangles to the gizmo for picking. A TriangleMesh can be generated from a regular Mesh too. Call this method during EditorEntity3DGizmo._Redraw.
| Name | Type | Default |
|---|---|---|
triangles | TriangleMesh | — |
AddHandles2 overloads
public void AddHandles(Vector3[] handles, Material material, int[] ids, bool billboard = false, bool secondary = false);Add interactive points only for a selected, editable gizmo. Implement update/commit callbacks to change properties; points alone do not change data.
| Name | Type | Default |
|---|---|---|
handles | Vector3[] | — |
material | Material | — |
ids | int[] | — |
billboard | bool | false |
secondary | bool | false |
handlesHandle positions in Entity3D local coordinates.
materialThe material created by CreateHandleMaterial().
idsEach handle ID: a nonempty array must match handles in length. An empty array uses indices.
billboardThe handle billboard setting.
secondaryAssign to the secondary set; callbacks receive the same flag.
public void AddHandles(ReadOnlySpan<Vector3> handles, Material material, ReadOnlySpan<int> ids, bool billboard, bool secondary);Add interactive points only for a selected, editable gizmo. Implement update/commit callbacks to change properties; points alone do not change data.
| Name | Type | Default |
|---|---|---|
handles | ReadOnlySpan<Vector3> | — |
material | Material | — |
ids | ReadOnlySpan<int> | — |
billboard | bool | — |
secondary | bool | — |
handlesHandle positions in Entity3D local coordinates.
materialThe material created by CreateHandleMaterial().
idsEach handle ID: a nonempty array must match handles in length. An empty array uses indices.
billboardThe handle billboard setting.
secondaryAssign to the secondary set; callbacks receive the same flag.
AddLines2 overloads
public void AddLines(Vector3[] lines, Material material, bool billboard = false, Color? modulate = default);Add lines as pairs of local points. Call after Clear() during redraw. Lines alone do not create handles or physics collisions.
| Name | Type | Default |
|---|---|---|
lines | Vector3[] | — |
material | Material | — |
billboard | bool | false |
modulate | Color? | default |
linesPairs of segment endpoints in Entity3D local coordinates.
materialThe line material, usually from GetMaterial(name, gizmo).
billboardFace lines toward the camera.
modulateAn additional color multiplier; white by default.
public void AddLines(ReadOnlySpan<Vector3> lines, Material material, bool billboard, Color? modulate);Add lines as pairs of local points. Call after Clear() during redraw. Lines alone do not create handles or physics collisions.
| Name | Type | Default |
|---|---|---|
lines | ReadOnlySpan<Vector3> | — |
material | Material | — |
billboard | bool | — |
modulate | Color? | — |
linesPairs of segment endpoints in Entity3D local coordinates.
materialThe line material, usually from GetMaterial(name, gizmo).
billboardFace lines toward the camera.
modulateAn additional color multiplier; white by default.
AddMeshvoid
public void AddMesh(Mesh mesh, Material material = null, Transform3D? transform = default, SkinReference skeleton = null);Adds a mesh to the gizmo with the specified material, local transform and skeleton. Call this method during EditorEntity3DGizmo._Redraw.
| Name | Type | Default |
|---|---|---|
mesh | Mesh | — |
material | Material | null |
transform | Transform3D? | default |
skeleton | SkinReference | null |
transformIf the parameter is null, then the default value is Transform3D.Identity.
AddUnscaledBillboardvoid
public void AddUnscaledBillboard(Material material, float defaultScale = 1f, Color? modulate = default);Adds an unscaled billboard for visualization and selection. Call this method during EditorEntity3DGizmo._Redraw.
| Name | Type | Default |
|---|---|---|
material | Material | — |
defaultScale | float | 1f |
modulate | Color? | default |
modulateIf the parameter is null, then the default value is new Color(1.0f, 1.0f, 1.0f, 1.0f).
Clearvoid
public void Clear();Clear accumulated gizmo geometry and picking data. Call at the beginning of redraw before adding lines and handles again. This does not delete the Entity.
GetEntity3DEntity3D
public Entity3D GetEntity3D();Return the Entity3D bound to this gizmo instance. Added geometry uses its local coordinates.
Entity3DThe associated Entity3D.
GetPluginEditorEntity3DGizmoPlugin
public EditorEntity3DGizmoPlugin GetPlugin();Return the serving handler. Use it to retrieve materials; do not dispose it while registered or in use.
EditorEntity3DGizmoPluginThis gizmo's handler; an unbound instance can return null.
GetSubgizmoSelectionint[]
public int[] GetSubgizmoSelection();Returns a list of the currently selected subgizmos. Can be used to highlight selected elements during EditorEntity3DGizmo._Redraw.
int[]IsSelectedbool
public bool IsSelected();Read editor gizmo selection state. This is neither Entity visibility nor a physics query.
booltrue for a selected gizmo.
IsSubgizmoSelectedbool
public bool IsSubgizmoSelected(int id);Returns true if the given subgizmo is currently selected. Can be used to highlight selected elements during EditorEntity3DGizmo._Redraw.
| Name | Type | Default |
|---|---|---|
id | int | — |
boolSetEntity3Dvoid
public void SetEntity3D(Entity node);Sets the reference Entity3D node for the gizmo. node must inherit from Entity3D.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
public void SetHidden(bool hidden);Sets the gizmo's hidden state. If true, the gizmo will be hidden. If false, it will be shown.
| Name | Type | Default |
|---|---|---|
hidden | bool | — |
_BeginHandleActionvoid
public virtual void _BeginHandleAction(int id, bool secondary);| Name | Type | Default |
|---|---|---|
id | int | — |
secondary | bool | — |
_CommitHandlevoid
public virtual void _CommitHandle(int id, bool secondary, Variant restore, bool cancel);Override this method to commit a handle being edited (handles must have been previously added by EditorEntity3DGizmo.AddHandles). This usually means creating an UndoRedo action for the change, using the current handle value as "do" and the restore argument as "undo".
If the cancel argument is true, the restore value should be directly set, without any UndoRedo action.
The secondary argument is true when the committed handle is secondary (see EditorEntity3DGizmo.AddHandles for more information).
| Name | Type | Default |
|---|---|---|
id | int | — |
secondary | bool | — |
restore | Variant | — |
cancel | bool | — |
_CommitSubgizmosvoid
public virtual void _CommitSubgizmos(int[] ids, Reckfell.Collections.Array<Transform3D> restores, bool cancel);Override this method to commit a group of subgizmos being edited (see EditorEntity3DGizmo._SubgizmosIntersectRay and EditorEntity3DGizmo._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.
| Name | Type | Default |
|---|---|---|
ids | int[] | — |
restores | Reckfell.Collections.Array<Transform3D> | — |
cancel | bool | — |
_GetHandleNamestring
public virtual string _GetHandleName(int id, bool secondary);Override this method to return the name of an edited handle (handles must have been previously added by EditorEntity3DGizmo.AddHandles). Handles can be named for reference to the user when editing.
The secondary argument is true when the requested handle is secondary (see EditorEntity3DGizmo.AddHandles for more information).
| Name | Type | Default |
|---|---|---|
id | int | — |
secondary | bool | — |
string_GetHandleValueVariant
public virtual Variant _GetHandleValue(int id, bool secondary);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 restore argument in EditorEntity3DGizmo._CommitHandle.
The secondary argument is true when the requested handle is secondary (see EditorEntity3DGizmo.AddHandles for more information).
| Name | Type | Default |
|---|---|---|
id | int | — |
secondary | bool | — |
Variant_GetSubgizmoTransformTransform3D
public virtual Transform3D _GetSubgizmoTransform(int id);Override this method to return the current transform of a subgizmo. This transform will be requested at the start of an edit and used as the restore argument in EditorEntity3DGizmo._CommitSubgizmos.
| Name | Type | Default |
|---|---|---|
id | int | — |
Transform3D_IsHandleHighlightedbool
public virtual bool _IsHandleHighlighted(int id, bool secondary);Override this method to return true whenever the 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).
| Name | Type | Default |
|---|---|---|
id | int | — |
secondary | bool | — |
bool_Redrawvoid
public virtual void _Redraw();Override this method to add all the gizmo elements whenever a gizmo update is requested. It's common to call EditorEntity3DGizmo.Clear at the beginning of this method and then add visual elements depending on the node's properties.
_SetHandlevoid
public virtual void _SetHandle(int id, bool secondary, Camera3D camera, Vector2 point);Override this method to update the node properties when the user drags a gizmo handle (previously added with EditorEntity3DGizmo.AddHandles). The provided point is the mouse position in screen coordinates and the camera can be used to convert it to raycasts.
The secondary argument is true when the edited handle is secondary (see EditorEntity3DGizmo.AddHandles for more information).
| Name | Type | Default |
|---|---|---|
id | int | — |
secondary | bool | — |
camera | Camera3D | — |
point | Vector2 | — |
_SetSubgizmoTransformvoid
public virtual void _SetSubgizmoTransform(int id, Transform3D transform);Override this method to update the node properties during subgizmo editing (see EditorEntity3DGizmo._SubgizmosIntersectRay and EditorEntity3DGizmo._SubgizmosIntersectFrustum). The transform is given in the Entity3D's local coordinate system.
| Name | Type | Default |
|---|---|---|
id | int | — |
transform | Transform3D | — |
_SubgizmosIntersectFrustumint[]
public virtual int[] _SubgizmosIntersectFrustum(Camera3D camera, Reckfell.Collections.Array<Plane> frustum);Override this method to allow selecting subgizmos using mouse drag box selection. Given a camera and a frustum, this method should return which subgizmos are contained within the frustum. The frustum 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, which can have any non-negative value and will be used in other virtual methods like EditorEntity3DGizmo._GetSubgizmoTransform or EditorEntity3DGizmo._CommitSubgizmos.
| Name | Type | Default |
|---|---|---|
camera | Camera3D | — |
frustum | Reckfell.Collections.Array<Plane> | — |
int[]_SubgizmosIntersectRayint
public virtual int _SubgizmosIntersectRay(Camera3D camera, Vector2 point);Override this method to allow selecting subgizmos using mouse clicks. Given a camera and a point 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 EditorEntity3DGizmo._GetSubgizmoTransform or EditorEntity3DGizmo._CommitSubgizmos.
| Name | Type | Default |
|---|---|---|
camera | Camera3D | — |
point | Vector2 | — |
int