Repository navigation
Fix #522: SVG round trips keep hidden objects and data-* attributes - #580
Merged
Merged
Conversation
An SVG used as an animation rig lost its hidden alternates and their
rotation pivots: the exporter left hidden objects out (only hidden layers
could be kept), and the importer dropped data-* attributes.
- SVG export: hiddenLayers (on by default for document.save, as before)
now keeps hidden objects too, each written display="none" on its own
element (path, image, text or group). Exports still leave them out
unless asked; the CLI's convert asks, as a conversion keeps the
document.
- An object's own data: ObjectAttributes.data, the data-* attributes in
order (ours, data-name and data-vc-*, aside). The importer keeps them on
the objects and layers they belong to (at most 64 per element), the
exporter writes them back, the native format saves them (missing in
older files), and object.setProps {data: {key: value|null}} sets or
removes them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bflatastic
added a commit
that referenced
this pull request
Oct 8, 2026
This was referenced Oct 8, 2026
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.
An SVG animation rig now survives a round trip: hidden alternates stay in the file as
display="none", and theirdata-*attributes (pivots) are kept.hiddenLayersoption now keeps hidden objects as well as hidden layers, each written hidden on its own element (display="none"on the path, image, text or group, in every styling mode). The PSD exporter's option of the same name already covered both.document.save/ Save As sets it unless told otherwise, as before for layers, so an SVG Save As keeps hidden objects by default. Plain exports (Export As,document.export) still leave them out unless asked. The CLI'sconvertasks, since a conversion keeps the document.data-*attributes: they are kept as the object's own data, in a newObjectAttributes.datafield (an ordered list of key/value pairs). It is empty in older files and saved by the native format. Our owndata-nameanddata-vc-*attributes are left aside.object.setProps {data: {key: "value" | null}}sets or removes them. Adata-prefix on the key is optional, and keys are checked.hidden_objects_and_data_attributes_round_tripuses the issue's rig plus a lone hidden path. A plain export leaves the hidden objects out. WithhiddenLayers, in all three styling modes, they are written hidden, are not drawn by resvg, and reopen hidden with all theirdata-*.object_data_is_set_saved_and_written_to_svgcovers set, remove, undo in one step, rejected keys, SVG output and the native save/load.converthelp text, ROADMAP (SVG bullet and Last updated).With the issue's
rig-repro.svg,vectorcraft-cli convert rig-repro.svg out.svgnow writescharacter,arm,arm-raisedandeye-closed, the last two withdisplay="none", anddata-pivotoncharacter,armandarm-raised. Converting the output again only changes the title. Saving as.vectorcraftand converting back keeps everything.Checks
cargo test -p vectorcraft-svg -p vectorcraft-doc -p vectorcraft-engine -p vectorcraft-format -p vectorcraft-cli -p vectorcraft-mcp -p vectorcraft-ui-egui,cargo clippyon svg/doc/engine/cli with--all-targets -- -D warnings,cargo fmt --all,cargo xtask wasm.🤖 Generated with Claude Code