Skip to content

feat: user-defined modules, independent root rendering, and session persistence#14

Merged
particlesector merged 5 commits into
mainfrom
feat/lang-modules
Apr 23, 2026
Merged

feat: user-defined modules, independent root rendering, and session persistence#14
particlesector merged 5 commits into
mainfrom
feat/lang-modules

Conversation

@particlesector
Copy link
Copy Markdown
Owner

Summary

  • User-defined modules (module name(params) { body }) with positional and named arguments, default parameter values, and correct lexical scoping via environment snapshot/restore
  • Independent root rendering — top-level objects are rendered as separate meshes (vertex buffer concatenation) instead of boolean-unioned, so objects fully contained inside another remain visible, matching OpenSCAD preview semantics
  • Overlapping-root warning — opt-in preference that runs an AABB + exact Manifold intersection check after each build and emits a diagnostics warning when roots overlap without an explicit union/difference
  • Preferences popup — modal UI under View → Preferences as a foundation for future opt-in analysis flags
  • Session persistence — window dimensions, full camera state (yaw, pitch, distance, orbit target), and last opened file are saved to config.json on exit and restored on next launch; auto-fit is skipped when resuming a saved session

chrislindseygames and others added 5 commits April 22, 2026 20:39
Implements module keyword, definition parsing, argument binding
(positional and named), default parameters, scoped environment
save/restore, and CSG evaluation. Adds 7 module-focused parser
tests, 8 CSG evaluator tests, and a visual SCAD test file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Top-level objects in a SCAD file are independent meshes — a union is an
explicit operation the user writes. The previous code ran Manifold boolean
union across all roots, silently removing any geometry interior to a larger
sibling and causing contained objects to disappear from the rendered mesh.

Each root is now evaluated to its own Manifold and the vertex/index buffers
are concatenated without any inter-root boolean ops, matching OpenSCAD's
preview behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Preferences modal (View → Preferences...) as the foundation for
user-opt-in analysis flags. The first flag, "Warn on overlapping root
objects", runs pairwise AABB-then-Manifold intersection checks on the
worker thread after each build; any overlapping pair gets a yellow warning
in the Diagnostics panel without a line:col prefix (runtime, not source).

DiagnosticsPanel now shows runtime warnings (no file + zero SourceLoc) as
plain non-clickable text instead of "1:1: message".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moves warnOverlappingRoots out of the ephemeral AppPrefs struct and into
Config, which already round-trips to ~/.chiselcad/config.json at startup
and shutdown. Removes AppPrefs — it was a premature separation. Initialises
MeshBuilder from config on startup so the preference survives restarts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On exit, saves the actual GLFW window dimensions, full camera state
(yaw, pitch, distance, target), and the last opened file path to config.
On startup, restores all three so the app resumes exactly where the user
left off. Camera auto-fit is skipped when a saved file+camera are restored.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@particlesector particlesector merged commit 99d8330 into main Apr 23, 2026
4 checks passed
@particlesector particlesector deleted the feat/lang-modules branch April 23, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants