Dynamic Decals - Gizmo
3D transform gizmo controller for the dynamic decals tool. Manages translate/rotate/scale modes, axis gizmo lifecycle (begin/drag/end), bounding box visualization, and per-mode callback dispatch. The
3D transform gizmo controller for the dynamic decals tool. Manages translate/rotate/scale modes, axis gizmo lifecycle (begin/drag/end), bounding box visualization, and per-mode callback dispatch. The gizmo operates on the selected decal layer's world transform.
Public API
| Function | Signature | Description |
|---|---|---|
M.getTransformMode | () → number | Returns current transform mode (0=none, 1=translate, 2=rotate, 3=scale) |
M.setTransformMode | (value) | Sets transform mode |
M.resetTransformFn | () | Clears translate/rotate/scale callback functions |
M.getDragCount | () → number | Returns drag frame count (0 if not dragging) |
M.gizmoBeginDrag | () | Called when gizmo drag starts (reset counter) |
M.gizmoEndDrag | () | Called when gizmo drag ends |
M.gizmoDragging | () | Per-frame drag handler: dispatches to translateFn/rotateFn/scaleFn |
M.registerEditorPreferences | (prefsRegistry) | Registers bounding box display/color preferences |
M.editorPreferenceValueChanged | (path, value) | Preference change callback (stub) |
M.editModeUpdate | (dtReal, dtSim, dtRaw) | Per-frame update: draws gizmo + bounding box |
M.setup | (tool_in) | Stores API reference |
Public Fields
| Field | Type | Description |
|---|---|---|
M.data | table | Current gizmo context: uid, type, objectType, dataPointIndex, objectDataCopy |
M.transform | MatrixF | Current gizmo transform matrix |
M.translateFn | function | Callback for translate mode dragging |
M.rotateFn | function | Callback for rotate mode dragging |
M.scaleFn | function | Callback for scale mode dragging |
M.transformModes | table | Enum: {none=0, translate=1, rotate=2, scale=3} |
Gizmo Flow
setTransformMode(M.transformModes.translate)
M.translateFn = function(gizmoTransform) ... end
-- Each frame (in editModeUpdate):
editor.updateAxisGizmo(gizmoBeginDrag, gizmoEndDrag, gizmoDragging)
editor.drawAxisGizmo()
-- During drag (gizmoDragging):
-- Skips first frame (dragCount == 1)
-- Dispatches to M.translateFn / M.rotateFn / M.scaleFnBounding Box Rendering
When enabled and a decal layer is selected:
local transform = api.getDecalWorldTransform(layer)
editor.drawSelectionBBox(transform, ColorF(r, g, b, a))Preferences
| Key | Type | Default | Description |
|---|---|---|---|
gizmo.displayBoundingBox | bool | true | Show bounding box for selected decal |
gizmo.boundingBoxColor | table | {1,0,0,0.75} | RGBA color for bounding box |
gizmo.displayDebugObjWhileMovingControlPoints | bool | true | Show debug sphere while dragging control points |
Dependencies
| Module | Purpose |
|---|---|
editor_api_dynamicDecals | getLayerByUid(), getDecalWorldTransform() |
See Also
- Dynamic Decals - Browser - Related reference
- Dynamic Decals - Brushes - Related reference
- Dynamic Decals - Camera - Related reference
- World Editor Guide - Guide
Dynamic Decals - Fonts
Font atlas generation and management for the dynamic decals tool. Rasterizes TTF fonts into atlas textures (with optional SDF), provides glyph browser, preview window, and integrates with the decal sy
Dynamic Decals - Helper
Shared utility functions for the dynamic decals tool. Provides centered text rendering, image widgets with tooltips, icon tooltips, and string formatting helpers used across all dynamic decal modules.