Crawl Editor - Boundaries
Sub-module of the Crawl Data Editor handling boundary polygon creation and editing. Provides vertex manipulation with gizmo support, terrain snapping, and undo/redo history.
Sub-module of the Crawl Data Editor handling boundary polygon creation and editing. Provides vertex manipulation with gizmo support, terrain snapping, and undo/redo history.
Module Interface
This module is a class constructor that returns a boundary editor instance:
local boundaries = require('editor/crawlEditor/boundaries')(crawlEditorRef)Key Methods
| Method | Description |
|---|---|
C:init(crawlEditorParam) | Initialize with reference to parent crawl editor |
C:setBoundary(boundary) | Set the currently edited boundary |
C:clearSelection() | Clear vertex and plane selection |
Key Features
- Vertex Manipulation - Add, remove, and move boundary polygon vertices
- Gizmo Support - 3D translation gizmo for vertex positioning
- Terrain Snapping - Option to snap vertices to terrain surface
- Undo/Redo - Full history support for vertex operations
- Dirty Tracking - Marks boundaries as dirty when modified
Undo/Redo Actions
| Action | Description |
|---|---|
setFieldUndo/Redo | Restore/apply field changes (name, vertices) |
addVertexUndo/Redo | Undo/redo vertex addition |
manipulateVerticesUndo/Redo | Undo/redo vertex position changes |
Internal State
self.boundary = nil -- Currently edited boundary
self.currentVertices = {} -- Selected vertex indices
self.currentPlane = nil -- Editing plane
self._prevGizmoPos = vec3() -- Previous gizmo position for delta tracking
self._prevVerticesPos = {} -- Vertex positions before drag
self.snapToTerrain = true -- Terrain snapping toggleAll Class Methods
| Method | Signature | Description |
|---|---|---|
C:init(crawlEditorParam) | Initialize with parent crawl editor reference | |
C:setFields(boundary) | Populate ImGui field buffers from boundary data | |
C:setBoundary(boundaryParam) | Set the currently edited boundary | |
C:clearSelection() | Clear vertex and plane selection | |
C:drawBoundariesList(allBoundaries, selection) | Render selectable list with Add/Delete context menu | |
C:drawBoundaryDetail(boundary) | Full detail panel: name, file rename, vertices, planes, custom fields | |
C:getNewBoundary() | → zone | Create a new boundary zone object |
C:findVert(mouseInfo, objects) | → table/nil | Find closest vertex sphere under mouse ray |
C:tryInsert(mouseInfo) | Alt-click inserts vertex at midpoint between existing vertices | |
C:input(mouseInfo) | Handle Shift-click (add), Alt-click (insert), click/ctrl-click (select) | |
C:updateTransform() | Set gizmo transform from selected vertices/plane centroid | |
C:beginDrag() | Capture pre-drag state for undo | |
C:dragging() | Handle translate/rotate gizmo interaction for vertices and planes | |
C:dropToTerrain(pos) | → vec3, bool | Snap position to terrain height |
C:endDragging() | Commit undo action, snap to terrain, reprocess vertices | |
C:draw(mouseInfo) | Main draw loop: gizmo update + input | |
C:drawBoundaryEditor() | Renders boundary detail or "No boundary selected" | |
C:drawCustomFields(fields) | Renders custom string/number/vec3 fields with copy/paste |
See Also
- crawlEditor - Parent crawl data editor tool
Assembly Spline Manager
Central manager for the Assembly Spline tool. Handles spline CRUD operations, undo/redo, presets, serialization, splitting/joining, linking with the Master Spline tool, and dirty-state updates.
Crawl Editor Input
Mouse input handling for the Crawl Editor. Provides raycasting from the camera through the mouse cursor, tracking click/hold/release states with world-space hit positions.