Skip to content

Part of #372: PDF/.ai import keeps strokes live and hidden and nested layers - #401

Merged
bflatastic merged 1 commit into
mainfrom
fix/issue-372
Oct 8, 2026
Merged

bflatastic merged 1 commit into
mainfrom
fix/issue-372

Conversation

@bflatastic

@bflatastic bflatastic commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Opening a PDF-compatible .ai (or any PDF) now keeps each stroked object one path with a live stroke, and brings hidden and nested layers in as hidden layers and sublayers with their art.

  • Strokes: Illustrator writes an object as a fill of its outline left open, then a stroke of it closed; the importer only merged identical paths, so every filled-and-stroked object came in as two (a fill and a separate stroke-only path). A fill and a stroke of the same outline (equal once every subpath is closed) now become one path with the fill and a live stroke (width, cap, join, miter limit, dash, paint), taking the stroke's outline. Strokes under a stretched transform stay strokes at their average width (hayro hands strokes over as strokes; nothing outlines them).
  • Hidden layers: groups off in the default configuration already came in hidden with their art (hayro skips them, so the importer re-reads the file with every group on). Now a group whose /Usage /View /ViewState is /OFF is hidden too (an /AS view event lets the view state override /D). The interpreter-skip check (skips_any) is kept apart from layer visibility.
  • Sublayers: the configuration's /Order nesting (inline or its own object, as Illustrator writes it; labels skipped) makes sublayers in first-paint order, taking their top-level layer's colour. Depth (32), entries and groups are capped; a group listed twice stays where first listed, so the nesting has no cycles.
  • Scale: splitting a page's art by group is indexed instead of a linear search per object, so thousands of layers import quickly (test with 3,000, half hidden).
  • ROADMAP: shipped line, plus pen tilt/bearing/barrel-rotation brushes (6D art pens) on the gap list and parity row; docs/mcp.md import notes.

Not here: hidden sublayers or objects inside a visible top-level layer aren't in an .ai's PDF part at all (only top-level layers become PDF layers), and brushes/width profiles arrive expanded; both live only in the native private data (out of scope in the ROADMAP).

Checks

  • Rebased on 24bea909 (origin/main).
  • cargo fmt --all --check, cargo clippy -p vectorcraft-pdf --all-targets -D warnings, cargo test -p vectorcraft-pdf (197 + 1 passed; 5 of the 8 new tests fail without the fix, the other 3 guard behaviour that already held), cargo test -p vectorcraft-engine --test import_fuzz (37), cargo test -p vectorcraft-engine -- pdf (81), cargo xtask layers, cargo xtask brands, cargo xtask wasm, cargo check -p vectorcraft-pdf for x86_64-unknown-linux-gnu and aarch64-apple-darwin.
  • Live: vectorcraft-cli run --in <real Illustrator 29 .ai> --cmd document.inspect: the filled-and-stroked object is now one path (fill #343334, stroke #ffffff 1.5) instead of two; the same file with its layer switched off imports as a hidden layer with all its art. Survey of 19 real .ai files: all open, remaining stroke-only paths are genuine open lines.
  • MCP stdio: open_file of a nested-layer .ai then inspect_document: layer "Artwork" holds the hidden sublayer "Hidden sublayer" with its art and a fill+stroke path.

🤖 Generated with Claude Code

… layers

An object Illustrator writes as a fill of its outline left open and then a
stroke of it closed imported as two objects: a filled path and a separate
stroke-only path. A fill and a stroke of the same outline (equal once every
subpath is closed) now become one path with the fill and a live stroke
(width, cap, join, miter limit, dash, paint), taking the stroke's outline.

Layers: a group whose view state is off (/Usage /View /ViewState /OFF, with or
without an /AS view event) comes in as a hidden layer with its art, as groups
off in the default configuration already did. The configuration's /Order
nesting (inline or as its own object, labels skipped) makes sublayers, which
take their top-level layer's colour; nesting depth, entries and groups are
capped. Splitting a page's art by group is no longer quadratic, so thousands
of layers import quickly.

The 6D art pen (rotation-aware brushes) is a separate feature, now on the
ROADMAP gap list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bflatastic
bflatastic merged commit 43c0df6 into main Oct 8, 2026
@bflatastic

Copy link
Copy Markdown
Member Author

Full cargo xtask ci passed on the integrated stack; merging.

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.

1 participant