Skip to content

Effects: Effect › SVG Filters lists default filters - #7658

Open
dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:feat/svg-filter-defaults
Open

dotCooCoo wants to merge 1 commit into
storytold:mainfrom
dotCooCoo:feat/svg-filter-defaults

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Effect › SVG Filters and Apply SVG Filter now list a set of default filters in every document. The help page describes picking a default filter from the
submenu, and editing a default's code in the dialog
(apply SVG filter effects).
Until now the lists held only the filters a document defined or imported.

  • The page does not list the defaults. The set, the names and the values are VectorCraft's own, written with
    SVG 1.1 filter primitives the effect already draws: Soft Blur, Heavy
    Blur, Soft Shadow, Hard Shadow, Glow, Bevel, Emboss, Thicken, Thin, Rough Edges, Grain, Grayscale, Invert and Hue
    Shift (crates/effects/src/svg_filter/defaults.rs).
  • The defaults live in the app. A document holds none of them until one is applied or edited there: svgFilter.apply
    with a default's name copies it into the document in the same undo step, and Save after Edit on a default adds the
    edited copy under the default's name. The document's copy is then listed in the default's place.
  • Delete is off for a default the document holds no copy of, and svgFilter.delete refuses it. Deleting the copy
    lists the default again.
  • svgFilter.list also returns defaults: [{name, xml, inDocument}]. svgFilter.apply takes index (and item)
    to put the filter in the place of an applied SVG filter, which Apply SVG Filter's OK uses when it is opened from the
    Appearance panel, so a default copied that way is still one undo step. An index that is not an applied SVG filter,
    null included, is an error.
  • Params text, docs/mcp.md, the SVG Filters row of docs/effects-parity.md and the evidence line in
    docs/target-app-parity.md are updated.

How it was tested

  • cargo fmt --all -- --check, cargo check --workspace --tests, and
    cargo clippy -p vectorcraft-effects -p vectorcraft-engine -p vectorcraft-ui-egui -p vectorcraft-mcp --all-targets -- -D warnings.
  • cargo test -p vectorcraft-effects --lib svg_filter: 40 passed. The new tests check that every default
    passes the filter check under its own name, draws, and is written to SVG as a filter; that Invert, Grayscale and Hue
    Shift give the values SVG 1.1's formulas give; that Hard Shadow, Thicken and Thin move or resize the alpha by their
    offset or radius; and the list order.
  • cargo test -p vectorcraft-engine --lib svgfilter: 35 passed. The new tests cover applying a default (one undo
    step, the copy added, undo removes it, and one history place taken when the history is full), editing and deleting
    a default, index, the 64-filter limit, and SVG export and the native format keeping an applied default.
  • cargo test -p vectorcraft-engine --test command_sweep: 24 passed, with malformed index, replace and delete
    cases added.
  • cargo test -p vectorcraft-ui-egui --lib: 4,646 passed, 2 ignored, including the dialog tests for the list order, OK on a
    default, Edit and Save on a default, and the menu items.
  • cargo xtask brands, layers, assets, wasm and ui-commands --check.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

Summary by CodeRabbit

  • New Features
    • Added 14 built-in SVG filters, available alongside document filters.
    • Applying a built-in filter adds a copy to the document. You can edit that copy, and deleting it makes the built-in filter available again.
    • Applying a filter to an existing SVG filter effect can now replace that effect.
    • Applied built-in filters are preserved through SVG export and import, and native-format save and reopen.
  • Documentation
    • Updated SVG filter guides to explain built-in filters, document copies, and replacing applied effects.

Effect › SVG Filters and Apply SVG Filter list 14 default filters in
every document, before the document's own. The set, the names and the
values are VectorCraft's own, written with SVG 1.1 filter primitives
(crates/effects/src/svg_filter/defaults.rs).

A document holds none of the defaults until one is applied or edited
there. svgFilter.apply with a default's name copies it into the document
in the same undo step, and svgFilter.define with replace naming a default
adds the edited copy under that name. The copy is listed in the default's
place. svgFilter.delete refuses a default the document holds no copy of,
and deleting the copy lists the default again.

