feat: user-defined modules, independent root rendering, and session persistence#14
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
module name(params) { body }) with positional and named arguments, default parameter values, and correct lexical scoping via environment snapshot/restore