svgFilter.list also returns the defaults. svgFilter.apply takes index and
item to put the filter in the place of an applied SVG filter, which the
dialog's OK uses when it is opened for an applied effect; an index that
is not an applied SVG filter, null included, is an error.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds 14 built-in SVG filters and exposes them through filter listing, editing, deletion, and application commands. Applying a default stores a document copy with the effect. The filter dialog and documentation now describe and support defaults and indexed effect replacement.

Changes: SVG filter defaults and application

Layer / File(s) Summary
Define defaults and listing
crates/effects/src/svg_filter.rs, crates/effects/src/svg_filter/defaults.rs, crates/engine/src/cmd/svgfilter.rs, docs/effects-parity.md, docs/target-app-parity.md
The effects module adds 14 SVG 1.1 filters and listing helpers. The command lists defaults alongside document filters, and the parity documentation describes the defaults.
Manage and apply filters
crates/engine/src/cmd/effectcmd.rs, crates/engine/src/cmd/svgfilter.rs, crates/engine/src/tests/svgfilter.rs, crates/engine/tests/command_sweep.rs, docs/mcp.md
The commands support default-named copies, deletion rules, and applying defaults with optional indexed replacement. Tests cover undo behavior, filter limits, invalid indices, and serialization.
Integrate defaults in the filter dialog
crates/ui-egui/src/dialogs/svg_filter.rs, crates/mcp/src/ui_catalog.rs, crates/ui-egui/src/menus/ui_commands.rs
The dialog lists defaults before other document filters and uses svgFilter.apply to apply or replace effects. Tests and UI command descriptions cover the updated behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Dialog as SVG Filter Dialog
  participant Apply as svgFilter.apply
  participant Defaults as Default filter lookup
  participant Document
  Dialog->>Apply: Submit filter name and optional index and item
  Apply->>Defaults: Resolve name when no document copy exists
  Defaults-->>Apply: Return matching default filter
  Apply->>Document: Store default copy and apply or replace effect in one undo step
Loading

Suggested reviewers: bflatastic, taha-mahmoodi, mockydevs

Merge Risk: Minimal · up to 0b1e1

This adds 14 built-in SVG filters that are copied into the document when applied or edited, with indexed replacement of applied effects. No concrete defect was found in the changed code. CI is currently failing on a render-crate compile error that appears unrelated to these changes, and it should be confirmed as pre-existing or fixed before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Effect › SVG Filters list now shows default filters. The changeset adds 14 built-in defaults, lists them in the dialog and MCP list, and supports applying, editing…
Description check Passed The description follows the template. It has a What and why section that explains the defaults, the apply, edit and delete behavior, and the API changes. It has a How it was tested section with comman…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Effect › SVG Filters list now shows default filters. The changeset adds 14 built-in defaults, lists them in the dialog and MCP list, and supports applying, editing and deleting them. The title is specific and matches the primary change, though it does not mention apply or delete behavior.

Full details: Description check

Explanation

The description follows the template. It has a What and why section that explains the defaults, the apply, edit and delete behavior, and the API changes. It has a How it was tested section with commands and pass counts. The checklist is present. The first checklist item is unchecked, and the description says cargo xtask ci was not run, which the template requires for merge readiness. The description does not explain that cargo xtask ci is still unrun, and it does not list the reason for leaving it unchecked.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

LanguageTool

docs/target-app-parity.md

LanguageTool checks are incomplete because the per-file request limit of 5 was reached. Remaining text was skipped; findings from completed checks are retained.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bada8e1 and 0b1e1e9.

Files selected for processing: 12

  • crates/effects/src/svg_filter.rs
  • crates/effects/src/svg_filter/defaults.rs
  • crates/engine/src/cmd/effectcmd.rs
  • crates/engine/src/cmd/svgfilter.rs
  • crates/engine/src/tests/svgfilter.rs
  • crates/engine/tests/command_sweep.rs
  • crates/mcp/src/ui_catalog.rs
  • crates/ui-egui/src/dialogs/svg_filter.rs
  • crates/ui-egui/src/menus/ui_commands.rs
  • docs/effects-parity.md
  • docs/mcp.md
  • docs/target-app-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

This branch has not been deployed

No deployments
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