diff --git a/.coderabbit.yaml b/.coderabbit.yaml index 2408084cf..fa5c645f7 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,6 +1,6 @@ -# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json -reviews: - auto_review: - # Dependabot bumps are checked by CI; skip CodeRabbit reviews on them. - ignore_usernames: - - "dependabot[bot]" +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +reviews: + auto_review: + # Dependabot bumps are checked by CI; skip CodeRabbit reviews on them. + ignore_usernames: + - "dependabot[bot]" diff --git a/.config/nextest.toml b/.config/nextest.toml index 2a4cd2cb9..38f939c31 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -1,3 +1,14 @@ # Minimum cargo-nextest for this repository: GHSA-vc25-qg58-w57c is fixed in 0.9.150 and CI # installs exactly that version, so an older nextest refuses to run (exit 92 REQUIRED_VERSION_NOT_MET). nextest-version = "0.9.150" + +[test-groups] +gpu = { max-threads = 1 } + +# Coverage runs each test in a separate process, so the GPU suite's in-process lock +# cannot protect software adapters from competing devices and readback timeouts. +# UI harnesses can create a device lazily when rendering a screenshot, so include +# the whole UI package instead of an incomplete list of GPU-named tests. +[[profile.default.overrides]] +filter = 'package(effectcraft-gpu) | package(effectcraft-ui-egui) | package(effectcraft-sam2) | (package(effectcraft-cli) & test(/^cli::gpu_adapter_name_/))' +test-group = 'gpu' diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml index b903f82ea..ccf74f43a 100644 --- a/.github/workflows/packaging-lint.yml +++ b/.github/workflows/packaging-lint.yml @@ -28,6 +28,10 @@ jobs: name: Windows installation policy (no app build) runs-on: windows-latest steps: + - name: Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 354fbd268..ffbe49afb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,10 @@ name: Release on: + # A nightly dry run on main: every release build except macOS, nothing signed or released + # (craft-common-actions release.yml `dry-run`). Finds release-only breakage before release day. + schedule: + - cron: "32 1 * * *" push: branches: [release] workflow_dispatch: @@ -29,6 +33,7 @@ jobs: # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos. uses: storytold/craft-common-actions/.github/workflows/release.yml@main with: + dry-run: ${{ github.event_name == 'schedule' }} app-name: effectcraft app-title: EffectCraft version: ${{ inputs.version }} diff --git a/.gitignore b/.gitignore index ff6ad2397..7ce8c8c55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -*~ -plan/ -target/ -/dist -/log -.DS_Store -.claude/worktrees/ -__pycache__/ - -# After Effects test corpus fetched by `cargo xtask aep-corpus` -/corpus/ +*~ +plan/ +target/ +/dist +/log +.DS_Store +.claude/worktrees/ +__pycache__/ + +# After Effects test corpus fetched by `cargo xtask aep-corpus` +/corpus/ diff --git a/.mcp.json b/.mcp.json index caff41c9b..96e62feac 100644 --- a/.mcp.json +++ b/.mcp.json @@ -1,12 +1,12 @@ -{ - "mcpServers": { - "effectcraft": { - "command": "cargo", - "args": ["run", "--quiet", "--release", "-p", "effectcraft-cli", "--", "mcp", "--demo"] - }, - "effectcraft-app": { - "command": "cargo", - "args": ["run", "--quiet", "--release", "-p", "effectcraft-cli", "--", "mcp", "--bridge", "9877"] - } - } -} +{ + "mcpServers": { + "effectcraft": { + "command": "cargo", + "args": ["run", "--quiet", "--release", "-p", "effectcraft-cli", "--", "mcp", "--demo"] + }, + "effectcraft-app": { + "command": "cargo", + "args": ["run", "--quiet", "--release", "-p", "effectcraft-cli", "--", "mcp", "--bridge", "9877"] + } + } +} diff --git a/AGENTS.md b/AGENTS.md index ba48c1a97..b666f5c87 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,210 +1,210 @@ - -## House rules - -These apply in every Craft repository. A later rule may be stricter, not weaker. The source is `standards/house-rules-core.md` in `storytold/craft-contrib`. Propose changes there, not in a copy. - -1. **A person is accountable.** Whoever runs an agent answers for what it opens and for its review comments. -2. **Check, then claim.** Before writing code, read the issue comments, search pull requests for `#N` and the keywords, and check recent commits on `main`. Comment on the issue first. Release a claim you will not finish. -3. **Verify, don't guess.** Open a definition before using it. Confirm the cause in the code, even when someone names a location. -4. **Keep fixes narrow and tested.** Fix what the issue describes, where the bug is. Add a test that fails without the fix. -5. **Review the diff before opening a pull request.** Identifiers exist as used, the test fails without the fix, nothing unrelated changed, and the description is true. -6. **Look for a better pull request.** If another fixes the same thing, close yours when it is better or equal, and say why. -7. **Report only what ran.** Say what you tested and what you could not run. Without a local build or test, say so and rely on CI before marking ready. -8. **`main` changes through a pull request.** Do not push to it. Branch protection enforces this. There is no exception. -9. **Stop and ask only about** licensing outside the allowlist, publishing, releases, a new remote, secrets, spending money, destructive git, and anything else hard to undo. Otherwise keep working. `plan/` is a gitignored notebook, not rules. Without it, do not ask for it and do not stop. -10. **Keep secrets and personal details out** of the repository, logs and requests. -11. **CI stays shared.** Workflows call `storytold/craft-common-actions`. Do not change CI in a feature or fix pull request. If CI cannot cover a change, open an issue there. -12. **Guards say why.** A check that looks removable says what it prevents. Read that before changing it. -13. **Instructions must be readable by everyone.** No notes about one machine, and no links to files a reader cannot open. `craftrules` is retired. Do not link to it. -14. **Keep pull requests moving.** Concurrent pull requests are fine; unanswered actionable feedback is not. Respond in 7 days, a reminder at 14, closure eligible at 30, from when an actionable request waits on the author. Suggestions and unconfirmed bot findings do not start the clock. A fix, explanation or agreed plan resets it; unrelated activity does not. Waiting on a reviewer or maintainer pauses it and does not count against the author. A maintainer decides closure; it is never automatic. Reuse search results, do not poll, and stop at a rate limit. -15. **No agent attribution.** A pull request does not say an agent wrote it. A repository rule may not require that. - - -## Rust Craft repositories - -These apply to native Craft apps and to shared Rust libraries. Select them by repository type. A repository that merely contains some Rust does not take this block. Rules later in a repository's file may be stricter, but not weaker. The source is `standards/house-rules-rust.md` in [storytold/craft-contrib](https://github.com/storytold/craft-contrib). - -1. **Never crash.** Non-test code does not panic and has no `unsafe`, except where the repository file names an exception. Return errors, treat input as hostile, and bound recursion and allocations. New production crate roots copy the `deny` attribute from an existing crate: `clippy::unwrap_used`, `clippy::expect_used`, `clippy::panic`, `clippy::unimplemented`, `clippy::todo`, `clippy::unreachable`. Every crash fix comes with a test that panicked before the fix. -2. **Clean room.** Learn from observed behaviour and public specifications. Do not copy another product's code, assets, strings or artwork. Check a dependency's licence before adding it. -3. **Assets and fonts.** Every asset is original or suitably licensed, and is recorded in `ATTRIBUTION.md` in the same change. Font files live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts), not in the app repository. -4. **Rust only for native Craft apps.** No handwritten JavaScript or TypeScript, and no Tauri, Electron or webview shell, in those apps. Shared tooling follows its documented technical scope and maintainer-approved exceptions. Craft PR Review's existing Tauri and TypeScript UI is one such exception. It does not relax this rule for native apps. Preserve any existing web build. -5. **Time goes through `chrono`.** Do not hand-roll calendar conversion. For dates beyond what `chrono` can represent, follow [standards/time.md](https://github.com/storytold/craft-contrib/blob/main/standards/time.md). -6. **Contributor credits.** Add or edit only your own person's entry in `contributors/people.toml`, and only after asking them. Never guess a name or hand-edit `contributors.json`. - -## Licence allowlist - -Dependencies and assets use SPDX identifiers. An expression is allowed when every identifier is in this list. A repository may name a shorter list. It may not add an identifier here by editing its own copy of these rules. - -- `ISC` -- `MIT` -- `BSD-2-Clause` -- `BSD-3-Clause` -- `Apache-2.0` -- `OFL-1.1` -- `Ubuntu-font-1.0` -- `Bitstream-Vera` -- `CC0-1.0` -- `CC-BY-4.0` -- `CC-BY-SA-4.0` -- `LicenseRef-Public-Domain` - -`LicenseRef-Storyteller-Trademark` is not in this list. It covers Storyteller brand marks only, where a repository already says so. - - -# EffectCraft — rules for agents and contributors - -These rules apply to every human and AI contributor. `CLAUDE.md` holds the working instructions; this -file holds the rules that must never be broken. When the two disagree, this file wins. - -## Never crash - -People trust EffectCraft with hours of work. A malformed project, PSD, SVG, Lottie or media file, a bad -expression or script, a broken plug-in, a bad control-channel or MCP argument, a corrupt preferences file -or a full disk must produce an error the user (or agent) can act on, never a crash and never lost work. -**This rule outranks feature work:** don't ship a feature by adding a panic path, and fix a crash before -building on top of it. - -- **Fail with `Result`** through the crate's error type and propagate with `?`; add context - (`map_err`, an error variant) rather than discarding it. Lenient readers fall back and record the repair. -- **No panicking shortcuts in non-test code:** no `unwrap()`, `expect()`, `panic!`, `unreachable!`, - `todo!` or `unimplemented!`. Use `?`, `ok_or(..)?`, `let … else`, `if let`, or `unwrap_or*` where a - fallback is genuinely correct (never where it would silently corrupt a document). Unfinished features - return an "unsupported" error. The only exception is a provably infallible literal, written as - `#[allow(clippy::expect_used)]` + `.expect("why this cannot fail")`. -- **No `unsafe`** (`unsafe_code = "forbid"` for the workspace). -- **Every input-derived number is hostile.** Use `get()` instead of `[i]`/`[a..b]` when the position - comes from a file, a user, an agent or arithmetic on those; slice strings only at char boundaries; use - checked or saturating arithmetic for lengths, offsets and counts; guard division by zero and NaN/inf - casts; cap allocations sized by input. -- **Bound recursion:** projects, precomps, expressions and SVG/PSD trees can be cyclic or deeply nested; - walk them with seen-sets or depth limits. -- **Don't cascade:** handle lock poisoning (`lock().unwrap_or_else(PoisonError::into_inner)` or an - error), and treat worker-thread join results as `Result`s. -- **Last-resort guard:** the app wraps command execution and file import/export in a panic hook / - `catch_unwind` boundary that turns an escaped panic into an error and keeps the document. It is a - safety net, not a substitute for the rules above; keep `panic = "unwind"`. -- **Prove it:** every crash fix comes with a small synthetic regression test that panicked before the fix. - -Tests, benches, fuzz targets and `xtask` may `unwrap()`; `clippy.toml` allows it in tests. Crates that are -clean carry `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, -clippy::todo, clippy::unreachable)]`; new crates start with it. - -## 1. Assets: no Adobe artwork, every asset licensed and attributed - -This rule is absolute. Breaking it is the most serious mistake a contributor can make on this project. - -**What counts as an asset:** any image, icon, cursor, logo, illustration, screenshot, font, colour LUT, -preset, template, sound, music, video, 3D model, or other non-code media. This covers files in the -repository, bytes embedded in code (`include_bytes!`, base64, data URIs), and data hard-coded to -reproduce an image (for example, point lists traced from someone else's icon). - -1. **Never use Adobe iconography, images or other Adobe assets**, in any form: - - no icons, cursors, logos, splash screens, UI artwork or screenshots from any Adobe product; - - no Adobe fonts, LUTs, presets, templates, sound effects, stock media or sample projects; - - no traced, redrawn, recoloured or "inspired-by" copies of Adobe icons. Our icons may follow generic - conventions (a play triangle, a razor blade, a stopwatch), but each must be drawn from scratch - without reference to Adobe's artwork. -2. **Every asset must be open**: open-source licensed (MIT, Apache-2.0, BSD, ISC, zlib, SIL OFL…), - public domain / CC0, or Creative Commons (CC BY or CC BY-SA; no NC/ND licences), **or** created by a - contributor who owns it and licenses it to the project under the project licence (MIT OR Apache-2.0). - If the licence is unknown or unclear, the asset does not go in. -3. **Every asset needs an attribution sidecar.** Next to each asset file `X`, add `X.attribution` with: - ```text - asset: - title: - author: - source: - license: - license-file: - added: by - notes: - ``` - Also add one line for the asset to [`ATTRIBUTION.md`](ATTRIBUTION.md). `cargo xtask assets` (part of - `cargo xtask ci`) fails if any asset lacks a sidecar or index entry. -4. **Screenshots** in the repo may show only EffectCraft (or other open projects), with media we generated - or media that is itself openly licensed. Never commit screenshots of Adobe products. -5. **Local reference material stays local.** After Effects reference screenshots and notes live only in - `plan/aftereffects/` (gitignored). They must never be committed, bundled, embedded, traced or shipped. -6. **Code-drawn assets** (icons in `crates/ui-egui/src/icons.rs`, procedural demo content in - `crates/engine/src/demo.rs`, generators in `crates/effects`) are original work under the project licence - and are listed in `ATTRIBUTION.md`. -7. **When in doubt, leave it out** and draw or generate it yourself. -8. **The one exception: first-party ArtCraft brand marks.** The ArtCraft name and logos in `docs/brand/` - are trademarks of the ArtCraft Team, not open source, usable only unmodified and only in the context of - EffectCraft under `docs/brand/LICENSE-brand.txt` (forks and modified versions must remove them). They still - need a sidecar and an `ATTRIBUTION.md` row (licence `LicenseRef-ArtCraft-Trademark`). No other - non-open asset is allowed, and this exception never covers third-party marks (Adobe, Discord, GitHub - and other logos stay out; draw a generic icon instead). - -## 2. Clean-room code - -- Never read, disassemble or copy anything inside Adobe application bundles; file names and listings only. - Observe behaviour by using the app; never capture its Home screen, recent projects, account info or - file browsers. -- Never copy GPL/LGPL/AGPL code (FFmpeg, Natron, Blender, Glaxnimate, Synfig, Friction, Olive, MLT, frei0r, G'MIC…). -- Never read or copy Adobe expression/scripting implementations, `.ffx` presets or effect plug-ins; the public Expression Language Reference and Scripting Guide describe *behaviour* only. -- Implement codecs and formats from public specifications (ITU-T/ISO/IEC standards, IETF RFCs, the VP9 - and AV1 bitstream specs, SMPTE documents, published container specs). Do not read the source of - reference or third-party decoders/encoders while implementing a format, even permissively licensed - ones (libvpx, libopus, libaom, dav1d, openh264…); spec text and conformance vectors only. Record the - spec edition used in the crate README. -- ffmpeg/ffprobe may be used only as external test oracles and fixture generators. They are never - linked, bundled or shipped. -- Dependencies must use permissive licences: MIT/Apache-2.0/BSD/ISC/Zlib/Unicode/CC0/BSL-1.0, or - MPL-2.0 used unmodified. - -## 3. Engineering rules - -- **Layering** (`cargo xtask layers`): nothing below L5 depends on egui/eframe/winit/rfd/cpal; L0–L4 build for wasm32. -- **Exact time:** `effectcraft_time::Tick` (254 016 000 000/s). Keyframe times are layer time. -- **Property tree:** everything animatable is a `Property` in the layer's `PropGroup` tree, addressed by paths (`transform/position`, `effects/#1/blurriness`, `@uid`). -- **Everything is a command** (`crates/engine`): id, label, menu path, shortcut, params, enabled(), run(). UI, CLI, control channel and MCP dispatch by id. -- **Everything is agent-drivable:** every interactive widget registers an automation id; UI state is serde. -- **Community links** (Help menu, About, header Discord button): https://discord.gg/artcraft, https://getartcraft.com, https://getartcraft.com/apps/effectcraft, https://github.com/storytold/effectcraft. -- **Quality gates** before every commit: `cargo xtask ci` (fmt, clippy -D warnings, tests, layers, assets, wasm). -- New workspace crates include `[lints] workspace = true` in `Cargo.toml`. Production crate roots declare the crate-level lint attributes before modules; crate-level `//!` documentation may precede them. -- **Commits:** one task id per commit (`M6.3: trim paths`). Only green states. -- `cargo run -p effectcraft -- --control 9877` opens the desktop app with the JSON-lines control server (`docs/control-protocol.md`). For UI work, look at the result, including the headless `snapshot` example. -- `plan/` is an optional gitignored notebook (`plan/aftereffects/` may hold reference notes and captures). Do not ask for it, do not stop when it is absent, and never commit those captures. -- Read [`docs/gaps.md`](docs/gaps.md) and [`docs/target-app-parity.md`](docs/target-app-parity.md) before choosing work. Fidelity, reliability and stability (G1–G3) come before new features. -- Some workflow files still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task. - - -Shared real-file test corpora (Photoshop-authored PSDs, etc.) live in -[`storytold/photocraft-corpus`](https://github.com/storytold/photocraft-corpus). -Never commit large binary fixtures to this repo; fetch them pinned by commit and sha256-verified, -as PhotoCraft does with `cargo xtask corpus`. - - -## See also - -- [ROADMAP.md](ROADMAP.md): stage, headline numbers and what's next -- [docs/gaps.md](docs/gaps.md): every known shortfall against After Effects, ranked, and the prioritised workstreams (G1–G9); read it before choosing work -- [docs/target-app-parity.md](docs/target-app-parity.md): the parity numbers and how they were measured, with the per-area docs it links (UI, file formats, hardware, localization, effects, scripting) -- [CONTRIBUTING.md](CONTRIBUTING.md): setup, gates, commits, how to add things -- [docs/architecture.md](docs/architecture.md): layers, data model, commands, pipeline -- [docs/testing.md](docs/testing.md): oracle tests, criteria, benchmarks -- [docs/agents.md](docs/agents.md): driving EffectCraft over MCP / the control channel, and the agent work loop -- [docs/control-protocol.md](docs/control-protocol.md): control-channel method reference -- [docs/contributors.md](docs/contributors.md): the About window's contributor and model credits -- [ATTRIBUTION.md](ATTRIBUTION.md): asset index - -## Contributor credits (About window) - -- About ▸ Contributors/Models are compiled into the binary from `contributors/contributors.json` - (commit stats; generated, never hand-edit) and `contributors/people.toml` (names people chose for - themselves). See `docs/contributors.md`. -- **Agents working for a contributor:** when you prepare a PR, check whether your human's GitHub - username has a `[people.]` entry in `contributors/people.toml`. If not, ask them once - whether they want to be credited by more than their username: a real name, a display name, and/or - their public GitHub profile name (`sync_github_name = true`). If yes, add **only their own** entry - (copy the template at the top of the file) - and include it in their PR, committed as them. If no, change nothing: they are credited as - `@username` anyway. -- Never add, edit, guess or copy anyone else's entry or name (not from git config, commit authors or - GitHub profiles). Never hand-edit `contributors.json`. - -## CI workflows -- Workflows in `.github/workflows/` call the shared workflows in [`storytold/craft-common-actions`](https://github.com/storytold/craft-common-actions) at `@main`, with their inputs and secrets. No other jobs: if no shared workflow does what's needed, it doesn't go here. -- Don't add or change CI in a feature or fix PR. If the existing workflows can't build or test a change, link an existing craft-common-actions issue or PR, or open a new issue, or a PR only for a small fix that is safe for every app and does not increase CI time. -- Some workflow files here still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task, never part of another PR, and the job stays here until a shared workflow runs it. + +## House rules + +These apply in every Craft repository. A later rule may be stricter, not weaker. The source is `standards/house-rules-core.md` in `storytold/craft-contrib`. Propose changes there, not in a copy. + +1. **A person is accountable.** Whoever runs an agent answers for what it opens and for its review comments. +2. **Check, then claim.** Before writing code, read the issue comments, search pull requests for `#N` and the keywords, and check recent commits on `main`. Comment on the issue first. Release a claim you will not finish. +3. **Verify, don't guess.** Open a definition before using it. Confirm the cause in the code, even when someone names a location. +4. **Keep fixes narrow and tested.** Fix what the issue describes, where the bug is. Add a test that fails without the fix. +5. **Review the diff before opening a pull request.** Identifiers exist as used, the test fails without the fix, nothing unrelated changed, and the description is true. +6. **Look for a better pull request.** If another fixes the same thing, close yours when it is better or equal, and say why. +7. **Report only what ran.** Say what you tested and what you could not run. Without a local build or test, say so and rely on CI before marking ready. +8. **`main` changes through a pull request.** Do not push to it. Branch protection enforces this. There is no exception. +9. **Stop and ask only about** licensing outside the allowlist, publishing, releases, a new remote, secrets, spending money, destructive git, and anything else hard to undo. Otherwise keep working. `plan/` is a gitignored notebook, not rules. Without it, do not ask for it and do not stop. +10. **Keep secrets and personal details out** of the repository, logs and requests. +11. **CI stays shared.** Workflows call `storytold/craft-common-actions`. Do not change CI in a feature or fix pull request. If CI cannot cover a change, open an issue there. +12. **Guards say why.** A check that looks removable says what it prevents. Read that before changing it. +13. **Instructions must be readable by everyone.** No notes about one machine, and no links to files a reader cannot open. `craftrules` is retired. Do not link to it. +14. **Keep pull requests moving.** Concurrent pull requests are fine; unanswered actionable feedback is not. Respond in 7 days, a reminder at 14, closure eligible at 30, from when an actionable request waits on the author. Suggestions and unconfirmed bot findings do not start the clock. A fix, explanation or agreed plan resets it; unrelated activity does not. Waiting on a reviewer or maintainer pauses it and does not count against the author. A maintainer decides closure; it is never automatic. Reuse search results, do not poll, and stop at a rate limit. +15. **No agent attribution.** A pull request does not say an agent wrote it. A repository rule may not require that. + + +## Rust Craft repositories + +These apply to native Craft apps and to shared Rust libraries. Select them by repository type. A repository that merely contains some Rust does not take this block. Rules later in a repository's file may be stricter, but not weaker. The source is `standards/house-rules-rust.md` in [storytold/craft-contrib](https://github.com/storytold/craft-contrib). + +1. **Never crash.** Non-test code does not panic and has no `unsafe`, except where the repository file names an exception. Return errors, treat input as hostile, and bound recursion and allocations. New production crate roots copy the `deny` attribute from an existing crate: `clippy::unwrap_used`, `clippy::expect_used`, `clippy::panic`, `clippy::unimplemented`, `clippy::todo`, `clippy::unreachable`. Every crash fix comes with a test that panicked before the fix. +2. **Clean room.** Learn from observed behaviour and public specifications. Do not copy another product's code, assets, strings or artwork. Check a dependency's licence before adding it. +3. **Assets and fonts.** Every asset is original or suitably licensed, and is recorded in `ATTRIBUTION.md` in the same change. Font files live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts), not in the app repository. +4. **Rust only for native Craft apps.** No handwritten JavaScript or TypeScript, and no Tauri, Electron or webview shell, in those apps. Shared tooling follows its documented technical scope and maintainer-approved exceptions. Craft PR Review's existing Tauri and TypeScript UI is one such exception. It does not relax this rule for native apps. Preserve any existing web build. +5. **Time goes through `chrono`.** Do not hand-roll calendar conversion. For dates beyond what `chrono` can represent, follow [standards/time.md](https://github.com/storytold/craft-contrib/blob/main/standards/time.md). +6. **Contributor credits.** Add or edit only your own person's entry in `contributors/people.toml`, and only after asking them. Never guess a name or hand-edit `contributors.json`. + +## Licence allowlist + +Dependencies and assets use SPDX identifiers. An expression is allowed when every identifier is in this list. A repository may name a shorter list. It may not add an identifier here by editing its own copy of these rules. + +- `ISC` +- `MIT` +- `BSD-2-Clause` +- `BSD-3-Clause` +- `Apache-2.0` +- `OFL-1.1` +- `Ubuntu-font-1.0` +- `Bitstream-Vera` +- `CC0-1.0` +- `CC-BY-4.0` +- `CC-BY-SA-4.0` +- `LicenseRef-Public-Domain` + +`LicenseRef-Storyteller-Trademark` is not in this list. It covers Storyteller brand marks only, where a repository already says so. + + +# EffectCraft — rules for agents and contributors + +These rules apply to every human and AI contributor. `CLAUDE.md` holds the working instructions; this +file holds the rules that must never be broken. When the two disagree, this file wins. + +## Never crash + +People trust EffectCraft with hours of work. A malformed project, PSD, SVG, Lottie or media file, a bad +expression or script, a broken plug-in, a bad control-channel or MCP argument, a corrupt preferences file +or a full disk must produce an error the user (or agent) can act on, never a crash and never lost work. +**This rule outranks feature work:** don't ship a feature by adding a panic path, and fix a crash before +building on top of it. + +- **Fail with `Result`** through the crate's error type and propagate with `?`; add context + (`map_err`, an error variant) rather than discarding it. Lenient readers fall back and record the repair. +- **No panicking shortcuts in non-test code:** no `unwrap()`, `expect()`, `panic!`, `unreachable!`, + `todo!` or `unimplemented!`. Use `?`, `ok_or(..)?`, `let … else`, `if let`, or `unwrap_or*` where a + fallback is genuinely correct (never where it would silently corrupt a document). Unfinished features + return an "unsupported" error. The only exception is a provably infallible literal, written as + `#[allow(clippy::expect_used)]` + `.expect("why this cannot fail")`. +- **No `unsafe`** (`unsafe_code = "forbid"` for the workspace). +- **Every input-derived number is hostile.** Use `get()` instead of `[i]`/`[a..b]` when the position + comes from a file, a user, an agent or arithmetic on those; slice strings only at char boundaries; use + checked or saturating arithmetic for lengths, offsets and counts; guard division by zero and NaN/inf + casts; cap allocations sized by input. +- **Bound recursion:** projects, precomps, expressions and SVG/PSD trees can be cyclic or deeply nested; + walk them with seen-sets or depth limits. +- **Don't cascade:** handle lock poisoning (`lock().unwrap_or_else(PoisonError::into_inner)` or an + error), and treat worker-thread join results as `Result`s. +- **Last-resort guard:** the app wraps command execution and file import/export in a panic hook / + `catch_unwind` boundary that turns an escaped panic into an error and keeps the document. It is a + safety net, not a substitute for the rules above; keep `panic = "unwind"`. +- **Prove it:** every crash fix comes with a small synthetic regression test that panicked before the fix. + +Tests, benches, fuzz targets and `xtask` may `unwrap()`; `clippy.toml` allows it in tests. Crates that are +clean carry `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, +clippy::todo, clippy::unreachable)]`; new crates start with it. + +## 1. Assets: no Adobe artwork, every asset licensed and attributed + +This rule is absolute. Breaking it is the most serious mistake a contributor can make on this project. + +**What counts as an asset:** any image, icon, cursor, logo, illustration, screenshot, font, colour LUT, +preset, template, sound, music, video, 3D model, or other non-code media. This covers files in the +repository, bytes embedded in code (`include_bytes!`, base64, data URIs), and data hard-coded to +reproduce an image (for example, point lists traced from someone else's icon). + +1. **Never use Adobe iconography, images or other Adobe assets**, in any form: + - no icons, cursors, logos, splash screens, UI artwork or screenshots from any Adobe product; + - no Adobe fonts, LUTs, presets, templates, sound effects, stock media or sample projects; + - no traced, redrawn, recoloured or "inspired-by" copies of Adobe icons. Our icons may follow generic + conventions (a play triangle, a razor blade, a stopwatch), but each must be drawn from scratch + without reference to Adobe's artwork. +2. **Every asset must be open**: open-source licensed (MIT, Apache-2.0, BSD, ISC, zlib, SIL OFL…), + public domain / CC0, or Creative Commons (CC BY or CC BY-SA; no NC/ND licences), **or** created by a + contributor who owns it and licenses it to the project under the project licence (MIT OR Apache-2.0). + If the licence is unknown or unclear, the asset does not go in. +3. **Every asset needs an attribution sidecar.** Next to each asset file `X`, add `X.attribution` with: + ```text + asset: + title: + author: + source: + license: + license-file: + added: by + notes: + ``` + Also add one line for the asset to [`ATTRIBUTION.md`](ATTRIBUTION.md). `cargo xtask assets` (part of + `cargo xtask ci`) fails if any asset lacks a sidecar or index entry. +4. **Screenshots** in the repo may show only EffectCraft (or other open projects), with media we generated + or media that is itself openly licensed. Never commit screenshots of Adobe products. +5. **Local reference material stays local.** After Effects reference screenshots and notes live only in + `plan/aftereffects/` (gitignored). They must never be committed, bundled, embedded, traced or shipped. +6. **Code-drawn assets** (icons in `crates/ui-egui/src/icons.rs`, procedural demo content in + `crates/engine/src/demo.rs`, generators in `crates/effects`) are original work under the project licence + and are listed in `ATTRIBUTION.md`. +7. **When in doubt, leave it out** and draw or generate it yourself. +8. **The one exception: first-party ArtCraft brand marks.** The ArtCraft name and logos in `docs/brand/` + are trademarks of the ArtCraft Team, not open source, usable only unmodified and only in the context of + EffectCraft under `docs/brand/LICENSE-brand.txt` (forks and modified versions must remove them). They still + need a sidecar and an `ATTRIBUTION.md` row (licence `LicenseRef-ArtCraft-Trademark`). No other + non-open asset is allowed, and this exception never covers third-party marks (Adobe, Discord, GitHub + and other logos stay out; draw a generic icon instead). + +## 2. Clean-room code + +- Never read, disassemble or copy anything inside Adobe application bundles; file names and listings only. + Observe behaviour by using the app; never capture its Home screen, recent projects, account info or + file browsers. +- Never copy GPL/LGPL/AGPL code (FFmpeg, Natron, Blender, Glaxnimate, Synfig, Friction, Olive, MLT, frei0r, G'MIC…). +- Never read or copy Adobe expression/scripting implementations, `.ffx` presets or effect plug-ins; the public Expression Language Reference and Scripting Guide describe *behaviour* only. +- Implement codecs and formats from public specifications (ITU-T/ISO/IEC standards, IETF RFCs, the VP9 + and AV1 bitstream specs, SMPTE documents, published container specs). Do not read the source of + reference or third-party decoders/encoders while implementing a format, even permissively licensed + ones (libvpx, libopus, libaom, dav1d, openh264…); spec text and conformance vectors only. Record the + spec edition used in the crate README. +- ffmpeg/ffprobe may be used only as external test oracles and fixture generators. They are never + linked, bundled or shipped. +- Dependencies must use permissive licences: MIT/Apache-2.0/BSD/ISC/Zlib/Unicode/CC0/BSL-1.0, or + MPL-2.0 used unmodified. + +## 3. Engineering rules + +- **Layering** (`cargo xtask layers`): nothing below L5 depends on egui/eframe/winit/rfd/cpal; L0–L4 build for wasm32. +- **Exact time:** `effectcraft_time::Tick` (254 016 000 000/s). Keyframe times are layer time. +- **Property tree:** everything animatable is a `Property` in the layer's `PropGroup` tree, addressed by paths (`transform/position`, `effects/#1/blurriness`, `@uid`). +- **Everything is a command** (`crates/engine`): id, label, menu path, shortcut, params, enabled(), run(). UI, CLI, control channel and MCP dispatch by id. +- **Everything is agent-drivable:** every interactive widget registers an automation id; UI state is serde. +- **Community links** (Help menu, About, header Discord button): https://discord.gg/artcraft, https://getartcraft.com, https://getartcraft.com/apps/effectcraft, https://github.com/storytold/effectcraft. +- **Quality gates** before every commit: `cargo xtask ci` (fmt, clippy -D warnings, tests, layers, assets, wasm). +- New workspace crates include `[lints] workspace = true` in `Cargo.toml`. Production crate roots declare the crate-level lint attributes before modules; crate-level `//!` documentation may precede them. +- **Commits:** one task id per commit (`M6.3: trim paths`). Only green states. +- `cargo run -p effectcraft -- --control 9877` opens the desktop app with the JSON-lines control server (`docs/control-protocol.md`). For UI work, look at the result, including the headless `snapshot` example. +- `plan/` is an optional gitignored notebook (`plan/aftereffects/` may hold reference notes and captures). Do not ask for it, do not stop when it is absent, and never commit those captures. +- Read [`docs/gaps.md`](docs/gaps.md) and [`docs/target-app-parity.md`](docs/target-app-parity.md) before choosing work. Fidelity, reliability and stability (G1–G3) come before new features. +- Some workflow files still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task. + + +Shared real-file test corpora (Photoshop-authored PSDs, etc.) live in +[`storytold/photocraft-corpus`](https://github.com/storytold/photocraft-corpus). +Never commit large binary fixtures to this repo; fetch them pinned by commit and sha256-verified, +as PhotoCraft does with `cargo xtask corpus`. + + +## See also + +- [ROADMAP.md](ROADMAP.md): stage, headline numbers and what's next +- [docs/gaps.md](docs/gaps.md): every known shortfall against After Effects, ranked, and the prioritised workstreams (G1–G9); read it before choosing work +- [docs/target-app-parity.md](docs/target-app-parity.md): the parity numbers and how they were measured, with the per-area docs it links (UI, file formats, hardware, localization, effects, scripting) +- [CONTRIBUTING.md](CONTRIBUTING.md): setup, gates, commits, how to add things +- [docs/architecture.md](docs/architecture.md): layers, data model, commands, pipeline +- [docs/testing.md](docs/testing.md): oracle tests, criteria, benchmarks +- [docs/agents.md](docs/agents.md): driving EffectCraft over MCP / the control channel, and the agent work loop +- [docs/control-protocol.md](docs/control-protocol.md): control-channel method reference +- [docs/contributors.md](docs/contributors.md): the About window's contributor and model credits +- [ATTRIBUTION.md](ATTRIBUTION.md): asset index + +## Contributor credits (About window) + +- About ▸ Contributors/Models are compiled into the binary from `contributors/contributors.json` + (commit stats; generated, never hand-edit) and `contributors/people.toml` (names people chose for + themselves). See `docs/contributors.md`. +- **Agents working for a contributor:** when you prepare a PR, check whether your human's GitHub + username has a `[people.]` entry in `contributors/people.toml`. If not, ask them once + whether they want to be credited by more than their username: a real name, a display name, and/or + their public GitHub profile name (`sync_github_name = true`). If yes, add **only their own** entry + (copy the template at the top of the file) + and include it in their PR, committed as them. If no, change nothing: they are credited as + `@username` anyway. +- Never add, edit, guess or copy anyone else's entry or name (not from git config, commit authors or + GitHub profiles). Never hand-edit `contributors.json`. + +## CI workflows +- Workflows in `.github/workflows/` call the shared workflows in [`storytold/craft-common-actions`](https://github.com/storytold/craft-common-actions) at `@main`, with their inputs and secrets. No other jobs: if no shared workflow does what's needed, it doesn't go here. +- Don't add or change CI in a feature or fix PR. If the existing workflows can't build or test a change, link an existing craft-common-actions issue or PR, or open a new issue, or a PR only for a small fix that is safe for every app and does not increase CI time. +- Some workflow files here still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task, never part of another PR, and the job stays here until a shared workflow runs it. diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 5bff5cdb0..2f78b6b5e 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -1,150 +1,158 @@ -# Attribution - -Every non-code asset in EffectCraft, with its author, source and licence. Each repository file listed here also has -a `.attribution` sidecar with full details. The rules are in [AGENTS.md](AGENTS.md) §1: no Adobe -iconography, images or other Adobe assets; open licences only; every asset attributed. -`cargo xtask assets` checks that this index and the sidecars cover every asset in the repository. -The complete licence texts and copyright notices for the bundled fonts, including the fonts embedded -by the pinned egui dependency, are reproduced in [`NOTICE`](NOTICE), which every package ships; the -`assets/fonts/OFL-*.txt` files are the upstream copies kept beside the fonts. - -## Bundled dependency fonts - -These fonts are embedded by the pinned egui dependency (epaint_default_fonts 0.37 at -`6d518fc799681571963842f95b55a6b68431b15a`); no font file is added to this repository. -egui-icons is always embedded, `default_fonts` adds Ubuntu Light and Hack, and -`monochrome_emoji_fonts` adds Noto Emoji and emoji-icon-font. The complete copyright notices -and licence texts are in [`NOTICE`](NOTICE). - -| Asset | Author | Source | Licence | -|---|---|---|---| -| `epaint_default_fonts/fonts/egui-icons.ttf` | John Slegers (emoji-icon-font) | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/egui-icons.txt; original https://github.com/jslegers/emoji-icon-font | MIT (complete copyright and permission text in `NOTICE`) | -| `epaint_default_fonts/fonts/emoji-icon-font.ttf` | John Slegers | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/emoji-icon-font-mit-license.txt; original https://github.com/jslegers/emoji-icon-font | MIT (complete copyright and permission text in `NOTICE`) | -| `epaint_default_fonts/fonts/NotoEmoji-Regular.ttf` | Google Inc. (The Noto Project Authors) | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/OFL.txt | OFL-1.1 (complete text in `NOTICE`) | -| `epaint_default_fonts/fonts/Ubuntu-Light.ttf` | Canonical Ltd. and Dalton Maag | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/UFL.txt | Ubuntu Font Licence 1.0 (complete text in `NOTICE`) | -| `epaint_default_fonts/fonts/Hack-Regular.ttf` | Source Foundry Authors; Bitstream Inc. | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/Hack-Regular.txt; original https://github.com/source-foundry/Hack | MIT AND Bitstream-Vera (complete texts in `NOTICE`) | - -## Asset files - -| Asset | Author | Source | Licence | -|---|---|---|---| -| `assets/fonts/Inter-Regular.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | -| `assets/fonts/Inter-Medium.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | -| `assets/fonts/Inter-SemiBold.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | -| `assets/fonts/Inter-Bold.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | -| `assets/fonts/Inter-Italic.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | -| `assets/fonts/NotoSerif-Regular.ttf` | The Noto Project Authors | https://github.com/notofonts/latin-greek-cyrillic | OFL-1.1 (`assets/fonts/OFL-NotoSerif.txt`) | -| `assets/fonts/NotoSansSymbols2-Regular.ttf` | The Noto Project Authors | https://github.com/notofonts/symbols | OFL-1.1 (`assets/fonts/OFL-NotoSansSymbols2.txt`) | -| `assets/fonts/JetBrainsMono-Regular.ttf` | The JetBrains Mono Project Authors | https://github.com/JetBrains/JetBrainsMono | OFL-1.1 (`assets/fonts/OFL-JetBrainsMono.txt`) | -| `apps/effectcraft-web/web/favicon.svg` | EffectCraft contributors | Original work: web app icon, a copy of `assets/app-icon/effectcraft-small.svg` (the unicorn app icon) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `packaging/macos/dmg/background.svg` | @XusBadia | Original work: macOS DMG Finder window background, derived from the EffectCraft app icon (`assets/app-icon/effectcraft.svg`); rendered to a TIFF by `packaging/macos/package.sh` at package time | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | -| `assets/app-icon/effectcraft-1024.png` | EffectCraft contributors | Original work: effectCraft app icon, 1024 px (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/effectcraft-macos-512.png` | EffectCraft contributors | Original work: effectCraft runtime Dock icon (macOS) (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/effectcraft-small.svg` | EffectCraft contributors | Original work: effectCraft app icon, light vector (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/effectcraft.icns` | EffectCraft contributors | Original work: effectCraft macOS app icon (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/effectcraft.ico` | EffectCraft contributors | Original work: effectCraft Windows app icon (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/effectcraft.svg` | EffectCraft contributors | Original work: effectCraft app icon, master vector (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/128x128/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 128x128 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/16x16/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 16x16 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/24x24/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 24x24 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/256x256/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 256x256 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/32x32/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 32x32 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/48x48/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 48x48 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/512x512/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 512x512 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/64x64/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 64x64 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `assets/app-icon/hicolor/scalable/apps/ai.storyteller.effectcraft.svg` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor scalable (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | -| `crates/lottie/tests/fixtures/bouncing-ball.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (bouncing ball, eased position keys) | MIT OR Apache-2.0 | -| `crates/lottie/tests/fixtures/shapes-gradient.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (star, rectangle, gradient fill, dashed stroke, trim paths) | MIT OR Apache-2.0 | -| `crates/lottie/tests/fixtures/precomp-matte-text.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (precomp, track matte, parented text) | MIT OR Apache-2.0 | -| `crates/lottie/tests/fixtures/legacy-masks.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (legacy keyframes, masks) | MIT OR Apache-2.0 | -| `crates/svg/tests/fixtures/basic-shapes.svg` | EffectCraft contributors | Original work: hand-written SVG test fixture (basic shapes, groups, transforms) | MIT OR Apache-2.0 | -| `crates/svg/tests/fixtures/paths-gradients.svg` | EffectCraft contributors | Original work: hand-written SVG test fixture (path data, gradients, CSS, use) | MIT OR Apache-2.0 | -| `crates/model/tests/fixtures/quad.gltf` | EffectCraft contributors | Original work: glTF 2.0 test fixture (textured quad, node hierarchy, translation animation; data URIs) | MIT OR Apache-2.0 | -| `crates/model/tests/fixtures/quad.glb` | EffectCraft contributors | Original work: binary glTF test fixture (the same quad with its texture in the BIN chunk) | MIT OR Apache-2.0 | -| `crates/model/tests/fixtures/cube.obj` | EffectCraft contributors | Original work: Wavefront OBJ test fixture (unit cube, two materials) | MIT OR Apache-2.0 | -| `crates/model/tests/fixtures/cube.mtl` | EffectCraft contributors | Original work: MTL test fixture (materials of cube.obj) | MIT OR Apache-2.0 | - -Two small After Effects test projects of `crates/aep` are in this repository: `crates/aep/tests/fixtures/synthetic.aep` (original work, made with After Effects 2026 from own data, working space None, the embedded colour profile removed; MIT OR Apache-2.0, with its `.attribution` sidecar) and `crates/aep/tests/fixtures/ai-mask-3099.aep` (original work, made with After Effects 2026 from four hand-written one-page PDFs named `.ai`, footage paths and host name neutralised, the embedded colour profiles replaced by stubs made with `crates/aep/examples/stubicc.rs`; MIT OR Apache-2.0, with its `.attribution` sidecar). The other After Effects test projects of `crates/aep` are not in this repository. They are original work of an EffectCraft contributor, generated with After Effects 2026 as own test data (MIT OR Apache-2.0, each file with its `.attribution` sidecar); they are in [storytold/effectcraft-corpus](https://github.com/storytold/effectcraft-corpus) with their sidecars, fetched by `cargo xtask aep-corpus` (commit-pinned, SHA-256-verified), and the tests read them only from the folder named by `EFFECTCRAFT_AEP_FIXTURES` (opt-in). Their embedded colour profiles are replaced by stubs made with `crates/aep/examples/stubicc.rs` (a header and a description, no colour data), so no vendor profile data is in them. - -## Screenshots - -Screenshots of EffectCraft itself, rendered headlessly, showing only procedurally generated demo content. - -| Asset | Author | Source | Licence | -|---|---|---|---| -| `docs/images/effectcraft-hero.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft main window) | MIT OR Apache-2.0 | -| `docs/images/effectcraft-3d.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft Classic 3D) | MIT OR Apache-2.0 | -| `docs/images/effectcraft-graph-editor.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft Graph Editor) | MIT OR Apache-2.0 | -| `docs/images/effectcraft-effects.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft effects) | MIT OR Apache-2.0 | -| `docs/images/effectcraft-render-queue.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft Render Queue panel with the demo compositions queued for H.264 and ProRes export) | MIT OR Apache-2.0 | - -## Code-drawn assets (original work, MIT OR Apache-2.0) - -- UI icons drawn in code: `crates/ui-egui/src/icons.rs`, including the original filled favorite star (2026-10-11, EffectCraft contributors). -- Procedural demo content (solids, shapes, gradients, text animations): `crates/engine/src/demo.rs`. -- Built-in project templates (Lower Third, Title Card, Logo Reveal, Kinetic Type, Social Square, Vertical Story, - Slideshow, 3D Text Orbit) built from engine commands, and their thumbnails rendered by our own renderer: - `crates/engine/src/templates.rs`. -- Text animator presets (Typewriter, Fade Up Characters, Bounce In Words, Tracking In, Scramble, Blur In, Jitter, - Drop In Lines): `crates/engine/presets/text_animators.json` (sidecar `.attribution`). -- Transition animation presets (23: wipes, clock and fan reveals, blinds, dissolves, card flips, CC wipes, fades): - `crates/engine/presets/transitions.json` (sidecar `.attribution`). -- Backgrounds animation presets (23: drifting gradients, fog, cloud and smoke, plasma and magma, cells and crystals, scrolling grids - and checks, pulse rings, bokeh, light sweep): `crates/engine/presets/backgrounds.json` (sidecar `.attribution`). -- Behaviors animation presets (22: wiggle, shake, float, orbit, bounce, drift, pendulum, spin, pulse, heartbeat, blink, strobe, flicker): - `crates/engine/presets/behaviors.json` (sidecar `.attribution`). -- Sample scripts (File ▸ Scripts) and ScriptUI panel: `crates/engine/scripts/Rename Layers.jsx`, - `crates/engine/scripts/Sort Layers by In Point.jsx`, `crates/engine/scripts/Create Null at Selected Layers.jsx`, - `crates/engine/scripts/Render Queue Batch.jsx`, `crates/engine/scripts/ScriptUI Panels/Layer Tools.jsx` - (sidecars `.attribution`). -- Bundled extension (ScriptUI panel) with its twelve built-in ease presets: - `extensions/scriptui-panels/Ease Presets.jsx` (sidecar `.attribution`). -- Example effect plug-in: `examples/plugins/posterize-bands` (WebAssembly ABI 1). - -## Trained models (optional downloads, not bundled) - -The repository and the installers contain no model weights. These models are downloaded only when -a user asks (Settings ▸ Roto Brush, Settings ▸ Face Tracking, or the `roto.model.*` / -`face.model.*` commands), unmodified from their authors' official location, checked against a -pinned SHA-256 and stored in the user's `models` folder with a `.NOTICE.txt` naming their -authors, licence and source. EffectCraft runs them with its own Rust implementation and is not -affiliated with or endorsed by their authors. - -| Model | Authors | Source | Licence | -|---|---|---|---| -| MobileSAM (`mobile_sam.pt`) | Chaoning Zhang et al., building on Meta AI's Segment Anything and Microsoft's TinyViT | https://github.com/ChaoningZhang/MobileSAM | Apache-2.0 | -| MediaPipe Face Landmarker (`face_landmarker.task`: BlazeFace short-range detector, Face Mesh V2, blendshapes) | Google LLC | https://developers.google.com/edge/mediapipe/solutions/vision/face_landmarker (model cards: https://storage.googleapis.com/mediapipe-assets/MediaPipe%20BlazeFace%20Model%20Card%20(Short%20Range).pdf, https://storage.googleapis.com/mediapipe-assets/Model%20Card%20MediaPipe%20Face%20Mesh%20V2.pdf) | Apache-2.0 | - -## Formats and parameters from other open-source projects - -Written in Rust for EffectCraft; no code is copied. They follow published specifications and -configuration from these Apache-2.0 projects: - -- `crates/segment/src/tflite.rs` reads TensorFlow Lite files using the field layout of TensorFlow - Lite's `schema.fbs` (The TensorFlow Authors, https://github.com/tensorflow/tensorflow, - Apache-2.0). -- `crates/segment/src/mediapipe.rs` follows MediaPipe's published face landmarker graph: the SSD - anchor layout, detection decoding, crop sizes and the face-mesh point indices it uses (Google - LLC, https://github.com/google-ai-edge/mediapipe, Apache-2.0). -- `crates/segment/src/mobilesam.rs` follows the MobileSAM, TinyViT and Segment Anything - architectures and their Apache-2.0 reference code. - -## First-party brand marks - -The ArtCraft name, wordmark and logos are trademarks of the ArtCraft Team. They are not open source and are not -covered by the project licence; they may be used only unmodified and only as part of this repository and EffectCraft, -under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt). Forks and modified versions must remove them -(AGENTS.md §1.8). - -| File | Author | Source | Licence | -|---|---|---|---| -| `docs/brand/artcraft-logo-white.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark, light ink for dark backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-logo-white.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark, light ink for dark backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-logo.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark (symbol + "ARTCRAFT"), dark ink for light backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-logo.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark (symbol + "ARTCRAFT"), dark ink for light backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-mark-black.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), black) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-mark-black.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), black) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-mark.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), blue) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | -| `docs/brand/artcraft-mark.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), blue) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | - -- Appearance theme previews, drawn procedurally from original shapes: `crates/ui-egui/src/panels/settings.rs` (original work, MIT OR Apache-2.0). +# Attribution + +Every non-code asset in EffectCraft, with its author, source and licence. Each repository file listed here also has +a `.attribution` sidecar with full details. The rules are in [AGENTS.md](AGENTS.md) §1: no Adobe +iconography, images or other Adobe assets; open licences only; every asset attributed. +`cargo xtask assets` checks that this index and the sidecars cover every asset in the repository. +The complete licence texts and copyright notices for the bundled fonts, including the fonts embedded +by the pinned egui dependency, are reproduced in [`NOTICE`](NOTICE), which every package ships; the +`assets/fonts/OFL-*.txt` files are the upstream copies kept beside the fonts. + +## Bundled dependency fonts + +These fonts are embedded by the pinned egui dependency (epaint_default_fonts 0.37 at +`6d518fc799681571963842f95b55a6b68431b15a`); no font file is added to this repository. +egui-icons is always embedded, `default_fonts` adds Ubuntu Light and Hack, and +`monochrome_emoji_fonts` adds Noto Emoji and emoji-icon-font. The complete copyright notices +and licence texts are in [`NOTICE`](NOTICE). + +| Asset | Author | Source | Licence | +|---|---|---|---| +| `epaint_default_fonts/fonts/egui-icons.ttf` | John Slegers (emoji-icon-font) | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/egui-icons.txt; original https://github.com/jslegers/emoji-icon-font | MIT (complete copyright and permission text in `NOTICE`) | +| `epaint_default_fonts/fonts/emoji-icon-font.ttf` | John Slegers | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/emoji-icon-font-mit-license.txt; original https://github.com/jslegers/emoji-icon-font | MIT (complete copyright and permission text in `NOTICE`) | +| `epaint_default_fonts/fonts/NotoEmoji-Regular.ttf` | Google Inc. (The Noto Project Authors) | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/OFL.txt | OFL-1.1 (complete text in `NOTICE`) | +| `epaint_default_fonts/fonts/Ubuntu-Light.ttf` | Canonical Ltd. and Dalton Maag | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/UFL.txt | Ubuntu Font Licence 1.0 (complete text in `NOTICE`) | +| `epaint_default_fonts/fonts/Hack-Regular.ttf` | Source Foundry Authors; Bitstream Inc. | https://github.com/storytold/egui/blob/6d518fc799681571963842f95b55a6b68431b15a/crates/epaint_default_fonts/fonts/Hack-Regular.txt; original https://github.com/source-foundry/Hack | MIT AND Bitstream-Vera (complete texts in `NOTICE`) | + +## Asset files + +| Asset | Author | Source | Licence | +|---|---|---|---| +| `assets/fonts/Inter-Regular.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | +| `assets/fonts/Inter-Medium.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | +| `assets/fonts/Inter-SemiBold.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | +| `assets/fonts/Inter-Bold.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | +| `assets/fonts/Inter-Italic.ttf` | The Inter Project Authors | https://github.com/rsms/inter | OFL-1.1 (`assets/fonts/OFL-Inter.txt`) | +| `assets/fonts/NotoSerif-Regular.ttf` | The Noto Project Authors | https://github.com/notofonts/latin-greek-cyrillic | OFL-1.1 (`assets/fonts/OFL-NotoSerif.txt`) | +| `assets/fonts/NotoSansSymbols2-Regular.ttf` | The Noto Project Authors | https://github.com/notofonts/symbols | OFL-1.1 (`assets/fonts/OFL-NotoSansSymbols2.txt`) | +| `assets/fonts/JetBrainsMono-Regular.ttf` | The JetBrains Mono Project Authors | https://github.com/JetBrains/JetBrainsMono | OFL-1.1 (`assets/fonts/OFL-JetBrainsMono.txt`) | +| `apps/effectcraft-web/web/favicon.svg` | EffectCraft contributors | Original work: web app icon, a copy of `assets/app-icon/effectcraft-small.svg` (the unicorn app icon) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `packaging/macos/dmg/background.svg` | @XusBadia | Original work: macOS DMG Finder window background, derived from the EffectCraft app icon (`assets/app-icon/effectcraft.svg`); rendered to a TIFF by `packaging/macos/package.sh` at package time | MIT OR Apache-2.0 (`LICENSE-MIT`, `LICENSE-APACHE`) | +| `assets/app-icon/effectcraft-1024.png` | EffectCraft contributors | Original work: effectCraft app icon, 1024 px (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/effectcraft-macos-512.png` | EffectCraft contributors | Original work: effectCraft runtime Dock icon (macOS) (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/effectcraft-small.svg` | EffectCraft contributors | Original work: effectCraft app icon, light vector (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/effectcraft.icns` | EffectCraft contributors | Original work: effectCraft macOS app icon (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/effectcraft.ico` | EffectCraft contributors | Original work: effectCraft Windows app icon (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/effectcraft.svg` | EffectCraft contributors | Original work: effectCraft app icon, master vector (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/128x128/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 128x128 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/16x16/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 16x16 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/24x24/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 24x24 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/256x256/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 256x256 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/32x32/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 32x32 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/48x48/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 48x48 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/512x512/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 512x512 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/64x64/apps/ai.storyteller.effectcraft.png` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor 64x64 (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `assets/app-icon/hicolor/scalable/apps/ai.storyteller.effectcraft.svg` | EffectCraft contributors | Original work: effectCraft app icon, Linux hicolor scalable (owner's ArtCraft unicorn drawing, vectorised) | MIT OR Apache-2.0 (`assets/app-icon/LICENSE.txt`) | +| `crates/lottie/tests/fixtures/bouncing-ball.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (bouncing ball, eased position keys) | MIT OR Apache-2.0 | +| `crates/lottie/tests/fixtures/shapes-gradient.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (star, rectangle, gradient fill, dashed stroke, trim paths) | MIT OR Apache-2.0 | +| `crates/lottie/tests/fixtures/precomp-matte-text.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (precomp, track matte, parented text) | MIT OR Apache-2.0 | +| `crates/lottie/tests/fixtures/legacy-masks.json` | EffectCraft contributors | Original work: hand-written Lottie test fixture (legacy keyframes, masks) | MIT OR Apache-2.0 | +| `crates/svg/tests/fixtures/basic-shapes.svg` | EffectCraft contributors | Original work: hand-written SVG test fixture (basic shapes, groups, transforms) | MIT OR Apache-2.0 | +| `crates/svg/tests/fixtures/paths-gradients.svg` | EffectCraft contributors | Original work: hand-written SVG test fixture (path data, gradients, CSS, use) | MIT OR Apache-2.0 | +| `crates/model/tests/fixtures/quad.gltf` | EffectCraft contributors | Original work: glTF 2.0 test fixture (textured quad, node hierarchy, translation animation; data URIs) | MIT OR Apache-2.0 | +| `crates/model/tests/fixtures/quad.glb` | EffectCraft contributors | Original work: binary glTF test fixture (the same quad with its texture in the BIN chunk) | MIT OR Apache-2.0 | +| `crates/model/tests/fixtures/cube.obj` | EffectCraft contributors | Original work: Wavefront OBJ test fixture (unit cube, two materials) | MIT OR Apache-2.0 | +| `crates/model/tests/fixtures/cube.mtl` | EffectCraft contributors | Original work: MTL test fixture (materials of cube.obj) | MIT OR Apache-2.0 | + +Three small After Effects test projects of `crates/aep` are in this repository: `crates/aep/tests/fixtures/synthetic.aep` (original work, made with After Effects 2026 from own data, working space None, the embedded colour profile removed; MIT OR Apache-2.0, with its `.attribution` sidecar), `crates/aep/tests/fixtures/ai-mask-3099.aep` (original work, made with After Effects 2026 from four hand-written one-page PDFs named `.ai`, footage paths and host name neutralised, the embedded colour profiles replaced by stubs made with `crates/aep/examples/stubicc.rs`; MIT OR Apache-2.0, with its `.attribution` sidecar) and `crates/aep/tests/fixtures/text-synthetic.aep` (original work, made with After Effects 2026 by script from own data, working space None, no colour profile embedded, nothing changed after the save; MIT OR Apache-2.0, with its `.attribution` sidecar). The other After Effects test projects of `crates/aep` are not in this repository. They are original work of an EffectCraft contributor, generated with After Effects 2026 as own test data (MIT OR Apache-2.0, each file with its `.attribution` sidecar); they are in [storytold/effectcraft-corpus](https://github.com/storytold/effectcraft-corpus) with their sidecars, fetched by `cargo xtask aep-corpus` (commit-pinned, SHA-256-verified), and the tests read them only from the folder named by `EFFECTCRAFT_AEP_FIXTURES` (opt-in). Their embedded colour profiles are replaced by stubs made with `crates/aep/examples/stubicc.rs` (a header and a description, no colour data), so no vendor profile data is in them. + +## Screenshots + +Screenshots of EffectCraft itself, rendered headlessly, showing only procedurally generated demo content. + +| Asset | Author | Source | Licence | +|---|---|---|---| +| `docs/images/effectcraft-hero.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft main window) | MIT OR Apache-2.0 | +| `docs/images/effectcraft-3d.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft Classic 3D) | MIT OR Apache-2.0 | +| `docs/images/effectcraft-graph-editor.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft Graph Editor) | MIT OR Apache-2.0 | +| `docs/images/effectcraft-effects.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft effects) | MIT OR Apache-2.0 | +| `docs/images/effectcraft-render-queue.png` | EffectCraft contributors | Original work: screenshot of EffectCraft (EffectCraft Render Queue panel with the demo compositions queued for H.264 and ProRes export) | MIT OR Apache-2.0 | + +## Code-drawn assets (original work, MIT OR Apache-2.0) + +- UI icons drawn in code: `crates/ui-egui/src/icons.rs`, including the original filled favorite star (2026-10-11, EffectCraft contributors). +- Procedural demo content (solids, shapes, gradients, text animations): `crates/engine/src/demo.rs`. +- Built-in project templates (Lower Third, Title Card, Logo Reveal, Kinetic Type, Social Square, Vertical Story, + Slideshow, 3D Text Orbit) built from engine commands, and their thumbnails rendered by our own renderer: + `crates/engine/src/templates.rs`. +- Text animator presets (Typewriter, Fade Up Characters, Bounce In Words, Tracking In, Scramble, Blur In, Jitter, + Drop In Lines): `crates/engine/presets/text_animators.json` (sidecar `.attribution`). +- Transition animation presets (23: wipes, clock and fan reveals, blinds, dissolves, card flips, CC wipes, fades): + `crates/engine/presets/transitions.json` (sidecar `.attribution`). +- Backgrounds animation presets (23: drifting gradients, fog, cloud and smoke, plasma and magma, cells and crystals, scrolling grids + and checks, pulse rings, bokeh, light sweep): `crates/engine/presets/backgrounds.json` (sidecar `.attribution`). +- Behaviors animation presets (22: wiggle, shake, float, orbit, bounce, drift, pendulum, spin, pulse, heartbeat, blink, strobe, flicker): + `crates/engine/presets/behaviors.json` (sidecar `.attribution`). +- Sample scripts (File ▸ Scripts) and ScriptUI panel: `crates/engine/scripts/Rename Layers.jsx`, + `crates/engine/scripts/Sort Layers by In Point.jsx`, `crates/engine/scripts/Create Null at Selected Layers.jsx`, + `crates/engine/scripts/Render Queue Batch.jsx`, `crates/engine/scripts/ScriptUI Panels/Layer Tools.jsx` + (sidecars `.attribution`). +- Bundled extension (ScriptUI panel) with its twelve built-in ease presets: + `extensions/scriptui-panels/Ease Presets.jsx` (sidecar `.attribution`). +- Example effect plug-in: `examples/plugins/posterize-bands` (WebAssembly ABI 1). + +## Trained models (optional downloads, not bundled) + +The repository and the installers contain no model weights. These models are downloaded only when +a user asks (Settings ▸ Roto Brush, Settings ▸ Face Tracking, or the `roto.model.*` / +`face.model.*` commands), unmodified from their authors' official location, checked against a +pinned SHA-256 and stored in the user's `models` folder with a `.NOTICE.txt` naming their +authors, licence and source. EffectCraft runs them with its own Rust implementation and is not +affiliated with or endorsed by their authors. + +| Model | Authors | Source | Licence | +|---|---|---|---| +| MobileSAM (`mobile_sam.pt`) | Chaoning Zhang et al., building on Meta AI's Segment Anything and Microsoft's TinyViT | https://github.com/ChaoningZhang/MobileSAM | Apache-2.0 | +| MediaPipe Face Landmarker (`face_landmarker.task`: BlazeFace short-range detector, Face Mesh V2, blendshapes) | Google LLC | https://developers.google.com/edge/mediapipe/solutions/vision/face_landmarker (model cards: https://storage.googleapis.com/mediapipe-assets/MediaPipe%20BlazeFace%20Model%20Card%20(Short%20Range).pdf, https://storage.googleapis.com/mediapipe-assets/Model%20Card%20MediaPipe%20Face%20Mesh%20V2.pdf) | Apache-2.0 | + +## Formats and parameters from other open-source projects + +Written in Rust for EffectCraft; no code is copied. They follow published specifications and +configuration from these Apache-2.0 projects: + +- `crates/segment/src/tflite.rs` reads TensorFlow Lite files using the field layout of TensorFlow + Lite's `schema.fbs` (The TensorFlow Authors, https://github.com/tensorflow/tensorflow, + Apache-2.0). +- `crates/segment/src/mediapipe.rs` follows MediaPipe's published face landmarker graph: the SSD + anchor layout, detection decoding, crop sizes and the face-mesh point indices it uses (Google + LLC, https://github.com/google-ai-edge/mediapipe, Apache-2.0). +- `crates/segment/src/mobilesam.rs` follows the MobileSAM, TinyViT and Segment Anything + architectures and their Apache-2.0 reference code. + +## Frozen matte regression fixture + +| Asset | Author | Source | Licence | +|---|---|---|---| +| `crates/engine/src/tests/fixtures/analysed-0.24.ecproj` | arnav-hiwarkar | Original work, synthetic project keyed by EffectCraft 0.24.1 | MIT OR Apache-2.0 | +| `crates/engine/src/tests/fixtures/object-matte-0.22.ecproj` | lisn0 | Original work, synthetic project saved by EffectCraft 0.22.0 | MIT OR Apache-2.0 | +| `crates/engine/src/tests/fixtures/tracked-0.22.ecproj` | arnav-hiwarkar | Original work, synthetic project saved by EffectCraft 0.22.0 | MIT OR Apache-2.0 | + +## First-party brand marks + +The ArtCraft name, wordmark and logos are trademarks of the ArtCraft Team. They are not open source and are not +covered by the project licence; they may be used only unmodified and only as part of this repository and EffectCraft, +under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt). Forks and modified versions must remove them +(AGENTS.md §1.8). + +| File | Author | Source | Licence | +|---|---|---|---| +| `docs/brand/artcraft-logo-white.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark, light ink for dark backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-logo-white.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark, light ink for dark backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-logo.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark (symbol + "ARTCRAFT"), dark ink for light backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-logo.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft wordmark (symbol + "ARTCRAFT"), dark ink for light backgrounds) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-mark-black.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), black) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-mark-black.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), black) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-mark.png` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), blue) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | +| `docs/brand/artcraft-mark.svg` | ArtCraft Team | Original work: first-party ArtCraft brand mark (ArtCraft symbol ("A" mark), blue) | ArtCraft brand terms, not open source (`docs/brand/LICENSE-brand.txt`) | + +- Appearance theme previews, drawn procedurally from original shapes: `crates/ui-egui/src/panels/settings.rs` (original work, MIT OR Apache-2.0). diff --git a/CLAUDE.md b/CLAUDE.md index 43c994c2d..fd25442bf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1 +1 @@ -@AGENTS.md +@AGENTS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8ce4b85aa..8d0027664 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,109 +1,109 @@ -# Contributing to EffectCraft - -Thanks for helping. Please read [AGENTS.md](AGENTS.md) first: its rules on assets and clean-room -work apply to everyone, people and AI agents alike, and they are not negotiable. - -## Setup - -You need [Rust](https://rustup.rs/) 1.95 or newer. - -On Linux the desktop app plays preview sound through `cpal`, so the build needs a usable ALSA -pkg-config package: an `alsa.pc` that pkg-config can find, naming the linkable ALSA runtime -library (usually `libasound.so.2`). `alsa-sys` runs pkg-config at build time; it does not compile -ALSA's headers. Without a usable package the build fails at link time with an unrelated-looking -error; `cargo xtask ci` probes pkg-config up front and names the package: - -```sh -sudo dnf install alsa-lib-devel # Fedora -sudo apt install libasound2-dev # Debian / Ubuntu -sudo pacman -S alsa-lib # Arch -``` - -If you cannot install the package, point `PKG_CONFIG_PATH` at a directory holding an `alsa.pc` -whose `Libs` line names your system's `libasound` (usually `libasound.so.2`); every CI run needs -that variable set. - -```sh -cargo run -p effectcraft -- --demo # the desktop app, with the demo project -cargo test --workspace -cargo xtask ci # what every commit must pass (dev-profile checks and tests) -``` - -The default `dev` profile keeps debug info to line tables: builds are fast and panics/backtraces -still name the file and line, but a debugger cannot show local variables. For an interactive -debugger session use the `dev-full` profile, which is the same build with full debug info: - -```sh -cargo run --profile dev-full -p effectcraft -- --demo -``` - -### Windows - -The MSVC toolchain, rustup's default on Windows, is what the releases use: with the Visual Studio -C++ build tools installed, the commands above work as they are. - -The GNU toolchain (`x86_64-pc-windows-gnu`) needs a current mingw-w64 GCC and binutils first on -`PATH`. They provide the linker and the Windows import libraries, such as `libshlwapi.a` for -opening links from the app. With MSYS2: - -```powershell -C:\msys64\usr\bin\pacman.exe -S --needed mingw-w64-x86_64-gcc -$env:PATH = "C:\msys64\mingw64\bin;$env:PATH" -cargo +stable-x86_64-pc-windows-gnu run -p effectcraft -- --demo -``` - -An older MinGW earlier on `PATH` can break the build: CodeBlocks' GCC 8.1 fails to link -`boa_engine` ([#1882](https://github.com/storytold/effectcraft/issues/1882)). - -Rust's bundled LLD and self-contained libraries don't include every import library EffectCraft -needs, so on their own they stop with `unable to find library` for `-lshlwapi`, `-lktmw32`, -`-lpropsys` and `-lversion` ([#1886](https://github.com/storytold/effectcraft/issues/1886)). To -link that way, copy those four from mingw-w64 into a folder of its own and add that folder to the -search path in your own Cargo config (`%USERPROFILE%\.cargo\config.toml`). Don't add all of -mingw-w64's `lib` folder: its C runtime clashes with Rust's bundled one -(`undefined symbol: DllEntryPoint`). - -```powershell -New-Item -ItemType Directory -Force C:\gnu-import-libs -foreach ($lib in "shlwapi", "ktmw32", "propsys", "version") { - Copy-Item "C:\msys64\mingw64\lib\lib$lib.a" C:\gnu-import-libs\ -} -``` - -```toml -[target.x86_64-pc-windows-gnu] -linker = "rust-lld" -rustflags = ["-C", "link-self-contained=yes", "-L", "native=C:/gnu-import-libs"] -``` - -## Ground rules - -- **Clean room.** Work from After Effects' public documentation and its observable behaviour only. - Never use Adobe artwork, presets or code, and never copy GPL/LGPL/AGPL code. -- **Every asset is attributed.** Add a `.attribution` sidecar and an [ATTRIBUTION.md](ATTRIBUTION.md) - row; `cargo xtask assets` checks it. -- **Layering.** Nothing below the interface layer depends on UI or OS crates; see - [docs/architecture.md](docs/architecture.md). -- **Everything is a command.** New features are engine commands with an id, label, menu path, - shortcut and parameters, so the UI, the CLI and the MCP server get them at once. Interactive - widgets register an automation id. -- **Never crash.** Non-test code returns errors instead of panicking: no `unwrap()`, `expect()`, - `panic!`, `unreachable!`, `todo!`, `unimplemented!` or `unsafe`, checked indexing and arithmetic on - input-derived values, and a regression test with every crash fix. See the "Never crash" section of - [AGENTS.md](AGENTS.md). -- **Tests with every change**, and green `cargo xtask ci` before every commit. One task per commit. - -## How to add… - -- **An effect:** add an `EffectSpec` in `crates/effects` (AE display name, category, parameters - with AE's names, defaults and ranges) and its render function, with a determinism test and a - behaviour test. If it reads the clock directly, add it to `TIME_DEPENDENT`. -- **A command:** register it with `cmd!` in `crates/engine/src/commands/`, place it in the menu - tree in `crates/engine/src/menus.rs`, and test it including undo. -- **A panel or dialog:** `crates/ui-egui/src/panels/`; look at the result with the headless - snapshot tool described in [docs/testing.md](docs/testing.md). - -## Talk to us - -Questions, ideas and bug reports are welcome on [Discord](https://discord.gg/artcraft) and in -GitHub issues. +# Contributing to EffectCraft + +Thanks for helping. Please read [AGENTS.md](AGENTS.md) first: its rules on assets and clean-room +work apply to everyone, people and AI agents alike, and they are not negotiable. + +## Setup + +You need [Rust](https://rustup.rs/) 1.95 or newer. + +On Linux the desktop app plays preview sound through `cpal`, so the build needs a usable ALSA +pkg-config package: an `alsa.pc` that pkg-config can find, naming the linkable ALSA runtime +library (usually `libasound.so.2`). `alsa-sys` runs pkg-config at build time; it does not compile +ALSA's headers. Without a usable package the build fails at link time with an unrelated-looking +error; `cargo xtask ci` probes pkg-config up front and names the package: + +```sh +sudo dnf install alsa-lib-devel # Fedora +sudo apt install libasound2-dev # Debian / Ubuntu +sudo pacman -S alsa-lib # Arch +``` + +If you cannot install the package, point `PKG_CONFIG_PATH` at a directory holding an `alsa.pc` +whose `Libs` line names your system's `libasound` (usually `libasound.so.2`); every CI run needs +that variable set. + +```sh +cargo run -p effectcraft -- --demo # the desktop app, with the demo project +cargo test --workspace +cargo xtask ci # what every commit must pass (dev-profile checks and tests) +``` + +The default `dev` profile keeps debug info to line tables: builds are fast and panics/backtraces +still name the file and line, but a debugger cannot show local variables. For an interactive +debugger session use the `dev-full` profile, which is the same build with full debug info: + +```sh +cargo run --profile dev-full -p effectcraft -- --demo +``` + +### Windows + +The MSVC toolchain, rustup's default on Windows, is what the releases use: with the Visual Studio +C++ build tools installed, the commands above work as they are. + +The GNU toolchain (`x86_64-pc-windows-gnu`) needs a current mingw-w64 GCC and binutils first on +`PATH`. They provide the linker and the Windows import libraries, such as `libshlwapi.a` for +opening links from the app. With MSYS2: + +```powershell +C:\msys64\usr\bin\pacman.exe -S --needed mingw-w64-x86_64-gcc +$env:PATH = "C:\msys64\mingw64\bin;$env:PATH" +cargo +stable-x86_64-pc-windows-gnu run -p effectcraft -- --demo +``` + +An older MinGW earlier on `PATH` can break the build: CodeBlocks' GCC 8.1 fails to link +`boa_engine` ([#1882](https://github.com/storytold/effectcraft/issues/1882)). + +Rust's bundled LLD and self-contained libraries don't include every import library EffectCraft +needs, so on their own they stop with `unable to find library` for `-lshlwapi`, `-lktmw32`, +`-lpropsys` and `-lversion` ([#1886](https://github.com/storytold/effectcraft/issues/1886)). To +link that way, copy those four from mingw-w64 into a folder of its own and add that folder to the +search path in your own Cargo config (`%USERPROFILE%\.cargo\config.toml`). Don't add all of +mingw-w64's `lib` folder: its C runtime clashes with Rust's bundled one +(`undefined symbol: DllEntryPoint`). + +```powershell +New-Item -ItemType Directory -Force C:\gnu-import-libs +foreach ($lib in "shlwapi", "ktmw32", "propsys", "version") { + Copy-Item "C:\msys64\mingw64\lib\lib$lib.a" C:\gnu-import-libs\ +} +``` + +```toml +[target.x86_64-pc-windows-gnu] +linker = "rust-lld" +rustflags = ["-C", "link-self-contained=yes", "-L", "native=C:/gnu-import-libs"] +``` + +## Ground rules + +- **Clean room.** Work from After Effects' public documentation and its observable behaviour only. + Never use Adobe artwork, presets or code, and never copy GPL/LGPL/AGPL code. +- **Every asset is attributed.** Add a `.attribution` sidecar and an [ATTRIBUTION.md](ATTRIBUTION.md) + row; `cargo xtask assets` checks it. +- **Layering.** Nothing below the interface layer depends on UI or OS crates; see + [docs/architecture.md](docs/architecture.md). +- **Everything is a command.** New features are engine commands with an id, label, menu path, + shortcut and parameters, so the UI, the CLI and the MCP server get them at once. Interactive + widgets register an automation id. +- **Never crash.** Non-test code returns errors instead of panicking: no `unwrap()`, `expect()`, + `panic!`, `unreachable!`, `todo!`, `unimplemented!` or `unsafe`, checked indexing and arithmetic on + input-derived values, and a regression test with every crash fix. See the "Never crash" section of + [AGENTS.md](AGENTS.md). +- **Tests with every change**, and green `cargo xtask ci` before every commit. One task per commit. + +## How to add… + +- **An effect:** add an `EffectSpec` in `crates/effects` (AE display name, category, parameters + with AE's names, defaults and ranges) and its render function, with a determinism test and a + behaviour test. If it reads the clock directly, add it to `TIME_DEPENDENT`. +- **A command:** register it with `cmd!` in `crates/engine/src/commands/`, place it in the menu + tree in `crates/engine/src/menus.rs`, and test it including undo. +- **A panel or dialog:** `crates/ui-egui/src/panels/`; look at the result with the headless + snapshot tool described in [docs/testing.md](docs/testing.md). + +## Talk to us + +Questions, ideas and bug reports are welcome on [Discord](https://discord.gg/artcraft) and in +GitHub issues. diff --git a/Cargo.lock b/Cargo.lock index 37233ef58..a525e39c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,8163 +1,8262 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "accesskit" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932" -dependencies = [ - "uuid", -] - -[[package]] -name = "accesskit_atspi_common" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c182f9c282ac9c5638d876d551d15e5f7d397ec263349a0c6a2b61595dd5e4" -dependencies = [ - "accesskit", - "accesskit_consumer", - "atspi-common", - "phf", - "serde", - "zvariant", -] - -[[package]] -name = "accesskit_consumer" -version = "0.39.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a45e2bb300bea6d5f33a82c3e051c3ddc6f41c209750f68a0acbe991a284344" -dependencies = [ - "accesskit", - "hashbrown 0.17.1", -] - -[[package]] -name = "accesskit_ios" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28e539d64b27fd4c14de8f78ada8f7c944c092f52f7e49fb63316507a57f6937" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.17.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit 0.2.2", -] - -[[package]] -name = "accesskit_macos" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5701624bf6a11efb6d4c8e922bf44126ed96250e5faa9a7a0468c979635839a4" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.17.1", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "accesskit_unix" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202f24df034a7476d07b7f74284de84f6d62aabd858dbe7ee9cad3b7ad6f8f9d" -dependencies = [ - "accesskit", - "accesskit_atspi_common", - "async-channel", - "async-executor", - "async-task", - "atspi", - "futures-lite", - "futures-util", - "serde", - "zbus", -] - -[[package]] -name = "accesskit_windows" -version = "0.35.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce63f35d6bdcf59f26b76b3379063f738e6412cef46999cc772d46aa3de35adb" -dependencies = [ - "accesskit", - "accesskit_consumer", - "hashbrown 0.17.1", - "static_assertions", - "windows 0.62.2", - "windows-core 0.62.2", -] - -[[package]] -name = "accesskit_winit" -version = "0.34.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee96dd150375c05912d8a473f98c2fb155fb3234fac88292d396548a2460fa77" -dependencies = [ - "accesskit", - "accesskit_ios", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "raw-window-handle", - "winit", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "getrandom 0.3.4", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aligned-vec" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" -dependencies = [ - "equator", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "alsa" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43" -dependencies = [ - "alsa-sys", - "bitflags 2.13.2", - "cfg-if", - "libc", -] - -[[package]] -name = "alsa-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "android-activity" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" -dependencies = [ - "android-properties", - "bitflags 2.13.2", - "cc", - "jni 0.22.4", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-sys", - "num_enum", - "thiserror 2.0.21", -] - -[[package]] -name = "android-properties" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" - -[[package]] -name = "android_system_properties" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" -dependencies = [ - "libc", -] - -[[package]] -name = "arboard" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" -dependencies = [ - "clipboard-win", - "image", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "parking_lot", - "percent-encoding", - "windows-sys 0.59.0", - "wl-clipboard-rs", - "x11rb", -] - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" -dependencies = [ - "serde", -] - -[[package]] -name = "as-raw-xcb-connection" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" - -[[package]] -name = "ash" -version = "0.38.0+1.3.281" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" -dependencies = [ - "libloading", -] - -[[package]] -name = "async-broadcast" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" -dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix 1.1.5", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix 1.1.5", -] - -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "async-signal" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix 1.1.5", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "atspi" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" -dependencies = [ - "atspi-common", - "atspi-proxies", -] - -[[package]] -name = "atspi-common" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus", - "zbus-lockstep", - "zbus-lockstep-macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "atspi-proxies" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" -dependencies = [ - "atspi-common", - "serde", - "zbus", -] - -[[package]] -name = "autocfg" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" - -[[package]] -name = "base64" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" - -[[package]] -name = "bit-set" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" -dependencies = [ - "bit-vec 0.9.1", -] - -[[package]] -name = "bit-set" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" -dependencies = [ - "bit-vec 0.10.1", -] - -[[package]] -name = "bit-vec" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" - -[[package]] -name = "bit-vec" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5727b15fa97d4f4fee0a3b7c3d550ed0269f54329207b86388de918604e31269" -dependencies = [ - "borsh", - "serde", -] - -[[package]] -name = "bit_field" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" -dependencies = [ - "objc2 0.5.2", -] - -[[package]] -name = "block2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" -dependencies = [ - "objc2 0.6.5", -] - -[[package]] -name = "blocking" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "boa_ast" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9221b0a090572b4a118b46c5874c0781fe4bc9546b85f0a615b8bfb609ca4ed7" -dependencies = [ - "bitflags 2.13.2", - "boa_interner", - "boa_macros", - "boa_string", - "indexmap", - "num-bigint", - "rustc-hash 2.1.3", - "strum", -] - -[[package]] -name = "boa_engine" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6aaf7fdc4299df68adb67e1a5440a51d34630a1f5271b9698fd74bc97b60d9" -dependencies = [ - "aligned-vec", - "arrayvec", - "async-channel", - "bitflags 2.13.2", - "boa_ast", - "boa_gc", - "boa_interner", - "boa_macros", - "boa_parser", - "boa_string", - "bytemuck", - "cfg-if", - "cow-utils", - "dashmap", - "dynify", - "fast-float2", - "futures-concurrency", - "futures-lite", - "getrandom 0.4.3", - "hashbrown 0.17.1", - "icu_normalizer", - "indexmap", - "intrusive-collections", - "itertools", - "num-bigint", - "num-integer", - "num-traits", - "num_enum", - "oneshot", - "pastey", - "portable-atomic", - "rand 0.10.3", - "regress", - "rustc-hash 2.1.3", - "ryu-js", - "serde", - "serde_json", - "small_btree", - "static_assertions", - "tag_ptr", - "tap", - "thin-vec", - "thiserror 2.0.21", - "time", - "web-time", -] - -[[package]] -name = "boa_gc" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af82119558ab1002d1978c8459b53a3ebb506177d29a3aca37c07c1777b1d966" -dependencies = [ - "arrayvec", - "boa_macros", - "boa_string", - "hashbrown 0.17.1", - "thin-vec", -] - -[[package]] -name = "boa_interner" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317c631e791f5cb7d0017e43c0a758b0eaffd40c34c4c360e2a6be7752b78cd1" -dependencies = [ - "boa_gc", - "boa_macros", - "hashbrown 0.17.1", - "indexmap", - "once_cell", - "phf", - "rustc-hash 2.1.3", - "static_assertions", -] - -[[package]] -name = "boa_macros" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b882fd440dc0f4b7441367cf89567bb077920356750c9a76a16c002d8ec2fa5c" -dependencies = [ - "cfg-if", - "cow-utils", - "proc-macro2", - "quote", - "syn 3.0.6", - "synstructure", -] - -[[package]] -name = "boa_parser" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641e81b3c8cbb7a2140547fb3ea534e9edf210b4e8c920b5fa864a919e11fbcf" -dependencies = [ - "bitflags 2.13.2", - "boa_ast", - "boa_interner", - "boa_macros", - "fast-float2", - "icu_properties", - "num-bigint", - "num-traits", - "regress", - "rustc-hash 2.1.3", -] - -[[package]] -name = "boa_string" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bf86c2bcff5bf2547acbfc516c5d3108ca527cb131511d749bf6fbef762c0e" -dependencies = [ - "fast-float2", - "itoa", - "pastey", - "rustc-hash 2.1.3", - "ryu-js", - "static_assertions", -] - -[[package]] -name = "borsh" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" -dependencies = [ - "borsh-derive", - "bytes", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" -dependencies = [ - "once_cell", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "bumpalo" -version = "3.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" - -[[package]] -name = "bytemuck" -version = "1.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "byteorder-lite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" - -[[package]] -name = "bytes" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" - -[[package]] -name = "calloop" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" -dependencies = [ - "bitflags 2.13.2", - "log", - "polling", - "rustix 0.38.44", - "slab", - "thiserror 1.0.69", -] - -[[package]] -name = "calloop" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" -dependencies = [ - "bitflags 2.13.2", - "polling", - "rustix 1.1.5", - "slab", - "tracing", -] - -[[package]] -name = "calloop-wayland-source" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" -dependencies = [ - "calloop 0.13.0", - "rustix 0.38.44", - "wayland-backend", - "wayland-client", -] - -[[package]] -name = "calloop-wayland-source" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" -dependencies = [ - "calloop 0.14.4", - "rustix 1.1.5", - "wayland-backend", - "wayland-client", -] - -[[package]] -name = "candle-core" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091" -dependencies = [ - "byteorder", - "float8", - "gemm", - "half", - "libm", - "memmap2", - "num-traits", - "num_cpus", - "rand 0.9.5", - "rand_distr", - "rayon", - "safetensors", - "thiserror 2.0.21", - "yoke", - "zip 7.4.0", -] - -[[package]] -name = "candle-nn" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03" -dependencies = [ - "candle-core", - "half", - "libc", - "num-traits", - "rayon", - "safetensors", - "serde", - "thiserror 2.0.21", -] - -[[package]] -name = "cast" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" - -[[package]] -name = "cc" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cfg-if" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" - -[[package]] -name = "cfg_aliases" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" - -[[package]] -name = "cgl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" -dependencies = [ - "libc", -] - -[[package]] -name = "chacha20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" -dependencies = [ - "cfg-if", - "cpufeatures 0.3.1", - "rand_core 0.10.1", -] - -[[package]] -name = "chrono" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" -dependencies = [ - "num-traits", -] - -[[package]] -name = "clipboard-win" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" -dependencies = [ - "error-code", -] - -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "codespan-reporting" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" -dependencies = [ - "serde", - "termcolor", - "unicode-width", -] - -[[package]] -name = "color" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "combine" -version = "4.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "core-graphics" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "core-graphics-types", - "foreign-types", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "libc", -] - -[[package]] -name = "core_detect" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" - -[[package]] -name = "coreaudio-rs" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aae284fbaf7d27aa0e292f7677dfbe26503b0d555026f702940805a630eac17" -dependencies = [ - "bitflags 1.3.2", - "libc", - "objc2-audio-toolbox", - "objc2-core-audio", - "objc2-core-audio-types", - "objc2-core-foundation", -] - -[[package]] -name = "cow-utils" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" - -[[package]] -name = "cpal" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd307f43cc2a697e2d1f8bc7a1d824b5269e052209e28883e5bc04d095aaa3f" -dependencies = [ - "alsa", - "coreaudio-rs", - "dasp_sample", - "jni 0.21.1", - "js-sys", - "libc", - "mach2", - "ndk", - "ndk-context", - "num-derive", - "num-traits", - "objc2-audio-toolbox", - "objc2-core-audio", - "objc2-core-audio-types", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "windows 0.54.0", -] - -[[package]] -name = "cpu-time" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e393a7668fe1fad3075085b86c781883000b4ede868f43627b34a87c8b7ded" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" -dependencies = [ - "libc", -] - -[[package]] -name = "craft-docpath" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" - -[[package]] -name = "craft-ecproj-format" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ca1b5e2edb8568335c6c14f390307bd5beae8238#ca1b5e2edb8568335c6c14f390307bd5beae8238" -dependencies = [ - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "craft-fonts-build" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" - -[[package]] -name = "craft-i18n" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" -dependencies = [ - "fixed_decimal", - "icu_decimal", - "icu_locale_core", - "icu_locale_fallback", - "icu_normalizer", - "icu_plurals", - "icu_properties", - "icu_provider", - "icu_provider_adapters", - "icu_provider_blob", - "log", - "objc2-foundation 0.3.2", - "sys-locale", - "unicode-bidi", - "windows-registry", - "writeable", -] - -[[package]] -name = "craft-media" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4#f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "craft-pdf" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" -dependencies = [ - "hayro-syntax", - "thiserror 2.0.21", -] - -[[package]] -name = "craft-quit" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" -dependencies = [ - "dispatch2", - "egui", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", -] - -[[package]] -name = "craft-ui" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" -dependencies = [ - "craft-fonts-build", - "craft-i18n", - "egui", - "epaint", - "js-sys", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "serde", - "skrifa", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "craft-update" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1b34eba41e62138fc2438d2734523b302840b45d#1b34eba41e62138fc2438d2734523b302840b45d" -dependencies = [ - "chrono", - "dunce", - "egui", - "flate2", - "getrandom 0.3.4", - "image", - "log", - "plist", - "semver", - "serde", - "serde_json", - "sha2", - "tar", - "tempfile", - "ureq", - "verifysign", - "winreg", - "winsafe", - "zip 9.1.3", -] - -[[package]] -name = "crc32fast" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" - -[[package]] -name = "crunchy" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "cursor-icon" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" - -[[package]] -name = "dashmap" -version = "6.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c" -dependencies = [ - "cfg-if", - "crossbeam-utils", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - -[[package]] -name = "dasp_sample" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" - -[[package]] -name = "deranged" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dispatch2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "libc", - "objc2 0.6.5", -] - -[[package]] -name = "displaydoc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "dlib" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" -dependencies = [ - "libloading", -] - -[[package]] -name = "document-features" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" -dependencies = [ - "litrs", -] - -[[package]] -name = "downcast-rs" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" - -[[package]] -name = "dpi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "dyn-stack" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4713e43e2886ba72b8271aa66c93d722116acf7a75555cce11dcde84388fe8" -dependencies = [ - "bytemuck", - "dyn-stack-macros", -] - -[[package]] -name = "dyn-stack-macros" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d926b4d407d372f141f93bb444696142c29d32962ccbd3531117cf3aa0bfa9" - -[[package]] -name = "dynify" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81acb15628a3e22358bf73de5e7e62360b8a777dbcb5fc9ac7dfa9ae73723747" -dependencies = [ - "dynify-macros", -] - -[[package]] -name = "dynify-macros" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec431cd708430d5029356535259c5d645d60edd3d39c54e5eea9782d46caa7d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "ecolor" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "bytemuck", - "emath", -] - -[[package]] -name = "effectcraft" -version = "0.23.1" -dependencies = [ - "chrono", - "cpal", - "craft-update", - "effectcraft-engine", - "effectcraft-host", - "effectcraft-ui-egui", - "eframe", - "egui", - "fmv-macos-events", - "log", - "muda", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "pollster 1.0.1", - "rfd", - "serde", - "serde_json", - "sysinfo", - "winit", - "winresource", - "zbus", -] - -[[package]] -name = "effectcraft-aep" -version = "0.23.1" -dependencies = [ - "effectcraft-color", - "effectcraft-effects", - "effectcraft-keyframe", - "effectcraft-project", - "effectcraft-time", - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-automation" -version = "0.23.1" -dependencies = [ - "effectcraft-engine", - "effectcraft-host", - "effectcraft-model", - "effectcraft-script", - "image", - "serde_json", - "tempfile", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-av1enc" -version = "0.23.1" -dependencies = [ - "filmcraft-av1", -] - -[[package]] -name = "effectcraft-cli" -version = "0.23.1" -dependencies = [ - "cpu-time", - "effectcraft-automation", - "effectcraft-engine", - "effectcraft-gpu", - "effectcraft-host", - "effectcraft-render", - "effectcraft-sam2", - "effectcraft-segment", - "effectcraft-time", - "effectcraft-track", - "effectcraft-ui-egui", - "image", - "serde_json", -] - -[[package]] -name = "effectcraft-color" -version = "0.23.1" -dependencies = [ - "proptest", - "serde", -] - -[[package]] -name = "effectcraft-effects" -version = "0.23.1" -dependencies = [ - "chrono", - "effectcraft-color", - "effectcraft-geom", - "effectcraft-keyframe", - "effectcraft-project", - "effectcraft-raster", - "effectcraft-segment", - "effectcraft-track", - "log", - "rayon", - "serde", - "serde_json", -] - -[[package]] -name = "effectcraft-engine" -version = "0.23.1" -dependencies = [ - "chrono", - "craft-docpath", - "effectcraft-aep", - "effectcraft-color", - "effectcraft-effects", - "effectcraft-geom", - "effectcraft-interchange", - "effectcraft-keyframe", - "effectcraft-lottie", - "effectcraft-model", - "effectcraft-path", - "effectcraft-pdf", - "effectcraft-project", - "effectcraft-psd", - "effectcraft-raster", - "effectcraft-render", - "effectcraft-sam2", - "effectcraft-segment", - "effectcraft-svg", - "effectcraft-text", - "effectcraft-time", - "effectcraft-track", - "exr", - "image", - "kurbo", - "log", - "rayon", - "same-file", - "serde", - "serde_json", - "tempfile", - "thiserror 2.0.21", - "web-time", -] - -[[package]] -name = "effectcraft-export" -version = "0.23.1" -dependencies = [ - "effectcraft-av1enc", - "effectcraft-color", - "effectcraft-effects", - "effectcraft-hevcenc", - "effectcraft-keyframe", - "effectcraft-media", - "effectcraft-opusenc", - "effectcraft-project", - "effectcraft-raster", - "effectcraft-render", - "effectcraft-time", - "effectcraft-vp9enc", - "exr", - "filmcraft-aac", - "filmcraft-h264enc", - "filmcraft-isobmff", - "filmcraft-opus", - "filmcraft-prores", - "filmcraft-vp9", - "gif", - "image", - "log", - "rayon", - "thiserror 2.0.21", - "web-time", -] - -[[package]] -name = "effectcraft-expr" -version = "0.23.1" -dependencies = [ - "boa_engine", - "effectcraft-color", - "effectcraft-effects", - "effectcraft-geom", - "effectcraft-keyframe", - "effectcraft-path", - "effectcraft-project", - "effectcraft-render", - "effectcraft-text", - "effectcraft-time", - "serde_json", -] - -[[package]] -name = "effectcraft-geom" -version = "0.23.1" -dependencies = [ - "proptest", - "serde", -] - -[[package]] -name = "effectcraft-gpu" -version = "0.23.1" -dependencies = [ - "bytemuck", - "effectcraft-color", - "effectcraft-effects", - "effectcraft-geom", - "effectcraft-keyframe", - "effectcraft-project", - "effectcraft-raster", - "effectcraft-render", - "effectcraft-text", - "effectcraft-time", - "js-sys", - "log", - "pollster 1.0.1", - "rayon", - "wasm-bindgen", - "web-time", - "wgpu", -] - -[[package]] -name = "effectcraft-helper-host" -version = "0.23.1" -dependencies = [ - "bytemuck", - "effectcraft-effects", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "effectcraft-hevcenc" -version = "0.23.1" -dependencies = [ - "filmcraft-hevc", -] - -[[package]] -name = "effectcraft-host" -version = "0.23.1" -dependencies = [ - "effectcraft-engine", - "effectcraft-export", - "effectcraft-expr", - "effectcraft-helper-host", - "effectcraft-interchange", - "effectcraft-media", - "effectcraft-pdf", - "effectcraft-plugin", - "effectcraft-project", - "effectcraft-psd", - "effectcraft-raster", - "effectcraft-script", - "effectcraft-svg", - "effectcraft-time", - "exr", - "gif", - "image", - "log", - "rayon", - "serde_json", - "tempfile", -] - -[[package]] -name = "effectcraft-interchange" -version = "0.23.1" -dependencies = [ - "effectcraft-color", - "effectcraft-keyframe", - "effectcraft-project", - "effectcraft-time", - "filmcraft-color", - "filmcraft-geom", - "filmcraft-interchange", - "filmcraft-media", - "filmcraft-project", - "filmcraft-time", - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-keyframe" -version = "0.23.1" -dependencies = [ - "effectcraft-color", - "effectcraft-geom", - "effectcraft-time", - "proptest", - "serde", - "serde_json", -] - -[[package]] -name = "effectcraft-lottie" -version = "0.23.1" -dependencies = [ - "craft-docpath", - "effectcraft-color", - "effectcraft-effects", - "effectcraft-keyframe", - "effectcraft-path", - "effectcraft-project", - "effectcraft-render", - "effectcraft-text", - "effectcraft-time", - "kurbo", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-media" -version = "0.23.1" -dependencies = [ - "craft-docpath", - "effectcraft-color", - "effectcraft-effects", - "effectcraft-model", - "effectcraft-pdf", - "effectcraft-project", - "effectcraft-psd", - "effectcraft-raster", - "effectcraft-render", - "effectcraft-svg", - "effectcraft-time", - "exr", - "filmcraft-aac", - "filmcraft-codecs", - "filmcraft-color", - "filmcraft-frame", - "filmcraft-isobmff", - "filmcraft-matroska", - "filmcraft-media", - "filmcraft-mpegts", - "filmcraft-time", - "gif", - "image", - "log", - "rayon", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-model" -version = "0.23.1" -dependencies = [ - "effectcraft-geom", - "image", - "log", - "miniz_oxide 0.9.1", - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-opusenc" -version = "0.23.1" -dependencies = [ - "filmcraft-opus", -] - -[[package]] -name = "effectcraft-path" -version = "0.23.1" -dependencies = [ - "effectcraft-geom", - "effectcraft-keyframe", - "effectcraft-raster", - "kurbo", - "linesweeper", - "tiny-skia 0.12.0", -] - -[[package]] -name = "effectcraft-pdf" -version = "0.23.1" -dependencies = [ - "craft-pdf", - "effectcraft-raster", - "effectcraft-svg", - "effectcraft-text", - "image", - "kurbo", - "miniz_oxide 0.9.1", - "skrifa", - "wasm-bindgen-test", - "zune-jpeg", -] - -[[package]] -name = "effectcraft-plugin" -version = "0.23.1" -dependencies = [ - "effectcraft-effects", - "effectcraft-keyframe", - "effectcraft-project", - "effectcraft-raster", - "serde_json", - "wasmi", -] - -[[package]] -name = "effectcraft-project" -version = "0.23.1" -dependencies = [ - "craft-ecproj-format", - "effectcraft-color", - "effectcraft-geom", - "effectcraft-keyframe", - "effectcraft-time", - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "effectcraft-psd" -version = "0.23.1" -dependencies = [ - "miniz_oxide 0.9.1", -] - -[[package]] -name = "effectcraft-raster" -version = "0.23.1" -dependencies = [ - "effectcraft-color", - "effectcraft-geom", - "rayon", - "tempfile", -] - -[[package]] -name = "effectcraft-render" -version = "0.23.1" -dependencies = [ - "effectcraft-color", - "effectcraft-effects", - "effectcraft-geom", - "effectcraft-keyframe", - "effectcraft-model", - "effectcraft-path", - "effectcraft-project", - "effectcraft-raster", - "effectcraft-text", - "effectcraft-time", - "kurbo", - "log", - "lz4_flex", - "rayon", - "serde", - "tempfile", - "web-time", -] - -[[package]] -name = "effectcraft-sam2" -version = "0.23.1" -dependencies = [ - "bytemuck", - "candle-core", - "candle-nn", - "effectcraft-segment", - "half", - "log", - "pollster 1.0.1", - "rayon", - "wgpu", -] - -[[package]] -name = "effectcraft-script" -version = "0.23.1" -dependencies = [ - "boa_engine", - "effectcraft-engine", - "effectcraft-expr", - "effectcraft-keyframe", - "effectcraft-path", - "effectcraft-project", - "effectcraft-psd", - "effectcraft-render", - "effectcraft-time", - "serde_json", - "socket2", - "web-time", -] - -[[package]] -name = "effectcraft-segment" -version = "0.23.1" -dependencies = [ - "miniz_oxide 0.9.1", - "ndarray", - "rayon", -] - -[[package]] -name = "effectcraft-svg" -version = "0.23.1" -dependencies = [ - "effectcraft-geom", - "effectcraft-path", - "effectcraft-raster", - "kurbo", - "rayon", - "roxmltree", -] - -[[package]] -name = "effectcraft-text" -version = "0.23.1" -dependencies = [ - "effectcraft-keyframe", - "harfrust", - "kurbo", - "skrifa", - "unicode-bidi", - "unicode-linebreak", -] - -[[package]] -name = "effectcraft-time" -version = "0.23.1" -dependencies = [ - "proptest", - "serde", -] - -[[package]] -name = "effectcraft-track" -version = "0.23.1" -dependencies = [ - "effectcraft-raster", - "effectcraft-segment", - "rayon", - "serde", - "serde_json", - "web-time", -] - -[[package]] -name = "effectcraft-ui-egui" -version = "0.23.1" -dependencies = [ - "bytemuck", - "chrono", - "craft-quit", - "craft-ui", - "craft-update", - "effectcraft-color", - "effectcraft-engine", - "effectcraft-geom", - "effectcraft-gpu", - "effectcraft-host", - "effectcraft-keyframe", - "effectcraft-media", - "effectcraft-path", - "effectcraft-project", - "effectcraft-render", - "effectcraft-segment", - "effectcraft-text", - "effectcraft-time", - "eframe", - "egui", - "egui_extras", - "egui_kittest", - "exr", - "half", - "image", - "kurbo", - "log", - "pollster 1.0.1", - "rayon", - "serde", - "serde_json", - "sys-locale", - "tempfile", - "toml", - "web-time", -] - -[[package]] -name = "effectcraft-vp9enc" -version = "0.23.1" - -[[package]] -name = "effectcraft-web" -version = "0.23.1" -dependencies = [ - "effectcraft-engine", - "effectcraft-export", - "effectcraft-expr", - "effectcraft-gpu", - "effectcraft-host", - "effectcraft-media", - "effectcraft-ui-egui", - "eframe", - "egui", - "js-sys", - "log", - "serde", - "serde_json", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "web-time", -] - -[[package]] -name = "eframe" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "ahash", - "bytemuck", - "document-features", - "egui", - "egui-wgpu", - "egui-winit", - "egui_glow", - "glutin", - "glutin-winit", - "image", - "js-sys", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "parking_lot", - "percent-encoding", - "pollster 1.0.1", - "profiling", - "raw-window-handle", - "send_wrapper", - "static_assertions", - "wasm-bindgen", - "web-sys", - "web-time", - "wgpu", - "windows-sys 0.61.2", - "winit", -] - -[[package]] -name = "egui" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "accesskit", - "ahash", - "bitflags 2.13.2", - "emath", - "epaint", - "itertools", - "log", - "nohash-hasher", - "profiling", - "smallvec", - "unicode-segmentation", - "web-sys", -] - -[[package]] -name = "egui-wgpu" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "ahash", - "bytemuck", - "document-features", - "egui", - "epaint", - "log", - "profiling", - "thiserror 2.0.21", - "type-map", - "web-time", - "wgpu", - "winit", -] - -[[package]] -name = "egui-winit" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "accesskit_winit", - "arboard", - "block2 0.6.2", - "bytemuck", - "egui", - "image", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "objc2-ui-kit 0.3.2", - "parking_lot", - "profiling", - "raw-window-handle", - "smithay-clipboard", - "web-time", - "webbrowser", - "windows-sys 0.61.2", - "winit", -] - -[[package]] -name = "egui_extras" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "ahash", - "egui", - "enum-map", - "itertools", - "log", - "profiling", -] - -[[package]] -name = "egui_glow" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "bytemuck", - "egui", - "glow", - "log", - "profiling", - "winit", -] - -[[package]] -name = "egui_kittest" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "eframe", - "egui", - "egui-wgpu", - "image", - "kittest", - "log", - "pollster 1.0.1", - "serde", - "toml", - "wgpu", -] - -[[package]] -name = "either" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" - -[[package]] -name = "emath" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "encoding_rs" -version = "0.8.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" -dependencies = [ - "cfg-if", - "core_detect", - "multiversion_no_op", - "rustversion", - "scopeguard", - "simdutf8", -] - -[[package]] -name = "endi" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" - -[[package]] -name = "enum-as-inner" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "enum-map" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4532960034c15ba2f55e9eee631040ecc473c32e6c4b200828c759840f13a06" -dependencies = [ - "enum-map-derive", -] - -[[package]] -name = "enum-map-derive" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7127272f64b3e098f7d81f350d672081b879bff896d219c42370dc858b1af9ff" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "enumflags2" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" -dependencies = [ - "enumflags2_derive", - "serde", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "epaint" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" -dependencies = [ - "ahash", - "bytemuck", - "ecolor", - "emath", - "epaint_default_fonts", - "font-types", - "harfrust", - "log", - "nohash-hasher", - "parking_lot", - "profiling", - "self_cell", - "skrifa", - "smallvec", - "unicode-bidi", - "unicode-general-category", - "unicode-properties", - "unicode-segmentation", - "vello_cpu", -] - -[[package]] -name = "epaint_default_fonts" -version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" - -[[package]] -name = "equator" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" -dependencies = [ - "equator-macro", -] - -[[package]] -name = "equator-macro" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "error-code" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" - -[[package]] -name = "euclid" -version = "0.22.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" -dependencies = [ - "num-traits", -] - -[[package]] -name = "event-listener" -version = "5.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" -dependencies = [ - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - -[[package]] -name = "exr" -version = "1.74.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3" -dependencies = [ - "bit_field", - "half", - "lebe", - "miniz_oxide 0.8.9", - "num-complex", - "pulp", - "rayon-core", - "smallvec", - "zune-inflate", -] - -[[package]] -name = "extended" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" - -[[package]] -name = "fast-float2" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e8948ce679d00a02a94739ea185595dca7118ed04feb991127e443bd3d761f" - -[[package]] -name = "fastrand" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" - -[[package]] -name = "fax" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" - -[[package]] -name = "fdeflate" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "fearless_simd" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" - -[[package]] -name = "filetime" -version = "0.2.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" -dependencies = [ - "cfg-if", - "libc", -] - -[[package]] -name = "filmcraft-aac" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-ac3" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-apv" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-av1" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-avi" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - -[[package]] -name = "filmcraft-bitstream" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "craft-media", -] - -[[package]] -name = "filmcraft-cfb" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - -[[package]] -name = "filmcraft-codecs" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-aac", - "filmcraft-ac3", - "filmcraft-apv", - "filmcraft-av1", - "filmcraft-avi", - "filmcraft-bitstream", - "filmcraft-color", - "filmcraft-dnx", - "filmcraft-frame", - "filmcraft-h264", - "filmcraft-hevc", - "filmcraft-isobmff", - "filmcraft-matroska", - "filmcraft-media", - "filmcraft-mpa", - "filmcraft-mpeg2v", - "filmcraft-mpegts", - "filmcraft-mxf", - "filmcraft-ogg", - "filmcraft-opus", - "filmcraft-prores", - "filmcraft-time", - "filmcraft-vp8", - "filmcraft-vp9", - "image", - "log", - "rayon", - "symphonia", - "thiserror 2.0.21", - "web-time", -] - -[[package]] -name = "filmcraft-color" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "serde", -] - -[[package]] -name = "filmcraft-dng" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-dnx" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-frame" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-color", - "filmcraft-time", - "rayon", - "serde", -] - -[[package]] -name = "filmcraft-geom" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "serde", -] - -[[package]] -name = "filmcraft-h264" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-h264enc" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-hevc" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-interchange" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-cfb", - "filmcraft-color", - "filmcraft-geom", - "filmcraft-media", - "filmcraft-project", - "filmcraft-time", - "roxmltree", - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-isobmff" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "craft-media", -] - -[[package]] -name = "filmcraft-matroska" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "craft-media", -] - -[[package]] -name = "filmcraft-media" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-color", - "filmcraft-dng", - "filmcraft-frame", - "filmcraft-time", - "image", - "rayon", - "serde", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mpa" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mpeg2v" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mpegts" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-mxf" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "chrono", -] - -[[package]] -name = "filmcraft-ogg" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - -[[package]] -name = "filmcraft-opus" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" - -[[package]] -name = "filmcraft-project" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-color", - "filmcraft-geom", - "filmcraft-media", - "filmcraft-time", - "serde", - "serde_json", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-prores" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-time" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "serde", -] - -[[package]] -name = "filmcraft-vp8" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "thiserror 2.0.21", -] - -[[package]] -name = "filmcraft-vp9" -version = "0.12.0" -source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" -dependencies = [ - "filmcraft-bitstream", - "rayon", - "thiserror 2.0.21", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" - -[[package]] -name = "fixed_decimal" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2214fb00f669ee96bee5bb29dfb1ddabe058b2bc426817efc79afa03c9bc55ae" -dependencies = [ - "displaydoc", - "smallvec", - "writeable", -] - -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - -[[package]] -name = "flate2" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" -dependencies = [ - "crc32fast", - "miniz_oxide 0.9.1", - "zlib-rs", -] - -[[package]] -name = "float8" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719a903cc23e4a89e87962c2a80fdb45cdaad0983a89bd150bb57b4c8571a7d5" -dependencies = [ - "half", - "num-traits", - "rand 0.9.5", - "rand_distr", -] - -[[package]] -name = "fmv-macos-events" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90642cf66dde7f205dc8b42dfe57b47d0f3a29f571b832742883ef512e23fe55" -dependencies = [ - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "font-types" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8eb065f3251655b3c90e22e5e363f310fc5332fb3402e37bbc94752283248f6" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-concurrency" -version = "7.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175cd8cca9e1d45b87f18ffa75088f2099e3c4fe5e2f83e42de112560bea8ea6" -dependencies = [ - "fixedbitset", - "futures-core", - "futures-lite", - "pin-project", - "smallvec", -] - -[[package]] -name = "futures-core" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" - -[[package]] -name = "futures-io" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" - -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - -[[package]] -name = "futures-macro" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "futures-task" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" - -[[package]] -name = "futures-util" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" -dependencies = [ - "futures-core", - "futures-macro", - "futures-task", - "pin-project-lite", - "slab", -] - -[[package]] -name = "gemm" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb" -dependencies = [ - "dyn-stack", - "gemm-c32", - "gemm-c64", - "gemm-common", - "gemm-f16", - "gemm-f32", - "gemm-f64", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-c32" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c" -dependencies = [ - "dyn-stack", - "gemm-common", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-c64" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f" -dependencies = [ - "dyn-stack", - "gemm-common", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-common" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88027625910cc9b1085aaaa1c4bc46bb3a36aad323452b33c25b5e4e7c8e2a3e" -dependencies = [ - "bytemuck", - "dyn-stack", - "half", - "libm", - "num-complex", - "num-traits", - "once_cell", - "paste", - "pulp", - "raw-cpuid", - "rayon", - "seq-macro", - "sysctl", -] - -[[package]] -name = "gemm-f16" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e" -dependencies = [ - "dyn-stack", - "gemm-common", - "gemm-f32", - "half", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "rayon", - "seq-macro", -] - -[[package]] -name = "gemm-f32" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c" -dependencies = [ - "dyn-stack", - "gemm-common", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "gemm-f64" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a" -dependencies = [ - "dyn-stack", - "gemm-common", - "num-complex", - "num-traits", - "paste", - "raw-cpuid", - "seq-macro", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "gethostname" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" -dependencies = [ - "rustix 1.1.5", - "windows-link 0.2.1", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - -[[package]] -name = "getrandom" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "r-efi 6.0.0", - "rand_core 0.10.1", - "wasm-bindgen", -] - -[[package]] -name = "gif" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" -dependencies = [ - "color_quant", - "weezl", -] - -[[package]] -name = "gl_generator" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" -dependencies = [ - "khronos_api", - "log", - "xml-rs", -] - -[[package]] -name = "glifo" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be" -dependencies = [ - "bytemuck", - "foldhash 0.2.0", - "hashbrown 0.17.1", - "log", - "peniko", - "skrifa", - "smallvec", - "vello_common", -] - -[[package]] -name = "glow" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "glutin" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" -dependencies = [ - "bitflags 2.13.2", - "cfg_aliases", - "cgl", - "dispatch2", - "glutin_egl_sys", - "glutin_glx_sys", - "glutin_wgl_sys", - "libloading", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "once_cell", - "raw-window-handle", - "wayland-sys", - "windows-sys 0.52.0", - "x11-dl", -] - -[[package]] -name = "glutin-winit" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" -dependencies = [ - "cfg_aliases", - "glutin", - "raw-window-handle", - "winit", -] - -[[package]] -name = "glutin_egl_sys" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" -dependencies = [ - "gl_generator", - "windows-sys 0.52.0", -] - -[[package]] -name = "glutin_glx_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" -dependencies = [ - "gl_generator", - "x11-dl", -] - -[[package]] -name = "glutin_wgl_sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" -dependencies = [ - "gl_generator", -] - -[[package]] -name = "gpu-allocator" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" -dependencies = [ - "ash", - "hashbrown 0.16.1", - "log", - "presser", - "thiserror 2.0.21", - "windows 0.62.2", -] - -[[package]] -name = "guillotiere" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" -dependencies = [ - "euclid", -] - -[[package]] -name = "half" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" -dependencies = [ - "bytemuck", - "cfg-if", - "crunchy", - "num-traits", - "rand 0.9.5", - "rand_distr", - "zerocopy", -] - -[[package]] -name = "harfrust" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "read-fonts", - "smallvec", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash 0.1.5", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.2.0", - "serde", - "serde_core", -] - -[[package]] -name = "hashbrown" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash 0.2.0", -] - -[[package]] -name = "hayro-ccitt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" - -[[package]] -name = "hayro-jbig2" -version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" -dependencies = [ - "hayro-ccitt", -] - -[[package]] -name = "hayro-jpeg2000" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" - -[[package]] -name = "hayro-syntax" -version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545#e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" -dependencies = [ - "hayro-jbig2", - "hayro-jpeg2000", - "rustc-hash 2.1.3", - "smallvec", - "stringprep", - "zune-jpeg", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "http" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "icu_collections" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_decimal" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eb8f655bba2d0c0459e43a5b0e6cd3cd388109898fb3d85d048165e8b0abd08" -dependencies = [ - "displaydoc", - "fixed_decimal", - "icu_locale_core", - "icu_pattern", - "icu_plurals", - "icu_provider", - "serde", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" -dependencies = [ - "displaydoc", - "litemap", - "serde", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locale_fallback" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9" -dependencies = [ - "icu_locale_core", - "icu_locale_fallback_data", - "icu_provider", - "potential_utf", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locale_fallback_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8" - -[[package]] -name = "icu_normalizer" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" - -[[package]] -name = "icu_pattern" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3db611446bd92c246b03e4aa0bafa71ddb194af431ddbb42b9d70e4bfce1a0" -dependencies = [ - "displaydoc", - "either", - "serde", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_plurals" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e475e6766ef87b1d3c1f97be6363995b0bfaeddbc789671615df598a97ff0593" -dependencies = [ - "displaydoc", - "fixed_decimal", - "icu_provider", - "serde", - "zerovec", -] - -[[package]] -name = "icu_properties" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" - -[[package]] -name = "icu_provider" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" -dependencies = [ - "displaydoc", - "icu_locale_core", - "postcard", - "serde", - "stable_deref_trait", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_provider_adapters" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df887bc4f55dbc773c7c45a0c7dfa75be886f7b7812830a71ab7271cc1801820" -dependencies = [ - "icu_locale_fallback", - "icu_provider", -] - -[[package]] -name = "icu_provider_blob" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5916b44fac319d3f58e4d8d805a627df19e27937b582cd99fcde3bb6b7ce1b0e" -dependencies = [ - "icu_provider", - "postcard", - "serde", - "writeable", - "zerotrie", - "zerovec", -] - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "image" -version = "0.25.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" -dependencies = [ - "bytemuck", - "byteorder-lite", - "color_quant", - "exr", - "gif", - "image-webp", - "moxcms", - "num-traits", - "png", - "tiff", - "zune-core", - "zune-jpeg", -] - -[[package]] -name = "image-webp" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" -dependencies = [ - "byteorder-lite", - "quick-error 2.0.1", -] - -[[package]] -name = "indexmap" -version = "2.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" -dependencies = [ - "equivalent", - "hashbrown 0.17.1", -] - -[[package]] -name = "intrusive-collections" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4275b20e6057cd7733fd8df8a5a31701e4fe44497dad0f3fa0e1c4fb971506be" - -[[package]] -name = "itertools" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys 0.3.1", - "log", - "thiserror 1.0.69", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" -dependencies = [ - "cfg-if", - "combine", - "jni-macros", - "jni-sys 0.4.1", - "log", - "simd_cesu8", - "thiserror 2.0.21", - "walkdir", - "windows-link 0.2.1", -] - -[[package]] -name = "jni-macros" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "simd_cesu8", - "syn 2.0.119", -] - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "jobserver" -version = "0.1.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" -dependencies = [ - "getrandom 0.4.3", - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" -dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", -] - -[[package]] -name = "keyboard-types" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" -dependencies = [ - "bitflags 2.13.2", - "serde", -] - -[[package]] -name = "khronos-egl" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" -dependencies = [ - "libc", - "libloading", - "pkg-config", -] - -[[package]] -name = "khronos_api" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" - -[[package]] -name = "kittest" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb81a721ba76aa095b7f45deb180504f786904e56ca4b8e141f66eb89a78b75" -dependencies = [ - "accesskit", - "accesskit_consumer", -] - -[[package]] -name = "kurbo" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" -dependencies = [ - "arrayvec", - "euclid", - "polycool", - "serde", - "smallvec", -] - -[[package]] -name = "lazy_static" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] -name = "lebe" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" - -[[package]] -name = "libc" -version = "0.2.189" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" - -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link 0.2.1", -] - -[[package]] -name = "libm" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" - -[[package]] -name = "libredox" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" -dependencies = [ - "bitflags 2.13.2", - "libc", - "plain", - "redox_syscall 0.9.4", -] - -[[package]] -name = "linebender_resource_handle" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" - -[[package]] -name = "linesweeper" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25df1b0c5432893f41bba817150e323703ee5f6d974f3a6808ac7fd7f046d18" -dependencies = [ - "arrayvec", - "kurbo", - "polycool", - "rustc-hash 2.1.3", - "smallvec", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" -dependencies = [ - "serde_core", -] - -[[package]] -name = "litrs" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" - -[[package]] -name = "lz4_flex" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecbdfe44b1bd960b68170b417450a628c43f7cf56bb3c5317e61cb230ee7f226" - -[[package]] -name = "mach2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" -dependencies = [ - "libc", -] - -[[package]] -name = "matrixmultiply" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7" -dependencies = [ - "autocfg", - "rawpointer", -] - -[[package]] -name = "memchr" -version = "2.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" - -[[package]] -name = "memmap2" -version = "0.9.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" -dependencies = [ - "libc", - "stable_deref_trait", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "minicov" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d" -dependencies = [ - "cc", - "walkdir", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "moxcms" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" -dependencies = [ - "num-traits", - "pxfm", -] - -[[package]] -name = "muda" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4340e89c178916e62879c5c36b7f699019369be413e496178a6983ce91b8bc03" -dependencies = [ - "crossbeam-channel", - "dpi", - "keyboard-types", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "png", - "thiserror 2.0.21", - "windows-sys 0.61.2", -] - -[[package]] -name = "multiversion_no_op" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" - -[[package]] -name = "naga" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" -dependencies = [ - "arrayvec", - "bit-set 0.10.0", - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "codespan-reporting", - "half", - "hashbrown 0.17.1", - "indexmap", - "libm", - "log", - "naga-types", - "num-traits", - "once_cell", - "rustc-hash 1.1.0", - "spirv", - "thiserror 2.0.21", - "unicode-ident", -] - -[[package]] -name = "naga-types" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" -dependencies = [ - "hashbrown 0.17.1", - "indexmap", - "rustc-hash 1.1.0", - "thiserror 2.0.21", -] - -[[package]] -name = "ndarray" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d" -dependencies = [ - "matrixmultiply", - "num-complex", - "num-integer", - "num-traits", - "portable-atomic", - "portable-atomic-util", - "rawpointer", -] - -[[package]] -name = "ndk" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" -dependencies = [ - "bitflags 2.13.2", - "jni-sys 0.3.1", - "log", - "ndk-sys", - "num_enum", - "raw-window-handle", - "thiserror 1.0.69", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-sys" -version = "0.6.0+11769913" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" -dependencies = [ - "jni-sys 0.3.1", -] - -[[package]] -name = "nix" -version = "0.31.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" -dependencies = [ - "bitflags 2.13.2", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nom" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" -dependencies = [ - "memchr", -] - -[[package]] -name = "ntapi" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" -dependencies = [ - "winapi", -] - -[[package]] -name = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "num-bigint" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" -dependencies = [ - "num-integer", - "num-traits", - "serde", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "bytemuck", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" - -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "num-integer" -version = "0.1.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" -dependencies = [ - "num_enum_derive", - "rustversion", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "num_threads" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" -dependencies = [ - "libc", -] - -[[package]] -name = "objc-sys" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" - -[[package]] -name = "objc2" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" -dependencies = [ - "objc-sys", - "objc2-encode", -] - -[[package]] -name = "objc2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" -dependencies = [ - "objc2-encode", -] - -[[package]] -name = "objc2-app-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "libc", - "objc2 0.5.2", - "objc2-core-data", - "objc2-core-image", - "objc2-foundation 0.2.2", - "objc2-quartz-core 0.2.2", -] - -[[package]] -name = "objc2-app-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-audio-toolbox" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08" -dependencies = [ - "bitflags 2.13.2", - "libc", - "objc2 0.6.5", - "objc2-core-audio", - "objc2-core-audio-types", - "objc2-core-foundation", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-contacts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-audio" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" -dependencies = [ - "dispatch2", - "objc2 0.6.5", - "objc2-core-audio-types", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-core-audio-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", -] - -[[package]] -name = "objc2-core-data" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-core-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" -dependencies = [ - "bitflags 2.13.2", - "dispatch2", - "objc2 0.6.5", -] - -[[package]] -name = "objc2-core-graphics" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" -dependencies = [ - "bitflags 2.13.2", - "dispatch2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-io-surface", -] - -[[package]] -name = "objc2-core-image" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", -] - -[[package]] -name = "objc2-core-location" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-contacts", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-foundation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "dispatch", - "libc", - "objc2 0.5.2", -] - -[[package]] -name = "objc2-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" -dependencies = [ - "libc", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-surface" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-link-presentation" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-metal" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-metal" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" -dependencies = [ - "bitflags 2.13.2", - "block2 0.6.2", - "objc2 0.6.5", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", - "objc2-metal 0.2.2", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", -] - -[[package]] -name = "objc2-symbols" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" -dependencies = [ - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-image", - "objc2-core-location", - "objc2-foundation 0.2.2", - "objc2-link-presentation", - "objc2-quartz-core 0.2.2", - "objc2-symbols", - "objc2-uniform-type-identifiers", - "objc2-user-notifications", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" -dependencies = [ - "bitflags 2.13.2", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", -] - -[[package]] -name = "objc2-uniform-type-identifiers" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" -dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" -dependencies = [ - "bitflags 2.13.2", - "block2 0.5.1", - "objc2 0.5.2", - "objc2-core-location", - "objc2-foundation 0.2.2", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "oneshot" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe21416a02c693fb9f980befcb230ecc70b0b3d1cc4abf88b9675c4c1457f0c" - -[[package]] -name = "oorandom" -version = "11.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" - -[[package]] -name = "openssl-probe" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" - -[[package]] -name = "orbclient" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" -dependencies = [ - "libc", - "libredox", -] - -[[package]] -name = "ordered-float" -version = "5.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" -dependencies = [ - "num-traits", -] - -[[package]] -name = "ordered-stream" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "os_pipe" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.5.18", - "smallvec", - "windows-link 0.2.1", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pastey" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" - -[[package]] -name = "peniko" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" -dependencies = [ - "bytemuck", - "color", - "kurbo", - "linebender_resource_handle", - "smallvec", -] - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap", -] - -[[package]] -name = "phf" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" -dependencies = [ - "phf_macros", - "phf_shared", - "serde", -] - -[[package]] -name = "phf_generator" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" -dependencies = [ - "fastrand", - "phf_shared", -] - -[[package]] -name = "phf_macros" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "phf_shared" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "piper" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "pkg-config" -version = "0.3.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" - -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - -[[package]] -name = "plist" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" -dependencies = [ - "base64", - "indexmap", - "quick-xml 0.42.0", - "serde", - "time", -] - -[[package]] -name = "png" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" -dependencies = [ - "bitflags 2.13.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.8.9", -] - -[[package]] -name = "polling" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi", - "pin-project-lite", - "rustix 1.1.5", - "windows-sys 0.61.2", -] - -[[package]] -name = "pollster" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" - -[[package]] -name = "pollster" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" - -[[package]] -name = "polycool" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" -dependencies = [ - "arrayvec", -] - -[[package]] -name = "portable-atomic" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" - -[[package]] -name = "portable-atomic-util" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" -dependencies = [ - "portable-atomic", -] - -[[package]] -name = "postcard" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" -dependencies = [ - "cobs", - "serde", -] - -[[package]] -name = "potential_utf" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" -dependencies = [ - "serde_core", - "writeable", - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "presser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" - -[[package]] -name = "proc-macro-crate" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" -dependencies = [ - "toml_edit", -] - -[[package]] -name = "proc-macro2" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "profiling" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" - -[[package]] -name = "proptest" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" -dependencies = [ - "bit-set 0.11.1", - "bit-vec 0.10.1", - "bitflags 2.13.2", - "chacha20", - "core_detect", - "num-traits", - "rand 0.10.3", - "rand_xorshift", - "regex-syntax", - "rusty-fork", - "tempfile", - "unarray", -] - -[[package]] -name = "pulp" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" -dependencies = [ - "bytemuck", - "cfg-if", - "libm", - "num-complex", - "paste", - "pulp-wasm-simd-flag", - "raw-cpuid", - "reborrow", - "version_check", -] - -[[package]] -name = "pulp-wasm-simd-flag" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" - -[[package]] -name = "pxfm" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - -[[package]] -name = "quick-xml" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" -dependencies = [ - "memchr", -] - -[[package]] -name = "quick-xml" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - -[[package]] -name = "rand" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" -dependencies = [ - "rand_chacha", - "rand_core 0.9.5", -] - -[[package]] -name = "rand" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" -dependencies = [ - "chacha20", - "getrandom 0.4.3", - "rand_core 0.10.1", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", -] - -[[package]] -name = "rand_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" -dependencies = [ - "getrandom 0.3.4", -] - -[[package]] -name = "rand_core" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" - -[[package]] -name = "rand_distr" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" -dependencies = [ - "num-traits", - "rand 0.9.5", -] - -[[package]] -name = "rand_xorshift" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" -dependencies = [ - "rand_core 0.10.1", -] - -[[package]] -name = "range-alloc" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" - -[[package]] -name = "raw-cpuid" -version = "11.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "raw-window-handle" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" - -[[package]] -name = "raw-window-metal" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" -dependencies = [ - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "objc2-quartz-core 0.3.2", -] - -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rayon" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "read-fonts" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" -dependencies = [ - "bytemuck", - "font-types", - "once_cell", -] - -[[package]] -name = "reborrow" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "redox_syscall" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "regex-syntax" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" - -[[package]] -name = "regress" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32eef8b209c3c1c15dbad02c1f30f9539f00dc7253e0cbcdaae442a50a09d7c1" -dependencies = [ - "memchr", -] - -[[package]] -name = "renderdoc-sys" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" - -[[package]] -name = "rfd" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220" -dependencies = [ - "block2 0.6.2", - "dispatch2", - "js-sys", - "libc", - "log", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-core-foundation", - "objc2-foundation 0.3.2", - "percent-encoding", - "pollster 0.4.0", - "raw-window-handle", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "web-sys", - "windows-sys 0.61.2", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.17", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "roxmltree" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" -dependencies = [ - "memchr", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" -dependencies = [ - "bitflags 2.13.2", - "errno", - "libc", - "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls" -version = "0.23.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" -dependencies = [ - "log", - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" -dependencies = [ - "openssl-probe", - "rustls-pki-types", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pki-types" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" -dependencies = [ - "zeroize", -] - -[[package]] -name = "rustls-platform-verifier" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" -dependencies = [ - "core-foundation 0.10.1", - "core-foundation-sys", - "jni 0.22.4", - "log", - "once_cell", - "rustls", - "rustls-native-certs", - "rustls-platform-verifier-android", - "rustls-webpki", - "security-framework", - "security-framework-sys", - "webpki-root-certs", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls-platform-verifier-android" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" - -[[package]] -name = "rustls-webpki" -version = "0.103.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" - -[[package]] -name = "rusty-fork" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" -dependencies = [ - "fnv", - "quick-error 1.2.3", - "tempfile", - "wait-timeout", -] - -[[package]] -name = "ryu-js" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04d056b875a9d2e6cb9a61d127afee9ac5999b9f87bcb32079d1318e505be714" - -[[package]] -name = "safetensors" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675656c1eabb620b921efea4f9199f97fc86e36dd6ffd1fbbe48d0f59a4987f5" -dependencies = [ - "hashbrown 0.16.1", - "serde", - "serde_json", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schannel" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sctk-adwaita" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" -dependencies = [ - "log", - "smithay-client-toolkit 0.19.2", - "tiny-skia 0.11.4", -] - -[[package]] -name = "security-framework" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" -dependencies = [ - "bitflags 2.13.2", - "core-foundation 0.10.1", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "self_cell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" - -[[package]] -name = "seq-macro" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" - -[[package]] -name = "serde" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde_core" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "serde_json" -version = "1.0.154" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_repr" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "serde_spanned" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" -dependencies = [ - "serde_core", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest", -] - -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "simd-adler32" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" - -[[package]] -name = "simd_cesu8" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" -dependencies = [ - "rustc_version", - "simdutf8", -] - -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - -[[package]] -name = "siphasher" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" - -[[package]] -name = "skrifa" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" -dependencies = [ - "bytemuck", - "read-fonts", -] - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "slotmap" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" -dependencies = [ - "version_check", -] - -[[package]] -name = "small_btree" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba60d2df92ba73864714808ca68c059734853e6ab722b40e1cf543ebb3a057a" -dependencies = [ - "arrayvec", -] - -[[package]] -name = "smallvec" -version = "1.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" -dependencies = [ - "serde", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" -dependencies = [ - "bitflags 2.13.2", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 0.38.44", - "thiserror 1.0.69", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" -dependencies = [ - "bitflags 2.13.2", - "calloop 0.14.4", - "calloop-wayland-source 0.4.1", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix 1.1.5", - "thiserror 2.0.21", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-experimental", - "wayland-protocols-misc", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - -[[package]] -name = "smithay-clipboard" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" -dependencies = [ - "libc", - "smithay-client-toolkit 0.20.0", - "wayland-backend", -] - -[[package]] -name = "smol_str" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "spin" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" - -[[package]] -name = "spirv" -version = "0.4.0+sdk-1.4.341.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" -dependencies = [ - "bitflags 2.13.2", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strict-num" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" - -[[package]] -name = "string-interner" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23de088478b31c349c9ba67816fa55d9355232d63c3afea8bf513e31f0f1d2c0" -dependencies = [ - "hashbrown 0.15.5", - "serde", -] - -[[package]] -name = "stringprep" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" -dependencies = [ - "unicode-bidi", - "unicode-normalization", - "unicode-properties", -] - -[[package]] -name = "strum" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "symphonia" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" -dependencies = [ - "lazy_static", - "symphonia-bundle-flac", - "symphonia-bundle-mp3", - "symphonia-codec-aac", - "symphonia-codec-alac", - "symphonia-codec-pcm", - "symphonia-codec-vorbis", - "symphonia-core", - "symphonia-format-isomp4", - "symphonia-format-ogg", - "symphonia-format-riff", - "symphonia-metadata", -] - -[[package]] -name = "symphonia-bundle-flac" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976" -dependencies = [ - "log", - "symphonia-core", - "symphonia-metadata", - "symphonia-utils-xiph", -] - -[[package]] -name = "symphonia-bundle-mp3" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" -dependencies = [ - "lazy_static", - "log", - "symphonia-core", - "symphonia-metadata", -] - -[[package]] -name = "symphonia-codec-aac" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790" -dependencies = [ - "lazy_static", - "log", - "symphonia-core", -] - -[[package]] -name = "symphonia-codec-alac" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8413fa754942ac16a73634c9dfd1500ed5c61430956b33728567f667fdd393ab" -dependencies = [ - "log", - "symphonia-core", -] - -[[package]] -name = "symphonia-codec-pcm" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" -dependencies = [ - "log", - "symphonia-core", -] - -[[package]] -name = "symphonia-codec-vorbis" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" -dependencies = [ - "log", - "symphonia-core", - "symphonia-utils-xiph", -] - -[[package]] -name = "symphonia-core" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" -dependencies = [ - "arrayvec", - "bitflags 1.3.2", - "bytemuck", - "lazy_static", - "log", -] - -[[package]] -name = "symphonia-format-isomp4" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5" -dependencies = [ - "encoding_rs", - "log", - "symphonia-core", - "symphonia-metadata", - "symphonia-utils-xiph", -] - -[[package]] -name = "symphonia-format-ogg" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" -dependencies = [ - "log", - "symphonia-core", - "symphonia-metadata", - "symphonia-utils-xiph", -] - -[[package]] -name = "symphonia-format-riff" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" -dependencies = [ - "extended", - "log", - "symphonia-core", - "symphonia-metadata", -] - -[[package]] -name = "symphonia-metadata" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" -dependencies = [ - "encoding_rs", - "lazy_static", - "log", - "symphonia-core", -] - -[[package]] -name = "symphonia-utils-xiph" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" -dependencies = [ - "symphonia-core", - "symphonia-metadata", -] - -[[package]] -name = "syn" -version = "2.0.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "3.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "sys-locale" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" -dependencies = [ - "js-sys", - "libc", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "sysctl" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc" -dependencies = [ - "bitflags 2.13.2", - "byteorder", - "enum-as-inner", - "libc", - "thiserror 1.0.69", - "walkdir", -] - -[[package]] -name = "sysinfo" -version = "0.37.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" -dependencies = [ - "libc", - "memchr", - "ntapi", - "objc2-core-foundation", - "objc2-io-kit", - "windows 0.61.3", -] - -[[package]] -name = "tag_ptr" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0e973b34477b7823833469eb0f5a3a60370fef7a453e02d751b59180d0a5a05" - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tar" -version = "0.4.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" -dependencies = [ - "filetime", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.3", - "once_cell", - "rustix 1.1.5", - "windows-sys 0.61.2", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thin-vec" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4568d7e143ec86d2021c338bae2afa88699e84b8e0af523626654fe6f03a1748" - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" -dependencies = [ - "thiserror-impl 2.0.21", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "tiff" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" -dependencies = [ - "fax", - "flate2", - "half", - "quick-error 2.0.1", - "weezl", - "zune-jpeg", -] - -[[package]] -name = "time" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" -dependencies = [ - "deranged", - "js-sys", - "libc", - "num-conv", - "num_threads", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" - -[[package]] -name = "time-macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-skia" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "tiny-skia-path 0.11.4", -] - -[[package]] -name = "tiny-skia" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "tiny-skia-path 0.12.0", -] - -[[package]] -name = "tiny-skia-path" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - -[[package]] -name = "tiny-skia-path" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - -[[package]] -name = "tinystr" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" -dependencies = [ - "displaydoc", - "serde_core", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" - -[[package]] -name = "tokio" -version = "1.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" -dependencies = [ - "pin-project-lite", -] - -[[package]] -name = "toml" -version = "1.1.6+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned", - "toml_datetime", - "toml_parser", - "toml_writer", - "winnow", -] - -[[package]] -name = "toml_datetime" -version = "1.1.1+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.25.15+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" -dependencies = [ - "indexmap", - "toml_datetime", - "toml_parser", - "winnow", -] - -[[package]] -name = "toml_parser" -version = "1.1.3+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" -dependencies = [ - "winnow", -] - -[[package]] -name = "toml_writer" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "tree_magic_mini" -version = "3.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" -dependencies = [ - "memchr", - "nom", - "petgraph", -] - -[[package]] -name = "type-map" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" -dependencies = [ - "rustc-hash 2.1.3", -] - -[[package]] -name = "typed-path" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54ec2755506471f54baf5e4bb5499d8e510cc1caf271270e778a736bd2d7336c" - -[[package]] -name = "typed-path" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" - -[[package]] -name = "typenum" -version = "1.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" - -[[package]] -name = "uds_windows" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" -dependencies = [ - "memoffset", - "tempfile", - "windows-sys 0.61.2", -] - -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - -[[package]] -name = "unicode-bidi" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" - -[[package]] -name = "unicode-general-category" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" - -[[package]] -name = "unicode-ident" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" - -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - -[[package]] -name = "unicode-normalization" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-properties" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" - -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "ureq" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde93ff05758a36a851a398a772b0b79a82fbe3c186a46f2696baaeaf84c966b" -dependencies = [ - "base64", - "flate2", - "log", - "percent-encoding", - "rustls", - "rustls-pki-types", - "rustls-platform-verifier", - "ureq-proto", - "utf8-zero", -] - -[[package]] -name = "ureq-proto" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841583fc36089d7d59419568ae157f43a5a03a2e5a81ba87c77d1596ef46e922" -dependencies = [ - "base64", - "http", - "httparse", - "log", -] - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8-zero" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "uuid" -version = "1.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" -dependencies = [ - "js-sys", - "serde_core", - "wasm-bindgen", -] - -[[package]] -name = "vello_common" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd" -dependencies = [ - "bytemuck", - "fearless_simd", - "guillotiere", - "log", - "peniko", - "smallvec", - "thiserror 2.0.21", -] - -[[package]] -name = "vello_cpu" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9" -dependencies = [ - "bytemuck", - "glifo", - "hashbrown 0.17.1", - "vello_common", -] - -[[package]] -name = "verifysign" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6acfcc42a8d44f340d001193d97ef56bf33210b51ad760ae8308c97d5241ca51" -dependencies = [ - "core-foundation 0.10.1", - "windows-sys 0.61.2", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wait-timeout" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" -dependencies = [ - "libc", -] - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" -dependencies = [ - "js-sys", - "tokio", - "wasm-bindgen", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 3.0.6", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-bindgen-test" -version = "0.3.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7499dfd45780a0a91d7ee6bb9ac51970a4479a41a89da443fdda5a39547d42" -dependencies = [ - "async-trait", - "cast", - "js-sys", - "libm", - "minicov", - "nu-ansi-term", - "num-traits", - "oorandom", - "serde", - "serde_json", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-bindgen-test-macro", - "wasm-bindgen-test-shared", -] - -[[package]] -name = "wasm-bindgen-test-macro" -version = "0.3.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b84b5ac638bfb168196a1a461fcc8f46a294a18b1b6be52133b4e0db122cc9f" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "wasm-bindgen-test-shared" -version = "0.2.129" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f692aa943ccd88363733b77063f32cfed5bc6cbea8e6e8b251b302f881606fe" - -[[package]] -name = "wasm-encoder" -version = "0.261.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2608e8bb6d67fd68f5a8d0eb1363d6e7bcbc1f8ded5a0bd3a1e382462b876b22" -dependencies = [ - "leb128fmt", - "wasmparser 0.261.0", -] - -[[package]] -name = "wasmi" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78693fcdd618e0fc34af59c6b8efa9ac5d58c68df940beff4bedddb6acfe7c27" -dependencies = [ - "spin", - "wasmi_collections", - "wasmi_core", - "wasmi_ir", - "wasmparser 0.228.0", - "wat", -] - -[[package]] -name = "wasmi_collections" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8be2aa467cf2d29e96ff759472c36eeb44a3c81c67fc9cb76c9a24c519c557" -dependencies = [ - "string-interner", -] - -[[package]] -name = "wasmi_core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69372d5fda3ea3d1e0aa6603c7888110e0187e88ea17cd8fc2e2df0a0e1f37fa" -dependencies = [ - "libm", -] - -[[package]] -name = "wasmi_ir" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f17b774caa13c618c7244f1ee51fe23c5e7b8538a471fa46d9949779758aed6" -dependencies = [ - "wasmi_core", -] - -[[package]] -name = "wasmparser" -version = "0.228.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abf1132c1fdf747d56bbc1bb52152400c70f336870f968b85e89ea422198ae3" -dependencies = [ - "bitflags 2.13.2", - "indexmap", -] - -[[package]] -name = "wasmparser" -version = "0.261.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f20f20e44f7e8aeb6744823ea9d869ede51e51be4fdaedede2852282e54d2d8" -dependencies = [ - "bitflags 2.13.2", - "indexmap", -] - -[[package]] -name = "wast" -version = "261.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "776443145731a4062e5b0d392892a2005909b6ab72d9fdc3cad53dd1a714e44a" -dependencies = [ - "bumpalo", - "leb128fmt", - "memchr", - "unicode-width", - "wasm-encoder", -] - -[[package]] -name = "wat" -version = "1.261.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b4d1a49ea73a8f3326e74e3a05db667001b16bd1035ed3356fc1a0ed05ca7f" -dependencies = [ - "wast", -] - -[[package]] -name = "wayland-backend" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" -dependencies = [ - "cc", - "downcast-rs", - "rustix 1.1.5", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" -dependencies = [ - "bitflags 2.13.2", - "rustix 1.1.5", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-csd-frame" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" -dependencies = [ - "bitflags 2.13.2", - "cursor-icon", - "wayland-backend", -] - -[[package]] -name = "wayland-cursor" -version = "0.31.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" -dependencies = [ - "rustix 1.1.5", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.32.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-experimental" -version = "20250721.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-misc" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-plasma" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" -dependencies = [ - "bitflags 2.13.2", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" -dependencies = [ - "proc-macro2", - "quick-xml 0.41.0", - "quote", -] - -[[package]] -name = "wayland-sys" -version = "0.31.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" -dependencies = [ - "dlib", - "log", - "once_cell", - "pkg-config", -] - -[[package]] -name = "web-sys" -version = "0.3.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" -dependencies = [ - "jni 0.22.4", - "log", - "ndk-context", - "objc2 0.6.5", - "objc2-app-kit 0.3.2", - "objc2-foundation 0.3.2", - "url", - "web-sys", -] - -[[package]] -name = "webpki-root-certs" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "weezl" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" - -[[package]] -name = "wgpu" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" -dependencies = [ - "arrayvec", - "bitflags 2.13.2", - "bytemuck", - "cfg-if", - "cfg_aliases", - "document-features", - "hashbrown 0.17.1", - "js-sys", - "log", - "naga", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" -dependencies = [ - "arrayvec", - "bit-set 0.10.0", - "bit-vec 0.9.1", - "bitflags 2.13.2", - "bytemuck", - "cfg_aliases", - "document-features", - "hashbrown 0.17.1", - "indexmap", - "log", - "naga", - "naga-types", - "once_cell", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "rustc-hash 1.1.0", - "smallvec", - "thiserror 2.0.21", - "wgpu-core-deps-apple", - "wgpu-core-deps-emscripten", - "wgpu-core-deps-wasm", - "wgpu-core-deps-windows-linux-android", - "wgpu-hal", - "wgpu-naga-bridge", - "wgpu-types", -] - -[[package]] -name = "wgpu-core-deps-apple" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-emscripten" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-wasm" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-core-deps-windows-linux-android" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" -dependencies = [ - "wgpu-hal", -] - -[[package]] -name = "wgpu-hal" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set 0.10.0", - "bitflags 2.13.2", - "block2 0.6.2", - "bytemuck", - "cfg-if", - "cfg_aliases", - "glow", - "glutin_wgl_sys", - "gpu-allocator", - "hashbrown 0.17.1", - "js-sys", - "khronos-egl", - "libc", - "libloading", - "log", - "naga", - "naga-types", - "ndk-sys", - "objc2 0.6.5", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation 0.3.2", - "objc2-metal 0.3.2", - "objc2-quartz-core 0.3.2", - "once_cell", - "ordered-float", - "parking_lot", - "portable-atomic", - "portable-atomic-util", - "profiling", - "range-alloc", - "raw-window-handle", - "raw-window-metal", - "renderdoc-sys", - "smallvec", - "static_assertions", - "thiserror 2.0.21", - "wasm-bindgen", - "wayland-sys", - "web-sys", - "wgpu-naga-bridge", - "wgpu-types", - "windows 0.62.2", - "windows-core 0.62.2", - "windows-result 0.4.1", -] - -[[package]] -name = "wgpu-naga-bridge" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" -dependencies = [ - "naga", - "wgpu-types", -] - -[[package]] -name = "wgpu-types" -version = "30.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" -dependencies = [ - "bitflags 2.13.2", - "bytemuck", - "js-sys", - "log", - "naga-types", - "raw-window-handle", - "static_assertions", - "web-sys", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" -dependencies = [ - "windows-core 0.54.0", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections 0.2.0", - "windows-core 0.61.2", - "windows-future 0.2.1", - "windows-link 0.1.3", - "windows-numerics 0.2.0", -] - -[[package]] -name = "windows" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" -dependencies = [ - "windows-collections 0.3.2", - "windows-core 0.62.2", - "windows-future 0.3.2", - "windows-numerics 0.3.1", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", -] - -[[package]] -name = "windows-collections" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" -dependencies = [ - "windows-core 0.62.2", -] - -[[package]] -name = "windows-core" -version = "0.54.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" -dependencies = [ - "windows-result 0.1.2", - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading 0.1.0", -] - -[[package]] -name = "windows-future" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" -dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", - "windows-threading 0.2.1", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", -] - -[[package]] -name = "windows-numerics" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" -dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", -] - -[[package]] -name = "windows-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-result" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-threading" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winit" -version = "0.30.13" -source = "git+https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc#a517b3846ee8457d84ee4975110bfda6797c44dc" -dependencies = [ - "ahash", - "android-activity", - "atomic-waker", - "bitflags 2.13.2", - "block2 0.5.1", - "bytemuck", - "calloop 0.13.0", - "cfg_aliases", - "concurrent-queue", - "core-foundation 0.9.4", - "core-graphics", - "cursor-icon", - "dpi", - "js-sys", - "libc", - "memmap2", - "ndk", - "objc2 0.5.2", - "objc2-app-kit 0.2.2", - "objc2-foundation 0.2.2", - "objc2-ui-kit 0.2.2", - "orbclient", - "percent-encoding", - "pin-project", - "raw-window-handle", - "redox_syscall 0.4.1", - "rustix 0.38.44", - "sctk-adwaita", - "smithay-client-toolkit 0.19.2", - "smol_str", - "tracing", - "unicode-segmentation", - "wasm-bindgen", - "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-plasma", - "web-sys", - "web-time", - "windows-sys 0.52.0", - "x11-dl", - "x11rb", - "xkbcommon-dl", -] - -[[package]] -name = "winnow" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.55.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" -dependencies = [ - "cfg-if", - "windows-sys 0.59.0", -] - -[[package]] -name = "winresource" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bc6d36480b829272a5bdabf08e6dca8004761c1da7e35efef800540c66221b" -dependencies = [ - "toml", - "version_check", -] - -[[package]] -name = "winsafe" -version = "0.0.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef0ffc427f045c0cc9ebffd6f4f91153dcd2a1547b5c3c29ee3f541e16e95c6" - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "wl-clipboard-rs" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1" -dependencies = [ - "libc", - "log", - "os_pipe", - "rustix 1.1.5", - "thiserror 2.0.21", - "tree_magic_mini", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-wlr", -] - -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" -dependencies = [ - "either", -] - -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "x11rb" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" -dependencies = [ - "as-raw-xcb-connection", - "gethostname", - "libc", - "libloading", - "once_cell", - "rustix 1.1.5", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" - -[[package]] -name = "xcursor" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" - -[[package]] -name = "xkbcommon-dl" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" -dependencies = [ - "bitflags 2.13.2", - "dlib", - "log", - "once_cell", - "xkeysym", -] - -[[package]] -name = "xkeysym" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" - -[[package]] -name = "xml-rs" -version = "0.8.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" - -[[package]] -name = "xtask" -version = "0.23.1" -dependencies = [ - "chrono", - "pkg-config", - "serde_json", - "sha2", - "tempfile", -] - -[[package]] -name = "yoke" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", - "synstructure", -] - -[[package]] -name = "zbus" -version = "5.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" -dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-lite", - "hex", - "libc", - "ordered-stream", - "rustix 1.1.5", - "serde", - "serde_repr", - "tracing", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow", - "zbus_macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zbus-lockstep" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" -dependencies = [ - "zbus_xml", - "zvariant", -] - -[[package]] -name = "zbus-lockstep-macros" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", - "zbus-lockstep", - "zbus_xml", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "5.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.6", - "zbus_names", - "zvariant", - "zvariant_utils", -] - -[[package]] -name = "zbus_names" -version = "4.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" -dependencies = [ - "serde", - "winnow", - "zvariant", -] - -[[package]] -name = "zbus_xml" -version = "5.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" -dependencies = [ - "serde", - "winnow", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zcheapstr" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" -dependencies = [ - "serde", -] - -[[package]] -name = "zerocopy" -version = "0.8.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6df92bf3d9227be3d53173901ddbffac2babc27ae50f397776ffd6dc33f800cb" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4f328cf2f05d084e496c3e9c3f33ed0a183656a16e1fcec4d464d8373aec82" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" - -[[package]] -name = "zerotrie" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" -dependencies = [ - "displaydoc", - "litemap", - "serde_core", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "zerovec" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" -dependencies = [ - "serde", - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.6", -] - -[[package]] -name = "zip" -version = "7.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc12baa6db2b15a140161ce53d72209dacea594230798c24774139b54ecaa980" -dependencies = [ - "crc32fast", - "indexmap", - "memchr", - "typed-path 0.12.4", -] - -[[package]] -name = "zip" -version = "9.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb" -dependencies = [ - "crc32fast", - "flate2", - "getrandom 0.4.3", - "indexmap", - "memchr", - "nix", - "typed-path 0.13.0", - "windows-sys 0.61.2", -] - -[[package]] -name = "zlib-rs" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" - -[[package]] -name = "zmij" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" - -[[package]] -name = "zune-core" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" - -[[package]] -name = "zune-inflate" -version = "0.2.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "zune-jpeg" -version = "0.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" -dependencies = [ - "zune-core", -] - -[[package]] -name = "zvariant" -version = "5.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147" -dependencies = [ - "endi", - "enumflags2", - "serde", - "winnow", - "zcheapstr", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.6", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 3.0.6", - "winnow", -] +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "accesskit" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932" +dependencies = [ + "uuid", +] + +[[package]] +name = "accesskit_atspi_common" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c182f9c282ac9c5638d876d551d15e5f7d397ec263349a0c6a2b61595dd5e4" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "phf", + "serde", + "zvariant", +] + +[[package]] +name = "accesskit_consumer" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a45e2bb300bea6d5f33a82c3e051c3ddc6f41c209750f68a0acbe991a284344" +dependencies = [ + "accesskit", + "hashbrown 0.17.1", +] + +[[package]] +name = "accesskit_ios" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28e539d64b27fd4c14de8f78ada8f7c944c092f52f7e49fb63316507a57f6937" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", +] + +[[package]] +name = "accesskit_macos" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5701624bf6a11efb6d4c8e922bf44126ed96250e5faa9a7a0468c979635839a4" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_unix" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202f24df034a7476d07b7f74284de84f6d62aabd858dbe7ee9cad3b7ad6f8f9d" +dependencies = [ + "accesskit", + "accesskit_atspi_common", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce63f35d6bdcf59f26b76b3379063f738e6412cef46999cc772d46aa3de35adb" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.17.1", + "static_assertions", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "accesskit_winit" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee96dd150375c05912d8a473f98c2fb155fb3234fac88292d396548a2460fa77" +dependencies = [ + "accesskit", + "accesskit_ios", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aligned-vec" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" +dependencies = [ + "equator", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "alsa" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed7572b7ba83a31e20d1b48970ee402d2e3e0537dcfe0a3ff4d6eb7508617d43" +dependencies = [ + "alsa-sys", + "bitflags 2.13.2", + "cfg-if", + "libc", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni 0.22.4", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "arboard" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.59.0", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" +dependencies = [ + "serde", +] + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.5", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.5", +] + +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.5", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atspi" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" +dependencies = [ + "atspi-common", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-proxies" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-set" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c" +dependencies = [ + "bit-vec 0.10.1", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bit-vec" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5727b15fa97d4f4fee0a3b7c3d550ed0269f54329207b86388de918604e31269" +dependencies = [ + "borsh", + "serde", +] + +[[package]] +name = "bit_field" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.2", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "boa_ast" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9221b0a090572b4a118b46c5874c0781fe4bc9546b85f0a615b8bfb609ca4ed7" +dependencies = [ + "bitflags 2.13.2", + "boa_interner", + "boa_macros", + "boa_string", + "indexmap", + "num-bigint", + "rustc-hash 2.1.3", + "strum", +] + +[[package]] +name = "boa_engine" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6aaf7fdc4299df68adb67e1a5440a51d34630a1f5271b9698fd74bc97b60d9" +dependencies = [ + "aligned-vec", + "arrayvec", + "async-channel", + "bitflags 2.13.2", + "boa_ast", + "boa_gc", + "boa_interner", + "boa_macros", + "boa_parser", + "boa_string", + "bytemuck", + "cfg-if", + "cow-utils", + "dashmap", + "dynify", + "fast-float2", + "futures-concurrency", + "futures-lite", + "getrandom 0.4.3", + "hashbrown 0.17.1", + "icu_normalizer", + "indexmap", + "intrusive-collections", + "itertools", + "num-bigint", + "num-integer", + "num-traits", + "num_enum", + "oneshot", + "pastey", + "portable-atomic", + "rand 0.10.3", + "regress", + "rustc-hash 2.1.3", + "ryu-js", + "serde", + "serde_json", + "small_btree", + "static_assertions", + "tag_ptr", + "tap", + "thin-vec", + "thiserror 2.0.21", + "time", + "web-time", +] + +[[package]] +name = "boa_gc" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af82119558ab1002d1978c8459b53a3ebb506177d29a3aca37c07c1777b1d966" +dependencies = [ + "arrayvec", + "boa_macros", + "boa_string", + "hashbrown 0.17.1", + "thin-vec", +] + +[[package]] +name = "boa_interner" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317c631e791f5cb7d0017e43c0a758b0eaffd40c34c4c360e2a6be7752b78cd1" +dependencies = [ + "boa_gc", + "boa_macros", + "hashbrown 0.17.1", + "indexmap", + "once_cell", + "phf", + "rustc-hash 2.1.3", + "static_assertions", +] + +[[package]] +name = "boa_macros" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b882fd440dc0f4b7441367cf89567bb077920356750c9a76a16c002d8ec2fa5c" +dependencies = [ + "cfg-if", + "cow-utils", + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "boa_parser" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "641e81b3c8cbb7a2140547fb3ea534e9edf210b4e8c920b5fa864a919e11fbcf" +dependencies = [ + "bitflags 2.13.2", + "boa_ast", + "boa_interner", + "boa_macros", + "fast-float2", + "icu_properties", + "num-bigint", + "num-traits", + "regress", + "rustc-hash 2.1.3", +] + +[[package]] +name = "boa_string" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bf86c2bcff5bf2547acbfc516c5d3108ca527cb131511d749bf6fbef762c0e" +dependencies = [ + "fast-float2", + "itoa", + "pastey", + "rustc-hash 2.1.3", + "ryu-js", + "static_assertions", +] + +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "borsh-derive", + "bytes", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "slab", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.4", + "rustix 1.1.5", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "candle-core" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091" +dependencies = [ + "byteorder", + "float8", + "gemm", + "half", + "libm", + "memmap2", + "num-traits", + "num_cpus", + "rand 0.9.5", + "rand_distr", + "rayon", + "safetensors", + "thiserror 2.0.21", + "yoke", + "zip 7.4.0", +] + +[[package]] +name = "candle-nn" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03" +dependencies = [ + "candle-core", + "half", + "libc", + "num-traits", + "rayon", + "safetensors", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "num-traits", +] + +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "combine" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "coreaudio-rs" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aae284fbaf7d27aa0e292f7677dfbe26503b0d555026f702940805a630eac17" +dependencies = [ + "bitflags 1.3.2", + "libc", + "objc2-audio-toolbox", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", +] + +[[package]] +name = "cow-utils" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" + +[[package]] +name = "cpal" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbd307f43cc2a697e2d1f8bc7a1d824b5269e052209e28883e5bc04d095aaa3f" +dependencies = [ + "alsa", + "coreaudio-rs", + "dasp_sample", + "jni 0.21.1", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "objc2-audio-toolbox", + "objc2-core-audio", + "objc2-core-audio-types", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.54.0", +] + +[[package]] +name = "cpu-time" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9e393a7668fe1fad3075085b86c781883000b4ede868f43627b34a87c8b7ded" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "craft-aep" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" + +[[package]] +name = "craft-audio" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-docpath" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" + +[[package]] +name = "craft-dpx" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "craft-ecproj-format" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-eps" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" + +[[package]] +name = "craft-exr" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "serde_json", +] + +[[package]] +name = "craft-fonts-build" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" + +[[package]] +name = "craft-gif" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" + +[[package]] +name = "craft-i18n" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "fixed_decimal", + "icu_decimal", + "icu_locale_core", + "icu_locale_fallback", + "icu_normalizer", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_provider_adapters", + "icu_provider_blob", + "log", + "objc2-foundation 0.3.2", + "sys-locale", + "unicode-bidi", + "windows-registry", + "writeable", +] + +[[package]] +name = "craft-lottie" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-media" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "craft-media" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4#f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "craft-mesh" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "miniz_oxide 0.9.1", + "serde_json", +] + +[[package]] +name = "craft-pdf" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "hayro-syntax", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-psd" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "encoding_rs", + "flate2", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-quit" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "dispatch2", + "egui", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", +] + +[[package]] +name = "craft-svg" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "craft-xml", + "flate2", + "kurbo", + "roxmltree", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-ui" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "craft-fonts-build", + "craft-i18n", + "egui", + "epaint", + "js-sys", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "serde", + "skrifa", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "craft-update" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "chrono", + "dunce", + "egui", + "flate2", + "getrandom 0.3.4", + "image", + "log", + "plist", + "rustix 1.1.5", + "semver", + "serde", + "serde_json", + "sha2", + "tar", + "tempfile", + "ureq", + "verifysign", + "winreg", + "winsafe", + "zip 9.1.3", +] + +[[package]] +name = "craft-video" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-webp" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "quick-xml 0.41.0", + "thiserror 2.0.21", +] + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "dashmap" +version = "6.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "libc", + "objc2 0.6.5", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-stack" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c4713e43e2886ba72b8271aa66c93d722116acf7a75555cce11dcde84388fe8" +dependencies = [ + "bytemuck", + "dyn-stack-macros", +] + +[[package]] +name = "dyn-stack-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d926b4d407d372f141f93bb444696142c29d32962ccbd3531117cf3aa0bfa9" + +[[package]] +name = "dynify" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81acb15628a3e22358bf73de5e7e62360b8a777dbcb5fc9ac7dfa9ae73723747" +dependencies = [ + "dynify-macros", +] + +[[package]] +name = "dynify-macros" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec431cd708430d5029356535259c5d645d60edd3d39c54e5eea9782d46caa7d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "ecolor" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "effectcraft" +version = "0.24.1" +dependencies = [ + "chrono", + "cpal", + "craft-update", + "effectcraft-engine", + "effectcraft-host", + "effectcraft-ui-egui", + "eframe", + "egui", + "fmv-macos-events", + "log", + "muda", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "pollster 1.0.1", + "rfd", + "serde", + "serde_json", + "sysinfo", + "tempfile", + "winit", + "winresource", + "zbus", +] + +[[package]] +name = "effectcraft-aep" +version = "0.24.1" +dependencies = [ + "craft-aep", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-keyframe", + "effectcraft-project", + "effectcraft-time", + "log", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-automation" +version = "0.24.1" +dependencies = [ + "effectcraft-engine", + "effectcraft-host", + "effectcraft-model", + "effectcraft-script", + "image", + "serde_json", + "tempfile", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-cli" +version = "0.24.1" +dependencies = [ + "cpu-time", + "effectcraft-automation", + "effectcraft-engine", + "effectcraft-gpu", + "effectcraft-host", + "effectcraft-render", + "effectcraft-sam2", + "effectcraft-segment", + "effectcraft-time", + "effectcraft-track", + "effectcraft-ui-egui", + "image", + "serde_json", +] + +[[package]] +name = "effectcraft-color" +version = "0.24.1" +dependencies = [ + "proptest", + "serde", +] + +[[package]] +name = "effectcraft-effects" +version = "0.24.1" +dependencies = [ + "chrono", + "effectcraft-color", + "effectcraft-geom", + "effectcraft-keyframe", + "effectcraft-project", + "effectcraft-raster", + "effectcraft-segment", + "effectcraft-track", + "log", + "rayon", + "serde", + "serde_json", +] + +[[package]] +name = "effectcraft-engine" +version = "0.24.1" +dependencies = [ + "chrono", + "craft-docpath", + "effectcraft-aep", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-geom", + "effectcraft-interchange", + "effectcraft-keyframe", + "effectcraft-lottie", + "effectcraft-model", + "effectcraft-path", + "effectcraft-pdf", + "effectcraft-project", + "effectcraft-psd", + "effectcraft-raster", + "effectcraft-render", + "effectcraft-sam2", + "effectcraft-segment", + "effectcraft-svg", + "effectcraft-text", + "effectcraft-time", + "effectcraft-track", + "exr", + "image", + "kurbo", + "log", + "rayon", + "same-file", + "serde", + "serde_json", + "tempfile", + "thiserror 2.0.21", + "web-time", +] + +[[package]] +name = "effectcraft-export" +version = "0.24.1" +dependencies = [ + "craft-audio", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-video", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-keyframe", + "effectcraft-media", + "effectcraft-opusenc", + "effectcraft-project", + "effectcraft-raster", + "effectcraft-render", + "effectcraft-time", + "exr", + "filmcraft-av1", + "filmcraft-hevc", + "filmcraft-vp9", + "gif", + "image", + "log", + "rayon", + "tempfile", + "thiserror 2.0.21", + "web-time", +] + +[[package]] +name = "effectcraft-expr" +version = "0.24.1" +dependencies = [ + "boa_engine", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-geom", + "effectcraft-keyframe", + "effectcraft-path", + "effectcraft-project", + "effectcraft-render", + "effectcraft-text", + "effectcraft-time", + "serde_json", +] + +[[package]] +name = "effectcraft-geom" +version = "0.24.1" +dependencies = [ + "proptest", + "serde", +] + +[[package]] +name = "effectcraft-gpu" +version = "0.24.1" +dependencies = [ + "bytemuck", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-geom", + "effectcraft-keyframe", + "effectcraft-project", + "effectcraft-raster", + "effectcraft-render", + "effectcraft-text", + "effectcraft-time", + "js-sys", + "log", + "pollster 1.0.1", + "rayon", + "wasm-bindgen", + "web-time", + "wgpu", +] + +[[package]] +name = "effectcraft-helper-host" +version = "0.24.1" +dependencies = [ + "bytemuck", + "effectcraft-effects", + "log", + "serde", + "serde_json", +] + +[[package]] +name = "effectcraft-host" +version = "0.24.1" +dependencies = [ + "effectcraft-engine", + "effectcraft-export", + "effectcraft-expr", + "effectcraft-helper-host", + "effectcraft-interchange", + "effectcraft-media", + "effectcraft-pdf", + "effectcraft-plugin", + "effectcraft-project", + "effectcraft-psd", + "effectcraft-raster", + "effectcraft-script", + "effectcraft-svg", + "effectcraft-time", + "exr", + "gif", + "image", + "log", + "rayon", + "serde_json", + "tempfile", +] + +[[package]] +name = "effectcraft-interchange" +version = "0.24.1" +dependencies = [ + "effectcraft-color", + "effectcraft-keyframe", + "effectcraft-project", + "effectcraft-time", + "filmcraft-color", + "filmcraft-geom", + "filmcraft-interchange", + "filmcraft-media", + "filmcraft-project", + "filmcraft-time", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-keyframe" +version = "0.24.1" +dependencies = [ + "effectcraft-color", + "effectcraft-geom", + "effectcraft-time", + "proptest", + "serde", + "serde_json", +] + +[[package]] +name = "effectcraft-lottie" +version = "0.24.1" +dependencies = [ + "craft-docpath", + "craft-lottie", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-keyframe", + "effectcraft-path", + "effectcraft-project", + "effectcraft-render", + "effectcraft-text", + "effectcraft-time", + "kurbo", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-media" +version = "0.24.1" +dependencies = [ + "craft-audio", + "craft-docpath", + "craft-dpx", + "craft-exr", + "craft-gif", + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)", + "craft-webp", + "effectcraft-color", + "effectcraft-effects", + "effectcraft-model", + "effectcraft-pdf", + "effectcraft-project", + "effectcraft-psd", + "effectcraft-raster", + "effectcraft-render", + "effectcraft-svg", + "effectcraft-time", + "exr", + "filmcraft-codecs", + "filmcraft-color", + "filmcraft-frame", + "filmcraft-media", + "filmcraft-mpegts", + "filmcraft-time", + "gif", + "image", + "log", + "rayon", + "serde_json", + "tempfile", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-model" +version = "0.24.1" +dependencies = [ + "craft-mesh", + "effectcraft-geom", + "image", + "log", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-opusenc" +version = "0.24.1" +dependencies = [ + "craft-audio", +] + +[[package]] +name = "effectcraft-path" +version = "0.24.1" +dependencies = [ + "effectcraft-geom", + "effectcraft-keyframe", + "effectcraft-raster", + "kurbo", + "linesweeper", + "tiny-skia 0.12.0", +] + +[[package]] +name = "effectcraft-pdf" +version = "0.24.1" +dependencies = [ + "craft-eps", + "craft-pdf", + "effectcraft-raster", + "effectcraft-svg", + "effectcraft-text", + "image", + "kurbo", + "miniz_oxide 0.9.1", + "skrifa", + "wasm-bindgen-test", + "zune-jpeg", +] + +[[package]] +name = "effectcraft-plugin" +version = "0.24.1" +dependencies = [ + "effectcraft-effects", + "effectcraft-keyframe", + "effectcraft-project", + "effectcraft-raster", + "serde_json", + "wasmi", +] + +[[package]] +name = "effectcraft-project" +version = "0.24.1" +dependencies = [ + "craft-ecproj-format", + "effectcraft-color", + "effectcraft-geom", + "effectcraft-keyframe", + "effectcraft-time", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "effectcraft-psd" +version = "0.24.1" +dependencies = [ + "craft-psd", + "miniz_oxide 0.9.1", +] + +[[package]] +name = "effectcraft-raster" +version = "0.24.1" +dependencies = [ + "craft-exr", + "effectcraft-color", + "effectcraft-geom", + "rayon", + "tempfile", +] + +[[package]] +name = "effectcraft-render" +version = "0.24.1" +dependencies = [ + "effectcraft-color", + "effectcraft-effects", + "effectcraft-geom", + "effectcraft-keyframe", + "effectcraft-model", + "effectcraft-path", + "effectcraft-project", + "effectcraft-raster", + "effectcraft-text", + "effectcraft-time", + "kurbo", + "log", + "lz4_flex", + "rayon", + "serde", + "tempfile", + "web-time", +] + +[[package]] +name = "effectcraft-sam2" +version = "0.24.1" +dependencies = [ + "bytemuck", + "candle-core", + "candle-nn", + "effectcraft-segment", + "half", + "log", + "pollster 1.0.1", + "rayon", + "wgpu", +] + +[[package]] +name = "effectcraft-script" +version = "0.24.1" +dependencies = [ + "boa_engine", + "effectcraft-engine", + "effectcraft-expr", + "effectcraft-keyframe", + "effectcraft-path", + "effectcraft-project", + "effectcraft-psd", + "effectcraft-render", + "effectcraft-time", + "serde_json", + "socket2", + "web-time", +] + +[[package]] +name = "effectcraft-segment" +version = "0.24.1" +dependencies = [ + "miniz_oxide 0.9.1", + "ndarray", + "rayon", +] + +[[package]] +name = "effectcraft-svg" +version = "0.24.1" +dependencies = [ + "craft-svg", + "effectcraft-geom", + "effectcraft-path", + "effectcraft-raster", + "kurbo", + "log", + "rayon", + "roxmltree", +] + +[[package]] +name = "effectcraft-text" +version = "0.24.1" +dependencies = [ + "effectcraft-keyframe", + "harfrust", + "kurbo", + "skrifa", + "unicode-bidi", + "unicode-linebreak", +] + +[[package]] +name = "effectcraft-time" +version = "0.24.1" +dependencies = [ + "proptest", + "serde", +] + +[[package]] +name = "effectcraft-track" +version = "0.24.1" +dependencies = [ + "effectcraft-raster", + "effectcraft-segment", + "rayon", + "serde", + "serde_json", + "web-time", +] + +[[package]] +name = "effectcraft-ui-egui" +version = "0.24.1" +dependencies = [ + "bytemuck", + "chrono", + "craft-quit", + "craft-ui", + "craft-update", + "effectcraft-color", + "effectcraft-engine", + "effectcraft-geom", + "effectcraft-gpu", + "effectcraft-host", + "effectcraft-keyframe", + "effectcraft-media", + "effectcraft-path", + "effectcraft-project", + "effectcraft-render", + "effectcraft-segment", + "effectcraft-text", + "effectcraft-time", + "eframe", + "egui", + "egui_extras", + "egui_kittest", + "exr", + "half", + "image", + "kurbo", + "log", + "pollster 1.0.1", + "rayon", + "serde", + "serde_json", + "sys-locale", + "tempfile", + "toml", + "web-time", +] + +[[package]] +name = "effectcraft-web" +version = "0.24.1" +dependencies = [ + "effectcraft-engine", + "effectcraft-export", + "effectcraft-expr", + "effectcraft-gpu", + "effectcraft-host", + "effectcraft-media", + "effectcraft-ui-egui", + "eframe", + "egui", + "js-sys", + "log", + "serde", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", +] + +[[package]] +name = "eframe" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "pollster 1.0.1", + "profiling", + "raw-window-handle", + "send_wrapper", + "static_assertions", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "accesskit", + "ahash", + "bitflags 2.13.2", + "emath", + "epaint", + "itertools", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", + "web-sys", +] + +[[package]] +name = "egui-wgpu" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.21", + "type-map", + "web-time", + "wgpu", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "accesskit_winit", + "arboard", + "block2 0.6.2", + "bytemuck", + "egui", + "image", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "parking_lot", + "profiling", + "raw-window-handle", + "smithay-clipboard", + "web-time", + "webbrowser", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui_extras" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "ahash", + "egui", + "enum-map", + "itertools", + "log", + "profiling", +] + +[[package]] +name = "egui_glow" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "bytemuck", + "egui", + "glow", + "log", + "profiling", + "winit", +] + +[[package]] +name = "egui_kittest" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "eframe", + "egui", + "egui-wgpu", + "image", + "kittest", + "log", + "pollster 1.0.1", + "serde", + "toml", + "wgpu", +] + +[[package]] +name = "either" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" + +[[package]] +name = "emath" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "encoding_rs" +version = "0.8.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "enum-map" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4532960034c15ba2f55e9eee631040ecc473c32e6c4b200828c759840f13a06" +dependencies = [ + "enum-map-derive", +] + +[[package]] +name = "enum-map-derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7127272f64b3e098f7d81f350d672081b879bff896d219c42370dc858b1af9ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "epaint" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" +dependencies = [ + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "font-types", + "harfrust", + "log", + "nohash-hasher", + "parking_lot", + "profiling", + "self_cell", + "skrifa", + "smallvec", + "unicode-bidi", + "unicode-general-category", + "unicode-properties", + "unicode-segmentation", + "vello_cpu", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.37.0" +source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a" + +[[package]] +name = "equator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" +dependencies = [ + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "exr" +version = "1.74.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide 0.8.9", + "num-complex", + "pulp", + "rayon-core", + "smallvec", + "zune-inflate", +] + +[[package]] +name = "extended" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9673d8203fcb076b19dfd17e38b3d4ae9f44959416ea532ce72415a6020365" + +[[package]] +name = "fast-float2" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e8948ce679d00a02a94739ea185595dca7118ed04feb991127e443bd3d761f" + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fearless_simd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "filmcraft-aac" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-ac3" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-apv" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-av1" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-avi" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" + +[[package]] +name = "filmcraft-bitstream" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4)", +] + +[[package]] +name = "filmcraft-cfb" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" + +[[package]] +name = "filmcraft-codecs" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-aac", + "filmcraft-ac3", + "filmcraft-apv", + "filmcraft-av1", + "filmcraft-avi", + "filmcraft-bitstream", + "filmcraft-color", + "filmcraft-dnx", + "filmcraft-frame", + "filmcraft-h264", + "filmcraft-hevc", + "filmcraft-isobmff", + "filmcraft-matroska", + "filmcraft-media", + "filmcraft-mpa", + "filmcraft-mpeg2v", + "filmcraft-mpegts", + "filmcraft-mxf", + "filmcraft-ogg", + "filmcraft-opus", + "filmcraft-prores", + "filmcraft-time", + "filmcraft-vp8", + "filmcraft-vp9", + "image", + "log", + "rayon", + "symphonia", + "thiserror 2.0.21", + "web-time", +] + +[[package]] +name = "filmcraft-color" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "serde", +] + +[[package]] +name = "filmcraft-dng" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-dnx" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-frame" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-color", + "filmcraft-time", + "rayon", + "serde", +] + +[[package]] +name = "filmcraft-geom" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "serde", +] + +[[package]] +name = "filmcraft-h264" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-hevc" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-interchange" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-cfb", + "filmcraft-color", + "filmcraft-geom", + "filmcraft-media", + "filmcraft-project", + "filmcraft-time", + "roxmltree", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-isobmff" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4)", +] + +[[package]] +name = "filmcraft-matroska" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f0ad6c1e1d297908915f4be315b0fcfc9be7b5d4)", +] + +[[package]] +name = "filmcraft-media" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-color", + "filmcraft-dng", + "filmcraft-frame", + "filmcraft-time", + "image", + "rayon", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-mpa" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-mpeg2v" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-mpegts" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-mxf" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "chrono", +] + +[[package]] +name = "filmcraft-ogg" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" + +[[package]] +name = "filmcraft-opus" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" + +[[package]] +name = "filmcraft-project" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-color", + "filmcraft-geom", + "filmcraft-media", + "filmcraft-time", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-prores" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-time" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "serde", +] + +[[package]] +name = "filmcraft-vp8" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "filmcraft-vp9" +version = "0.12.0" +source = "git+https://github.com/storytold/filmcraft?rev=d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5#d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" +dependencies = [ + "filmcraft-bitstream", + "rayon", + "thiserror 2.0.21", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "fixed_decimal" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2214fb00f669ee96bee5bb29dfb1ddabe058b2bc426817efc79afa03c9bc55ae" +dependencies = [ + "displaydoc", + "smallvec", + "writeable", +] + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "float8" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719a903cc23e4a89e87962c2a80fdb45cdaad0983a89bd150bb57b4c8571a7d5" +dependencies = [ + "half", + "num-traits", + "rand 0.9.5", + "rand_distr", +] + +[[package]] +name = "fmv-macos-events" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90642cf66dde7f205dc8b42dfe57b47d0f3a29f571b832742883ef512e23fe55" +dependencies = [ + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8eb065f3251655b3c90e22e5e363f310fc5332fb3402e37bbc94752283248f6" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-concurrency" +version = "7.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175cd8cca9e1d45b87f18ffa75088f2099e3c4fe5e2f83e42de112560bea8ea6" +dependencies = [ + "fixedbitset", + "futures-core", + "futures-lite", + "pin-project", + "smallvec", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gemm" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb" +dependencies = [ + "dyn-stack", + "gemm-c32", + "gemm-c64", + "gemm-common", + "gemm-f16", + "gemm-f32", + "gemm-f64", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c32" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-c64" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-common" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88027625910cc9b1085aaaa1c4bc46bb3a36aad323452b33c25b5e4e7c8e2a3e" +dependencies = [ + "bytemuck", + "dyn-stack", + "half", + "libm", + "num-complex", + "num-traits", + "once_cell", + "paste", + "pulp", + "raw-cpuid", + "rayon", + "seq-macro", + "sysctl", +] + +[[package]] +name = "gemm-f16" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e" +dependencies = [ + "dyn-stack", + "gemm-common", + "gemm-f32", + "half", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "rayon", + "seq-macro", +] + +[[package]] +name = "gemm-f32" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "gemm-f64" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a" +dependencies = [ + "dyn-stack", + "gemm-common", + "num-complex", + "num-traits", + "paste", + "raw-cpuid", + "seq-macro", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link 0.2.1", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glifo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "skrifa", + "smallvec", + "vello_common", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows 0.62.2", +] + +[[package]] +name = "guillotiere" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" +dependencies = [ + "euclid", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "bytemuck", + "cfg-if", + "crunchy", + "num-traits", + "rand 0.9.5", + "rand_distr", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", + "serde", + "serde_core", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hayro-ccitt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" + +[[package]] +name = "hayro-jbig2" +version = "0.3.0" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "hayro-ccitt", +] + +[[package]] +name = "hayro-jpeg2000" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1" + +[[package]] +name = "hayro-syntax" +version = "0.7.2" +source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9" +dependencies = [ + "hayro-jbig2", + "hayro-jpeg2000", + "rustc-hash 2.1.3", + "smallvec", + "stringprep", + "zune-jpeg", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_decimal" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb8f655bba2d0c0459e43a5b0e6cd3cd388109898fb3d85d048165e8b0abd08" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_locale_core", + "icu_pattern", + "icu_plurals", + "icu_provider", + "serde", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8" + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_pattern" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b3db611446bd92c246b03e4aa0bafa71ddb194af431ddbb42b9d70e4bfce1a0" +dependencies = [ + "displaydoc", + "either", + "serde", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_plurals" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e475e6766ef87b1d3c1f97be6363995b0bfaeddbc789671615df598a97ff0593" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_provider", + "serde", + "zerovec", +] + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "postcard", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_provider_adapters" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df887bc4f55dbc773c7c45a0c7dfa75be886f7b7812830a71ab7271cc1801820" +dependencies = [ + "icu_locale_fallback", + "icu_provider", +] + +[[package]] +name = "icu_provider_blob" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5916b44fac319d3f58e4d8d805a627df19e27937b582cd99fcde3bb6b7ce1b0e" +dependencies = [ + "icu_provider", + "postcard", + "serde", + "writeable", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error 2.0.1", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "intrusive-collections" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4275b20e6057cd7733fd8df8a5a31701e4fe44497dad0f3fa0e1c4fb971506be" + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link 0.2.1", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.13.2", + "serde", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kittest" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb81a721ba76aa095b7f45deb180504f786904e56ca4b8e141f66eb89a78b75" +dependencies = [ + "accesskit", + "accesskit_consumer", +] + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "serde", + "smallvec", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "lebe" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.4", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linesweeper" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25df1b0c5432893f41bba817150e323703ee5f6d974f3a6808ac7fd7f046d18" +dependencies = [ + "arrayvec", + "kurbo", + "polycool", + "rustc-hash 2.1.3", + "smallvec", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" +dependencies = [ + "serde_core", +] + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lz4_flex" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecbdfe44b1bd960b68170b417450a628c43f7cf56bb3c5317e61cb230ee7f226" + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + +[[package]] +name = "matrixmultiply" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7" +dependencies = [ + "autocfg", + "rawpointer", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", + "stable_deref_trait", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minicov" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d" +dependencies = [ + "cc", + "walkdir", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "muda" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4340e89c178916e62879c5c36b7f699019369be413e496178a6983ce91b8bc03" +dependencies = [ + "crossbeam-channel", + "dpi", + "keyboard-types", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "png", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "ndarray" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d" +dependencies = [ + "matrixmultiply", + "num-complex", + "num-integer", + "num-traits", + "portable-atomic", + "portable-atomic-util", + "rawpointer", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93e7820bc0a80a0238e650327316f929ba18d5be054b647490a3a6a339f3e7c0" +dependencies = [ + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "bytemuck", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-audio-toolbox" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6948501a91121d6399b79abaa33a8aa4ea7857fe019f341b8c23ad6e81b79b08" +dependencies = [ + "bitflags 2.13.2", + "libc", + "objc2 0.6.5", + "objc2-core-audio", + "objc2-core-audio-types", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-audio" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1eebcea8b0dbff5f7c8504f3107c68fc061a3eb44932051c8cf8a68d969c3b2" +dependencies = [ + "dispatch2", + "objc2 0.6.5", + "objc2-core-audio-types", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-core-audio-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a89f2ec274a0cf4a32642b2991e8b351a404d290da87bb6a9a9d8632490bd1c" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "oneshot" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe21416a02c693fb9f980befcb230ecc70b0b3d1cc4abf88b9675c4c1457f0c" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "plist" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" +dependencies = [ + "base64", + "indexmap", + "quick-xml 0.42.0", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "pollster" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "serde", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "proptest" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" +dependencies = [ + "bit-set 0.11.1", + "bit-vec 0.10.1", + "bitflags 2.13.2", + "chacha20", + "core_detect", + "num-traits", + "rand 0.10.3", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "pulp" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" +dependencies = [ + "bytemuck", + "cfg-if", + "libm", + "num-complex", + "paste", + "pulp-wasm-simd-flag", + "raw-cpuid", + "reborrow", + "version_check", +] + +[[package]] +name = "pulp-wasm-simd-flag" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_distr" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" +dependencies = [ + "num-traits", + "rand 0.9.5", +] + +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "raw-cpuid" +version = "11.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "reborrow" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "regress" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32eef8b209c3c1c15dbad02c1f30f9539f00dc7253e0cbcdaae442a50a09d7c1" +dependencies = [ + "memchr", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rfd" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220" +dependencies = [ + "block2 0.6.2", + "dispatch2", + "js-sys", + "libc", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "percent-encoding", + "pollster 0.4.0", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "roxmltree" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni 0.22.4", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu-js" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d056b875a9d2e6cb9a61d127afee9ac5999b9f87bcb32079d1318e505be714" + +[[package]] +name = "safetensors" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "675656c1eabb620b921efea4f9199f97fc86e36dd6ffd1fbbe48d0f59a4987f5" +dependencies = [ + "hashbrown 0.16.1", + "serde", + "serde_json", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "log", + "smithay-client-toolkit 0.19.2", + "tiny-skia 0.11.4", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "seq-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "small_btree" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba60d2df92ba73864714808ca68c059734853e6ab722b40e1cf543ebb3a057a" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "smallvec" +version = "1.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" +dependencies = [ + "serde", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.4", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.5", + "thiserror 2.0.21", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + +[[package]] +name = "string-interner" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23de088478b31c349c9ba67816fa55d9355232d63c3afea8bf513e31f0f1d2c0" +dependencies = [ + "hashbrown 0.15.5", + "serde", +] + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "symphonia" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5773a4c030a19d9bfaa090f49746ff35c75dfddfa700df7a5939d5e076a57039" +dependencies = [ + "lazy_static", + "symphonia-bundle-flac", + "symphonia-bundle-mp3", + "symphonia-codec-aac", + "symphonia-codec-alac", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-isomp4", + "symphonia-format-ogg", + "symphonia-format-riff", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-flac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91565e180aea25d9b80a910c546802526ffd0072d0b8974e3ebe59b686c9976" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4872dd6bb56bf5eac799e3e957aa1981086c3e613b27e0ac23b176054f7c57ed" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-codec-aac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c263845aa86881416849c1729a54c7f55164f8b96111dba59de46849e73a790" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-alac" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8413fa754942ac16a73634c9dfd1500ed5c61430956b33728567f667fdd393ab" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e89d716c01541ad3ebe7c91ce4c8d38a7cf266a3f7b2f090b108fb0cb031d95" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-vorbis" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f025837c309cd69ffef572750b4a2257b59552c5399a5e49707cc5b1b85d1c73" +dependencies = [ + "log", + "symphonia-core", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-core" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea00cc4f79b7f6bb7ff87eddc065a1066f3a43fe1875979056672c9ef948c2af" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-format-isomp4" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243739585d11f81daf8dac8d9f3d18cc7898f6c09a259675fc364b382c30e0a5" +dependencies = [ + "encoding_rs", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-ogg" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b4955c67c1ed3aa8ae8428d04ca8397fbef6a19b2b051e73b5da8b1435639cb" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-riff" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d7c3df0e7d94efb68401d81906eae73c02b40d5ec1a141962c592d0f11a96f" +dependencies = [ + "extended", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36306ff42b9ffe6e5afc99d49e121e0bd62fe79b9db7b9681d48e29fa19e6b16" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-utils-xiph" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27c85ab799a338446b68eec77abf42e1a6f1bb490656e121c6e27bfbab9f16" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "sysctl" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "enum-as-inner", + "libc", + "thiserror 1.0.69", + "walkdir", +] + +[[package]] +name = "sysinfo" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows 0.61.3", +] + +[[package]] +name = "tag_ptr" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0e973b34477b7823833469eb0f5a3a60370fef7a453e02d751b59180d0a5a05" + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thin-vec" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4568d7e143ec86d2021c338bae2afa88699e84b8e0af523626654fe6f03a1748" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error 2.0.1", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "js-sys", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path 0.11.4", +] + +[[package]] +name = "tiny-skia" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path 0.12.0", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-skia-path" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "1.1.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.15+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom", + "petgraph", +] + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.3", +] + +[[package]] +name = "typed-path" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ec2755506471f54baf5e4bb5499d8e510cc1caf271270e778a736bd2d7336c" + +[[package]] +name = "typed-path" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde93ff05758a36a851a398a772b0b79a82fbe3c186a46f2696baaeaf84c966b" +dependencies = [ + "base64", + "flate2", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "ureq-proto", + "utf8-zero", +] + +[[package]] +name = "ureq-proto" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841583fc36089d7d59419568ae157f43a5a03a2e5a81ba87c77d1596ef46e922" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" +dependencies = [ + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "vello_common" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd" +dependencies = [ + "bytemuck", + "fearless_simd", + "guillotiere", + "log", + "peniko", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "vello_cpu" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9" +dependencies = [ + "bytemuck", + "glifo", + "hashbrown 0.17.1", + "vello_common", +] + +[[package]] +name = "verifysign" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6acfcc42a8d44f340d001193d97ef56bf33210b51ad760ae8308c97d5241ca51" +dependencies = [ + "core-foundation 0.10.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.6", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae7499dfd45780a0a91d7ee6bb9ac51970a4479a41a89da443fdda5a39547d42" +dependencies = [ + "async-trait", + "cast", + "js-sys", + "libm", + "minicov", + "nu-ansi-term", + "num-traits", + "oorandom", + "serde", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", + "wasm-bindgen-test-shared", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b84b5ac638bfb168196a1a461fcc8f46a294a18b1b6be52133b4e0db122cc9f" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "wasm-bindgen-test-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f692aa943ccd88363733b77063f32cfed5bc6cbea8e6e8b251b302f881606fe" + +[[package]] +name = "wasm-encoder" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2608e8bb6d67fd68f5a8d0eb1363d6e7bcbc1f8ded5a0bd3a1e382462b876b22" +dependencies = [ + "leb128fmt", + "wasmparser 0.261.0", +] + +[[package]] +name = "wasmi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78693fcdd618e0fc34af59c6b8efa9ac5d58c68df940beff4bedddb6acfe7c27" +dependencies = [ + "spin", + "wasmi_collections", + "wasmi_core", + "wasmi_ir", + "wasmparser 0.228.0", + "wat", +] + +[[package]] +name = "wasmi_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a8be2aa467cf2d29e96ff759472c36eeb44a3c81c67fc9cb76c9a24c519c557" +dependencies = [ + "string-interner", +] + +[[package]] +name = "wasmi_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69372d5fda3ea3d1e0aa6603c7888110e0187e88ea17cd8fc2e2df0a0e1f37fa" +dependencies = [ + "libm", +] + +[[package]] +name = "wasmi_ir" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f17b774caa13c618c7244f1ee51fe23c5e7b8538a471fa46d9949779758aed6" +dependencies = [ + "wasmi_core", +] + +[[package]] +name = "wasmparser" +version = "0.228.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4abf1132c1fdf747d56bbc1bb52152400c70f336870f968b85e89ea422198ae3" +dependencies = [ + "bitflags 2.13.2", + "indexmap", +] + +[[package]] +name = "wasmparser" +version = "0.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f20f20e44f7e8aeb6744823ea9d869ede51e51be4fdaedede2852282e54d2d8" +dependencies = [ + "bitflags 2.13.2", + "indexmap", +] + +[[package]] +name = "wast" +version = "261.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776443145731a4062e5b0d392892a2005909b6ab72d9fdc3cad53dd1a714e44a" +dependencies = [ + "bumpalo", + "leb128fmt", + "memchr", + "unicode-width", + "wasm-encoder", +] + +[[package]] +name = "wat" +version = "1.261.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b4d1a49ea73a8f3326e74e3a05db667001b16bd1035ed3356fc1a0ed05ca7f" +dependencies = [ + "wast", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml 0.41.0", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" +dependencies = [ + "jni 0.22.4", + "log", + "ndk-context", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bit-vec 0.9.1", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.10.0", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "ndk-sys", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-types", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-result 0.4.1", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections 0.2.0", + "windows-core 0.61.2", + "windows-future 0.2.1", + "windows-link 0.1.3", + "windows-numerics 0.2.0", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections 0.3.2", + "windows-core 0.62.2", + "windows-future 0.3.2", + "windows-numerics 0.3.1", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading 0.1.0", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading 0.2.1", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "git+https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc#a517b3846ee8457d84ee4975110bfda6797c44dc" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation 0.9.4", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit 0.19.2", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.55.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +dependencies = [ + "cfg-if", + "windows-sys 0.59.0", +] + +[[package]] +name = "winresource" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bc6d36480b829272a5bdabf08e6dca8004761c1da7e35efef800540c66221b" +dependencies = [ + "toml", + "version_check", +] + +[[package]] +name = "winsafe" +version = "0.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef0ffc427f045c0cc9ebffd6f4f91153dcd2a1547b5c3c29ee3f541e16e95c6" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 1.1.5", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" +dependencies = [ + "either", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xtask" +version = "0.24.1" +dependencies = [ + "chrono", + "pkg-config", + "serde_json", + "sha2", + "tempfile", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.5", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus-lockstep" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" +dependencies = [ + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus-lockstep-macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "zbus-lockstep", + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.6", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" +dependencies = [ + "serde", + "winnow", + "zvariant", +] + +[[package]] +name = "zbus_xml" +version = "5.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" +dependencies = [ + "serde", + "winnow", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +dependencies = [ + "serde", +] + +[[package]] +name = "zerocopy" +version = "0.8.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df92bf3d9227be3d53173901ddbffac2babc27ae50f397776ffd6dc33f800cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac4f328cf2f05d084e496c3e9c3f33ed0a183656a16e1fcec4d464d8373aec82" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "litemap", + "serde_core", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "zip" +version = "7.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc12baa6db2b15a140161ce53d72209dacea594230798c24774139b54ecaa980" +dependencies = [ + "crc32fast", + "indexmap", + "memchr", + "typed-path 0.12.4", +] + +[[package]] +name = "zip" +version = "9.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb" +dependencies = [ + "crc32fast", + "flate2", + "getrandom 0.4.3", + "indexmap", + "memchr", + "nix", + "typed-path 0.13.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.6", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.6", + "winnow", +] diff --git a/Cargo.toml b/Cargo.toml index 6f96cb012..08e34d741 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,260 +1,249 @@ -[workspace] -resolver = "3" -members = ["crates/*", "apps/*", "xtask"] -default-members = ["crates/*", "apps/*"] - -[workspace.package] -version = "0.23.1" -edition = "2024" -license = "MIT OR Apache-2.0" -rust-version = "1.95" -repository = "https://github.com/storytold/effectcraft" - -[workspace.dependencies] -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545", version = "=0.1.0", default-features = false, features = ["read"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" } -craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545" } -craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "ca1b5e2edb8568335c6c14f390307bd5beae8238" } -# craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1b34eba41e62138fc2438d2734523b302840b45d", features = ["egui"] } -# internal -effectcraft-time = { path = "crates/time" } -effectcraft-geom = { path = "crates/geom" } -effectcraft-color = { path = "crates/color" } -effectcraft-raster = { path = "crates/raster" } -effectcraft-path = { path = "crates/path" } -effectcraft-keyframe = { path = "crates/keyframe" } -effectcraft-project = { path = "crates/project" } -effectcraft-text = { path = "crates/text" } -effectcraft-effects = { path = "crates/effects" } -effectcraft-track = { path = "crates/track" } -effectcraft-segment = { path = "crates/segment" } -effectcraft-sam2 = { path = "crates/sam2" } -effectcraft-model = { path = "crates/model" } -effectcraft-render = { path = "crates/render" } -effectcraft-gpu = { path = "crates/gpu" } -effectcraft-media = { path = "crates/media" } -effectcraft-export = { path = "crates/export" } -effectcraft-expr = { path = "crates/expr" } -effectcraft-lottie = { path = "crates/lottie" } -effectcraft-interchange = { path = "crates/interchange" } -effectcraft-pdf = { path = "crates/pdf" } -effectcraft-psd = { path = "crates/psd" } -effectcraft-aep = { path = "crates/aep" } -effectcraft-vp9enc = { path = "crates/vp9enc" } -effectcraft-svg = { path = "crates/svg" } -effectcraft-engine = { path = "crates/engine" } -effectcraft-host = { path = "crates/host" } -effectcraft-ui-egui = { path = "crates/ui-egui" } -effectcraft-automation = { path = "crates/automation" } -effectcraft-opusenc = { path = "crates/opusenc" } -effectcraft-script = { path = "crates/script" } -effectcraft-hevcenc = { path = "crates/hevcenc" } -effectcraft-av1enc = { path = "crates/av1enc" } -effectcraft-plugin = { path = "crates/plugin" } -effectcraft-helper-host = { path = "crates/helper-host" } - -# foundation -thiserror = "2" -serde = { version = "1", features = ["derive", "rc"] } -serde_json = { version = "1", features = ["float_roundtrip"] } -log = "0.4" -# All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). -chrono = { version = "0.4.45", default-features = false, features = ["std"] } -rayon = "1" -# std::time::Instant/SystemTime on native; the browser clock on wasm32 (std's panic there). -web-time = "1" -gif = "0.14" -proptest = "1" - -# scripting (expressions) -boa_engine = { version = "0.22", default-features = false } -# WebAssembly effect plug-ins (sandboxed interpreter; MIT/Apache-2.0, pure Rust) -wasmi = { version = "2", default-features = false, features = ["std", "validate", "wat", "deterministic", "portable-dispatch"] } - -# geometry / fonts -kurbo = { version = "0.13", features = ["serde"] } -tiny-skia = { version = "0.12", default-features = false, features = ["std", "simd"] } -skrifa = { version = "0.44", default-features = false, features = ["std"] } -harfrust = { version = "0.12", default-features = false, features = ["std"] } -exr = "1.74" -image = { version = "0.25", default-features = false, features = ["png", "jpeg"] } -same-file = "1.0" -tempfile = "3.27" - -# media codecs + containers: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). -# Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. -filmcraft-codecs = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -# encoders + muxer (crates/export) -filmcraft-h264enc = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-prores = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-aac = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-isobmff = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -# container headers read for AAC channel layouts (crates/media) -filmcraft-matroska = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-mpegts = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -# decoder used as the round-trip oracle of effectcraft-opusenc (crates/export dev-dependency) -filmcraft-opus = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-vp9 = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -# decoders used as the round-trip oracles of effectcraft-hevcenc / effectcraft-av1enc (dev-dependencies only) -filmcraft-hevc = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-av1 = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -# timeline interchange (EDL, FCP7 XML, FCPXML, OTIO) for Premiere Pro interop (crates/interchange only) -filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } -filmcraft-geom = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } - -# gpu (the same wgpu eframe / egui-wgpu use) -wgpu = { version = "30.0.1", features = ["fragile-send-sync-non-atomic-wasm"] } -bytemuck = "1" -pollster = "1" -half = "2.7" - -# ui -# Shared frontend components; keep this dependency above the engine boundary. -# Shared UI and the complete egui family select reviewed immutable commits below. -craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545", features = ["serde"] } -# `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` -# and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. -egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } -eframe = { version = "0.37", default-features = false } -# Resizable table columns (About ▸ Contributors / Models); no image loaders. -egui_extras = { version = "0.37", default-features = false } -egui_kittest = "0.37" -rfd = "0.17" -cpal = "0.16" -# The operating system's interface language (MIT/Apache-2.0, no dependencies on desktop). -sys-locale = "0.3" - -# Local co-development against a FilmCraft checkout next to this repo: uncomment. -# [patch."https://github.com/storytold/filmcraft"] -# filmcraft-codecs = { path = "../filmcraft/crates/codecs" } -# filmcraft-media = { path = "../filmcraft/crates/media" } -# filmcraft-frame = { path = "../filmcraft/crates/frame" } -# filmcraft-color = { path = "../filmcraft/crates/color" } -# filmcraft-time = { path = "../filmcraft/crates/time" } -# filmcraft-h264enc = { path = "../filmcraft/crates/h264enc" } -# filmcraft-prores = { path = "../filmcraft/crates/prores" } -# filmcraft-aac = { path = "../filmcraft/crates/aac" } -# filmcraft-isobmff = { path = "../filmcraft/crates/isobmff" } -# filmcraft-matroska = { path = "../filmcraft/crates/matroska" } -# filmcraft-mpegts = { path = "../filmcraft/crates/mpegts" } - -[workspace.lints.rust] -unsafe_code = "forbid" - -[workspace.lints.clippy] -cognitive_complexity = "deny" -too_many_arguments = "deny" -wildcard_imports = "deny" -dbg_macro = "warn" -todo = "warn" -needless_range_loop = "allow" -type_complexity = "allow" - -[profile.dev.package."*"] -opt-level = 2 -debug = false - -[profile.dev] -opt-level = 1 -# Panics and backtraces keep file and line; full debug info only made the many test binaries large. -debug = "line-tables-only" - -# Same settings as `dev`, but with full debug info for interactive debugger sessions: local -# variables, parameters and column breakpoints work. Use `--profile dev-full` when debugging; -# everything else stays on the fast default. See CONTRIBUTING.md, "Setup". -[profile.dev-full] -inherits = "dev" -debug = true - -# Pixel hot loops: keep debug builds interactive. -[profile.dev.package.effectcraft-raster] -opt-level = 3 - -[profile.dev.package.effectcraft-render] -opt-level = 3 - -[profile.dev.package.effectcraft-gpu] -opt-level = 3 - -[profile.dev.package.effectcraft-effects] -opt-level = 3 - -[profile.dev.package.effectcraft-track] -opt-level = 3 - -[profile.dev.package.effectcraft-path] -opt-level = 3 - -[profile.dev.package.effectcraft-media] -opt-level = 3 - -[profile.dev.package.effectcraft-opusenc] -opt-level = 3 - -[profile.dev.package.effectcraft-export] -opt-level = 3 - -[profile.dev.package.effectcraft-vp9enc] -opt-level = 3 - -[profile.dev.package.effectcraft-hevcenc] -opt-level = 3 - -[profile.dev.package.effectcraft-av1enc] -opt-level = 3 - -# FilmCraft codec hot loops (same settings as FilmCraft's own workspace). -[profile.dev.package.filmcraft-h264] -opt-level = 3 - -[profile.dev.package.filmcraft-h264enc] -opt-level = 3 - -[profile.dev.package.filmcraft-hevc] -opt-level = 3 - -[profile.dev.package.filmcraft-vp9] -opt-level = 3 - -[profile.dev.package.filmcraft-prores] -opt-level = 3 - -[profile.dev.package.filmcraft-dnx] -opt-level = 3 - -[profile.dev.package.filmcraft-av1] -opt-level = 3 - -[profile.dev.package.filmcraft-aac] -opt-level = 3 - -[profile.dev.package.filmcraft-opus] -opt-level = 3 - -[profile.release] -lto = "thin" -codegen-units = 1 - -[patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545", version = "=0.3.0" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } -# Patch a crate only together with the dependency that needs it: an unused patch makes the Nix -# build, which uses vendored sources, fail (`cargo xtask lock-patches`). -winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } +[workspace] +resolver = "3" +members = ["crates/*", "apps/*", "xtask"] +default-members = ["crates/*", "apps/*"] + +[workspace.package] +version = "0.24.1" +edition = "2024" +license = "MIT OR Apache-2.0" +rust-version = "1.95" +repository = "https://github.com/storytold/effectcraft" + +[workspace.dependencies] +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.1.0", default-features = false, features = ["read"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["stl", "obj", "gltf", "fbx"] } +craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" } +# craft-update: app-specific pretend versions apply to startup and manual checks. +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["egui"] } +# internal +effectcraft-time = { path = "crates/time" } +effectcraft-geom = { path = "crates/geom" } +effectcraft-color = { path = "crates/color" } +effectcraft-raster = { path = "crates/raster" } +effectcraft-path = { path = "crates/path" } +effectcraft-keyframe = { path = "crates/keyframe" } +effectcraft-project = { path = "crates/project" } +effectcraft-text = { path = "crates/text" } +effectcraft-effects = { path = "crates/effects" } +effectcraft-track = { path = "crates/track" } +effectcraft-segment = { path = "crates/segment" } +effectcraft-sam2 = { path = "crates/sam2" } +effectcraft-model = { path = "crates/model" } +effectcraft-render = { path = "crates/render" } +effectcraft-gpu = { path = "crates/gpu" } +effectcraft-media = { path = "crates/media" } +effectcraft-export = { path = "crates/export" } +effectcraft-expr = { path = "crates/expr" } +effectcraft-lottie = { path = "crates/lottie" } +effectcraft-interchange = { path = "crates/interchange" } +effectcraft-pdf = { path = "crates/pdf" } +effectcraft-psd = { path = "crates/psd" } +effectcraft-aep = { path = "crates/aep" } +effectcraft-svg = { path = "crates/svg" } +effectcraft-engine = { path = "crates/engine" } +effectcraft-host = { path = "crates/host" } +effectcraft-ui-egui = { path = "crates/ui-egui" } +effectcraft-automation = { path = "crates/automation" } +effectcraft-opusenc = { path = "crates/opusenc" } +effectcraft-script = { path = "crates/script" } +effectcraft-plugin = { path = "crates/plugin" } +effectcraft-helper-host = { path = "crates/helper-host" } + +# foundation +thiserror = "2" +serde = { version = "1", features = ["derive", "rc"] } +serde_json = { version = "1", features = ["float_roundtrip"] } +log = "0.4" +# All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). +chrono = { version = "0.4.45", default-features = false, features = ["std"] } +rayon = "1" +# std::time::Instant/SystemTime on native; the browser clock on wasm32 (std's panic there). +web-time = "1" +gif = "0.14" +proptest = "1" + +# scripting (expressions) +boa_engine = { version = "0.22", default-features = false } +# WebAssembly effect plug-ins (sandboxed interpreter; MIT/Apache-2.0, pure Rust) +wasmi = { version = "2", default-features = false, features = ["std", "validate", "wat", "deterministic", "portable-dispatch"] } + +# geometry / fonts +kurbo = { version = "0.13", features = ["serde"] } +tiny-skia = { version = "0.12", default-features = false, features = ["std", "simd"] } +skrifa = { version = "0.44", default-features = false, features = ["std"] } +harfrust = { version = "0.12", default-features = false, features = ["std"] } +exr = "1.74" +image = { version = "0.25", default-features = false, features = ["png", "jpeg"] } +same-file = "1.0" +tempfile = "3.27" + +# codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev. +craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["isobmff", "matroska"] } +craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] } +craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] } + +# footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001). +# Only `crates/media`, `crates/export` and `crates/interchange` may depend on these. +filmcraft-codecs = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-media = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-frame = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-color = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-time = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +# MPEG TS / PS headers read for AAC channel layouts (crates/media); craft-media has no MPEG TS reader +filmcraft-mpegts = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +# decoders used as the round-trip oracles of craft-video's VP9, HEVC and AV1 encoders (crates/export +# dev-dependencies only); craft-video has no decoder for them +filmcraft-vp9 = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-hevc = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-av1 = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +# timeline interchange (EDL, FCP7 XML, FCPXML, OTIO) for Premiere Pro interop (crates/interchange only) +filmcraft-interchange = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-project = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } +filmcraft-geom = { git = "https://github.com/storytold/filmcraft", rev = "d5ead4ba1ee2f1cd13cb86a4239aee2730a3d9f5" } + +# gpu (the same wgpu eframe / egui-wgpu use) +wgpu = { version = "30.0.1", features = ["fragile-send-sync-non-atomic-wasm"] } +bytemuck = "1" +pollster = "1" +half = "2.7" + +# ui +# Shared frontend components; keep this dependency above the engine boundary. +# Shared UI and the complete egui family select reviewed immutable commits below. +craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["serde"] } +# `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()` +# and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate. +egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] } +eframe = { version = "0.37", default-features = false } +# Resizable table columns (About ▸ Contributors / Models); no image loaders. +egui_extras = { version = "0.37", default-features = false } +egui_kittest = "0.37" +rfd = "0.17" +cpal = "0.16" +# The operating system's interface language (MIT/Apache-2.0, no dependencies on desktop). +sys-locale = "0.3" + +# Local co-development against a FilmCraft checkout next to this repo: uncomment. +# [patch."https://github.com/storytold/filmcraft"] +# filmcraft-codecs = { path = "../filmcraft/crates/codecs" } +# filmcraft-media = { path = "../filmcraft/crates/media" } +# filmcraft-frame = { path = "../filmcraft/crates/frame" } +# filmcraft-color = { path = "../filmcraft/crates/color" } +# filmcraft-time = { path = "../filmcraft/crates/time" } +# filmcraft-mpegts = { path = "../filmcraft/crates/mpegts" } + +[workspace.lints.rust] +unsafe_code = "forbid" + +[workspace.lints.clippy] +cognitive_complexity = "deny" +too_many_arguments = "deny" +wildcard_imports = "deny" +dbg_macro = "warn" +todo = "warn" +needless_range_loop = "allow" +type_complexity = "allow" + +[profile.dev.package."*"] +opt-level = 2 +debug = false + +[profile.dev] +opt-level = 1 +# Panics and backtraces keep file and line; full debug info only made the many test binaries large. +debug = "line-tables-only" + +# Same settings as `dev`, but with full debug info for interactive debugger sessions: local +# variables, parameters and column breakpoints work. Use `--profile dev-full` when debugging; +# everything else stays on the fast default. See CONTRIBUTING.md, "Setup". +[profile.dev-full] +inherits = "dev" +debug = true + +# Pixel hot loops: keep debug builds interactive. +[profile.dev.package.effectcraft-raster] +opt-level = 3 + +[profile.dev.package.effectcraft-render] +opt-level = 3 + +[profile.dev.package.effectcraft-gpu] +opt-level = 3 + +[profile.dev.package.effectcraft-effects] +opt-level = 3 + +[profile.dev.package.effectcraft-track] +opt-level = 3 + +[profile.dev.package.effectcraft-path] +opt-level = 3 + +[profile.dev.package.effectcraft-media] +opt-level = 3 + +[profile.dev.package.effectcraft-opusenc] +opt-level = 3 + +[profile.dev.package.effectcraft-export] +opt-level = 3 + +# craft-libs codec hot loops. +[profile.dev.package.craft-video] +opt-level = 3 + +[profile.dev.package.craft-audio] +opt-level = 3 + +[profile.dev.package.craft-media] +opt-level = 3 + +# FilmCraft codec hot loops (same settings as FilmCraft's own workspace). +[profile.dev.package.filmcraft-h264] +opt-level = 3 + +[profile.dev.package.filmcraft-hevc] +opt-level = 3 + +[profile.dev.package.filmcraft-vp9] +opt-level = 3 + +[profile.dev.package.filmcraft-dnx] +opt-level = 3 + +[profile.dev.package.filmcraft-av1] +opt-level = 3 + +[profile.release] +lto = "thin" +codegen-units = 1 + +[patch.crates-io] +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.3.0" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } +# Patch a crate only together with the dependency that needs it: an unused patch makes the Nix +# build, which uses vendored sources, fail (`cargo xtask lock-patches`). +winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } diff --git a/LICENSE-APACHE b/LICENSE-APACHE index f433b1a53..ade750b16 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -1,177 +1,177 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/LICENSE-MIT b/LICENSE-MIT index 633fe3051..86fac3264 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NOTICE b/NOTICE index 4a79e69fd..efb0eb7cd 100644 --- a/NOTICE +++ b/NOTICE @@ -1,322 +1,322 @@ -EffectCraft -Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors. -Licensed under the MIT License or the Apache License, Version 2.0, at your option -(LICENSE-MIT, LICENSE-APACHE). - -The ArtCraft name, wordmark and logos in docs/brand/ are trademarks of the ArtCraft Team. They are -not open source and are not covered by the license above; their terms are in -docs/brand/LICENSE-brand.txt. - -Third-party material - -This product bundles third-party material under its own licenses, listed below. The per-file -list (author, source, license) is in ATTRIBUTION.md. - -Bundled fonts - -EffectCraft embeds Inter, Noto Serif, JetBrains Mono and Noto Sans Symbols 2 from -assets/fonts/. The pinned egui dependency (epaint_default_fonts, revision -6d518fc799681571963842f95b55a6b68431b15a) additionally embeds Ubuntu Light, Hack, -Noto Emoji, egui-icons and emoji-icon-font through EffectCraft's enabled `default_fonts` -and `monochrome_emoji_fonts` features; no font file from that dependency is added to -this repository. The complete copyright notices and licence texts required for all of -these fonts follow. - -The optional PDF document reader uses craft-pdf and Hayro-syntax 0.7.2, MIT OR Apache-2.0. -The shared patched syntax source is centralized in storytold/craft-libs, transferred from -PdfCraft revision 9ed3abe4907a127d36b12fbfeee71d7e26248da1. This parser-only use embeds no -Hayro fonts, CMaps or image codecs; EffectCraft keeps its existing fonts and drawing filters. - -Linux Wayland window decorations -------------------------------- -sctk-adwaita 0.10.1 (https://github.com/PolyMeilex/sctk-adwaita, -commit d5f343c45c04d4a026db57f76760819b7325db00) is used by winit on Linux -for vector window controls. Its title-font features are disabled: no Cantarell -font is embedded by this dependency and no font file is added to this repo. - -sctk-adwaita's MIT licence: - -MIT License - -Copyright (c) 2022 Bartłomiej Maryńczak - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -SIL Open Font License 1.1 - -Applies to Inter (assets/fonts/Inter-*.ttf), Noto Serif (assets/fonts/NotoSerif-Regular.ttf), -JetBrains Mono (assets/fonts/JetBrainsMono-Regular.ttf), Noto Sans Symbols 2 -(assets/fonts/NotoSansSymbols2-Regular.ttf) and Noto Emoji (NotoEmoji-Regular.ttf). -Copyright notices: - -Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter) -Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic) -Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) -Copyright 2022 The Noto Project Authors (https://github.com/notofonts/symbols) -Copyright 2013 Google Inc. All Rights Reserved. - -The fonts in assets/fonts/ also keep their upstream licence files at -assets/fonts/OFL-.txt. The complete licence text follows. - -This Font Software is licensed under the SIL Open Font License, -Version 1.1. - -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font -creation efforts of academic and linguistic communities, and to -provide a free and open framework in which fonts may be shared and -improved in partnership with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply to -any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software -components as distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, -deleting, or substituting -- in part or in whole -- any of the -components of the Original Version, by changing formats or by porting -the Font Software to a new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, -modify, redistribute, and sell modified and unmodified copies of the -Font Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, in -Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the -corresponding Copyright Holder. This restriction only applies to the -primary font name as presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created using -the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. - -Ubuntu Font Licence 1.0 - -Applies to Ubuntu Light (Ubuntu-Light.ttf). Copyright notice: - -Copyright 2011 Canonical Ltd. Licensed under the Ubuntu Font Licence 1.0 - -------------------------------- -UBUNTU FONT LICENCE Version 1.0 -------------------------------- - -PREAMBLE -This licence allows the licensed fonts to be used, studied, modified and -redistributed freely. The fonts, including any derivative works, can be -bundled, embedded, and redistributed provided the terms of this licence -are met. The fonts and derivatives, however, cannot be released under -any other licence. The requirement for fonts to remain under this -licence does not require any document created using the fonts or their -derivatives to be published under this licence, as long as the primary -purpose of the document is not to be a vehicle for the distribution of -the fonts. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this licence and clearly marked as such. This may -include source files, build scripts and documentation. - -"Original Version" refers to the collection of Font Software components -as received under this licence. - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to -a new environment. - -"Copyright Holder(s)" refers to all individuals and companies who have a -copyright ownership of the Font Software. - -"Substantially Changed" refers to Modified Versions which can be easily -identified as dissimilar to the Font Software by users of the Font -Software comparing the Original Version with the Modified Version. - -To "Propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification and with or without charging -a redistribution fee), making available to the public, and in some -countries other activities as well. - -PERMISSION & CONDITIONS -This licence does not grant any rights under trademark law and all such -rights are reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of the Font Software, to propagate the Font Software, subject to -the below conditions: - -1) Each copy of the Font Software must contain the above copyright -notice and this licence. These can be included either as stand-alone -text files, human-readable headers or in the appropriate machine- -readable metadata fields within text or binary files as long as those -fields can be easily viewed by the user. - -2) The font name complies with the following: -(a) The Original Version must retain its name, unmodified. -(b) Modified Versions which are Substantially Changed must be renamed to -avoid use of the name of the Original Version or similar names entirely. -(c) Modified Versions which are not Substantially Changed must be -renamed to both (i) retain the name of the Original Version and (ii) add -additional naming elements to distinguish the Modified Version from the -Original Version. The name of such Modified Versions must be the name of -the Original Version, with "derivative X" where X represents the name of -the new work, appended to that name. - -3) The name(s) of the Copyright Holder(s) and any contributor to the -Font Software shall not be used to promote, endorse or advertise any -Modified Version, except (i) as required by this licence, (ii) to -acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with -their explicit written permission. - -4) The Font Software, modified or unmodified, in part or in whole, must -be distributed entirely under this licence, and must not be distributed -under any other licence. The requirement for fonts to remain under this -licence does not affect any document created using the Font Software, -except any version of the Font Software extracted from a document -created using the Font Software may only be distributed under this -licence. - -TERMINATION -This licence becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF -COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER -DEALINGS IN THE FONT SOFTWARE. - -Hack: MIT License and Bitstream Vera License - -Applies to Hack (Hack-Regular.ttf). Upstream notice and both licence texts: - -The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License - -The work in the DejaVu project was committed to the public domain. - -Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera" -MIT License - -Copyright (c) 2018 Source Foundry Authors - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -BITSTREAM VERA LICENSE - -Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: - -The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces. - -The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera". - -This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names. - -The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. - -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. - -Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org. - -MIT License (egui-icons and emoji-icon-font) - -Applies to egui-icons.ttf, a five-glyph subset of emoji-icon-font, and the parent -emoji-icon-font.ttf, both by John Slegers, https://github.com/jslegers/emoji-icon-font. - -MIT License - -Copyright (c) 2014 John Slegers - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +EffectCraft +Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors. +Licensed under the MIT License or the Apache License, Version 2.0, at your option +(LICENSE-MIT, LICENSE-APACHE). + +The ArtCraft name, wordmark and logos in docs/brand/ are trademarks of the ArtCraft Team. They are +not open source and are not covered by the license above; their terms are in +docs/brand/LICENSE-brand.txt. + +Third-party material + +This product bundles third-party material under its own licenses, listed below. The per-file +list (author, source, license) is in ATTRIBUTION.md. + +Bundled fonts + +EffectCraft embeds Inter, Noto Serif, JetBrains Mono and Noto Sans Symbols 2 from +assets/fonts/. The pinned egui dependency (epaint_default_fonts, revision +6d518fc799681571963842f95b55a6b68431b15a) additionally embeds Ubuntu Light, Hack, +Noto Emoji, egui-icons and emoji-icon-font through EffectCraft's enabled `default_fonts` +and `monochrome_emoji_fonts` features; no font file from that dependency is added to +this repository. The complete copyright notices and licence texts required for all of +these fonts follow. + +The optional PDF document reader uses craft-pdf and Hayro-syntax 0.7.2, MIT OR Apache-2.0. +The shared patched syntax source is centralized in storytold/craft-libs, transferred from +PdfCraft revision 9ed3abe4907a127d36b12fbfeee71d7e26248da1. This parser-only use embeds no +Hayro fonts, CMaps or image codecs; EffectCraft keeps its existing fonts and drawing filters. + +Linux Wayland window decorations +------------------------------- +sctk-adwaita 0.10.1 (https://github.com/PolyMeilex/sctk-adwaita, +commit d5f343c45c04d4a026db57f76760819b7325db00) is used by winit on Linux +for vector window controls. Its title-font features are disabled: no Cantarell +font is embedded by this dependency and no font file is added to this repo. + +sctk-adwaita's MIT licence: + +MIT License + +Copyright (c) 2022 Bartłomiej Maryńczak + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +SIL Open Font License 1.1 + +Applies to Inter (assets/fonts/Inter-*.ttf), Noto Serif (assets/fonts/NotoSerif-Regular.ttf), +JetBrains Mono (assets/fonts/JetBrainsMono-Regular.ttf), Noto Sans Symbols 2 +(assets/fonts/NotoSansSymbols2-Regular.ttf) and Noto Emoji (NotoEmoji-Regular.ttf). +Copyright notices: + +Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter) +Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic) +Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) +Copyright 2022 The Noto Project Authors (https://github.com/notofonts/symbols) +Copyright 2013 Google Inc. All Rights Reserved. + +The fonts in assets/fonts/ also keep their upstream licence files at +assets/fonts/OFL-.txt. The complete licence text follows. + +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +Ubuntu Font Licence 1.0 + +Applies to Ubuntu Light (Ubuntu-Light.ttf). Copyright notice: + +Copyright 2011 Canonical Ltd. Licensed under the Ubuntu Font Licence 1.0 + +------------------------------- +UBUNTU FONT LICENCE Version 1.0 +------------------------------- + +PREAMBLE +This licence allows the licensed fonts to be used, studied, modified and +redistributed freely. The fonts, including any derivative works, can be +bundled, embedded, and redistributed provided the terms of this licence +are met. The fonts and derivatives, however, cannot be released under +any other licence. The requirement for fonts to remain under this +licence does not require any document created using the fonts or their +derivatives to be published under this licence, as long as the primary +purpose of the document is not to be a vehicle for the distribution of +the fonts. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this licence and clearly marked as such. This may +include source files, build scripts and documentation. + +"Original Version" refers to the collection of Font Software components +as received under this licence. + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to +a new environment. + +"Copyright Holder(s)" refers to all individuals and companies who have a +copyright ownership of the Font Software. + +"Substantially Changed" refers to Modified Versions which can be easily +identified as dissimilar to the Font Software by users of the Font +Software comparing the Original Version with the Modified Version. + +To "Propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification and with or without charging +a redistribution fee), making available to the public, and in some +countries other activities as well. + +PERMISSION & CONDITIONS +This licence does not grant any rights under trademark law and all such +rights are reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to propagate the Font Software, subject to +the below conditions: + +1) Each copy of the Font Software must contain the above copyright +notice and this licence. These can be included either as stand-alone +text files, human-readable headers or in the appropriate machine- +readable metadata fields within text or binary files as long as those +fields can be easily viewed by the user. + +2) The font name complies with the following: +(a) The Original Version must retain its name, unmodified. +(b) Modified Versions which are Substantially Changed must be renamed to +avoid use of the name of the Original Version or similar names entirely. +(c) Modified Versions which are not Substantially Changed must be +renamed to both (i) retain the name of the Original Version and (ii) add +additional naming elements to distinguish the Modified Version from the +Original Version. The name of such Modified Versions must be the name of +the Original Version, with "derivative X" where X represents the name of +the new work, appended to that name. + +3) The name(s) of the Copyright Holder(s) and any contributor to the +Font Software shall not be used to promote, endorse or advertise any +Modified Version, except (i) as required by this licence, (ii) to +acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with +their explicit written permission. + +4) The Font Software, modified or unmodified, in part or in whole, must +be distributed entirely under this licence, and must not be distributed +under any other licence. The requirement for fonts to remain under this +licence does not affect any document created using the Font Software, +except any version of the Font Software extracted from a document +created using the Font Software may only be distributed under this +licence. + +TERMINATION +This licence becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. + +Hack: MIT License and Bitstream Vera License + +Applies to Hack (Hack-Regular.ttf). Upstream notice and both licence texts: + +The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License + +The work in the DejaVu project was committed to the public domain. + +Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera" +MIT License + +Copyright (c) 2018 Source Foundry Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +BITSTREAM VERA LICENSE + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: + +The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera". + +This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names. + +The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org. + +MIT License (egui-icons and emoji-icon-font) + +Applies to egui-icons.ttf, a five-glyph subset of emoji-icon-font, and the parent +emoji-icon-font.ttf, both by John Slegers, https://github.com/jslegers/emoji-icon-font. + +MIT License + +Copyright (c) 2014 John Slegers + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 913f8aa06..6aa5e5ce4 100644 --- a/README.md +++ b/README.md @@ -1,399 +1,399 @@ -

- - - - ArtCraft - - -

- - -

- EffectCraft icon: an engraved unicorn on a pink tile -

- -

EffectCraft

- -

- Motion graphics and visual effects; an open-source, professional motion graphics and visual effects studio, built in pure Rust. -

- -

- A free, open-source compositor: compositions, layers, - keyframes, 308 effects, layer styles, expressions, 3D cameras and lights, and a render queue, native on macOS, - Windows and Linux, and in the browser. Young, moving fast, and already usable. -

- -

- Status: young and moving fast - Written in Rust - License: MIT OR Apache-2.0 -
- Scanned by SonarCloud - Reviewed by CodeRabbit -

- -

- Join the ArtCraft community on Discord -

- -

- EffectCraft on getartcraft.com · - ArtCraft · - All Crafting Apps -

- -
- -

- EffectCraft's main window: the animated demo composition in the Composition panel, the Project panel, a Timeline with text, shape and solid layers, and the Properties panel showing the selected text layer's transform, font and paragraph settings -

- -> [!NOTE] -> **ArtCraft is a community of artists from all walks of life.** Digital, generative, music, -> games — if you make things, you're one of us. **[Come say hi on Discord](https://discord.gg/artcraft).** - -

- What it is · - Animate · - Effects · - 3D · - Export · - Agents · - Get started · - Status · - How it's made · - Downloads · - The Crafting Apps · - License -

- -## What EffectCraft is - -EffectCraft is for animated titles, motion graphics and compositing work: the kind of thing -motion designers and VFX artists need. You build a composition out of layers (solids, shapes, -text, footage, other compositions), animate their properties with keyframes, stack effects on -them and render the result. - -The interface feels natural and responsive, with dedicated panels (Project, Composition, Timeline, -Layer, Footage, Effect Controls, Tools, Preview, Effects & Presets, Audio, Info, Paragraph, -Character, Align, Progress, Render Queue) and standard motion graphics shortcuts, going further in -a few places where it matters to us: - -- **Lottie import and export built in**, so animations can go straight to the web and apps - without a plugin. -- **A project file you can read.** Projects are versioned JSON (`.ecproj`), so they diff cleanly - in version control. -- **Everything is scriptable.** Menu actions, timeline edits and property changes are exposed as - commands. Engine commands are available through the CLI, JSON control channel and MCP; - UI-only commands use the frontend dispatcher and can be invoked through the control channel - or an attached MCP bridge. -- **No FFmpeg.** Video and audio decoding and encoding are pure Rust: FilmCraft's codecs and - EffectCraft's own VP9, AV1, HEVC and Opus encoders. - -## Animate - -The panels, menus and shortcuts follow standard motion design conventions: -Project, Composition, Timeline, Effect Controls, Properties, Effects & Presets, Character, -Paragraph, Align, Info, Preview, Audio and the Render Queue, docked the way you expect. Drag -footage, comps and effects between them: onto the comp viewer, where they land under the pointer, -or into the Timeline, between layers and at the time you point to. - -- **Layers of every kind:** solids, shapes, text, footage, nested compositions, nulls, - adjustment layers, cameras and lights; parenting, track mattes, all 38 blend modes, motion blur. -- **Keyframes that behave the same:** linear, Bezier, hold, auto and continuous Bezier, roving - keys, Easy Ease (F9), Keyframe Velocity and Interpolation dialogs, copy and paste at the current - time, and a **Graph Editor** with value and speed graphs and draggable handles. -- **Time:** time remapping, time stretch, time-reverse, freeze frame, work area, markers, exact - frame-accurate timing at every frame rate including 29.97 drop-frame. -- **Shapes and masks:** shape layers with trim paths, repeaters, round corners, offset, zig zag, - twist, wiggle, merge paths and gradient strokes; masks drawn with the pen tool, with modes, - feather, expansion and vertex editing in the viewer. -- **Text:** point and paragraph text with real shaping in any font installed on your machine, the - Character and Paragraph panels, and text animators with range selectors. -- **Expressions:** JavaScript with the standard motion expressions model (`wiggle`, `loopOut`, - `thisComp.layer("…")`, vector maths on arrays), an inline editor and the pick-whip. -- **Timeline like you know it:** twirl layers open to Transform, masks, effects and the rest; drag - rows to reorder layers; rename with Enter or a double-click; the property shortcuts (A, P, S, - R, T, M, F, E, L, U and their double presses AA, PP, SS, RR, TT, MM, FF, EE, LL, UU), Shift to - add properties, Alt+Shift+A/P/S/R/T to key the current time, Ctrl+` to twirl selected layers. -- **Puppet tools:** Position, Advanced, Bend, Starch and Overlap pins on a mesh built from the - layer, real-time pin recording, rotate/scale handles, pins driven by (or carrying) nulls for - rigging, and follow-through for hair and cloth. - -

- The Graph Editor showing an eased value curve for a text animator's Range Start, with the graph editor's button bar for hold, linear, auto Bezier and Easy Ease -

- -## Effects - -308 built-in effects across its categories, each with its parameter names, order and -defaults: blur and sharpen, channel, color correction (Curves, Levels, Hue/Saturation, a full -color-grading panel…), distort (Warp, Bulge, Turbulent Displace, Perspective Pin…), generate (Fractal Noise, -Gradient Ramp, Stroke, Write-on, Audio Spectrum…), keying, matte, noise and grain, perspective, -**simulation** (Particle Emitter 3D, Rainfall, Shatter, Card Dance, Caustics, Wave World…), -stylize (Glow, Glass Relief…), **time** (Echo, Posterize Time, Timewarp, Time Displacement…), -**audio** (Reverb, Parametric EQ, Delay, Stereo Mixer…), text, transitions, utility and expression -controls. All nine **Layer Styles** (Drop Shadow, Inner/Outer Glow, Bevel and Emboss, Satin, -overlays, Stroke) with Global Light. Preview plays audio in sync, with meters and waveforms. - -## 3D - -Classic 3D compositing: 3D layers with orientation and material options, -one- and two-node **cameras** with depth of field, **lights** (parallel, spot, point, ambient) -with soft ray-traced shadows, layers that intersect correctly, orbit, pan and dolly camera -tools, and Front, Top, Left and Custom views. - -

- The 3D Showcase demo in Custom View 1: intersecting cards lit by a spot light with soft shadows on a gridded floor, with the camera frustum and light drawn as wireframes -

- -## Export - -A dedicated Render Queue, with Render Settings and Output Modules: **H.264** MP4 and -**ProRes** MOV (Proxy to 4444 XQ with alpha) with audio, **HEVC** (Main / Main 10) and **AV1** -MP4, **WebM** (VP9 with inter frames and alpha, or AV1; Opus audio), PNG, JPEG, TIFF, Targa and 32-bit EXR sequences, animated GIF and WAV/AIFF. Field -rendering with 3:2 pulldown, effect/solo/guide/depth overrides, crop, region of interest and -resize, Render Settings and Output Module templates with defaults, post-render actions, storage -overflow and render logs. The same queue runs from the command line. Every encoder is pure -Rust (FilmCraft's H.264, ProRes and AAC; EffectCraft's own VP9, AV1, HEVC and Opus); there is no -FFmpeg inside. - -**Lottie** goes both ways: File ▸ Export ▸ Lottie JSON… writes a composition (precomps, shape, -solid, image, text and null layers, eased and spatial keyframes, masks, track mattes, blend -modes, time remapping, optionally expressions) as `.json` or `.lottie`, and lists anything Lottie -cannot express; File ▸ Import ▸ Lottie… opens one as a new composition. - -

- The Render Queue panel with two compositions queued -

- -## Built for agents - -Engine commands are available through the CLI, JSON control channel and MCP. UI-only commands -need the running app's frontend dispatcher: complete menu access requires the app's control -channel or an attached MCP bridge. Headless MCP sessions expose supported engine commands, -but not UI-only commands or bridge-only `ui_*` tools. - -- **MCP server:** `effectcraft-cli mcp` speaks the Model Context Protocol over stdio, headless - or bridged to the running app (`--bridge 9877`). Tools cover commands, the project and property - tree, keyframes and rendered frames. This repository ships a ready [`.mcp.json`](.mcp.json). -- **Command line:** one-shot calls with JSON output, for example - `effectcraft-cli set Main '#1' transform/position '[100,360]' --time 0 main.ecproj --save` - or `effectcraft-cli render --comp Main --out main.mp4`, or - `effectcraft-cli exec file.exportLottie '{"comp":"Main","path":"main.json"}' main.ecproj`. -- **Control channel:** `effectcraft --control 9877` accepts JSON lines to run commands, inspect - and click any widget by its automation id, and take screenshots. - -See [docs/agents.md](docs/agents.md) and [docs/control-protocol.md](docs/control-protocol.md). - -## Get started - -Installers for each version are on the [Releases](https://github.com/storytold/effectcraft/releases) -page: a universal macOS app; Windows MSIs and portable zips for x64, x86 and ARM64; Linux -AppImage, Flatpak, deb, rpm and tar.gz for x86_64 and aarch64, plus a riscv64 tar.gz; a FreeBSD x86_64 tarball; and the -web build. [Downloads](#downloads) lists every file. The Windows ARM64 build runs natively on -Windows on ARM, without x64 emulation. CI installs that MSI on Windows 11 ARM64 hardware, checks -both programs are ARM64 and runs the command-line tool there, but it doesn't open the app's window -or run the test suite natively on ARM64 yet, so please report anything that behaves differently. - -On Gentoo, the community [::snakebyte overlay](https://github.com/switch87/snakebyte-overlay) packages -the Linux release as `media-video/effectcraft-bin` (not maintained by the EffectCraft team): - -```sh -eselect repository add snakebyte git https://github.com/switch87/snakebyte-overlay.git -emaint sync -r snakebyte -echo 'media-video/effectcraft-bin ~amd64' >> /etc/portage/package.accept_keywords/effectcraft -emerge --ask media-video/effectcraft-bin -``` - -To build it yourself you need [Rust](https://rustup.rs/) 1.95 or newer. - -```sh -git clone https://github.com/storytold/effectcraft -cd effectcraft -cargo run --release -p effectcraft # the app (add `-- --demo` to open the demo project) -cargo run --release -p effectcraft-cli -- render --out intro.mp4 # render the demo headless -cargo xtask web --serve 8765 # the browser build on http://127.0.0.1:8765/ (docs/web.md) -``` - -New to it? [docs/footage.md](docs/footage.md) covers importing footage and image sequences and -Interpret Footage. - -To work on it: `cargo test --workspace`, and `cargo xtask ci` before every commit (format, lints, -tests, layering, asset attribution and the WebAssembly build). See [CONTRIBUTING.md](CONTRIBUTING.md), -[docs/architecture.md](docs/architecture.md) and [docs/testing.md](docs/testing.md). - -## Where it stands - -EffectCraft is young: its first commit was on 1 October 2026. A comprehensive feature set -exists, including 308 effects, but breadth is not the same as full maturity across every edge -case. Today it's a good place to try things and to tell us what breaks. It isn't yet recommended -for production client work. In particular: - -- **Native project format.** Projects are saved as `.ecproj`, readable versioned JSON. Proprietary - project formats and After Effects SDK plug-ins are not supported. -- **Fidelity is still being refined.** Automated rendering tests currently focus on small - compositions, so please report visual discrepancies or unexpected behaviour. -- **macOS is the most tested platform.** Linux and Windows users have hit basic interaction - bugs, which we're fixing first. -- **The trained models are new.** Roto Brush can use MobileSAM (an optional 40 MB download in - Settings ▸ Roto Brush) and face tracking can use Google's MediaPipe Face Landmarker (an optional - 3.8 MB download in Settings ▸ Face Tracking). Both are actively undergoing evaluation and tuning. - -EffectCraft is in **alpha**: about 91% of the features tracked in -[docs/target-app-parity.md](docs/target-app-parity.md) exist, and we estimate it is about 45% of the -way to being ready for full professional production work. The [ROADMAP](ROADMAP.md) has the plan, -[docs/target-app-parity.md](docs/target-app-parity.md) the measurement and [docs/gaps.md](docs/gaps.md) -every known shortfall. The web build ([docs/web.md](docs/web.md)) runs the full app in the browser. -[Bug reports](https://github.com/storytold/effectcraft/issues) are the most useful thing you can -send us right now. - -## How it's made - -- **Engine first.** A stack of small crates with strict layering. The interface (egui) sits on - top and nothing underneath depends on it. -- **Clean room.** We work from public documentation and observable behavior, never - from proprietary files, icons, presets or code. No code is copied from GPL projects. The full rules - are in [AGENTS.md](AGENTS.md). -- **Private by default.** No telemetry, and no network access unless you ask for it. -- **One family.** EffectCraft shares its time model and text engine design with FilmCraft, and - gets its video and audio codecs from it. - -## Downloads - -**New to EffectCraft?** Download it from the [EffectCraft page on getartcraft.com](https://getartcraft.com/apps/effectcraft). That's the easiest way to install it. - -**Want a specific build or format?** On GitHub, the [latest release](https://github.com/storytold/effectcraft/releases/latest) has every build listed below, and [all releases](https://github.com/storytold/effectcraft/releases) has earlier versions and their notes. `` in the file names is the version number, and `SHA256SUMS.txt` lists a checksum for every file. - -### Windows - -| Build | Installer | Portable | -|---|---|---| -| x64 (64-bit Intel/AMD) | `effectcraft--windows-x64.msi` | `effectcraft--windows-x64-portable.zip` | -| arm64 (Snapdragon and other ARM PCs) | `effectcraft--windows-arm64.msi` | `effectcraft--windows-arm64-portable.zip` | -| x86 (32-bit) | `effectcraft--windows-x86.msi` | `effectcraft--windows-x86-portable.zip` | - -Installers and executables are code-signed. The installer asks who to install EffectCraft for and where. By default it installs for your -account only, into `%LOCALAPPDATA%\Programs\ArtCraft\EffectCraft`, without an administrator prompt; -"Everyone on this computer" installs into `C:\Program Files\ArtCraft\EffectCraft` (`Program Files (x86)` for the 32-bit build). Later versions -install into the same folder. To install silently -into a folder of your choice: `msiexec /i effectcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\EffectCraft"`. -A silent install is per-user by default. `INSTALLFOLDER` chooses the folder, not who it is installed for; -add `ALLUSERS=1`, from an elevated terminal or deployment tool, for an all-users install. - -### macOS - -| Build | File | Notes | -|---|---|---| -| App, universal (Apple silicon + Intel) | `effectcraft--macos-universal.dmg` | Signed and notarized | -| Command-line tool, universal | `effectcraft-cli--macos-universal.zip` | Signed and notarized | - -### Linux - -| Format | x86_64 | aarch64 (ARM64) | Notes | -|---|---|---|---| -| AppImage | `effectcraft--linux-x86_64.AppImage` | `effectcraft--linux-aarch64.AppImage` | Runs anywhere; updates itself with [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) (`.zsync` files) | -| Flatpak | `effectcraft--linux-x86_64.flatpak` | `effectcraft--linux-aarch64.flatpak` | Sandboxed; `flatpak install --user ` | -| Debian/Ubuntu | `effectcraft--linux-x86_64.deb` | `effectcraft--linux-aarch64.deb` | | -| Fedora/RHEL/openSUSE | `effectcraft--linux-x86_64.rpm` | `effectcraft--linux-aarch64.rpm` | | -| Tarball | `effectcraft--linux-x86_64.tar.gz` | `effectcraft--linux-aarch64.tar.gz` | Unpack anywhere | - -RISC-V 64-bit: `effectcraft--linux-riscv64.tar.gz` (tarball only; needs glibc 2.39+, e.g. Ubuntu 24.04+ or Debian 13+). - -**File drag-and-drop on Linux:** The current eframe/winit 0.30 native Wayland backend does not -deliver file-hover or file-drop events. On Hyprland and other native Wayland sessions, use -**File ▸ Import ▸ File…** (which accepts multiple files), or start EffectCraft via XWayland if -XWayland is installed and `DISPLAY` is set: - -```sh -env -u WAYLAND_DISPLAY effectcraft -``` - -When the backend delivers events (X11/XWayland, Windows and macOS), dropping media anywhere -in the window imports it, and a drop-target hint appears while hovering. On native Wayland the -app cannot detect an attempt that generates no event; it shows a startup notice with the -File ▸ Import fallback instead. - -### FreeBSD - -| Build | File | -|---|---| -| x86_64 | `effectcraft--freebsd-x86_64.tar.gz` | - -### Web (WebAssembly) - -| Build | File | Notes | -|---|---|---| -| Static site | `effectcraft-web-.zip` | Runs in a modern browser; host it on any static server | - -## The Crafting Apps - -EffectCraft is one of the **Crafting Apps**: free, open-source creative tools from the -[ArtCraft](https://getartcraft.com/) team, each written from scratch in Rust and each able to -stand on its own. - -| | App | What it's for | Code | Learn more | -|:-:|---|---|---|---| -| | **PhotoCraft** | Image editing: layers, masks, type and real PSD files | [GitHub](https://github.com/storytold/photocraft) | [Website](https://getartcraft.com/apps/photocraft) | -| | **VectorCraft** | Vector illustration | [GitHub](https://github.com/storytold/vectorcraft) | [Website](https://getartcraft.com/apps/vectorcraft) | -| | **FilmCraft** | Video editing, color and sound | [GitHub](https://github.com/storytold/filmcraft) | [Website](https://getartcraft.com/apps/filmcraft) | -| | **LightCraft** | Photo library and raw development | [GitHub](https://github.com/storytold/lightcraft) | [Website](https://getartcraft.com/apps/lightcraft) | -| | **PdfCraft** | Reading, organizing and protecting PDFs | [GitHub](https://github.com/storytold/pdfcraft) | [Website](https://getartcraft.com/apps/pdfcraft) | -| | **EffectCraft** | Motion graphics and visual effects | [GitHub](https://github.com/storytold/effectcraft) | [Website](https://getartcraft.com/apps/effectcraft) | -| | **DesignCraft** | Page layout and publishing | [GitHub](https://github.com/storytold/designcraft) | [Website](https://getartcraft.com/apps/designcraft) | -| | **FigCraft** | Interface design and prototyping | [GitHub](https://github.com/storytold/figcraft) | [Website](https://getartcraft.com/apps/figcraft) | -| | **WordCraft** | Word processing and documents | [GitHub](https://github.com/storytold/wordcraft) | [Website](https://getartcraft.com/apps/wordcraft) | -| | **SoundCraft** | Audio recording and editing | [GitHub](https://github.com/storytold/soundcraft) | [Website](https://getartcraft.com/apps/soundcraft) | -| | **DeckCraft** | Presentations and slide decks | [GitHub](https://github.com/storytold/deckcraft) | [Website](https://getartcraft.com/apps/deckcraft) | -| | **CADCraft** | Computer-aided design | [GitHub](https://github.com/storytold/cadcraft) | [Website](https://getartcraft.com/apps/cadcraft) | -| | **GridCraft** | Spreadsheets and data | [GitHub](https://github.com/storytold/gridcraft) | [Website](https://getartcraft.com/apps/gridcraft) | -| | **TextureCraft** | 3D texture painting | [GitHub](https://github.com/storytold/texturecraft) | [Website](https://getartcraft.com/apps/texturecraft) | -| | **Craft Anything** | See how any software works, then build your own | [GitHub](https://github.com/storytold/craft-anything) | [Website](https://getartcraft.com/apps/craft-anything) | -| | **SolidCraft** | Parametric 3D CAD by Tangency Labs (community app) | [GitHub](https://github.com/tangency-labs/solidcraft) | | - -And [**ArtCraft**](https://getartcraft.com/) itself, our AI image and video studio for artists who want real control. - -
- -

- Join the ArtCraft community on Discord -

- -

Come make things with us

- -

- Our Discord is where artists of every kind hang out: people who paint, shoot, draw, cut film, - set type, and people still figuring out what they like to make. Share what you're working on, - ask for help, tell us what's broken, or tell us what you wish these tools could do. - Whatever your medium and however long you've been at it, you're welcome here. -

- -

- discord.gg/artcraft · - getartcraft.com · - The Crafting Apps · - EffectCraft -

- -## License and credits - -EffectCraft is dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option. -Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors. Required notices are in [NOTICE](NOTICE). - -Bundled fonts, icons, images and other assets keep their own open licenses; each one is listed -with its author, source and license in [ATTRIBUTION.md](ATTRIBUTION.md). - -The ArtCraft name, wordmark and logos in [`docs/brand/`](docs/brand/) are trademarks of the -ArtCraft Team and are not covered by this license. They may be used only unmodified, and only as -part of this repository and EffectCraft, under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt). -Forks and modified versions must remove them. - -

- ArtCraft
- Made by the ArtCraft team and community. -

- -## Star history - -[![Star History Chart](https://api.star-history.com/svg?repos=storytold/effectcraft&type=Date&legend=top-left)](https://www.star-history.com/?repos=storytold%2Feffectcraft&type=date&legend=top-left) +

+ + + + ArtCraft + + +

+ + +

+ EffectCraft icon: an engraved unicorn on a pink tile +

+ +

EffectCraft

+ +

+ Motion graphics and visual effects; an open-source, professional motion graphics and visual effects studio, built in pure Rust. +

+ +

+ A free, open-source compositor: compositions, layers, + keyframes, 308 effects, layer styles, expressions, 3D cameras and lights, and a render queue, native on macOS, + Windows and Linux, and in the browser. Young, moving fast, and already usable. +

+ +

+ Status: young and moving fast + Written in Rust + License: MIT OR Apache-2.0 +
+ Scanned by SonarCloud + Reviewed by CodeRabbit +

+ +

+ Join the ArtCraft community on Discord +

+ +

+ EffectCraft on getartcraft.com · + ArtCraft · + All Crafting Apps +

+ +
+ +

+ EffectCraft's main window: the animated demo composition in the Composition panel, the Project panel, a Timeline with text, shape and solid layers, and the Properties panel showing the selected text layer's transform, font and paragraph settings +

+ +> [!NOTE] +> **ArtCraft is a community of artists from all walks of life.** Digital, generative, music, +> games — if you make things, you're one of us. **[Come say hi on Discord](https://discord.gg/artcraft).** + +

+ What it is · + Animate · + Effects · + 3D · + Export · + Agents · + Get started · + Status · + How it's made · + Downloads · + The Crafting Apps · + License +

+ +## What EffectCraft is + +EffectCraft is for animated titles, motion graphics and compositing work: the kind of thing +motion designers and VFX artists need. You build a composition out of layers (solids, shapes, +text, footage, other compositions), animate their properties with keyframes, stack effects on +them and render the result. + +The interface feels natural and responsive, with dedicated panels (Project, Composition, Timeline, +Layer, Footage, Effect Controls, Tools, Preview, Effects & Presets, Audio, Info, Paragraph, +Character, Align, Progress, Render Queue) and standard motion graphics shortcuts, going further in +a few places where it matters to us: + +- **Lottie import and export built in**, so animations can go straight to the web and apps + without a plugin. +- **A project file you can read.** Projects are versioned JSON (`.ecproj`), so they diff cleanly + in version control. +- **Everything is scriptable.** Menu actions, timeline edits and property changes are exposed as + commands. Engine commands are available through the CLI, JSON control channel and MCP; + UI-only commands use the frontend dispatcher and can be invoked through the control channel + or an attached MCP bridge. +- **No FFmpeg.** Video and audio decoding and encoding are pure Rust: FilmCraft's codecs and + EffectCraft's own VP9, AV1, HEVC and Opus encoders. + +## Animate + +The panels, menus and shortcuts follow standard motion design conventions: +Project, Composition, Timeline, Effect Controls, Properties, Effects & Presets, Character, +Paragraph, Align, Info, Preview, Audio and the Render Queue, docked the way you expect. Drag +footage, comps and effects between them: onto the comp viewer, where they land under the pointer, +or into the Timeline, between layers and at the time you point to. + +- **Layers of every kind:** solids, shapes, text, footage, nested compositions, nulls, + adjustment layers, cameras and lights; parenting, track mattes, all 38 blend modes, motion blur. +- **Keyframes that behave the same:** linear, Bezier, hold, auto and continuous Bezier, roving + keys, Easy Ease (F9), Keyframe Velocity and Interpolation dialogs, copy and paste at the current + time, and a **Graph Editor** with value and speed graphs and draggable handles. +- **Time:** time remapping, time stretch, time-reverse, freeze frame, work area, markers, exact + frame-accurate timing at every frame rate including 29.97 drop-frame. +- **Shapes and masks:** shape layers with trim paths, repeaters, round corners, offset, zig zag, + twist, wiggle, merge paths and gradient strokes; masks drawn with the pen tool, with modes, + feather, expansion and vertex editing in the viewer. +- **Text:** point and paragraph text with real shaping in any font installed on your machine, the + Character and Paragraph panels, and text animators with range selectors. +- **Expressions:** JavaScript with the standard motion expressions model (`wiggle`, `loopOut`, + `thisComp.layer("…")`, vector maths on arrays), an inline editor and the pick-whip. +- **Timeline like you know it:** twirl layers open to Transform, masks, effects and the rest; drag + rows to reorder layers; rename with Enter or a double-click; the property shortcuts (A, P, S, + R, T, M, F, E, L, U and their double presses AA, PP, SS, RR, TT, MM, FF, EE, LL, UU), Shift to + add properties, Alt+Shift+A/P/S/R/T to key the current time, Ctrl+` to twirl selected layers. +- **Puppet tools:** Position, Advanced, Bend, Starch and Overlap pins on a mesh built from the + layer, real-time pin recording, rotate/scale handles, pins driven by (or carrying) nulls for + rigging, and follow-through for hair and cloth. + +

+ The Graph Editor showing an eased value curve for a text animator's Range Start, with the graph editor's button bar for hold, linear, auto Bezier and Easy Ease +

+ +## Effects + +308 built-in effects across its categories, each with its parameter names, order and +defaults: blur and sharpen, channel, color correction (Curves, Levels, Hue/Saturation, a full +color-grading panel…), distort (Warp, Bulge, Turbulent Displace, Perspective Pin…), generate (Fractal Noise, +Gradient Ramp, Stroke, Write-on, Audio Spectrum…), keying, matte, noise and grain, perspective, +**simulation** (Particle Emitter 3D, Rainfall, Shatter, Card Dance, Caustics, Wave World…), +stylize (Glow, Glass Relief…), **time** (Echo, Posterize Time, Timewarp, Time Displacement…), +**audio** (Reverb, Parametric EQ, Delay, Stereo Mixer…), text, transitions, utility and expression +controls. All nine **Layer Styles** (Drop Shadow, Inner/Outer Glow, Bevel and Emboss, Satin, +overlays, Stroke) with Global Light. Preview plays audio in sync, with meters and waveforms. + +## 3D + +Classic 3D compositing: 3D layers with orientation and material options, +one- and two-node **cameras** with depth of field, **lights** (parallel, spot, point, ambient) +with soft ray-traced shadows, layers that intersect correctly, orbit, pan and dolly camera +tools, and Front, Top, Left and Custom views. + +

+ The 3D Showcase demo in Custom View 1: intersecting cards lit by a spot light with soft shadows on a gridded floor, with the camera frustum and light drawn as wireframes +

+ +## Export + +A dedicated Render Queue, with Render Settings and Output Modules: **H.264** MP4 and +**ProRes** MOV (Proxy to 4444 XQ with alpha) with audio, **HEVC** (Main / Main 10) and **AV1** +MP4, **WebM** (VP9 with inter frames and alpha, or AV1; Opus audio), PNG, JPEG, TIFF, Targa and 32-bit EXR sequences, animated GIF and WAV/AIFF. Field +rendering with 3:2 pulldown, effect/solo/guide/depth overrides, crop, region of interest and +resize, Render Settings and Output Module templates with defaults, post-render actions, storage +overflow and render logs. The same queue runs from the command line. Every encoder is pure +Rust (craft-libs' H.264, ProRes, HEVC, VP9, AV1 and AAC; EffectCraft's own Opus); there is no +FFmpeg inside. + +**Lottie** goes both ways: File ▸ Export ▸ Lottie JSON… writes a composition (precomps, shape, +solid, image, text and null layers, eased and spatial keyframes, masks, track mattes, blend +modes, time remapping, optionally expressions) as `.json` or `.lottie`, and lists anything Lottie +cannot express; File ▸ Import ▸ Lottie… opens one as a new composition. + +

+ The Render Queue panel with two compositions queued +

+ +## Built for agents + +Engine commands are available through the CLI, JSON control channel and MCP. UI-only commands +need the running app's frontend dispatcher: complete menu access requires the app's control +channel or an attached MCP bridge. Headless MCP sessions expose supported engine commands, +but not UI-only commands or bridge-only `ui_*` tools. + +- **MCP server:** `effectcraft-cli mcp` speaks the Model Context Protocol over stdio, headless + or bridged to the running app (`--bridge 9877`). Tools cover commands, the project and property + tree, keyframes and rendered frames. This repository ships a ready [`.mcp.json`](.mcp.json). +- **Command line:** one-shot calls with JSON output, for example + `effectcraft-cli set Main '#1' transform/position '[100,360]' --time 0 main.ecproj --save` + or `effectcraft-cli render --comp Main --out main.mp4`, or + `effectcraft-cli exec file.exportLottie '{"comp":"Main","path":"main.json"}' main.ecproj`. +- **Control channel:** `effectcraft --control 9877` accepts JSON lines to run commands, inspect + and click any widget by its automation id, and take screenshots. + +See [docs/agents.md](docs/agents.md) and [docs/control-protocol.md](docs/control-protocol.md). + +## Get started + +Installers for each version are on the [Releases](https://github.com/storytold/effectcraft/releases) +page: a universal macOS app; Windows MSIs and portable zips for x64, x86 and ARM64; Linux +AppImage, Flatpak, deb, rpm and tar.gz for x86_64 and aarch64, plus a riscv64 tar.gz; a FreeBSD x86_64 tarball; and the +web build. [Downloads](#downloads) lists every file. The Windows ARM64 build runs natively on +Windows on ARM, without x64 emulation. CI installs that MSI on Windows 11 ARM64 hardware, checks +both programs are ARM64 and runs the command-line tool there, but it doesn't open the app's window +or run the test suite natively on ARM64 yet, so please report anything that behaves differently. + +On Gentoo, the community [::snakebyte overlay](https://github.com/switch87/snakebyte-overlay) packages +the Linux release as `media-video/effectcraft-bin` (not maintained by the EffectCraft team): + +```sh +eselect repository add snakebyte git https://github.com/switch87/snakebyte-overlay.git +emaint sync -r snakebyte +echo 'media-video/effectcraft-bin ~amd64' >> /etc/portage/package.accept_keywords/effectcraft +emerge --ask media-video/effectcraft-bin +``` + +To build it yourself you need [Rust](https://rustup.rs/) 1.95 or newer. + +```sh +git clone https://github.com/storytold/effectcraft +cd effectcraft +cargo run --release -p effectcraft # the app (add `-- --demo` to open the demo project) +cargo run --release -p effectcraft-cli -- render --out intro.mp4 # render the demo headless +cargo xtask web --serve 8765 # the browser build on http://127.0.0.1:8765/ (docs/web.md) +``` + +New to it? [docs/footage.md](docs/footage.md) covers importing footage and image sequences and +Interpret Footage. + +To work on it: `cargo test --workspace`, and `cargo xtask ci` before every commit (format, lints, +tests, layering, asset attribution and the WebAssembly build). See [CONTRIBUTING.md](CONTRIBUTING.md), +[docs/architecture.md](docs/architecture.md) and [docs/testing.md](docs/testing.md). + +## Where it stands + +EffectCraft is young: its first commit was on 1 October 2026. A comprehensive feature set +exists, including 308 effects, but breadth is not the same as full maturity across every edge +case. Today it's a good place to try things and to tell us what breaks. It isn't yet recommended +for production client work. In particular: + +- **Native project format.** Projects are saved as `.ecproj`, readable versioned JSON. Proprietary + project formats and After Effects SDK plug-ins are not supported. +- **Fidelity is still being refined.** Automated rendering tests currently focus on small + compositions, so please report visual discrepancies or unexpected behaviour. +- **macOS is the most tested platform.** Linux and Windows users have hit basic interaction + bugs, which we're fixing first. +- **The trained models are new.** Roto Brush can use MobileSAM (an optional 40 MB download in + Settings ▸ Roto Brush) and face tracking can use Google's MediaPipe Face Landmarker (an optional + 3.8 MB download in Settings ▸ Face Tracking). Both are actively undergoing evaluation and tuning. + +EffectCraft is in **alpha**: about 91% of the features tracked in +[docs/target-app-parity.md](docs/target-app-parity.md) exist, and we estimate it is about 45% of the +way to being ready for full professional production work. The [ROADMAP](ROADMAP.md) has the plan, +[docs/target-app-parity.md](docs/target-app-parity.md) the measurement and [docs/gaps.md](docs/gaps.md) +every known shortfall. The web build ([docs/web.md](docs/web.md)) runs the full app in the browser. +[Bug reports](https://github.com/storytold/effectcraft/issues) are the most useful thing you can +send us right now. + +## How it's made + +- **Engine first.** A stack of small crates with strict layering. The interface (egui) sits on + top and nothing underneath depends on it. +- **Clean room.** We work from public documentation and observable behavior, never + from proprietary files, icons, presets or code. No code is copied from GPL projects. The full rules + are in [AGENTS.md](AGENTS.md). +- **Private by default.** No telemetry, and no network access unless you ask for it. +- **One family.** EffectCraft shares its time model and text engine design with FilmCraft, and + gets its video and audio codecs from it. + +## Downloads + +**New to EffectCraft?** Download it from the [EffectCraft page on getartcraft.com](https://getartcraft.com/apps/effectcraft). That's the easiest way to install it. + +**Want a specific build or format?** On GitHub, the [latest release](https://github.com/storytold/effectcraft/releases/latest) has every build listed below, and [all releases](https://github.com/storytold/effectcraft/releases) has earlier versions and their notes. `` in the file names is the version number, and `SHA256SUMS.txt` lists a checksum for every file. + +### Windows + +| Build | Installer | Portable | +|---|---|---| +| x64 (64-bit Intel/AMD) | `effectcraft--windows-x64.msi` | `effectcraft--windows-x64-portable.zip` | +| arm64 (Snapdragon and other ARM PCs) | `effectcraft--windows-arm64.msi` | `effectcraft--windows-arm64-portable.zip` | +| x86 (32-bit) | `effectcraft--windows-x86.msi` | `effectcraft--windows-x86-portable.zip` | + +Installers and executables are code-signed. The installer asks who to install EffectCraft for and where. By default it installs for your +account only, into `%LOCALAPPDATA%\Programs\ArtCraft\EffectCraft`, without an administrator prompt; +"Everyone on this computer" installs into `C:\Program Files\ArtCraft\EffectCraft` (`Program Files (x86)` for the 32-bit build). Later versions +install into the same folder. To install silently +into a folder of your choice: `msiexec /i effectcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\EffectCraft"`. +A silent install is per-user by default. `INSTALLFOLDER` chooses the folder, not who it is installed for; +add `ALLUSERS=1`, from an elevated terminal or deployment tool, for an all-users install. + +### macOS + +| Build | File | Notes | +|---|---|---| +| App, universal (Apple silicon + Intel) | `effectcraft--macos-universal.dmg` | Signed and notarized | +| Command-line tool, universal | `effectcraft-cli--macos-universal.zip` | Signed and notarized | + +### Linux + +| Format | x86_64 | aarch64 (ARM64) | Notes | +|---|---|---|---| +| AppImage | `effectcraft--linux-x86_64.AppImage` | `effectcraft--linux-aarch64.AppImage` | Runs anywhere; updates itself with [AppImageUpdate](https://github.com/AppImageCommunity/AppImageUpdate) (`.zsync` files) | +| Flatpak | `effectcraft--linux-x86_64.flatpak` | `effectcraft--linux-aarch64.flatpak` | Sandboxed; `flatpak install --user ` | +| Debian/Ubuntu | `effectcraft--linux-x86_64.deb` | `effectcraft--linux-aarch64.deb` | | +| Fedora/RHEL/openSUSE | `effectcraft--linux-x86_64.rpm` | `effectcraft--linux-aarch64.rpm` | | +| Tarball | `effectcraft--linux-x86_64.tar.gz` | `effectcraft--linux-aarch64.tar.gz` | Unpack anywhere | + +RISC-V 64-bit: `effectcraft--linux-riscv64.tar.gz` (tarball only; needs glibc 2.39+, e.g. Ubuntu 24.04+ or Debian 13+). + +**File drag-and-drop on Linux:** The current eframe/winit 0.30 native Wayland backend does not +deliver file-hover or file-drop events. On Hyprland and other native Wayland sessions, use +**File ▸ Import ▸ File…** (which accepts multiple files), or start EffectCraft via XWayland if +XWayland is installed and `DISPLAY` is set: + +```sh +env -u WAYLAND_DISPLAY effectcraft +``` + +When the backend delivers events (X11/XWayland, Windows and macOS), dropping media anywhere +in the window imports it, and a drop-target hint appears while hovering. On native Wayland the +app cannot detect an attempt that generates no event; it shows a startup notice with the +File ▸ Import fallback instead. + +### FreeBSD + +| Build | File | +|---|---| +| x86_64 | `effectcraft--freebsd-x86_64.tar.gz` | + +### Web (WebAssembly) + +| Build | File | Notes | +|---|---|---| +| Static site | `effectcraft-web-.zip` | Runs in a modern browser; host it on any static server | + +## The Crafting Apps + +EffectCraft is one of the **Crafting Apps**: free, open-source creative tools from the +[ArtCraft](https://getartcraft.com/) team, each written from scratch in Rust and each able to +stand on its own. + +| | App | What it's for | Code | Learn more | +|:-:|---|---|---|---| +| | **PhotoCraft** | Image editing: layers, masks, type and real PSD files | [GitHub](https://github.com/storytold/photocraft) | [Website](https://getartcraft.com/apps/photocraft) | +| | **VectorCraft** | Vector illustration | [GitHub](https://github.com/storytold/vectorcraft) | [Website](https://getartcraft.com/apps/vectorcraft) | +| | **FilmCraft** | Video editing, color and sound | [GitHub](https://github.com/storytold/filmcraft) | [Website](https://getartcraft.com/apps/filmcraft) | +| | **LightCraft** | Photo library and raw development | [GitHub](https://github.com/storytold/lightcraft) | [Website](https://getartcraft.com/apps/lightcraft) | +| | **PdfCraft** | Reading, organizing and protecting PDFs | [GitHub](https://github.com/storytold/pdfcraft) | [Website](https://getartcraft.com/apps/pdfcraft) | +| | **EffectCraft** | Motion graphics and visual effects | [GitHub](https://github.com/storytold/effectcraft) | [Website](https://getartcraft.com/apps/effectcraft) | +| | **DesignCraft** | Page layout and publishing | [GitHub](https://github.com/storytold/designcraft) | [Website](https://getartcraft.com/apps/designcraft) | +| | **FigCraft** | Interface design and prototyping | [GitHub](https://github.com/storytold/figcraft) | [Website](https://getartcraft.com/apps/figcraft) | +| | **WordCraft** | Word processing and documents | [GitHub](https://github.com/storytold/wordcraft) | [Website](https://getartcraft.com/apps/wordcraft) | +| | **SoundCraft** | Audio recording and editing | [GitHub](https://github.com/storytold/soundcraft) | [Website](https://getartcraft.com/apps/soundcraft) | +| | **DeckCraft** | Presentations and slide decks | [GitHub](https://github.com/storytold/deckcraft) | [Website](https://getartcraft.com/apps/deckcraft) | +| | **CADCraft** | Computer-aided design | [GitHub](https://github.com/storytold/cadcraft) | [Website](https://getartcraft.com/apps/cadcraft) | +| | **GridCraft** | Spreadsheets and data | [GitHub](https://github.com/storytold/gridcraft) | [Website](https://getartcraft.com/apps/gridcraft) | +| | **TextureCraft** | 3D texture painting | [GitHub](https://github.com/storytold/texturecraft) | [Website](https://getartcraft.com/apps/texturecraft) | +| | **Craft Anything** | See how any software works, then build your own | [GitHub](https://github.com/storytold/craft-anything) | [Website](https://getartcraft.com/apps/craft-anything) | +| | **SolidCraft** | Parametric 3D CAD by Tangency Labs (community app) | [GitHub](https://github.com/tangency-labs/solidcraft) | | + +And [**ArtCraft**](https://getartcraft.com/) itself, our AI image and video studio for artists who want real control. + +
+ +

+ Join the ArtCraft community on Discord +

+ +

Come make things with us

+ +

+ Our Discord is where artists of every kind hang out: people who paint, shoot, draw, cut film, + set type, and people still figuring out what they like to make. Share what you're working on, + ask for help, tell us what's broken, or tell us what you wish these tools could do. + Whatever your medium and however long you've been at it, you're welcome here. +

+ +

+ discord.gg/artcraft · + getartcraft.com · + The Crafting Apps · + EffectCraft +

+ +## License and credits + +EffectCraft is dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option. +Copyright (c) 2026 ArtCraft Team and the EffectCraft contributors. Required notices are in [NOTICE](NOTICE). + +Bundled fonts, icons, images and other assets keep their own open licenses; each one is listed +with its author, source and license in [ATTRIBUTION.md](ATTRIBUTION.md). + +The ArtCraft name, wordmark and logos in [`docs/brand/`](docs/brand/) are trademarks of the +ArtCraft Team and are not covered by this license. They may be used only unmodified, and only as +part of this repository and EffectCraft, under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt). +Forks and modified versions must remove them. + +

+ ArtCraft
+ Made by the ArtCraft team and community. +

+ +## Star history + +[![Star History Chart](https://api.star-history.com/svg?repos=storytold/effectcraft&type=Date&legend=top-left)](https://www.star-history.com/?repos=storytold%2Feffectcraft&type=date&legend=top-left) diff --git a/ROADMAP.md b/ROADMAP.md index e41cbe2f1..656487144 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,193 +1,193 @@ -# EffectCraft Roadmap - -**Stage: alpha** · next: beta, ~30 points of "ready for real work" and ~350–620 h away - -> **Last reviewed:** 2026-10-22 · **Last updated:** 2026-11-05 · **Change:** minor (ProRes alpha final-run conformance; previously: features of 30 October in the progress log: text Line Join, Timeline drag-reorder and multi-select of effects, viewer edge pan, ScriptUI drag capture and dock size; previously: localization recount after #1774) · **Target:** Adobe After Effects 2026 (26.5.0.89) - -EffectCraft aims to do what After Effects does, with the same panels, menus and behaviour, written -from scratch in Rust. This page is the one-page summary; the evidence is in -[docs/target-app-parity.md](docs/target-app-parity.md), the work list in -[docs/gaps.md](docs/gaps.md), and the plan in [docs/roadmap.md](docs/roadmap.md). - -## Headline numbers - -| | Value | Kind | -|---|---|---| -| **Feature breadth** | **≈ 91%** | Estimated, weighted by area; the self-graded 92-item checklist says ≈ 99% | -| **Ready for real work** | **≈ 45%** (40–50%) | Estimated; one live fidelity measurement so far | -| **Mainstream practitioner** | **≈ 47%** | Estimated: the typical motion designer's weekly work ([how](docs/target-app-parity.md#mainstream-practitioner-and-essentials-user)) | -| **Essentials user** | **≈ 52%** | Estimated: core features only ([how](docs/target-app-parity.md#essentials-user)) | -| Remaining to **beta** | **≈ 350–620 Opus 5.5 agent-hours** | Estimated | -| Remaining to **full parity** | **≈ 850–1,500 Opus 5.5 agent-hours** | Estimated; ≈ 70% parallelises | - -| Audience | Ready % | Hours to ~95% | Work that dominates | -|---|---:|---:|---| -| Full target | ≈ 45% | ≈ 850–1,500 h | `.aep`, fidelity corpus, bug backlog, performance, formats, hardware, localization | -| Mainstream practitioner | ≈ 47% | ≈ 280–530 h | `.aep` exchange, stability, everyday fidelity and bugs, preview speed | -| Essentials user | ≈ 52% | ≈ 150–300 h | Opening tutorial `.aep` files, start-up stability, core bugs, preview with sound | - -About 60–70% of these hours parallelise ([detail](docs/target-app-parity.md#readiness-by-audience)). - -Hours are one Opus 5.5 agent working sequentially, calibrated on this repository's history -([how](docs/target-app-parity.md#calibration-of-the-hours)). - -### Stage - -**Alpha**, because all six core workflows of the [alpha gate](docs/roadmap.md#alpha-gate) -(set up, animate, text and shapes, composite, preview, save and deliver) work end to end on macOS -and the work saves and reopens, and ready for real work (≈ 45%) is above the ≈ 40% bar. But: After Effects projects (`.aep`) can't be opened, which -alone rules out beta; fidelity against After Effects is measured for one narrow case (scalar ease, -168 samples); 216 issues are open on 12 October, six of them crash reports (#580, #501, #426, #341, #234, #879). Beta needs ≈ 75% ready and `.aep` -opening reliably: the `.aep` owner decision and importer (80–160 h), the fidelity harness and -P0/P1 corpus (60–100 h), the crash and bug backlog (40–80 h), performance (40–70 h), -Linux/Windows reliability (30–50 h) and depth in animation, masks, effects and text (100–160 h). - -## By dimension - -| Dimension | % | Hours | Doc | -|---|---:|---:|---| -| Features: breadth | 91% | — | [target-app-parity.md](docs/target-app-parity.md#by-feature-area) | -| Features: ready for real work | 50% | 360–660 | [target-app-parity.md](docs/target-app-parity.md#by-feature-area) | -| UI/UX fidelity | 65% | 60–120 | [ui-parity.md](docs/ui-parity.md) | -| File formats | 50% | 130–230 | [file-format-parity.md](docs/file-format-parity.md) | -| Hardware | 40% | 60–120 | [hardware-parity.md](docs/hardware-parity.md) | -| Localization | 24% | 60–110 + review | [localization-parity.md](docs/localization-parity.md) | -| Performance | 35% | 50–100 | [gaps.md](docs/gaps.md#g5-performance-at-real-world-scale) | -| Stability | 45% | 40–80 | [gaps.md](docs/gaps.md#g3-stability-and-a-green-main) | -| Platforms | 65% | 30–60 | [gaps.md](docs/gaps.md#g2-real-user-reliability-on-every-platform) | -| Ecosystem and plug-ins | 20% | 40–80 | [plugins.md](docs/plugins.md), [scripting-parity.md](docs/scripting-parity.md) | -| AI features | 35% | 40–80 | [gaps.md](docs/gaps.md) | -| Agent control (beyond After Effects) | ahead | — | [agents.md](docs/agents.md) | - -## Features - -| Area | Breadth | Ready | Hours | -|---|---:|---:|---:| -| Project, footage and import | 92% | 55% | 25–45 | -| Compositions, layers and compositing | 98% | 60% | 30–55 | -| Animation: keyframes, graph editor, motion paths, puppet | 97% | 55% | 35–60 | -| Expressions and scripting ([detail](docs/scripting-parity.md)) | 93% | 65% | 20–40 | -| Shapes, masks and roto | 93% | 45% | 30–50 | -| Text and typography | 94% | 50% | 20–35 | -| Effects and animation presets ([detail](docs/effects-parity.md)) | 85% | 40% | 70–130 | -| 3D (Classic and Advanced) | 82% | 35% | 35–65 | -| Tracking and AI-assisted tools | 80% | 35% | 35–70 | -| Preview and cache | 92% | 40% | 25–50 | -| Render queue and export | 85% | 55% | 25–45 | -| Audio | 85% | 45% | 6–12 | - -Weights and evidence per row: [target-app-parity.md](docs/target-app-parity.md#by-feature-area). - -## Languages - -UI strings translated out of ≈ 4,200 (detail: [localization-parity.md](docs/localization-parity.md)). - -| Language | Status | % | -|---|---|---:| -| English | full | 100% | -| Simplified Chinese | partial (menus, most of the panels) | 46% | -| Spanish | menus only | 29% | -| Hindi | none | 0% | -| Arabic | none | 0% | -| French | menus only | 16% | -| Portuguese (Brazil) | partial (menus, part of the panels) | 34% | -| Indonesian | none | 0% | -| Japanese | partial (menus, most of the panels) | 46% | -| German | menus only | 16% | -| Korean | none | 0% | -| Vietnamese | none | 0% | - -Also shipped: Traditional Chinese (partial, 38%), Ukrainian (partial, 29%), Czech (partial, 29%), Polish (partial, 34%), Georgian (partial, 39%; native-speaker reviewed), Russian (menus only, 15%) and Swedish (menus, panels and effect names; not yet measured). No other language has had -native-speaker review. - -## Upcoming - -Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gaps.md). - -| | Next | Hours | -|---|---|---:| -| 1 | Fix the open crash reports; run `cargo xtask ci` on every pull request (G3) | 15–30 | -| 2 | Fidelity harness against After Effects: rendered frames, a corpus case per P0/P1 feature (G1) | 60–100 | -| 3 | Real-user reliability on Linux and Windows; the open mask, effect, text and 3D bugs (G2) | 100–190 | -| 4 | `.aep` / `.aepx` import, after the owner's clean-room decision (G4) | 80–160 | -| 5 | Performance: benchmarks at 1080p / 4K, real-time cached playback, hardware video (G5) | 50–100 | -| 6 | Localization depth: effect names, all panels, Korean / Italian (G9) | 60–110 | - -Come tell us what matters most to you on [Discord](https://discord.gg/artcraft). - -## Progress log - -- 2026-11-05: ProRes 4444 and XQ exports write the required run after the final alpha - difference. The FilmCraft encoder pin fixes alpha movies rejected by native macOS - decoding; an export regression checks the stored bytes for both profiles, alpha modes, - and motion-blur settings (#293). Resolve itself still needs confirmation. -- 2026-10-30: Text strokes take a Line Join (Miter, Round or Bevel) in the Character panel, - Miter for new text as in After Effects (#2077). In the Timeline, effects, masks and shape items - drag to a new place in their stack (#2210) and Shift-click adds them to the selection, so one - animation preset can hold several (#2552). The Composition panel pans while a mask vertex is - held at its edge (#999). Effect buffers that pad a small layer stay within a memory budget - (#2261); an MP4 lasts as long as its edit list shows (#2592); the Render Queue's times tick - between frames (#2593). ScriptUI drags keep their control past the window edge with - `MouseEvent.buttons` (#2584), and docked panels get their dock's size and `onResize` (#2585). -- 2026-10-28: A shape layer's Rectangle and Ellipse Size get the Constrain Proportions chain - that Scale has, so a circle stays a circle while its size is typed, scrubbed or keyed; it - starts off, so existing shapes behave as before (#2489). -- 2026-10-24: Shape layers have the Wiggle Transform path operation (Contents ▸ Add, or - `layer.addShapeItem {kind: "wiggler"}`): it wiggles the anchor point, position, scale and - rotation of the paths above it by random amounts that change over time, up to the Transform - values it holds. The copies of a Repeater above it wiggle independently as far as its - Correlation allows; with the Repeater below it, they wiggle together. -- 2026-10-22: Localization: the panel/dialog catalogs gain 303 rows in Japanese, Simplified - Chinese and Traditional Chinese — panel tabs, form and dialog labels, panel context menus, - tracker/graph/text-panel controls, File-panel footers and credits. Recounted after #1774: - Japanese is 1,923 of ≈ 4,200 interface strings (46%, with 297 effect names); the Chinese - panel catalogs hold 998 (Simplified) and 951 (Traditional) rows, and Simplified Chinese is - 46% with its 307 effect names; the overall share is ≈ 24%. -- 2026-10-16: Convert To Bezier Path turns a shape layer's Rectangle, Ellipse or Polystar - path into an editable Path 1 with the same geometry, as After Effects does; it used to - apply to mask RotoBezier only, so a parametric shape path could not be converted at all - and its vertices could not be edited or animated (#932). -- 2026-10-14: Georgian (`ka`): every menu row, every panel-catalog row the Chinese catalogs have plus 195 Georgian-only ones, and the effect names and categories; Match System for `ka` / `ka-GE` / `ka_GE.UTF-8` locales. Reviewed by a native speaker. -- 2026-10-12: Roto Brush span edits report strokes outside a trimmed layer without panicking; - strokes and undo history are preserved so restoring the timing allows the span edit again. -- 2026-10-11: Ukrainian panels caught up with the Chinese catalogs. The 95 rows the panel - catalog gained since 9 October are translated: the Home screen (recent files, their Kind and - Opened columns, the empty and no-match states), the viewer's toolbar tooltips, magnification, - resolution, grid, channel and Fast Previews popups, the Appearance settings, the solid dialog - and the project, import, export and colour-management forms. `uk` now carries 495 of the 496 - panel rows — `RGB` reads the same in Ukrainian, so it falls back to the English source by - design — alongside its 618/618 menus. -- 2026-10-10: Full parity re-measure against After Effects 2026 26.5 (installed bundle, 26.2–26.5 - release notes, repository counts): breadth ≈ 91%, ready ≈ 45%, stage alpha. Progress docs - restructured: `docs/parity.md` became `docs/target-app-parity.md`; new - `docs/roadmap.md`, `localization-parity.md`, `file-format-parity.md`, `hardware-parity.md`, - `ui-parity.md`, `effects-parity.md` and `scripting-parity.md`. -- 2026-10-10: Spanish (#460) and Brazilian Portuguese (#217) menu translations. -- 2026-10-10: Japanese now translates the interface below the menu bar too: `crates/ui-egui/src/i18n/ui.rs` has a Japanese table with the same 396 rows as the Chinese ones (panels, dialogs, buttons and tooltips; the shape test keeps the three catalogs listing the same source strings). Menus were already Japanese. -- 2026-10-09: Ukrainian now covers all 396 current panel-catalog strings, including dialogs, buttons and tooltips, alongside its menu translation. The catalog keeps the same source keys and placeholder counts as the Chinese catalogs; missing or engine-generated text still falls back to English. - -- UI.6: Viewer breadcrumbs use theme colors for readable active text. The bottom control row scrolls horizontally at compact widths; keyboard focus reveals the selected control while dropdowns, exposure adjustments and snapshot holds retain their behavior. -- UI.3: Shared docking transactions and pointer targets now handle panel moves, splits, tab ordering and floating groups, preserving accordion metadata and the saved workspace schema. Dock dividers use bounded shared geometry and keyboard-accessible resize handles. Tiny layouts no longer reach an invalid floating-point clamp; workspace trees and saved layouts are retained. - -- 2026-10-09: Settings ▸ General ▸ Language now translates the interface below the menu bar as well: panels, dialogs, buttons and tooltips read their text through `crates/ui-egui/src/i18n/ui.rs`, keyed by the English source string. Simplified and Traditional Chinese are complete (384 strings); Japanese rows can follow in the same file. A test fails when a converted panel gains a hard-coded string, and another keeps the catalog free of unused rows. -- 2026-10-08: `effectcraft-cli render --out` resolves a relative path against the working directory, like `--project` (it used the project's folder, which doubled a path that already named it). Render Queue outputs set in a project are unchanged. -- 2026-10-08: Long-press a grouped toolbar button to choose its tools, including Horizontal/Vertical Type; releasing the hold keeps the menu open. Existing point/paragraph text creation is unchanged. -- 2026-10-06: Settings ▸ General ▸ Language persists English/Japanese menu labels (`general.language`); native UI reuses installed Japanese font fallback, with no bundled CJK font. Dialog and panel contents remain English. -- 2026-10-05: Honest assessment ([docs/gaps.md](docs/gaps.md)): breadth ≈ 99% by our own checklist, real use ≈ 30–50%; workstreams G1–G9. -- 2026-10-04: Checklist audit at `d39c0e8`: 89 done / 3 partial / 0 missing of 92 features. -- 2026-10-01: First commit. - -## Revision history - -| Date | Change | Summary | -|---|---|---| -| 2026-10-30 | minor | Progress log: text Line Join, Timeline drag-reorder and Shift multi-select of effects, viewer edge pan, effect padding budget, MP4 edit-list duration, Render Queue clock, ScriptUI drag capture and docked-panel size | -| 2026-10-22 | minor | Localization: 300 more panel/dialog rows in Japanese and the Chinese catalogs, plus the review's three missing rows (Basic, Advanced, Play/Stop) — panel tabs, form and dialog labels, context menus, tracker/graph/text-panel controls, File-panel footers, credits; language shares recounted after #1774 (Japanese 27% → 46% with 297 effect names, Simplified Chinese 29% → 46% with 307 effect names, Traditional Chinese 29% → 38%, overall 18% → 24%) | -| 2026-10-12 | minor | Open-issue count (134 to 216), crash list and localization share (12% to 18%) updated to match docs/gaps.md | -| 2026-10-12 | patch | Roto Brush span validation after trimming; command regressions for both layer edges | -| 2026-10-12 | minor | Shared PDF object/xref parsing with bounded app-owned conversion and preserved stream budgets; drawing, EPS and image/font policy remain unchanged | -| 2026-10-10 | minor | Hours to ≈ 95% for each audience | -| 2026-10-10 | minor | Headline adds mainstream practitioner (≈ 47%) and essentials user (≈ 52%) | -| 2026-10-10 | major | Progress docs restructured: stage, two numbers, dimensions, features, languages, upcoming, progress log; milestones moved to docs/roadmap.md | -| 2026-10-10 | minor | Stage checked against the new core-workflow gate (all six pass; still alpha) | -| 2026-10-05 | major | Two numbers (breadth vs real use) and workstreams G1–G9 | +# EffectCraft Roadmap + +**Stage: alpha** · next: beta, ~30 points of "ready for real work" and ~350–620 h away + +> **Last reviewed:** 2026-10-22 · **Last updated:** 2026-11-05 · **Change:** minor (ProRes alpha final-run conformance; previously: features of 30 October in the progress log: text Line Join, Timeline drag-reorder and multi-select of effects, viewer edge pan, ScriptUI drag capture and dock size; previously: localization recount after #1774) · **Target:** Adobe After Effects 2026 (26.5.0.89) + +EffectCraft aims to do what After Effects does, with the same panels, menus and behaviour, written +from scratch in Rust. This page is the one-page summary; the evidence is in +[docs/target-app-parity.md](docs/target-app-parity.md), the work list in +[docs/gaps.md](docs/gaps.md), and the plan in [docs/roadmap.md](docs/roadmap.md). + +## Headline numbers + +| | Value | Kind | +|---|---|---| +| **Feature breadth** | **≈ 91%** | Estimated, weighted by area; the self-graded 92-item checklist says ≈ 99% | +| **Ready for real work** | **≈ 45%** (40–50%) | Estimated; one live fidelity measurement so far | +| **Mainstream practitioner** | **≈ 47%** | Estimated: the typical motion designer's weekly work ([how](docs/target-app-parity.md#mainstream-practitioner-and-essentials-user)) | +| **Essentials user** | **≈ 52%** | Estimated: core features only ([how](docs/target-app-parity.md#essentials-user)) | +| Remaining to **beta** | **≈ 350–620 Opus 5.5 agent-hours** | Estimated | +| Remaining to **full parity** | **≈ 850–1,500 Opus 5.5 agent-hours** | Estimated; ≈ 70% parallelises | + +| Audience | Ready % | Hours to ~95% | Work that dominates | +|---|---:|---:|---| +| Full target | ≈ 45% | ≈ 850–1,500 h | `.aep`, fidelity corpus, bug backlog, performance, formats, hardware, localization | +| Mainstream practitioner | ≈ 47% | ≈ 280–530 h | `.aep` exchange, stability, everyday fidelity and bugs, preview speed | +| Essentials user | ≈ 52% | ≈ 150–300 h | Opening tutorial `.aep` files, start-up stability, core bugs, preview with sound | + +About 60–70% of these hours parallelise ([detail](docs/target-app-parity.md#readiness-by-audience)). + +Hours are one Opus 5.5 agent working sequentially, calibrated on this repository's history +([how](docs/target-app-parity.md#calibration-of-the-hours)). + +### Stage + +**Alpha**, because all six core workflows of the [alpha gate](docs/roadmap.md#alpha-gate) +(set up, animate, text and shapes, composite, preview, save and deliver) work end to end on macOS +and the work saves and reopens, and ready for real work (≈ 45%) is above the ≈ 40% bar. But: After Effects projects (`.aep`) can't be opened, which +alone rules out beta; fidelity against After Effects is measured for one narrow case (scalar ease, +168 samples); 216 issues are open on 12 October, six of them crash reports (#580, #501, #426, #341, #234, #879). Beta needs ≈ 75% ready and `.aep` +opening reliably: the `.aep` owner decision and importer (80–160 h), the fidelity harness and +P0/P1 corpus (60–100 h), the crash and bug backlog (40–80 h), performance (40–70 h), +Linux/Windows reliability (30–50 h) and depth in animation, masks, effects and text (100–160 h). + +## By dimension + +| Dimension | % | Hours | Doc | +|---|---:|---:|---| +| Features: breadth | 91% | — | [target-app-parity.md](docs/target-app-parity.md#by-feature-area) | +| Features: ready for real work | 50% | 360–660 | [target-app-parity.md](docs/target-app-parity.md#by-feature-area) | +| UI/UX fidelity | 65% | 60–120 | [ui-parity.md](docs/ui-parity.md) | +| File formats | 50% | 130–230 | [file-format-parity.md](docs/file-format-parity.md) | +| Hardware | 40% | 60–120 | [hardware-parity.md](docs/hardware-parity.md) | +| Localization | 24% | 60–110 + review | [localization-parity.md](docs/localization-parity.md) | +| Performance | 35% | 50–100 | [gaps.md](docs/gaps.md#g5-performance-at-real-world-scale) | +| Stability | 45% | 40–80 | [gaps.md](docs/gaps.md#g3-stability-and-a-green-main) | +| Platforms | 65% | 30–60 | [gaps.md](docs/gaps.md#g2-real-user-reliability-on-every-platform) | +| Ecosystem and plug-ins | 20% | 40–80 | [plugins.md](docs/plugins.md), [scripting-parity.md](docs/scripting-parity.md) | +| AI features | 35% | 40–80 | [gaps.md](docs/gaps.md) | +| Agent control (beyond After Effects) | ahead | — | [agents.md](docs/agents.md) | + +## Features + +| Area | Breadth | Ready | Hours | +|---|---:|---:|---:| +| Project, footage and import | 92% | 55% | 25–45 | +| Compositions, layers and compositing | 98% | 60% | 30–55 | +| Animation: keyframes, graph editor, motion paths, puppet | 97% | 55% | 35–60 | +| Expressions and scripting ([detail](docs/scripting-parity.md)) | 93% | 65% | 20–40 | +| Shapes, masks and roto | 93% | 45% | 30–50 | +| Text and typography | 94% | 50% | 20–35 | +| Effects and animation presets ([detail](docs/effects-parity.md)) | 85% | 40% | 70–130 | +| 3D (Classic and Advanced) | 82% | 35% | 35–65 | +| Tracking and AI-assisted tools | 80% | 35% | 35–70 | +| Preview and cache | 92% | 40% | 25–50 | +| Render queue and export | 85% | 55% | 25–45 | +| Audio | 85% | 45% | 6–12 | + +Weights and evidence per row: [target-app-parity.md](docs/target-app-parity.md#by-feature-area). + +## Languages + +UI strings translated out of ≈ 4,200 (detail: [localization-parity.md](docs/localization-parity.md)). + +| Language | Status | % | +|---|---|---:| +| English | full | 100% | +| Simplified Chinese | partial (menus, most of the panels) | 46% | +| Spanish | menus only | 29% | +| Hindi | none | 0% | +| Arabic | none | 0% | +| French | menus only | 16% | +| Portuguese (Brazil) | partial (menus, part of the panels) | 34% | +| Indonesian | none | 0% | +| Japanese | partial (menus, most of the panels) | 46% | +| German | menus only | 16% | +| Korean | none | 0% | +| Vietnamese | none | 0% | + +Also shipped: Traditional Chinese (partial, 38%), Ukrainian (partial, 29%), Czech (partial, 29%), Polish (partial, 34%), Georgian (partial, 39%; native-speaker reviewed), Russian (menus only, 15%) and Swedish (menus, panels and effect names; not yet measured). No other language has had +native-speaker review. + +## Upcoming + +Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gaps.md). + +| | Next | Hours | +|---|---|---:| +| 1 | Fix the open crash reports; run `cargo xtask ci` on every pull request (G3) | 15–30 | +| 2 | Fidelity harness against After Effects: rendered frames, a corpus case per P0/P1 feature (G1) | 60–100 | +| 3 | Real-user reliability on Linux and Windows; the open mask, effect, text and 3D bugs (G2) | 100–190 | +| 4 | `.aep` / `.aepx` import, after the owner's clean-room decision (G4) | 80–160 | +| 5 | Performance: benchmarks at 1080p / 4K, real-time cached playback, hardware video (G5) | 50–100 | +| 6 | Localization depth: effect names, all panels, Korean / Italian (G9) | 60–110 | + +Come tell us what matters most to you on [Discord](https://discord.gg/artcraft). + +## Progress log + +- 2026-11-05: ProRes 4444 and XQ exports write the required run after the final alpha + difference. The FilmCraft encoder pin fixes alpha movies rejected by native macOS + decoding; an export regression checks the stored bytes for both profiles, alpha modes, + and motion-blur settings (#293). Resolve itself still needs confirmation. +- 2026-10-30: Text strokes take a Line Join (Miter, Round or Bevel) in the Character panel, + Miter for new text as in After Effects (#2077). In the Timeline, effects, masks and shape items + drag to a new place in their stack (#2210) and Shift-click adds them to the selection, so one + animation preset can hold several (#2552). The Composition panel pans while a mask vertex is + held at its edge (#999). Effect buffers that pad a small layer stay within a memory budget + (#2261); an MP4 lasts as long as its edit list shows (#2592); the Render Queue's times tick + between frames (#2593). ScriptUI drags keep their control past the window edge with + `MouseEvent.buttons` (#2584), and docked panels get their dock's size and `onResize` (#2585). +- 2026-10-28: A shape layer's Rectangle and Ellipse Size get the Constrain Proportions chain + that Scale has, so a circle stays a circle while its size is typed, scrubbed or keyed; it + starts off, so existing shapes behave as before (#2489). +- 2026-10-24: Shape layers have the Wiggle Transform path operation (Contents ▸ Add, or + `layer.addShapeItem {kind: "wiggler"}`): it wiggles the anchor point, position, scale and + rotation of the paths above it by random amounts that change over time, up to the Transform + values it holds. The copies of a Repeater above it wiggle independently as far as its + Correlation allows; with the Repeater below it, they wiggle together. +- 2026-10-22: Localization: the panel/dialog catalogs gain 303 rows in Japanese, Simplified + Chinese and Traditional Chinese — panel tabs, form and dialog labels, panel context menus, + tracker/graph/text-panel controls, File-panel footers and credits. Recounted after #1774: + Japanese is 1,923 of ≈ 4,200 interface strings (46%, with 297 effect names); the Chinese + panel catalogs hold 998 (Simplified) and 951 (Traditional) rows, and Simplified Chinese is + 46% with its 307 effect names; the overall share is ≈ 24%. +- 2026-10-16: Convert To Bezier Path turns a shape layer's Rectangle, Ellipse or Polystar + path into an editable Path 1 with the same geometry, as After Effects does; it used to + apply to mask RotoBezier only, so a parametric shape path could not be converted at all + and its vertices could not be edited or animated (#932). +- 2026-10-14: Georgian (`ka`): every menu row, every panel-catalog row the Chinese catalogs have plus 195 Georgian-only ones, and the effect names and categories; Match System for `ka` / `ka-GE` / `ka_GE.UTF-8` locales. Reviewed by a native speaker. +- 2026-10-12: Roto Brush span edits report strokes outside a trimmed layer without panicking; + strokes and undo history are preserved so restoring the timing allows the span edit again. +- 2026-10-11: Ukrainian panels caught up with the Chinese catalogs. The 95 rows the panel + catalog gained since 9 October are translated: the Home screen (recent files, their Kind and + Opened columns, the empty and no-match states), the viewer's toolbar tooltips, magnification, + resolution, grid, channel and Fast Previews popups, the Appearance settings, the solid dialog + and the project, import, export and colour-management forms. `uk` now carries 495 of the 496 + panel rows — `RGB` reads the same in Ukrainian, so it falls back to the English source by + design — alongside its 618/618 menus. +- 2026-10-10: Full parity re-measure against After Effects 2026 26.5 (installed bundle, 26.2–26.5 + release notes, repository counts): breadth ≈ 91%, ready ≈ 45%, stage alpha. Progress docs + restructured: `docs/parity.md` became `docs/target-app-parity.md`; new + `docs/roadmap.md`, `localization-parity.md`, `file-format-parity.md`, `hardware-parity.md`, + `ui-parity.md`, `effects-parity.md` and `scripting-parity.md`. +- 2026-10-10: Spanish (#460) and Brazilian Portuguese (#217) menu translations. +- 2026-10-10: Japanese now translates the interface below the menu bar too: `crates/ui-egui/src/i18n/ui.rs` has a Japanese table with the same 396 rows as the Chinese ones (panels, dialogs, buttons and tooltips; the shape test keeps the three catalogs listing the same source strings). Menus were already Japanese. +- 2026-10-09: Ukrainian now covers all 396 current panel-catalog strings, including dialogs, buttons and tooltips, alongside its menu translation. The catalog keeps the same source keys and placeholder counts as the Chinese catalogs; missing or engine-generated text still falls back to English. + +- UI.6: Viewer breadcrumbs use theme colors for readable active text. The bottom control row scrolls horizontally at compact widths; keyboard focus reveals the selected control while dropdowns, exposure adjustments and snapshot holds retain their behavior. +- UI.3: Shared docking transactions and pointer targets now handle panel moves, splits, tab ordering and floating groups, preserving accordion metadata and the saved workspace schema. Dock dividers use bounded shared geometry and keyboard-accessible resize handles. Tiny layouts no longer reach an invalid floating-point clamp; workspace trees and saved layouts are retained. + +- 2026-10-09: Settings ▸ General ▸ Language now translates the interface below the menu bar as well: panels, dialogs, buttons and tooltips read their text through `crates/ui-egui/src/i18n/ui.rs`, keyed by the English source string. Simplified and Traditional Chinese are complete (384 strings); Japanese rows can follow in the same file. A test fails when a converted panel gains a hard-coded string, and another keeps the catalog free of unused rows. +- 2026-10-08: `effectcraft-cli render --out` resolves a relative path against the working directory, like `--project` (it used the project's folder, which doubled a path that already named it). Render Queue outputs set in a project are unchanged. +- 2026-10-08: Long-press a grouped toolbar button to choose its tools, including Horizontal/Vertical Type; releasing the hold keeps the menu open. Existing point/paragraph text creation is unchanged. +- 2026-10-06: Settings ▸ General ▸ Language persists English/Japanese menu labels (`general.language`); native UI reuses installed Japanese font fallback, with no bundled CJK font. Dialog and panel contents remain English. +- 2026-10-05: Honest assessment ([docs/gaps.md](docs/gaps.md)): breadth ≈ 99% by our own checklist, real use ≈ 30–50%; workstreams G1–G9. +- 2026-10-04: Checklist audit at `d39c0e8`: 89 done / 3 partial / 0 missing of 92 features. +- 2026-10-01: First commit. + +## Revision history + +| Date | Change | Summary | +|---|---|---| +| 2026-10-30 | minor | Progress log: text Line Join, Timeline drag-reorder and Shift multi-select of effects, viewer edge pan, effect padding budget, MP4 edit-list duration, Render Queue clock, ScriptUI drag capture and docked-panel size | +| 2026-10-22 | minor | Localization: 300 more panel/dialog rows in Japanese and the Chinese catalogs, plus the review's three missing rows (Basic, Advanced, Play/Stop) — panel tabs, form and dialog labels, context menus, tracker/graph/text-panel controls, File-panel footers, credits; language shares recounted after #1774 (Japanese 27% → 46% with 297 effect names, Simplified Chinese 29% → 46% with 307 effect names, Traditional Chinese 29% → 38%, overall 18% → 24%) | +| 2026-10-12 | minor | Open-issue count (134 to 216), crash list and localization share (12% to 18%) updated to match docs/gaps.md | +| 2026-10-12 | patch | Roto Brush span validation after trimming; command regressions for both layer edges | +| 2026-10-12 | minor | Shared PDF object/xref parsing with bounded app-owned conversion and preserved stream budgets; drawing, EPS and image/font policy remain unchanged | +| 2026-10-10 | minor | Hours to ≈ 95% for each audience | +| 2026-10-10 | minor | Headline adds mainstream practitioner (≈ 47%) and essentials user (≈ 52%) | +| 2026-10-10 | major | Progress docs restructured: stage, two numbers, dimensions, features, languages, upcoming, progress log; milestones moved to docs/roadmap.md | +| 2026-10-10 | minor | Stage checked against the new core-workflow gate (all six pass; still alpha) | +| 2026-10-05 | major | Two numbers (breadth vs real use) and workstreams G1–G9 | diff --git a/apps/effectcraft/Cargo.toml b/apps/effectcraft/Cargo.toml index 21bd46755..2c8224f65 100644 --- a/apps/effectcraft/Cargo.toml +++ b/apps/effectcraft/Cargo.toml @@ -41,6 +41,9 @@ zbus = "5.19" # Icon + VERSIONINFO for effectcraft.exe; build.rs only uses it when targeting Windows. winresource = "0.1" +[dev-dependencies] +tempfile = { workspace = true } + [target.'cfg(target_os = "macos")'.dependencies] # Keep the control channel responsive when the window is covered (App Nap / occlusion throttling). objc2-foundation = { version = "0.3", default-features = false, features = ["std", "NSProcessInfo", "NSString", "NSObject"] } diff --git a/apps/effectcraft/src/crash_report.rs b/apps/effectcraft/src/crash_report.rs index 6ca42aab7..3080c12bb 100644 --- a/apps/effectcraft/src/crash_report.rs +++ b/apps/effectcraft/src/crash_report.rs @@ -426,6 +426,7 @@ mod tests { } fn helper_mode(dir: &Path, id: &str, interactive: bool) -> Reporter { + let _spawn_lock = crate::test_child_spawn_lock(); let mut child = Command::new(std::env::current_exe().unwrap()) .args(["--exact", &test_name("reporter_process"), "--ignored", "--nocapture"]) .env(ROLE, "reporter") @@ -550,6 +551,7 @@ mod tests { #[test] fn accepted_native_close_finishes_before_process_termination() { let dir = folder(); + let _spawn_lock = crate::test_child_spawn_lock(); let status = Command::new(std::env::current_exe().unwrap()) .args(["--exact", &test_name("aborting_parent"), "--ignored", "--nocapture"]) .env(ROLE, "native-close") @@ -595,6 +597,7 @@ mod tests { #[test] fn an_aborting_parent_leaves_one_diagnostic_report() { let dir = folder(); + let _spawn_lock = crate::test_child_spawn_lock(); let status = Command::new(std::env::current_exe().unwrap()) .args(["--exact", &test_name("aborting_parent"), "--ignored", "--nocapture"]) .env(ROLE, "abort") @@ -616,6 +619,7 @@ mod tests { fn an_unrelated_child_does_not_keep_the_control_pipe_open() { let dir = folder(); let r = helper(&dir, "5-1"); + let _spawn_lock = crate::test_child_spawn_lock(); let mut unrelated = Command::new(std::env::current_exe().unwrap()) .args(["--exact", &test_name("lingering_child"), "--ignored", "--nocapture"]) .env(ROLE, "linger") @@ -632,6 +636,7 @@ mod tests { #[test] fn an_unresponsive_helper_cannot_hang_clean_shutdown() { + let _spawn_lock = crate::test_child_spawn_lock(); let mut child = Command::new(std::env::current_exe().unwrap()) .args(["--exact", &test_name("lingering_child"), "--ignored", "--nocapture"]) .env(ROLE, "linger") @@ -704,6 +709,7 @@ mod tests { #[cfg(windows)] fn windows_report_preserves_real_unsigned_exit_bits() { let dir = folder(); + let _spawn_lock = crate::test_child_spawn_lock(); let status = Command::new(std::env::current_exe().unwrap()) .args(["--exact", &test_name("aborting_parent"), "--ignored", "--nocapture"]) .env(ROLE, "windows-status") diff --git a/apps/effectcraft/src/launch_guard.rs b/apps/effectcraft/src/launch_guard.rs index 2656179ac..85d1fdd57 100644 --- a/apps/effectcraft/src/launch_guard.rs +++ b/apps/effectcraft/src/launch_guard.rs @@ -214,8 +214,8 @@ mod tests { /// A launch that never drew switches the next one to OpenGL, which then stays (#243). #[test] fn a_launch_that_never_drew_switches_the_next_to_opengl() { - let dir = std::env::temp_dir().join(format!("ec-launch-guard-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); + let _spawn_lock = crate::test_child_spawn_lock(); + let dir = fresh_dir("never-drew"); // A first launch that draws: nothing changes. Its first frames don't settle it (a driver // may still crash as the window is shown); frames for `SETTLE` do. let mut l = Launch::begin(Some(&dir), false); @@ -259,8 +259,8 @@ mod tests { /// normal quit in that time doesn't. #[test] fn a_launch_that_stops_after_its_first_frame_switches_the_next_to_opengl() { - let dir = std::env::temp_dir().join(format!("ec-launch-guard-3-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); + let _spawn_lock = crate::test_child_spawn_lock(); + let dir = fresh_dir("first-frame"); let mut l = Launch::begin(Some(&dir), false); assert!(l.frame_drawn().is_some()); drop(l); @@ -286,8 +286,8 @@ mod tests { /// open a window either goes back to Automatic instead of failing every launch. #[test] fn a_second_copy_or_failed_opengl_doesnt_strand_window_graphics() { - let dir = std::env::temp_dir().join(format!("ec-launch-guard-2-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); + let _spawn_lock = crate::test_child_spawn_lock(); + let dir = fresh_dir("second-copy"); let _first = Launch::begin(Some(&dir), false); assert_eq!(Launch::begin(Some(&dir), false).backends, None); assert_eq!(window_graphics(&dir), "auto"); @@ -303,10 +303,7 @@ mod tests { /// A fresh settings folder for one test. fn fresh_dir(case: &str) -> PathBuf { - let dir = std::env::temp_dir().join(format!("ec-launch-guard-{case}-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); - std::fs::create_dir_all(&dir).unwrap(); - dir + tempfile::Builder::new().prefix(&format!("ec-launch-guard-{case}-")).tempdir().unwrap().keep() } /// Window Graphics saved as OpenGL. @@ -318,6 +315,7 @@ mod tests { #[test] fn a_second_copy_reports_the_saved_backend_without_owning_the_guard() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("second-source"); save_opengl(&dir); let mut first = Launch::begin(Some(&dir), false); @@ -333,6 +331,7 @@ mod tests { /// one's marker (#477). #[test] fn a_second_copy_quitting_leaves_the_running_launchs_marker() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("second-quits"); let mut first = Launch::begin(Some(&dir), false); let mut second = Launch::begin(Some(&dir), false); @@ -346,6 +345,7 @@ mod tests { /// A second copy whose OpenGL window fails doesn't remove a running launch's marker. #[test] fn failed_opengl_in_a_second_copy_leaves_the_running_launchs_marker() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("second-gl-fails"); let mut first = Launch::begin(Some(&dir), false); let second = Launch::begin(Some(&dir), false); @@ -360,6 +360,7 @@ mod tests { /// With `WGPU_BACKEND` set, a stale marker and a saved OpenGL choice are left as they are. #[test] fn wgpu_backend_leaves_a_stale_marker_and_saved_opengl_alone() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("env-override"); save_opengl(&dir); std::fs::write(dir.join(MARKER), b"stale-marker").unwrap(); @@ -376,6 +377,7 @@ mod tests { /// After OpenGL fails to open a window, the next launch is back on Automatic, without a notice. #[test] fn failed_opengl_puts_the_next_launch_back_on_automatic() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("gl-recovers"); save_opengl(&dir); let l = Launch::begin(Some(&dir), false); @@ -396,6 +398,7 @@ mod tests { #[cfg(unix)] #[test] fn the_guard_file_stays_the_same_file_across_launches() { + let _spawn_lock = crate::test_child_spawn_lock(); use std::os::unix::fs::MetadataExt; let dir = fresh_dir("guard-identity"); let mut a = Launch::begin(Some(&dir), false); @@ -417,6 +420,7 @@ mod tests { /// A second copy's frames and quit neither settle nor unlock the running launch. #[test] fn a_second_copys_frames_dont_settle_the_running_launch() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("second-frames"); let mut a = Launch::begin(Some(&dir), false); std::fs::write(dir.join(MARKER), b"owner-marker").unwrap(); @@ -438,6 +442,7 @@ mod tests { /// once it has stopped without settling the next launch still switches to OpenGL. #[test] fn a_running_older_version_holding_the_marker_is_left_alone() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("older-version"); std::fs::write(dir.join(MARKER), b"old-owner").unwrap(); std::fs::write(dir.join(PREFS_FILE), Prefs::default().to_json()).unwrap(); @@ -468,6 +473,7 @@ mod tests { #[cfg(windows)] #[test] fn an_unopenable_marker_leaves_settings_and_marker_alone() { + let _spawn_lock = crate::test_child_spawn_lock(); use std::os::windows::fs::OpenOptionsExt; let dir = fresh_dir("marker-unopenable"); @@ -491,6 +497,7 @@ mod tests { /// A guard file that can't be opened leaves Window Graphics and the marker as they are. #[test] fn an_unusable_guard_file_leaves_settings_and_marker_alone() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("guard-unusable"); std::fs::create_dir(dir.join(LOCK)).unwrap(); std::fs::write(dir.join(MARKER), b"stale-marker").unwrap(); @@ -512,6 +519,7 @@ mod tests { /// Window Graphics to Automatic and removes the marker. #[test] fn failed_opengl_cleanup_waits_for_the_running_launch() { + let _spawn_lock = crate::test_child_spawn_lock(); let dir = fresh_dir("gl-cleanup-waits"); save_opengl(&dir); let launch = Launch::begin(Some(&dir), false); diff --git a/apps/effectcraft/src/main.rs b/apps/effectcraft/src/main.rs index 5a602adcb..b07e3ce43 100644 --- a/apps/effectcraft/src/main.rs +++ b/apps/effectcraft/src/main.rs @@ -35,6 +35,17 @@ mod window; use effectcraft_ui_egui::EffectcraftApp; use serde_json::json; +// On Unix, a subprocess briefly inherits every non-CLOFORK descriptor between fork and exec. +// The app's guard-lock tests hold an advisory lock while crash-reporter tests spawn child +// processes; coordinate just those intervals so an unrelated test child cannot extend a lock. +#[cfg(test)] +static TEST_CHILD_SPAWN_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); + +#[cfg(test)] +fn test_child_spawn_lock() -> std::sync::MutexGuard<'static, ()> { + TEST_CHILD_SPAWN_LOCK.lock().unwrap_or_else(std::sync::PoisonError::into_inner) +} + /// The app icon for the window, taskbar and Dock (assets/app-icon, regenerated by /// `packaging/icons.sh`). macOS gets the padded variant so it sits on Apple's icon grid in the Dock. /// The 256 px app icon (Windows, Linux; the AppImage's desktop integration installs it too). diff --git a/clippy.toml b/clippy.toml index 3522a15b6..a4200a0e1 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,8 +1,8 @@ -allow-unwrap-in-tests = true -allow-expect-in-tests = true -allow-panic-in-tests = true -allow-indexing-slicing-in-tests = true -disallowed-types = [ - { path = "egui::ComboBox", reason = "use craft_ui::ComboBox: egui's combo box menu can't grow back while open (egui#5225)" }, -] -cognitive-complexity-threshold = 30 +allow-unwrap-in-tests = true +allow-expect-in-tests = true +allow-panic-in-tests = true +allow-indexing-slicing-in-tests = true +disallowed-types = [ + { path = "egui::ComboBox", reason = "use craft_ui::ComboBox: egui's combo box menu can't grow back while open (egui#5225)" }, +] +cognitive-complexity-threshold = 30 diff --git a/contributors/people.toml b/contributors/people.toml index e9144f9ea..beb91a413 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -135,3 +135,6 @@ display_name = "Jonathan Cardoso" [people.nazar-gavrylyk] sync_github_name = true + +[people.andreaaazo] +sync_github_name = true diff --git a/crates/aep/Cargo.toml b/crates/aep/Cargo.toml index b1bf3f9fe..0523edb9b 100644 --- a/crates/aep/Cargo.toml +++ b/crates/aep/Cargo.toml @@ -10,18 +10,15 @@ rust-version.workspace = true workspace = true [dependencies] +craft-aep = { workspace = true } effectcraft-time = { workspace = true } effectcraft-color = { workspace = true } effectcraft-keyframe = { workspace = true } effectcraft-project = { workspace = true } effectcraft-effects = { workspace = true } +log = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } [dev-dependencies] serde_json = { workspace = true } - -# The tool's own tests run with the crate's (examples are only built by default). -[[example]] -name = "stubicc" -test = true diff --git a/crates/aep/README.md b/crates/aep/README.md index 5e8035d8f..0e65d86f8 100644 --- a/crates/aep/README.md +++ b/crates/aep/README.md @@ -3,7 +3,9 @@ After Effects projects (`.aep`, `.aepx`) in one crate, the way `effectcraft-lottie` handles Lottie: - `container`: reads and writes the container as a lossless chunk tree, with a typed, read-only - view (below; its API is re-exported at the crate root); + view (below). This is `craft-aep` from [storytold/craft-libs](https://github.com/storytold/craft-libs), + re-exported at the crate root; its container tests and the `aepdump`/`stubicc` tools are there. + Only `effect_map` and `style_map` (After Effects effects and layer styles to EffectCraft's) are here; - `import`: maps the typed view into an EffectCraft project and reports everything it does not import ([`docs/aep-import.md`](../../docs/aep-import.md)); - `export`: writes an EffectCraft project as an `.aep` with every chunk built in code, and reports everything it does not export @@ -21,7 +23,9 @@ tree; pad bytes, odd bodies and the bytes after the container, an XMP packet, ar The XML form of a project (`.aepx`) is read into the same tree by `read_aepx` (a small bounded XML tokenizer, no dependency); `parse_any` picks the reader by content, so the typed view and the -importer take either form. The mapping is in `docs/aep-format.md`, section 1. +importer take either form. The mapping is in `docs/aep-format.md`, section 1. The importer, which +only reads, does not build the owned tree: it reads either form through the flat index +`TreeIndex`, an `.aep` in place and an `.aepx` decoded into one buffer first. Bodies that look like lists but are not chunk sequences (for example `LIST btdk`, raw text) stay opaque rather than failing the parse. Input is untrusted: sizes are checked against the remaining @@ -75,6 +79,10 @@ solid, a folder, a Levels and a Glow effect with expressions). Every After Effec the working space's ICC profile (HP sRGB IEC61966-2.1 for the default) in a JSON settings chunk; the one `Utf8` chunk of this file that held a profile was replaced by `{}`, and nothing else was changed. The tests in `tests/it/import/synthetic.rs` damage copies of it and need no other file. +`tests/fixtures/text-synthetic.aep` is the other: made in After Effects 2026 the same way (working +space None, nothing changed after the save), one composition with two text layers that hold a +text animator's Stroke Opacity (static and keyed) and Source Text expressions (enabled and +disabled); `tests/it/import/text_synthetic.rs` reads it (#3170). `tests/fixtures/ai-mask-3099.aep` (131 KB, #3099) is the second: four hand-written one-page PDFs named `.ai` with distinct page boxes, placed in a composition, one of them with two masks under a @@ -86,14 +94,9 @@ the import against After Effects' read-back, and the host's `vector_import` test - `tests/fixtures/tools/`: the generator of the test projects (regenerates the corpus with After Effects; its README says how). -- `examples/aepdump.rs`: prints the chunk tree of a file (ids, sizes, short data, match names): - `cargo run -p effectcraft-aep --example aepdump -- file.aep`. -- `examples/stubicc.rs`: replaces every embedded ICC profile of a saved project by a stub that keeps - only the profile's description: the JSON `colorProfileData` of the working space (any white space - around the colon, `\/` escapes, quotes as `"`) in an `.aep` chunk or the `.aepx` text, and a raw - profile of an imported image (an `.aep` chunk, or the `bdata` hex of an `.aepx`): - `cargo run -p effectcraft-aep --example stubicc -- in.aep out.aep`. A profile it cannot replace - stops it before anything is written. The importer reads the working space's name from the - description only, so the project imports the same; no vendor colour data stays in the test - project. Check the result independently, not by the tool's count (the corpus repository has - `tools/aep/inspect-embedded.py`, which scans the raw bytes, base64 and hex). +- `aepdump` (prints the chunk tree of a file) and `stubicc` (replaces every embedded ICC profile of a + saved project by a stub) are examples of `craft-aep` in + [storytold/craft-libs](https://github.com/storytold/craft-libs): + `cargo run -p craft-aep --example stubicc -- in.aep out.aep` there. Check the result independently, + not by the tool's count (the corpus repository has `tools/aep/inspect-embedded.py`, which scans the + raw bytes, base64 and hex). diff --git a/crates/aep/examples/aepdump.rs b/crates/aep/examples/aepdump.rs deleted file mode 100644 index 2fe492696..000000000 --- a/crates/aep/examples/aepdump.rs +++ /dev/null @@ -1,75 +0,0 @@ -//! Developer tool: prints the chunk tree of an .aep (ids, sizes, short data), match names inline. -#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] -use effectcraft_aep::{Body, Chunk}; - -/// Ends this developer tool with a message instead of a panic. -trait OrExit { - fn or_exit(self, what: &str) -> T; -} - -impl OrExit for Option { - fn or_exit(self, what: &str) -> T { - match self { - Some(v) => v, - None => exit(what), - } - } -} - -impl OrExit for Result { - fn or_exit(self, what: &str) -> T { - match self { - Ok(v) => v, - Err(e) => exit(&format!("{what}: {e:?}")), - } - } -} - -fn exit(msg: &str) -> ! { - eprintln!("{msg}"); - std::process::exit(1) -} - -fn show(c: &Chunk<'_>, depth: usize, max: usize, hex: usize) { - let ind = " ".repeat(depth); - let id = String::from_utf8_lossy(&c.id).to_string(); - match &c.body { - Body::Data(d) if &c.id == b"tdmn" => { - let n: String = d.iter().take_while(|b| **b != 0).map(|b| *b as char).collect(); - println!("{ind}tdmn {n}"); - } - Body::Data(d) => { - let h: String = d.iter().take(hex).map(|b| format!("{b:02x}")).collect(); - let a: String = d.iter().take(hex).map(|b| if (32..127).contains(b) { *b as char } else { '.' }).collect(); - println!("{ind}{id} [{}] {h} |{a}|", d.len()); - } - Body::Chunks(k) => { - println!("{ind}{id} (nested)"); - if depth < max { - for x in k { - show(x, depth + 1, max, hex); - } - } - } - Body::List { list_type, children } => { - println!("{ind}LIST {} ({} children)", String::from_utf8_lossy(list_type), children.len()); - if depth < max { - for x in children { - show(x, depth + 1, max, hex); - } - } - } - Body::OpaqueList { list_type, data } => println!("{ind}LIST {} opaque [{}]", String::from_utf8_lossy(list_type), data.len()), - } -} -fn main() { - let a: Vec = std::env::args().collect(); - let bytes = std::fs::read(a.get(1).or_exit("usage: see the comment at the top of this file")).or_exit("read"); - let max: usize = a.get(2).and_then(|s| s.parse().ok()).unwrap_or(4); - let hex: usize = a.get(3).and_then(|s| s.parse().ok()).unwrap_or(32); - let f = effectcraft_aep::parse(&bytes).or_exit("parse"); - for c in &f.chunks { - show(c, 0, max, hex); - } - println!("trailer {} bytes", f.trailer.len()); -} diff --git a/crates/aep/examples/stubicc.rs b/crates/aep/examples/stubicc.rs deleted file mode 100644 index 9438da06d..000000000 --- a/crates/aep/examples/stubicc.rs +++ /dev/null @@ -1,359 +0,0 @@ -//! Developer tool: replaces every embedded ICC profile of an .aep / .aepx by a stub that keeps only the -//! profile's description. Fixture hygiene: a saved project carries the vendor's working-space profile -//! (a few KB of colour data); the importer reads only the profile's name, the `desc` tag, so the stub -//! (a 128-byte header, one `desc` tag, no colour data, made here) imports identically. -//! -//! `cargo run -p effectcraft-aep --example stubicc -- in.aep out.aep` -//! -//! It handles: -//! - the JSON value `"colorProfileData": ""` in any chunk of an .aep and anywhere in the text -//! of an .aepx (white space around the colon, `\/` escapes and quotes written as `"` allowed); -//! - a raw ICC profile stored as a chunk of its own (the profile of an imported image), in an .aep -//! as the chunk's bytes and in an .aepx as its `bdata=""` attribute. -//! -//! A profile it cannot replace (no readable description, data that does not decode) stops the tool -//! before anything is written. Check the result independently (the corpus has -//! `tools/aep/inspect-embedded.py`), not by this tool's own count. -#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] -use effectcraft_aep::{Body, Chunk}; - -const B64: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -/// Ends this developer tool with a message instead of a panic. -trait OrExit { - fn or_exit(self, what: &str) -> T; -} - -impl OrExit for Option { - fn or_exit(self, what: &str) -> T { - match self { - Some(v) => v, - None => exit(what), - } - } -} - -impl OrExit for Result { - fn or_exit(self, what: &str) -> T { - match self { - Ok(v) => v, - Err(e) => exit(&format!("{what}: {e:?}")), - } - } -} - -fn exit(msg: &str) -> ! { - eprintln!("{msg}"); - std::process::exit(1) -} - -fn b64_decode(text: &[u8]) -> Option> { - let (mut out, mut acc, mut bits) = (Vec::new(), 0u32, 0u32); - for &c in text.iter().filter(|c| **c != b'=') { - let v = u32::try_from(B64.iter().position(|b| *b == c)?).ok()?; - acc = (acc << 6 | v) & 0x00ff_ffff; - bits += 6; - if bits >= 8 { - bits -= 8; - out.push(((acc >> bits) & 0xff) as u8); - } - } - Some(out) -} - -fn b64_encode(data: &[u8]) -> Vec { - let mut out = Vec::new(); - for ch in data.chunks(3) { - let at = |i: usize| u32::from(ch.get(i).copied().unwrap_or(0)); - let n = (at(0) << 16) | (at(1) << 8) | at(2); - for i in 0..4usize { - if i <= ch.len() { - out.push(B64.get(((n >> (18 - 6 * i)) & 63) as usize).copied().unwrap_or(b'A')); - } else { - out.push(b'='); - } - } - } - out -} - -fn be32(d: &[u8], at: usize) -> Option { - let b: [u8; 4] = d.get(at..at.checked_add(4)?)?.try_into().ok()?; - usize::try_from(u32::from_be_bytes(b)).ok() -} - -/// The profile description (ICC.1 `desc`: v2 ASCII or v4 `mluc`, first record). -fn description(icc: &[u8]) -> Option { - let count = be32(icc, 128)?; - let tag = (0..count.min(1024)).find_map(|i| { - let at = 132usize.checked_add(i.checked_mul(12)?)?; - (icc.get(at..at.checked_add(4)?)? == b"desc").then_some(at) - })?; - let off = be32(icc, tag.checked_add(4)?)?; - let body = icc.get(off..off.checked_add(be32(icc, tag.checked_add(8)?)?)?)?; - let text = match body.get(..4)? { - b"desc" => { - let n = be32(body, 8)?; - String::from_utf8_lossy(body.get(12..12usize.checked_add(n)?)?.split(|b| *b == 0).next()?).into_owned() - } - b"mluc" => { - let (n, at) = (be32(body, 20)?, be32(body, 24)?); - let units: Vec = body.get(at..at.checked_add(n)?)?.chunks(2).filter_map(|p| Some(u16::from_be_bytes([*p.first()?, *p.get(1)?]))).collect(); - String::from_utf16_lossy(&units) - } - _ => return None, - }; - Some(text.trim_end_matches('\0').trim().to_owned()) -} - -/// A profile with a header, one `desc` tag and no colour data. -fn stub(desc: &str) -> Option> { - let mut body = b"desc\0\0\0\0".to_vec(); - body.extend_from_slice(&u32::try_from(desc.len().checked_add(1)?).ok()?.to_be_bytes()); - body.extend_from_slice(desc.as_bytes()); - body.push(0); - body.extend_from_slice(&[0; 4 + 4 + 2 + 1 + 67]); - let mut p = vec![0u8; 128]; - for (at, v) in [(8, &0x0240_0000u32.to_be_bytes()[..]), (12, b"mntr"), (16, b"RGB "), (20, b"XYZ "), (36, b"acsp")] { - p.get_mut(at..at + v.len())?.copy_from_slice(v); - } - p.extend_from_slice(&1u32.to_be_bytes()); - p.extend_from_slice(b"desc"); - p.extend_from_slice(&144u32.to_be_bytes()); - p.extend_from_slice(&u32::try_from(body.len()).ok()?.to_be_bytes()); - p.extend_from_slice(&body); - let size = u32::try_from(p.len()).ok()?.to_be_bytes(); - p.get_mut(..4)?.copy_from_slice(&size); - Some(p) -} - -/// The JSON key, without its quotes. -const KEY: &[u8] = b"colorProfileData"; -/// How a JSON quote is written: as is (a `Utf8` chunk, the `` text of an .aepx) and as an -/// XML entity (JSON inside an attribute of an .aepx). -const QUOTES: [&[u8]; 2] = [b"\"", b"""]; - -/// What the tool did, counted. -#[derive(Default)] -struct Tally { - stubbed: usize, - /// Values too short to be a profile (no ICC header), kept as they are. - kept_short: usize, - /// Profiles that could not be replaced (no readable description, undecodable data): the tool - /// fails, so no profile is ever left behind silently. - failed: Vec, -} - -fn is_profile(d: &[u8]) -> bool { - d.len() > 132 && d.get(36..40) == Some(b"acsp") -} - -/// The stub for the bytes `d` of a value, or `None` (counted) when it holds no profile or the -/// profile has no readable description. -fn stub_of(d: &[u8], at: usize, tally: &mut Tally) -> Option> { - if !is_profile(d) { - tally.kept_short += 1; - return None; - } - let s = description(d).and_then(|t| stub(&t)); - if s.is_none() { - tally.failed.push(format!("profile at byte {at}: no readable description")); - } - s -} - -/// At the start of `t`: the key in quotes, optional white space, a colon, optional white space and -/// the opening quote of the value. Returns the length up to and including that quote, and the quote. -fn value_start(t: &[u8]) -> Option<(usize, &'static [u8])> { - let ws = |mut i: usize| { - while t.get(i).is_some_and(u8::is_ascii_whitespace) { - i += 1; - } - i - }; - QUOTES.into_iter().find_map(|q| { - let key_end = q.len().checked_mul(2)?.checked_add(KEY.len())?; - let quoted = t.get(..key_end)?; - if !(quoted.starts_with(q) && quoted.get(q.len()..q.len() + KEY.len())? == KEY && quoted.ends_with(q)) { - return None; - } - let colon = ws(key_end); - if t.get(colon) != Some(&b':') { - return None; - } - let open = ws(colon + 1); - t.get(open..)?.starts_with(q).then_some((open + q.len(), q)) - }) -} - -fn hex_decode(h: &[u8]) -> Option> { - if !h.len().is_multiple_of(2) { - return None; - } - h.chunks(2).map(|p| u8::from_str_radix(std::str::from_utf8(p).ok()?, 16).ok()).collect() -} - -fn hex_encode(d: &[u8], upper: bool) -> Vec { - d.iter().flat_map(|b| if upper { format!("{b:02X}") } else { format!("{b:02x}") }.into_bytes()).collect() -} - -/// Replaces, in `text`, every `colorProfileData` JSON value (base64; `\/` escapes, white space -/// around the colon and quotes written as `"` allowed) and every .aepx `bdata=""` -/// attribute that holds a raw profile. -fn stub_text(text: &[u8], tally: &mut Tally) -> Vec { - const BDATA: &[u8] = b"bdata=\""; - let (mut out, mut i) = (Vec::with_capacity(text.len()), 0); - while let Some(&b) = text.get(i) { - let rest = text.get(i..).unwrap_or_default(); - if let Some((open, q)) = value_start(rest) - && let Some(len) = rest.get(open..).and_then(|v| v.windows(q.len()).position(|w| w == q)) - { - let raw = rest.get(open..open + len).unwrap_or_default(); - let unescaped: Vec = raw.iter().copied().filter(|c| *c != b'\\').collect(); - let replaced = match b64_decode(&unescaped) { - Some(d) => stub_of(&d, i, tally).map(|s| b64_encode(&s)), - None => { - tally.failed.push(format!("colorProfileData at byte {i}: not base64")); - None - } - }; - out.extend_from_slice(rest.get(..open).unwrap_or_default()); - match replaced { - Some(enc) => { - out.extend_from_slice(&enc); - tally.stubbed += 1; - } - None => out.extend_from_slice(raw), - } - i += open + len; - continue; - } - if rest.starts_with(BDATA) - && let Some(len) = rest.get(BDATA.len()..).and_then(|v| v.iter().position(|c| *c == b'"')) - { - let hex = rest.get(BDATA.len()..BDATA.len() + len).unwrap_or_default(); - let replaced = hex_decode(hex).filter(|d| is_profile(d)).and_then(|d| stub_of(&d, i, tally)); - out.extend_from_slice(BDATA); - match replaced { - Some(s) => { - out.extend_from_slice(&hex_encode(&s, hex.iter().any(u8::is_ascii_uppercase))); - tally.stubbed += 1; - } - None => out.extend_from_slice(hex), - } - i += BDATA.len() + len; - continue; - } - out.push(b); - i += 1; - } - out -} - -fn walk(chunks: &mut [Chunk<'_>], tally: &mut Tally) { - for c in chunks.iter_mut() { - // Only a data chunk is rewritten as one: an opaque `LIST` also has bytes, but replacing it by - // a data chunk would drop its list type. - let data = if let Body::Data(d) = &c.body { Some(d.to_vec()) } else { None }; - match data { - Some(d) if d.windows(KEY.len()).any(|w| w == KEY) => { - let new = stub_text(&d, tally); - *c = Chunk::data(c.id, new); - } - Some(d) if is_profile(&d) => { - if let Some(s) = stub_of(&d, 0, tally) { - *c = Chunk::data(c.id, s); - tally.stubbed += 1; - } - } - _ => { - if let Body::List { children, .. } | Body::Chunks(children) = &mut c.body { - walk(children, tally); - } - } - } - } -} - -fn main() { - let args: Vec = std::env::args().collect(); - let (Some(input), Some(output)) = (args.get(1), args.get(2)) else { exit("usage: stubicc ") }; - let bytes = std::fs::read(input).or_exit("read the input"); - let mut tally = Tally::default(); - let out = if input.ends_with(".aepx") { - stub_text(&bytes, &mut tally) - } else { - let mut file = effectcraft_aep::parse(&bytes).or_exit("parse the input"); - walk(&mut file.chunks, &mut tally); - effectcraft_aep::write(&file).or_exit("write the output") - }; - if !tally.failed.is_empty() { - exit(&format!("nothing written: {} profile(s) could not be replaced:\n{}", tally.failed.len(), tally.failed.join("\n"))); - } - std::fs::write(output, out).or_exit("write the output"); - println!("stubbed {} profile(s); kept {} short value(s) that hold no profile", tally.stubbed, tally.kept_short); -} - -#[cfg(test)] -#[allow(clippy::unwrap_used)] -mod tests { - use super::*; - - fn profile(desc: &str) -> Vec { - // A profile with colour data after the description (like a real one): the stub of `desc` - // plus 3000 bytes, its size field updated. - let mut p = stub(desc).unwrap(); - p.extend(std::iter::repeat_n(0x5a, 3000)); - let size = u32::try_from(p.len()).unwrap().to_be_bytes(); - p[..4].copy_from_slice(&size); - p - } - - fn stubbed(text: &[u8]) -> (Vec, Tally) { - let mut tally = Tally::default(); - (stub_text(text, &mut tally), tally) - } - - #[test] - fn json_values_in_every_spelling_are_replaced() { - let b64 = String::from_utf8(b64_encode(&profile("sRGB IEC61966-2.1"))).unwrap(); - let want = String::from_utf8(b64_encode(&stub("sRGB IEC61966-2.1").unwrap())).unwrap(); - for (before, after) in [ - (format!("{{\"colorProfileData\":\"{b64}\"}}"), format!("{{\"colorProfileData\":\"{want}\"}}")), - (format!("{{\"colorProfileData\" : \n\t\"{b64}\"}}"), format!("{{\"colorProfileData\" : \n\t\"{want}\"}}")), - (format!("{{\"colorProfileData\":\"{}\"}}", b64.replace('/', "\\/")), format!("{{\"colorProfileData\":\"{want}\"}}")), - (format!("{{"colorProfileData": "{b64}"}}"), format!("{{"colorProfileData": "{want}"}}")), - ] { - let (out, tally) = stubbed(before.as_bytes()); - assert_eq!(String::from_utf8(out).unwrap(), after); - assert_eq!((tally.stubbed, tally.failed.len()), (1, 0)); - } - } - - #[test] - fn a_raw_profile_in_aepx_hex_is_replaced_and_other_hex_kept() { - let hex = String::from_utf8(hex_encode(&profile("Rec.709 Gamma 2.4"), false)).unwrap(); - let want = String::from_utf8(hex_encode(&stub("Rec.709 Gamma 2.4").unwrap(), false)).unwrap(); - let text = format!("", "ab".repeat(200)); - let (out, tally) = stubbed(text.as_bytes()); - assert_eq!(String::from_utf8(out).unwrap(), format!("", "ab".repeat(200))); - assert_eq!((tally.stubbed, tally.failed.len()), (1, 0)); - // Upper-case hex stays upper case. - let (out, _) = stubbed(format!("bdata=\"{}\"", hex.to_uppercase()).as_bytes()); - assert_eq!(String::from_utf8(out).unwrap(), format!("bdata=\"{}\"", want.to_uppercase())); - } - - #[test] - fn a_profile_that_cannot_be_replaced_is_a_failure_not_a_silent_copy() { - // An ICC header whose tag table has no `desc`. - let mut p = profile("x"); - p[132..136].copy_from_slice(b"wtpt"); - let (_, tally) = stubbed(format!("\"colorProfileData\":\"{}\"", String::from_utf8(b64_encode(&p)).unwrap()).as_bytes()); - assert_eq!((tally.stubbed, tally.failed.len()), (0, 1)); - let (_, tally) = stubbed(b"\"colorProfileData\":\"not*base64\""); - assert_eq!(tally.failed.len(), 1); - // A short value holds no profile: kept and counted, not a failure. - let (out, tally) = stubbed(b"\"colorProfileData\":\"AAAA\""); - assert_eq!((out.as_slice(), tally.kept_short, tally.failed.len()), (&b"\"colorProfileData\":\"AAAA\""[..], 1, 0)); - } -} diff --git a/crates/aep/src/container.rs b/crates/aep/src/container.rs index 531d74843..d9dbcfb14 100644 --- a/crates/aep/src/container.rs +++ b/crates/aep/src/container.rs @@ -1,61 +1,7 @@ -//! After Effects project (`.aep`) container reader and writer. -//! -//! An `.aep` is a `RIFX` container (big-endian RIFF) with form type `Egg!`. This crate reads it -//! into a lossless chunk tree ([`AepFile`]) and writes it back byte for byte. The XML form of a -//! project (`.aepx`) is read into the same tree by [`read_aepx`]; [`parse_any`] picks the reader -//! by content. See -//! `docs/aep-format.md` for the observed format and how it was established (clean room: only -//! files we generated ourselves, one change per file). -//! -//! [`Project::new`] opens a typed, read-only view over the tree: items, compositions -//! ([`CompHeader`]), layers ([`LayerHeader`], [`Transform`], effects, masks, text documents, -//! markers), properties, keyframes and footage. Only fields whose layout was verified against the -//! values the test files were made with are decoded; every accessor returns `None` (or an empty -//! list) on damaged data instead of failing. +//! The `.aep` / `.aepx` container and its typed view come from `craft-aep`; only the tables that map +//! After Effects effects and layer styles onto EffectCraft's are kept here. -mod aepx; -mod arbitrary; -mod bytes; -mod camera; -mod chunk; pub mod effect_map; -mod effects; -mod error; -mod footage; -mod header; -mod keys; -mod masks; -mod matte; -mod read; -mod settings; -mod shapes; pub mod style_map; -mod textdoc; -mod typed; -mod values; -mod version; -mod write; -pub use aepx::{is_aepx, parse_any, read_aepx, read_aepx_with_limits}; -pub use arbitrary::{ - CURVE_IDENTITY, CryptomatteData, CurvesData, ExtractorChannels, HueSaturationData, LevelsData, MeshData, curve_lut, identifier_channel_type, -}; -pub use camera::{CameraPosition, DEFAULT_CAMERA_ZOOM}; -pub use chunk::{AepFile, Body, Chunk, LIST, NESTED_IDS, Walk}; -pub use effects::{DefinitionSource, Effect, EffectDefinitions, EffectParam, LayerRef, ParamKind, ParamValue}; -pub use error::AepError; -pub use footage::{Footage, SequenceInfo}; -pub use header::{BlendMode, CompHeader, LayerHeader, LayerType, LightType, Quality, Rational, Renderer}; -pub use keys::{ExpressionFlags, Interpolation, KeyEase, KeyframeKind, SpatialKey}; -pub use masks::{Mask, MaskAtom, MaskMode, PathVertex, ShapePath}; -pub use matte::{MatteMode, TrackMatte}; -pub use read::{Limits, parse, parse_with_limits}; -pub use settings::{ProjectSettings, TimeDisplay, WorkingSpace}; -pub use shapes::{GradientType, PolystarType, ShapeDetail, ShapeGroup, ShapeItem, Stroke, StrokeCap, StrokeJoin}; -pub use textdoc::{ - AutoKern, Caps, CueType, FontBaseline, Justification, KernRun, Marker, ParagraphRun, StyleRun, TextBox, TextDocument, TextValue, parse_text_dict, -}; -pub use typed::{Comp, Item, ItemKind, KeyLayout, KeyList, Keyframe, Layer, ListHeader, Project, PropEntry, PropGroup, PropNode, Property, TimeBase}; -pub use values::{Orientation, OrientationKey, TimeRemap, TimeRemapKey, Tracked, Transform, ValueSource}; -pub use version::AeVersion; -pub use write::{write, write_to}; +pub use craft_aep::*; diff --git a/crates/aep/src/container/aepx.rs b/crates/aep/src/container/aepx.rs deleted file mode 100644 index a45cbae1d..000000000 --- a/crates/aep/src/container/aepx.rs +++ /dev/null @@ -1,640 +0,0 @@ -//! Reading the XML form of a project (`.aepx`) into the same chunk tree as an `.aep`. -//! -//! An `.aepx` is the `RIFX` chunk tree written as XML: one element per chunk, named by the chunk -//! id (or the list type of a `LIST`), with the body as hex in a `bdata` attribute. A few chunks -//! are written as text instead (`Utf8` as ``, the numbers `numS` and `ppSn`, the footage -//! alias `alas` as ``), and the XMP packet that follows the container of an `.aep` -//! is the element ``. The mapping, with the cases it was found on, is in -//! `docs/aep-format.md` (section 1.1). -//! -//! The reader is a small XML tokenizer for exactly that subset: elements, attributes, text, the -//! five predefined entities and character references, CDATA, comments and processing -//! instructions. A document type declaration is refused (no entity expansion). It runs without -//! recursion; the nesting depth and the element count are bounded by [`Limits`], and everything -//! it allocates is bounded by the size of the input. - -use std::borrow::Cow; - -use crate::container::chunk::{AepFile, Body, Chunk, LIST, NESTED_IDS}; -use crate::container::error::AepError; -use crate::container::read::{Limits, parse}; - -/// The root element of an `.aepx`. -const ROOT: &[u8] = b"AfterEffectsProject"; -/// The element that holds the XMP packet (the trailer of an `.aep`). -const XMP: &[u8] = b"ProjectXMPMetadata"; -/// The element of a `Utf8` chunk. -const STRING: &[u8] = b"string"; -/// The element of an `alas` chunk (footage alias), written as attributes instead of JSON. -const FILE_REFERENCE: &[u8] = b"fileReference"; - -/// List types whose body is not a chunk sequence: the `.aepx` writes them like data chunks (with -/// `bdata`), the `.aep` as an opaque `LIST`. -const OPAQUE_LIST_TYPES: [[u8; 4]; 1] = [*b"btdk"]; - -/// True when `data` looks like an `.aepx`: optional UTF-8 byte order mark and white space, then -/// an XML declaration or the `AfterEffectsProject` root element. -pub fn is_aepx(data: &[u8]) -> bool { - let rest = data.strip_prefix(&[0xef, 0xbb, 0xbf][..]).unwrap_or(data); - let start = rest.iter().position(|b| !b.is_ascii_whitespace()).unwrap_or(rest.len()); - let rest = rest.get(start..).unwrap_or(&[]); - rest.starts_with(b" Result, AepError> { - if is_aepx(data) { read_aepx(data) } else { parse(data) } -} - -/// Reads an `.aepx` with the default [`Limits`] into the chunk tree an `.aep` of the same project -/// gives. -/// -/// # Errors -/// [`AepError::Xml`] for input that is not well-formed XML of the `.aepx` subset (bad UTF-8, an -/// unknown entity, an unclosed or mismatched tag, invalid or odd-length hex, a number that does -/// not parse, a document type declaration, a root element other than `AfterEffectsProject`); -/// [`AepError::TooDeep`] / [`AepError::TooManyChunks`] beyond the limits. -pub fn read_aepx(data: &[u8]) -> Result, AepError> { - read_aepx_with_limits(data, Limits::default()) -} - -/// Like [`read_aepx`] with explicit [`Limits`]: `max_depth` bounds the element nesting (the root -/// element's children are depth 1), `max_chunks` the number of elements. -/// -/// # Errors -/// See [`read_aepx`]. -pub fn read_aepx_with_limits(data: &[u8], limits: Limits) -> Result, AepError> { - let text = match std::str::from_utf8(data) { - Ok(t) => t.as_bytes(), - Err(e) => return Err(xml(e.valid_up_to(), "the file is not valid UTF-8")), - }; - Reader { data: text, pos: 0, limits, count: 0, stack: Vec::new(), top: None, trailer: None }.run() -} - -fn xml(offset: usize, what: &'static str) -> AepError { - AepError::Xml { offset, what } -} - -/// What an open element becomes when it closes. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -enum Kind { - /// The root element: its children are the top-level chunks. - Root, - /// A chunk with this id (or a `LIST` with this list type). - Chunk([u8; 4]), - /// A `Utf8` chunk. - Utf8, - /// An `alas` chunk built from the attributes. - Alias, - /// The XMP packet (only directly below the root). - Xmp, - /// An element without a chunk counterpart (a name that is no chunk id); skipped with its content. - Skip, -} - -struct Frame { - kind: Kind, - /// Offset of the start tag (for errors). - at: usize, - /// The name as written, to match the end tag. - name: (usize, usize), - /// The decoded `bdata` attribute. - bdata: Option>, - /// The attributes of a `fileReference`, in document order. - attrs: Vec<(String, String)>, - /// Collected text (only for `string` and the XMP packet). - text: Vec, - children: Vec>, -} - -struct Reader<'d> { - data: &'d [u8], - pos: usize, - limits: Limits, - count: usize, - stack: Vec, - /// The top-level chunks once the root element has closed. - top: Option>>, - trailer: Option>, -} - -impl Reader<'_> { - fn run(mut self) -> Result, AepError> { - if self.data.starts_with(&[0xef, 0xbb, 0xbf]) { - self.pos = 3; - } - while self.pos < self.data.len() { - if self.rest().starts_with(b"<") { - self.markup()?; - } else { - self.text()?; - } - } - if let Some(open) = self.stack.last() { - return Err(xml(open.at, "an element is not closed before the end of the file")); - } - let chunks = self.top.ok_or_else(|| xml(self.data.len(), "no AfterEffectsProject root element"))?; - Ok(AepFile { chunks, trailer: Cow::Owned(self.trailer.unwrap_or_default()) }) - } - - fn rest(&self) -> &[u8] { - self.data.get(self.pos..).unwrap_or(&[]) - } - - /// The offset of `needle` at or after `from`. - fn find(&self, from: usize, needle: &[u8]) -> Option { - let hay = self.data.get(from..)?; - if needle.is_empty() || hay.len() < needle.len() { - return None; - } - let first = *needle.first()?; - let mut i = 0; - while let Some(p) = hay.get(i..)?.iter().position(|b| *b == first) { - let at = i.checked_add(p)?; - if hay.get(at..)?.starts_with(needle) { - return from.checked_add(at); - } - i = at.checked_add(1)?; - } - None - } - - /// Skips to just after `close`, which must follow. - fn skip_past(&mut self, close: &[u8], what: &'static str) -> Result { - let at = self.find(self.pos, close).ok_or(xml(self.pos, what))?; - self.pos = at.saturating_add(close.len()); - Ok(at) - } - - fn markup(&mut self) -> Result<(), AepError> { - let rest = self.rest(); - if rest.starts_with(b"", "a processing instruction is not closed")?; - } else if rest.starts_with(b"", "a comment is not closed")?; - } else if rest.starts_with(b"", "a CDATA section is not closed")?; - let content = self.data.get(start..end).unwrap_or(&[]); - let at = start; - match self.stack.last_mut() { - Some(frame) => { - if matches!(frame.kind, Kind::Utf8 | Kind::Xmp) { - frame.text.extend_from_slice(content); - } - } - None => return Err(xml(at, "CDATA outside the root element")), - } - } else if rest.starts_with(b" bool { - !(b.is_ascii_whitespace() || matches!(b, b'<' | b'>' | b'/' | b'=' | b'"' | b'\'' | b'&')) - } - - fn name(&mut self) -> Result<(usize, usize), AepError> { - let start = self.pos; - let len = self.rest().iter().position(|b| !Self::is_name_byte(*b)).unwrap_or(self.rest().len()); - if len == 0 { - return Err(xml(start, "a tag or attribute has no name")); - } - self.pos = start.saturating_add(len); - Ok((start, self.pos)) - } - - fn skip_ws(&mut self) { - let n = self.rest().iter().position(|b| !b.is_ascii_whitespace()).unwrap_or(self.rest().len()); - self.pos = self.pos.saturating_add(n); - } - - fn slice(&self, (a, b): (usize, usize)) -> &[u8] { - self.data.get(a..b).unwrap_or(&[]) - } - - fn start_tag(&mut self) -> Result<(), AepError> { - let at = self.pos; - self.pos = self.pos.saturating_add(1); - let name = self.name()?; - let mut attrs: Vec<((usize, usize), Vec)> = Vec::new(); - let self_closing = loop { - self.skip_ws(); - let rest = self.rest(); - if rest.starts_with(b"/>") { - self.pos = self.pos.saturating_add(2); - break true; - } - if rest.starts_with(b">") { - self.pos = self.pos.saturating_add(1); - break false; - } - if rest.is_empty() { - return Err(xml(at, "a start tag is not closed")); - } - let key = self.name()?; - self.skip_ws(); - if !self.rest().starts_with(b"=") { - return Err(xml(self.pos, "an attribute has no value")); - } - self.pos = self.pos.saturating_add(1); - self.skip_ws(); - let quote = *self.rest().first().ok_or(xml(self.pos, "a start tag is not closed"))?; - if quote != b'"' && quote != b'\'' { - return Err(xml(self.pos, "an attribute value is not quoted")); - } - let vstart = self.pos.saturating_add(1); - let vend = self.find(vstart, &[quote]).ok_or(xml(vstart, "an attribute value is not closed"))?; - let raw = self.data.get(vstart..vend).unwrap_or(&[]); - if raw.contains(&b'<') { - return Err(xml(vstart, "`<` inside an attribute value")); - } - let mut value = Vec::new(); - decode_entities(raw, vstart, &mut value)?; - self.pos = vend.saturating_add(1); - attrs.push((key, value)); - }; - let kind = self.kind_of(name, at)?; - if kind != Kind::Root { - self.count = self.count.saturating_add(1); - if self.count > self.limits.max_chunks { - return Err(AepError::TooManyChunks); - } - // The root's children are depth 1, like the top-level chunks of an `.aep`. - if self.stack.len() > self.limits.max_depth { - return Err(AepError::TooDeep); - } - } - let mut frame = Frame { kind, at, name, bdata: None, attrs: Vec::new(), text: Vec::new(), children: Vec::new() }; - if matches!(kind, Kind::Chunk(_)) { - if let Some((key, value)) = attrs.iter().find(|(k, _)| self.slice(*k) == b"bdata") { - frame.bdata = Some(decode_hex(value, key.1)?); - } - } else if kind == Kind::Alias { - frame.attrs = attrs.iter().map(|(k, v)| (String::from_utf8_lossy(self.slice(*k)).into_owned(), String::from_utf8_lossy(v).into_owned())).collect(); - } - self.stack.push(frame); - if self_closing { - self.close()?; - } - Ok(()) - } - - /// Classifies an element by its name and where it is. - fn kind_of(&self, name: (usize, usize), at: usize) -> Result { - let n = self.slice(name); - let parent = match self.stack.last() { - None => { - if self.top.is_some() { - return Err(xml(at, "a second root element")); - } - if n != ROOT { - return Err(xml(at, "the root element is not AfterEffectsProject")); - } - return Ok(Kind::Root); - } - Some(p) => p.kind, - }; - Ok(match parent { - Kind::Skip | Kind::Utf8 | Kind::Xmp | Kind::Alias => Kind::Skip, - Kind::Root | Kind::Chunk(_) => { - if n == STRING { - Kind::Utf8 - } else if n == FILE_REFERENCE { - Kind::Alias - } else if n == XMP && parent == Kind::Root { - Kind::Xmp - } else if let Some(id) = chunk_id(n) { - Kind::Chunk(id) - } else { - Kind::Skip - } - } - }) - } - - fn end_tag(&mut self) -> Result<(), AepError> { - let at = self.pos; - self.pos = self.pos.saturating_add(2); - let name = self.name()?; - self.skip_ws(); - if !self.rest().starts_with(b">") { - return Err(xml(at, "an end tag is not closed")); - } - self.pos = self.pos.saturating_add(1); - let open = self.stack.last().ok_or(xml(at, "an end tag without a start tag"))?; - if self.slice(open.name) != self.slice(name) { - return Err(xml(at, "an end tag does not match its start tag")); - } - self.close() - } - - /// Closes the innermost element and hands its chunk to the parent. - fn close(&mut self) -> Result<(), AepError> { - let frame = self.stack.pop().ok_or(xml(self.pos, "an end tag without a start tag"))?; - let chunk = match frame.kind { - Kind::Root => { - self.top = Some(frame.children); - return Ok(()); - } - Kind::Skip => return Ok(()), - Kind::Xmp => { - if self.trailer.is_none() { - self.trailer = Some(frame.text); - } - return Ok(()); - } - Kind::Utf8 => Chunk::data(*b"Utf8", frame.text), - Kind::Alias => Chunk::data(*b"alas", alias_json(&frame.attrs).into_bytes()), - Kind::Chunk(id) => chunk_of(id, frame)?, - }; - if let Some(parent) = self.stack.last_mut() { - parent.children.push(chunk); - } - Ok(()) - } - - fn text(&mut self) -> Result<(), AepError> { - let start = self.pos; - let len = self.rest().iter().position(|b| *b == b'<').unwrap_or(self.rest().len()); - let end = start.saturating_add(len); - self.pos = end; - let raw = self.data.get(start..end).unwrap_or(&[]); - match self.stack.last_mut() { - Some(frame) if matches!(frame.kind, Kind::Utf8 | Kind::Xmp) => decode_entities(raw, start, &mut frame.text), - Some(_) => Ok(()), - None if raw.iter().all(u8::is_ascii_whitespace) => Ok(()), - None => Err(xml(start, "text outside the root element")), - } - } -} - -/// The chunk id of an element name: 1 to 4 printable ASCII bytes, padded with spaces (`Pin` is -/// the list type `Pin `). -fn chunk_id(name: &[u8]) -> Option<[u8; 4]> { - if name.is_empty() || name.len() > 4 || !name.iter().all(|b| b.is_ascii_graphic()) { - return None; - } - let mut id = [b' '; 4]; - for (d, s) in id.iter_mut().zip(name) { - *d = *s; - } - Some(id) -} - -/// The chunk of a closed element named by a chunk id. -fn chunk_of(id: [u8; 4], frame: Frame) -> Result, AepError> { - if let Some(bytes) = frame.bdata { - if OPAQUE_LIST_TYPES.contains(&id) { - let pad = if bytes.len() % 2 == 1 { Some(0) } else { None }; - return Ok(Chunk { id: LIST, body: Body::OpaqueList { list_type: id, data: Cow::Owned(bytes) }, pad }); - } - return Ok(Chunk::data(id, bytes)); - } - // Numbers written as text: `0` and `150.000000000`. - if &id == b"numS" || &id == b"ppSn" { - let text = match frame.children.as_slice() { - [only] if only.is(b"Utf8") => only.bytes().unwrap_or(&[]), - _ => return Err(xml(frame.at, "a numS or ppSn element without its number")), - }; - let text = std::str::from_utf8(text).map_err(|_| xml(frame.at, "a number is not text"))?.trim(); - let body = if &id == b"numS" { - // Only `0` is sampled, so whether the field is signed is open: accept both readings of 4 bytes. - let n = text.parse::().ok().filter(|n| (i64::from(i32::MIN)..=i64::from(u32::MAX)).contains(n)); - let n = n.ok_or(xml(frame.at, "numS is not a 32-bit integer"))?; - (n as u32).to_be_bytes().to_vec() - } else { - text.parse::().map_err(|_| xml(frame.at, "ppSn is not a number"))?.to_be_bytes().to_vec() - }; - return Ok(Chunk::data(id, body)); - } - if NESTED_IDS.contains(&id) { - if frame.children.is_empty() { - return Ok(Chunk::data(id, Vec::new())); - } - return Ok(Chunk { id, body: Body::Chunks(frame.children), pad: None }); - } - Ok(Chunk::list(id, frame.children)) -} - -/// Appends `raw` with the predefined entities and character references decoded. -fn decode_entities(raw: &[u8], offset: usize, out: &mut Vec) -> Result<(), AepError> { - let mut i = 0; - while let Some(rest) = raw.get(i..) { - let Some(amp) = rest.iter().position(|b| *b == b'&') else { - out.extend_from_slice(rest); - break; - }; - out.extend_from_slice(rest.get(..amp).unwrap_or(&[])); - let at = offset.saturating_add(i).saturating_add(amp); - let after = rest.get(amp.saturating_add(1)..).unwrap_or(&[]); - let semi = after.iter().take(12).position(|b| *b == b';').ok_or(xml(at, "an entity is not terminated"))?; - let name = after.get(..semi).unwrap_or(&[]); - let ch = match name { - b"amp" => '&', - b"lt" => '<', - b"gt" => '>', - b"quot" => '"', - b"apos" => '\'', - _ => { - let code = if let Some(hex) = name.strip_prefix(b"#x").or_else(|| name.strip_prefix(b"#X")) { - std::str::from_utf8(hex).ok().and_then(|h| u32::from_str_radix(h, 16).ok()) - } else if let Some(dec) = name.strip_prefix(b"#") { - std::str::from_utf8(dec).ok().and_then(|d| d.parse::().ok()) - } else { - return Err(xml(at, "an unknown entity")); - }; - code.filter(|c| *c != 0).and_then(char::from_u32).ok_or(xml(at, "an invalid character reference"))? - } - }; - let mut buf = [0u8; 4]; - out.extend_from_slice(ch.encode_utf8(&mut buf).as_bytes()); - i = i.saturating_add(amp).saturating_add(semi).saturating_add(2); - } - Ok(()) -} - -/// Decodes a `bdata` value (hex digits, two per byte). -fn decode_hex(text: &[u8], offset: usize) -> Result, AepError> { - if text.len() % 2 == 1 { - return Err(xml(offset, "bdata has an odd number of hex digits")); - } - let digit = |b: u8| match b { - b'0'..=b'9' => Some(b - b'0'), - b'a'..=b'f' => Some(b - b'a' + 10), - b'A'..=b'F' => Some(b - b'A' + 10), - _ => None, - }; - let (pairs, _) = text.as_chunks::<2>(); - pairs - .iter() - .map(|[hi, lo]| digit(*hi).zip(digit(*lo)).map(|(h, l)| (h << 4) | l)) - .collect::>>() - .ok_or(xml(offset, "bdata holds a character that is not a hex digit")) -} - -/// The JSON body of an `alas` chunk from the attributes of a `fileReference`, keys in document -/// order (alphabetical in every sample, as in the `.aep`): the two `ascendcount_*` values as -/// numbers, `platform` `Win` as `1`, `target_is_folder` `0` / `1` as `false` / `true`, everything -/// else as a string. -fn alias_json(attrs: &[(String, String)]) -> String { - let mut out = String::from("{"); - for (i, (key, value)) in attrs.iter().enumerate() { - if i > 0 { - out.push(','); - } - json_str(&mut out, key); - out.push(':'); - let number = value.parse::().ok(); - match (key.as_str(), value.as_str()) { - ("ascendcount_base" | "ascendcount_target", _) if number.is_some() => out.push_str(value), - ("platform", "Win") => out.push('1'), - ("platform", _) if number.is_some() => out.push_str(value), - ("target_is_folder", "0" | "false") => out.push_str("false"), - ("target_is_folder", "1" | "true") => out.push_str("true"), - _ => json_str(&mut out, value), - } - } - out.push('}'); - out -} - -fn json_str(out: &mut String, s: &str) { - out.push('"'); - for c in s.chars() { - match c { - '"' => out.push_str("\\\""), - '\\' => out.push_str("\\\\"), - '\n' => out.push_str("\\n"), - '\r' => out.push_str("\\r"), - '\t' => out.push_str("\\t"), - c if u32::from(c) < 0x20 => out.push_str(&format!("\\u{:04x}", u32::from(c))), - c => out.push(c), - } - } - out.push('"'); -} - -#[cfg(test)] -mod tests { - use super::*; - - fn doc(body: &str) -> String { - format!("\n{body}\n") - } - - #[test] - fn maps_elements_to_chunks() { - let x = doc(concat!( - "\n", - "A & BA-3", - "150.000000000x", - "]]>" - )); - let f = read_aepx(x.as_bytes()).unwrap(); - assert_eq!(f.trailer.as_ref(), b""); - let ids: Vec<_> = f.chunks.iter().map(|c| (c.id, c.list_type())).collect(); - assert_eq!( - ids, - vec![ - (*b"head", None), - (LIST, Some(*b"Pin ")), - (LIST, Some(*b"Pefl")), - (*b"tdsn", None), - (*b"numS", None), - (*b"ppSn", None), - (LIST, Some(*b"btdk")) - ] - ); - assert_eq!(f.chunks[1].children()[0].bytes(), Some(&[1u8][..])); - assert_eq!(f.chunks[1].children()[0].pad, Some(0)); - assert_eq!(f.chunks[3].children()[0].bytes(), Some(&b"A & BA"[..])); - assert_eq!(f.chunks[4].bytes(), Some(&(-3i32).to_be_bytes()[..])); - assert_eq!(f.chunks[5].bytes(), Some(&150f64.to_be_bytes()[..])); - assert_eq!(f.chunks[6].bytes(), Some(&b"ABC"[..])); - // The tree writes as a valid `.aep` that parses back to itself. - let bin = crate::container::write(&f).unwrap(); - assert_eq!(parse(&bin).unwrap(), f); - } - - #[test] - fn file_reference_becomes_alias_json() { - let x = doc(concat!( - "" - )); - let f = read_aepx(x.as_bytes()).unwrap(); - let alas = f.chunks[0].children()[0].bytes().unwrap(); - assert_eq!( - std::str::from_utf8(alas).unwrap(), - r#"{"ascendcount_base":1,"ascendcount_target":1,"fullpath":"C:\\a\\\"b.png","platform":1,"server_name":"N","server_volume_name":"V","target_is_folder":false}"# - ); - } - - #[test] - fn nums_takes_signed_and_unsigned_32_bit_values() { - for (text, bytes) in [("-2147483648", [0x80, 0, 0, 0]), ("4294967295", [0xff; 4]), (" 7 ", [0, 0, 0, 7])] { - let f = read_aepx(doc(&format!("{text}")).as_bytes()).unwrap(); - assert_eq!(f.chunks[0].bytes(), Some(&bytes[..]), "{text}"); - } - for text in ["-2147483649", "4294967296", "1.5"] { - assert!(read_aepx(doc(&format!("{text}")).as_bytes()).is_err(), "{text}"); - } - } - - #[test] - fn detection() { - assert!(is_aepx(b"\xef\xbb\xbf ")); - assert!(is_aepx(b"")); - assert!(!is_aepx(b"RIFX\0\0\0\x04Egg!")); - assert!(parse_any(b"RIFX\0\0\0\x04Egg!").is_ok()); - assert!(parse_any(doc("").as_bytes()).is_ok()); - } - - #[test] - fn bad_input_is_an_error() { - let bad = [ - doc(""), - doc(""), - doc(" "), - doc("�"), - doc("&"), - doc(""), - doc(""), - doc("x"), - doc(""), - doc(""), - doc(""), - "]>".into(), - "".into(), - "".into(), - "".into(), - "junk".into(), - "]]>"), 2); assert_eq!(super::import::json_depth(br#"{"a": "[[[{{", "b": [[1], {"c": "\\\"["}]}"#), 3); } + +/// A hostile project: footage in a folder whose parents loop back to it. Export walked the +/// folder's parents recursively and never reached the cache insert, so the stack ran out. +#[test] +fn export_survives_a_folder_parent_cycle() { + let (mut p, cid) = ae_project(); + let a = p.add_item("A", effectcraft_color::Label::None, None, ItemKind::Folder); + let b = p.add_item("B", effectcraft_color::Label::None, Some(a), ItemKind::Folder); + p.items.get_mut(&a).unwrap().parent = Some(b); + let footage: Vec = p.items.values().filter(|i| matches!(i.kind, ItemKind::Footage(_))).map(|i| i.id).collect(); + for f in footage { + p.items.get_mut(&f).unwrap().parent = Some(a); + } + let out = export(&p, cid, &ExportOptions::default(), &HashMap::new()).unwrap(); + assert!(out.warnings.iter().any(|w| w.contains("contains itself")), "{:?}", out.warnings); +} + +/// Precomps that use each other, and a chain of comps that each use the next one twice: the +/// audio check recursed forever on the first and 2^depth times on the second. +#[test] +fn export_audio_check_ends_on_precomp_cycles_and_shared_chains() { + let mut p = Project::default(); + let a = footage_item(&mut p, "/media/a.mov"); + let comp = || Comp::new(W, H, FrameRate::new(25, 1), t(2.0)); + // A chain of 60 comps, each using the next twice; the last one is silent footage. + let mut next = { + let mut c = comp(); + let l = effectcraft_project::build::layer(&mut p, &c, "a", LayerSource::Footage { item: a }, (W, H), None); + c.layers.push(l); + comp_item(&mut p, "Leaf", c) + }; + for i in 0..60 { + let mut c = comp(); + for n in 0..2 { + let l = effectcraft_project::build::layer(&mut p, &c, &format!("use {n}"), LayerSource::Comp { item: next }, (W, H), None); + c.layers.push(l); + } + next = comp_item(&mut p, &format!("Chain {i}"), c); + } + let started = std::time::Instant::now(); + export(&p, next, &ExportOptions::default(), &HashMap::new()).unwrap(); + assert!(started.elapsed() < std::time::Duration::from_secs(30), "{:?}", started.elapsed()); + // Two comps nesting each other. + let x = comp_item(&mut p, "X", comp()); + let mut y = comp(); + let l = effectcraft_project::build::layer(&mut p, &y, "x", LayerSource::Comp { item: x }, (W, H), None); + y.layers.push(l); + let y = comp_item(&mut p, "Y", y); + let mut xc = comp(); + let l = effectcraft_project::build::layer(&mut p, &xc, "y", LayerSource::Comp { item: y }, (W, H), None); + xc.layers.push(l); + if let Some(ItemKind::Comp(c)) = p.items.get_mut(&x).map(|i| &mut i.kind) { + *c = Arc::new(xc); + } + export(&p, x, &ExportOptions::default(), &HashMap::new()).unwrap(); +} + +/// A flat edit with many clips and many transitions: each clip finds its own transitions (it +/// scanned every transition of the track per clip), and they still extend and fade it. +#[test] +fn import_finds_each_clips_transitions_without_scanning_the_track() { + let mut p = fp::Project::new("Flat"); + let a = media(&mut p, "a.png", "/media/a.mov", filmcraft_media::MediaKind::Movie, true, false, None); + let settings = fp::SequenceSettings { width: W, height: H, frame_rate: rate(), ..Default::default() }; + let main = p.new_sequence("Main", settings, 1, 0, None); + const N: usize = 500; + let mut items = Vec::with_capacity(N); + let mut transitions = Vec::with_capacity(N); + for i in 0..N { + let ti = item(&mut p, a, fp::TrackKind::Video, i as f64 * 0.4, 0.0, 0.4); + if let Some(prev) = items.last().map(|x: &fp::TrackItem| x.id) { + transitions.push(fp::Transition { + id: fp::TransitionId(p.alloc_id()), + effect: fp::find_effect("cross_dissolve").unwrap().instance(), + start: secs(i as f64 * 0.4 - 0.08), + duration: secs(0.16), + from: Some(prev), + to: Some(ti.id), + align: fp::TransitionAlign::CenterAtCut, + reverse: false, + }); + } + items.push(ti); + } + let seq = p.sequence_mut(main).unwrap(); + seq.video_tracks[0].items = items; + seq.video_tracks[0].transitions = transitions; + let (bytes, _) = fc::export(&p, main, fc::Format::Otio, &Default::default()).unwrap(); + let (q, r) = import_doc(&bytes, "Flat.otio", &mut probe); + let m = q.comp(r.comps[0]).unwrap(); + assert_eq!(m.layers.len(), N); + // A middle clip reaches over both of its transitions' handles. + let mid = m.layers.iter().find(|l| near(l.in_point, t(100.0 - 0.08))).expect("clip 250 extended into its incoming transition"); + assert!(near(mid.out_point, t(100.4 + 0.08)), "{}", mid.out_point.seconds()); +} diff --git a/crates/keyframe/src/text_doc.rs b/crates/keyframe/src/text_doc.rs index f91d8be4d..e8fcb52be 100644 --- a/crates/keyframe/src/text_doc.rs +++ b/crates/keyframe/src/text_doc.rs @@ -85,13 +85,13 @@ impl Justify { } pub fn parse(s: &str) -> Option { Some(match s.to_ascii_lowercase().replace(['_', ' ', '-'], "").as_str() { - "left" | "leftjustify" => Justify::Left, - "center" | "centre" | "centerjustify" => Justify::Center, - "right" | "rightjustify" => Justify::Right, + "left" | "leftjustify" | "alignleft" => Justify::Left, + "center" | "centre" | "centerjustify" | "aligncenter" => Justify::Center, + "right" | "rightjustify" | "alignright" => Justify::Right, "justify" | "justifyleft" | "justifylastleft" | "fulljustifylastlineleft" => Justify::JustifyLastLeft, "justifycenter" | "justifylastcenter" | "fulljustifylastlinecenter" => Justify::JustifyLastCenter, "justifyright" | "justifylastright" | "fulljustifylastlineright" => Justify::JustifyLastRight, - "justifyall" | "fulljustifylastlinefull" | "fulljustify" => Justify::JustifyAll, + "justifyall" | "justifyfull" | "fulljustifylastlinefull" | "fulljustify" => Justify::JustifyAll, _ => return None, }) } diff --git a/crates/lottie/Cargo.toml b/crates/lottie/Cargo.toml index a9f64b3ba..9a95dca13 100644 --- a/crates/lottie/Cargo.toml +++ b/crates/lottie/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-lottie = { workspace = true } craft-docpath = { workspace = true } effectcraft-time = { workspace = true } effectcraft-color = { workspace = true } diff --git a/crates/lottie/src/anim.rs b/crates/lottie/src/anim.rs index 5b6dabf50..62550f86f 100644 --- a/crates/lottie/src/anim.rs +++ b/crates/lottie/src/anim.rs @@ -1,26 +1,20 @@ -//! Animated properties: EffectCraft keyframes ↔ Lottie keyframes. -//! -//! A Lottie keyframe holds the start value `s` of a segment and the segment's normalised cubic -//! Bezier ease: `o` (out tangent of this key) and `i` (in tangent of the next key), each with `x` -//! (time fraction) and `y` (value progress fraction), per dimension. After Effects' temporal ease -//! is speed (units/s) and influence (fraction of the segment): for a segment of duration `d` and -//! value change `Δv`, -//! -//! ```text -//! o.x = influence_out o.y = speed_out · influence_out · d / Δv -//! i.x = 1 − influence_in i.y = 1 − speed_in · influence_in · d / Δv -//! ``` -//! -//! which is exactly the Bezier the keyframe evaluator uses. Spatial properties ease along the -//! motion path (Δv = arc length, one dimension) and carry `to`/`ti` spatial tangents. Hold keys -//! set `h: 1`. +//! Animated properties: EffectCraft keyframes ↔ Lottie keyframes, through `craft-lottie`'s +//! property encoding ([`craft_lottie::read_prop`], [`craft_lottie::write_prop`]) and its +//! conversion between a segment's normalised Bezier ease and After Effects' speed and influence +//! ([`Tangents`]). Spatial properties ease along the motion path (Δv = arc length, one +//! dimension) and carry `to`/`ti` spatial tangents. +pub(crate) use craft_lottie::nums; +use craft_lottie::{Animated, Json, KeyOut, PropValue, Tangents, read_prop, round6}; use effectcraft_keyframe::{self as kf, Ease, Interp, Keyframe, Value}; use effectcraft_project::{Expression, Property}; -use serde_json::{Value as Json, json}; +use serde_json::json; use crate::Timebase; +/// Most distinct warnings an import or export reports. +const MAX_WARNINGS: usize = 200; + /// Export state shared by the whole document. pub(crate) struct Ex { pub tb: Timebase, @@ -31,7 +25,8 @@ pub(crate) struct Ex { impl Ex { pub fn warn(&mut self, w: impl Into) { let w = w.into(); - if !self.warnings.contains(&w) { + // Each warning is looked for among the earlier ones: past a screenful, more add nothing. + if self.warnings.len() < MAX_WARNINGS && !self.warnings.contains(&w) { self.warnings.push(w); } } @@ -46,7 +41,8 @@ pub(crate) struct Im { impl Im { pub fn warn(&mut self, w: impl Into) { let w = w.into(); - if !self.warnings.contains(&w) { + // Each warning is looked for among the earlier ones: past a screenful, more add nothing. + if self.warnings.len() < MAX_WARNINGS && !self.warnings.contains(&w) { self.warnings.push(w); } } @@ -57,15 +53,11 @@ fn secs(t: effectcraft_time::Tick) -> f64 { } fn r6(v: f64) -> f64 { - if v.is_finite() { (v * 1e6).round() / 1e6 } else { 0.0 } + round6(v) } -/// A key value as Lottie's `s` (numbers wrapped in an array, objects in a one-element array). -fn wrap(j: Json) -> Json { - match j { - Json::Array(_) => j, - other => json!([other]), - } +fn lottie_ease(e: Ease) -> craft_lottie::Ease { + craft_lottie::Ease { speed: e.speed, influence: e.influence } } fn is_spatial(p: &Property) -> bool { @@ -75,7 +67,7 @@ fn is_spatial(p: &Property) -> bool { /// Export a property as a Lottie animatable property (`{a, k}` plus `x` for expressions). /// `label` names the property in warnings. Muted keys are omitted: Lottie has no mute state, and /// the remaining keys carry the animation the renderer shows. -pub(crate) fn export_prop(ex: &mut Ex, p: &Property, conv: &dyn Fn(&Value) -> Json, label: &str) -> Json { +pub(crate) fn export_prop(ex: &mut Ex, p: &Property, conv: &dyn Fn(&Value) -> Json, label: &str) -> Animated { let muted = p.keys.iter().any(|k| k.muted); if muted { ex.warn(format!("{label}: muted keyframes are not exported")); @@ -87,146 +79,102 @@ pub(crate) fn export_prop(ex: &mut Ex, p: &Property, conv: &dyn Fn(&Value) -> Js } else { &p.keys }; - let mut out = - if keys.is_empty() { json!({"a": 0, "k": conv(&p.value)}) } else { json!({"a": 1, "k": export_keys(ex, keys, is_spatial(p), p.hold_only, conv)}) }; + let mut expression = None; if let Some(e) = p.expr.as_ref().filter(|e| e.enabled && !e.text.trim().is_empty()) { if ex.include_expressions { - out["x"] = json!(e.text); + expression = Some(e.text.as_str()); } else { ex.warn(format!("{label}: expression not exported (enable includeExpressions to export it as `x`)")); } } - out + if keys.is_empty() { + return Animated(craft_lottie::write_prop(conv(&p.value), &[], expression)); + } + Animated::keyed(&export_keys(ex, keys, is_spatial(p), p.hold_only, conv), expression) } -fn export_keys(ex: &Ex, keys: &[Keyframe], spatial: bool, hold_only: bool, conv: &dyn Fn(&Value) -> Json) -> Vec { +fn export_keys(ex: &Ex, keys: &[Keyframe], spatial: bool, hold_only: bool, conv: &dyn Fn(&Value) -> Json) -> Vec { let mut out = Vec::with_capacity(keys.len()); for (i, k) in keys.iter().enumerate() { - let mut o = json!({"t": r6(ex.tb.frame(k.time)), "s": wrap(conv(&k.value))}); - if i + 1 == keys.len() { - if k.out_interp == Interp::Hold || hold_only { - o["h"] = json!(1); + let mut o = KeyOut { t: ex.tb.frame(k.time), s: conv(&k.value), hold: false, ease: vec![], spatial: None }; + let last = i + 1 == keys.len(); + if k.out_interp == Interp::Hold || hold_only || (!last && !k.value.interpolates()) { + o.hold = true; + } else if !last { + o.ease = segment_ease(keys, i, spatial); + if spatial { + let (_, to) = kf::spatial_tangents(keys, i); + let (ti, _) = kf::spatial_tangents(keys, i + 1); + let n = if matches!(k.value, Value::Vec2(_)) { 2 } else { conv(&k.value).as_array().map(Vec::len).unwrap_or(3).min(3) }; + o.spatial = Some((to.get(..n).unwrap_or_default().to_vec(), ti.get(..n).unwrap_or_default().to_vec())); } - out.push(o); - continue; - } - if k.out_interp == Interp::Hold || hold_only || !k.value.interpolates() { - o["h"] = json!(1); - out.push(o); - continue; - } - let (ox, oy, ix, iy) = segment_ease(keys, i, spatial); - o["o"] = json!({"x": ox, "y": oy}); - o["i"] = json!({"x": ix, "y": iy}); - if spatial { - let (_, to) = kf::spatial_tangents(keys, i); - let (ti, _) = kf::spatial_tangents(keys, i + 1); - let n = if matches!(k.value, Value::Vec2(_)) { 2 } else { conv(&k.value).as_array().map(Vec::len).unwrap_or(3).min(3) }; - o["to"] = json!(to[..n].iter().map(|v| r6(*v)).collect::>()); - o["ti"] = json!(ti[..n].iter().map(|v| r6(*v)).collect::>()); } out.push(o); } out } -/// Normalised ease of segment `i → i+1`: (o.x, o.y, i.x, i.y) per dimension. -fn segment_ease(keys: &[Keyframe], i: usize, spatial: bool) -> (Vec, Vec, Vec, Vec) { - let (a, b) = (&keys[i], &keys[i + 1]); +/// Normalised ease of segment `i → i+1`, one entry per dimension. +fn segment_ease(keys: &[Keyframe], i: usize, spatial: bool) -> Vec { + let (Some(a), Some(b)) = (keys.get(i), keys.get(i + 1)) else { return vec![] }; let dur = (secs(b.time) - secs(a.time)).max(1e-12); let ca = a.value.components(); let cb = b.value.components(); let numeric = !ca.is_empty() && ca.len() == cb.len(); let dims = if spatial || !numeric { 1 } else { ca.len() }; - let (mut ox, mut oy, mut ix, mut iy) = (vec![], vec![], vec![], vec![]); - for d in 0..dims { - let (dv, eo, ei) = if spatial { - let len = kf::spatial_segment_length(keys, i); - (len, kf::side_ease(keys, i, 0, true, true), kf::side_ease(keys, i + 1, 0, true, false)) - } else if numeric { - (cb[d] - ca[d], kf::side_ease(keys, i, d, false, true), kf::side_ease(keys, i + 1, d, false, false)) - } else { - // Paths, gradients: overall progress 0 → 1. - let side = |k: &Keyframe, out: bool| { - let interp = if out { k.out_interp } else { k.in_interp }; - let list = if out { &k.out_ease } else { &k.in_ease }; - if interp == Interp::Bezier { - list.first().copied().unwrap_or_default() - } else { - Ease { speed: 1.0 / dur, influence: kf::LINEAR_SIDE_INFLUENCE } - } + (0..dims) + .map(|d| { + let (dv, eo, ei) = if spatial { + let len = kf::spatial_segment_length(keys, i); + (len, kf::side_ease(keys, i, 0, true, true), kf::side_ease(keys, i + 1, 0, true, false)) + } else if numeric { + (cb[d] - ca[d], kf::side_ease(keys, i, d, false, true), kf::side_ease(keys, i + 1, d, false, false)) + } else { + // Paths, gradients: overall progress 0 → 1. + let side = |k: &Keyframe, out: bool| { + let interp = if out { k.out_interp } else { k.in_interp }; + let list = if out { &k.out_ease } else { &k.in_ease }; + if interp == Interp::Bezier { + list.first().copied().unwrap_or_default() + } else { + Ease { speed: 1.0 / dur, influence: kf::LINEAR_SIDE_INFLUENCE } + } + }; + (1.0, Some(side(a, true)), Some(side(b, false))) }; - (1.0, Some(side(a, true)), Some(side(b, false))) - }; - let lin = Ease { speed: dv / dur, influence: kf::LINEAR_SIDE_INFLUENCE }; - let (eo, ei) = (eo.unwrap_or(lin), ei.unwrap_or(lin)); - // Crossing time handles must retain the independently specified influences. - let (i0, i1) = (eo.influence.clamp(0.0, 1.0), ei.influence.clamp(0.0, 1.0)); - let (y0, y1) = if dv.abs() > 1e-12 { (eo.speed * i0 * dur / dv, 1.0 - ei.speed * i1 * dur / dv) } else { (0.0, 1.0) }; - ox.push(r6(i0)); - oy.push(r6(y0)); - ix.push(r6(1.0 - i1)); - iy.push(r6(y1)); - } - (ox, oy, ix, iy) + let lin = Ease { speed: dv / dur, influence: kf::LINEAR_SIDE_INFLUENCE }; + // Crossing time handles keep the independently specified influences. + Tangents::from_speed(lottie_ease(eo.unwrap_or(lin)), lottie_ease(ei.unwrap_or(lin)), dv, dur) + }) + .collect() } // ---------------------------------------------------------------- import -/// Whether a Lottie property value is keyframed. -pub(crate) fn is_animated(j: &Json) -> bool { - if j.get("a").and_then(Json::as_i64) == Some(1) { - return true; - } - j.get("k").and_then(Json::as_array).and_then(|a| a.first()).is_some_and(|f| f.get("t").is_some()) -} - -/// Component `d` of an ease tangent field (`x` / `y` may be a number or an array). -fn comp(j: &Json, field: &str, d: usize) -> Option { - match j.get(field)? { - Json::Number(n) => n.as_f64(), - Json::Array(a) => a.get(d).or(a.first()).and_then(Json::as_f64), - _ => None, - } -} - -fn vec3_of(j: Option<&Json>) -> [f64; 3] { - let a = j.and_then(Json::as_array); - let g = |i: usize| a.and_then(|a| a.get(i)).and_then(Json::as_f64).unwrap_or(0.0); - [g(0), g(1), g(2)] -} - /// Import a Lottie animatable property into `p` (value, keys, expression). `conv` turns a Lottie /// value (as found in `k` or a key's `s`, possibly wrapped in a one-element array) into a value of /// the property's type. pub(crate) fn import_prop(im: &Im, j: &Json, p: &mut Property, conv: &dyn Fn(&Json) -> Option) { - if !j.is_object() { - if let Some(v) = conv(j) { - p.value = v; - } - return; - } - if let Some(x) = j.get("x").and_then(Json::as_str).filter(|x| !x.trim().is_empty()) { + let prop = read_prop(j); + if let Some(x) = prop.expression { p.expr = Some(Expression { text: x.to_string(), enabled: true }); } - let Some(k) = j.get("k") else { return }; - if !is_animated(j) { - if let Some(v) = conv(k) { - p.value = v; + let list = match prop.value { + PropValue::None => return, + PropValue::Static(v) => { + if let Some(v) = conv(v) { + p.value = v; + } + return; } - return; - } - let Some(list) = k.as_array() else { return }; + PropValue::Keys(list) => list, + }; let spatial = is_spatial(p); let mut keys: Vec = Vec::with_capacity(list.len()); - let mut kept: Vec<&Json> = Vec::with_capacity(list.len()); - let mut prev_end: Option<&Json> = None; + let mut kept = Vec::with_capacity(list.len()); for kj in list { - let t = kj.get("t").and_then(Json::as_f64).unwrap_or(0.0); - let sv = kj.get("s").or(prev_end); - prev_end = kj.get("e"); - let Some(v) = sv.and_then(conv) else { continue }; - let mut key = Keyframe::new(im.tb.tick(t), v); + let Some(v) = kj.s.and_then(conv) else { continue }; + let mut key = Keyframe::new(im.tb.tick(kj.t), v); key.spatial_auto = false; if p.hold_only || !key.value.interpolates() { key = key.hold(); @@ -240,16 +188,14 @@ pub(crate) fn import_prop(im: &Im, j: &Json, p: &mut Property, conv: &dyn Fn(&Js let n = keys.len(); for i in 0..n.saturating_sub(1) { let Some(kj) = kept.get(i) else { break }; - if kj.get("h").and_then(Json::as_i64) == Some(1) || p.hold_only { + if kj.hold || p.hold_only { keys[i].out_interp = Interp::Hold; keys[i + 1].in_interp = Interp::Hold; continue; } if spatial { - let to = vec3_of(kj.get("to")); - let ti = vec3_of(kj.get("ti")); - keys[i].spatial_out = to; - keys[i + 1].spatial_in = ti; + keys[i].spatial_out = kj.to; + keys[i + 1].spatial_in = kj.ti; } } // Eases need the spatial tangents (arc length), so they come second. @@ -258,7 +204,7 @@ pub(crate) fn import_prop(im: &Im, j: &Json, p: &mut Property, conv: &dyn Fn(&Js if keys[i].out_interp == Interp::Hold { continue; } - let (Some(o), Some(ii)) = (kj.get("o"), kj.get("i")) else { + let (Some(o), Some(ii)) = (kj.o, kj.i) else { keys[i].out_interp = Interp::Linear; keys[i + 1].in_interp = Interp::Linear; continue; @@ -272,13 +218,8 @@ pub(crate) fn import_prop(im: &Im, j: &Json, p: &mut Property, conv: &dyn Fn(&Js let mut outs = vec![]; let mut ins = vec![]; for d in 0..dims { - let ox = comp(o, "x", d).unwrap_or(1.0 / 3.0).clamp(0.0, 1.0); - let oy = comp(o, "y", d).unwrap_or(ox); - let ix = comp(ii, "x", d).unwrap_or(2.0 / 3.0).clamp(0.0, 1.0); - let iy = comp(ii, "y", d).unwrap_or(ix); - if (ox - oy).abs() > 1e-4 || (ix - iy).abs() > 1e-4 { - linear = false; - } + let t = Tangents::read(o, ii, d); + linear &= t.is_linear(); let dv = if spatial { kf::spatial_segment_length(&keys, i) } else if numeric { @@ -286,10 +227,9 @@ pub(crate) fn import_prop(im: &Im, j: &Json, p: &mut Property, conv: &dyn Fn(&Js } else { 1.0 }; - let inf_o = ox.max(0.001); - let inf_i = (1.0 - ix).max(0.001); - outs.push(Ease { speed: oy * dv / (inf_o * dur), influence: inf_o }); - ins.push(Ease { speed: (1.0 - iy) * dv / (inf_i * dur), influence: inf_i }); + let (out, into) = t.to_speed(dv, dur); + outs.push(Ease { speed: out.speed, influence: out.influence }); + ins.push(Ease { speed: into.speed, influence: into.influence }); } if linear { keys[i].out_interp = Interp::Linear; @@ -305,6 +245,13 @@ pub(crate) fn import_prop(im: &Im, j: &Json, p: &mut Property, conv: &dyn Fn(&Js p.keys = keys; } +/// [`import_prop`] for a property of the model ([`Animated`]). +pub(crate) fn import_animated(im: &Im, a: Option<&Animated>, p: &mut Property, conv: &dyn Fn(&Json) -> Option) { + if let Some(a) = a { + import_prop(im, &a.0, p, conv); + } +} + // ---------------------------------------------------------------- value converters pub(crate) fn num(v: &Value) -> Json { @@ -330,23 +277,6 @@ pub(crate) fn arr3(v: &Value) -> Json { json!([r6(*c.first().unwrap_or(&0.0)), r6(*c.get(1).unwrap_or(&0.0)), r6(*c.get(2).unwrap_or(&0.0))]) } -/// Numbers of a Lottie value (`5`, `[5]`, `[1, 2, 3]`). -pub(crate) fn nums(j: &Json) -> Option> { - match j { - Json::Number(n) => Some(vec![n.as_f64()?]), - Json::Array(a) => { - // `[[x, y]]`-style wrapping. - if a.len() == 1 - && let Some(inner @ Json::Array(_)) = a.first() - { - return nums(inner); - } - a.iter().map(Json::as_f64).collect() - } - _ => None, - } -} - pub(crate) fn to_scalar(j: &Json) -> Option { nums(j).and_then(|v| v.first().copied()).map(Value::Scalar) } @@ -363,15 +293,8 @@ pub(crate) fn to_vec3(j: &Json, z: f64) -> Option { } pub(crate) fn to_color(j: &Json) -> Option { - let v = nums(j)?; - let mut c = [*v.first()?, *v.get(1).unwrap_or(&0.0), *v.get(2).unwrap_or(&0.0), *v.get(3).unwrap_or(&1.0)]; - // Some files use 0–255. - if c[..3].iter().any(|x| *x > 1.0) { - for x in &mut c[..3] { - *x /= 255.0; - } - } - Some(Value::Color(c)) + // Some files use 0–255: `craft_lottie::color` divides those. + craft_lottie::color(j).map(Value::Color) } pub(crate) fn to_bool(j: &Json) -> Option { diff --git a/crates/lottie/src/base64.rs b/crates/lottie/src/base64.rs deleted file mode 100644 index b45f86d4a..000000000 --- a/crates/lottie/src/base64.rs +++ /dev/null @@ -1,69 +0,0 @@ -//! Standard base64 (RFC 4648 §4) for embedded image assets. - -const ALPHABET: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -pub fn encode(data: &[u8]) -> String { - let mut out = String::with_capacity(data.len().div_ceil(3) * 4); - for chunk in data.chunks(3) { - let b = [chunk[0], *chunk.get(1).unwrap_or(&0), *chunk.get(2).unwrap_or(&0)]; - let n = (b[0] as u32) << 16 | (b[1] as u32) << 8 | b[2] as u32; - for i in 0..4 { - if i <= chunk.len() { - out.push(ALPHABET[(n >> (18 - 6 * i) & 63) as usize] as char); - } else { - out.push('='); - } - } - } - out -} - -pub fn decode(s: &str) -> Option> { - let val = |c: u8| -> Option { - Some(match c { - b'A'..=b'Z' => c - b'A', - b'a'..=b'z' => c - b'a' + 26, - b'0'..=b'9' => c - b'0' + 52, - b'+' | b'-' => 62, - b'/' | b'_' => 63, - _ => return None, - } as u32) - }; - let clean: Vec = s.bytes().filter(|c| !c.is_ascii_whitespace() && *c != b'=').collect(); - let mut out = Vec::with_capacity(clean.len() * 3 / 4); - for chunk in clean.chunks(4) { - let mut n = 0u32; - for (i, &c) in chunk.iter().enumerate() { - n |= val(c)? << (18 - 6 * i); - } - let bytes = [(n >> 16) as u8, (n >> 8) as u8, n as u8]; - match chunk.len() { - 4 => out.extend_from_slice(&bytes), - 3 => out.extend_from_slice(&bytes[..2]), - 2 => out.push(bytes[0]), - _ => return None, - } - } - Some(out) -} - -/// Split a `data:;base64,` URI into (mime, bytes). -pub fn data_uri(s: &str) -> Option<(String, Vec)> { - let rest = s.strip_prefix("data:")?; - let (head, payload) = rest.split_once(',')?; - let mime = head.strip_suffix(";base64")?; - Some((mime.to_string(), decode(payload)?)) -} - -#[cfg(test)] -mod tests { - #[test] - fn roundtrip() { - for s in ["", "f", "fo", "foo", "foob", "fooba", "foobar"] { - let e = super::encode(s.as_bytes()); - assert_eq!(super::decode(&e).unwrap(), s.as_bytes()); - } - assert_eq!(super::encode(b"foobar"), "Zm9vYmFy"); - assert_eq!(super::encode(b"fo"), "Zm8="); - } -} diff --git a/crates/lottie/src/export.rs b/crates/lottie/src/export.rs index 88dcf4ed4..99ca28e7e 100644 --- a/crates/lottie/src/export.rs +++ b/crates/lottie/src/export.rs @@ -2,11 +2,14 @@ use std::collections::BTreeSet; +use craft_lottie::model::{Asset, Effect, Font, Fonts, Layer as LottieLayer, LayerContent, Marker, Mask, PrecompLayer, SolidLayer, Transform}; +use craft_lottie::{Animated, Animation, Json}; use effectcraft_keyframe::Value; use effectcraft_project::{Comp, FootageKind, GroupKind, ItemId, ItemKind, Layer, LayerSource, MaskMode, MatteKind, Project, PropGroup}; -use serde_json::{Map, Value as Json, json}; +use serde_json::json; use crate::anim::{self, Ex, export_prop}; +use crate::shapes::fixed; use crate::{LottieError, Timebase, shapes, text}; /// Export settings. @@ -134,30 +137,15 @@ struct Doc<'a> { opts: &'a ExportOptions, read: &'a dyn Fn(&str) -> Option>, ex: Ex, - assets: Vec, + assets: Vec, done: BTreeSet, - fonts: Vec, + fonts: Vec, any_3d: bool, } -fn hex(c: [f32; 3]) -> String { - let b = |v: f32| (v.clamp(0.0, 1.0) * 255.0).round() as u8; - format!("#{:02x}{:02x}{:02x}", b(c[0]), b(c[1]), b(c[2])) -} - /// The image type `bytes` hold, by their signature; `None` for anything else. pub(crate) fn image_mime(bytes: &[u8]) -> Option<&'static str> { - if bytes.starts_with(b"\x89PNG\r\n\x1a\n") { - Some("image/png") - } else if bytes.starts_with(&[0xff, 0xd8, 0xff]) { - Some("image/jpeg") - } else if bytes.starts_with(b"GIF87a") || bytes.starts_with(b"GIF89a") { - Some("image/gif") - } else if bytes.starts_with(b"RIFF") && bytes.get(8..12) == Some(b"WEBP") { - Some("image/webp") - } else { - None - } + craft_lottie::image_mime(bytes) } impl Doc<'_> { @@ -165,84 +153,68 @@ impl Doc<'_> { self.ex.tb.frame(t) } - fn prop(&mut self, g: &PropGroup, m: &str, conv: &dyn Fn(&Value) -> Json, label: &str) -> Option { + fn prop(&mut self, g: &PropGroup, m: &str, conv: &dyn Fn(&Value) -> Json, label: &str) -> Option { let p = g.get(m)?; Some(export_prop(&mut self.ex, p, conv, &format!("{label} ▸ {}", p.name))) } - fn transform(&mut self, l: &Layer) -> Json { - let mut ks = Map::new(); - let Some(tr) = l.transform() else { return json!({}) }; + fn transform(&mut self, l: &Layer) -> Transform { + let mut ks = Transform::default(); + let Some(tr) = l.transform() else { return ks }; let label = format!("{} ▸ Transform", l.name); let three = l.is_3d(); - if let Some(a) = self.prop(tr, "anchor", &anim::arr3, &label) { - ks.insert("a".into(), a); - } + ks.anchor = self.prop(tr, "anchor", &anim::arr3, &label); if tr.get("positionX").is_some() { let mut p = json!({"s": true}); for (k, m) in [("x", "positionX"), ("y", "positionY"), ("z", "positionZ")] { if (k != "z" || three) && let Some(v) = self.prop(tr, m, &anim::num, &label) { - p[k] = v; + p[k] = v.0; } } - ks.insert("p".into(), p); - } else if let Some(p) = self.prop(tr, "position", &anim::arr3, &label) { - ks.insert("p".into(), p); - } - if let Some(s) = self.prop(tr, "scale", &anim::arr3, &label) { - ks.insert("s".into(), s); + ks.position = Some(Animated(p)); + } else { + ks.position = self.prop(tr, "position", &anim::arr3, &label); } + ks.scale = self.prop(tr, "scale", &anim::arr3, &label); if three { - for (k, m) in [("rx", "rotationX"), ("ry", "rotationY"), ("rz", "rotation")] { - if let Some(v) = self.prop(tr, m, &anim::num, &label) { - ks.insert(k.into(), v); - } - } - if let Some(v) = self.prop(tr, "orientation", &anim::arr3, &label) { - ks.insert("or".into(), v); - } - } else if let Some(r) = self.prop(tr, "rotation", &anim::num, &label) { - ks.insert("r".into(), r); + ks.rotation_x = self.prop(tr, "rotationX", &anim::num, &label); + ks.rotation_y = self.prop(tr, "rotationY", &anim::num, &label); + ks.rotation_z = self.prop(tr, "rotation", &anim::num, &label); + ks.orientation = self.prop(tr, "orientation", &anim::arr3, &label); + } else { + ks.rotation = self.prop(tr, "rotation", &anim::num, &label); } - if let Some(o) = self.prop(tr, "opacity", &anim::num, &label) { - ks.insert("o".into(), o); - } - Json::Object(ks) + ks.opacity = self.prop(tr, "opacity", &anim::num, &label); + ks } - fn masks(&mut self, l: &Layer) -> Vec { + fn masks(&mut self, l: &Layer) -> Vec { let Some(masks) = l.masks() else { return vec![] }; let mut out = vec![]; for m in masks.groups() { let GroupKind::Mask { mode, inverted, .. } = m.kind else { continue }; let label = format!("{} ▸ {}", l.name, m.name); - let mut o = json!({"nm": m.name, "mode": mask_mode(mode), "inv": inverted}); - if let Some(v) = self.prop(m, "path", &shapes::path_value, &label) { - o["pt"] = v; - } - if let Some(v) = self.prop(m, "opacity", &anim::num, &label) { - o["o"] = v; - } - if let Some(v) = self.prop(m, "expansion", &anim::num, &label) { - o["x"] = v; - } + let mut o = Mask { name: Some(m.name.clone()), mode: Some(mask_mode(mode).into()), inverted: Some(inverted), ..Default::default() }; + o.path = self.prop(m, "path", &shapes::path_value, &label); + o.opacity = self.prop(m, "opacity", &anim::num, &label); + o.expansion = self.prop(m, "expansion", &anim::num, &label); if let Some(f) = m.get("feather") { if f.is_animated() || f.value.components().iter().any(|v| *v != 0.0) { self.ex.warn(format!("{label}: mask feather is exported as `f` (not every Lottie player renders it)")); } - o["f"] = export_prop(&mut self.ex, f, &anim::arr2, &format!("{label} ▸ Mask Feather")); + o.extra.insert("f".into(), export_prop(&mut self.ex, f, &anim::arr2, &format!("{label} ▸ Mask Feather")).0); } if !m.enabled { - o["mode"] = json!("n"); + o.mode = Some("n".into()); } out.push(o); } out } - fn effects(&mut self, l: &Layer) -> Vec { + fn effects(&mut self, l: &Layer) -> Vec { let Some(fx) = l.effects() else { return vec![] }; let mut out = vec![]; for (i, g) in fx.groups().enumerate() { @@ -268,11 +240,27 @@ impl Doc<'_> { }; (p.name.clone(), export_prop(&mut self.ex, p, &conv, &format!("{label} ▸ {}", p.name))) } - None => (format!("Param {}", pi + 1), json!({"a": 0, "k": konst})), + None => (format!("Param {}", pi + 1), fixed(json!(konst))), }; - params.push(json!({"ty": ty, "nm": nm, "mn": m, "ix": pi + 1, "v": v})); + params.push(Effect { + kind: Some(i64::from(*ty)), + name: Some(nm), + match_name: Some((*m).into()), + index: Some(pi as i64 + 1), + value: Some(v), + ..Default::default() + }); } - out.push(json!({"ty": map.ty, "nm": g.name, "mn": effect, "ix": i + 1, "en": g.enabled as u8, "np": params.len(), "ef": params})); + out.push(Effect { + kind: Some(i64::from(map.ty)), + name: Some(g.name.clone()), + match_name: Some(effect.clone()), + index: Some(i as i64 + 1), + enabled: Some(i64::from(g.enabled)), + count: Some(params.len() as i64), + values: Some(params), + ..Default::default() + }); } out } @@ -294,8 +282,16 @@ impl Doc<'_> { self.ex.warn(format!("{}: `{}` is not a PNG, JPEG, GIF or WebP image (layer exported as a null)", l.name, f.path)); return None; }; - let uri = format!("data:{mime};base64,{}", crate::base64::encode(&bytes)); - self.assets.push(json!({"id": id, "nm": it.name, "w": f.width, "h": f.height, "u": "", "p": uri, "e": 1})); + self.assets.push(Asset { + id: Some(id.clone()), + name: Some(it.name.clone()), + width: Some(f64::from(f.width)), + height: Some(f64::from(f.height)), + dir: Some(String::new()), + path: Some(craft_lottie::base64::to_data_uri(mime, &bytes)), + embedded: Some(1), + ..Default::default() + }); self.done.insert(id.clone()); Some(id) } @@ -309,11 +305,19 @@ impl Doc<'_> { let c = it.as_comp()?; self.done.insert(id.clone()); let layers = self.layers(c); - self.assets.push(json!({"id": id, "nm": it.name, "fr": c.frame_rate.as_f64(), "w": c.width, "h": c.height, "layers": layers})); + self.assets.push(Asset { + id: Some(id.clone()), + name: Some(it.name.clone()), + frame_rate: Some(c.frame_rate.as_f64()), + width: Some(f64::from(c.width)), + height: Some(f64::from(c.height)), + layers: Some(layers), + ..Default::default() + }); Some(id) } - fn layers(&mut self, comp: &Comp) -> Vec { + fn layers(&mut self, comp: &Comp) -> Vec { let mattes: BTreeSet<_> = comp.layers.iter().filter_map(|l| l.track_matte.map(|m| m.layer)).collect(); let mut out = vec![]; for (idx, l) in comp.layers.iter().enumerate() { @@ -322,11 +326,9 @@ impl Doc<'_> { out } - fn layer(&mut self, comp: &Comp, idx: usize, l: &Layer, is_matte: bool) -> Json { + fn layer(&mut self, comp: &Comp, idx: usize, l: &Layer, is_matte: bool) -> LottieLayer { let name = l.name.clone(); - let mut o = Map::new(); - o.insert("ind".into(), json!(idx + 1)); - o.insert("nm".into(), json!(name)); + let mut o = LottieLayer { index: Some(idx as i64 + 1), name: Some(name.clone()), ..Default::default() }; let three = l.is_3d(); if three { self.any_3d = true; @@ -334,34 +336,30 @@ impl Doc<'_> { self.ex.warn(format!("{name}: 3D layer exported with ddd: 1 (most Lottie players render 2D only)")); } } - o.insert("ddd".into(), json!(three as u8)); + o.three_d = Some(i64::from(three)); let mut hidden = !l.switches.video || l.switches.guide; - let mut ty = 3; + o.content = LayerContent::Null; match &l.source { LayerSource::Shape => { - ty = 4; let items = l.props.sub("contents").map(|c| shapes::export_items(&mut self.ex, c, &name)).unwrap_or_default(); - o.insert("shapes".into(), json!(items)); + o.content = LayerContent::Shape(items); } LayerSource::Text => { if self.opts.text_as_shapes { - ty = 4; - let items = text::glyph_shapes(&mut self.ex, l); - o.insert("shapes".into(), json!(items)); + o.content = LayerContent::Shape(text::glyph_shapes(&mut self.ex, l)); } else { - ty = 5; - let t = text::export_text(&mut self.ex, l, &mut self.fonts); - o.insert("t".into(), t); + o.content = LayerContent::Text(Box::new(text::export_text(&mut self.ex, l, &mut self.fonts))); } } LayerSource::Solid { item } => { let sol = self.project.item(*item).and_then(|i| if let ItemKind::Solid(s) = &i.kind { Some(s.clone()) } else { None }); match sol { Some(s) if !l.switches.adjustment => { - ty = 1; - o.insert("sc".into(), json!(hex(s.color))); - o.insert("sw".into(), json!(s.width)); - o.insert("sh".into(), json!(s.height)); + o.content = LayerContent::Solid(SolidLayer { + color: Some(craft_lottie::to_hex(s.color)), + width: Some(f64::from(s.width)), + height: Some(f64::from(s.height)), + }); } _ => { self.ex.warn(format!("{name}: adjustment layers are not part of Lottie (exported as a null)")); @@ -371,15 +369,9 @@ impl Doc<'_> { } LayerSource::Comp { item } => { if let Some(id) = self.precomp_asset(*item) { - ty = 0; let (w, h) = self.project.comp(*item).map(|c| (c.width, c.height)).unwrap_or((comp.width, comp.height)); - o.insert("refId".into(), json!(id)); - o.insert("w".into(), json!(w)); - o.insert("h".into(), json!(h)); - if let Some(tm) = l.props.get("timeRemap") { - let v = export_prop(&mut self.ex, tm, &anim::num, &format!("{name} ▸ Time Remap")); - o.insert("tm".into(), v); - } + let time_remap = l.props.get("timeRemap").map(|tm| export_prop(&mut self.ex, tm, &anim::num, &format!("{name} ▸ Time Remap"))); + o.content = LayerContent::Precomp(PrecompLayer { ref_id: Some(id), width: Some(f64::from(w)), height: Some(f64::from(h)), time_remap }); } } LayerSource::Footage { item } => { @@ -387,8 +379,7 @@ impl Doc<'_> { match kind { Some((FootageKind::Still, true)) => { if let Some(id) = self.image_asset(*item, l) { - ty = 2; - o.insert("refId".into(), json!(id)); + o.content = LayerContent::Image(Some(id)); } else { hidden = true; } @@ -413,20 +404,16 @@ impl Doc<'_> { hidden = true; } } - o.insert("ty".into(), json!(ty)); - if let Some(p) = l.parent.and_then(|p| comp.index_of(p)) { - o.insert("parent".into(), json!(p)); - } - o.insert("sr".into(), json!(l.stretch / 100.0)); + o.parent = l.parent.and_then(|p| comp.index_of(p)).map(|p| p as i64); + o.stretch = Some(l.stretch / 100.0); if l.stretch < 0.0 { self.ex.warn(format!("{name}: reversed time stretch is not supported by most Lottie players")); } - let ks = self.transform(l); - o.insert("ks".into(), ks); - o.insert("ao".into(), json!((l.auto_orient == effectcraft_project::AutoOrient::AlongPath) as u8)); - o.insert("ip".into(), json!(self.frame(l.in_point))); - o.insert("op".into(), json!(self.frame(l.out_point))); - o.insert("st".into(), json!(self.frame(l.start_time))); + o.transform = Some(self.transform(l)); + o.auto_orient = Some(i64::from(l.auto_orient == effectcraft_project::AutoOrient::AlongPath)); + o.in_point = Some(self.frame(l.in_point)); + o.out_point = Some(self.frame(l.out_point)); + o.start_time = Some(self.frame(l.start_time)); let bm = match crate::blend_to_lottie(l.blend_mode) { Some(b) => b, None => { @@ -434,32 +421,32 @@ impl Doc<'_> { 0 } }; - o.insert("bm".into(), json!(bm)); + o.blend_mode = Some(i64::from(bm)); let masks = self.masks(l); if !masks.is_empty() { - o.insert("hasMask".into(), json!(true)); - o.insert("masksProperties".into(), json!(masks)); + o.has_mask = Some(true); + o.masks = Some(masks); } let ef = self.effects(l); if !ef.is_empty() { - o.insert("ef".into(), json!(ef)); + o.effects = Some(ef); } if let Some(tm) = l.track_matte && let Some(mi) = comp.index_of(tm.layer) { - o.insert("tt".into(), json!(matte_code(tm.kind))); - o.insert("tp".into(), json!(mi)); + o.matte_mode = Some(i64::from(matte_code(tm.kind))); + o.matte_parent = Some(mi as i64); if mi != idx { self.ex.warn(format!("{name}: track matte layer is not directly above (players without `tp` support use the layer above)")); } } if is_matte { - o.insert("td".into(), json!(1)); + o.is_matte = Some(1); if l.switches.video { self.ex.warn(format!("{name}: visible track matte layer (Lottie always hides matte layers)")); } } else if hidden { - o.insert("hd".into(), json!(true)); + o.hidden = Some(true); } if !l.markers.is_empty() { self.ex.warn(format!("{name}: layer markers are not part of Lottie (composition markers are exported)")); @@ -471,7 +458,7 @@ impl Doc<'_> { if l.preserve_transparency { self.ex.warn(format!("{name}: Preserve Underlying Transparency is not part of Lottie")); } - Json::Object(o) + o } } @@ -493,24 +480,27 @@ pub fn export_comp(project: &Project, comp: ItemId, opts: &ExportOptions, read: }; doc.done.insert(format!("comp_{}", comp.0)); let layers = doc.layers(c); - let markers: Vec = c.markers.iter().map(|m| json!({"tm": doc.frame(m.time), "cm": m.comment, "dr": doc.frame(m.duration)})).collect(); - let mut out = json!({ - "v": "5.12.0", - "fr": c.frame_rate.as_f64(), - "ip": 0, - "op": doc.frame(c.duration), - "w": c.width, - "h": c.height, - "nm": item.name, - "ddd": doc.any_3d as u8, - "assets": doc.assets, - "layers": layers, - "markers": markers, - }); - if !doc.fonts.is_empty() { - out["fonts"] = json!({"list": doc.fonts}); - } - Ok(ExportResult { json: out, warnings: doc.ex.warnings }) + let markers: Vec = c + .markers + .iter() + .map(|m| Marker { time: Some(doc.frame(m.time)), comment: Some(m.comment.clone()), duration: Some(doc.frame(m.duration)), ..Default::default() }) + .collect(); + let animation = Animation { + version: Some("5.12.0".into()), + frame_rate: Some(c.frame_rate.as_f64()), + in_point: Some(0.0), + out_point: Some(doc.frame(c.duration)), + width: Some(f64::from(c.width)), + height: Some(f64::from(c.height)), + name: Some(item.name.clone()), + three_d: Some(i64::from(doc.any_3d)), + assets: Some(doc.assets), + layers: Some(layers), + markers: Some(markers), + fonts: (!doc.fonts.is_empty()).then(|| Fonts { list: Some(doc.fonts), ..Default::default() }), + ..Default::default() + }; + Ok(ExportResult { json: animation.to_json(), warnings: doc.ex.warnings }) } /// Package an export as a dotLottie archive (`manifest.json` + `animations/.json`). diff --git a/crates/lottie/src/import.rs b/crates/lottie/src/import.rs index 57ef6427a..6534727dc 100644 --- a/crates/lottie/src/import.rs +++ b/crates/lottie/src/import.rs @@ -1,8 +1,10 @@ //! Lottie document → EffectCraft compositions (the inverse of [`crate::export`]). -use std::collections::BTreeMap; +use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; +use craft_lottie::model::{Asset, Effect, Layer as LottieLayer, LayerContent, Mask, Transform}; +use craft_lottie::{Animated, Animation, Json}; use effectcraft_color::Label; use effectcraft_keyframe::{ShapePath, Value}; use effectcraft_project::build::{self, Ids}; @@ -11,12 +13,14 @@ use effectcraft_project::{ PropGroup, Property, Solid, TrackMatte, }; use effectcraft_time::{FrameRate, Tick}; -use serde_json::Value as Json; -use crate::anim::{self, Im, import_prop}; +use crate::anim::{self, Im, import_animated, import_prop}; use crate::export::{fx_by_id, fx_by_type, fx_params, mask_mode_from}; use crate::{LottieError, Timebase, shapes, text}; +/// Longest font family or style name kept (each text key using the font holds a copy). +const MAX_FONT_NAME_CHARS: usize = 256; + /// An embedded image asset handed to the caller to store (the returned path becomes the /// footage item's file). #[derive(Clone, Debug)] @@ -37,24 +41,15 @@ pub struct ImportResult { pub warnings: Vec, } -fn f(j: &Json, k: &str) -> Option { - j.get(k).and_then(Json::as_f64) -} - -fn s<'a>(j: &'a Json, k: &str) -> Option<&'a str> { - j.get(k).and_then(Json::as_str) -} - -fn hex_color(sc: &str) -> [f32; 3] { - let h = sc.trim_start_matches('#'); - let c = |i: usize| { - h.get(i..i + 2).filter(|x| x.bytes().all(|b| b.is_ascii_hexdigit())).and_then(|x| u8::from_str_radix(x, 16).ok()).unwrap_or(0) as f32 / 255.0 +/// The Lottie document inside raw bytes (plain JSON, or a stored dotLottie archive), read into +/// `craft-lottie`'s model within its default limits. +fn document(bytes: &[u8]) -> Result { + let read = |b: &[u8]| { + Animation::read(b).map_err(|e| match e { + craft_lottie::LottieError::Parse(m) => LottieError::Parse(m), + other => LottieError::Invalid(other.to_string()), + }) }; - [c(0), c(2), c(4)] -} - -/// The Lottie JSON inside raw bytes (plain JSON, or a stored dotLottie archive). -fn document(bytes: &[u8]) -> Result { if bytes.starts_with(b"PK") { let entries = crate::zip::read_stored(bytes); let anim = entries @@ -62,9 +57,9 @@ fn document(bytes: &[u8]) -> Result { .find(|(n, _)| n.starts_with("animations/") && n.ends_with(".json")) .or_else(|| entries.iter().find(|(n, _)| n.ends_with(".json") && n != "manifest.json")) .ok_or_else(|| LottieError::Parse("dotLottie archive without an uncompressed animation".into()))?; - return serde_json::from_slice(&anim.1).map_err(|e| LottieError::Parse(e.to_string())); + return read(&anim.1); } - serde_json::from_slice(bytes).map_err(|e| LottieError::Parse(e.to_string())) + read(bytes) } struct Ctx<'a> { @@ -118,27 +113,28 @@ pub fn import( store: &mut dyn FnMut(&ImportedImage) -> Option, ) -> Result { let doc = document(bytes)?; - let (Some(w), Some(h)) = (f(&doc, "w"), f(&doc, "h")) else { return Err(LottieError::Parse("missing `w`/`h`".into())) }; - let fr = f(&doc, "fr").filter(|v| *v > 0.0).unwrap_or(30.0); + let (Some(w), Some(h)) = (doc.width, doc.height) else { return Err(LottieError::Parse("missing `w`/`h`".into())) }; + let fr = doc.frame_rate.filter(|v| *v > 0.0).unwrap_or(30.0); let rate = FrameRate::from_f64(fr); let tb = Timebase { rate }; - let name = s(&doc, "nm").filter(|n| !n.is_empty()).unwrap_or(fallback_name).to_string(); - let ip = f(&doc, "ip").unwrap_or(0.0); - let op = f(&doc, "op").unwrap_or(ip + fr).max(ip + 1.0); + let name = doc.name.as_deref().filter(|n| !n.is_empty()).unwrap_or(fallback_name).to_string(); + let ip = doc.in_point.unwrap_or(0.0); + let op = doc.out_point.unwrap_or(ip + fr).max(ip + 1.0); let mut cx = Ctx { im: Im { tb, warnings: vec![] }, assets: BTreeMap::new(), fonts: vec![], store, base_dir, items: vec![], folder: None, name: name.clone() }; - if let Some(list) = doc.get("fonts").and_then(|f| f.get("list")).and_then(Json::as_array) { - for fo in list { - let n = s(fo, "fName").unwrap_or("").to_string(); - let fam = s(fo, "fFamily").unwrap_or(&n).to_string(); - let st = s(fo, "fStyle").unwrap_or("Regular").to_string(); - cx.fonts.push((n, fam, st)); - } + for fo in doc.fonts.as_ref().and_then(|f| f.list.as_deref()).unwrap_or_default() { + // Every text key referring to the font copies its family and style: keep them to + // a font name's length. + let short = |v: &str| v.chars().take(MAX_FONT_NAME_CHARS).collect::(); + let n = fo.name.clone().unwrap_or_default(); + let fam = short(fo.family.as_deref().unwrap_or(&n)); + let st = short(fo.style.as_deref().unwrap_or("Regular")); + cx.fonts.push((n, fam, st)); } // Glyph outlines embedded for players without the fonts. Text is set in installed fonts. - if let Some(chars) = doc.get("chars").and_then(Json::as_array).filter(|c| !c.is_empty()) { + if let Some(chars) = doc.chars.as_deref().filter(|c| !c.is_empty()) { let mut fams: Vec<&str> = vec![]; - for fam in chars.iter().filter_map(|c| s(c, "fFamily")).filter(|f| !f.trim().is_empty()) { + for fam in chars.iter().filter_map(|c| c.family.as_deref()).filter(|f| !f.trim().is_empty()) { if !fams.contains(&fam) { fams.push(fam); } @@ -149,24 +145,27 @@ pub fn import( let (w, h) = (w.round().max(1.0) as u32, h.round().max(1.0) as u32); let duration = tb.tick(op); // Pass 1: asset items (precomps empty for now, images stored). - let assets = doc.get("assets").and_then(Json::as_array).cloned().unwrap_or_default(); - for a in &assets { - let Some(id) = s(a, "id") else { continue }; - if a.get("layers").is_some() { + let assets: &[Asset] = doc.assets.as_deref().unwrap_or_default(); + let top: &[LottieLayer] = doc.layers.as_deref().unwrap_or_default(); + let layer_sizes = precomp_layer_sizes(top, assets); + for a in assets { + let Some(id) = a.id.as_deref() else { continue }; + let size = a.width.zip(a.height).map(|(x, y)| (x as u32, y as u32)); + if a.layers.is_some() { let folder = cx.folder(project); - let layer = precomp_layer_size(&doc, &assets, id); - let aw = f(a, "w").map(|v| v as u32).or(layer.map(|l| l.0)).unwrap_or(w); - let ah = f(a, "h").map(|v| v as u32).or(layer.map(|l| l.1)).unwrap_or(h); - let arate = f(a, "fr").map(FrameRate::from_f64).unwrap_or(rate); + let layer = layer_sizes.get(id).copied(); + let aw = a.width.map(|v| v as u32).or(layer.map(|l| l.0)).unwrap_or(w); + let ah = a.height.map(|v| v as u32).or(layer.map(|l| l.1)).unwrap_or(h); + let arate = a.frame_rate.map(FrameRate::from_f64).unwrap_or(rate); let c = Comp::new(aw, ah, arate, duration); - let nm = s(a, "nm").unwrap_or(id).to_string(); + let nm = a.name.as_deref().unwrap_or(id).to_string(); let item = project.add_item(&nm, Label::Sandstone, Some(folder), ItemKind::Comp(Arc::new(c))); cx.items.push(item); - cx.assets.insert(id.to_string(), (item, f(a, "w").zip(f(a, "h")).map(|(x, y)| (x as u32, y as u32)))); - } else if let Some(p) = s(a, "p") { - let (aw, ah) = (f(a, "w").unwrap_or(0.0) as u32, f(a, "h").unwrap_or(0.0) as u32); - let nm = s(a, "nm").unwrap_or(id).to_string(); - let path = if let Some((mime, data)) = crate::base64::data_uri(p) { + cx.assets.insert(id.to_string(), (item, size)); + } else if let Some(p) = a.path.as_deref() { + let (aw, ah) = (a.width.unwrap_or(0.0) as u32, a.height.unwrap_or(0.0) as u32); + let nm = a.name.as_deref().unwrap_or(id).to_string(); + let path = if let Some((mime, data)) = craft_lottie::base64::data_uri(p) { let ext = match mime.as_str() { "image/jpeg" | "image/jpg" => "jpg", "image/webp" => "webp", @@ -176,7 +175,7 @@ pub fn import( }; (cx.store)(&ImportedImage { id: id.to_string(), name: nm.clone(), bytes: data, ext: ext.into() }) } else { - let u = s(a, "u").unwrap_or(""); + let u = a.dir.as_deref().unwrap_or(""); match external_image(&format!("{u}{p}"), cx.base_dir) { Ok(path) => Some(path), Err(why) => { @@ -218,11 +217,11 @@ pub fn import( } } // Pass 2: precomp contents. - for a in &assets { - let (Some(id), Some(layers)) = (s(a, "id"), a.get("layers").and_then(Json::as_array)) else { continue }; + for a in assets { + let (Some(id), Some(layers)) = (a.id.as_deref(), a.layers.as_deref()) else { continue }; let Some((item, _)) = cx.assets.get(id).copied() else { continue }; let Some(mut c) = project.comp(item).cloned() else { continue }; - let end = layers.iter().filter_map(|l| f(l, "op")).fold(0.0f64, f64::max); + let end = layers.iter().filter_map(|l| l.out_point).fold(0.0f64, f64::max); if end > 0.0 { c.duration = tb.tick(end); c.work_area = (Tick::ZERO, c.duration); @@ -237,62 +236,64 @@ pub fn import( if ip > 0.0 { comp.work_area = (tb.tick(ip), duration); } - if let Some(ms) = doc.get("markers").and_then(Json::as_array) { - for m in ms { - comp.markers.push(Marker { - time: tb.tick(f(m, "tm").unwrap_or(0.0)), - duration: tb.tick(f(m, "dr").unwrap_or(0.0)), - comment: s(m, "cm").unwrap_or("").to_string(), - ..Default::default() - }); - } + for m in doc.markers.as_deref().unwrap_or_default() { + comp.markers.push(Marker { + time: tb.tick(m.time.unwrap_or(0.0)), + duration: tb.tick(m.duration.unwrap_or(0.0)), + comment: m.comment.clone().unwrap_or_default(), + ..Default::default() + }); } - let layers = doc.get("layers").and_then(Json::as_array).cloned().unwrap_or_default(); - build_layers(&mut cx, project, &mut comp, &layers); + build_layers(&mut cx, project, &mut comp, top); let id = project.add_item(&name, Label::Sandstone, None, ItemKind::Comp(Arc::new(comp))); cx.items.push(id); project.fix_next_id(); Ok(ImportResult { comp: id, items: cx.items, warnings: cx.im.warnings }) } -/// The `w`/`h` of the first precomp layer, in the main comp or in any asset, that shows asset `id`. -/// lottie-spec gives a precomposition asset no size: the layer's `w`/`h` are its clipping rect. -fn precomp_layer_size(doc: &Json, assets: &[Json], id: &str) -> Option<(u32, u32)> { - let lists = doc.get("layers").into_iter().chain(assets.iter().filter_map(|a| a.get("layers"))); - lists.filter_map(Json::as_array).flatten().find_map(|l| { - if l.get("ty").and_then(Json::as_u64) != Some(0) || s(l, "refId") != Some(id) { - return None; - } - let (lw, lh) = f(l, "w").zip(f(l, "h"))?; - Some((lw.round().max(1.0) as u32, lh.round().max(1.0) as u32)) - }) +/// By asset id, the `w`/`h` of the first precomp layer, in the main comp or in any asset, that +/// shows it. lottie-spec gives a precomposition asset no size: the layer's `w`/`h` are its +/// clipping rect. One pass over all layers, not one per asset. +fn precomp_layer_sizes<'a>(top: &'a [LottieLayer], assets: &'a [Asset]) -> HashMap<&'a str, (u32, u32)> { + let mut out = HashMap::new(); + let lists = std::iter::once(top).chain(assets.iter().filter_map(|a| a.layers.as_deref())); + for l in lists.flatten() { + let LayerContent::Precomp(p) = &l.content else { continue }; + let (Some(id), Some((lw, lh))) = (p.ref_id.as_deref(), p.width.zip(p.height)) else { continue }; + out.entry(id).or_insert((lw.round().max(1.0) as u32, lh.round().max(1.0) as u32)); + } + out } -fn transform(im: &Im, ks: &Json, tr: &mut PropGroup, next: &mut u64) { - let set = |tr: &mut PropGroup, m: &str, j: Option<&Json>, conv: &dyn Fn(&Json) -> Option| { - if let (Some(j), Some(p)) = (j, tr.get_mut(m)) { - import_prop(im, j, p, conv); +fn transform(im: &Im, ks: &Transform, tr: &mut PropGroup, next: &mut u64) { + let set = |tr: &mut PropGroup, m: &str, j: Option<&Animated>, conv: &dyn Fn(&Json) -> Option| { + if let Some(p) = tr.get_mut(m) { + import_animated(im, j, p, conv); } }; - set(tr, "anchor", ks.get("a"), &|v| anim::to_vec3(v, 0.0)); - set(tr, "scale", ks.get("s"), &|v| anim::to_vec3(v, 100.0)); - set(tr, "rotation", ks.get("r").or(ks.get("rz")), &anim::to_scalar); - set(tr, "rotationX", ks.get("rx"), &anim::to_scalar); - set(tr, "rotationY", ks.get("ry"), &anim::to_scalar); - set(tr, "orientation", ks.get("or"), &|v| anim::to_vec3(v, 0.0)); - set(tr, "opacity", ks.get("o"), &anim::to_scalar); - let Some(p) = ks.get("p") else { return }; - if p.get("s").and_then(Json::as_bool) == Some(true) { + set(tr, "anchor", ks.anchor.as_ref(), &|v| anim::to_vec3(v, 0.0)); + set(tr, "scale", ks.scale.as_ref(), &|v| anim::to_vec3(v, 100.0)); + set(tr, "rotation", ks.rotation.as_ref().or(ks.rotation_z.as_ref()), &anim::to_scalar); + set(tr, "rotationX", ks.rotation_x.as_ref(), &anim::to_scalar); + set(tr, "rotationY", ks.rotation_y.as_ref(), &anim::to_scalar); + set(tr, "orientation", ks.orientation.as_ref(), &|v| anim::to_vec3(v, 0.0)); + set(tr, "opacity", ks.opacity.as_ref(), &anim::to_scalar); + let Some(p) = &ks.position else { return }; + if let Some(dims) = p.split() { // Separated dimensions: X/Y/Z Position after Position. let at = tr.children.iter().position(|c| c.match_id() == "position").map(|i| i + 1).unwrap_or(tr.children.len()); let base = tr.get("position").map(|p| p.value.as_vec3()).unwrap_or([0.0; 3]); - for (d, (key, m, name)) in - [("x", "positionX", "X Position"), ("y", "positionY", "Y Position"), ("z", "positionZ", "Z Position")].iter().enumerate().rev() + for (d, (j, m, name)) in dims + .iter() + .zip([("positionX", "X Position"), ("positionY", "Y Position"), ("positionZ", "Z Position")]) + .map(|(j, (m, n))| (j, m, n)) + .enumerate() + .rev() { let mut pr = Property::new(*next, m, name, Value::Scalar(base[d])).with_ui(ParamUi::Number); *next += 1; pr.three_d_only = d == 2; - if let Some(j) = p.get(*key) { + if let Some(j) = j { import_prop(im, j, &mut pr, &anim::to_scalar); } tr.children.insert(at, Node::Prop(pr)); @@ -302,50 +303,50 @@ fn transform(im: &Im, ks: &Json, tr: &mut PropGroup, next: &mut u64) { } } -fn masks(im: &Im, ids: &mut Ids, list: &[Json], g: &mut PropGroup) { +fn masks(im: &Im, ids: &mut Ids, list: &[Mask], g: &mut PropGroup) { for (i, m) in list.iter().enumerate() { - let mode = mask_mode_from(s(m, "mode").unwrap_or("a")); - let name = s(m, "nm").map(str::to_string).unwrap_or(format!("Mask {}", i + 1)); + let mode = mask_mode_from(m.mode.as_deref().unwrap_or("a")); + let name = m.name.clone().unwrap_or(format!("Mask {}", i + 1)); let color = build::MASK_COLORS[i % build::MASK_COLORS.len()]; let mut mg = build::mask(ids, &name, ShapePath::default(), mode, color); if let GroupKind::Mask { inverted, .. } = &mut mg.kind { - *inverted = m.get("inv").and_then(Json::as_bool).unwrap_or(false); + *inverted = m.inverted.unwrap_or(false); } - let mut set = |k: &str, mid: &str, conv: &dyn Fn(&Json) -> Option| { - if let (Some(j), Some(p)) = (m.get(k), mg.get_mut(mid)) { + let mut set = |j: Option<&Json>, mid: &str, conv: &dyn Fn(&Json) -> Option| { + if let (Some(j), Some(p)) = (j, mg.get_mut(mid)) { import_prop(im, j, p, conv); } }; - let closed = m.get("cl").and_then(Json::as_bool).unwrap_or(false); - set("pt", "path", &|v| shapes::to_path(v, closed)); - set("o", "opacity", &anim::to_scalar); - set("x", "expansion", &anim::to_scalar); - set("f", "feather", &anim::to_vec2); + let closed = m.closed.unwrap_or(false); + set(m.path.as_ref().map(|a| &a.0), "path", &|v| shapes::to_path(v, closed)); + set(m.opacity.as_ref().map(|a| &a.0), "opacity", &anim::to_scalar); + set(m.expansion.as_ref().map(|a| &a.0), "expansion", &anim::to_scalar); + set(m.extra.get("f"), "feather", &anim::to_vec2); g.children.push(Node::Group(mg)); } } -fn effects(im: &mut Im, ids: &mut Ids, list: &[Json], g: &mut PropGroup, size: [f64; 2]) { +fn effects(im: &mut Im, ids: &mut Ids, list: &[Effect], g: &mut PropGroup, size: [f64; 2]) { for e in list { - let ty = e.get("ty").and_then(Json::as_u64).unwrap_or(0); - let params = e.get("ef").and_then(Json::as_array).cloned().unwrap_or_default(); - let inner_ty = params.first().and_then(|p| p.get("ty")).and_then(Json::as_u64); - let map = s(e, "mn").and_then(fx_by_id).or_else(|| fx_by_type(ty, inner_ty)); - let nm = s(e, "nm").unwrap_or("Effect"); + let ty = e.kind.and_then(|t| u64::try_from(t).ok()).unwrap_or(0); + let params: &[Effect] = e.values.as_deref().unwrap_or_default(); + let inner_ty = params.first().and_then(|p| p.kind).and_then(|t| u64::try_from(t).ok()); + let map = e.match_name.as_deref().and_then(fx_by_id).or_else(|| fx_by_type(ty, inner_ty)); + let nm = e.name.as_deref().unwrap_or("Effect"); let Some(map) = map else { im.warn(format!("effect `{nm}` (type {ty}) is not supported (skipped)")); continue; }; let Some(spec) = effectcraft_effects::find(map.id) else { continue }; let mut fg = effectcraft_effects::instantiate(spec, ids, nm, size); - if e.get("en").and_then(Json::as_u64) == Some(0) { + if e.enabled == Some(0) { fg.enabled = false; } for (i, (m, pty, scale, _)) in fx_params(map).iter().enumerate() { if m.is_empty() { continue; } - let Some(pj) = params.get(i).and_then(|p| p.get("v")) else { continue }; + let Some(pj) = params.get(i).and_then(|p| p.value.as_ref()) else { continue }; let Some(p) = fg.get_mut(m) else { continue }; let (pty, scale) = (*pty, *scale); let conv = move |v: &Json| -> Option { @@ -357,79 +358,84 @@ fn effects(im: &mut Im, ids: &mut Ids, list: &[Json], g: &mut PropGroup, size: [ _ => anim::to_scalar(v).map(|x| Value::Scalar(x.as_f64() / scale)), } }; - import_prop(im, pj, p, &conv); + import_prop(im, &pj.0, p, &conv); } g.children.push(Node::Group(fg)); } } -fn layer_source(cx: &mut Ctx, project: &mut Project, comp: &Comp, j: &Json) -> Option<(LayerSource, (u32, u32))> { - let ty = j.get("ty").and_then(Json::as_u64).unwrap_or(99); +fn layer_source(cx: &mut Ctx, project: &mut Project, comp: &Comp, j: &LottieLayer) -> Option<(LayerSource, (u32, u32))> { let full = (comp.width, comp.height); - let asset = |cx: &Ctx| s(j, "refId").and_then(|r| cx.assets.get(r).copied()); - Some(match ty { - 0 => { - let Some((item, _)) = asset(cx) else { - cx.im.warn(format!("{}: missing precomp asset", s(j, "nm").unwrap_or("layer"))); + let nm = j.name.as_deref(); + let asset = |cx: &Ctx, r: Option<&str>| r.and_then(|r| cx.assets.get(r).copied()); + Some(match &j.content { + LayerContent::Precomp(p) => { + let Some((item, _)) = asset(cx, p.ref_id.as_deref()) else { + cx.im.warn(format!("{}: missing precomp asset", nm.unwrap_or("layer"))); return None; }; let size = project.comp(item).map(|c| (c.width, c.height)).unwrap_or(full); (LayerSource::Comp { item }, size) } - 1 => { - let sw = f(j, "sw").unwrap_or(comp.width as f64).round().max(1.0) as u32; - let sh = f(j, "sh").unwrap_or(comp.height as f64).round().max(1.0) as u32; - let color = hex_color(s(j, "sc").unwrap_or("#000000")); - let name = s(j, "nm").unwrap_or("Solid"); + LayerContent::Solid(sl) => { + let sw = sl.width.unwrap_or(comp.width as f64).round().max(1.0) as u32; + let sh = sl.height.unwrap_or(comp.height as f64).round().max(1.0) as u32; + let color = craft_lottie::hex_color(sl.color.as_deref().unwrap_or("#000000")); + let name = nm.unwrap_or("Solid"); let folder = cx.folder(project); let item = project.add_item(name, Label::Red, Some(folder), ItemKind::Solid(Solid { color, width: sw, height: sh, pixel_aspect: 1.0 })); cx.items.push(item); (LayerSource::Solid { item }, (sw, sh)) } - 2 => { - let Some((item, size)) = asset(cx) else { - cx.im.warn(format!("{}: missing image asset", s(j, "nm").unwrap_or("layer"))); + LayerContent::Image(r) => { + let Some((item, size)) = asset(cx, r.as_deref()) else { + cx.im.warn(format!("{}: missing image asset", nm.unwrap_or("layer"))); return None; }; (LayerSource::Footage { item }, size.unwrap_or(full)) } - 3 => (LayerSource::Null, (100, 100)), - 4 => (LayerSource::Shape, full), - 5 => (LayerSource::Text, full), - 13 => { - cx.im.warn(format!("{}: camera layers are not imported", s(j, "nm").unwrap_or("camera"))); - return None; - } - other => { - cx.im.warn(format!("{}: layer type {other} is not supported (skipped)", s(j, "nm").unwrap_or("layer"))); - return None; - } + LayerContent::Null => (LayerSource::Null, (100, 100)), + LayerContent::Shape(_) => (LayerSource::Shape, full), + LayerContent::Text(_) => (LayerSource::Text, full), + LayerContent::Other(ty) => match ty.as_u64().unwrap_or(99) { + // A shape or text layer whose content is missing or unreadable is an empty one. + 4 => (LayerSource::Shape, full), + 5 => (LayerSource::Text, full), + 13 => { + cx.im.warn(format!("{}: camera layers are not imported", nm.unwrap_or("camera"))); + return None; + } + other => { + cx.im.warn(format!("{}: layer type {other} is not supported (skipped)", nm.unwrap_or("layer"))); + return None; + } + }, }) } /// Build the layers of a comp (Lottie order: first = top = layer #1). -fn build_layers(cx: &mut Ctx, project: &mut Project, comp: &mut Comp, layers: &[Json]) { +fn build_layers(cx: &mut Ctx, project: &mut Project, comp: &mut Comp, layers: &[LottieLayer]) { let tb = cx.im.tb; let mut by_ind: BTreeMap = BTreeMap::new(); - // (layer id, parent ind, matte: (kind, explicit tp ind), json position) - let mut pending: Vec<(LayerId, Option, Option<(MatteKind, Option)>, usize)> = vec![]; + // (layer id, its index in `comp.layers`, parent ind, matte: (kind, explicit tp ind), json position) + let mut pending: Vec<(LayerId, usize, Option, Option<(MatteKind, Option)>, usize)> = vec![]; let mut pos_ind: Vec> = vec![]; for (ji, j) in layers.iter().enumerate() { - let ind = j.get("ind").and_then(Json::as_i64); + let ind = j.index; pos_ind.push(ind); let Some((source, size)) = layer_source(cx, project, comp, j) else { continue }; - let name = s(j, "nm").unwrap_or(source.type_name()).to_string(); + let name = j.name.clone().unwrap_or_else(|| source.type_name().to_string()); let mut l: Layer = build::layer(project, comp, &name, source.clone(), size, None); if let Some(i) = ind { by_ind.insert(i, l.id); } - let ip = f(j, "ip").unwrap_or(0.0); - let op = f(j, "op").unwrap_or(tb.frame(comp.duration)); + let ip = j.in_point.unwrap_or(0.0); + let op = j.out_point.unwrap_or(tb.frame(comp.duration)); l.in_point = tb.tick(ip); l.out_point = tb.tick(op.max(ip)); - l.start_time = tb.tick(f(j, "st").unwrap_or(0.0)); + l.start_time = tb.tick(j.start_time.unwrap_or(0.0)); // Below 1 % (or 0) the layer time divides by ~0, and layer.timeStretch refuses it too. - let sr = f(j, "sr").unwrap_or(1.0); + let sr = j.stretch.unwrap_or(1.0); l.stretch = if sr.is_finite() && sr.abs() >= 0.01 { // Past ±9900 % too (#3247): the largest stretch a layer supports, sign kept. let pct = effectcraft_project::limits::stretch(sr * 100.0); @@ -441,76 +447,73 @@ fn build_layers(cx: &mut Ctx, project: &mut Project, comp: &mut Comp, layers: &[ cx.im.warn(format!("{name}: a time stretch of {} % is not supported (100 % used)", sr * 100.0)); 100.0 }; - if j.get("ddd").and_then(Json::as_u64) == Some(1) { + if j.three_d == Some(1) { l.switches.three_d = true; } - if let Some(bm) = j.get("bm").and_then(Json::as_u64) { + if let Some(bm) = j.blend_mode.and_then(|b| u64::try_from(b).ok()) { l.blend_mode = crate::blend_from_lottie(bm); } - if j.get("ao").and_then(Json::as_u64) == Some(1) { + if j.auto_orient == Some(1) { l.auto_orient = AutoOrient::AlongPath; } - if j.get("hd").and_then(Json::as_bool) == Some(true) { + if j.hidden == Some(true) { l.switches.video = false; } - if j.get("td").and_then(Json::as_u64) == Some(1) { + if j.is_matte == Some(1) { l.switches.video = false; } let mut next = project.next_id; - if let (Some(ks), Some(tr)) = (j.get("ks"), l.props.sub_mut("transform")) { + if let (Some(ks), Some(tr)) = (&j.transform, l.props.sub_mut("transform")) { transform(&cx.im, ks, tr, &mut next); } let mut ids = Ids(&mut next); - match &source { - LayerSource::Shape => { - let items = j.get("shapes").and_then(Json::as_array).cloned().unwrap_or_default(); - let groups = shapes::import_items(&mut cx.im, &mut ids, &items); + match (&source, &j.content) { + (LayerSource::Shape, LayerContent::Shape(items)) => { + let groups = shapes::import_items(&mut cx.im, &mut ids, &mut items.iter()); if let Some(c) = l.props.sub_mut("contents") { c.children.extend(groups.into_iter().map(Node::Group)); } } - LayerSource::Text => { - if let (Some(t), Some(tg)) = (j.get("t"), l.props.sub_mut("text")) { + (LayerSource::Text, LayerContent::Text(t)) => { + if let Some(tg) = l.props.sub_mut("text") { text::import_text(&mut cx.im, &mut ids, t, tg, &cx.fonts); } } - LayerSource::Comp { .. } => { - if let Some(tm) = j.get("tm") { + (LayerSource::Comp { .. }, LayerContent::Precomp(p)) => { + if let Some(tm) = &p.time_remap { let mut pr = ids.prop("timeRemap", "Time Remap", Value::Scalar(0.0)).with_ui(ParamUi::Number); - import_prop(&cx.im, tm, &mut pr, &anim::to_scalar); + import_prop(&cx.im, &tm.0, &mut pr, &anim::to_scalar); l.props.children.insert(0, Node::Prop(pr)); } } _ => {} } - if let Some(list) = j.get("masksProperties").and_then(Json::as_array) + if let Some(list) = &j.masks && let Some(g) = l.props.sub_mut("masks") { masks(&cx.im, &mut ids, list, g); } - if let Some(list) = j.get("ef").and_then(Json::as_array) + if let Some(list) = &j.effects && let Some(g) = l.props.sub_mut("effects") { effects(&mut cx.im, &mut ids, list, g, [size.0 as f64, size.1 as f64]); } - if j.get("sy").and_then(Json::as_array).is_some_and(|a| !a.is_empty()) { + if j.extra.get("sy").and_then(Json::as_array).is_some_and(|a| !a.is_empty()) { cx.im.warn(format!("{name}: layer styles are not imported")); } project.next_id = next; - let parent = j.get("parent").and_then(Json::as_i64); - let tt = j.get("tt").and_then(Json::as_u64).unwrap_or(0); - let matte = match tt { + let matte = match j.matte_mode.unwrap_or(0) { 1 => Some(MatteKind::Alpha), 2 => Some(MatteKind::AlphaInverted), 3 => Some(MatteKind::Luma), 4 => Some(MatteKind::LumaInverted), _ => None, } - .map(|k| (k, j.get("tp").and_then(Json::as_i64))); - pending.push((l.id, parent, matte, ji)); + .map(|k| (k, j.matte_parent)); + pending.push((l.id, comp.layers.len(), j.parent, matte, ji)); comp.layers.push(l); } - for (id, parent, matte, ji) in pending { + for (id, at, parent, matte, ji) in pending { let parent_id = parent.and_then(|p| by_ind.get(&p).copied()).filter(|p| *p != id); let matte_id = matte.and_then(|(k, tp)| { let target = match tp { @@ -520,21 +523,9 @@ fn build_layers(cx: &mut Ctx, project: &mut Project, comp: &mut Comp, layers: &[ }; target.filter(|t| *t != id).map(|t| TrackMatte { layer: t, kind: k }) }); - if let Some(l) = comp.layer_mut(id) { + if let Some(l) = comp.layers.get_mut(at) { l.parent = parent_id; l.track_matte = matte_id; } } } - -#[cfg(test)] -mod hex_color_tests { - use super::hex_color; - - #[test] - fn hex_color_rejects_plus_sign() { - assert_eq!(hex_color("#+f0000"), [0.0, 0.0, 0.0]); - assert_eq!(hex_color("#zz0000"), [0.0, 0.0, 0.0]); - assert_eq!(hex_color("#ff0000"), [1.0, 0.0, 0.0]); - } -} diff --git a/crates/lottie/src/lib.rs b/crates/lottie/src/lib.rs index 1b12cc8be..0a1f4bc96 100644 --- a/crates/lottie/src/lib.rs +++ b/crates/lottie/src/lib.rs @@ -1,7 +1,7 @@ //! Lottie JSON import and export. //! -//! Implemented from the public Lottie format description (the lottie-spec 1.0 schema and the -//! LottieFiles format documentation); no player or exporter source was used. +//! The format itself (the document model, property and keyframe encoding, paths, gradients, +//! embedded images) is `craft-lottie`; this crate maps it onto EffectCraft's project. //! //! **Export** ([`export_comp`]) turns a composition into a Lottie document: nested compositions //! become precomp assets, still footage becomes embedded base64 image assets, and shape, solid, @@ -21,7 +21,6 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] mod anim; -mod base64; mod export; mod import; mod shapes; diff --git a/crates/lottie/src/shapes.rs b/crates/lottie/src/shapes.rs index fab8d3646..f28e73a04 100644 --- a/crates/lottie/src/shapes.rs +++ b/crates/lottie/src/shapes.rs @@ -1,23 +1,27 @@ //! Shape layer contents ↔ Lottie shape items (`gr`, `rc`, `el`, `sr`, `sh`, `fl`, `st`, `gf`, -//! `gs`, `tm`, `rp`, `rd`, `op`, `pb`, `tw`, `zz`, `mm`, `tr`). +//! `gs`, `tm`, `rp`, `rd`, `op`, `pb`, `tw`, `zz`, `mm`, `tr`), on `craft-lottie`'s model. +use craft_lottie::model::{ + Dash, Ellipse, Fill, GradientColors, GradientFill, GradientStroke, Group, Map, Merge, OffsetPath, Path, PolyStar, PuckerBloat, Rect, Repeater, + RepeaterTransform, RoundCorners, Shape, ShapeKind, Stroke, Transform, Trim, Twist, ZigZag, +}; +use craft_lottie::{Animated, Bezier, Json}; use effectcraft_color::BlendMode; use effectcraft_keyframe::{Gradient, ShapePath, Value}; use effectcraft_project::build::{self, EXTRA_DASHES, Ids}; use effectcraft_project::{Node, ParamUi, PropGroup}; -use serde_json::{Map, Value as Json, json}; +use serde_json::json; use crate::anim::{self, Ex, Im, export_prop, import_prop}; // ---------------------------------------------------------------- shared value converters -pub(crate) fn shape_json(p: &ShapePath) -> Json { - let pts = |v: &[[f64; 2]]| v.iter().map(|q| json!([r(q[0]), r(q[1])])).collect::>(); - json!({"c": p.closed, "v": pts(&p.vertices), "i": pts(&p.in_tangents), "o": pts(&p.out_tangents)}) +pub(crate) fn bezier(p: &ShapePath) -> Bezier { + Bezier { closed: p.closed, vertices: p.vertices.clone(), in_tangents: p.in_tangents.clone(), out_tangents: p.out_tangents.clone() } } -fn r(v: f64) -> f64 { - (v * 1e6).round() / 1e6 +pub(crate) fn shape_json(p: &ShapePath) -> Json { + bezier(p).to_json() } pub(crate) fn path_value(v: &Value) -> Json { @@ -30,29 +34,8 @@ pub(crate) fn path_value(v: &Value) -> Json { /// A Lottie path. `closed` is used when the path has no `c`: Bodymovin 3.x and early 4.x keep the /// flag outside the path, as `cl` on a mask and `closed` on an `sh` item. pub(crate) fn to_path(j: &Json, closed: bool) -> Option { - let o = match j { - Json::Array(a) => a.first()?, - o => o, - }; - let pts = |k: &str| -> Vec<[f64; 2]> { - o.get(k) - .and_then(Json::as_array) - .map(|a| a.iter().map(|p| anim::nums(p).map(|v| [*v.first().unwrap_or(&0.0), *v.get(1).unwrap_or(&0.0)]).unwrap_or([0.0; 2])).collect()) - .unwrap_or_default() - }; - let vertices = pts("v"); - let n = vertices.len(); - let fit = |mut v: Vec<[f64; 2]>| { - v.resize(n, [0.0; 2]); - v - }; - Some(Value::Path(ShapePath { - in_tangents: fit(pts("i")), - out_tangents: fit(pts("o")), - vertices, - closed: o.get("c").and_then(Json::as_bool).unwrap_or(closed), - feather: Vec::new(), - })) + let b = Bezier::from_json(j, closed)?; + Some(Value::Path(ShapePath { vertices: b.vertices, in_tangents: b.in_tangents, out_tangents: b.out_tangents, closed: b.closed, feather: Vec::new() })) } /// Gradient as Lottie's flat stop list: `[pos, r, g, b]…` then `[pos, alpha]…`. @@ -61,29 +44,19 @@ pub(crate) fn gradient_flat(v: &Value) -> Json { Value::Gradient(g) => g.clone(), _ => Gradient::default(), }; - let mut out = vec![]; - for (p, c) in &g.colors { - out.extend([r(*p), r(c[0] as f64), r(c[1] as f64), r(c[2] as f64)]); + craft_lottie::Gradient { + colors: g.colors.iter().map(|(p, c)| (*p, [f64::from(c[0]), f64::from(c[1]), f64::from(c[2])])).collect(), + opacities: g.opacities.iter().map(|(p, a)| (*p, f64::from(*a))).collect(), } - let plain = g.opacities.iter().all(|(_, a)| (*a - 1.0).abs() < 1e-6); - if !plain { - for (p, a) in &g.opacities { - out.extend([r(*p), r(*a as f64)]); - } - } - json!(out) + .to_flat() } pub(crate) fn to_gradient(j: &Json, ncolors: usize) -> Option { - let v = anim::nums(j)?; - let n = ncolors.min(v.len() / 4); - let colors: Vec<(f64, [f32; 4])> = (0..n).map(|i| (v[i * 4], [v[i * 4 + 1] as f32, v[i * 4 + 2] as f32, v[i * 4 + 3] as f32, 1.0])).collect(); - let rest = &v[n * 4..]; - let mut opacities: Vec<(f64, f32)> = rest.chunks(2).filter(|c| c.len() == 2).map(|c| (c[0], c[1] as f32)).collect(); - if opacities.is_empty() { - opacities = vec![(0.0, 1.0), (1.0, 1.0)]; - } - Some(Value::Gradient(Gradient { colors, opacities })) + let g = craft_lottie::Gradient::from_flat(j, ncolors)?; + Some(Value::Gradient(Gradient { + colors: g.colors.iter().map(|(p, [r, gr, b])| (*p, [*r as f32, *gr as f32, *b as f32, 1.0])).collect(), + opacities: g.opacities.iter().map(|(p, a)| (*p, *a as f32)).collect(), + })) } fn blend_index(m: BlendMode) -> u32 { @@ -92,22 +65,18 @@ fn blend_index(m: BlendMode) -> u32 { // ---------------------------------------------------------------- export +/// A group's properties, exported with the warnings they need. struct Out<'a, 'b> { ex: &'a mut Ex, g: &'b PropGroup, - o: Map, label: String, } impl Out<'_, '_> { - fn put(&mut self, key: &str, m: &str, conv: &dyn Fn(&Value) -> Json) { - if let Some(p) = self.g.get(m) { - let v = export_prop(self.ex, p, conv, &format!("{} ▸ {}", self.label, p.name)); - self.o.insert(key.into(), v); - } - } - fn raw(&mut self, key: &str, v: Json) { - self.o.insert(key.into(), v); + /// The property `m` of the group, when it has one. + fn put(&mut self, m: &str, conv: &dyn Fn(&Value) -> Json) -> Option { + let p = self.g.get(m)?; + Some(export_prop(self.ex, p, conv, &format!("{} ▸ {}", self.label, p.name))) } fn e(&self, m: &str) -> u32 { self.g.get(m).map(|p| p.value.as_enum()).unwrap_or(0) @@ -121,34 +90,46 @@ impl Out<'_, '_> { fn animated(&self, m: &str) -> bool { self.g.get(m).is_some_and(|p| p.is_animated() || p.has_expression()) } - fn blend(&mut self) { + fn blend(&mut self) -> i64 { let i = self.e("blend"); let m = BlendMode::ALL.get(i as usize).copied().unwrap_or_default(); match crate::blend_to_lottie(m) { - Some(bm) => self.raw("bm", json!(bm)), + Some(bm) => i64::from(bm), None => { self.ex.warn(format!("{}: blend mode {m:?} has no Lottie equivalent (Normal used)", self.label)); - self.raw("bm", json!(0)); + 0 } } } - fn done(self) -> Json { - Json::Object(self.o) + fn direction(&self) -> i64 { + if self.e("direction") == 1 { 3 } else { 1 } } } -/// Stroke fields shared by `st` and `gs`. -fn stroke_fields(o: &mut Out) { - o.put("w", "width", &anim::num); - o.raw("lc", json!(o.e("cap") + 1)); - o.raw("lj", json!(o.e("join") + 1)); - o.raw("ml", json!(o.f("miter"))); +/// A static property (`{a: 0, k}`). +pub(crate) fn fixed(k: Json) -> Animated { + Animated(json!({"a": 0, "k": k})) +} + +/// Stroke fields shared by `st` and `gs`: width, cap, join, miter limit, dashes. +struct StrokeOut { + width: Option, + cap: i64, + join: i64, + miter: f64, + dashes: Option>, +} + +fn stroke_fields(o: &mut Out) -> StrokeOut { + let width = o.put("width", &anim::num); + let (cap, join, miter) = (i64::from(o.e("cap")) + 1, i64::from(o.e("join")) + 1, o.f("miter")); let used = |g: Option<&PropGroup>, m: &str| g.and_then(|g| g.get(m)).is_some_and(|p| p.is_animated() || p.value.as_f64().abs() > 1e-9); let (taper, wave) = (o.g.sub("taper"), o.g.sub("wave")); if used(taper, "startLength") || used(taper, "endLength") || used(wave, "amount") { let msg = format!("{}: stroke Taper and Wave have no Lottie equivalent (uniform width exported)", o.label); o.ex.warn(msg); } + let mut dashes = None; if let Some(d) = o.g.sub("dashes") { let dash = d.get("dash").map(|p| p.value.as_f64()).unwrap_or(0.0); if dash > 0.0 || d.any_animated() { @@ -156,202 +137,257 @@ fn stroke_fields(o: &mut Out) { for (n, m) in [("d", "dash"), ("g", "gap"), ("d", "dash2"), ("g", "gap2"), ("d", "dash3"), ("g", "gap3"), ("o", "offset")] { if let Some(p) = d.get(m) { let v = export_prop(o.ex, p, &anim::num, &format!("{} ▸ Dashes ▸ {}", o.label, p.name)); - list.push(json!({"n": n, "nm": p.name, "v": v})); + list.push(Dash { kind: Some(n.into()), name: Some(p.name.clone()), length: Some(v), ..Default::default() }); } } - o.raw("d", json!(list)); + dashes = Some(list); } } + StrokeOut { width, cap, join, miter, dashes } } -fn shape_transform(ex: &mut Ex, tr: &PropGroup, label: &str) -> Json { - let mut o = Out { ex, g: tr, o: Map::new(), label: format!("{label} ▸ Transform") }; - o.raw("ty", json!("tr")); - o.put("a", "anchor", &anim::arr2); - o.put("p", "position", &anim::arr2); - o.put("s", "scale", &anim::arr2); - o.put("r", "rotation", &anim::num); - o.put("o", "opacity", &anim::num); - o.put("sk", "skew", &anim::num); - o.put("sa", "skewAxis", &anim::num); - o.put("so", "startOpacity", &anim::num); - o.put("eo", "endOpacity", &anim::num); - o.done() +/// The `tr` of a group or a repeater: anchor, position, scale, rotation, opacity, skew, and the +/// repeater's start and end opacity, by their Lottie keys. +fn shape_transform(ex: &mut Ex, tr: &PropGroup, label: &str) -> Vec<(&'static str, Animated)> { + let mut o = Out { ex, g: tr, label: format!("{label} ▸ Transform") }; + let mut out = vec![]; + for (k, m, conv) in [ + ("a", "anchor", anim::arr2 as fn(&Value) -> Json), + ("p", "position", anim::arr2), + ("s", "scale", anim::arr2), + ("r", "rotation", anim::num), + ("o", "opacity", anim::num), + ("sk", "skew", anim::num), + ("sa", "skewAxis", anim::num), + ("so", "startOpacity", anim::num), + ("eo", "endOpacity", anim::num), + ] { + if let Some(v) = o.put(m, &conv) { + out.push((k, v)); + } + } + out +} + +/// The `tr` item that ends a group's items. +fn group_transform(keys: Vec<(&'static str, Animated)>) -> Shape { + let (mut t, mut extra) = (Transform::default(), Map::new()); + for (k, v) in keys { + match k { + "a" => t.anchor = Some(v), + "p" => t.position = Some(v), + "s" => t.scale = Some(v), + "r" => t.rotation = Some(v), + "o" => t.opacity = Some(v), + "sk" => t.skew = Some(v), + "sa" => t.skew_axis = Some(v), + _ => { + extra.insert(k.into(), v.0); + } + } + } + Shape { kind: ShapeKind::Transform(Box::new(t)), extra, ..Default::default() } +} + +/// A repeater's `tr`, which players read with `ty: "tr"` like a group's. +fn repeater_transform(keys: Vec<(&'static str, Animated)>) -> RepeaterTransform { + let mut t = RepeaterTransform::default(); + t.extra.insert("ty".into(), json!("tr")); + for (k, v) in keys { + match k { + "a" => t.anchor = Some(v), + "p" => t.position = Some(v), + "s" => t.scale = Some(v), + "r" => t.rotation = Some(v), + "so" => t.start_opacity = Some(v), + "eo" => t.end_opacity = Some(v), + "sk" => t.skew = Some(v), + "sa" => t.skew_axis = Some(v), + _ => { + t.extra.insert(k.into(), v.0); + } + } + } + t } /// Export a contents group's items (first item = top, as in the timeline). -pub(crate) fn export_items(ex: &mut Ex, contents: &PropGroup, label: &str) -> Vec { +pub(crate) fn export_items(ex: &mut Ex, contents: &PropGroup, label: &str) -> Vec { let mut out = vec![]; for node in &contents.children { let Node::Group(g) = node else { continue }; let lbl = format!("{label} ▸ {}", g.name); - let ty = match g.match_id.as_str() { - "group" => "gr", - "rect" => "rc", - "ellipse" => "el", - "star" => "sr", - "path" => "sh", - "fill" => "fl", - "stroke" => "st", - "gfill" => "gf", - "gstroke" => "gs", - "trim" => "tm", - "repeater" => "rp", - "round" => "rd", - "offset" => "op", - "pucker" => "pb", - "twist" => "tw", - "zigzag" => "zz", - "merge" => "mm", - other => { - ex.warn(format!("{lbl}: shape item `{other}` has no Lottie equivalent (skipped)")); - continue; + let mut o = Out { ex, g, label: lbl.clone() }; + let mut blend = None; + let kind = match g.match_id.as_str() { + "group" => { + let mut items = g.sub("contents").map(|c| export_items(o.ex, c, &lbl)).unwrap_or_default(); + items.push(match g.sub("transform") { + Some(t) => group_transform(shape_transform(o.ex, t, &lbl)), + None => group_transform(vec![ + ("a", fixed(json!([0, 0]))), + ("p", fixed(json!([0, 0]))), + ("s", fixed(json!([100, 100]))), + ("r", fixed(json!(0))), + ("o", fixed(json!(100))), + ]), + }); + blend = Some(o.blend()); + ShapeKind::Group(Group { count: Some(items.len() as f64), items: Some(items) }) } - }; - let mut o = Out { ex, g, o: Map::new(), label: lbl.clone() }; - o.raw("ty", json!(ty)); - o.raw("nm", json!(g.name)); - if !g.enabled { - o.raw("hd", json!(true)); - } - let dir = |o: &mut Out| { - let d = if o.e("direction") == 1 { 3 } else { 1 }; - o.raw("d", json!(d)); - }; - match ty { - "gr" => { - let items = g.sub("contents").map(|c| export_items(o.ex, c, &lbl)).unwrap_or_default(); - let mut items = items; - let tr = match g.sub("transform") { - Some(t) => shape_transform(o.ex, t, &lbl), - None => { - json!({"ty": "tr", "a": {"a": 0, "k": [0, 0]}, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]}, "r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}) - } - }; - items.push(tr); - o.raw("np", json!(items.len())); - o.raw("it", json!(items)); - o.blend(); - } - "rc" => { - dir(&mut o); - o.put("s", "size", &anim::arr2); - o.put("p", "position", &anim::arr2); - if o.flag("perCorner") { + "rect" => { + let direction = Some(o.direction()); + let size = o.put("size", &anim::arr2); + let position = o.put("position", &anim::arr2); + let roundness = if o.flag("perCorner") { let names = ["topLeftRoundness", "topRightRoundness", "bottomRightRoundness", "bottomLeftRoundness"]; let radii = names.map(|m| o.f(m)); // Lottie `rc` has one `r`: four equal static radii export as that value. // `r` is a property (`{a, k}`) like the uniform branch writes, not a bare number. if radii.iter().all(|v| (v - radii[0]).abs() < 1e-6) && !names.iter().any(|m| o.animated(m)) && radii[0] >= 0.0 { - o.raw("r", json!({"a": 0, "k": r(radii[0])})); + Some(fixed(json!(craft_lottie::round6(radii[0])))) } else { o.ex.warn(format!("{}: per-corner roundness has no Lottie rectangle equivalent (roundness 0 exported)", o.label)); - o.raw("r", json!({"a": 0, "k": 0})); + Some(fixed(json!(0))) } } else { - o.put("r", "roundness", &anim::num); - } + o.put("roundness", &anim::num) + }; + ShapeKind::Rect(Rect { direction, position, size, roundness }) } - "el" => { - dir(&mut o); - o.put("s", "size", &anim::arr2); - o.put("p", "position", &anim::arr2); + "ellipse" => { + let direction = Some(o.direction()); + let size = o.put("size", &anim::arr2); + ShapeKind::Ellipse(Ellipse { direction, position: o.put("position", &anim::arr2), size }) } - "sr" => { - dir(&mut o); - o.raw("sy", json!(o.e("type") + 1)); - o.put("pt", "points", &anim::num); - o.put("p", "position", &anim::arr2); - o.put("r", "rotation", &anim::num); - o.put("ir", "innerRadius", &anim::num); - o.put("or", "outerRadius", &anim::num); - o.put("is", "innerRoundness", &anim::num); - o.put("os", "outerRoundness", &anim::num); + "star" => ShapeKind::PolyStar(PolyStar { + direction: Some(o.direction()), + star_type: Some(i64::from(o.e("type")) + 1), + points: o.put("points", &anim::num), + position: o.put("position", &anim::arr2), + rotation: o.put("rotation", &anim::num), + inner_radius: o.put("innerRadius", &anim::num), + outer_radius: o.put("outerRadius", &anim::num), + inner_roundness: o.put("innerRoundness", &anim::num), + outer_roundness: o.put("outerRoundness", &anim::num), + }), + "path" => ShapeKind::Path(Path { direction: Some(o.direction()), path: o.put("path", &path_value), closed: None }), + "fill" => { + let f = Fill { color: o.put("color", &anim::arr), opacity: o.put("opacity", &anim::num), rule: Some(i64::from(o.e("rule")) + 1) }; + blend = Some(o.blend()); + ShapeKind::Fill(f) } - "sh" => { - dir(&mut o); - o.put("ks", "path", &path_value); + "stroke" => { + let (color, opacity) = (o.put("color", &anim::arr), o.put("opacity", &anim::num)); + let st = stroke_fields(&mut o); + blend = Some(o.blend()); + ShapeKind::Stroke(Stroke { + color, + opacity, + width: st.width, + cap: Some(st.cap), + join: Some(st.join), + miter_limit: Some(st.miter), + miter_limit_animated: None, + dashes: st.dashes, + }) } - "fl" => { - o.put("c", "color", &anim::arr); - o.put("o", "opacity", &anim::num); - o.raw("r", json!(o.e("rule") + 1)); - o.blend(); - } - "st" => { - o.put("c", "color", &anim::arr); - o.put("o", "opacity", &anim::num); - stroke_fields(&mut o); - o.blend(); - } - "gf" | "gs" => { - o.put("o", "opacity", &anim::num); - o.put("s", "start", &anim::arr2); - o.put("e", "end", &anim::arr2); - o.raw("t", json!(o.e("type") + 1)); - o.put("h", "highlightLength", &anim::num); - o.put("a", "highlightAngle", &anim::num); + m @ ("gfill" | "gstroke") => { + let opacity = o.put("opacity", &anim::num); + let (start, end) = (o.put("start", &anim::arr2), o.put("end", &anim::arr2)); + let gradient_type = Some(i64::from(o.e("type")) + 1); + let (highlight_length, highlight_angle) = (o.put("highlightLength", &anim::num), o.put("highlightAngle", &anim::num)); let ncolors = match g.get("colors").map(|p| &p.value) { Some(Value::Gradient(gr)) => gr.colors.len(), _ => 2, }; - if let Some(p) = g.get("colors") { - let k = export_prop(o.ex, p, &gradient_flat, &format!("{lbl} ▸ Colors")); - o.raw("g", json!({"p": ncolors, "k": k})); - } - if ty == "gf" { - o.raw("r", json!(o.e("rule") + 1)); + let colors = g.get("colors").map(|p| GradientColors { + count: Some(ncolors as i64), + stops: Some(export_prop(o.ex, p, &gradient_flat, &format!("{lbl} ▸ Colors"))), + ..Default::default() + }); + let kind = if m == "gfill" { + ShapeKind::GradientFill(GradientFill { + colors, + start, + end, + gradient_type, + highlight_length, + highlight_angle, + opacity, + rule: Some(i64::from(o.e("rule")) + 1), + }) } else { - stroke_fields(&mut o); - } - o.blend(); + let st = stroke_fields(&mut o); + ShapeKind::GradientStroke(GradientStroke { + colors, + start, + end, + gradient_type, + highlight_length, + highlight_angle, + opacity, + width: st.width, + cap: Some(st.cap), + join: Some(st.join), + miter_limit: Some(st.miter), + miter_limit_animated: None, + dashes: st.dashes, + }) + }; + blend = Some(o.blend()); + kind } - "tm" => { - o.put("s", "start", &anim::num); - o.put("e", "end", &anim::num); - o.put("o", "offset", &anim::num); - o.raw("m", json!(o.e("mode") + 1)); - } - "rp" => { - o.put("c", "copies", &anim::num); - o.put("o", "offset", &anim::num); + "trim" => ShapeKind::Trim(Trim { + start: o.put("start", &anim::num), + end: o.put("end", &anim::num), + offset: o.put("offset", &anim::num), + multiple: Some(i64::from(o.e("mode")) + 1), + }), + "repeater" => { + let (copies, offset) = (o.put("copies", &anim::num), o.put("offset", &anim::num)); // Lottie: 1 = Above, 2 = Below; EffectCraft: 0 = Below, 1 = Above. - o.raw("m", json!(if o.e("composite") == 1 { 1 } else { 2 })); - if let Some(t) = g.sub("transform") { - let tr = shape_transform(o.ex, t, &lbl); - o.raw("tr", tr); - } + let composite = Some(if o.e("composite") == 1 { 1 } else { 2 }); + let transform = g.sub("transform").map(|t| repeater_transform(shape_transform(o.ex, t, &lbl))); + ShapeKind::Repeater(Repeater { copies, offset, composite, transform }) } - "rd" => o.put("r", "radius", &anim::num), - "op" => { - o.put("a", "amount", &anim::num); - o.raw("lj", json!(o.e("join") + 1)); - o.put("ml", "miter", &anim::num); + "round" => ShapeKind::RoundCorners(RoundCorners { radius: o.put("radius", &anim::num) }), + "offset" => { + let amount = o.put("amount", &anim::num); + let join = Some(i64::from(o.e("join")) + 1); + let miter_limit = o.put("miter", &anim::num); if (o.f("copies") - 1.0).abs() > 1e-9 || o.animated("copies") || o.f("copyOffset") != 0.0 { o.ex.warn(format!("{lbl}: Offset Paths copies are not part of Lottie (one copy exported)")); } + ShapeKind::OffsetPath(OffsetPath { amount, join, miter_limit }) } - "pb" => o.put("a", "amount", &anim::num), - "tw" => { - o.put("a", "angle", &anim::num); - o.put("c", "center", &anim::arr2); + "pucker" => ShapeKind::PuckerBloat(PuckerBloat { amount: o.put("amount", &anim::num) }), + "twist" => ShapeKind::Twist(Twist { angle: o.put("angle", &anim::num), center: o.put("center", &anim::arr2) }), + "zigzag" => ShapeKind::ZigZag(ZigZag { + frequency: o.put("size", &anim::num), + amount: o.put("ridges", &anim::num), + point_type: Some(fixed(json!(o.e("points") + 1))), + }), + "merge" => ShapeKind::Merge(Merge { mode: Some(i64::from(o.e("mode")) + 1) }), + other => { + o.ex.warn(format!("{lbl}: shape item `{other}` has no Lottie equivalent (skipped)")); + continue; } - "zz" => { - o.put("s", "size", &anim::num); - o.put("r", "ridges", &anim::num); - o.raw("pt", json!({"a": 0, "k": o.e("points") + 1})); - } - "mm" => o.raw("mm", json!(o.e("mode") + 1)), - _ => {} - } - out.push(o.done()); + }; + out.push(Shape { name: Some(g.name.clone()), hidden: (!g.enabled).then_some(true), blend_mode: blend, kind, ..Default::default() }); } out } // ---------------------------------------------------------------- import -fn set(im: &Im, g: &mut PropGroup, m: &str, j: Option<&Json>, conv: &dyn Fn(&Json) -> Option) { +fn set(im: &Im, g: &mut PropGroup, m: &str, j: Option<&Animated>, conv: &dyn Fn(&Json) -> Option) { + if let (Some(j), Some(p)) = (j, g.get_mut(m)) { + import_prop(im, &j.0, p, conv); + } +} + +fn set_json(im: &Im, g: &mut PropGroup, m: &str, j: Option<&Json>, conv: &dyn Fn(&Json) -> Option) { if let (Some(j), Some(p)) = (j, g.get_mut(m)) { import_prop(im, j, p, conv); } @@ -363,43 +399,60 @@ fn set_enum(g: &mut PropGroup, m: &str, v: u32) { } } -fn int(j: &Json, k: &str) -> Option { - let v = j.get(k)?; +/// A whole number however a file writes it: `2`, `2.0`, `2.4` (rounded) or a property `{k: 2}`. +fn int_json(v: Option<&Json>) -> Option { + let v = v?; v.as_i64().or_else(|| v.as_f64().map(|f| f.round() as i64)).or_else(|| v.get("k").and_then(anim::nums).and_then(|n| n.first().map(|f| f.round() as i64))) } -fn import_blend(j: &Json, g: &mut PropGroup) { - if let Some(bm) = j.get("bm").and_then(Json::as_u64) { +/// An integer key of the model, or the value the model kept in `extra` when it was written +/// another way. +fn int(field: Option, extra: &Map, key: &str) -> Option { + field.or_else(|| int_json(extra.get(key))) +} + +fn import_blend(s: &Shape, g: &mut PropGroup) { + if let Some(bm) = int(s.blend_mode, &s.extra, "bm").and_then(|b| u64::try_from(b).ok()) { set_enum(g, "blend", blend_index(crate::blend_from_lottie(bm))); } } -fn import_stroke(im: &Im, ids: &mut Ids, j: &Json, g: &mut PropGroup) { - set(im, g, "width", j.get("w"), &anim::to_scalar); - if let Some(lc) = int(j, "lc") { +/// The stroke keys of `st` and `gs`. +struct StrokeIn<'a> { + width: Option<&'a Animated>, + cap: Option, + join: Option, + miter: Option, + miter_animated: Option<&'a Animated>, + dashes: Option<&'a [Dash]>, +} + +fn import_stroke(im: &Im, ids: &mut Ids, st: StrokeIn<'_>, g: &mut PropGroup) { + set(im, g, "width", st.width, &anim::to_scalar); + if let Some(lc) = st.cap { set_enum(g, "cap", lc.saturating_sub(1).clamp(0, 2) as u32); } - if let Some(lj) = int(j, "lj") { + if let Some(lj) = st.join { set_enum(g, "join", lj.saturating_sub(1).clamp(0, 2) as u32); } if let Some(p) = g.get_mut("miter") { - if let Some(ml) = j.get("ml").and_then(Json::as_f64) { + if let Some(ml) = st.miter { p.value = Value::Scalar(ml); - } else if let Some(ml2) = j.get("ml2") { - import_prop(im, ml2, p, &anim::to_scalar); + } else if let Some(ml2) = st.miter_animated { + import_prop(im, &ml2.0, p, &anim::to_scalar); } } - if let Some(list) = j.get("d").and_then(Json::as_array) + if let Some(list) = st.dashes && let Some(d) = g.sub_mut("dashes") { // The n-th `d` and `g` are the n-th Dash/Gap pair; the extra pairs are created as the Dashes "+" does. let (mut dashes, mut gaps) = (0, 0); for e in list { - let (n, pair) = match e.get("n").and_then(Json::as_str) { + let (n, pair) = match e.kind.as_deref() { Some("d") => (&mut dashes, 0), Some("g") => (&mut gaps, 1), Some("o") => { - set(im, d, "offset", e.get("v"), &anim::to_scalar); + set(im, d, "offset", e.length.as_ref(), &anim::to_scalar); continue; } _ => continue, @@ -418,205 +471,299 @@ fn import_stroke(im: &Im, ids: &mut Ids, j: &Json, g: &mut PropGroup) { [dm, gm][pair] } }; - set(im, d, m, e.get("v"), &anim::to_scalar); + set(im, d, m, e.length.as_ref(), &anim::to_scalar); } } } -fn import_shape_transform(im: &Im, j: &Json, tr: &mut PropGroup) { - set(im, tr, "anchor", j.get("a"), &anim::to_vec2); - set(im, tr, "position", j.get("p"), &anim::to_vec2); - set(im, tr, "scale", j.get("s"), &anim::to_vec2); - set(im, tr, "rotation", j.get("r"), &anim::to_scalar); - set(im, tr, "opacity", j.get("o"), &anim::to_scalar); - set(im, tr, "skew", j.get("sk"), &anim::to_scalar); - set(im, tr, "skewAxis", j.get("sa"), &anim::to_scalar); - set(im, tr, "startOpacity", j.get("so"), &anim::to_scalar); - set(im, tr, "endOpacity", j.get("eo"), &anim::to_scalar); +/// A `tr` (of a group or a repeater), looked up by its Lottie keys. +fn import_shape_transform(im: &Im, get: &dyn Fn(&str) -> Option, tr: &mut PropGroup) { + for (k, m, conv) in [ + ("a", "anchor", anim::to_vec2 as fn(&Json) -> Option), + ("p", "position", anim::to_vec2), + ("s", "scale", anim::to_vec2), + ("r", "rotation", anim::to_scalar), + ("o", "opacity", anim::to_scalar), + ("sk", "skew", anim::to_scalar), + ("sa", "skewAxis", anim::to_scalar), + ("so", "startOpacity", anim::to_scalar), + ("eo", "endOpacity", anim::to_scalar), + ] { + set_json(im, tr, m, get(k).as_ref(), &conv); + } +} + +/// A named key of the model, or the same key kept in `extra`. +fn key(a: Option<&Animated>, extra: &Map, k: &str) -> Option { + a.map(|a| a.0.clone()).or_else(|| extra.get(k).cloned()) +} + +fn group_tr_get<'a>(t: &'a Transform, item: &'a Map) -> impl Fn(&str) -> Option + 'a { + move |k| { + let named = match k { + "a" => t.anchor.as_ref(), + "p" => t.position.as_ref(), + "s" => t.scale.as_ref(), + "r" => t.rotation.as_ref(), + "o" => t.opacity.as_ref(), + "sk" => t.skew.as_ref(), + "sa" => t.skew_axis.as_ref(), + _ => None, + }; + key(named, &t.extra, k).or_else(|| item.get(k).cloned()) + } +} + +fn repeater_tr_get(t: &RepeaterTransform) -> impl Fn(&str) -> Option + '_ { + move |k| { + let named = match k { + "a" => t.anchor.as_ref(), + "p" => t.position.as_ref(), + "s" => t.scale.as_ref(), + "r" => t.rotation.as_ref(), + "so" => t.start_opacity.as_ref(), + "eo" => t.end_opacity.as_ref(), + "sk" => t.skew.as_ref(), + "sa" => t.skew_axis.as_ref(), + _ => None, + }; + key(named, &t.extra, k) + } } /// Import Lottie shape items into shape contents groups. -pub(crate) fn import_items(im: &mut Im, ids: &mut Ids, items: &[Json]) -> Vec { +pub(crate) fn import_items(im: &mut Im, ids: &mut Ids, items: &mut dyn Iterator) -> Vec { let mut out = vec![]; - for j in items { - let ty = j.get("ty").and_then(Json::as_str).unwrap_or(""); - let dir = |g: &mut PropGroup| { - if int(j, "d") == Some(3) { + for s in items { + let x = &s.extra; + let dir = |g: &mut PropGroup, d: Option| { + if int(d, x, "d") == Some(3) { set_enum(g, "direction", 1); } }; - let mut g = match ty { - "gr" => { - let list = j.get("it").and_then(Json::as_array).cloned().unwrap_or_default(); - let inner: Vec = list.iter().filter(|i| i.get("ty").and_then(Json::as_str) != Some("tr")).cloned().collect(); - let children = import_items(im, ids, &inner); + let mut g = match &s.kind { + ShapeKind::Group(gr) => { + let list = gr.items.as_deref().unwrap_or_default(); + // Borrowed, not cloned: each nesting level copying its subtree costs memory + // quadratic in the depth. + let children = import_items(im, ids, &mut list.iter().filter(|i| !matches!(i.kind, ShapeKind::Transform(_)))); let mut g = build::shape_group(ids, "Group 1", children); - if let Some(tr) = list.iter().find(|i| i.get("ty").and_then(Json::as_str) == Some("tr")) - && let Some(t) = g.sub_mut("transform") + if let Some(tr) = list.iter().find(|i| matches!(i.kind, ShapeKind::Transform(_))) + && let ShapeKind::Transform(t) = &tr.kind + && let Some(tg) = g.sub_mut("transform") { - import_shape_transform(im, tr, t); + import_shape_transform(im, &group_tr_get(t, &tr.extra), tg); } - import_blend(j, &mut g); + import_blend(s, &mut g); g } - "rc" => { + ShapeKind::Rect(r) => { let mut g = build::shape_rect(ids, [100.0, 100.0], [0.0, 0.0], 0.0); - dir(&mut g); - set(im, &mut g, "size", j.get("s"), &anim::to_vec2); - set(im, &mut g, "position", j.get("p"), &anim::to_vec2); - set(im, &mut g, "roundness", j.get("r"), &anim::to_scalar); + dir(&mut g, r.direction); + set(im, &mut g, "size", r.size.as_ref(), &anim::to_vec2); + set(im, &mut g, "position", r.position.as_ref(), &anim::to_vec2); + set(im, &mut g, "roundness", r.roundness.as_ref(), &anim::to_scalar); // Lottie has one roundness: keep the per-corner values in step so ticking the box // on an imported rectangle keeps the shape. for m in ["topLeftRoundness", "topRightRoundness", "bottomRightRoundness", "bottomLeftRoundness"] { - set(im, &mut g, m, j.get("r"), &anim::to_scalar); + set(im, &mut g, m, r.roundness.as_ref(), &anim::to_scalar); } g } - "el" => { + ShapeKind::Ellipse(e) => { let mut g = build::shape_ellipse(ids, [100.0, 100.0], [0.0, 0.0]); - dir(&mut g); - set(im, &mut g, "size", j.get("s"), &anim::to_vec2); - set(im, &mut g, "position", j.get("p"), &anim::to_vec2); + dir(&mut g, e.direction); + set(im, &mut g, "size", e.size.as_ref(), &anim::to_vec2); + set(im, &mut g, "position", e.position.as_ref(), &anim::to_vec2); g } - "sr" => { - let star = int(j, "sy").unwrap_or(1) != 2; + ShapeKind::PolyStar(p) => { + let star = int(p.star_type, x, "sy").unwrap_or(1) != 2; let mut g = build::shape_star(ids, star, 5.0, [0.0, 0.0], 100.0, 50.0); - dir(&mut g); - set(im, &mut g, "points", j.get("pt"), &anim::to_scalar); - set(im, &mut g, "position", j.get("p"), &anim::to_vec2); - set(im, &mut g, "rotation", j.get("r"), &anim::to_scalar); - set(im, &mut g, "innerRadius", j.get("ir"), &anim::to_scalar); - set(im, &mut g, "outerRadius", j.get("or"), &anim::to_scalar); - set(im, &mut g, "innerRoundness", j.get("is"), &anim::to_scalar); - set(im, &mut g, "outerRoundness", j.get("os"), &anim::to_scalar); + dir(&mut g, p.direction); + set(im, &mut g, "points", p.points.as_ref(), &anim::to_scalar); + set(im, &mut g, "position", p.position.as_ref(), &anim::to_vec2); + set(im, &mut g, "rotation", p.rotation.as_ref(), &anim::to_scalar); + set(im, &mut g, "innerRadius", p.inner_radius.as_ref(), &anim::to_scalar); + set(im, &mut g, "outerRadius", p.outer_radius.as_ref(), &anim::to_scalar); + set(im, &mut g, "innerRoundness", p.inner_roundness.as_ref(), &anim::to_scalar); + set(im, &mut g, "outerRoundness", p.outer_roundness.as_ref(), &anim::to_scalar); g } - "sh" => { + ShapeKind::Path(p) => { let mut g = build::shape_path(ids, ShapePath::default()); - dir(&mut g); - let closed = j.get("closed").and_then(Json::as_bool).unwrap_or(false); - set(im, &mut g, "path", j.get("ks"), &|v| to_path(v, closed)); + dir(&mut g, p.direction); + let closed = p.closed.unwrap_or(false); + set(im, &mut g, "path", p.path.as_ref(), &|v| to_path(v, closed)); g } - "fl" => { + ShapeKind::Fill(f) => { let mut g = build::shape_fill(ids, [1.0, 1.0, 1.0, 1.0]); - set(im, &mut g, "color", j.get("c"), &anim::to_color); - set(im, &mut g, "opacity", j.get("o"), &anim::to_scalar); - if int(j, "r") == Some(2) { + set(im, &mut g, "color", f.color.as_ref(), &anim::to_color); + set(im, &mut g, "opacity", f.opacity.as_ref(), &anim::to_scalar); + if int(f.rule, x, "r") == Some(2) { set_enum(&mut g, "rule", 1); } - import_blend(j, &mut g); + import_blend(s, &mut g); g } - "st" => { + ShapeKind::Stroke(st) => { let mut g = build::shape_stroke(ids, [1.0, 1.0, 1.0, 1.0], 2.0); - set(im, &mut g, "color", j.get("c"), &anim::to_color); - set(im, &mut g, "opacity", j.get("o"), &anim::to_scalar); - import_stroke(im, ids, j, &mut g); - import_blend(j, &mut g); - g - } - "gf" | "gs" => { - let radial = int(j, "t") == Some(2); - let mut g = if ty == "gf" { - build::shape_gradient_fill(ids, radial, [0.0, 0.0], [100.0, 0.0], Gradient::default()) - } else { - build::shape_gradient_stroke(ids, radial, [0.0, 0.0], [100.0, 0.0], Gradient::default(), 2.0) + set(im, &mut g, "color", st.color.as_ref(), &anim::to_color); + set(im, &mut g, "opacity", st.opacity.as_ref(), &anim::to_scalar); + let fields = StrokeIn { + width: st.width.as_ref(), + cap: int(st.cap, x, "lc"), + join: int(st.join, x, "lj"), + miter: st.miter_limit, + miter_animated: st.miter_limit_animated.as_ref(), + dashes: st.dashes.as_deref(), }; - set(im, &mut g, "opacity", j.get("o"), &anim::to_scalar); - set(im, &mut g, "start", j.get("s"), &anim::to_vec2); - set(im, &mut g, "end", j.get("e"), &anim::to_vec2); - set(im, &mut g, "highlightLength", j.get("h"), &anim::to_scalar); - set(im, &mut g, "highlightAngle", j.get("a"), &anim::to_scalar); - if let Some(gj) = j.get("g") { - let n = gj.get("p").and_then(Json::as_u64).unwrap_or(2) as usize; - if let Some(k) = gj.get("k") { - set(im, &mut g, "colors", Some(k), &move |v| to_gradient(v, n)); - } - } - if ty == "gf" { - if int(j, "r") == Some(2) { - set_enum(&mut g, "rule", 1); - } - } else { - import_stroke(im, ids, j, &mut g); - } - import_blend(j, &mut g); + import_stroke(im, ids, fields, &mut g); + import_blend(s, &mut g); g } - "tm" => { + ShapeKind::GradientFill(gf) => { + let radial = int(gf.gradient_type, x, "t") == Some(2); + let mut g = build::shape_gradient_fill(ids, radial, [0.0, 0.0], [100.0, 0.0], Gradient::default()); + gradient_common( + im, + &mut g, + gf.opacity.as_ref(), + gf.start.as_ref(), + gf.end.as_ref(), + gf.highlight_length.as_ref(), + gf.highlight_angle.as_ref(), + gf.colors.as_ref(), + ); + if int(gf.rule, x, "r") == Some(2) { + set_enum(&mut g, "rule", 1); + } + import_blend(s, &mut g); + g + } + ShapeKind::GradientStroke(gs) => { + let radial = int(gs.gradient_type, x, "t") == Some(2); + let mut g = build::shape_gradient_stroke(ids, radial, [0.0, 0.0], [100.0, 0.0], Gradient::default(), 2.0); + gradient_common( + im, + &mut g, + gs.opacity.as_ref(), + gs.start.as_ref(), + gs.end.as_ref(), + gs.highlight_length.as_ref(), + gs.highlight_angle.as_ref(), + gs.colors.as_ref(), + ); + let fields = StrokeIn { + width: gs.width.as_ref(), + cap: int(gs.cap, x, "lc"), + join: int(gs.join, x, "lj"), + miter: gs.miter_limit, + miter_animated: gs.miter_limit_animated.as_ref(), + dashes: gs.dashes.as_deref(), + }; + import_stroke(im, ids, fields, &mut g); + import_blend(s, &mut g); + g + } + ShapeKind::Trim(t) => { let mut g = build::shape_trim(ids, 0.0, 100.0, 0.0); - set(im, &mut g, "start", j.get("s"), &anim::to_scalar); - set(im, &mut g, "end", j.get("e"), &anim::to_scalar); - set(im, &mut g, "offset", j.get("o"), &anim::to_scalar); - if int(j, "m") == Some(2) { + set(im, &mut g, "start", t.start.as_ref(), &anim::to_scalar); + set(im, &mut g, "end", t.end.as_ref(), &anim::to_scalar); + set(im, &mut g, "offset", t.offset.as_ref(), &anim::to_scalar); + if int(t.multiple, x, "m") == Some(2) { set_enum(&mut g, "mode", 1); } g } - "rp" => { + ShapeKind::Repeater(r) => { let mut g = build::shape_repeater(ids, 3.0, [100.0, 0.0]); - set(im, &mut g, "copies", j.get("c"), &anim::to_scalar); - set(im, &mut g, "offset", j.get("o"), &anim::to_scalar); - set_enum(&mut g, "composite", if int(j, "m") == Some(1) { 1 } else { 0 }); - if let (Some(tr), Some(t)) = (j.get("tr"), g.sub_mut("transform")) { - import_shape_transform(im, tr, t); + set(im, &mut g, "copies", r.copies.as_ref(), &anim::to_scalar); + set(im, &mut g, "offset", r.offset.as_ref(), &anim::to_scalar); + set_enum(&mut g, "composite", if int(r.composite, x, "m") == Some(1) { 1 } else { 0 }); + if let (Some(tr), Some(t)) = (r.transform.as_ref(), g.sub_mut("transform")) { + import_shape_transform(im, &repeater_tr_get(tr), t); } g } - "rd" | "op" | "pb" | "tw" | "zz" | "mm" => { - let kind = match ty { - "rd" => "round", - "op" => "offset", - "pb" => "pucker", - "tw" => "twist", - "zz" => "zigzag", - _ => "merge", - }; - let Some(mut g) = build::shape_simple_op(ids, kind) else { continue }; - match ty { - "rd" => set(im, &mut g, "radius", j.get("r"), &anim::to_scalar), - "op" => { - set(im, &mut g, "amount", j.get("a"), &anim::to_scalar); - if let Some(lj) = int(j, "lj") { - set_enum(&mut g, "join", lj.saturating_sub(1).clamp(0, 2) as u32); - } - set(im, &mut g, "miter", j.get("ml"), &anim::to_scalar); - } - "pb" => set(im, &mut g, "amount", j.get("a"), &anim::to_scalar), - "tw" => { - set(im, &mut g, "angle", j.get("a"), &anim::to_scalar); - set(im, &mut g, "center", j.get("c"), &anim::to_vec2); - } - "zz" => { - set(im, &mut g, "size", j.get("s"), &anim::to_scalar); - set(im, &mut g, "ridges", j.get("r"), &anim::to_scalar); - if int(j, "pt") == Some(2) { - set_enum(&mut g, "points", 1); - } - } - _ => { - if let Some(m) = int(j, "mm") { - set_enum(&mut g, "mode", m.saturating_sub(1).clamp(0, 4) as u32); - } - } + ShapeKind::RoundCorners(r) => { + let Some(mut g) = build::shape_simple_op(ids, "round") else { continue }; + set(im, &mut g, "radius", r.radius.as_ref(), &anim::to_scalar); + g + } + ShapeKind::OffsetPath(op) => { + let Some(mut g) = build::shape_simple_op(ids, "offset") else { continue }; + set(im, &mut g, "amount", op.amount.as_ref(), &anim::to_scalar); + if let Some(lj) = int(op.join, x, "lj") { + set_enum(&mut g, "join", lj.saturating_sub(1).clamp(0, 2) as u32); + } + set(im, &mut g, "miter", op.miter_limit.as_ref(), &anim::to_scalar); + g + } + ShapeKind::PuckerBloat(pb) => { + let Some(mut g) = build::shape_simple_op(ids, "pucker") else { continue }; + set(im, &mut g, "amount", pb.amount.as_ref(), &anim::to_scalar); + g + } + ShapeKind::Twist(tw) => { + let Some(mut g) = build::shape_simple_op(ids, "twist") else { continue }; + set(im, &mut g, "angle", tw.angle.as_ref(), &anim::to_scalar); + set(im, &mut g, "center", tw.center.as_ref(), &anim::to_vec2); + g + } + ShapeKind::ZigZag(zz) => { + let Some(mut g) = build::shape_simple_op(ids, "zigzag") else { continue }; + set(im, &mut g, "size", zz.frequency.as_ref(), &anim::to_scalar); + set(im, &mut g, "ridges", zz.amount.as_ref(), &anim::to_scalar); + if int_json(zz.point_type.as_ref().map(|a| &a.0)) == Some(2) { + set_enum(&mut g, "points", 1); } g } - "tr" => continue, - other => { - im.warn(format!("shape item `{other}` is not supported (skipped)")); + ShapeKind::Merge(mm) => { + let Some(mut g) = build::shape_simple_op(ids, "merge") else { continue }; + if let Some(m) = int(mm.mode, x, "mm") { + set_enum(&mut g, "mode", m.saturating_sub(1).clamp(0, 4) as u32); + } + g + } + ShapeKind::Transform(_) => continue, + ShapeKind::Other(ty) => { + im.warn(format!("shape item `{}` is not supported (skipped)", ty.as_str().unwrap_or(""))); continue; } }; - if let Some(nm) = j.get("nm").and_then(Json::as_str) { - g.name = nm.to_string(); + if let Some(nm) = &s.name { + g.name = nm.clone(); } - if j.get("hd").and_then(Json::as_bool) == Some(true) { + if s.hidden == Some(true) { g.enabled = false; } out.push(g); } out } + +/// The keys `gf` and `gs` share. +#[allow(clippy::too_many_arguments)] +fn gradient_common( + im: &Im, + g: &mut PropGroup, + opacity: Option<&Animated>, + start: Option<&Animated>, + end: Option<&Animated>, + highlight_length: Option<&Animated>, + highlight_angle: Option<&Animated>, + colors: Option<&GradientColors>, +) { + set(im, g, "opacity", opacity, &anim::to_scalar); + set(im, g, "start", start, &anim::to_vec2); + set(im, g, "end", end, &anim::to_vec2); + set(im, g, "highlightLength", highlight_length, &anim::to_scalar); + set(im, g, "highlightAngle", highlight_angle, &anim::to_scalar); + if let Some(c) = colors { + let n = c.count.and_then(|n| usize::try_from(n).ok()).unwrap_or(2); + set(im, g, "colors", c.stops.as_ref(), &move |v| to_gradient(v, n)); + } +} diff --git a/crates/lottie/src/tests.rs b/crates/lottie/src/tests.rs index b941b4f61..35c52026d 100644 --- a/crates/lottie/src/tests.rs +++ b/crates/lottie/src/tests.rs @@ -381,7 +381,7 @@ fn offset_paths_miter_uses_animatable_lottie_value() { assert_eq!(shapes[0]["ml"]["k"][1]["s"], json!([9.0])); assert_eq!(shapes[1]["ml"], json!({"a": 0, "k": 6.0})); assert_eq!(shapes[2]["ty"], "st"); - assert_eq!(shapes[2]["ml"], json!(7.0)); + assert_eq!(shapes[2]["ml"].as_f64(), Some(7.0)); assert!(compare_comps(&p, cid, &q, nc) > 10); let restored = &q.comp(nc).unwrap().layers[0]; assert_eq!(restored.props.group("contents/offset").unwrap().get("miter").unwrap().keys.len(), 2); @@ -997,6 +997,53 @@ fn per_corner_roundness_exports_equal_radii_and_warns_when_mixed() { assert!(!warnings.iter().any(|w| w.contains("per-corner")), "{warnings:?}"); } +#[test] +fn many_layers_and_precomps_import_with_their_parents_and_sizes() { + // 5 000 null layers each parented to the previous, and 2 000 empty precomp assets: the + // relationship and size passes index the layers instead of searching them per layer. (Each + // has its own name: `Comp::unique_layer_name` numbering one repeated name is a separate cost.) + let n = 5_000; + let layers: Vec = (1..=n).map(|i| json!({"ty": 3, "nm": format!("N{i}"), "ind": i, "parent": i - 1, "ip": 0, "op": 30, "st": 0, "ks": {}})).collect(); + let mut assets: Vec = (0..2_000).map(|i| json!({"id": format!("c{i}"), "layers": []})).collect(); + assets.push(json!({"id": "last", "layers": []})); + let mut layers = layers; + layers.push(json!({"ty": 0, "ind": n + 1, "refId": "last", "w": 50, "h": 40, "ip": 0, "op": 30, "st": 0, "ks": {}})); + let doc = json!({"w": 200, "h": 120, "fr": 30, "ip": 0, "op": 30, "assets": assets, "layers": layers}); + let mut q = Project::default(); + let nc = import(&mut q, doc.to_string().as_bytes(), "Imported", "", &mut |_| None).unwrap().comp; + let c = q.comp(nc).unwrap(); + assert_eq!(c.layers.len(), n as usize + 1); + assert_eq!(c.layers.get(0).unwrap().parent, None); + assert_eq!(c.layers.get(1).unwrap().parent, Some(c.layers.get(0).unwrap().id)); + let LayerSource::Comp { item } = c.layers.get(n as usize).unwrap().source else { panic!("not a precomp") }; + let pc = q.comp(item).unwrap(); + assert_eq!((pc.width, pc.height), (50, 40)); +} + +#[test] +fn deeply_nested_shape_groups_and_long_font_names_import() { + let mut g = json!({"ty": "rc", "s": {"a": 0, "k": [10, 10]}, "p": {"a": 0, "k": [0, 0]}, "r": {"a": 0, "k": 0}}); + // 50 levels: each is two levels of JSON, within serde_json's recursion limit of 128. + for _ in 0..50 { + g = json!({"ty": "gr", "it": [g, {"ty": "tr", "o": {"a": 0, "k": 100}}]}); + } + let family = "F".repeat(100_000); + let keys: Vec = (0..50).map(|i| json!({"t": i, "s": {"t": "x", "f": "A", "s": 10}})).collect(); + let doc = json!({"w": 200, "h": 120, "fr": 30, "ip": 0, "op": 60, + "fonts": {"list": [{"fName": "A", "fFamily": family, "fStyle": "Regular"}]}, + "layers": [ + {"ty": 4, "ind": 1, "ip": 0, "op": 60, "st": 0, "ks": {}, "shapes": [g]}, + {"ty": 5, "ind": 2, "ip": 0, "op": 60, "st": 0, "ks": {}, "t": {"d": {"k": keys}}} + ]}); + let mut q = Project::default(); + let nc = import(&mut q, doc.to_string().as_bytes(), "Imported", "", &mut |_| None).unwrap().comp; + let c = q.comp(nc).unwrap(); + let st = c.layers.get(1).unwrap().props.prop("text/sourceText").unwrap(); + assert_eq!(st.keys.len(), 50); + let Value::Text(d) = &st.keys[0].value else { panic!("not text") }; + assert_eq!(d.font.len(), 256); +} + /// A footage item called a still whose file is not an image is not embedded. #[test] fn only_image_bytes_are_embedded() { diff --git a/crates/lottie/src/text.rs b/crates/lottie/src/text.rs index 125835c2b..39199cfb3 100644 --- a/crates/lottie/src/text.rs +++ b/crates/lottie/src/text.rs @@ -1,14 +1,18 @@ //! Text layers ↔ Lottie text data (`t`: document keys `d`, animators `a`, more options `m`), //! and text converted to glyph shapes. +use craft_lottie::model::{ + Font, Map, Path, Shape, ShapeKind, TextAlign, TextData, TextDocKey, TextDocs, TextDocument, TextFollowPath, TextRange, TextSelector, TextStyle, +}; +use craft_lottie::{Animated, Json}; use effectcraft_keyframe::{Justify, TextDoc, Value}; use effectcraft_project::build::{self, Ids}; use effectcraft_project::{Layer, Node, PropGroup}; use effectcraft_time::Tick; -use serde_json::{Map, Value as Json, json}; +use serde_json::json; use crate::anim::{self, Ex, Im, export_prop, import_prop}; -use crate::shapes; +use crate::shapes::{self, fixed}; const JUSTIFY: [Justify; 7] = [Justify::Left, Justify::Right, Justify::Center, Justify::JustifyLastLeft, Justify::JustifyLastRight, Justify::JustifyLastCenter, Justify::JustifyAll]; @@ -18,47 +22,49 @@ pub(crate) fn font_name(family: &str, style: &str) -> String { format!("{}-{}", family.replace(' ', ""), style.replace(' ', "")) } -fn rgb(c: [f32; 4]) -> Json { - json!([c[0] as f64, c[1] as f64, c[2] as f64]) +fn rgb(c: [f32; 4]) -> Vec { + vec![f64::from(c[0]), f64::from(c[1]), f64::from(c[2])] } -fn doc_json(d: &TextDoc) -> Json { - let mut o = json!({ - "t": d.text.replace("\r\n", "\r").replace('\n', "\r"), - "f": font_name(&d.font, &d.style), - "s": d.size, - "j": JUSTIFY.iter().position(|j| *j == d.justify).unwrap_or(0), - "tr": d.tracking, - "lh": d.leading.unwrap_or(d.size * 1.2), - "ls": d.baseline_shift, - "of": d.stroke_over_fill, - }); - if d.apply_fill { - o["fc"] = rgb(d.fill); +fn doc_json(d: &TextDoc) -> TextDocument { + let stroke = d.apply_stroke && d.stroke_width > 0.0; + TextDocument { + text: Some(d.text.replace("\r\n", "\r").replace('\n', "\r")), + font: Some(font_name(&d.font, &d.style)), + size: Some(d.size), + justify: Some(JUSTIFY.iter().position(|j| *j == d.justify).unwrap_or(0) as i64), + tracking: Some(d.tracking), + line_height: Some(d.leading.unwrap_or(d.size * 1.2)), + baseline_shift: Some(d.baseline_shift), + stroke_over_fill: Some(d.stroke_over_fill), + fill: d.apply_fill.then(|| rgb(d.fill)), + stroke: stroke.then(|| rgb(d.stroke)), + stroke_width: stroke.then_some(d.stroke_width), + caps: if d.all_caps { + Some(1) + } else if d.small_caps { + Some(2) + } else { + None + }, + box_size: d.box_size.map(|b| b.to_vec()), + box_position: d.box_size.map(|_| d.box_pos.to_vec()), + ..Default::default() } - if d.apply_stroke && d.stroke_width > 0.0 { - o["sc"] = rgb(d.stroke); - o["sw"] = json!(d.stroke_width); - } - if d.all_caps { - o["ca"] = json!(1); - } else if d.small_caps { - o["ca"] = json!(2); - } - if let Some(b) = d.box_size { - o["sz"] = json!(b); - o["ps"] = json!(d.box_pos); - } - o } -fn doc_from(j: &Json, fonts: &[(String, String, String)]) -> TextDoc { +/// A colour of a text document (`fc`, `sc`), 0..=1 or 0..=255. +fn doc_color(c: Option<&Vec>, extra: &Map, key: &str) -> Option<[f32; 4]> { + let j = c.filter(|c| !c.is_empty()).map(|c| json!(c)).or_else(|| extra.get(key).cloned())?; + anim::to_color(&j).map(|v| v.as_color()) +} + +fn doc_from(j: &TextDocument, fonts: &[(String, String, String)]) -> TextDoc { let mut d = TextDoc::default(); - let f = |k: &str| j.get(k).and_then(Json::as_f64); - if let Some(t) = j.get("t").and_then(Json::as_str) { + if let Some(t) = &j.text { d.text = t.replace(['\r', '\u{3}'], "\n"); } - if let Some(name) = j.get("f").and_then(Json::as_str) { + if let Some(name) = &j.font { match fonts.iter().find(|(n, _, _)| n == name) { Some((_, fam, st)) => { d.font = fam.clone(); @@ -71,40 +77,39 @@ fn doc_from(j: &Json, fonts: &[(String, String, String)]) -> TextDoc { } } } - if let Some(s) = f("s") { + if let Some(s) = j.size { d.size = s; } - let col = |k: &str| j.get(k).and_then(anim::to_color).map(|v| v.as_color()); - match col("fc") { + match doc_color(j.fill.as_ref(), &j.extra, "fc") { Some(c) => d.fill = c, None => d.apply_fill = false, } - if let Some(c) = col("sc") { + if let Some(c) = doc_color(j.stroke.as_ref(), &j.extra, "sc") { d.stroke = c; d.apply_stroke = true; - d.stroke_width = f("sw").unwrap_or(1.0); + d.stroke_width = j.stroke_width.unwrap_or(1.0); } - if let Some(of) = j.get("of").and_then(Json::as_bool) { + if let Some(of) = j.stroke_over_fill { d.stroke_over_fill = of; } - if let Some(i) = j.get("j").and_then(Json::as_u64) { - d.justify = JUSTIFY.get(i as usize).copied().unwrap_or_default(); + if let Some(i) = j.justify.and_then(|i| usize::try_from(i).ok()) { + d.justify = JUSTIFY.get(i).copied().unwrap_or_default(); } - d.tracking = f("tr").unwrap_or(0.0); - if let Some(lh) = f("lh") + d.tracking = j.tracking.unwrap_or(0.0); + if let Some(lh) = j.line_height && (lh - d.size * 1.2).abs() > 1e-6 { d.leading = Some(lh); } - d.baseline_shift = f("ls").unwrap_or(0.0); - match j.get("ca").and_then(Json::as_u64) { + d.baseline_shift = j.baseline_shift.unwrap_or(0.0); + match j.caps { Some(1) => d.all_caps = true, Some(2) => d.small_caps = true, _ => {} } - if let Some(sz) = j.get("sz").and_then(anim::nums).filter(|v| v.len() >= 2) { + if let Some(sz) = j.box_size.as_deref().filter(|v| v.len() >= 2) { d.box_size = Some([sz[0], sz[1]]); - if let Some(ps) = j.get("ps").and_then(anim::nums).filter(|v| v.len() >= 2) { + if let Some(ps) = j.box_position.as_deref().filter(|v| v.len() >= 2) { d.box_pos = [ps[0], ps[1]]; } } @@ -136,28 +141,86 @@ fn conv_for(v: &Value) -> fn(&Value) -> Json { } } +/// The field of a range animator's style for a Lottie key. +fn style_field<'a>(st: &'a mut TextStyle, key: &str) -> Option<&'a mut Option> { + Some(match key { + "p" => &mut st.position, + "a" => &mut st.anchor, + "s" => &mut st.scale, + "r" => &mut st.rotation, + "rx" => &mut st.rotation_x, + "ry" => &mut st.rotation_y, + "sk" => &mut st.skew, + "sa" => &mut st.skew_axis, + "o" => &mut st.opacity, + "fc" => &mut st.fill, + "fh" => &mut st.fill_hue, + "fs" => &mut st.fill_saturation, + "fb" => &mut st.fill_brightness, + "fo" => &mut st.fill_opacity, + "sc" => &mut st.stroke, + "sw" => &mut st.stroke_width, + "so" => &mut st.stroke_opacity, + "t" => &mut st.tracking, + "ls" => &mut st.line_spacing, + "bl" => &mut st.blur, + _ => return None, + }) +} + +fn style_set(st: &mut TextStyle, key: &str, v: Animated) { + match style_field(st, key) { + Some(f) => *f = Some(v), + None => { + st.extra.insert(key.into(), v.0); + } + } +} + +fn style_get(st: &TextStyle, key: &str) -> Option { + let named = match key { + "p" => &st.position, + "a" => &st.anchor, + "s" => &st.scale, + "r" => &st.rotation, + "sk" => &st.skew, + "sa" => &st.skew_axis, + "o" => &st.opacity, + "fc" => &st.fill, + "fh" => &st.fill_hue, + "fs" => &st.fill_saturation, + "fb" => &st.fill_brightness, + "sc" => &st.stroke, + "sw" => &st.stroke_width, + "t" => &st.tracking, + _ => &None, + }; + named.as_ref().map(|a| a.0.clone()).or_else(|| st.extra.get(key).cloned()) +} + /// Export a text layer's `t` object. Fonts used are added to `fonts`. -pub(crate) fn export_text(ex: &mut Ex, layer: &Layer, fonts: &mut Vec) -> Json { - let Some(tg) = layer.props.sub("text") else { return json!({}) }; +pub(crate) fn export_text(ex: &mut Ex, layer: &Layer, fonts: &mut Vec) -> TextData { + let Some(tg) = layer.props.sub("text") else { return TextData::default() }; let label = &layer.name; let mut docs = vec![]; let mut add_font = |d: &TextDoc| { let n = font_name(&d.font, &d.style); - if !fonts.iter().any(|f| f["fName"] == json!(n)) { - fonts.push(json!({"fName": n, "fFamily": d.font, "fStyle": d.style, "ascent": 75})); + if !fonts.iter().any(|f| f.name.as_deref() == Some(n.as_str())) { + fonts.push(Font { name: Some(n), family: Some(d.font.clone()), style: Some(d.style.clone()), ascent: Some(75.0), ..Default::default() }); } }; + let key = |t: f64, d: &TextDoc| TextDocKey { time: Some(t), document: Some(doc_json(d)), ..Default::default() }; if let Some(st) = tg.get("sourceText") { if st.keys.is_empty() { if let Value::Text(d) = &st.value { add_font(d); - docs.push(json!({"t": 0, "s": doc_json(d)})); + docs.push(key(0.0, d)); } } else { for k in &st.keys { if let Value::Text(d) = &k.value { add_font(d); - docs.push(json!({"t": ex.tb.frame(k.time), "s": doc_json(d)})); + docs.push(key(ex.tb.frame(k.time), d)); } } } @@ -184,22 +247,28 @@ pub(crate) fn export_text(ex: &mut Ex, layer: &Layer, fonts: &mut Vec) -> animators.push(export_animator(ex, a, &format!("{label} ▸ {}", a.name))); } } - let mut m = json!({"g": 1, "a": {"a": 0, "k": [0, 0]}}); + let mut m = TextAlign { grouping: Some(1), anchor: Some(fixed(json!([0, 0]))), ..Default::default() }; if let Some(more) = tg.sub("moreOptions") { - m["g"] = json!(more.get("anchorGrouping").map(|p| p.value.as_enum()).unwrap_or(0) + 1); + m.grouping = Some(i64::from(more.get("anchorGrouping").map(|p| p.value.as_enum()).unwrap_or(0)) + 1); if let Some(p) = more.get("groupingAlignment") { - m["a"] = export_prop(ex, p, &anim::arr2, &format!("{label} ▸ Grouping Alignment")); + m.anchor = Some(export_prop(ex, p, &anim::arr2, &format!("{label} ▸ Grouping Alignment"))); } } if tg.sub("pathOptions").and_then(|p| p.get("path")).is_some_and(|p| p.value.as_enum() > 0) { ex.warn(format!("{label}: text on a path is not exported")); } - json!({"d": {"k": docs}, "a": animators, "m": m, "p": {}}) + TextData { + documents: Some(TextDocs { keys: Some(docs), ..Default::default() }), + ranges: Some(animators), + alignment: Some(m), + follow_path: Some(TextFollowPath::default()), + ..Default::default() + } } /// Text animators reproducing the style runs of `d` (fill, stroke, stroke width, size, /// tracking, baseline shift) over their character ranges. -fn style_run_animators(ex: &mut Ex, d: &TextDoc, label: &str) -> Vec { +fn style_run_animators(ex: &mut Ex, d: &TextDoc, label: &str) -> Vec { let base = d.base_style(); let mut out = vec![]; let mut start = 0usize; @@ -211,63 +280,71 @@ fn style_run_animators(ex: &mut Ex, d: &TextDoc, label: &str) -> Vec { if *s == base || run.len == 0 { continue; } - let k = |v: Json| json!({"a": 0, "k": v}); - let mut props = Map::new(); + let k = fixed; + let mut props = TextStyle::default(); if s.apply_fill && s.fill != base.fill { - props.insert("fc".into(), k(json!([s.fill[0] as f64, s.fill[1] as f64, s.fill[2] as f64, 1.0]))); + props.fill = Some(k(json!([s.fill[0] as f64, s.fill[1] as f64, s.fill[2] as f64, 1.0]))); } if s.apply_stroke && s.stroke != base.stroke { - props.insert("sc".into(), k(json!([s.stroke[0] as f64, s.stroke[1] as f64, s.stroke[2] as f64, 1.0]))); + props.stroke = Some(k(json!([s.stroke[0] as f64, s.stroke[1] as f64, s.stroke[2] as f64, 1.0]))); } if (s.stroke_width - base.stroke_width).abs() > 1e-9 { - props.insert("sw".into(), k(json!(s.stroke_width - base.stroke_width))); + props.stroke_width = Some(k(json!(s.stroke_width - base.stroke_width))); } if (s.size - base.size).abs() > 1e-9 && base.size > 0.0 { let p = s.size / base.size * 100.0; - props.insert("s".into(), k(json!([p, p, 100.0]))); + props.scale = Some(k(json!([p, p, 100.0]))); } if (s.tracking - base.tracking).abs() > 1e-9 { // Lottie tracking is in 1/1000 em like the Character panel's. - props.insert("t".into(), k(json!(s.tracking - base.tracking))); + props.tracking = Some(k(json!(s.tracking - base.tracking))); } if (s.baseline_shift - base.baseline_shift).abs() > 1e-9 { - props.insert("p".into(), k(json!([0.0, -(s.baseline_shift - base.baseline_shift), 0.0]))); + props.position = Some(k(json!([0.0, -(s.baseline_shift - base.baseline_shift), 0.0]))); } let lost = s.font != base.font || s.style != base.style || s.faux_bold != base.faux_bold || s.faux_italic != base.faux_italic; if lost && !warned { ex.warn(format!("{label}: per-character fonts and faux styles are not part of Lottie text (base font used)")); warned = true; } - if props.is_empty() { + if props == TextStyle::default() { continue; } - out.push(json!({ - "nm": format!("Style {a}–{b}"), - "s": { - "t": 0, "xe": k(json!(0)), "ne": k(json!(0)), "a": k(json!(100)), "b": 1, "rn": 0, "sh": 1, - "r": 2, "m": k(json!(1)), "s": k(json!(a)), "e": k(json!(b)), "o": k(json!(0)), - }, - "a": Json::Object(props), - })); + let mut sel = TextSelector { + kind: Some(0), + ease_high: Some(k(json!(0))), + ease_low: Some(k(json!(0))), + amount: Some(k(json!(100))), + based_on: Some(1), + randomize: Some(0), + shape: Some(1), + units: Some(2), + start: Some(k(json!(a))), + end: Some(k(json!(b))), + offset: Some(k(json!(0))), + ..Default::default() + }; + sel.extra.insert("m".into(), k(json!(1)).0); + out.push(TextRange { name: Some(format!("Style {a}–{b}")), selector: Some(sel), style: Some(props), ..Default::default() }); } out } -fn export_animator(ex: &mut Ex, a: &PropGroup, label: &str) -> Json { - let mut props = Map::new(); +fn export_animator(ex: &mut Ex, a: &PropGroup, label: &str) -> TextRange { + let mut props = TextStyle::default(); if let Some(pg) = a.sub("properties") { for p in pg.props() { match ANIM_PROPS.iter().find(|(_, _, m)| *m == p.match_id) { Some((key, _, _)) => { let v = export_prop(ex, p, &conv_for(&p.value), &format!("{label} ▸ {}", p.name)); - props.insert((*key).into(), v); + style_set(&mut props, key, v); } None if matches!(p.match_id.as_str(), "trackingType") => {} None => ex.warn(format!("{label} ▸ {}: text animator property not supported by Lottie", p.name)), } } } - let mut sel = json!({"t": 0}); + let mut sel = TextSelector { kind: Some(0), ..Default::default() }; let sels: Vec<&PropGroup> = a.sub("selectors").map(|s| s.groups().collect()).unwrap_or_default(); if sels.len() > 1 { ex.warn(format!("{label}: only the first selector is exported (Lottie animators have one)")); @@ -276,61 +353,56 @@ fn export_animator(ex: &mut Ex, a: &PropGroup, label: &str) -> Json { if s.match_id != "rangeSelector" { ex.warn(format!("{label}: {} is not supported by Lottie", s.name)); } else { - for (k, m) in [("s", "start"), ("e", "end"), ("o", "offset")] { - if let Some(p) = s.get(m) { - sel[k] = export_prop(ex, p, &anim::num, &format!("{label} ▸ {}", p.name)); - } - } + let mut prop = |m: &str| s.get(m).map(|p| export_prop(ex, p, &anim::num, &format!("{label} ▸ {}", p.name))); + (sel.start, sel.end, sel.offset) = (prop("start"), prop("end"), prop("offset")); if let Some(adv) = s.sub("advanced") { - let e = |m: &str| adv.get(m).map(|p| p.value.as_enum()).unwrap_or(0) + 1; - sel["r"] = json!(e("units")); - sel["b"] = json!(e("basedOn")); - sel["m"] = json!({"a": 0, "k": e("mode")}); - sel["sh"] = json!(e("shape")); - sel["rn"] = json!(adv.get("randomize").is_some_and(|p| p.value.as_bool()) as u8); - for (k, m) in [("a", "amount"), ("sm", "smoothness"), ("xe", "easeHigh"), ("ne", "easeLow")] { - if let Some(p) = adv.get(m) { - sel[k] = export_prop(ex, p, &anim::num, &format!("{label} ▸ {}", p.name)); - } - } + let e = |m: &str| i64::from(adv.get(m).map(|p| p.value.as_enum()).unwrap_or(0)) + 1; + sel.units = Some(e("units")); + sel.based_on = Some(e("basedOn")); + sel.extra.insert("m".into(), json!({"a": 0, "k": e("mode")})); + sel.shape = Some(e("shape")); + sel.randomize = Some(i64::from(adv.get("randomize").is_some_and(|p| p.value.as_bool()))); + let mut prop = |m: &str| adv.get(m).map(|p| export_prop(ex, p, &anim::num, &format!("{label} ▸ {}", p.name))); + (sel.amount, sel.smoothness, sel.ease_high, sel.ease_low) = (prop("amount"), prop("smoothness"), prop("easeHigh"), prop("easeLow")); } } } - json!({"nm": a.name, "s": sel, "a": Json::Object(props)}) + TextRange { name: Some(a.name.clone()), selector: Some(sel), style: Some(props), ..Default::default() } } /// Import Lottie text data into a text layer's `text` group. -pub(crate) fn import_text(im: &mut Im, ids: &mut Ids, t: &Json, tg: &mut PropGroup, fonts: &[(String, String, String)]) { - if let Some(list) = t.get("d").and_then(|d| d.get("k")).and_then(Json::as_array) +pub(crate) fn import_text(im: &mut Im, ids: &mut Ids, t: &TextData, tg: &mut PropGroup, fonts: &[(String, String, String)]) { + if let Some(list) = t.documents.as_ref().and_then(|d| d.keys.as_deref()) && let Some(st) = tg.get_mut("sourceText") { - let docs: Vec<(f64, TextDoc)> = - list.iter().filter_map(|k| Some((k.get("t").and_then(Json::as_f64).unwrap_or(0.0), doc_from(k.get("s")?, fonts)))).collect(); + let docs: Vec<(f64, TextDoc)> = list.iter().filter_map(|k| Some((k.time.unwrap_or(0.0), doc_from(k.document.as_ref()?, fonts)))).collect(); if let Some((_, first)) = docs.first() { st.value = Value::Text(Box::new(first.clone())); } if docs.len() > 1 { - st.keys = docs.iter().map(|(f, d)| effectcraft_keyframe::Keyframe::new(im.tb.tick(*f), Value::Text(Box::new(d.clone()))).hold()).collect(); + // Moved into the keys, not cloned: the documents are not kept twice. + st.keys = docs.into_iter().map(|(f, d)| effectcraft_keyframe::Keyframe::new(im.tb.tick(f), Value::Text(Box::new(d))).hold()).collect(); } } - if let Some(m) = t.get("m") + if let Some(m) = &t.alignment && let Some(more) = tg.sub_mut("moreOptions") { - if let (Some(g), Some(p)) = (m.get("g").and_then(Json::as_u64), more.get_mut("anchorGrouping")) { + let grouping = m.grouping.or_else(|| m.extra.get("g").and_then(Json::as_i64)).and_then(|g| u64::try_from(g).ok()); + if let (Some(g), Some(p)) = (grouping, more.get_mut("anchorGrouping")) { p.value = Value::Enum((g.max(1) - 1).min(3) as u32); } - if let (Some(a), Some(p)) = (m.get("a"), more.get_mut("groupingAlignment")) { - import_prop(im, a, p, &anim::to_vec2); + if let (Some(a), Some(p)) = (&m.anchor, more.get_mut("groupingAlignment")) { + import_prop(im, &a.0, p, &anim::to_vec2); } } - let Some(list) = t.get("a").and_then(Json::as_array) else { return }; + let Some(list) = &t.ranges else { return }; let mut animators = vec![]; for (i, a) in list.iter().enumerate() { - let name = a.get("nm").and_then(Json::as_str).map(str::to_string).unwrap_or(format!("Animator {}", i + 1)); - let props_j = a.get("a").cloned().unwrap_or(json!({})); + let name = a.name.clone().unwrap_or(format!("Animator {}", i + 1)); + let style = a.style.clone().unwrap_or_default(); let mut kinds: Vec<&str> = vec![]; for (key, kind, _) in ANIM_PROPS { - if props_j.get(*key).is_some() && !kinds.contains(kind) { + if style_get(&style, key).is_some() && !kinds.contains(kind) { kinds.push(kind); } } @@ -338,7 +410,7 @@ pub(crate) fn import_text(im: &mut Im, ids: &mut Ids, t: &Json, tg: &mut PropGro let mut g = build::text_animator(ids, &name, props); if let Some(pg) = g.sub_mut("properties") { for (key, _, m) in ANIM_PROPS { - let (Some(j), Some(p)) = (props_j.get(*key), pg.get_mut(m)) else { continue }; + let (Some(j), Some(p)) = (style_get(&style, key), pg.get_mut(m)) else { continue }; let conv: Box Option> = match &p.value { Value::Vec3(d) => { let z = d[2]; @@ -348,34 +420,38 @@ pub(crate) fn import_text(im: &mut Im, ids: &mut Ids, t: &Json, tg: &mut PropGro Value::Color(_) => Box::new(anim::to_color), _ => Box::new(anim::to_scalar), }; - import_prop(im, j, p, &*conv); + import_prop(im, &j, p, &*conv); } } - if let Some(s) = a.get("s") + if let Some(s) = &a.selector && let Some(sel) = g.sub_mut("selectors").and_then(|s| s.groups_mut_first()) { - for (k, m) in [("s", "start"), ("e", "end"), ("o", "offset")] { - if let (Some(j), Some(p)) = (s.get(k), sel.get_mut(m)) { - import_prop(im, j, p, &anim::to_scalar); + for (m, j) in [("start", &s.start), ("end", &s.end), ("offset", &s.offset)] { + if let (Some(j), Some(p)) = (j, sel.get_mut(m)) { + import_prop(im, &j.0, p, &anim::to_scalar); } } if let Some(adv) = sel.sub_mut("advanced") { - let mut en = |m: &str, key: &str, max: u32| { - let v = s.get(key).and_then(|v| if v.is_object() { v.get("k") } else { Some(v) }).and_then(anim::nums).and_then(|n| n.first().copied()); + let mut en = |m: &str, field: Option, key: &str, max: u32| { + let v = field.map(|f| f as f64).or_else(|| { + let v = s.extra.get(key)?; + let v = if v.is_object() { v.get("k")? } else { v }; + anim::nums(v).and_then(|n| n.first().copied()) + }); if let (Some(v), Some(p)) = (v, adv.get_mut(m)) { p.value = Value::Enum((((v.round() as i64).saturating_sub(1)).max(0) as u32).min(max)); } }; - en("units", "r", 1); - en("basedOn", "b", 3); - en("mode", "m", 5); - en("shape", "sh", 5); - if let (Some(rn), Some(p)) = (s.get("rn").and_then(Json::as_u64), adv.get_mut("randomize")) { + en("units", s.units, "r", 1); + en("basedOn", s.based_on, "b", 3); + en("mode", None, "m", 5); + en("shape", s.shape, "sh", 5); + if let (Some(rn), Some(p)) = (s.randomize.and_then(|r| u64::try_from(r).ok()), adv.get_mut("randomize")) { p.value = Value::Bool(rn != 0); } - for (k, m) in [("a", "amount"), ("sm", "smoothness"), ("xe", "easeHigh"), ("ne", "easeLow")] { - if let (Some(j), Some(p)) = (s.get(k), adv.get_mut(m)) { - import_prop(im, j, p, &anim::to_scalar); + for (m, j) in [("amount", &s.amount), ("smoothness", &s.smoothness), ("easeHigh", &s.ease_high), ("easeLow", &s.ease_low)] { + if let (Some(j), Some(p)) = (j, adv.get_mut(m)) { + import_prop(im, &j.0, p, &anim::to_scalar); } } } @@ -399,7 +475,7 @@ impl FirstGroup for PropGroup { /// Text converted to glyph shapes: one group with every glyph outline (at layer time 0's /// Source Text), a fill and a stroke, as Lottie shape items. -pub(crate) fn glyph_shapes(ex: &mut Ex, layer: &Layer) -> Vec { +pub(crate) fn glyph_shapes(ex: &mut Ex, layer: &Layer) -> Vec { let Some(tg) = layer.props.sub("text") else { return vec![] }; let Some(st) = tg.get("sourceText") else { return vec![] }; let Value::Text(doc) = st.value_at(Tick::ZERO) else { return vec![] }; @@ -411,14 +487,29 @@ pub(crate) fn glyph_shapes(ex: &mut Ex, layer: &Layer) -> Vec { for g in &lay.glyphs { let p = kurbo::Affine::translate((g.origin.x, g.origin.y)) * g.path.clone(); for sp in effectcraft_path::from_kurbo(&p) { - items.push(json!({"ty": "sh", "nm": g.ch.to_string(), "d": 1, "ks": {"a": 0, "k": shapes::shape_json(&sp)}})); + let path = Path { direction: Some(1), path: Some(fixed(shapes::shape_json(&sp))), closed: None }; + items.push(Shape { name: Some(g.ch.to_string()), kind: ShapeKind::Path(path), ..Default::default() }); } } - let col = |c: [f32; 4]| json!({"a": 0, "k": [c[0] as f64, c[1] as f64, c[2] as f64, 1.0]}); - let stroke = (doc.apply_stroke && doc.stroke_width > 0.0).then( - || json!({"ty": "st", "nm": "Stroke", "c": col(doc.stroke), "o": {"a": 0, "k": 100}, "w": {"a": 0, "k": doc.stroke_width}, "lc": 2, "lj": 2, "ml": 4}), - ); - let fill = doc.apply_fill.then(|| json!({"ty": "fl", "nm": "Fill", "c": col(doc.fill), "o": {"a": 0, "k": 100}, "r": 1})); + let col = |c: [f32; 4]| fixed(json!([c[0] as f64, c[1] as f64, c[2] as f64, 1.0])); + let stroke = (doc.apply_stroke && doc.stroke_width > 0.0).then(|| Shape { + name: Some("Stroke".into()), + kind: ShapeKind::Stroke(craft_lottie::model::Stroke { + color: Some(col(doc.stroke)), + opacity: Some(fixed(json!(100))), + width: Some(fixed(json!(doc.stroke_width))), + cap: Some(2), + join: Some(2), + miter_limit: Some(4.0), + ..Default::default() + }), + ..Default::default() + }); + let fill = doc.apply_fill.then(|| Shape { + name: Some("Fill".into()), + kind: ShapeKind::Fill(craft_lottie::model::Fill { color: Some(col(doc.fill)), opacity: Some(fixed(json!(100))), rule: Some(1) }), + ..Default::default() + }); // Items above draw on top: stroke over fill puts the stroke first. if doc.stroke_over_fill { items.extend(stroke); @@ -428,6 +519,15 @@ pub(crate) fn glyph_shapes(ex: &mut Ex, layer: &Layer) -> Vec { items.extend(stroke); } let n = items.len() + 1; - items.push(json!({"ty": "tr", "a": {"a": 0, "k": [0, 0]}, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]}, "r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}})); - vec![json!({"ty": "gr", "nm": layer.name, "np": n, "it": items})] + let tr = craft_lottie::model::Transform { + anchor: Some(fixed(json!([0, 0]))), + position: Some(fixed(json!([0, 0]))), + scale: Some(fixed(json!([100, 100]))), + rotation: Some(fixed(json!(0))), + opacity: Some(fixed(json!(100))), + ..Default::default() + }; + items.push(Shape { kind: ShapeKind::Transform(Box::new(tr)), ..Default::default() }); + let group = craft_lottie::model::Group { count: Some(n as f64), items: Some(items) }; + vec![Shape { name: Some(layer.name.clone()), kind: ShapeKind::Group(group), ..Default::default() }] } diff --git a/crates/media/Cargo.toml b/crates/media/Cargo.toml index 4947d928a..f744c684c 100644 --- a/crates/media/Cargo.toml +++ b/crates/media/Cargo.toml @@ -22,15 +22,17 @@ effectcraft-pdf = { workspace = true } effectcraft-model = { workspace = true } filmcraft-codecs = { workspace = true } filmcraft-media = { workspace = true } -filmcraft-aac = { workspace = true } -filmcraft-isobmff = { workspace = true } -filmcraft-matroska = { workspace = true } +craft-dpx = { workspace = true } +craft-exr = { workspace = true } +craft-gif = { workspace = true } +craft-webp = { workspace = true } +craft-audio = { workspace = true } +craft-media = { workspace = true } filmcraft-mpegts = { workspace = true } filmcraft-frame = { workspace = true } filmcraft-color = { workspace = true } filmcraft-time = { workspace = true } exr = { workspace = true } -gif = { workspace = true } image = { workspace = true, features = ["gif", "webp", "tiff", "bmp", "exr", "tga", "hdr"] } rayon = { workspace = true } serde_json = { workspace = true } @@ -38,5 +40,8 @@ thiserror = { workspace = true } log = { workspace = true } [dev-dependencies] +# Writes the animated GIFs of the tests. +gif = { workspace = true } +tempfile = { workspace = true } # (tests render comps that read layers through effects; already a dependency of effectcraft-render) effectcraft-effects = { workspace = true } diff --git a/crates/media/src/aac.rs b/crates/media/src/aac.rs index 625c37b43..a1793b7af 100644 --- a/crates/media/src/aac.rs +++ b/crates/media/src/aac.rs @@ -6,7 +6,7 @@ use std::io; -use filmcraft_aac::AudioSpecificConfig; +use craft_audio::aac::AudioSpecificConfig; use filmcraft_media::ByteReader; /// How far into an MPEG TS / PS file the audio streams are looked for: the stream is indexed as @@ -34,15 +34,16 @@ pub(crate) fn config(header: Option<&[u8]>, file: Option<&dyn ByteReader>) -> Op /// are in its fragments, not the `moov`). fn mp4(header: &[u8], file: Option<&dyn ByteReader>) -> Option> { let mp4 = match file { - Some(f) => filmcraft_isobmff::open(Head(f, f.len())), - None => filmcraft_isobmff::open(header), + Some(f) => craft_media::isobmff::open(Head(f, f.len())), + None => craft_media::isobmff::open(header), }; let mp4 = mp4.ok()?; - let playable = - |t: &&filmcraft_isobmff::Track| t.kind == filmcraft_isobmff::TrackKind::Audio && !t.samples.is_empty() && !t.entries.is_empty() && t.timescale > 0; + let playable = |t: &&craft_media::isobmff::Track| { + t.kind == craft_media::isobmff::TrackKind::Audio && !t.samples.is_empty() && !t.entries.is_empty() && t.timescale > 0 + }; let track = mp4.tracks.iter().find(playable)?; match &track.entries.first()?.codec { - filmcraft_isobmff::CodecConfig::Aac(a) => Some(a.asc.clone()), + craft_media::isobmff::CodecConfig::Aac(a) => Some(a.asc.clone()), _ => None, } } @@ -50,9 +51,9 @@ fn mp4(header: &[u8], file: Option<&dyn ByteReader>) -> Option> { /// The track FilmCraft's Matroska source plays: the first audio track with frames, found by /// indexing the clusters as that source does. fn matroska(file: &dyn ByteReader) -> Option> { - let mkv = filmcraft_matroska::open(Head(file, file.len())).ok()?; - match &mkv.tracks.iter().find(|t| t.kind == filmcraft_matroska::TrackKind::Audio && !t.samples.is_empty())?.codec { - filmcraft_matroska::Codec::Aac { asc } => Some(asc.clone()), + let mkv = craft_media::matroska::open(Head(file, file.len())).ok()?; + match &mkv.tracks.iter().find(|t| t.kind == craft_media::matroska::TrackKind::Audio && !t.samples.is_empty())?.codec { + craft_media::matroska::Codec::Aac { asc } => Some(asc.clone()), _ => None, } } @@ -88,16 +89,7 @@ impl Head<'_> { } } -impl filmcraft_isobmff::ByteSource for Head<'_> { - fn len(&self) -> u64 { - self.1 - } - fn read_at(&self, offset: u64, buf: &mut [u8]) -> io::Result<()> { - self.read(offset, buf) - } -} - -impl filmcraft_matroska::ByteSource for Head<'_> { +impl craft_media::ByteSource for Head<'_> { fn len(&self) -> u64 { self.1 } diff --git a/crates/media/src/downmix.rs b/crates/media/src/downmix.rs index 09bb1e1f6..5e086bdaf 100644 --- a/crates/media/src/downmix.rs +++ b/crates/media/src/downmix.rs @@ -19,7 +19,7 @@ use std::f32::consts::FRAC_1_SQRT_2; use std::sync::Arc; -use filmcraft_aac::{AudioSpecificConfig, ProgramConfig}; +use craft_audio::aac::{AudioSpecificConfig, ProgramConfig}; /// A source channel's contribution to the left and right outputs, before normalisation. pub type Pair = [f32; 2]; @@ -185,7 +185,7 @@ mod tests { } } - /// AudioSpecificConfigs as ffmpeg 8.1 and FilmCraft's encoder write them (48 kHz AAC-LC). + /// AudioSpecificConfigs as ffmpeg 8.1 and craft-audio's encoder write them (48 kHz AAC-LC). const PCE_FFMPEG_61: &str = "118004c848002000c4400d4c61766336322e32382e31303256e500"; const PCE_FILMCRAFT_61: &str = "118004c845000108840000"; diff --git a/crates/media/src/dpx.rs b/crates/media/src/dpx.rs index a5b2abdaf..f08f1344d 100644 --- a/crates/media/src/dpx.rs +++ b/crates/media/src/dpx.rs @@ -1,17 +1,11 @@ -//! DPX (SMPTE 268M) and Kodak Cineon stills, the film-scan interchange formats, read from the -//! public specifications. +//! DPX (SMPTE 268M) and Kodak Cineon stills, the film-scan interchange formats, read with +//! `craft-dpx`; this module maps a frame onto footage and 16-bit pixels. //! -//! Supported: luma, RGB, RGBA and ABGR (DPX) or one / three channels (Cineon), 8-, 10-, 12- and -//! 16-bit unsigned samples, 10-bit filled into 32-bit words with the pad bits low (DPX method A, -//! Cineon "32-bit left justified") or high (method B, "right justified"), 12-bit in 16-bit words, -//! big- and little-endian files, the four unrotated image orientations and the pixel aspect ratio. //! Code values are shown as stored (a log scan looks flat, as in After Effects without a Cineon -//! conversion); the codec names the transfer (`log`, `linear`, …). Anything else (run-length -//! encoding, signed or float samples, Y'CbCr, packed 10/12-bit, transposed images) is refused -//! with an error naming it. Every field is read with bounds checks. +//! conversion); the codec names the transfer (`log`, `linear`, …). Y'CbCr elements and transposed +//! images are refused with an error naming them; so is everything `craft-dpx` does not read. use effectcraft_project::{AlphaMode, Footage}; -use rayon::prelude::*; use crate::{MediaError, Result}; @@ -21,391 +15,110 @@ pub(crate) const EXTENSIONS: &[&str] = &["dpx", "cin"]; /// Largest image accepted (8192 × 8192): bigger headers are refused before allocating. const MAX_PIXELS: u64 = 1 << 26; -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -enum Kind { - Dpx, - Cineon, +fn limits() -> craft_dpx::Limits { + let mut l = craft_dpx::Limits::default(); + l.max_pixels = MAX_PIXELS; + l } -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -enum Layout { - Luma, - Rgb, - Rgba, - Abgr, -} - -impl Layout { - fn components(self) -> usize { - match self { - Layout::Luma => 1, - Layout::Rgb => 3, - Layout::Rgba | Layout::Abgr => 4, - } - } - fn name(self) -> &'static str { - match self { - Layout::Luma => "luma", - Layout::Rgb => "RGB", - Layout::Rgba => "RGBA", - Layout::Abgr => "ABGR", - } +fn error(path: &str, e: craft_dpx::Error) -> MediaError { + match e { + craft_dpx::Error::Unsupported(_) => MediaError::Unsupported(format!("{path}: {e}")), + _ => MediaError::Decode(format!("{path}: {e}")), } } -/// How samples are stored in a line. -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -enum Packing { - /// One byte per sample. - Bytes8, - /// One 16-bit word per sample. - Words16, - /// Three 10-bit samples per 32-bit word, first in the high bits, two pad bits low. - Filled10A, - /// Three 10-bit samples per 32-bit word, two pad bits high. - Filled10B, - /// One 12-bit sample per 16-bit word, four pad bits low. - Filled12A, - /// One 12-bit sample per 16-bit word, four pad bits high. - Filled12B, +/// The header of a DPX or Cineon file this module shows (`None` for other formats). +fn info(path: &str, bytes: &[u8]) -> Result> { + if craft_dpx::sniff(bytes).is_none() { + return Ok(None); + } + let info = craft_dpx::probe(bytes, &limits()).map_err(|e| error(path, e))?; + if info.layout.is_ycbcr() { + return Err(MediaError::Unsupported(format!("{path}: DPX with Y'CbCr samples is not supported"))); + } + if info.flips().is_none() { + return Err(MediaError::Unsupported(format!("{path}: DPX orientation {} (transposed image) is not supported", info.orientation))); + } + Ok(Some(info)) } -impl Packing { - fn max(self) -> u32 { - match self { - Packing::Bytes8 => 0xff, - Packing::Words16 => 0xffff, - Packing::Filled10A | Packing::Filled10B => 0x3ff, - Packing::Filled12A | Packing::Filled12B => 0xfff, - } - } - fn bits(self) -> u32 { - match self { - Packing::Bytes8 => 8, - Packing::Words16 => 16, - Packing::Filled10A | Packing::Filled10B => 10, - Packing::Filled12A | Packing::Filled12B => 12, - } - } - /// Bytes holding `n` samples, padded to a 32-bit word (lines start on word boundaries). - fn line_bytes(self, n: u64) -> u64 { - match self { - Packing::Bytes8 => n.div_ceil(4) * 4, - Packing::Words16 | Packing::Filled12A | Packing::Filled12B => (n * 2).div_ceil(4) * 4, - Packing::Filled10A | Packing::Filled10B => n.div_ceil(3) * 4, - } +fn layout_name(info: &craft_dpx::Info) -> &'static str { + match info.layout { + craft_dpx::Layout::Luma => "luma", + craft_dpx::Layout::Rgb => "RGB", + _ if info.descriptor == 52 => "ABGR", + _ => "RGBA", } } -/// What a header says about the picture. -#[derive(Clone, Debug)] -struct Header { - kind: Kind, - big_endian: bool, - width: u32, - height: u32, - layout: Layout, - packing: Packing, - /// Byte offset of the first line. - offset: u64, - /// Bytes from one line's start to the next. - stride: u64, - flip_x: bool, - flip_y: bool, - pixel_aspect: f64, - /// Transfer characteristic for the codec name (`log`, `linear`, …), empty when unstated. - transfer: &'static str, -} - -/// Bounds-checked reads in the file's byte order. -struct Reader<'a> { - b: &'a [u8], - big: bool, -} - -impl Reader<'_> { - fn u8(&self, o: usize) -> Option { - self.b.get(o).copied() +/// The transfer characteristic for the codec name, empty when unstated. +fn transfer(info: &craft_dpx::Info) -> &'static str { + if info.kind == craft_dpx::Kind::Cineon { + return "log"; } - fn u16(&self, o: usize) -> Option { - let s: [u8; 2] = self.b.get(o..o.checked_add(2)?)?.try_into().ok()?; - Some(if self.big { u16::from_be_bytes(s) } else { u16::from_le_bytes(s) }) - } - fn u32(&self, o: usize) -> Option { - let s: [u8; 4] = self.b.get(o..o.checked_add(4)?)?.try_into().ok()?; - Some(if self.big { u32::from_be_bytes(s) } else { u32::from_le_bytes(s) }) - } -} - -const UNDEFINED32: u32 = u32::MAX; - -/// DPX or Cineon, and the byte order, from the magic number. -fn sniff(bytes: &[u8]) -> Option<(Kind, bool)> { - match bytes.get(..4)? { - b"SDPX" => Some((Kind::Dpx, true)), - b"XPDS" => Some((Kind::Dpx, false)), - [0x80, 0x2a, 0x5f, 0xd7] => Some((Kind::Cineon, true)), - [0xd7, 0x5f, 0x2a, 0x80] => Some((Kind::Cineon, false)), - _ => None, - } -} - -fn unsupported(path: &str, what: impl std::fmt::Display) -> MediaError { - MediaError::Unsupported(format!("{path}: {what}")) -} - -fn truncated(path: &str, kind: Kind) -> MediaError { - let name = if kind == Kind::Dpx { "DPX" } else { "Cineon" }; - MediaError::Decode(format!("{path}: truncated {name} header")) -} - -fn parse(path: &str, bytes: &[u8]) -> Result> { - let Some((kind, big_endian)) = sniff(bytes) else { return Ok(None) }; - let r = Reader { b: bytes, big: big_endian }; - let h = match kind { - Kind::Dpx => parse_dpx(path, &r)?, - Kind::Cineon => parse_cineon(path, &r)?, - }; - let pixels = u64::from(h.width) * u64::from(h.height); - if h.width == 0 || h.height == 0 || pixels > MAX_PIXELS { - return Err(MediaError::Decode(format!("{path}: image size {} × {} out of range", h.width, h.height))); - } - let need = h.offset.saturating_add(h.stride.saturating_mul(u64::from(h.height))); - if (bytes.len() as u64) < need { - return Err(MediaError::Decode(format!("{path}: truncated image data ({} of {need} bytes)", bytes.len()))); - } - Ok(Some(h)) -} - -fn parse_dpx(path: &str, r: &Reader) -> Result
{ - let t = || truncated(path, Kind::Dpx); - let image_offset = r.u32(4).ok_or_else(t)?; - let orientation = r.u16(768).ok_or_else(t)?; - let elements = r.u16(770).ok_or_else(t)?; - let width = r.u32(772).ok_or_else(t)?; - let height = r.u32(776).ok_or_else(t)?; - // The first image element (the picture; further elements are alternative views). - let sign = r.u32(780).ok_or_else(t)?; - let descriptor = r.u8(800).ok_or_else(t)?; - let transfer = r.u8(801).ok_or_else(t)?; - let bits = r.u8(803).ok_or_else(t)?; - let packing = r.u16(804).ok_or_else(t)?; - let encoding = r.u16(806).ok_or_else(t)?; - let data_offset = r.u32(808).ok_or_else(t)?; - let eol_padding = r.u32(812).ok_or_else(t)?; - if elements == 0 || elements == u16::MAX { - return Err(unsupported(path, "DPX file without an image element")); - } - if sign == 1 { - return Err(unsupported(path, "DPX with signed samples is not supported")); - } - if encoding == 1 { - return Err(unsupported(path, "run-length encoded DPX is not supported")); - } - let layout = match descriptor { - 6 => Layout::Luma, - 50 => Layout::Rgb, - 51 => Layout::Rgba, - 52 => Layout::Abgr, - 100..=103 => return Err(unsupported(path, "DPX with Y'CbCr samples is not supported")), - d => return Err(unsupported(path, format!("DPX image element descriptor {d} is not supported (luma, RGB, RGBA and ABGR are)"))), - }; - let packing = match (bits, packing) { - (8, _) => Packing::Bytes8, - (16, _) => Packing::Words16, - (10, 1) => Packing::Filled10A, - (10, 2) => Packing::Filled10B, - (12, 1) => Packing::Filled12A, - (12, 2) => Packing::Filled12B, - (10 | 12, _) => return Err(unsupported(path, format!("DPX with packed {bits}-bit samples (packing {packing}) is not supported"))), - (b, _) => return Err(unsupported(path, format!("DPX with {b}-bit samples is not supported (8, 10, 12 and 16 are)"))), - }; - let (flip_x, flip_y) = match orientation { - 0 | u16::MAX => (false, false), - 1 => (true, false), - 2 => (false, true), - 3 => (true, true), - o => return Err(unsupported(path, format!("DPX orientation {o} (transposed image) is not supported"))), - }; - let offset = if data_offset == 0 || data_offset == UNDEFINED32 { image_offset } else { data_offset }; - let eol = if eol_padding == UNDEFINED32 { 0 } else { eol_padding }; - let samples = u64::from(width) * layout.components() as u64; - // Pixel aspect ratio (orientation header), when stated. - let pixel_aspect = match (r.u32(1628), r.u32(1632)) { - (Some(h), Some(v)) if h != 0 && v != 0 && h != UNDEFINED32 && v != UNDEFINED32 => { - let a = f64::from(h) / f64::from(v); - if (0.1..=10.0).contains(&a) { a } else { 1.0 } - } - _ => 1.0, - }; - let transfer = match transfer { - 1 => "log (printing density)", - 2 => "linear", - 3 => "log", - 5 | 6 => "Rec. 709", - 13 => "ADX", + match info.transfer { + Some(1) => "log (printing density)", + Some(2) => "linear", + Some(3) => "log", + Some(5 | 6) => "Rec. 709", + Some(13) => "ADX", _ => "", - }; - Ok(Header { - kind: Kind::Dpx, - big_endian: r.big, - width, - height, - layout, - packing, - offset: u64::from(offset), - stride: packing.line_bytes(samples) + u64::from(eol), - flip_x, - flip_y, - pixel_aspect, - transfer, - }) -} - -fn parse_cineon(path: &str, r: &Reader) -> Result
{ - let t = || truncated(path, Kind::Cineon); - let offset = r.u32(4).ok_or_else(t)?; - let orientation = r.u8(192).ok_or_else(t)?; - let channels = r.u8(193).ok_or_else(t)?; - // Channel 0's description; every channel must match it. - let bits = r.u8(198).ok_or_else(t)?; - let width = r.u32(200).ok_or_else(t)?; - let height = r.u32(204).ok_or_else(t)?; - let interleave = r.u8(680).ok_or_else(t)?; - let packing = r.u8(681).ok_or_else(t)?; - let signed = r.u8(682).ok_or_else(t)?; - let eol_padding = r.u32(684).ok_or_else(t)?; - let layout = match channels { - 1 => Layout::Luma, - 3 => Layout::Rgb, - c => return Err(unsupported(path, format!("Cineon with {c} channels is not supported (1 and 3 are)"))), - }; - for c in 1..usize::from(channels) { - let base = 196 + 28 * c; - if r.u8(base + 2) != Some(bits) || r.u32(base + 4) != Some(width) || r.u32(base + 8) != Some(height) { - return Err(unsupported(path, "Cineon channels of different sizes or depths are not supported")); - } } - if interleave != 0 { - return Err(unsupported(path, "Cineon with line or channel interleave is not supported")); - } - if signed == 1 { - return Err(unsupported(path, "Cineon with signed samples is not supported")); - } - let packing = match (bits, packing) { - (8, _) => Packing::Bytes8, - (16, _) => Packing::Words16, - (10, 5) => Packing::Filled10A, - (10, 6) => Packing::Filled10B, - (10, p) => return Err(unsupported(path, format!("Cineon with 10-bit packing {p} is not supported (32-bit words are)"))), - (b, _) => return Err(unsupported(path, format!("Cineon with {b}-bit samples is not supported (8, 10 and 16 are)"))), - }; - let (flip_x, flip_y) = match orientation { - 0 | u8::MAX => (false, false), - 1 => (false, true), - 2 => (true, false), - 3 => (true, true), - o => return Err(unsupported(path, format!("Cineon orientation {o} (transposed image) is not supported"))), - }; - let eol = if eol_padding == UNDEFINED32 { 0 } else { eol_padding }; - let samples = u64::from(width) * layout.components() as u64; - Ok(Header { - kind: Kind::Cineon, - big_endian: r.big, - width, - height, - layout, - packing, - offset: u64::from(offset), - stride: packing.line_bytes(samples) + u64::from(eol), - flip_x, - flip_y, - pixel_aspect: 1.0, - transfer: "log", - }) } /// Footage for a DPX or Cineon file (`None` for other formats). pub(crate) fn probe(path: &str, bytes: &[u8]) -> Result> { - let Some(h) = parse(path, bytes)? else { return Ok(None) }; - let alpha = matches!(h.layout, Layout::Rgba | Layout::Abgr); + let Some(h) = info(path, bytes)? else { return Ok(None) }; + let alpha = h.layout.has_alpha(); let mut f = crate::probe::still_footage(path, h.width, h.height, image::ImageFormat::Png, alpha); f.alpha = if alpha { AlphaMode::Straight } else { AlphaMode::Ignore }; - f.pixel_aspect = h.pixel_aspect; - let name = if h.kind == Kind::Dpx { "DPX" } else { "Cineon" }; - f.codec = format!("{name} {}-bit {}", h.packing.bits(), h.layout.name()); - if !h.transfer.is_empty() { - f.codec = format!("{}, {}", f.codec, h.transfer); + f.pixel_aspect = + h.pixel_aspect.map(|(x, y)| f64::from(x) / f64::from(y)).filter(|a| (0.1..=10.0).contains(a) && h.kind == craft_dpx::Kind::Dpx).unwrap_or(1.0); + let name = if h.kind == craft_dpx::Kind::Dpx { "DPX" } else { "Cineon" }; + f.codec = format!("{name} {}-bit {}", h.bits, layout_name(&h)); + let t = transfer(&h); + if !t.is_empty() { + f.codec = format!("{}, {t}", f.codec); } Ok(Some(f)) } -/// The picture of a DPX or Cineon file as 16-bit samples (`None` for other formats). +/// The picture of a DPX or Cineon file as 16-bit samples, upright (`None` for other formats). pub(crate) fn decode(path: &str, bytes: &[u8]) -> Result> { - let Some(h) = parse(path, bytes)? else { return Ok(None) }; - let (w, ht) = (h.width as usize, h.height as usize); - // Output components: luma, RGB or RGBA (ABGR reordered). - let nc = h.layout.components(); - let row_len = w * nc; - let mut out = vec![0u16; row_len * ht]; - let max = h.packing.max(); - out.par_chunks_mut(row_len).enumerate().for_each(|(y, row)| { - let sy = if h.flip_y { ht - 1 - y } else { y }; - let start = h.offset.saturating_add(h.stride.saturating_mul(sy as u64)); - let line = usize::try_from(start).ok().and_then(|s| bytes.get(s..)).unwrap_or(&[]); - for x in 0..w { - let sx = if h.flip_x { w - 1 - x } else { x }; - for c in 0..nc { - // ABGR stores alpha first and colour reversed. - let sc = if h.layout == Layout::Abgr { 3 - c } else { c }; - let v = sample(line, h.packing, h.big_endian, sx * nc + sc); - if let Some(o) = row.get_mut(x * nc + c) { - *o = ((u64::from(v.min(max)) * 0xffff + u64::from(max) / 2) / u64::from(max)) as u16; + let Some(h) = info(path, bytes)? else { return Ok(None) }; + let (flip_x, flip_y) = h.flips().unwrap_or_default(); + let frame = craft_dpx::decode(bytes, &limits()).map_err(|e| error(path, e))?; + let (w, ht, nc) = (h.width as usize, h.height as usize, h.layout.components()); + let row_len = w.checked_mul(nc).ok_or_else(|| MediaError::Decode(format!("{path}: image dimensions overflow")))?; + let mut out = frame.codes; + if flip_y { + for y in 0..ht / 2 { + for x in 0..row_len { + out.swap(y * row_len + x, (ht - 1 - y) * row_len + x); + } + } + } + if flip_x { + for row in out.chunks_exact_mut(row_len) { + for x in 0..w / 2 { + let (a, b) = (x * nc, (w - 1 - x) * nc); + for c in 0..nc { + row.swap(a + c, b + c); } } } - }); + } + out.iter_mut().for_each(|c| *c = craft_dpx::widen(*c, h.bits)); let (w32, h32) = (h.width, h.height); let img = match h.layout { - Layout::Luma => image::ImageBuffer::from_raw(w32, h32, out).map(image::DynamicImage::ImageLuma16), - Layout::Rgb => image::ImageBuffer::from_raw(w32, h32, out).map(image::DynamicImage::ImageRgb16), - Layout::Rgba | Layout::Abgr => image::ImageBuffer::from_raw(w32, h32, out).map(image::DynamicImage::ImageRgba16), + craft_dpx::Layout::Luma => image::ImageBuffer::from_raw(w32, h32, out).map(image::DynamicImage::ImageLuma16), + craft_dpx::Layout::Rgb => image::ImageBuffer::from_raw(w32, h32, out).map(image::DynamicImage::ImageRgb16), + _ => image::ImageBuffer::from_raw(w32, h32, out).map(image::DynamicImage::ImageRgba16), }; img.map(Some).ok_or_else(|| MediaError::Decode(format!("{path}: image buffer size mismatch"))) } -/// Sample `i` of a line (0 past its end; the header check makes that unreachable for valid -/// headers). -#[inline] -fn sample(line: &[u8], packing: Packing, big: bool, i: usize) -> u32 { - let word16 = |o: usize| -> u32 { - match line.get(o..o + 2) { - Some(&[a, b]) => u32::from(if big { u16::from_be_bytes([a, b]) } else { u16::from_le_bytes([a, b]) }), - _ => 0, - } - }; - let word32 = |o: usize| -> u32 { - match line.get(o..o + 4) { - Some(&[a, b, c, d]) => { - if big { - u32::from_be_bytes([a, b, c, d]) - } else { - u32::from_le_bytes([a, b, c, d]) - } - } - _ => 0, - } - }; - match packing { - Packing::Bytes8 => line.get(i).copied().map_or(0, u32::from), - Packing::Words16 => word16(i * 2), - Packing::Filled12A => word16(i * 2) >> 4, - Packing::Filled12B => word16(i * 2) & 0xfff, - Packing::Filled10A => (word32(i / 3 * 4) >> (22 - 10 * (i % 3) as u32)) & 0x3ff, - Packing::Filled10B => (word32(i / 3 * 4) >> (20 - 10 * (i % 3) as u32)) & 0x3ff, - } -} - #[cfg(test)] mod tests { use super::*; @@ -452,7 +165,7 @@ mod tests { #[test] fn hostile_headers_never_panic() { - assert!(parse("x", b"not a dpx").expect("other").is_none()); + assert!(info("x", b"not a dpx").expect("other").is_none()); let good = { let mut a = dpx_header(4, 4, 50, 10, 1, 0); a.extend(std::iter::repeat_n(0x5a, 64)); @@ -462,14 +175,18 @@ mod tests { for n in [4, 8, 600, 790, 805, 2047, 2048, 2100] { assert!(decode("t.dpx", good.get(..n).expect("cut")).is_err(), "{n}"); } - // huge, zero, unsupported + // huge, zero, Y'CbCr, unsupported depth, transposed for (w, h, d, bits, p, o) in - [(u32::MAX, u32::MAX, 50, 10, 1, 0), (0, 4, 50, 10, 1, 0), (4, 4, 102, 10, 1, 0), (4, 4, 50, 10, 0, 0), (4, 4, 50, 32, 0, 0), (4, 4, 50, 10, 1, 5)] + [(u32::MAX, u32::MAX, 50, 10, 1, 0), (0, 4, 50, 10, 1, 0), (4, 4, 102, 10, 1, 0), (4, 4, 50, 32, 0, 0), (4, 4, 50, 10, 1, 5)] { let mut b = dpx_header(w, h, d, bits, p, o); b.extend(std::iter::repeat_n(0, 64)); - assert!(probe("h.dpx", &b).is_err() && decode("h.dpx", &b).is_err()); + assert!(probe("h.dpx", &b).is_err() && decode("h.dpx", &b).is_err(), "{w}x{h} {d} {bits} {p} {o}"); } + // 8192 × 8193 is past this module's own cap, which is below craft-dpx's default. + let mut big = dpx_header(8192, 8193, 6, 8, 0, 0); + big.extend(std::iter::repeat_n(0, 64)); + assert!(probe("big.dpx", &big).is_err()); // run-length encoding and offsets past the end are refused let mut rle = good.clone(); rle[806..808].copy_from_slice(&1u16.to_be_bytes()); diff --git a/crates/media/src/exr_channels.rs b/crates/media/src/exr_channels.rs index d0acf590f..96b0173cd 100644 --- a/crates/media/src/exr_channels.rs +++ b/crates/media/src/exr_channels.rs @@ -31,35 +31,15 @@ use crate::convert::{AlphaOp, float_to_image}; /// stop at the same size). const MAX_DISPLAY_PIXELS: usize = 1 << 28; -fn is_depth(name: &str) -> bool { - let last = name.rsplit('.').next().unwrap_or(name); - last.eq_ignore_ascii_case("z") || name.to_ascii_lowercase().contains("depth") -} - -/// Full plane name of a channel in a part: `part.channel`, except that Blender 5 writes one part -/// per pass whose channels already carry the full name (part `ViewLayer.Depth` holds -/// `ViewLayer.Depth.Z`), which is kept as is instead of doubling the prefix. -fn channel_name(part: Option<&str>, channel: &str) -> String { - match part { - Some(p) if channel.strip_prefix(p).is_some_and(|rest| rest.starts_with('.')) => channel.to_string(), - Some(p) => format!("{p}.{channel}"), - None => channel.to_string(), - } -} +// Channel naming and the Cryptomatte manifest are `craft-exr`'s. +use craft_exr::channels::{is_depth, part_channel_name as channel_name}; +pub use craft_exr::cryptomatte::parse_manifest; /// The part name channels are prefixed with (`None`: unnamed). fn part_name(header: &Header) -> Option { header.own_attributes.layer_name.as_ref().map(|t| t.to_string()).filter(|s| !s.is_empty()) } -/// Parse a Cryptomatte manifest (`{"name": "hexhash", …}`). -pub fn parse_manifest(json: &str) -> Vec<(String, u32)> { - let Ok(serde_json::Value::Object(m)) = serde_json::from_str::(json) else { return vec![] }; - let mut v: Vec<(String, u32)> = m.iter().filter_map(|(k, h)| Some((k.clone(), u32::from_str_radix(h.as_str()?.trim(), 16).ok()?))).collect(); - v.sort(); - v -} - /// Why an OpenEXR file's pixels can't be decoded when its headers name a compression this build /// can't decompress (HTJ2K, OpenEXR 3.4's High-Throughput JPEG 2000): the decoders only said /// "no non-deep rgb channels" or showed a transparent frame (#482). `None` for other files. diff --git a/crates/media/src/gif_anim.rs b/crates/media/src/gif_anim.rs index 09c0cda34..8453b50ac 100644 --- a/crates/media/src/gif_anim.rs +++ b/crates/media/src/gif_anim.rs @@ -43,18 +43,11 @@ pub(crate) fn gcd(a: u32, b: u32) -> u32 { } /// Describe an animated GIF as a movie. `None` for a GIF with fewer than two frames (a still) or -/// one whose headers can't be read. +/// one whose headers can't be read. A damaged tail keeps the frames before it. pub(crate) fn probe(path: &str, bytes: &[u8]) -> Option { - let mut dec = gif::DecodeOptions::new().read_info(Cursor::new(bytes)).ok()?; - let (width, height) = (u32::from(dec.width()), u32::from(dec.height())); - let mut delays: Vec = Vec::new(); - while delays.len() < MAX_FRAMES { - match dec.next_frame_info() { - Ok(Some(f)) => delays.push(delay_cs(u32::from(f.delay))), - // The end, or a damaged tail: keep the frames before it. - _ => break, - } - } + let info = craft_gif::scan(bytes, MAX_FRAMES)?; + let (width, height) = (u32::from(info.width), u32::from(info.height)); + let delays: Vec = info.frames.iter().map(|f| delay_cs(u32::from(f.delay_cs))).collect(); if delays.len() < 2 || width == 0 || height == 0 { return None; } @@ -93,7 +86,18 @@ impl Anim { if crate::webp_anim::is_webp(bytes) { return crate::webp_anim::load(bytes); } - let dec = GifDecoder::new(Cursor::new(bytes)).map_err(|e| MediaError::Decode(format!("GIF: {e}")))?; + let mut dec = GifDecoder::new(Cursor::new(bytes)).map_err(|e| MediaError::Decode(format!("GIF: {e}")))?; + // A frame may be far larger than the canvas, and the decoder allocates its buffer before + // decoding it: no single buffer may pass what all the frames may hold. + let mut limits = image::Limits::no_limits(); + limits.max_alloc = Some(MAX_BYTES as u64); + image::ImageDecoder::set_limits(&mut dec, limits).map_err(|e| MediaError::Decode(format!("GIF: {e}")))?; + // The decoder allocates the full logical canvas for the first frame, however small the + // frames themselves are: check it before decoding any. + let (w, h) = image::ImageDecoder::dimensions(&dec); + if u64::from(w) * u64::from(h) * 4 > MAX_BYTES as u64 { + return Err(MediaError::Unsupported(format!("GIF canvas of {w}×{h} is too large to hold in memory"))); + } let (mut frames, mut starts) = (Vec::new(), Vec::new()); let (mut at, mut size) = (0i64, 0usize); for frame in dec.into_frames() { @@ -179,6 +183,17 @@ mod tests { assert_eq!(colour_at(&pool, &f, 5.0), [0.0, 0.0, 1.0]); } + #[test] + fn a_frame_far_larger_than_the_canvas_is_refused_before_it_is_allocated() { + // A 1×1 canvas and a 20000×20000 frame (1.6 GB of RGBA); the data itself is not there. + let mut bytes = b"GIF89a".to_vec(); + // (a two-entry global colour table, so the frame gets as far as its buffer) + bytes.extend([1, 0, 1, 0, 0x80, 0, 0, 0, 0, 0, 255, 255, 255]); + bytes.extend([0x2c, 0, 0, 0, 0, 0x20, 0x4e, 0x20, 0x4e, 0, 2, 0]); + let e = crate::gif_anim::Anim::load(&bytes).err().expect("refused").to_string(); + assert!(e.to_lowercase().contains("memory"), "{e}"); + } + #[test] fn a_zero_delay_is_ten_hundredths_like_in_browsers() { let f = probe_bytes("a.gif", gif(&[(RED, 0), (GREEN, 1)]).into()).unwrap(); @@ -212,4 +227,18 @@ mod tests { assert!(pool.frame_at(&f, Tick::ZERO).is_err()); let _ = probe_bytes("a.gif", bytes.into()); } + + #[test] + fn a_huge_canvas_is_refused_before_decoding() { + // A 65535×65535 logical screen (16 GiB of RGBA) holding one 1×1 frame. + let mut out = Vec::new(); + { + let mut enc = gif::Encoder::new(&mut out, u16::MAX, u16::MAX, &[]).unwrap(); + for _ in 0..2 { + enc.write_frame(&gif::Frame::from_rgb(1, 1, &RED)).unwrap(); + } + } + let e = super::Anim::load(&out).err().unwrap(); + assert!(e.to_string().contains("too large"), "{e}"); + } } diff --git a/crates/media/src/layered.rs b/crates/media/src/layered.rs index 64ade9394..adc23cf31 100644 --- a/crates/media/src/layered.rs +++ b/crates/media/src/layered.rs @@ -119,7 +119,7 @@ pub(crate) fn decode(path: &str, bytes: &[u8], footage: &Footage, op: AlphaOp) - if u64::from(w) * u64::from(h) > u64::from(MAX_VECTOR_SIDE) * u64::from(MAX_VECTOR_SIDE) { return Err(MediaError::Decode(format!("{path}: {w}×{h} pixels is larger than vector footage can be drawn ({MAX_VECTOR_SIDE}×{MAX_VECTOR_SIDE})"))); } - let img = effectcraft_svg::rasterize_with(&doc, w, h, to_image); + let img = effectcraft_svg::try_rasterize_with(&doc, w, h, to_image).map_err(|e| MediaError::Decode(format!("{path}: {e}")))?; // The rasteriser produces premultiplied pixels already. let _ = op; return Ok(Some(img)); @@ -132,10 +132,15 @@ const MAX_VECTOR_SIDE: u32 = 16384; /// The vector footage `footage` (of the file `path` with these `bytes`) rasterised at `scale` × /// its size as [`effectcraft_render::vector_fit`] draws it (Continuously Rasterize). -pub(crate) fn rasterize_vector(path: &str, bytes: &[u8], footage: &Footage, scale: f64) -> Option { +/// +/// `None` when the file cannot be read as a vector document. `Some(Err(_))` when a render budget +/// refused part of the drawing (for example a layer scaled past the surface limit), so the caller +/// can report it instead of showing a partial or empty image as if it were complete. +pub(crate) fn rasterize_vector(path: &str, bytes: &[u8], footage: &Footage, scale: f64) -> Option> { let doc = footage_doc(path, bytes, footage)?.ok()?; let ((sw, sh), to_image) = fit(&doc, footage, scale); - Some(effectcraft_svg::rasterize_with(&doc, sw.clamp(1, MAX_VECTOR_SIDE), sh.clamp(1, MAX_VECTOR_SIDE), to_image)) + let drawn = effectcraft_svg::try_rasterize_with(&doc, sw.clamp(1, MAX_VECTOR_SIDE), sh.clamp(1, MAX_VECTOR_SIDE), to_image); + Some(drawn.map_err(|e| MediaError::Decode(format!("{path}: {e}")))) } /// The page framing of vector footage: as After Effects places it for footage from an After @@ -173,6 +178,18 @@ mod tests { assert_eq!((img.width, img.height), (40, 20)); } + /// Continuously Rasterize reports a layer scaled past the render budget as an error instead of + /// returning a partial or empty image, and still draws the same layer at an ordinary scale. + #[test] + fn rasterizing_vector_footage_past_the_budget_is_reported() { + let svg = br#""#; + let footage = probe("scaled.svg", svg).unwrap().unwrap(); + let ok = rasterize_vector("scaled.svg", svg, &footage, 1.0).unwrap().unwrap(); + assert_eq!((ok.width, ok.height), (100, 100)); + let e = rasterize_vector("scaled.svg", svg, &footage, 1000.0).unwrap().err().map(|e| e.to_string()).unwrap_or_default(); + assert!(e.contains("scaled.svg"), "{e}"); + } + /// A 200 × 100 pt page: red left half, blue right half. fn halves_pdf() -> Vec { effectcraft_pdf::write::pdf( @@ -214,7 +231,7 @@ mod tests { (footage.width, footage.height) = (100, 80); let unplaced = decode("art.ai", &pdf, &footage, op).unwrap().unwrap(); assert!(unplaced == own, "not placed: drawn as before"); - assert_eq!(rasterize_vector("art.ai", &pdf, &footage, 0.5).map(|i| (i.width, i.height)), Some((100, 50))); + assert_eq!(rasterize_vector("art.ai", &pdf, &footage, 0.5).and_then(|r| r.ok()).map(|i| (i.width, i.height)), Some((100, 50))); footage.placed_page = true; let img = decode("art.ai", &pdf, &footage, op).unwrap().unwrap(); @@ -226,7 +243,7 @@ mod tests { assert!(is_blue(img.get(x, y)), "blue at ({x}, {y}): {:?}", img.get(x, y)); } - let sharp = rasterize_vector("art.ai", &pdf, &footage, 2.0).unwrap(); + let sharp = rasterize_vector("art.ai", &pdf, &footage, 2.0).unwrap().unwrap(); assert_eq!((sharp.width, sharp.height), (200, 160)); assert!(is_red(sharp.get(50, 155)) && is_blue(sharp.get(150, 155))); // Placed at the page's own size: 1:1. diff --git a/crates/media/src/lib.rs b/crates/media/src/lib.rs index 0b509c45f..454c3705f 100644 --- a/crates/media/src/lib.rs +++ b/crates/media/src/lib.rs @@ -33,7 +33,7 @@ mod webp_anim; /// Video decoder counters (time in decoders, samples decoded, seeks, cache hits), for benchmarks. pub use filmcraft_codecs::{GopStats, gop_stats}; pub use pool::{DEFAULT_BUDGET, MediaPool, PoolStats}; -pub use probe::{DEFAULT_SEQUENCE_RATE, probe, probe_bytes, probe_model}; +pub use probe::{DEFAULT_SEQUENCE_RATE, probe, probe_bytes, probe_model, probe_noting}; /// Errors from probing or decoding footage. #[derive(Debug, thiserror::Error)] diff --git a/crates/media/src/pool.rs b/crates/media/src/pool.rs index e35ff37fc..f5d109797 100644 --- a/crates/media/src/pool.rs +++ b/crates/media/src/pool.rs @@ -1011,6 +1011,8 @@ impl Inner { crate::exr_channels::count_decode(false); match crate::probe::load_oriented(&bytes, crate::still_format(path, &bytes)) { Ok(img) => Ok(dynamic_to_image(&img, op)), + // Over the size limit: the layered fallback would allocate its planes anyway. + Err(e @ image::ImageError::Limits(_)) => Err(MediaError::Decode(format!("{path}: {e}"))), // A multi-layer OpenEXR file without an unnamed RGB layer: its colour layer. Err(e) => crate::exr_channels::layered_picture(path, bytes, &file, op, shared) .map_err(|why| MediaError::Decode(format!("{path}: {}", why.unwrap_or_else(|| e.to_string())))), @@ -1108,7 +1110,7 @@ impl FootageSource for MediaPool { } fn problem(&self, footage: &Footage) -> Option { - if footage.missing || footage.kind != FootageKind::Video { + if footage.missing || (footage.kind != FootageKind::Video && !effectcraft_render::is_vector_footage(footage)) { return None; } lock(&self.inner.problems).get(footage.path.as_str()).cloned() @@ -1119,7 +1121,19 @@ impl FootageSource for MediaPool { return None; } let bytes = self.inner.read(&footage.path).ok()?; - crate::layered::rasterize_vector(&footage.path, &bytes, footage, scale).map(Arc::new) + let path: Arc = footage.path.as_str().into(); + match crate::layered::rasterize_vector(&footage.path, &bytes, footage, scale)? { + Ok(img) => { + lock(&self.inner.problems).remove(&path); + Some(Arc::new(img)) + } + // Refused by a render budget (a layer scaled too far): no frame, with the reason + // reported through `problem` rather than showing a partial image as complete. + Err(e) => { + self.inner.note_problem(&path, "", &e); + None + } + } } fn set_aux_footage(&self, paths: &[String]) { diff --git a/crates/media/src/probe.rs b/crates/media/src/probe.rs index 1fc945aa1..194eebc47 100644 --- a/crates/media/src/probe.rs +++ b/crates/media/src/probe.rs @@ -9,6 +9,15 @@ use image::metadata::Orientation; use crate::{MediaError, Result, ext_of, rate_from_fc}; +/// Most pixels a still may decode to: 4 GiB as the renderer's float RGBA (2^28, 16384 × 16384; +/// 150-megapixel medium-format frames, stitched panoramas and large scans decode). A browser tab's +/// wasm32 heap can't hold one allocation that large (and the decoded input beside it): 512 MiB +/// there, and on 32-bit targets, where one allocation may not pass `isize::MAX` (2 GiB). +#[cfg(not(any(target_arch = "wasm32", target_pointer_width = "32")))] +pub(crate) const MAX_STILL_PIXELS: u64 = 1 << 28; +#[cfg(any(target_arch = "wasm32", target_pointer_width = "32"))] +pub(crate) const MAX_STILL_PIXELS: u64 = 1 << 25; + /// Frame rate given to image sequences on import (After Effects' default preference). pub const DEFAULT_SEQUENCE_RATE: FrameRate = FrameRate::FPS_30; @@ -43,11 +52,25 @@ fn side_file_reader(model: &Path) -> impl Fn(&str) -> Option> + use<> { } } +thread_local! { + /// What the last model probed on this thread left out (see [`probe_noting`]). + static MODEL_WARNING: std::cell::RefCell> = const { std::cell::RefCell::new(None) }; +} + +/// [`probe`], and what the import left out of the file (a 3D model's textures over the limits), +/// for the user. +pub fn probe_noting(path: impl AsRef) -> Result<(Footage, Option)> { + MODEL_WARNING.with(|w| w.borrow_mut().take()); + let f = probe(path)?; + Ok((f, MODEL_WARNING.with(|w| w.borrow_mut().take()))) +} + /// Probe a 3D model (glTF 2.0 / OBJ / STL / FBX): a [`FootageKind::Model`] item whose duration is its /// longest animation. `resolve` reads sibling resources. pub fn probe_model(path: &str, bytes: &[u8], resolve: &dyn Fn(&str) -> Option>) -> Result { let m = effectcraft_model::load(path, bytes, resolve).map_err(|e| MediaError::Decode(format!("{path}: {e}")))?; let s = m.summary(); + MODEL_WARNING.with(|w| *w.borrow_mut() = (!m.warnings.is_empty()).then(|| format!("{path}: {}", m.warnings.join("; ")))); let dur = s.animations.iter().map(|a| a.1).fold(0.0f64, f64::max); let codec = match effectcraft_model::format_of(path) { Some("obj") => "OBJ", @@ -134,12 +157,12 @@ fn trim_to_edits(f: &mut Footage, shown: Option) { /// How long the video track's edit list shows its media (`elst` segments, movie timescale): /// `None` without edits, or with an empty edit (a delayed start keeps the reader's duration). fn video_shown(bytes: &[u8]) -> Option { - let file = filmcraft_isobmff::open(bytes).ok()?; - let t = file.tracks.iter().find(|t| t.kind == filmcraft_isobmff::TrackKind::Video && !t.samples.is_empty())?; + let file = craft_media::isobmff::open(bytes).ok()?; + let t = file.tracks.iter().find(|t| t.kind == craft_media::isobmff::TrackKind::Video && !t.samples.is_empty())?; edits_shown(&t.edits, file.timescale) } -fn edits_shown(edits: &[filmcraft_isobmff::Edit], timescale: u32) -> Option { +fn edits_shown(edits: &[craft_media::isobmff::Edit], timescale: u32) -> Option { if edits.is_empty() || timescale == 0 || edits.iter().any(|e| e.media_time < 0) { return None; } @@ -291,6 +314,12 @@ pub(crate) fn load_oriented(bytes: &[u8], fmt: Option) -> im None => image::ImageReader::new(std::io::Cursor::new(bytes)).with_guessed_format()?, }; let mut dec = reader.into_decoder()?; + // `from_decoder` skips the reader's allocation limit, and some decoders (BMP) allocate + // whatever size their header claims: refuse a still the renderer could not hold as floats. + let (w, h) = dec.dimensions(); + if u64::from(w) * u64::from(h) > MAX_STILL_PIXELS { + return Err(image::ImageError::Limits(image::error::LimitError::from_kind(image::error::LimitErrorKind::DimensionError))); + } let orientation = dec.orientation().unwrap_or(Orientation::NoTransforms); let mut img = image::DynamicImage::from_decoder(dec)?; img.apply_orientation(orientation); @@ -303,8 +332,8 @@ pub(crate) fn load_oriented(bytes: &[u8], fmt: Option) -> im /// containers have none. FilmCraft turns the frames of a pure 0/90/180/270° header itself, so this /// is only the quarter turn nearest to a header it does not turn. pub(crate) fn video_turn(bytes: &[u8]) -> Orientation { - let Ok(file) = filmcraft_isobmff::open(bytes) else { return Orientation::NoTransforms }; - let Some(track) = file.tracks.iter().find(|t| t.kind == filmcraft_isobmff::TrackKind::Video) else { + let Ok(file) = craft_media::isobmff::open(bytes) else { return Orientation::NoTransforms }; + let Some(track) = file.tracks.iter().find(|t| t.kind == craft_media::isobmff::TrackKind::Video) else { return Orientation::NoTransforms; }; // A pure rotation is already applied by FilmCraft's decoder (frames and size come out @@ -329,8 +358,8 @@ pub(crate) fn video_turn(bytes: &[u8]) -> Orientation { /// median reads as 30.303 or 58.824 fps. `None` for other containers and for movies the median /// reads right. fn video_rate(bytes: &[u8]) -> Option { - let file = filmcraft_isobmff::open(bytes).ok()?; - let t = file.tracks.iter().find(|t| t.kind == filmcraft_isobmff::TrackKind::Video && !t.samples.is_empty())?; + let file = craft_media::isobmff::open(bytes).ok()?; + let t = file.tracks.iter().find(|t| t.kind == craft_media::isobmff::TrackKind::Video && !t.samples.is_empty())?; averaged_rate(t.timescale, t.samples.iter().take(240).map(|s| s.duration)) } @@ -364,11 +393,28 @@ fn averaged_rate(timescale: u32, durations: impl Iterator) -> Option mod tests { use super::*; + #[test] + fn a_still_larger_than_the_renderer_holds_is_refused_before_decoding() { + // A 24-bit BMP header claiming 20000×20000 pixels (within the BMP decoder's own limit) + // over no pixel data. + let mut bmp = b"BM".to_vec(); + bmp.extend(54u32.to_le_bytes()); + bmp.extend([0u8; 4]); + bmp.extend(54u32.to_le_bytes()); + bmp.extend(40u32.to_le_bytes()); + bmp.extend(20_000i32.to_le_bytes()); + bmp.extend(20_000i32.to_le_bytes()); + bmp.extend(1u16.to_le_bytes()); + bmp.extend(24u16.to_le_bytes()); + bmp.extend([0u8; 24]); + assert!(matches!(load_oriented(&bmp, Some(image::ImageFormat::Bmp)), Err(image::ImageError::Limits(_)))); + } + /// #2592: an encoder-delayed H.264 track's edit list shows 75 frames at 25 fps (3 s at a /// 1000 timescale), though its media runs a frame longer; empty edits and no edits leave it. #[test] fn the_edit_list_trims_a_movie_to_the_frames_it_shows() { - let edit = |segment_duration, media_time| filmcraft_isobmff::Edit { segment_duration, media_time, media_rate: 0x0001_0000 }; + let edit = |segment_duration, media_time| craft_media::isobmff::Edit { segment_duration, media_time, media_rate: 0x0001_0000 }; let shown = edits_shown(&[edit(3000, 1024)], 1000); assert_eq!(shown, Some(Tick::from_units(3, 1))); let mut f = Footage { kind: FootageKind::Video, duration: Tick::from_units(76, 25), ..Footage::default() }; @@ -455,4 +501,21 @@ mod tests { assert_eq!(averaged_rate(u32::MAX, [u32::MAX; 300].into_iter()), None); assert_eq!(video_rate(b"not a movie"), None); } + + /// A 150-megapixel still (a medium-format frame) is not refused for its size: only its (absent) + /// pixel data fails, not the dimension check. A still past the limit is. + #[cfg(not(any(target_arch = "wasm32", target_pointer_width = "32")))] + #[test] + fn stills_up_to_the_limit_pass_the_size_check() { + let bmp = |w: u32, h: u32| { + let mut b = vec![b'B', b'M', 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, 0]; + b.extend_from_slice(&w.to_le_bytes()); + b.extend_from_slice(&h.to_le_bytes()); + b.extend_from_slice(&[1, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + b + }; + let limit = |e: image::ImageError| matches!(e, image::ImageError::Limits(_)); + assert!(!load_oriented(&bmp(14_000, 10_800), None).err().is_some_and(limit), "150 MP passes the check"); + assert!(load_oriented(&bmp(20_000, 20_000), None).err().is_some_and(limit), "400 MP is refused"); + } } diff --git a/crates/media/src/webp_anim.rs b/crates/media/src/webp_anim.rs index 9420be1ed..147fe8264 100644 --- a/crates/media/src/webp_anim.rs +++ b/crates/media/src/webp_anim.rs @@ -23,7 +23,7 @@ pub(crate) const CODEC: &str = "WebP"; /// Whether `bytes` start like a WebP file. pub(crate) fn is_webp(bytes: &[u8]) -> bool { - bytes.get(0..4) == Some(b"RIFF") && bytes.get(8..12) == Some(b"WEBP") + craft_webp::is_webp(bytes) } /// What the chunk headers of an animated WebP say. @@ -35,46 +35,11 @@ struct Header { delays: Vec, } -fn u24(b: &[u8]) -> Option { - match b { - [a, b, c, ..] => Some(u32::from(*a) | u32::from(*b) << 8 | u32::from(*c) << 16), - _ => None, - } -} - /// Read the `VP8X` header and the `ANMF` frame headers. `None` when the file isn't an animated /// WebP. A truncated tail keeps the frames before it. fn header(bytes: &[u8]) -> Option
{ - if !is_webp(bytes) { - return None; - } - let riff = bytes.get(4..8).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes)?; - let end = usize::try_from(riff).ok()?.saturating_add(8).min(bytes.len()); - let (mut at, mut canvas, mut delays) = (12usize, None, Vec::new()); - while delays.len() < MAX_FRAMES { - let Some(head) = bytes.get(at..at.saturating_add(8)).filter(|_| at.saturating_add(8) <= end) else { break }; - let size = head.get(4..8).and_then(|b| b.try_into().ok()).map(u32::from_le_bytes)?; - let size = usize::try_from(size).ok()?; - let body_end = at.saturating_add(8).saturating_add(size); - let Some(body) = bytes.get(at.saturating_add(8)..body_end).filter(|_| body_end <= end) else { break }; - match head.get(0..4) { - Some(b"VP8X") => { - let flags = *body.first()?; - if flags & 0x02 == 0 { - // No animation flag: a still. - return None; - } - let w = u24(body.get(4..)?)?.saturating_add(1); - let h = u24(body.get(7..)?)?.saturating_add(1); - canvas = Some((w, h, flags & 0x10 != 0)); - } - Some(b"ANMF") if body.len() >= 16 => delays.push(u24(body.get(12..)?)?), - _ => {} - } - at = body_end.saturating_add(size & 1); - } - let (width, height, alpha) = canvas?; - Some(Header { width, height, alpha, delays }) + let info = craft_webp::scan(bytes, MAX_FRAMES).filter(|i| i.animated)?; + Some(Header { width: info.width, height: info.height, alpha: info.alpha, delays: info.frames.iter().map(|f| f.duration_ms).collect() }) } /// The delay of a frame in milliseconds. Browsers show delays of 10 ms or less (that encoders @@ -157,6 +122,11 @@ pub(crate) fn load(bytes: &[u8]) -> Result { return Err(MediaError::Unsupported(format!("animated WebP of {} frames of {}×{} is too large to hold in memory", h.delays.len(), h.width, h.height))); } let dec = WebPDecoder::new(Cursor::new(bytes)).map_err(|e| MediaError::Decode(format!("WebP: {e}")))?; + // The budget above used the canvas this file's header scan found; the decoder must agree, or + // a second VP8X header could make it allocate a far larger canvas. + if image::ImageDecoder::dimensions(&dec) != (h.width, h.height) { + return Err(MediaError::Decode("WebP: conflicting canvas sizes".into())); + } let (mut frames, mut delays, mut size) = (Vec::new(), Vec::new(), 0usize); for frame in dec.into_frames() { let frame = match frame { @@ -326,4 +296,20 @@ mod tests { let e = super::load(&bytes).err().unwrap(); assert!(e.to_string().contains("too large"), "{e}"); } + + #[test] + fn conflicting_canvas_headers_are_refused() { + // The first VP8X claims 16384×16384; a second one, which the header scan keeps, 1×1. + let mut bytes = webp(1, 1, &[(RED, 50); 2]); + bytes[24..27].copy_from_slice(&u24(16383)); + bytes[27..30].copy_from_slice(&u24(16383)); + let mut small = vec![0x12, 0, 0, 0]; + small.extend_from_slice(&u24(0)); + small.extend_from_slice(&u24(0)); + let second = chunk(b"VP8X", &small); + bytes.splice(30..30, second.iter().copied()); + let riff = u32::try_from(bytes.len() - 8).unwrap(); + bytes[4..8].copy_from_slice(&riff.to_le_bytes()); + assert!(super::load(&bytes).is_err()); + } } diff --git a/crates/media/tests/it/aac_layout.rs b/crates/media/tests/it/aac_layout.rs index fb3e078a6..896e4f0a7 100644 --- a/crates/media/tests/it/aac_layout.rs +++ b/crates/media/tests/it/aac_layout.rs @@ -1,5 +1,5 @@ //! Multichannel AAC reaches stereo by where each channel plays, whatever order its channel -//! configuration decodes in (#1701). Fixtures are tones encoded with FilmCraft's AAC encoder (no +//! configuration decodes in (#1701). Fixtures are tones encoded with craft-audio's AAC encoder (no //! ffmpeg needed, so nothing is skipped), with the configuration rewritten where the coded //! elements fit another: configurations 11 and 12 code the same elements as the encoder's 7- and //! 8-channel output, and a program config element can name any of them. @@ -9,9 +9,9 @@ use std::io::Cursor; use std::path::PathBuf; use std::sync::Arc; +use craft_audio::aac::{AudioSpecificConfig, Encoder, EncoderConfig, ProgramConfig}; use effectcraft_media::{MediaPool, probe, probe_bytes}; use effectcraft_time::Tick; -use filmcraft_aac::{AudioSpecificConfig, Encoder, EncoderConfig, ProgramConfig}; const RATE: u32 = 48_000; /// Tone frequencies by channel; an LFE gets [`LFE_TONE`], which its element can carry. @@ -61,7 +61,9 @@ fn lc(config: u8) -> Option { fn pce(front: Vec<(bool, u8)>, side: Vec<(bool, u8)>, back: Vec<(bool, u8)>, lfe: Vec, comment: &[u8]) -> Option { let pce = ProgramConfig { object_type: 1, sf_index: 3, front, side, back, lfe, comment: comment.to_vec(), ..Default::default() }; - Some(AudioSpecificConfig { pce: Some(pce), ..AudioSpecificConfig::lc(3, 0) }) + let mut asc = AudioSpecificConfig::lc(3, 0); + asc.pce = Some(pce); + Some(asc) } use Ch::*; @@ -115,7 +117,7 @@ fn mp4(asc: Vec, channels: u32, units: &[Vec]) -> Vec { /// As [`mp4`], after an audio track with the configuration and channel count `empty` and no /// samples, if any. fn mp4_after(empty: Option<(Vec, u32)>, asc: Vec, channels: u32, units: &[Vec]) -> Vec { - use filmcraft_isobmff::{Brand, Mp4Writer, SampleEntry, TrackConfig, WriteSample, WriterOptions}; + use craft_media::isobmff::{Brand, Mp4Writer, SampleEntry, TrackConfig, WriteSample, WriterOptions}; let mut w = Mp4Writer::new(Cursor::new(Vec::new()), WriterOptions::new(Brand::Mp4)).expect("writer"); if let Some((asc, channels)) = empty { w.add_track(TrackConfig::new(SampleEntry::aac(asc, channels, RATE), RATE)).expect("empty track"); @@ -134,7 +136,7 @@ fn mkv(asc: Vec, channels: u32, units: &[Vec]) -> Vec { /// As [`mkv`], after an audio track with the configuration and channel count `empty` and no /// frames, if any. fn mkv_after(empty: Option<(Vec, u32)>, asc: Vec, channels: u32, units: &[Vec]) -> Vec { - use filmcraft_matroska::{MkvWriter, MuxOptions, TrackKind, TrackSpec}; + use craft_media::matroska::{MkvWriter, MuxOptions, TrackKind, TrackSpec}; let track = |asc: Vec, channels: u32| { let mut t = TrackSpec::new(TrackKind::Audio, "A_AAC"); t.codec_private = asc; @@ -210,7 +212,7 @@ fn lfe_is_coded(case: &Case, bytes: Vec) { fn every_aac_layout_mixes_by_speaker_in_mp4() { for case in cases() { let (asc, units) = encode(case.content, false); - let asc = case.asc.as_ref().map_or(asc, AudioSpecificConfig::to_bytes); + let asc = case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")); let bytes = mp4(asc, case.content.len() as u32, &units); lfe_is_coded(&case, bytes.clone()); let p = write(&format!("{}.mp4", case.name), &bytes); @@ -227,7 +229,7 @@ fn every_aac_layout_mixes_by_speaker_in_mp4() { fn matroska_aac_layouts_mix_by_speaker() { for case in cases().into_iter().filter(|c| matches!(c.name, "config12" | "pce61-centre-first" | "pce61-ffmpeg")) { let (asc, units) = encode(case.content, false); - let asc = case.asc.as_ref().map_or(asc, AudioSpecificConfig::to_bytes); + let asc = case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")); let p = write(&format!("{}.mkv", case.name), &mkv(asc, case.content.len() as u32, &units)); check(case.name, case.content, &mix(&MediaPool::new(), &probe(&p).expect("probe"))); } @@ -251,9 +253,9 @@ fn an_empty_audio_track_lends_its_configuration_to_no_other() { for (name, empty) in [("config12", 7), ("pce61-centre-first", 11)] { let case = cases().into_iter().find(|c| c.name == name).expect("case"); let n = case.content.len() as u32; - let empty = Some((AudioSpecificConfig::lc(3, empty).to_bytes(), n)); + let empty = Some((AudioSpecificConfig::lc(3, empty).to_bytes().expect("ASC"), n)); let (asc, units) = encode(case.content, false); - let asc = case.asc.as_ref().map_or(asc, AudioSpecificConfig::to_bytes); + let asc = case.asc.as_ref().map_or(asc, |a| a.to_bytes().expect("ASC")); let p = write(&format!("{name}-after-empty.mp4"), &mp4_after(empty.clone(), asc.clone(), n, &units)); check(&format!("{name} MP4"), case.content, &mix(&MediaPool::new(), &probe(&p).expect("probe"))); let p = write(&format!("{name}-after-empty.mkv"), &mkv_after(empty, asc, n, &units)); diff --git a/crates/media/tests/it/downmix.rs b/crates/media/tests/it/downmix.rs index 05205ab6a..f974c6cb0 100644 --- a/crates/media/tests/it/downmix.rs +++ b/crates/media/tests/it/downmix.rs @@ -174,7 +174,7 @@ fn each_channel_reaches_stereo_at_its_bs775_gain() { fn whole_pce_entry(p: &Path, channels: usize) -> PathBuf { let mut bytes = std::fs::read(p).expect("read"); let Some((asc, 2)) = aac_entry(&bytes) else { return p.to_path_buf() }; - if channels <= 2 || filmcraft_aac::AudioSpecificConfig::parse(&asc).map(|a| a.channel_config).ok() != Some(0) { + if channels <= 2 || craft_audio::aac::AudioSpecificConfig::parse(&asc).map(|a| a.channel_config).ok() != Some(0) { return p.to_path_buf(); } // the `mp4a` entry's channelcount follows its 6 reserved bytes, data reference index and @@ -189,9 +189,9 @@ fn whole_pce_entry(p: &Path, channels: usize) -> PathBuf { /// The AudioSpecificConfig and sample entry channel count of an MP4's first AAC track. fn aac_entry(bytes: &[u8]) -> Option<(Vec, u32)> { - let file = filmcraft_isobmff::open(bytes).ok()?; + let file = craft_media::isobmff::open(bytes).ok()?; file.tracks.iter().flat_map(|t| &t.entries).find_map(|e| match &e.codec { - filmcraft_isobmff::CodecConfig::Aac(a) => Some((a.asc.clone(), e.audio.as_ref()?.channels)), + craft_media::isobmff::CodecConfig::Aac(a) => Some((a.asc.clone(), e.audio.as_ref()?.channels)), _ => None, }) } diff --git a/crates/media/tests/it/file_timecode.rs b/crates/media/tests/it/file_timecode.rs index e5cbfa92d..dae3335ba 100644 --- a/crates/media/tests/it/file_timecode.rs +++ b/crates/media/tests/it/file_timecode.rs @@ -2,8 +2,8 @@ use std::io::Cursor; +use craft_media::isobmff::{Brand, Mp4Writer, SampleEntry, TimecodeConfig, TrackConfig, WriteSample, WriterOptions}; use effectcraft_project::FootageKind; -use filmcraft_isobmff::{Brand, Mp4Writer, SampleEntry, TimecodeConfig, TrackConfig, WriteSample, WriterOptions}; /// A two-frame 24 fps Motion JPEG MOV, with a timecode track from `start_frame` when given. fn mov(start_frame: Option) -> Vec { diff --git a/crates/media/tests/it/footage.rs b/crates/media/tests/it/footage.rs index 7f0de6ae4..ed152541c 100644 --- a/crates/media/tests/it/footage.rs +++ b/crates/media/tests/it/footage.rs @@ -747,8 +747,8 @@ fn sequence_gaps_hold_the_previous_frame() { /// parallax project's 21120-px plates were decoded and resampled for every frame at Quarter). #[test] fn stills_at_reduced_sizes_are_resampled_once() { - let dir = std::env::temp_dir().join(format!("ec-still-size-{}", std::process::id())); - std::fs::create_dir_all(&dir).expect("temp dir"); + let guard = tempfile::tempdir().expect("temp dir"); + let dir = guard.path().to_path_buf(); let p = dir.join("plate.png"); let px = |x: u32, y: u32| { image::Rgba([(x * 7 % 256) as u8, (y * 13 % 256) as u8, ((x ^ y) % 256) as u8, if (x + y).is_multiple_of(5) { 0 } else { 255 - (x % 128) as u8 }]) diff --git a/crates/model/Cargo.toml b/crates/model/Cargo.toml index ebe7da7e8..1dfa79430 100644 --- a/crates/model/Cargo.toml +++ b/crates/model/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "effectcraft-model" -description = "3D models: glTF 2.0 (.gltf/.glb), Wavefront OBJ/MTL, STL and FBX 7.x (binary and ASCII) import, PBR metallic-roughness materials, node hierarchy, skinning and animation, parametric primitives, and extruded/bevelled outline meshes" +description = "3D models: glTF 2.0 (.gltf/.glb), Wavefront OBJ/MTL, STL and FBX 6.x/7.x (binary and ASCII) import through craft-mesh, PBR metallic-roughness materials, node hierarchy, skinning and animation, parametric primitives, and extruded/bevelled outline meshes" version.workspace = true edition.workspace = true license.workspace = true @@ -10,10 +10,9 @@ rust-version.workspace = true workspace = true [dependencies] +craft-mesh = { workspace = true } effectcraft-geom = { workspace = true } serde = { workspace = true } -serde_json = { workspace = true } thiserror = { workspace = true } log = { workspace = true } image = { workspace = true } -miniz_oxide = "0.9" diff --git a/crates/model/src/extrude.rs b/crates/model/src/extrude.rs index 114606b95..71d550367 100644 --- a/crates/model/src/extrude.rs +++ b/crates/model/src/extrude.rs @@ -96,10 +96,14 @@ fn point_in(p: P, c: &[P]) -> bool { inside } +/// Most contours grouped into outlines; containment is tested pairwise, so the smallest are dropped. +pub const MAX_CONTOURS: usize = 10_000; + /// Group closed contours into outlines by nesting depth (even depth = outer, odd = hole of the -/// innermost containing outer contour). Degenerate contours are dropped. +/// innermost containing outer contour). Degenerate contours are dropped, as are the smallest +/// past [`MAX_CONTOURS`] (a kept hole always keeps its larger container). pub fn group_contours(contours: Vec>) -> Vec { - let cs: Vec> = contours + let mut cs: Vec> = contours .into_iter() .map(|mut c| { c.dedup(); @@ -110,26 +114,60 @@ pub fn group_contours(contours: Vec>) -> Vec { }) .filter(|c| c.len() >= 3 && signed_area(c).abs() > 1e-9) .collect(); + if cs.len() > MAX_CONTOURS { + log::warn!("model: {} contours, grouping the {MAX_CONTOURS} largest", cs.len()); + // Keep the largest, in their original order. + let area: Vec = cs.iter().map(|c| signed_area(c).abs()).collect(); + let mut keep: Vec = (0..cs.len()).collect(); + keep.sort_by(|&a, &b| area[b].total_cmp(&area[a])); + keep.truncate(MAX_CONTOURS); + keep.sort_unstable(); + cs = keep.into_iter().map(|i| std::mem::take(&mut cs[i])).collect(); + } let n = cs.len(); let area: Vec = cs.iter().map(|c| signed_area(c).abs()).collect(); - // Containers of each contour (by a vertex inside; nested contours do not cross). - let parents: Vec> = (0..n) + let bounds: Vec<[P; 2]> = cs + .iter() + .map(|c| c.iter().fold([[f64::MAX; 2], [f64::MIN; 2]], |[lo, hi], p| [[lo[0].min(p[0]), lo[1].min(p[1])], [hi[0].max(p[0]), hi[1].max(p[1])]])) + .collect(); + // The containers of each contour: the larger contours holding a vertex of it (nested contours + // do not cross); the bounding box must hold the vertex first. Depth is their count, so + // overlapping (non-nested) paths keep every container they sit inside. + let containers = |i: usize, only: &dyn Fn(usize) -> bool| -> Vec { + let p = cs[i][0]; + (0..n) + .filter(|&j| j != i && area[j] > area[i] && only(j)) + .filter(|&j| (bounds[j][0][0]..=bounds[j][1][0]).contains(&p[0]) && (bounds[j][0][1]..=bounds[j][1][1]).contains(&p[1])) + .filter(|&j| point_in(p, &cs[j])) + .collect() + }; + let depth: Vec = (0..n).map(|i| containers(i, &|_| true).len()).collect(); + // A hole belongs to the innermost containing contour that is itself an outline: with + // overlapping paths the smallest container can be a hole, which has no outline to take it. + let parent: Vec> = (0..n) .map(|i| { - let probe = cs[i][0]; - (0..n).filter(|&j| j != i && area[j] > area[i] && point_in(probe, &cs[j])).collect() + if depth[i].is_multiple_of(2) { + None + } else { + containers(i, &|j| depth[j].is_multiple_of(2)).into_iter().min_by(|&a, &b| area[a].total_cmp(&area[b])) + } }) .collect(); let mut outlines: Vec = vec![]; let mut slot = vec![usize::MAX; n]; let mut order: Vec = (0..n).collect(); - order.sort_by_key(|&i| parents[i].len()); - for i in order { - let depth = parents[i].len(); - if depth.is_multiple_of(2) { + order.sort_by_key(|&i| depth[i]); + // Every outline gets its slot before any hole is attached: with overlapping paths a hole's + // parent can be deeper than the hole itself. + for &i in &order { + if depth[i].is_multiple_of(2) { slot[i] = outlines.len(); outlines.push(Outline { outer: cs[i].clone(), holes: vec![] }); - } else if let Some(&p) = parents[i].iter().filter(|&&j| parents[j].len() == depth - 1).min_by(|&&a, &&b| area[a].total_cmp(&area[b])) - && slot[p] != usize::MAX + } + } + for &i in &order { + if !depth[i].is_multiple_of(2) + && let Some(p) = parent[i] { outlines[slot[p]].holes.push(cs[i].clone()); } diff --git a/crates/model/src/fbx.rs b/crates/model/src/fbx.rs index bca387ff2..fead03b21 100644 --- a/crates/model/src/fbx.rs +++ b/crates/model/src/fbx.rs @@ -1,953 +1,34 @@ -//! FBX 7.x scenes, binary and ASCII. -//! -//! Written from public descriptions of the format (the binary node-record layout, the ASCII -//! syntax, and the scene objects of the Autodesk FBX SDK documentation): no importer source was -//! read. -//! -//! - **Binary**: the `Kaydara FBX Binary` header and version, node records with 32-bit (before -//! 7.5) or 64-bit offsets, every property type (`Y C I F D L S R` and the `f d l i b` arrays, -//! zlib-compressed or not). Object names `Name\0\x01Class` become `Class::Name` as in ASCII. -//! - **ASCII**: `Key: value, value { children }` with `;` comments and `*N { a: … }` arrays. -//! - **Scene**: `Geometry` meshes (`Vertices`, `PolygonVertexIndex` polygons fan-triangulated, -//! the first `LayerElementNormal`, `LayerElementUV` and `LayerElementMaterial` with every -//! mapping and reference mode), `Model` nodes with the SDK transform (translation, rotation -//! offset and pivot, pre/post rotation, Euler rotation in its order, scaling offset and pivot, -//! scaling) and geometric transforms, `Material` (Lambert/Phong mapped onto -//! metallic-roughness), `Texture` and `Video` (embedded or relative image files), joined by -//! `Connections`. `GlobalSettings` axes turn the scene to +Y up. -//! -//! Not imported: FBX 6.x and older, animation stacks, skin deformers, blend shapes, cameras and -//! lights, NURBS and patches. Units stay the file's own (like OBJ). +//! FBX 6.x and 7.x scenes, binary and ASCII, read with `craft-mesh` (`craft_mesh::fbx`): +//! `Geometry` meshes, `Model` nodes with the SDK transform and geometric transforms, `Material` +//! (Lambert/Phong mapped onto metallic-roughness), embedded or relative `Texture` images, +//! joined by `Connections`. A root node turns the file's `GlobalSettings` axes to +Y up; units +//! stay the file's own (like OBJ). Meshes without normals get smooth ones. -use std::collections::HashMap; -use std::sync::Arc; +use crate::scene::{MissingNormals, error, limits, mat4, to_model}; +use crate::{Model, ModelError, Node, Result}; -use crate::obj::srgb_to_linear; -use crate::{AlphaMode, Mat4, Material, Mesh, Model, ModelError, Node, Primitive, Result, TexRef, Texture, perr, vec3}; +pub use craft_mesh::fbx::BINARY_MAGIC; -/// The binary file's magic (`Kaydara FBX Binary`, two spaces, NUL, 0x1A, 0x00). -pub const BINARY_MAGIC: &[u8] = b"Kaydara FBX Binary \0\x1a\0"; - -/// Deepest node nesting accepted (real files nest well under 10 levels). -const MAX_DEPTH: usize = 64; -/// Largest decoded array accepted (bytes). -const MAX_ARRAY_BYTES: usize = 1 << 30; -/// Most memory one import may keep: parsed arrays as stored (8 bytes per element, whatever the -/// wire type) plus the meshes built from them (#1234). -const MAX_IMPORT_BYTES: usize = 1 << 31; - -/// What is left of an import's memory budget. -struct Budget(std::cell::Cell); - -impl Budget { - fn new(bytes: usize) -> Budget { - Budget(std::cell::Cell::new(bytes)) - } - /// Take `bytes` (None: a size that overflowed) from the budget, or fail the import before - /// anything that large is allocated. - fn take(&self, bytes: Option, what: &str) -> Result<()> { - let left = self.0.get(); - match bytes.filter(|&b| b <= left) { - Some(b) => { - self.0.set(left - b); - Ok(()) - } - None => Err(perr(format!("FBX: {what} would take the import past its {} MiB memory limit", MAX_IMPORT_BYTES >> 20))), - } - } -} - -/// Bytes a mesh keeps. -fn mesh_bytes(m: &Mesh) -> Option { - m.primitives.iter().try_fold(0usize, |acc, p| { - let n = p.positions.len().checked_mul(12)?.checked_add(p.normals.len().checked_mul(12)?)?.checked_add(p.uvs.len().checked_mul(8)?)?; - let n = n.checked_add(p.tangents.len().checked_mul(16)?)?.checked_add(p.joints.len().checked_mul(8)?)?.checked_add(p.weights.len().checked_mul(16)?)?; - acc.checked_add(n)?.checked_add(p.indices.len().checked_mul(4)?) - }) -} - -/// Bytes the values under `nodes` keep. Used for ASCII files, which hold array elements as -/// one `Prop` each and are parsed before they can be counted (the text itself bounds them). -fn value_bytes(nodes: &[FbxNode]) -> Option { - nodes.iter().try_fold(0usize, |acc, n| { - let own = n.props.iter().try_fold(0usize, |a, p| { - let extra = match p { - Prop::Ints(v) => v.len().checked_mul(8)?, - Prop::Floats(v) => v.len().checked_mul(8)?, - Prop::Str(v) => v.len(), - Prop::Bytes(v) => v.len(), - Prop::Int(_) | Prop::Float(_) => 0, - }; - a.checked_add(std::mem::size_of::())?.checked_add(extra) - })?; - acc.checked_add(own)?.checked_add(value_bytes(&n.children)?) - }) -} - -/// One property value of an FBX node. -#[derive(Clone, Debug, PartialEq)] -pub enum Prop { - Int(i64), - Float(f64), - Str(String), - Bytes(Vec), - Ints(Vec), - Floats(Vec), -} - -impl Prop { - fn as_f64(&self) -> Option { - match self { - Prop::Int(i) => Some(*i as f64), - Prop::Float(f) => Some(*f), - _ => None, - } - } - fn as_i64(&self) -> Option { - match self { - Prop::Int(i) => Some(*i), - Prop::Float(f) if f.is_finite() => Some(*f as i64), - _ => None, - } - } - fn as_str(&self) -> Option<&str> { - match self { - Prop::Str(s) => Some(s), - _ => None, - } - } -} - -/// A node of the FBX document tree (the same for binary and ASCII files). -#[derive(Clone, Debug, Default, PartialEq)] -pub struct FbxNode { - pub name: String, - pub props: Vec, - pub children: Vec, -} - -impl FbxNode { - pub fn child(&self, name: &str) -> Option<&FbxNode> { - self.children.iter().find(|c| c.name == name) - } - pub fn children_named<'a>(&'a self, name: &'a str) -> impl Iterator + 'a { - self.children.iter().filter(move |c| c.name == name) - } - fn prop(&self, i: usize) -> Option<&Prop> { - self.props.get(i) - } - fn str_at(&self, i: usize) -> Option<&str> { - self.prop(i).and_then(Prop::as_str) - } - /// The node's array as floats: a binary array property, an ASCII `a:` child, or the plain - /// value list. - pub fn floats(&self) -> Vec { - if let Some(a) = self.child("a") { - return a.floats(); - } - let mut out = vec![]; - for p in &self.props { - match p { - Prop::Floats(v) => out.extend_from_slice(v), - Prop::Ints(v) => out.extend(v.iter().map(|&i| i as f64)), - Prop::Int(i) => out.push(*i as f64), - Prop::Float(f) => out.push(*f), - _ => {} - } - } - out - } - /// The node's array as integers (see [`FbxNode::floats`]). - pub fn ints(&self) -> Vec { - if let Some(a) = self.child("a") { - return a.ints(); - } - let mut out = vec![]; - for p in &self.props { - match p { - Prop::Ints(v) => out.extend_from_slice(v), - Prop::Floats(v) => out.extend(v.iter().filter(|f| f.is_finite()).map(|&f| f as i64)), - p => out.extend(p.as_i64()), - } - } - out - } -} - -/// Read an FBX file (binary or ASCII) into its top-level nodes and the file version -/// (e.g. 7400). -pub fn read(bytes: &[u8]) -> Result<(u32, Vec)> { - read_within(bytes, &Budget::new(MAX_IMPORT_BYTES)) -} - -fn read_within(bytes: &[u8], budget: &Budget) -> Result<(u32, Vec)> { - if bytes.starts_with(BINARY_MAGIC) { - read_binary(bytes, budget) - } else { - let (version, nodes) = read_ascii(&String::from_utf8_lossy(bytes))?; - budget.take(value_bytes(&nodes), "its values")?; - Ok((version, nodes)) - } -} - -// --------------------------------------------------------------------------------------------- -// Binary - -struct Bin<'a> { - d: &'a [u8], - /// 64-bit record offsets (version 7500 and later). - wide: bool, - budget: &'a Budget, -} - -impl Bin<'_> { - fn take(&self, pos: &mut usize, n: usize) -> Result<&[u8]> { - let end = pos.checked_add(n).ok_or_else(|| perr("FBX: offset overflow"))?; - let s = self.d.get(*pos..end).ok_or_else(|| perr(format!("FBX: truncated at byte {pos}")))?; - *pos = end; - Ok(s) - } - fn arr(&self, pos: &mut usize) -> Result<[u8; N]> { - let s = self.take(pos, N)?; - let mut a = [0u8; N]; - a.copy_from_slice(s); - Ok(a) - } - fn u32(&self, pos: &mut usize) -> Result { - Ok(u32::from_le_bytes(self.arr(pos)?)) - } - fn offset(&self, pos: &mut usize) -> Result { - if self.wide { Ok(u64::from_le_bytes(self.arr(pos)?)) } else { Ok(self.u32(pos)? as u64) } - } - fn to_usize(v: u64) -> Result { - usize::try_from(v).map_err(|_| perr("FBX: offset out of range")) - } - - /// Records until `end` or a null record. - fn list(&self, pos: &mut usize, end: usize, depth: usize) -> Result> { - if depth > MAX_DEPTH { - return Err(perr("FBX: nodes nested too deeply")); - } - let mut out = vec![]; - while *pos < end { - match self.record(pos, depth)? { - Some(n) => out.push(n), - None => break, - } - } - Ok(out) - } - - /// One node record; `None` for the null record that closes a list. - fn record(&self, pos: &mut usize, depth: usize) -> Result> { - let start = *pos; - let end = Self::to_usize(self.offset(pos)?)?; - let nprops = self.offset(pos)?; - let plen = Self::to_usize(self.offset(pos)?)?; - let nlen = self.arr::<1>(pos)?[0] as usize; - if end == 0 && nprops == 0 && plen == 0 && nlen == 0 { - return Ok(None); - } - if end <= start || end > self.d.len() { - return Err(perr(format!("FBX: bad record end {end} at byte {start}"))); - } - let name = String::from_utf8_lossy(self.take(pos, nlen)?).into_owned(); - let pstart = *pos; - let pend = pstart.checked_add(plen).filter(|&e| e <= end).ok_or_else(|| perr(format!("FBX: `{name}`: property list past the record")))?; - // Every property is at least one byte, so a count above the list length is corrupt. - if nprops > plen as u64 { - return Err(perr(format!("FBX: `{name}`: {nprops} properties in {plen} bytes"))); - } - let mut props = Vec::with_capacity(nprops as usize); - for _ in 0..nprops { - props.push(self.prop(pos, pend)?); - } - *pos = pend; - let children = if *pos < end { self.list(pos, end, depth + 1)? } else { vec![] }; - *pos = end; - Ok(Some(FbxNode { name, props, children })) - } - - fn prop(&self, pos: &mut usize, pend: usize) -> Result { - let sub = Bin { d: self.d.get(..pend).ok_or_else(|| perr("FBX: truncated property"))?, wide: self.wide, budget: self.budget }; - let t = sub.arr::<1>(pos)?[0]; - Ok(match t { - b'Y' => Prop::Int(i16::from_le_bytes(sub.arr(pos)?) as i64), - b'C' => Prop::Int((sub.arr::<1>(pos)?[0] != 0) as i64), - b'I' => Prop::Int(i32::from_le_bytes(sub.arr(pos)?) as i64), - b'L' => Prop::Int(i64::from_le_bytes(sub.arr(pos)?)), - b'F' => Prop::Float(f32::from_le_bytes(sub.arr(pos)?) as f64), - b'D' => Prop::Float(f64::from_le_bytes(sub.arr(pos)?)), - b'S' => { - let n = sub.u32(pos)? as usize; - Prop::Str(object_name(sub.take(pos, n)?)) - } - b'R' => { - let n = sub.u32(pos)? as usize; - Prop::Bytes(sub.take(pos, n)?.to_vec()) - } - b'f' | b'd' | b'l' | b'i' | b'b' => { - let len = sub.u32(pos)? as usize; - let enc = sub.u32(pos)?; - let clen = sub.u32(pos)? as usize; - let size = match t { - b'd' | b'l' => 8, - b'f' | b'i' => 4, - _ => 1, - }; - let want = len.checked_mul(size).filter(|&n| n <= MAX_ARRAY_BYTES).ok_or_else(|| perr("FBX: array too large"))?; - // Elements are kept as f64/i64 (booleans and 32-bit values widen), so the budget - // is charged for what is kept, not for the wire bytes. - sub.budget.take(len.checked_mul(8), "an array")?; - let data = sub.take(pos, clen)?; - let raw = match enc { - 0 => data.to_vec(), - 1 => miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(data, want).map_err(|e| perr(format!("FBX: array zlib: {e:?}")))?, - e => return Err(perr(format!("FBX: unknown array encoding {e}"))), - }; - let raw = raw.get(..want).ok_or_else(|| perr("FBX: array shorter than its length"))?; - match t { - b'f' => Prop::Floats(raw.as_chunks::<4>().0.iter().map(|c| f32::from_le_bytes(*c) as f64).collect()), - b'd' => Prop::Floats(raw.as_chunks::<8>().0.iter().map(|c| f64::from_le_bytes(*c)).collect()), - b'l' => Prop::Ints(raw.as_chunks::<8>().0.iter().map(|c| i64::from_le_bytes(*c)).collect()), - b'i' => Prop::Ints(raw.as_chunks::<4>().0.iter().map(|c| i32::from_le_bytes(*c) as i64).collect()), - _ => Prop::Ints(raw.iter().map(|&b| (b != 0) as i64).collect()), - } - } - t => return Err(perr(format!("FBX: unknown property type 0x{t:02x}"))), - }) - } -} - -/// Binary object names are `Name\0\x01Class`; ASCII writes `Class::Name`. -fn object_name(b: &[u8]) -> String { - let s = String::from_utf8_lossy(b); - match s.split_once("\0\x01") { - Some((name, class)) => format!("{class}::{name}"), - None => s.into_owned(), - } -} - -fn read_binary(bytes: &[u8], budget: &Budget) -> Result<(u32, Vec)> { - let mut pos = BINARY_MAGIC.len(); - let version = Bin { d: bytes, wide: false, budget }.u32(&mut pos)?; - let bin = Bin { d: bytes, wide: version >= 7500, budget }; - let mut nodes = vec![]; - while pos < bytes.len() { - match bin.record(&mut pos, 0) { - Ok(Some(n)) => nodes.push(n), - Ok(None) => break, - // A damaged tail (footer, padding) after complete sections is ignored. - Err(_) if nodes.iter().any(|n| n.name == "Objects") => break, - Err(e) => return Err(e), - } - } - Ok((version, nodes)) -} - -// --------------------------------------------------------------------------------------------- -// ASCII - -#[derive(Clone, Debug, PartialEq)] -enum Tok { - Key(String), - Val(Prop), - /// `*N` array length (the values follow in an `a:` child). - Count, - Comma, - Open, - Close, -} - -fn tokenize(text: &str) -> Vec { - let mut out = vec![]; - let mut it = text.char_indices().peekable(); - while let Some(&(i, c)) = it.peek() { - match c { - c if c.is_whitespace() => { - it.next(); - } - ';' => { - for (_, c) in it.by_ref() { - if c == '\n' { - break; - } - } - } - ',' => { - it.next(); - out.push(Tok::Comma); - } - '{' => { - it.next(); - out.push(Tok::Open); - } - '}' => { - it.next(); - out.push(Tok::Close); - } - '"' => { - it.next(); - let start = i + 1; - let mut end = text.len(); - for (j, c) in it.by_ref() { - if c == '"' { - end = j; - break; - } - } - out.push(Tok::Val(Prop::Str(text.get(start..end).unwrap_or("").replace(""", "\"")))); - } - _ => { - let start = i; - let mut end = text.len(); - while let Some(&(j, c)) = it.peek() { - if c.is_whitespace() || matches!(c, ',' | '{' | '}' | '"' | ';' | ':') { - end = j; - break; - } - it.next(); - } - let word = text.get(start..end).unwrap_or(""); - if it.peek().is_some_and(|&(_, c)| c == ':') { - it.next(); - out.push(Tok::Key(word.to_string())); - } else if word.starts_with('*') { - out.push(Tok::Count); - } else if let Ok(i) = word.parse::() { - out.push(Tok::Val(Prop::Int(i))); - } else if let Ok(f) = word.parse::() { - out.push(Tok::Val(Prop::Float(f))); - } else if !word.is_empty() { - out.push(Tok::Val(Prop::Str(word.to_string()))); - } else { - // A stray `:` with no key. - it.next(); - } - } - } - } - out -} - -fn ascii_list(toks: &[Tok], i: &mut usize, depth: usize) -> Result> { - if depth > MAX_DEPTH { - return Err(perr("FBX: nodes nested too deeply")); - } - let mut out = vec![]; - while let Some(t) = toks.get(*i) { - *i += 1; - match t { - Tok::Close if depth > 0 => return Ok(out), - Tok::Key(name) => { - let mut node = FbxNode { name: name.clone(), ..FbxNode::default() }; - loop { - match toks.get(*i) { - Some(Tok::Val(v)) => node.props.push(v.clone()), - Some(Tok::Count | Tok::Comma) => {} - _ => break, - } - *i += 1; - } - if toks.get(*i) == Some(&Tok::Open) { - *i += 1; - node.children = ascii_list(toks, i, depth + 1)?; - } - out.push(node); - } - _ => {} - } - } - Ok(out) -} - -fn read_ascii(text: &str) -> Result<(u32, Vec)> { - let toks = tokenize(text); - let mut i = 0; - let nodes = ascii_list(&toks, &mut i, 0)?; - let version = nodes - .iter() - .find(|n| n.name == "FBXHeaderExtension") - .and_then(|h| h.child("FBXVersion")) - .and_then(|v| v.prop(0)) - .and_then(Prop::as_i64) - .and_then(|v| u32::try_from(v).ok()) - .unwrap_or(0); - Ok((version, nodes)) -} - -// --------------------------------------------------------------------------------------------- -// Scene - -/// `Properties70` entries by name (`P: name, type, label, flags, values…`). -struct Props70<'a>(HashMap<&'a str, &'a FbxNode>); - -impl<'a> Props70<'a> { - fn of(node: &'a FbxNode) -> Props70<'a> { - let mut m = HashMap::new(); - if let Some(p) = node.child("Properties70") { - for e in p.children_named("P") { - if let Some(name) = e.str_at(0) { - m.entry(name).or_insert(e); - } - } - } - Props70(m) - } - fn values(&self, name: &str) -> Vec { - self.0.get(name).map(|e| e.props.iter().skip(4).filter_map(Prop::as_f64).collect()).unwrap_or_default() - } - fn f(&self, name: &str) -> Option { - self.values(name).first().copied().filter(|v| v.is_finite()) - } - fn v3(&self, name: &str, default: [f64; 3]) -> [f64; 3] { - match self.values(name).as_slice() { - [x, y, z, ..] if x.is_finite() && y.is_finite() && z.is_finite() => [*x, *y, *z], - _ => default, - } - } -} - -/// An Euler rotation (degrees) in FBX rotation order (`eEulerXYZ` = 0 rotates about X first). -fn euler(d: [f64; 3], order: i64) -> Mat4 { - let (x, y, z) = (Mat4::rotate_x(d[0]), Mat4::rotate_y(d[1]), Mat4::rotate_z(d[2])); - match order { - 1 => y * z * x, - 2 => x * z * y, - 3 => z * x * y, - 4 => y * x * z, - 5 => x * y * z, - _ => z * y * x, - } -} - -fn translate(t: [f64; 3]) -> Mat4 { - Mat4::translate(vec3(t[0], t[1], t[2])) -} - -/// A Model's local transform: `T · Roff · Rp · Rpre · R · Rpost⁻¹ · Rp⁻¹ · Soff · Sp · S · Sp⁻¹`. -fn model_local(p: &Props70) -> Mat4 { - let order = p.f("RotationOrder").map_or(0, |o| o as i64); - let active = p.f("RotationActive").is_some_and(|a| a != 0.0); - let (pre, post) = - if active { (euler(p.v3("PreRotation", [0.0; 3]), 0), euler(p.v3("PostRotation", [0.0; 3]), 0).transpose()) } else { (Mat4::IDENTITY, Mat4::IDENTITY) }; - let rp = p.v3("RotationPivot", [0.0; 3]); - let sp = p.v3("ScalingPivot", [0.0; 3]); - let s = p.v3("Lcl Scaling", [1.0; 3]); - translate(p.v3("Lcl Translation", [0.0; 3])) - * translate(p.v3("RotationOffset", [0.0; 3])) - * translate(rp) - * pre - * euler(p.v3("Lcl Rotation", [0.0; 3]), order) - * post - * translate([-rp[0], -rp[1], -rp[2]]) - * translate(p.v3("ScalingOffset", [0.0; 3])) - * translate(sp) - * Mat4::scale(vec3(s[0], s[1], s[2])) - * translate([-sp[0], -sp[1], -sp[2]]) -} - -/// The geometric transform of a Model (applies to its geometry, not to its children). -fn geometric(p: &Props70) -> Option { - let t = p.v3("GeometricTranslation", [0.0; 3]); - let r = p.v3("GeometricRotation", [0.0; 3]); - let s = p.v3("GeometricScaling", [1.0; 3]); - if t == [0.0; 3] && r == [0.0; 3] && s == [1.0; 3] { - return None; - } - Some(translate(t) * euler(r, 0) * Mat4::scale(vec3(s[0], s[1], s[2]))) -} - -/// The file's axis system → +Y up, +Z front, +X right. -fn axis_matrix(settings: Option<&FbxNode>) -> Mat4 { - let p = settings.map(Props70::of); - let get = |name: &str, d: f64| p.as_ref().and_then(|p| p.f(name)).unwrap_or(d); - let axis = |a: f64, s: f64| -> Option<[f64; 4]> { - let a = a as i64; - let sign = if s < 0.0 { -1.0 } else { 1.0 }; - let mut v = [0.0; 4]; - *v.get_mut(usize::try_from(a).ok().filter(|&a| a < 3)?)? = sign; - Some(v) - }; - let (Some(right), Some(up), Some(front)) = ( - axis(get("CoordAxis", 0.0), get("CoordAxisSign", 1.0)), - axis(get("UpAxis", 1.0), get("UpAxisSign", 1.0)), - axis(get("FrontAxis", 2.0), get("FrontAxisSign", 1.0)), - ) else { - return Mat4::IDENTITY; - }; - let m = Mat4([right, up, front, [0.0, 0.0, 0.0, 1.0]]); - // Two axes on the same file axis: not a rotation. - let used = |k: usize| right[k] != 0.0 || up[k] != 0.0 || front[k] != 0.0; - if (0..3).all(used) { m } else { Mat4::IDENTITY } -} - -#[derive(Clone, Copy, PartialEq, Eq)] -enum Mapping { - PolygonVertex, - Vertex, - Polygon, - AllSame, -} - -/// A geometry layer element (normals, UVs, material indices). -struct LayerData { - mapping: Mapping, - data: Vec, - index: Option>, - width: usize, -} - -impl LayerData { - fn of(geom: &FbxNode, element: &str, data: &str, index: &str, width: usize) -> Option { - let e = geom.child(element)?; - let mapping = match e.child("MappingInformationType").and_then(|m| m.str_at(0)).unwrap_or("ByPolygonVertex") { - "ByPolygonVertex" => Mapping::PolygonVertex, - "ByVertex" | "ByVertice" | "ByControlPoint" => Mapping::Vertex, - "ByPolygon" => Mapping::Polygon, - "AllSame" => Mapping::AllSame, - _ => return None, - }; - let reference = e.child("ReferenceInformationType").and_then(|m| m.str_at(0)).unwrap_or("Direct"); - let index = (reference != "Direct").then(|| e.child(index).map(FbxNode::ints)).flatten(); - Some(LayerData { mapping, data: e.child(data)?.floats(), index, width }) - } - fn get(&self, pv: usize, v: usize, poly: usize) -> Option<&[f64]> { - let i = match self.mapping { - Mapping::PolygonVertex => pv, - Mapping::Vertex => v, - Mapping::Polygon => poly, - Mapping::AllSame => 0, - }; - let j = match &self.index { - Some(ix) => usize::try_from(*ix.get(i)?).ok()?, - None => i, - }; - let a = j.checked_mul(self.width)?; - self.data.get(a..a.checked_add(self.width)?) - } -} - -fn f32s(s: &[f64]) -> [f32; N] { - let mut a = [0.0f32; N]; - for (o, v) in a.iter_mut().zip(s) { - *o = if v.is_finite() { *v as f32 } else { 0.0 }; - } - a -} - -/// A Mesh geometry with its polygons triangulated; `materials[k]` is the model-level material -/// index of the geometry's material slot `k`. -fn build_mesh(name: &str, geom: &FbxNode, materials: &[usize], with_normal_maps: &dyn Fn(usize) -> bool) -> Option { - let positions: Vec<[f32; 3]> = geom.child("Vertices")?.floats().as_chunks::<3>().0.iter().map(|c| f32s::<3>(c)).collect(); - let pvi = geom.child("PolygonVertexIndex")?.ints(); - let normals = LayerData::of(geom, "LayerElementNormal", "Normals", "NormalsIndex", 3); - let uvs = LayerData::of(geom, "LayerElementUV", "UV", "UVIndex", 2); - let mats = geom.child("LayerElementMaterial").and_then(|e| { - let mapping = e.child("MappingInformationType").and_then(|m| m.str_at(0)).unwrap_or("AllSame"); - let ids = e.child("Materials")?.ints(); - Some((mapping == "ByPolygon", ids)) - }); - - type Key = (u32, [u32; 3], [u32; 2]); - let mut prims: Vec<(Option, Primitive, HashMap, Vec)> = vec![]; - let mut corners: Vec<(usize, usize)> = vec![]; - let mut poly = 0usize; - for (pv, &raw) in pvi.iter().enumerate() { - // The last corner of a polygon is stored as `-index - 1`. - let (v, last) = if raw < 0 { (!raw, true) } else { (raw, false) }; - corners.push((pv, usize::try_from(v).unwrap_or(usize::MAX))); - if !last { - continue; - } - let poly_corners = std::mem::take(&mut corners); - let p_index = poly; - poly += 1; - if poly_corners.len() < 3 || poly_corners.iter().any(|&(_, v)| v >= positions.len()) { - continue; - } - let slot = mats.as_ref().and_then(|(by_poly, ids)| { - let k = if *by_poly { *ids.get(p_index)? } else { *ids.first()? }; - materials.get(usize::try_from(k).ok()?).copied() - }); - let slot = slot.or_else(|| materials.first().copied()); - let at = match prims.iter().position(|p| p.0 == slot) { - Some(i) => i, - None => { - prims.push((slot, Primitive { material: slot, ..Default::default() }, HashMap::new(), vec![])); - prims.len() - 1 - } - }; - let Some((_, prim, map, need)) = prims.get_mut(at) else { continue }; - let mut ids = Vec::with_capacity(poly_corners.len()); - for &(pv, v) in &poly_corners { - let n = normals.as_ref().and_then(|l| l.get(pv, v, p_index)).map(f32s::<3>); - let t = uvs.as_ref().and_then(|l| l.get(pv, v, p_index)).map(f32s::<2>); - let key: Key = (v as u32, n.unwrap_or([f32::NAN; 3]).map(f32::to_bits), t.unwrap_or([f32::NAN; 2]).map(f32::to_bits)); - let id = *map.entry(key).or_insert_with(|| { - prim.positions.push(positions.get(v).copied().unwrap_or_default()); - prim.normals.push(n.unwrap_or_default()); - prim.uvs.push(t.unwrap_or_default()); - need.push(n.is_none()); - (prim.positions.len() - 1) as u32 - }); - ids.push(id); - } - for i in 2..ids.len() { - prim.indices.extend([ids[0], ids[i - 1], ids[i]]); - } - } - let mut mesh = Mesh { name: name.to_string(), primitives: vec![] }; - for (_, mut p, _, need) in prims { - if p.indices.is_empty() { - continue; - } - if need.iter().any(|&b| b) { - let given = p.normals.clone(); - p.compute_normals(); - for ((n, g), need) in p.normals.iter_mut().zip(given).zip(&need) { - if !need { - *n = g; - } - } - } - if uvs.is_none() { - p.uvs.clear(); - } else { - // FBX's v axis points up the image; textures are stored top row first. - for uv in p.uvs.iter_mut() { - uv[1] = 1.0 - uv[1]; - } - } - if p.material.is_some_and(with_normal_maps) { - p.compute_tangents(); - } - mesh.primitives.push(p); - } - (!mesh.primitives.is_empty()).then_some(mesh) -} - -/// Lambert/Phong surface properties onto metallic-roughness. -fn material(name: &str, node: &FbxNode) -> Material { - let p = Props70::of(node); - let phong = node.child("ShadingModel").and_then(|s| s.str_at(0)).is_some_and(|s| s.eq_ignore_ascii_case("phong")); - let factor = p.f("DiffuseFactor").unwrap_or(1.0); - let d = p.v3("DiffuseColor", p.v3("Diffuse", [0.8; 3])); - let alpha = match p.f("Opacity") { - Some(o) => o, - None => { - let tc = p.v3("TransparentColor", [0.0; 3]); - 1.0 - (tc[0] + tc[1] + tc[2]) / 3.0 * p.f("TransparencyFactor").unwrap_or(0.0) - } - } - .clamp(0.0, 1.0); - let lin = |c: f64| srgb_to_linear((c * factor).clamp(0.0, 1.0) as f32); - let e = p.v3("EmissiveColor", [0.0; 3]); - let ef = p.f("EmissiveFactor").unwrap_or(1.0); - let roughness = if phong { - let ns = p.f("ShininessExponent").or_else(|| p.f("Shininess")).unwrap_or(20.0).max(0.0); - (2.0 / (ns + 2.0)).sqrt() as f32 - } else { - 1.0 - }; - Material { - name: name.to_string(), - base_color: [lin(d[0]), lin(d[1]), lin(d[2]), alpha as f32], - metallic: 0.0, - roughness, - emissive: e.map(|c| srgb_to_linear((c * ef).clamp(0.0, 1.0) as f32)), - alpha_mode: if alpha < 0.999 { AlphaMode::Blend } else { AlphaMode::Opaque }, - ..Material::default() - } -} - -/// Decode standard base64 (ASCII FBX embeds `Video` content this way); `None` on bad input. -fn base64(s: &str) -> Option> { - let mut out = Vec::with_capacity(s.len() / 4 * 3); - let (mut acc, mut bits) = (0u32, 0u32); - for c in s.bytes() { - let v = match c { - b'A'..=b'Z' => c - b'A', - b'a'..=b'z' => c - b'a' + 26, - b'0'..=b'9' => c - b'0' + 52, - b'+' => 62, - b'/' => 63, - b'=' => break, - c if c.is_ascii_whitespace() => continue, - _ => return None, - }; - acc = (acc << 6) | v as u32; - bits += 6; - if bits >= 8 { - bits -= 8; - out.push((acc >> bits) as u8); - acc &= (1 << bits) - 1; - } - } - Some(out) -} - -fn short_name(full: &str) -> &str { - full.split_once("::").map_or(full, |(_, n)| n) -} - -/// Parse an FBX file into a model. `resolve(uri)` reads texture files next to it. +/// Parse an FBX file; `resolve(path)` reads texture files the file names but does not embed. pub fn parse(bytes: &[u8], resolve: &dyn Fn(&str) -> Option>) -> Result { - parse_within(bytes, resolve, MAX_IMPORT_BYTES) -} - -/// [`parse`] keeping at most `limit` bytes of arrays and meshes. -fn parse_within(bytes: &[u8], resolve: &dyn Fn(&str) -> Option>, limit: usize) -> Result { - let budget = Budget::new(limit); - let (version, doc) = read_within(bytes, &budget)?; - if version != 0 && version < 7000 { - return Err(ModelError::Unsupported(format!("FBX {}.{} (only FBX 7.x files are read)", version / 1000, version % 1000 / 100))); + let limits = limits(); + let doc = craft_mesh::fbx::read_document(bytes, &limits).map_err(error)?; + let mut textures = |path: &str| resolve(path); + let scene = doc.scene(&limits, &mut textures).map_err(error)?; + if scene.meshes.is_empty() { + return Err(ModelError::Parse("FBX file without meshes".into())); } - let top = |name: &str| doc.iter().find(|n| n.name == name); - let objects = top("Objects").ok_or_else(|| perr("FBX: no Objects section"))?; - let by_id: HashMap = objects.children.iter().filter_map(|o| Some((o.prop(0)?.as_i64()?, o))).collect(); - let kind = |id: i64| by_id.get(&id).map(|n| n.name.as_str()); - - // Connections: (child, parent, property) in file order. - let mut links: Vec<(i64, i64, Option<&str>)> = vec![]; - if let Some(c) = top("Connections") { - for e in c.children_named("C") { - let (Some(a), Some(b)) = (e.prop(1).and_then(Prop::as_i64), e.prop(2).and_then(Prop::as_i64)) else { continue }; - links.push((a, b, e.str_at(3))); - } + let mut m = to_model(scene, MissingNormals::Smooth, &|_| None)?; + // The axes node goes first: every node index moves up by one. + for n in &mut m.nodes { + n.children.iter_mut().for_each(|c| *c += 1); } - - let model_ids: Vec = objects.children.iter().filter(|o| o.name == "Model").filter_map(|o| o.prop(0)?.as_i64()).collect(); - let mut node_of: HashMap = HashMap::new(); - let mut nodes = vec![Node { name: "FBX axes".into(), matrix: Some(axis_matrix(top("GlobalSettings"))), ..Node::default() }]; - for &id in &model_ids { - if node_of.contains_key(&id) { - continue; - } - let Some(o) = by_id.get(&id) else { continue }; - let name = short_name(o.str_at(1).unwrap_or("")).to_string(); - node_of.insert(id, nodes.len()); - nodes.push(Node { name, matrix: Some(model_local(&Props70::of(o))), ..Node::default() }); - } - - // Hierarchy: the first Model→Model link is the parent; anything else hangs off the root. - let mut parent: HashMap = HashMap::new(); - for &(c, p, _) in &links { - if let (Some(&ci), Some(&pi)) = (node_of.get(&c), node_of.get(&p)) - && ci != pi - { - parent.entry(ci).or_insert(pi); - } - } - for i in 1..nodes.len() { - let p = parent.get(&i).copied().unwrap_or(0); - if let Some(n) = nodes.get_mut(p) { - n.children.push(i); - } - } - - // Materials (in first-use order) and their textures. - let mut materials: Vec = vec![]; - let mut textures: Vec> = vec![]; - let mut material_of: HashMap = HashMap::new(); - let mut texture_of: HashMap> = HashMap::new(); - let mut load_texture = |tid: i64, textures: &mut Vec>| -> Option { - if let Some(t) = texture_of.get(&tid) { - return *t; - } - let t = (|| { - let tex = by_id.get(&tid)?; - let embedded = links.iter().filter(|l| l.1 == tid && kind(l.0) == Some("Video")).find_map(|l| { - let content = by_id.get(&l.0)?.child("Content")?; - match content.props.first()? { - Prop::Bytes(b) if !b.is_empty() => Some(b.clone()), - Prop::Str(_) => { - let s: String = content.props.iter().filter_map(Prop::as_str).collect(); - base64(&s).filter(|b| !b.is_empty()) - } - _ => None, - } - }); - let bytes = embedded.or_else(|| { - ["RelativeFilename", "FileName"].iter().find_map(|k| { - let f = tex.child(k)?.str_at(0)?.replace('\\', "/"); - resolve(&f).or_else(|| resolve(f.rsplit('/').next()?)) - }) - })?; - let t = Texture::decode(&bytes).ok()?; - textures.push(Arc::new(t)); - Some(textures.len() - 1) - })(); - texture_of.insert(tid, t); - t - }; - let mut material_index = |mid: i64, materials: &mut Vec, textures: &mut Vec>| -> Option { - if let Some(&m) = material_of.get(&mid) { - return Some(m); - } - let node = by_id.get(&mid)?; - let mut m = material(short_name(node.str_at(1).unwrap_or("")), node); - for &(tid, _, prop) in links.iter().filter(|l| l.1 == mid && kind(l.0) == Some("Texture")) { - let slot = match prop { - Some("DiffuseColor") => &mut m.base_color_tex, - Some("NormalMap") => &mut m.normal_tex, - Some("EmissiveColor") => &mut m.emissive_tex, - _ => continue, - }; - if slot.is_none() { - *slot = load_texture(tid, textures).map(|texture| TexRef { texture, uv_set: 0 }); - } - } - if m.emissive_tex.is_some() && m.emissive == [0.0; 3] { - m.emissive = [1.0; 3]; - } - materials.push(m); - material_of.insert(mid, materials.len() - 1); - Some(materials.len() - 1) - }; - - // One mesh per Model with Mesh geometry (material slots are per Model). Models instancing the - // same geometry with the same materials share one mesh rather than each building a copy. - let mut meshes: Vec = vec![]; - let mut mesh_of: HashMap<(i64, Vec), usize> = HashMap::new(); - for &id in &model_ids { - let Some(&ni) = node_of.get(&id) else { continue }; - let Some(gid) = links.iter().find(|l| l.1 == id && kind(l.0) == Some("Geometry")).map(|l| l.0) else { continue }; - let Some(geom) = by_id.get(&gid) else { continue }; - let mats: Vec = - links.iter().filter(|l| l.1 == id && kind(l.0) == Some("Material")).filter_map(|l| material_index(l.0, &mut materials, &mut textures)).collect(); - let name = nodes.get(ni).map(|n| n.name.clone()).unwrap_or_default(); - let mesh_index = match mesh_of.get(&(gid, mats.clone())) { - Some(&i) => i, - None => { - let normal_mapped: Vec = materials.iter().map(|m| m.normal_tex.is_some()).collect(); - let Some(mesh) = build_mesh(&name, geom, &mats, &|m| normal_mapped.get(m).copied().unwrap_or(false)) else { continue }; - budget.take(mesh_bytes(&mesh), &format!("mesh `{name}`"))?; - meshes.push(mesh); - mesh_of.insert((gid, mats), meshes.len() - 1); - meshes.len() - 1 - } - }; - let geo = by_id.get(&id).and_then(|o| geometric(&Props70::of(o))); - match geo { - Some(matrix) => { - nodes.push(Node { name: format!("{name} geometry"), matrix: Some(matrix), mesh: Some(mesh_index), ..Node::default() }); - let gi = nodes.len() - 1; - if let Some(n) = nodes.get_mut(ni) { - n.children.push(gi); - } - } - None => { - if let Some(n) = nodes.get_mut(ni) { - n.mesh = Some(mesh_index); - } - } - } - } - if meshes.is_empty() { - return Err(perr("FBX file without meshes")); - } - Ok(Model { meshes, nodes, roots: vec![0], materials, textures, ..Model::default() }) + m.skins.iter_mut().flat_map(|s| s.joints.iter_mut()).for_each(|j| *j += 1); + m.animations.iter_mut().flat_map(|a| a.channels.iter_mut()).for_each(|c| c.node += 1); + let roots = m.roots.iter().map(|r| r + 1).collect(); + m.nodes.insert(0, Node { name: "FBX axes".into(), matrix: Some(mat4(&doc.axes_to_y_up())), children: roots, ..Node::default() }); + m.roots = vec![0]; + Ok(m) } #[cfg(test)] diff --git a/crates/model/src/fbx/tests.rs b/crates/model/src/fbx/tests.rs index 1ba1978ba..399b16e2d 100644 --- a/crates/model/src/fbx/tests.rs +++ b/crates/model/src/fbx/tests.rs @@ -1,5 +1,5 @@ use super::*; -use crate::load; +use crate::{AlphaMode, load, vec3}; /// A Z-up scene: a Null parent with a mesh child (rotated, scaled, with a geometric offset) /// holding a quad and a triangle with a material each. @@ -131,116 +131,12 @@ fn check_scene(m: &Model) { assert!(close(lo, [8.0, 2.0, -2.0]) && close(hi, [10.0, 4.0, 0.0]), "{lo:?} {hi:?}"); } -/// A binary FBX of the same node tree (`a:` children become typed arrays). -fn write_binary(nodes: &[FbxNode], version: u32, compress: bool) -> Vec { - fn prop(out: &mut Vec, p: &Prop, compress: bool) { - let array = |out: &mut Vec, t: u8, len: usize, raw: Vec| { - out.push(t); - out.extend((len as u32).to_le_bytes()); - let data = if compress { miniz_oxide::deflate::compress_to_vec_zlib(&raw, 6) } else { raw }; - out.extend((compress as u32).to_le_bytes()); - out.extend((data.len() as u32).to_le_bytes()); - out.extend(data); - }; - match p { - Prop::Int(i) => match i32::try_from(*i) { - Ok(v) => { - out.push(b'I'); - out.extend(v.to_le_bytes()); - } - Err(_) => { - out.push(b'L'); - out.extend(i.to_le_bytes()); - } - }, - Prop::Float(f) => { - out.push(b'D'); - out.extend(f.to_le_bytes()); - } - Prop::Str(s) => { - let s = match s.split_once("::") { - Some((class, name)) => format!("{name}\0\x01{class}"), - None => s.clone(), - }; - out.push(b'S'); - out.extend((s.len() as u32).to_le_bytes()); - out.extend(s.as_bytes()); - } - Prop::Bytes(b) => { - out.push(b'R'); - out.extend((b.len() as u32).to_le_bytes()); - out.extend(b); - } - Prop::Ints(v) => array(out, b'i', v.len(), v.iter().flat_map(|&i| (i as i32).to_le_bytes()).collect()), - Prop::Floats(v) => array(out, b'd', v.len(), v.iter().flat_map(|f| f.to_le_bytes()).collect()), - } - } - fn record(out: &mut Vec, n: &FbxNode, wide: bool, compress: bool) { - let w = if wide { 8 } else { 4 }; - let start = out.len(); - out.extend(vec![0u8; 3 * w]); - out.push(n.name.len() as u8); - out.extend(n.name.as_bytes()); - let props = match n.child("a") { - Some(a) if a.props.iter().all(|p| matches!(p, Prop::Int(_))) => vec![Prop::Ints(a.ints())], - Some(a) => vec![Prop::Floats(a.floats())], - None => n.props.clone(), - }; - let pstart = out.len(); - for p in &props { - prop(out, p, compress); - } - let plen = out.len() - pstart; - let kids: Vec<&FbxNode> = n.children.iter().filter(|c| c.name != "a").collect(); - if !kids.is_empty() { - for k in kids { - record(out, k, wide, compress); - } - out.extend(vec![0u8; 3 * w + 1]); - } - let end = out.len(); - for (k, v) in [end, props.len(), plen].into_iter().enumerate() { - let at = start + k * w; - if wide { - out[at..at + 8].copy_from_slice(&(v as u64).to_le_bytes()); - } else { - out[at..at + 4].copy_from_slice(&(v as u32).to_le_bytes()); - } - } - } - let wide = version >= 7500; - let mut out = BINARY_MAGIC.to_vec(); - out.extend(version.to_le_bytes()); - for n in nodes { - record(&mut out, n, wide, compress); - } - out.extend(vec![0u8; if wide { 25 } else { 13 }]); - // Footer bytes after the closing null record. - out.extend([0xfa; 16]); - out -} - #[test] fn ascii_fbx_scene() { let m = load("scene.fbx", ASCII.as_bytes(), &|_| None).unwrap(); check_scene(&m); } -#[test] -fn binary_fbx_matches_ascii() { - let (_, doc) = read(ASCII.as_bytes()).unwrap(); - let ascii = parse(ASCII.as_bytes(), &|_| None).unwrap(); - for (version, compress) in [(7400, false), (7400, true), (7500, true)] { - let bin = write_binary(&doc, version, compress); - let (v, nodes) = read(&bin).unwrap(); - assert_eq!(v, version); - assert_eq!(nodes.iter().map(|n| n.name.as_str()).collect::>(), ["FBXHeaderExtension", "GlobalSettings", "Objects", "Connections"]); - // Found by its magic even without the extension. - let m = load("scene.bin", &bin, &|_| None).unwrap(); - assert_eq!(m, ascii, "version {version}, compressed {compress}"); - } -} - #[test] fn embedded_and_relative_textures() { let png = { @@ -291,91 +187,6 @@ fn b64(b: &[u8]) -> String { s } -#[test] -fn hostile_fbx_files_fail_cleanly() { - let (_, doc) = read(ASCII.as_bytes()).unwrap(); - let bin = write_binary(&doc, 7500, true); - // Every truncation and every single-byte corruption returns (no panic, no runaway). - for n in 0..bin.len() { - let _ = parse(&bin[..n], &|_| None); - } - for i in 0..bin.len() { - let mut b = bin.clone(); - b[i] ^= 0xff; - let _ = parse(&b, &|_| None); - } - // An array claiming 4 G elements. - let mut huge = BINARY_MAGIC.to_vec(); - huge.extend(7400u32.to_le_bytes()); - let body: Vec = b"d".iter().copied().chain(u32::MAX.to_le_bytes()).chain(0u32.to_le_bytes()).chain(8u32.to_le_bytes()).chain([0u8; 8]).collect(); - let start = huge.len(); - let end = start + 13 + 1 + body.len(); - huge.extend((end as u32).to_le_bytes()); - huge.extend(1u32.to_le_bytes()); - huge.extend((body.len() as u32).to_le_bytes()); - huge.push(1); - huge.push(b'V'); - huge.extend(body); - assert!(read(&huge).is_err()); - // Deep nesting, both encodings. - assert!(read("A: {".repeat(100_000).as_bytes()).is_err()); - // Not an FBX scene at all, an old FBX version, and a scene without meshes. - assert!(parse(b"\x00\x01garbage", &|_| None).is_err()); - let v6 = "FBXHeaderExtension: {\n FBXVersion: 6100\n}\nObjects: {\n}\n"; - assert!(matches!(parse(v6.as_bytes(), &|_| None), Err(ModelError::Unsupported(_)))); - assert!(parse(b"Objects: {\n Model: 1, \"Model::Empty\", \"Null\" {\n }\n}\n", &|_| None).is_err()); -} - -/// A version-7400 binary FBX holding one top-level node `A` with uncompressed arrays of type -/// `t` (`b'b'`, `b'i'`, `b'f'`, `b'd'`, `b'l'`) and `len` elements each. -fn binary_arrays(arrays: &[(u8, usize)]) -> Vec { - let mut props = vec![]; - for &(t, len) in arrays { - let size = match t { - b'd' | b'l' => 8, - b'f' | b'i' => 4, - _ => 1, - }; - props.push(t); - props.extend((len as u32).to_le_bytes()); - props.extend(0u32.to_le_bytes()); - props.extend(((len * size) as u32).to_le_bytes()); - props.extend(std::iter::repeat_n(1u8, len * size)); - } - let mut out = BINARY_MAGIC.to_vec(); - out.extend(7400u32.to_le_bytes()); - let end = out.len() + 13 + 1 + props.len(); - out.extend((end as u32).to_le_bytes()); - out.extend((arrays.len() as u32).to_le_bytes()); - out.extend((props.len() as u32).to_le_bytes()); - out.push(1); - out.push(b'A'); - out.extend(props); - out -} - -#[test] -fn fbx_arrays_are_charged_for_the_memory_they_keep() { - // A boolean array is one byte per element on the wire but eight once kept as `Prop::Ints`: - // the budget counts the eight (#1234). - let n = 10_000; - let bin = binary_arrays(&[(b'b', n)]); - assert!(read_within(&bin, &Budget::new(n * 8)).is_ok()); - let e = read_within(&bin, &Budget::new(n * 8 - 1)).unwrap_err(); - assert!(e.to_string().contains("memory limit"), "{e}"); - // 32-bit floats widen to f64 the same way. - assert!(read_within(&binary_arrays(&[(b'f', n)]), &Budget::new(n * 4)).is_err()); - // Several arrays each within the budget but not together. - let bin = binary_arrays(&[(b'i', n), (b'd', n), (b'b', n)]); - assert!(read_within(&bin, &Budget::new(n * 24)).is_ok()); - assert!(read_within(&bin, &Budget::new(n * 20)).is_err()); - // ASCII values count too. - let (_, doc) = read(ASCII.as_bytes()).unwrap(); - let values = value_bytes(&doc).unwrap(); - assert!(values > 45 * std::mem::size_of::(), "{values}"); - assert!(parse_within(ASCII.as_bytes(), &|_| None, values - 1).unwrap_err().to_string().contains("memory limit")); -} - /// [`ASCII`] with two more Models instancing its geometry: `Copy` with the same two materials, /// `Red only` with just the first. fn instanced_scene() -> String { @@ -401,11 +212,94 @@ fn fbx_models_instancing_one_geometry_share_its_mesh() { assert_eq!(mesh_of("Shape"), mesh_of("Copy"), "same geometry and materials: one mesh"); assert_ne!(mesh_of("Shape"), mesh_of("Red only"), "different materials: its own mesh"); assert_eq!(m.meshes.len(), 2); - // A budget with room for one copy of the geometry's mesh, but not three, still imports. - let one = parse(ASCII.as_bytes(), &|_| None).unwrap(); - let mesh = mesh_bytes(&one.meshes[0]).unwrap(); - let (_, doc) = read(instanced_scene().as_bytes()).unwrap(); - let values = value_bytes(&doc).unwrap(); - assert!(parse_within(instanced_scene().as_bytes(), &|_| None, values + 2 * mesh).is_ok()); - assert!(parse_within(instanced_scene().as_bytes(), &|_| None, values + mesh).is_err()); +} + +#[test] +fn texture_aliases_of_one_image_share_its_pixels() { + let png = { + let img = image::RgbaImage::from_pixel(2, 1, image::Rgba([0, 255, 0, 255])); + let mut b = std::io::Cursor::new(vec![]); + img.write_to(&mut b, image::ImageFormat::Png).unwrap(); + b.into_inner() + }; + let objects = r#" + Texture: 600, "Texture::Base", "" { + RelativeFilename: "maps\base.png" + } + Texture: 700, "Texture::Base again", "" { + RelativeFilename: "maps\base.png" + } +} +Connections: {"#; + let doc = ASCII + .replace("}\nConnections: {", objects) + .replace("C: \"OO\",500,300\n", "C: \"OO\",500,300\n\tC: \"OP\",600,400, \"DiffuseColor\"\n\tC: \"OP\",700,500, \"DiffuseColor\"\n"); + let resolve = |uri: &str| (uri == "maps/base.png").then(|| png.clone()); + let m = parse(doc.as_bytes(), &resolve).unwrap(); + assert_eq!(m.textures.len(), 1); + assert!(m.materials.iter().all(|x| x.base_color_tex.map(|t| t.texture) == Some(0))); + assert!(m.warnings.is_empty()); +} + +/// A PNG that is only a header claiming `w`×`h` pixels (an empty data chunk follows). +fn png_header_only(w: u32, h: u32) -> Vec { + fn chunk(png: &mut Vec, ty: &[u8], data: &[u8]) { + let body = [ty, data].concat(); + let mut crc = 0xFFFF_FFFFu32; + for &b in &body { + crc ^= u32::from(b); + for _ in 0..8 { + crc = if crc & 1 != 0 { (crc >> 1) ^ 0xEDB8_8320 } else { crc >> 1 }; + } + } + png.extend((data.len() as u32).to_be_bytes()); + png.extend(&body); + png.extend((!crc).to_be_bytes()); + } + let mut png = vec![0x89, b'P', b'N', b'G', 0x0D, 0x0A, 0x1A, 0x0A]; + chunk(&mut png, b"IHDR", &[w.to_be_bytes(), h.to_be_bytes(), [8, 6, 0, 0]].concat().iter().copied().chain([0]).collect::>()); + chunk(&mut png, b"IDAT", &[]); + png +} + +#[test] +fn a_texture_past_the_limits_is_left_out_with_a_warning_not_a_failed_import() { + let objects = r#" + Texture: 600, "Texture::Base", "" { + RelativeFilename: "maps\base.png" + } +} +Connections: {"#; + let doc = ASCII.replace("}\nConnections: {", objects).replace("C: \"OO\",500,300\n", "C: \"OO\",500,300\n\tC: \"OP\",600,400, \"DiffuseColor\"\n"); + // 30000×30000 pixels would take ~14 GiB; the header alone is refused, before anything is allocated. + let huge = png_header_only(30000, 30000); + let resolve = |_: &str| Some(huge.clone()); + let m = parse(doc.as_bytes(), &resolve).unwrap(); + assert!(m.textures.is_empty() && m.materials.iter().all(|x| x.base_color_tex.is_none())); + assert!(m.warnings.iter().any(|w| w.contains("30000")), "{:?}", m.warnings); +} + +#[test] +fn texture_files_resolving_to_one_image_share_it() { + let png = { + let img = image::RgbaImage::from_pixel(2, 1, image::Rgba([0, 255, 0, 255])); + let mut b = std::io::Cursor::new(vec![]); + img.write_to(&mut b, image::ImageFormat::Png).unwrap(); + b.into_inner() + }; + let objects = r#" + Texture: 600, "Texture::Base", "" { + RelativeFilename: "maps\base.png" + } + Texture: 700, "Texture::Other spelling", "" { + RelativeFilename: "missing\base.png" + FileName: "maps\base.png" + } +} +Connections: {"#; + let doc = ASCII + .replace("}\nConnections: {", objects) + .replace("C: \"OO\",500,300\n", "C: \"OO\",500,300\n\tC: \"OP\",600,400, \"DiffuseColor\"\n\tC: \"OP\",700,500, \"DiffuseColor\"\n"); + let resolve = |uri: &str| (uri == "maps/base.png").then(|| png.clone()); + assert_eq!(parse(doc.as_bytes(), &resolve).unwrap().textures.len(), 1); } diff --git a/crates/model/src/gltf.rs b/crates/model/src/gltf.rs index c0b736359..68bc86764 100644 --- a/crates/model/src/gltf.rs +++ b/crates/model/src/gltf.rs @@ -1,687 +1,26 @@ -//! glTF 2.0 import, written from the Khronos glTF 2.0 specification. -//! -//! Supports `.gltf` (JSON with external `.bin`/image files or `data:` URIs) and `.glb` (binary -//! container: a JSON chunk and a BIN chunk). Imports the default scene's node hierarchy (TRS or -//! matrix), triangle primitives (`TRIANGLES`, `TRIANGLE_STRIP`, `TRIANGLE_FAN`) with POSITION, -//! NORMAL, TANGENT, TEXCOORD_0, JOINTS_0 and WEIGHTS_0, PBR metallic-roughness materials -//! (base colour, metallic-roughness, normal, occlusion and emissive textures; alpha modes; -//! double-sided; `KHR_materials_emissive_strength`, `KHR_materials_unlit`), embedded or -//! external PNG/JPEG images with sampler wrap modes, skins and animations (step, linear and -//! cubic-spline translation/rotation/scale), perspective and orthographic cameras, and -//! `KHR_lights_punctual` lights (directional, point, spot). Sparse accessors and morph targets -//! are ignored. +//! glTF 2.0 import (`.gltf` with external or embedded buffers, `.glb`), read with `craft-mesh` +//! (`craft_mesh::gltf`): meshes, PBR metallic-roughness materials, the node hierarchy, skins, +//! animations, cameras and `KHR_lights_punctual` lights. External buffers and images are read +//! through the caller's resolver by their percent-decoded URI. Primitives without normals get +//! flat normals (glTF 2.0 §3.7.2.1); normal-mapped ones get tangents from their UVs. -use std::{cell::Cell, sync::Arc}; +use crate::scene::{MissingNormals, error, limits, to_model}; +use crate::{Model, Result}; -use serde_json::Value; +pub use craft_mesh::base64_decode; +pub use craft_mesh::gltf::{split_glb, uri_decode}; -use crate::{ - AlphaMode, Animation, Channel, ChannelPath, Interp, Mat4, Material, Mesh, Model, ModelError, Node, Primitive, Result, Skin, TexRef, Texture, Wrap, perr, -}; - -const GLB_MAGIC: u32 = 0x4654_6C67; -const CHUNK_JSON: u32 = 0x4E4F_534A; -const CHUNK_BIN: u32 = 0x004E_4942; - -/// Split a GLB container into its JSON text and BIN chunk. -pub fn split_glb(b: &[u8]) -> Result<(&[u8], Option<&[u8]>)> { - let u32_at = |o: usize| -> Option { b.get(o..o + 4).map(|s| u32::from_le_bytes([s[0], s[1], s[2], s[3]])) }; - if u32_at(0) != Some(GLB_MAGIC) { - return Err(perr("not a GLB file")); - } - if u32_at(4) != Some(2) { - return Err(ModelError::Unsupported(format!("GLB version {}", u32_at(4).unwrap_or(0)))); - } - let total = (u32_at(8).unwrap_or(0) as usize).min(b.len()); - let mut o = 12; - let mut json = None; - let mut bin = None; - while o + 8 <= total { - let len = u32_at(o).unwrap_or(0) as usize; - let ty = u32_at(o + 4).unwrap_or(0); - let past_end = || perr("GLB chunk runs past the end of the file"); - let end = (o + 8).checked_add(len).ok_or_else(past_end)?; - let data = b.get(o + 8..end).ok_or_else(past_end)?; - match ty { - CHUNK_JSON if json.is_none() => json = Some(data), - CHUNK_BIN if bin.is_none() => bin = Some(data), - _ => {} - } - o = end; - } - Ok((json.ok_or_else(|| perr("GLB without a JSON chunk"))?, bin)) -} - -/// Decode standard base64 (with or without padding; whitespace ignored). -pub fn base64_decode(s: &str) -> Option> { - let mut out = Vec::with_capacity(s.len() * 3 / 4); - let mut acc = 0u32; - let mut bits = 0; - for c in s.bytes() { - let v = match c { - b'A'..=b'Z' => c - b'A', - b'a'..=b'z' => c - b'a' + 26, - b'0'..=b'9' => c - b'0' + 52, - b'+' | b'-' => 62, - b'/' | b'_' => 63, - b'=' => break, - b' ' | b'\n' | b'\r' | b'\t' => continue, - _ => return None, - } as u32; - acc = (acc << 6) | v; - bits += 6; - if bits >= 8 { - bits -= 8; - out.push((acc >> bits) as u8); - acc &= (1 << bits) - 1; - } - } - Some(out) -} - -/// Percent-decode a relative URI. -pub fn uri_decode(s: &str) -> String { - let b = s.as_bytes(); - let mut out = Vec::with_capacity(b.len()); - let mut i = 0; - while i < b.len() { - if b[i] == b'%' - && i + 2 < b.len() - && b[i + 1].is_ascii_hexdigit() - && b[i + 2].is_ascii_hexdigit() - && let Ok(v) = u8::from_str_radix(std::str::from_utf8(&b[i + 1..i + 3]).unwrap_or("zz"), 16) - { - out.push(v); - i += 3; - continue; - } - out.push(b[i]); - i += 1; - } - String::from_utf8_lossy(&out).into_owned() -} - -/// Bytes of a `data:` URI or an external resource. -fn load_uri(uri: &str, resolve: &dyn Fn(&str) -> Option>) -> Result> { - if let Some(rest) = uri.strip_prefix("data:") { - let (meta, data) = rest.split_once(',').ok_or_else(|| perr("malformed data URI"))?; - return if meta.ends_with(";base64") { base64_decode(data).ok_or_else(|| perr("bad base64 in data URI")) } else { Ok(uri_decode(data).into_bytes()) }; - } - let name = uri_decode(uri); - resolve(&name).ok_or(ModelError::Missing(name)) -} - -struct Doc<'a> { - j: &'a Value, - buffers: Vec>, - /// Zero components that buffer-less accessors may still allocate, across the whole file: - /// nothing backs them, so many references to one capped accessor must not multiply (#2139). - zero_left: Cell, - /// Components every accessor read may still allocate, across the whole file: each primitive - /// that references an accessor keeps its own copy, so references must not multiply memory. - read_left: Cell, - /// The budget `read_left` started from, for the error message. - read_cap: usize, -} - -fn arr<'v>(v: &'v Value, k: &str) -> &'v [Value] { - v.get(k).and_then(Value::as_array).map(Vec::as_slice).unwrap_or(&[]) -} -/// A non-negative integer field; one too large for `usize` counts as absent (#1235). -fn idx(v: &Value, k: &str) -> Option { - v.get(k).and_then(Value::as_u64).and_then(|x| usize::try_from(x).ok()) -} -/// Node indices in an array field (out-of-range ones are dropped). -fn indices(v: &Value, k: &str) -> Vec { - arr(v, k).iter().filter_map(Value::as_u64).filter_map(|c| usize::try_from(c).ok()).collect() -} - -/// The most components accessors without a buffer view (all zeros) may have, together: nothing -/// in the file backs their counts, so they are capped instead of checked against a buffer -/// (#1235, #2139). -const MAX_ZERO_COMPONENTS: usize = 1 << 24; - -/// The most components all accessor reads in one file may allocate together (about 1 GiB as -/// `f32`/`u32`). Each primitive keeps its own copy of what it reads, so an accessor referenced -/// N times costs N times; this bounds that by a fixed amount rather than by buffer size, because -/// real assets legitimately share one vertex buffer across many primitives. A 10M-triangle scan -/// (5M vertices with position, normal, UV and tangent, 30M indices) reads about 90M. -const MAX_READ_COMPONENTS: usize = 1 << 28; - -/// Where an accessor's elements lie in its buffer: `count` elements of `elem` bytes, `stride` -/// apart from `base`, all checked to be inside `buf`. -struct Span<'b> { - buf: &'b [u8], - base: usize, - stride: usize, -} -fn num(v: &Value, k: &str, d: f64) -> f64 { - v.get(k).and_then(Value::as_f64).unwrap_or(d) -} -fn nums(v: &Value, k: &str, d: [f64; N]) -> [f64; N] { - let mut out = d; - if let Some(a) = v.get(k).and_then(Value::as_array) { - for (i, x) in a.iter().take(N).enumerate() { - out[i] = x.as_f64().unwrap_or(d[i]); - } - } - out -} - -/// Bytes of component `c` of element `i`, with checked offsets (the span was validated, but -/// nothing derived from the file is indexed unchecked). -fn component(buf: &[u8], base: usize, stride: usize, i: usize, c: usize, csize: usize) -> Result<&[u8]> { - let o = i.checked_mul(stride).and_then(|o| o.checked_add(base)).and_then(|o| o.checked_add(c.checked_mul(csize)?)); - o.and_then(|o| buf.get(o..o.checked_add(csize)?)).ok_or_else(|| perr("accessor reads past its buffer")) -} - -impl Doc<'_> { - /// Charge `total` components to the file's read budget before allocating them. - fn charge(&self, total: usize) -> Result<()> { - let left = self.read_left.get(); - let Some(rest) = left.checked_sub(total) else { - let cap = self.read_cap; - return Err(perr(format!("accessor reads need more than {cap} components in total ({total} requested, {left} left)"))); - }; - self.read_left.set(rest); - Ok(()) - } - - /// Charge `count` items of `per` components each. - fn charge_each(&self, count: usize, per: usize) -> Result<()> { - self.charge(count.checked_mul(per).ok_or_else(|| perr("primitive is too large"))?) - } - - /// The accessor's element count and total components (`count * n`), checked; and its span in - /// the buffer, validated before anything is allocated from the count. `None` for an - /// accessor without a buffer view, whose components are all zero. - fn layout(&self, acc: &Value, n: usize, csize: usize) -> Result<(usize, usize, Option>)> { - let count = match acc.get("count") { - None => 0, - Some(c) => c.as_u64().and_then(|c| usize::try_from(c).ok()).ok_or_else(|| perr("accessor count is not a valid size"))?, - }; - let total = count.checked_mul(n).ok_or_else(|| perr("accessor count is too large"))?; - let Some(bv) = idx(acc, "bufferView") else { - let left = self.zero_left.get(); - let Some(rest) = left.checked_sub(total) else { - return Err(perr(format!("accessors without a bufferView have more than {MAX_ZERO_COMPONENTS} components ({total} requested, {left} left)"))); - }; - self.zero_left.set(rest); - self.charge(total)?; - return Ok((count, total, None)); - }; - let view = arr(self.j, "bufferViews").get(bv).ok_or_else(|| perr(format!("no bufferView {bv}")))?; - let buf = self.buffers.get(idx(view, "buffer").unwrap_or(0)).ok_or_else(|| perr("bufferView buffer out of range"))?; - let past = || perr("accessor reads past its buffer"); - let base = idx(view, "byteOffset").unwrap_or(0).checked_add(idx(acc, "byteOffset").unwrap_or(0)).ok_or_else(past)?; - let elem = csize.checked_mul(n).ok_or_else(past)?; - let stride = idx(view, "byteStride").filter(|s| *s > 0).unwrap_or(elem); - if stride < elem { - return Err(perr(format!("bufferView byteStride {stride} is smaller than its {elem}-byte elements"))); - } - if count > 0 { - let end = (count - 1).checked_mul(stride).and_then(|o| o.checked_add(base)).and_then(|o| o.checked_add(elem)).ok_or_else(past)?; - if end > buf.len() { - return Err(past()); - } - } - self.charge(total)?; - Ok((count, total, Some(Span { buf, base, stride }))) - } - - /// An accessor as `f32` rows of `n` components (normalised integers mapped to 0..1 / -1..1). - fn floats(&self, a: usize) -> Result<(Vec, usize)> { - let acc = arr(self.j, "accessors").get(a).ok_or_else(|| perr(format!("no accessor {a}")))?; - let n = match acc.get("type").and_then(Value::as_str).unwrap_or("") { - "SCALAR" => 1, - "VEC2" => 2, - "VEC3" => 3, - "VEC4" => 4, - "MAT2" => 4, - "MAT3" => 9, - "MAT4" => 16, - t => return Err(perr(format!("accessor type `{t}`"))), - }; - let ct = idx(acc, "componentType").unwrap_or(5126); - let norm = acc.get("normalized").and_then(Value::as_bool).unwrap_or(false); - let csize = match ct { - 5120 | 5121 => 1, - 5122 | 5123 => 2, - 5125 | 5126 => 4, - _ => return Err(perr(format!("componentType {ct}"))), - }; - let (count, total, span) = self.layout(acc, n, csize)?; - let mut out = vec![0.0f32; total]; - let Some(Span { buf, base, stride }) = span else { - // No buffer view: all zeros (sparse substitution is not supported). - return Ok((out, n)); - }; - // Matrices of 1/2-byte components pad columns to 4 bytes; ignored (rare). - for i in 0..count { - for c in 0..n { - let s = component(buf, base, stride, i, c, csize)?; - out[i * n + c] = match ct { - 5126 => f32::from_le_bytes([s[0], s[1], s[2], s[3]]), - 5125 => u32::from_le_bytes([s[0], s[1], s[2], s[3]]) as f32, - 5123 => { - let v = u16::from_le_bytes([s[0], s[1]]) as f32; - if norm { v / 65535.0 } else { v } - } - 5122 => { - let v = i16::from_le_bytes([s[0], s[1]]) as f32; - if norm { (v / 32767.0).max(-1.0) } else { v } - } - 5121 => { - let v = s[0] as f32; - if norm { v / 255.0 } else { v } - } - _ => { - let v = s[0] as i8 as f32; - if norm { (v / 127.0).max(-1.0) } else { v } - } - }; - } - } - Ok((out, n)) - } - - /// Integer accessor (indices, joints) read exactly. - fn ints(&self, a: usize) -> Result> { - let acc = arr(self.j, "accessors").get(a).ok_or_else(|| perr(format!("no accessor {a}")))?; - let ct = idx(acc, "componentType").unwrap_or(5125); - if ct == 5126 { - return Ok(self.floats(a)?.0.into_iter().map(|v| v as u32).collect()); - } - let n = match acc.get("type").and_then(Value::as_str).unwrap_or("SCALAR") { - "VEC4" => 4, - "VEC3" => 3, - "VEC2" => 2, - _ => 1, - }; - let csize = match ct { - 5120 | 5121 => 1, - 5122 | 5123 => 2, - _ => 4, - }; - let (count, total, span) = self.layout(acc, n, csize)?; - let Some(Span { buf, base, stride }) = span else { return Ok(vec![0; total]) }; - let mut out = Vec::with_capacity(total); - for i in 0..count { - for c in 0..n { - let s = component(buf, base, stride, i, c, csize)?; - out.push(match csize { - 1 => s[0] as u32, - 2 => u16::from_le_bytes([s[0], s[1]]) as u32, - _ => u32::from_le_bytes([s[0], s[1], s[2], s[3]]), - }); - } - } - Ok(out) - } -} - -/// Parse a `.gltf` (JSON) or `.glb` file. +/// Parse a `.gltf` (JSON) or `.glb` file; `resolve(uri)` reads external buffers and images. pub fn parse(bytes: &[u8], resolve: &dyn Fn(&str) -> Option>) -> Result { - parse_with_budget(bytes, resolve, MAX_READ_COMPONENTS) -} - -/// [`parse`] with a read budget of `read_budget` accessor components for the whole file. -pub(crate) fn parse_with_budget(bytes: &[u8], resolve: &dyn Fn(&str) -> Option>, read_budget: usize) -> Result { - let (json, bin) = if bytes.starts_with(b"glTF") { split_glb(bytes)? } else { (bytes, None) }; - let j: Value = serde_json::from_slice(json).map_err(|e| perr(format!("glTF JSON: {e}")))?; - let ver = j.get("asset").and_then(|a| a.get("version")).and_then(Value::as_str).unwrap_or(""); - if !ver.starts_with('2') { - return Err(ModelError::Unsupported(format!("glTF version `{ver}` (2.0 required)"))); - } - for ext in arr(&j, "extensionsRequired") { - let e = ext.as_str().unwrap_or(""); - if !matches!(e, "KHR_materials_unlit" | "KHR_materials_emissive_strength") { - return Err(ModelError::Unsupported(format!("required extension {e}"))); - } - } - let mut buffers = vec![]; - for (i, b) in arr(&j, "buffers").iter().enumerate() { - let data = match b.get("uri").and_then(Value::as_str) { - Some(u) => load_uri(u, resolve)?, - None if i == 0 => bin.map(<[u8]>::to_vec).ok_or_else(|| perr("buffer 0 has no uri and the file has no BIN chunk"))?, - None => vec![], - }; - buffers.push(data); - } - let d = Doc { j: &j, buffers, zero_left: Cell::new(MAX_ZERO_COMPONENTS), read_left: Cell::new(read_budget), read_cap: read_budget }; - - // Images → textures (decoded once per image; samplers set the wrap modes). - let mut images: Vec>> = vec![]; - for im in arr(&j, "images") { - let data = if let Some(u) = im.get("uri").and_then(Value::as_str) { - load_uri(u, resolve).ok() - } else if let Some(bv) = idx(im, "bufferView") { - arr(&j, "bufferViews").get(bv).and_then(|v| { - let b = d.buffers.get(idx(v, "buffer").unwrap_or(0))?; - let o = idx(v, "byteOffset").unwrap_or(0); - b.get(o..o.checked_add(idx(v, "byteLength").unwrap_or(0))?).map(<[u8]>::to_vec) - }) - } else { - None - }; - images.push(data.and_then(|b| Texture::decode(&b).ok()).map(Arc::new)); - } - let wrap = |v: u64| match v { - 33071 => Wrap::Clamp, - 33648 => Wrap::Mirror, - _ => Wrap::Repeat, - }; - let mut textures: Vec> = vec![]; - let mut tex_map: Vec> = vec![]; - for t in arr(&j, "textures") { - let Some(img) = idx(t, "source").and_then(|s| images.get(s).cloned().flatten()) else { - tex_map.push(None); - continue; - }; - let samp = idx(t, "sampler").and_then(|s| arr(&j, "samplers").get(s)); - let ws = samp.and_then(|s| s.get("wrapS")).and_then(Value::as_u64).unwrap_or(10497); - let wt = samp.and_then(|s| s.get("wrapT")).and_then(Value::as_u64).unwrap_or(10497); - let w = [wrap(ws), wrap(wt)]; - let tex = if img.wrap == w { img } else { Arc::new(Texture { wrap: w, ..(*img).clone() }) }; - tex_map.push(Some(textures.len())); - textures.push(tex); - } - let tref = |v: Option<&Value>| -> Option { - let v = v?; - let t = tex_map.get(idx(v, "index")?).copied().flatten()?; - Some(TexRef { texture: t, uv_set: idx(v, "texCoord").unwrap_or(0) as u32 }) - }; - - let mut materials = vec![]; - for m in arr(&j, "materials") { - let pbr = m.get("pbrMetallicRoughness").cloned().unwrap_or(Value::Null); - let bc = nums(&pbr, "baseColorFactor", [1.0; 4]); - let ext = m.get("extensions"); - let strength = ext.and_then(|e| e.get("KHR_materials_emissive_strength")).map_or(1.0, |e| num(e, "emissiveStrength", 1.0)); - let em = nums(m, "emissiveFactor", [0.0; 3]); - materials.push(Material { - name: m.get("name").and_then(Value::as_str).unwrap_or("").to_string(), - base_color: bc.map(|v| v as f32), - base_color_tex: tref(pbr.get("baseColorTexture")), - metallic: num(&pbr, "metallicFactor", 1.0) as f32, - roughness: num(&pbr, "roughnessFactor", 1.0) as f32, - metallic_roughness_tex: tref(pbr.get("metallicRoughnessTexture")), - normal_tex: tref(m.get("normalTexture")), - normal_scale: m.get("normalTexture").map_or(1.0, |n| num(n, "scale", 1.0)) as f32, - occlusion_tex: tref(m.get("occlusionTexture")), - occlusion_strength: m.get("occlusionTexture").map_or(1.0, |n| num(n, "strength", 1.0)) as f32, - emissive: [(em[0] * strength) as f32, (em[1] * strength) as f32, (em[2] * strength) as f32], - emissive_tex: tref(m.get("emissiveTexture")), - alpha_mode: match m.get("alphaMode").and_then(Value::as_str) { - Some("MASK") => AlphaMode::Mask, - Some("BLEND") => AlphaMode::Blend, - _ => AlphaMode::Opaque, - }, - alpha_cutoff: num(m, "alphaCutoff", 0.5) as f32, - double_sided: m.get("doubleSided").and_then(Value::as_bool).unwrap_or(false), - unlit: ext.and_then(|e| e.get("KHR_materials_unlit")).is_some(), - }); - } - - let mut meshes = vec![]; - for m in arr(&j, "meshes") { - let mut mesh = Mesh { name: m.get("name").and_then(Value::as_str).unwrap_or("").to_string(), primitives: vec![] }; - for p in arr(m, "primitives") { - if let Some(prim) = primitive(&d, p, &materials)? { - mesh.primitives.push(prim); - } - } - meshes.push(mesh); - } - - let mut nodes = vec![]; - for n in arr(&j, "nodes") { - let matrix = n.get("matrix").and_then(Value::as_array).filter(|a| a.len() == 16).map(|a| { - // Column-major in the file. - let v: Vec = a.iter().map(|x| x.as_f64().unwrap_or(0.0)).collect(); - let mut m = [[0.0; 4]; 4]; - for c in 0..4 { - for r in 0..4 { - m[r][c] = v[c * 4 + r]; - } - } - Mat4(m) - }); - nodes.push(Node { - name: n.get("name").and_then(Value::as_str).unwrap_or("").to_string(), - translation: nums(n, "translation", [0.0; 3]), - rotation: nums(n, "rotation", [0.0, 0.0, 0.0, 1.0]), - scale: nums(n, "scale", [1.0; 3]), - matrix, - mesh: idx(n, "mesh").filter(|&m| m < meshes.len()), - skin: idx(n, "skin"), - camera: idx(n, "camera"), - light: n.get("extensions").and_then(|e| e.get("KHR_lights_punctual")).and_then(|e| idx(e, "light")), - children: indices(n, "children"), - }); - } - - let scene = idx(&j, "scene").unwrap_or(0); - let roots: Vec = match arr(&j, "scenes").get(scene) { - Some(s) => indices(s, "nodes"), - None => { - // No scene: every node that is nobody's child. - let mut child = vec![false; nodes.len()]; - for n in &nodes { - for &c in &n.children { - if c < child.len() { - child[c] = true; - } - } - } - (0..nodes.len()).filter(|&i| !child[i]).collect() - } - }; - - let mut skins = vec![]; - for s in arr(&j, "skins") { - let joints: Vec = indices(s, "joints"); - let inverse_bind = match idx(s, "inverseBindMatrices") { - Some(a) => { - let (f, _) = d.floats(a)?; - f.as_chunks::<16>() - .0 - .iter() - .map(|v| { - let mut m = [[0.0; 4]; 4]; - for c in 0..4 { - for r in 0..4 { - m[r][c] = v[c * 4 + r] as f64; - } - } - Mat4(m) - }) - .collect() - } - None => vec![Mat4::IDENTITY; joints.len()], - }; - skins.push(Skin { joints, inverse_bind }); - } - - let mut animations = vec![]; - for a in arr(&j, "animations") { - let samplers = arr(a, "samplers"); - let mut anim = Animation { name: a.get("name").and_then(Value::as_str).unwrap_or("").to_string(), channels: vec![] }; - for c in arr(a, "channels") { - let Some(t) = c.get("target") else { continue }; - let Some(node) = idx(t, "node") else { continue }; - let path = match t.get("path").and_then(Value::as_str) { - Some("translation") => ChannelPath::Translation, - Some("rotation") => ChannelPath::Rotation, - Some("scale") => ChannelPath::Scale, - _ => continue, - }; - let Some(s) = idx(c, "sampler").and_then(|s| samplers.get(s)) else { continue }; - let interp = match s.get("interpolation").and_then(Value::as_str) { - Some("STEP") => Interp::Step, - Some("CUBICSPLINE") => Interp::CubicSpline, - _ => Interp::Linear, - }; - let (Some(input), Some(output)) = (idx(s, "input"), idx(s, "output")) else { continue }; - let (times, _) = d.floats(input)?; - let (values, _) = d.floats(output)?; - anim.channels.push(Channel { node, path, interp, times, values }); - } - animations.push(anim); - } - - let cameras = arr(&j, "cameras").iter().enumerate().map(|(i, c)| camera(c, i)).collect(); - let lights = j - .get("extensions") - .and_then(|e| e.get("KHR_lights_punctual")) - .map(|e| arr(e, "lights").iter().enumerate().map(|(i, l)| light(l, i)).collect()) - .unwrap_or_default(); - Ok(Model { meshes, nodes, roots, materials, textures, skins, animations, cameras, lights }) -} - -fn name_or(v: &Value, d: String) -> String { - v.get("name").and_then(Value::as_str).filter(|s| !s.is_empty()).map(str::to_string).unwrap_or(d) -} - -/// A glTF camera (glTF 2.0 §5.12): `perspective` {yfov, aspectRatio?, znear} or -/// `orthographic` {xmag, ymag}. -fn camera(c: &Value, i: usize) -> crate::ModelCamera { - let projection = match (c.get("type").and_then(Value::as_str), c.get("orthographic")) { - (Some("orthographic"), Some(o)) => crate::CameraProjection::Orthographic { xmag: num(o, "xmag", 1.0), ymag: num(o, "ymag", 1.0) }, - _ => { - let p = c.get("perspective").cloned().unwrap_or(Value::Null); - crate::CameraProjection::Perspective { - yfov: num(&p, "yfov", 0.8).clamp(1e-3, 3.1), - aspect: p.get("aspectRatio").and_then(Value::as_f64), - znear: num(&p, "znear", 0.01), - } - } - }; - crate::ModelCamera { name: name_or(c, format!("Camera {}", i + 1)), projection } -} - -/// A `KHR_lights_punctual` light: type, color, intensity, range, spot cone angles. -fn light(l: &Value, i: usize) -> crate::ModelLight { - let kind = match l.get("type").and_then(Value::as_str) { - Some("directional") => crate::ModelLightKind::Directional, - Some("spot") => { - let s = l.get("spot").cloned().unwrap_or(Value::Null); - let outer = num(&s, "outerConeAngle", std::f64::consts::FRAC_PI_4).clamp(1e-3, std::f64::consts::FRAC_PI_2); - crate::ModelLightKind::Spot { inner: num(&s, "innerConeAngle", 0.0).clamp(0.0, outer), outer } - } - _ => crate::ModelLightKind::Point, - }; - crate::ModelLight { - name: name_or(l, format!("Light {}", i + 1)), - kind, - color: nums(l, "color", [1.0; 3]), - intensity: num(l, "intensity", 1.0).max(0.0), - range: l.get("range").and_then(Value::as_f64), - } -} - -fn primitive(d: &Doc, p: &Value, materials: &[Material]) -> Result> { - let mode = idx(p, "mode").unwrap_or(4); - if !matches!(mode, 4..=6) { - return Ok(None); - } - let attrs = p.get("attributes").ok_or_else(|| perr("primitive without attributes"))?; - let Some(pa) = idx(attrs, "POSITION") else { return Ok(None) }; - let (pos, _) = d.floats(pa)?; - let positions: Vec<[f32; 3]> = pos.as_chunks::<3>().0.iter().map(|c| [c[0], c[1], c[2]]).collect(); - let n = positions.len(); - let vec3s = |a: Option| -> Result> { - Ok(match a { - Some(a) => d.floats(a)?.0.as_chunks::<3>().0.iter().map(|c| [c[0], c[1], c[2]]).collect(), - None => vec![], - }) - }; - let mut normals = vec3s(idx(attrs, "NORMAL"))?; - let uvs: Vec<[f32; 2]> = match idx(attrs, "TEXCOORD_0") { - Some(a) => d.floats(a)?.0.as_chunks::<2>().0.iter().map(|c| [c[0], c[1]]).collect(), - None => vec![], - }; - let tangents: Vec<[f32; 4]> = match idx(attrs, "TANGENT") { - Some(a) => d.floats(a)?.0.as_chunks::<4>().0.iter().map(|c| [c[0], c[1], c[2], c[3]]).collect(), - None => vec![], - }; - let joints: Vec<[u16; 4]> = match idx(attrs, "JOINTS_0") { - Some(a) => d.ints(a)?.as_chunks::<4>().0.iter().map(|c| [c[0] as u16, c[1] as u16, c[2] as u16, c[3] as u16]).collect(), - None => vec![], - }; - let weights: Vec<[f32; 4]> = match idx(attrs, "WEIGHTS_0") { - Some(a) => d.floats(a)?.0.as_chunks::<4>().0.iter().map(|c| [c[0], c[1], c[2], c[3]]).collect(), - None => vec![], - }; - let raw: Vec = match idx(p, "indices") { - Some(a) => d.ints(a)?, - None => { - // Generated indices are allocated like a read, once per referencing primitive. - d.charge(n)?; - (0..n as u32).collect() - } - }; - if raw.iter().any(|&i| i as usize >= n) { - return Err(perr("index out of range")); - } - let mut indices = Vec::with_capacity(raw.len()); - match mode { - 5 => { - for i in 2..raw.len() { - let (a, b, c) = (raw[i - 2], raw[i - 1], raw[i]); - if i % 2 == 0 { indices.extend([a, b, c]) } else { indices.extend([b, a, c]) } - } - } - 6 => { - for i in 2..raw.len() { - indices.extend([raw[0], raw[i - 1], raw[i]]); - } - } - _ => indices.extend(raw.as_chunks::<3>().0.iter().flatten()), - } - // The triangle list is kept besides the raw indices (a strip or fan of k indices becomes - // 3(k-2)), so it is charged like a read. - d.charge(indices.len())?; - if normals.len() != n { - normals.clear(); - } - let material = idx(p, "material").filter(|&m| m < materials.len()); - let skinned = joints.len() == n && weights.len() == n; - if normals.is_empty() { - // Flat normals unshare every vertex: position and normal, plus UVs and joints/weights. - let per = 6 + if uvs.len() == n { 2 } else { 0 } + if skinned { 8 } else { 0 }; - d.charge_each(indices.len(), per)?; - } - let mut prim = Primitive { - positions, - normals, - uvs: if uvs.len() == n { uvs } else { vec![] }, - tangents: if tangents.len() == n { tangents } else { vec![] }, - joints: if skinned { joints } else { vec![] }, - weights: if skinned { weights } else { vec![] }, - indices, - material, - }; - if prim.normals.is_empty() { - prim.flat_normals(); - prim.tangents.clear(); - } - let needs_tangents = material.is_some_and(|m| materials[m].normal_tex.is_some()); - if needs_tangents && prim.tangents.is_empty() { - d.charge_each(prim.positions.len(), 4)?; - prim.compute_tangents(); - } - Ok(Some(prim)) -} - -#[cfg(test)] -mod tests { - use super::uri_decode; - - #[test] - fn uri_decode_rejects_signed_hex_pair() { - assert_eq!(uri_decode("a%+1b"), "a%+1b"); - assert_eq!(uri_decode("a%-1b"), "a%-1b"); - assert_eq!(uri_decode("a%41b"), "aAb"); - } + let mut buffers = |uri: &str| resolve(uri); + let scene = craft_mesh::gltf::read(bytes, &limits(), &mut buffers).map_err(error)?; + to_model(scene, MissingNormals::Flat, &|im| { + let uri = im.uri.as_deref()?; + match uri.strip_prefix("data:") { + Some(_) => None, + // craft-mesh decodes external image URIs while constructing the scene. Decode only + // once here; a second pass changes literal percent escapes in valid filenames. + None => resolve(uri), + } + }) } diff --git a/crates/model/src/lib.rs b/crates/model/src/lib.rs index 19a0d37f3..0f25570eb 100644 --- a/crates/model/src/lib.rs +++ b/crates/model/src/lib.rs @@ -1,12 +1,14 @@ //! 3D models for the Advanced 3D renderer. //! -//! - [`gltf`]: glTF 2.0 import (`.gltf` with external or embedded buffers, `.glb`), written from -//! the Khronos glTF 2.0 specification: meshes, PBR metallic-roughness materials (base colour, -//! metallic-roughness, normal, occlusion and emissive maps), the node hierarchy, skins and -//! animations. +//! The file formats are read with `craft-mesh` (storytold/craft-libs); this crate maps its +//! scene onto [`Model`], decodes the textures and adds the normals and tangents a file leaves out. +//! +//! - [`gltf`]: glTF 2.0 import (`.gltf` with external or embedded buffers, `.glb`): meshes, PBR +//! metallic-roughness materials (base colour, metallic-roughness, normal, occlusion and +//! emissive maps), the node hierarchy, skins, animations, cameras and lights. //! - [`obj`]: Wavefront OBJ geometry with MTL materials (mapped onto the metallic-roughness model). //! - [`stl`]: STL meshes (binary and ASCII, with the binary per-facet and part colours). -//! - [`fbx`]: FBX 7.x scenes, binary and ASCII: meshes, the Model hierarchy, Lambert/Phong +//! - [`fbx`]: FBX 6.x and 7.x scenes, binary and ASCII: meshes, the Model hierarchy, Lambert/Phong //! materials and their textures. //! - [`prim`]: parametric primitives (cube, sphere, plane, torus, cone, cylinder). //! - [`extrude`]: extruded, bevelled meshes from 2D outlines (text and shape layers), with @@ -22,6 +24,7 @@ pub mod fbx; pub mod gltf; pub mod obj; pub mod prim; +mod scene; pub mod stl; pub mod triangulate; @@ -46,7 +49,7 @@ pub(crate) fn perr(s: impl Into) -> ModelError { } /// Texture coordinate wrapping (glTF sampler wrap modes). -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] pub enum Wrap { #[default] Repeat, @@ -64,14 +67,40 @@ pub struct Texture { pub wrap: [Wrap; 2], } +/// Most pixels one texture may hold (8192 × 8192: 1 GiB as float RGBA). +pub const MAX_TEXTURE_PIXELS: u64 = 1 << 26; +/// Most pixels the textures of one import may hold together (8 GiB as float RGBA: thirty-two 4K +/// maps). A texture past it is left out and the import says so (`Model::warnings`). +pub const MAX_IMPORT_TEXTURE_PIXELS: u64 = 1 << 29; + impl Texture { pub fn solid(c: [f32; 4]) -> Texture { Texture { width: 1, height: 1, data: vec![c], wrap: [Wrap::Repeat; 2] } } + /// The pixel size an image claims, read from its header without decoding it. + pub fn dimensions(bytes: &[u8]) -> Result<(u32, u32)> { + let reader = image::ImageReader::new(std::io::Cursor::new(bytes)).with_guessed_format().map_err(|e| perr(format!("image: {e}")))?; + reader.into_dimensions().map_err(|e| perr(format!("image: {e}"))) + } /// Decode a PNG or JPEG. pub fn decode(bytes: &[u8]) -> Result { - let img = image::load_from_memory(bytes).map_err(|e| perr(format!("image: {e}")))?.to_rgba32f(); + Self::decode_within(bytes, &mut MAX_IMPORT_TEXTURE_PIXELS.clone()) + } + /// [`decode`](Self::decode), of at most [`MAX_TEXTURE_PIXELS`], taking the pixels from `pixels_left`, an import's remaining + /// texture budget, before the image is decoded. + pub fn decode_within(bytes: &[u8], pixels_left: &mut u64) -> Result { + let err = |e: image::ImageError| perr(format!("image: {e}")); + let (w, h) = Self::dimensions(bytes)?; + let pixels = w as u64 * h as u64; + if pixels > MAX_TEXTURE_PIXELS { + return Err(ModelError::Unsupported(format!("a {w}×{h} texture (at most {MAX_TEXTURE_PIXELS} pixels)"))); + } + if pixels > *pixels_left { + return Err(ModelError::Unsupported(format!("a {w}×{h} texture: the model's textures would hold more than {MAX_IMPORT_TEXTURE_PIXELS} pixels"))); + } + let img = image::load_from_memory(bytes).map_err(err)?.to_rgba32f(); let (w, h) = (img.width(), img.height()); + *pixels_left -= pixels; let data = img.pixels().map(|p| p.0).collect(); Ok(Texture { width: w, height: h, data, wrap: [Wrap::Repeat; 2] }) } @@ -201,6 +230,9 @@ impl Primitive { if !self.uvs.is_empty() { p.uvs.push(self.uvs[i]); } + if !self.tangents.is_empty() { + p.tangents.push(self.tangents[i]); + } if !self.joints.is_empty() { p.joints.push(self.joints[i]); p.weights.push(self.weights[i]); @@ -512,6 +544,8 @@ pub struct Model { pub cameras: Vec, /// Punctual lights embedded in the file (glTF `KHR_lights_punctual`). pub lights: Vec, + /// Parts of the file the import left out (textures over the limits), for the user. + pub warnings: Vec, } /// A camera embedded in a model file. @@ -570,8 +604,9 @@ pub struct Instance<'m> { pub mesh: &'m Mesh, /// Node → model space. pub world: Mat4, - /// Skinned meshes: joint matrices (model space, `joint_world × inverse_bind`). - pub joints: Option>, + /// Skinned meshes: joint matrices (model space, `joint_world × inverse_bind`), shared by + /// the instances of one skin. + pub joints: Option>>, } impl Model { @@ -622,6 +657,8 @@ impl Model { let mut seen = vec![false; self.nodes.len()]; let mut stack: Vec = self.roots.clone(); let mut out = vec![]; + // The pose is one for the whole scene, so every instance of a skin shares its matrices. + let mut joints_of: std::collections::HashMap>> = std::collections::HashMap::new(); while let Some(i) = stack.pop() { if i >= self.nodes.len() || seen[i] { continue; @@ -629,12 +666,19 @@ impl Model { seen[i] = true; let n = &self.nodes[i]; if let Some(m) = n.mesh.and_then(|m| self.meshes.get(m)) { - let joints = n.skin.and_then(|s| self.skins.get(s)).map(|s| { - s.joints - .iter() - .enumerate() - .map(|(k, &j)| world.get(j).copied().unwrap_or(Mat4::IDENTITY) * s.inverse_bind.get(k).copied().unwrap_or(Mat4::IDENTITY)) - .collect() + let joints = n.skin.and_then(|si| self.skins.get(si).map(|s| (si, s))).map(|(si, s)| { + joints_of + .entry(si) + .or_insert_with(|| { + Arc::new( + s.joints + .iter() + .enumerate() + .map(|(k, &j)| world.get(j).copied().unwrap_or(Mat4::IDENTITY) * s.inverse_bind.get(k).copied().unwrap_or(Mat4::IDENTITY)) + .collect(), + ) + }) + .clone() }); // Skinned vertices are placed by their joints alone (glTF: the node transform of // a skinned mesh is ignored). diff --git a/crates/model/src/obj.rs b/crates/model/src/obj.rs index 22d9877a2..c305cf23f 100644 --- a/crates/model/src/obj.rs +++ b/crates/model/src/obj.rs @@ -1,33 +1,21 @@ -//! Wavefront OBJ geometry and MTL materials. +//! Wavefront OBJ geometry and MTL materials, read with `craft-mesh` (`craft_mesh::obj`). //! -//! OBJ: `v` (optional vertex colours ignored), `vt`, `vn`, `f` with `v`, `v/vt`, `v//vn`, -//! `v/vt/vn` references (negative = relative), polygons fan-triangulated, `o`/`g` groups, `s` -//! smoothing (normals computed per smoothing state when a face has none), `usemtl`, `mtllib`. -//! -//! MTL materials map onto metallic-roughness: `Kd` → base colour, `d`/`Tr` → alpha, `Ke` → -//! emissive, `Pr`/`Pm` (the PBR extension) → roughness/metallic, otherwise roughness from the -//! Phong exponent `Ns` (`sqrt(2 / (Ns + 2))`) and metallic 0; `map_Kd`, `map_Ke`, -//! `map_Bump`/`bump`/`norm` load base colour, emissive and normal textures. +//! The material library and the textures it names are read through the caller's resolver: a +//! texture is looked up by the name as written (a name containing spaces is one name), then by +//! its file name (an absolute path from another machine, #1274), then by the final token (the +//! options convention, `-bm 1 file.png`). Faces without normals get smooth normals within a +//! smoothing group and flat ones where smoothing is off. -use std::collections::HashMap; -use std::sync::Arc; +use crate::scene::{MissingNormals, error, limits, to_model}; +use crate::{Model, Result}; -use crate::{AlphaMode, Material, Mesh, Model, Primitive, Result, TexRef, Texture, perr}; +pub use craft_mesh::srgb_to_linear; -/// The last component of a referenced path, treating `\` as a separator too: a path from a -/// machine of another kind (`C:\textures\checker.png`) still finds `checker.png` next to the -/// model (#1274). `None` when the name carries no path at all. -fn sibling_name(name: &str) -> Option<&str> { - let file = name.rsplit(['/', '\\']).next()?; - (!file.is_empty() && file.len() < name.len()).then_some(file) -} - -/// A material reference resolved against the model's folder: the name as written (a name -/// containing spaces is one name), then its file name (an absolute path from another machine, -/// #1274), then the final token (the options convention, `-bm 1 file.png`). +/// A material reference resolved against the model's folder: the name as written, then its file +/// name, then the final token. fn resolve_reference(resolve: &dyn Fn(&str) -> Option>, name: &str) -> Option> { let mut tried: Vec<&str> = vec![]; - for candidate in [name, sibling_name(name).unwrap_or(name), name.split_whitespace().last().unwrap_or(name)] { + for candidate in [name, craft_mesh::obj::sibling_name(name).unwrap_or(name), name.split_whitespace().last().unwrap_or(name)] { if tried.contains(&candidate) { continue; } @@ -39,263 +27,11 @@ fn resolve_reference(resolve: &dyn Fn(&str) -> Option>, name: &str) -> O None } -/// Parse MTL text into named materials (textures appended to `textures`). -pub fn parse_mtl(text: &str, resolve: &dyn Fn(&str) -> Option>, textures: &mut Vec>) -> Vec { - let mut out: Vec = vec![]; - let mut loaded: HashMap> = HashMap::new(); - let mut tex = |name: &str, textures: &mut Vec>| -> Option { - let key = name.trim().to_string(); - let t = *loaded.entry(key.clone()).or_insert_with(|| { - let Some(b) = resolve_reference(resolve, &key) else { - log::warn!("model: texture `{key}` was not found next to the model"); - return None; - }; - match Texture::decode(&b) { - Ok(t) => { - textures.push(Arc::new(t)); - Some(textures.len() - 1) - } - Err(e) => { - log::warn!("model: cannot decode texture `{key}`: {e}"); - None - } - } - }); - t.map(|texture| TexRef { texture, uv_set: 0 }) - }; - let mut ns_seen = false; - let mut pr_seen = false; - for line in text.lines() { - let line = line.trim(); - let (key, rest) = line.split_once(char::is_whitespace).map(|(k, r)| (k, r.trim())).unwrap_or((line, "")); - let f3 = || -> [f32; 3] { - let v: Vec = rest.split_whitespace().filter_map(|x| x.parse().ok()).collect(); - match v.len() { - 0 => [0.0; 3], - 1 | 2 => [v[0]; 3], - _ => [v[0], v[1], v[2]], - } - }; - let f1 = || rest.split_whitespace().next().and_then(|x| x.parse::().ok()); - if key == "newmtl" { - if let Some(m) = out.last_mut() { - finish(m, ns_seen, pr_seen); - } - ns_seen = false; - pr_seen = false; - out.push(Material { name: rest.to_string(), metallic: 0.0, roughness: 0.5, ..Material::default() }); - continue; - } - let Some(m) = out.last_mut() else { continue }; - match key { - "Kd" => { - let c = f3(); - m.base_color = [srgb_to_linear(c[0]), srgb_to_linear(c[1]), srgb_to_linear(c[2]), m.base_color[3]]; - } - "Ke" => m.emissive = f3().map(srgb_to_linear), - "d" => m.base_color[3] = f1().unwrap_or(1.0), - "Tr" => m.base_color[3] = 1.0 - f1().unwrap_or(0.0), - "Ns" => { - let ns = f1().unwrap_or(0.0).max(0.0); - if !pr_seen { - m.roughness = (2.0 / (ns + 2.0)).sqrt(); - } - ns_seen = true; - } - "Pr" => { - m.roughness = f1().unwrap_or(0.5).clamp(0.0, 1.0); - pr_seen = true; - } - "Pm" => m.metallic = f1().unwrap_or(0.0).clamp(0.0, 1.0), - "map_Kd" => m.base_color_tex = tex(rest, textures), - "map_Ke" => { - m.emissive_tex = tex(rest, textures); - if m.emissive == [0.0; 3] { - m.emissive = [1.0; 3]; - } - } - "map_Bump" | "map_bump" | "bump" | "norm" => m.normal_tex = tex(rest, textures), - _ => {} - } - } - if let Some(m) = out.last_mut() { - finish(m, ns_seen, pr_seen); - } - out -} - -fn finish(m: &mut Material, _ns: bool, _pr: bool) { - if m.base_color[3] < 0.999 { - m.alpha_mode = AlphaMode::Blend; - } -} - -/// sRGB-encoded component → linear (MTL colours are display colours). -pub fn srgb_to_linear(c: f32) -> f32 { - if c <= 0.04045 { c / 12.92 } else { ((c + 0.055) / 1.055).powf(2.4) } -} - -#[derive(Clone, Copy, PartialEq, Eq, Hash)] -struct Key { - v: u32, - t: u32, - n: u32, - /// Smoothing state (faces without normals get computed normals per state). - s: u32, -} - -/// Parse OBJ text (and its MTL libraries through `resolve`). +/// Parse OBJ text (and its MTL libraries and textures through `resolve`). pub fn parse(bytes: &[u8], resolve: &dyn Fn(&str) -> Option>) -> Result { - let text = String::from_utf8_lossy(bytes); - let mut v: Vec<[f32; 3]> = vec![]; - let mut vt: Vec<[f32; 2]> = vec![]; - let mut vn: Vec<[f32; 3]> = vec![]; - let mut materials: Vec = vec![]; - let mut textures: Vec> = vec![]; - // One primitive per material, in order of first use. - let mut prims: Vec<(Option, Primitive, HashMap, Vec)> = vec![]; - let mut current: Option = None; - let mut smooth = 0u32; - let mut flat_id = 1u32 << 31; - let mut faces = 0usize; - // Join `\` line continuations. - let joined = text.replace("\\\r\n", " ").replace("\\\n", " "); - for (ln, line) in joined.lines().enumerate() { - let line = line.split('#').next().unwrap_or("").trim(); - if line.is_empty() { - continue; - } - let mut it = line.split_whitespace(); - let key = it.next().unwrap_or(""); - let rest: Vec<&str> = it.collect(); - let fl = |i: usize| rest.get(i).and_then(|x| x.parse::().ok()); - match key { - "v" => v.push([fl(0).unwrap_or(0.0), fl(1).unwrap_or(0.0), fl(2).unwrap_or(0.0)]), - "vt" => vt.push([fl(0).unwrap_or(0.0), fl(1).unwrap_or(0.0)]), - "vn" => vn.push([fl(0).unwrap_or(0.0), fl(1).unwrap_or(0.0), fl(2).unwrap_or(1.0)]), - "s" => { - smooth = match rest.first().copied() { - None | Some("off") | Some("0") => 0, - Some(x) => x.parse().unwrap_or(1).max(1), - } - } - "mtllib" => { - let name = line["mtllib".len()..].trim(); - let mut found = false; - for file in std::iter::once(name).chain(name.split_whitespace()).chain(sibling_name(name)) { - if let Some(b) = resolve(file) { - let mut ms = parse_mtl(&String::from_utf8_lossy(&b), resolve, &mut textures); - materials.append(&mut ms); - found = true; - break; - } - } - if !found && !name.is_empty() { - log::warn!("model: material library `{name}` was not found next to the model"); - } - } - "usemtl" => { - let name = line["usemtl".len()..].trim(); - current = materials.iter().position(|m| m.name == name); - if current.is_none() { - // Unknown material: a named grey default. - materials.push(Material { name: name.to_string(), metallic: 0.0, roughness: 0.5, base_color: [0.8, 0.8, 0.8, 1.0], ..Material::default() }); - current = Some(materials.len() - 1); - } - } - "f" => { - if rest.len() < 3 { - continue; - } - faces += 1; - let resolve_i = |s: &str, len: usize| -> Option { - if s.is_empty() { - return None; - } - let i: i64 = s.parse().ok()?; - let k = if i < 0 { len as i64 + i } else { i - 1 }; - (k >= 0 && (k as usize) < len).then_some(k as u32) - }; - let mut refs = vec![]; - for r in &rest { - let mut parts = r.split('/'); - let vi = resolve_i(parts.next().unwrap_or(""), v.len()).ok_or_else(|| perr(format!("line {}: bad vertex index `{r}`", ln + 1)))?; - let ti = parts.next().and_then(|s| resolve_i(s, vt.len())); - let ni = parts.next().and_then(|s| resolve_i(s, vn.len())); - refs.push((vi, ti, ni)); - } - let has_n = refs.iter().all(|r| r.2.is_some()); - // Faces without normals: shared within a smoothing group, unique otherwise. - let s = if has_n { - 0 - } else if smooth == 0 { - flat_id += 1; - flat_id - } else { - smooth - }; - let slot = match prims.iter().position(|p| p.0 == current) { - Some(i) => i, - None => { - prims.push((current, Primitive { material: current, ..Default::default() }, HashMap::new(), vec![])); - prims.len() - 1 - } - }; - let (_, prim, map, need) = &mut prims[slot]; - let mut ids = vec![]; - for (vi, ti, ni) in refs { - let k = Key { v: vi, t: ti.unwrap_or(u32::MAX), n: ni.unwrap_or(u32::MAX), s }; - let id = *map.entry(k).or_insert_with(|| { - prim.positions.push(v[vi as usize]); - prim.uvs.push(ti.map_or([0.0, 0.0], |t| vt[t as usize])); - prim.normals.push(ni.map_or([0.0; 3], |n| vn[n as usize])); - need.push(ni.is_none()); - (prim.positions.len() - 1) as u32 - }); - ids.push(id); - } - for i in 2..ids.len() { - prim.indices.extend([ids[0], ids[i - 1], ids[i]]); - } - } - _ => {} - } - } - if faces == 0 { - return Err(perr("OBJ file without faces")); - } - let any_uv = !vt.is_empty(); - let mut mesh = Mesh { name: String::new(), primitives: vec![] }; - for (_, mut p, _, need) in prims { - if need.iter().any(|&b| b) { - // Fill missing normals from the triangles (area weighted), keep given ones. - let given = p.normals.clone(); - p.compute_normals(); - for (i, n) in p.normals.iter_mut().enumerate() { - if !need[i] { - *n = given[i]; - } - } - } - if !any_uv { - p.uvs.clear(); - } else { - // OBJ's v axis points up the image; textures are stored top row first. - for uv in p.uvs.iter_mut() { - uv[1] = 1.0 - uv[1]; - } - } - if p.material.is_some_and(|m| materials[m].normal_tex.is_some()) { - p.compute_tangents(); - } - mesh.primitives.push(p); - } - Ok(Model::single(mesh, materials).with_textures(textures)) -} - -impl Model { - fn with_textures(mut self, t: Vec>) -> Model { - self.textures = t; - self - } + // `craft-mesh` splits `mtllib` names and tries each complete library path itself. Applying + // texture-option fallback here first can mistake the last library for the whole directive. + let mut library = |name: &str| resolve(name); + let scene = craft_mesh::obj::read(bytes, &limits(), &mut library).map_err(error)?; + to_model(scene, MissingNormals::BySmoothing, &|im| resolve_reference(resolve, im.uri.as_deref()?.trim())) } diff --git a/crates/model/src/scene.rs b/crates/model/src/scene.rs new file mode 100644 index 000000000..07fee0397 --- /dev/null +++ b/crates/model/src/scene.rs @@ -0,0 +1,459 @@ +//! A `craft-mesh` scene (glTF, OBJ, STL or FBX, read there) as a [`Model`]: one primitive per +//! part with one index per vertex, decoded textures, and the normals and tangents the renderer +//! needs where the file has none. + +use std::collections::HashMap; +use std::sync::Arc; + +use craft_mesh as cm; + +use crate::{ + AlphaMode, Animation, CameraProjection, Channel, ChannelPath, Interp, MAX_IMPORT_TEXTURE_PIXELS, Mat4, Material, Mesh, Model, ModelCamera, ModelError, + ModelLight, ModelLightKind, Node, Primitive, Result, Skin, TexRef, Texture, Wrap, +}; + +/// The bounds every reader keeps: `craft-mesh`'s defaults, with up to 2 GiB of buffers, +/// arrays and embedded images in one import. +pub(crate) fn limits() -> cm::Limits { + cm::Limits { max_data_bytes: 2 << 30, ..cm::Limits::default() } +} + +pub(crate) fn error(e: cm::Error) -> ModelError { + match e { + cm::Error::Missing(name) => ModelError::Missing(name), + cm::Error::Unsupported(m) => ModelError::Unsupported(m), + cm::Error::Malformed(m) | cm::Error::TooLarge(m) => ModelError::Parse(m), + } +} + +/// What a primitive without normals gets. +#[derive(Clone, Copy, PartialEq, Eq)] +pub(crate) enum MissingNormals { + /// Every triangle its own vertices and face normal (glTF 2.0 §3.7.2.1). + Flat, + /// Area-weighted vertex normals (FBX). + Smooth, + /// Smooth within an OBJ smoothing group, flat where smoothing is off. + BySmoothing, +} + +/// A column-major `craft-mesh` matrix as a [`Mat4`]. +pub(crate) fn mat4(m: &cm::Mat4) -> Mat4 { + let mut out = [[0.0; 4]; 4]; + for (c, col) in m.as_chunks::<4>().0.iter().enumerate() { + for (r, v) in col.iter().enumerate() { + out[r][c] = *v; + } + } + Mat4(out) +} + +fn wrap(w: cm::Wrap) -> Wrap { + match w { + cm::Wrap::Repeat => Wrap::Repeat, + cm::Wrap::Clamp => Wrap::Clamp, + cm::Wrap::Mirror => Wrap::Mirror, + } +} + +/// The scene as a model. `image` gives the bytes of an image the scene names but does not hold +/// (OBJ, which only names its textures); an image that cannot be read or decoded leaves its +/// material untextured, with a log line. +pub(crate) fn to_model(mut scene: cm::Scene, missing: MissingNormals, image: &dyn Fn(&cm::Image) -> Option>) -> Result { + let mut warnings = std::mem::take(&mut scene.warnings); + for w in &warnings { + log::warn!("model: {w}"); + } + // Images decode once; each (image, wrap) a material uses is one texture. + let mut pixels_left = MAX_IMPORT_TEXTURE_PIXELS; + let mut decoded_by_name: HashMap>> = HashMap::new(); + let decoded: Vec>> = scene + .images + .iter() + .enumerate() + .map(|(index, im)| { + let key = image_key(im, index); + if let Some(decoded) = decoded_by_name.get(&key) { + return decoded.clone(); + } + let external; + let bytes = if let Some(data) = im.data.as_deref() { + Some(data) + } else { + external = image(im); + external.as_deref() + }; + let decoded = match bytes.map(|b| Texture::decode_within(b, &mut pixels_left)) { + Some(Ok(t)) => Some(Arc::new(t)), + Some(Err(e)) => { + let warning = format!("texture `{}` was left out: {e}", im.uri.as_deref().unwrap_or(&im.name)); + log::warn!("model: {warning}"); + warnings.push(warning); + None + } + None => { + let warning = format!("texture `{}` was not found next to the model", im.uri.as_deref().unwrap_or(&im.name)); + log::warn!("model: {warning}"); + warnings.push(warning); + None + } + }; + decoded_by_name.insert(key, decoded.clone()); + decoded + }) + .collect(); + let mut textures: Vec> = vec![]; + let mut texture_of: HashMap<(String, [Wrap; 2]), usize> = HashMap::new(); + for texture in &scene.texture_variants { + ensure_texture(&scene, &decoded, *texture, &mut textures, &mut texture_of, &mut pixels_left, &mut warnings); + } + let mut tref = |t: Option| -> Option { + let t = t?; + let texture = ensure_texture(&scene, &decoded, t, &mut textures, &mut texture_of, &mut pixels_left, &mut warnings)?; + Some(TexRef { texture, uv_set: t.uv_set }) + }; + let materials: Vec = scene + .materials + .iter() + .map(|m| Material { + name: m.name.clone(), + base_color: m.base_color, + base_color_tex: tref(m.base_color_texture), + metallic: m.metallic, + roughness: m.roughness, + metallic_roughness_tex: tref(m.metallic_roughness_texture), + normal_tex: tref(m.normal_texture), + normal_scale: m.normal_scale, + occlusion_tex: tref(m.occlusion_texture), + occlusion_strength: m.occlusion_strength, + emissive: m.emissive, + emissive_tex: tref(m.emissive_texture), + alpha_mode: match m.alpha_mode { + cm::AlphaMode::Opaque => AlphaMode::Opaque, + cm::AlphaMode::Mask(_) => AlphaMode::Mask, + cm::AlphaMode::Blend => AlphaMode::Blend, + }, + alpha_cutoff: if let cm::AlphaMode::Mask(c) = m.alpha_mode { c } else { 0.5 }, + double_sided: m.double_sided, + unlit: m.unlit, + }) + .collect(); + let mut adapter_bytes = 0u64; + let meshes = scene.meshes.iter().map(|m| mesh(m, &materials, missing, &mut adapter_bytes)).collect::>>()?; + let nodes = scene + .nodes + .iter() + .map(|n| { + let (translation, rotation, scale, matrix) = match n.trs { + Some(t) => (t.translation, t.rotation, t.scale, None), + None => ([0.0; 3], [0.0, 0.0, 0.0, 1.0], [1.0; 3], Some(mat4(&n.transform))), + }; + Node { + name: n.name.clone(), + translation, + rotation, + scale, + matrix, + mesh: n.mesh.filter(|&m| m < scene.meshes.len()), + skin: n.skin, + camera: n.camera, + light: n.light, + children: n.children.clone(), + } + }) + .collect(); + let skins = scene + .skins + .iter() + .map(|s| Skin { + joints: s.joints.clone(), + inverse_bind: if s.inverse_bind.is_empty() { vec![Mat4::IDENTITY; s.joints.len()] } else { s.inverse_bind.iter().map(mat4).collect() }, + }) + .collect(); + let animations = scene + .animations + .iter() + .map(|a| Animation { + name: a.name.clone(), + channels: a + .channels + .iter() + .map(|c| Channel { + node: c.node, + path: match c.path { + cm::ChannelPath::Translation => ChannelPath::Translation, + cm::ChannelPath::Rotation => ChannelPath::Rotation, + cm::ChannelPath::Scale => ChannelPath::Scale, + }, + interp: match c.interpolation { + cm::Interpolation::Step => Interp::Step, + cm::Interpolation::Linear => Interp::Linear, + cm::Interpolation::CubicSpline => Interp::CubicSpline, + }, + times: c.times.clone(), + values: c.values.clone(), + }) + .collect(), + }) + .collect(); + let name_or = |n: &str, d: String| if n.is_empty() { d } else { n.to_string() }; + let cameras = scene + .cameras + .iter() + .enumerate() + .map(|(i, c)| ModelCamera { + name: name_or(&c.name, format!("Camera {}", i + 1)), + projection: match c.projection { + cm::Projection::Perspective { yfov, aspect, znear, .. } => CameraProjection::Perspective { yfov: yfov.clamp(1e-3, 3.1), aspect, znear }, + cm::Projection::Orthographic { xmag, ymag, .. } => CameraProjection::Orthographic { xmag, ymag }, + }, + }) + .collect(); + let lights = scene + .lights + .iter() + .enumerate() + .map(|(i, l)| ModelLight { + name: name_or(&l.name, format!("Light {}", i + 1)), + kind: match l.kind { + cm::LightKind::Directional => ModelLightKind::Directional, + cm::LightKind::Point => ModelLightKind::Point, + cm::LightKind::Spot { inner, outer } => { + let outer = outer.clamp(1e-3, std::f64::consts::FRAC_PI_2); + ModelLightKind::Spot { inner: inner.clamp(0.0, outer), outer } + } + }, + color: l.color, + intensity: l.intensity.max(0.0), + range: l.range, + }) + .collect(); + Ok(Model { meshes, nodes, roots: scene.roots, materials, textures, skins, animations, cameras, lights, warnings }) +} + +fn image_key(image: &cm::Image, index: usize) -> String { + image.uri.as_deref().or_else(|| (!image.name.is_empty()).then_some(image.name.as_str())).map(str::to_string).unwrap_or_else(|| format!("image:{index}")) +} + +fn ensure_texture( + scene: &cm::Scene, + decoded: &[Option>], + reference: cm::TextureRef, + textures: &mut Vec>, + texture_of: &mut HashMap<(String, [Wrap; 2]), usize>, + pixels_left: &mut u64, + warnings: &mut Vec, +) -> Option { + let image = decoded.get(reference.image)?.as_ref()?; + let wrap_mode = reference.wrap.map(wrap); + let key = (image_key(scene.images.get(reference.image)?, reference.image), wrap_mode); + if let Some(&index) = texture_of.get(&key) { + return Some(index); + } + if image.wrap != wrap_mode { + let cost = (image.width as u64).checked_mul(image.height as u64); + let Some(cost) = cost.filter(|&cost| cost <= *pixels_left) else { + let source = scene.images.get(reference.image)?; + let warning = format!("texture `{}` wrap variant exceeds the model texture pixel limit", source.uri.as_deref().unwrap_or(&source.name)); + log::warn!("model: {warning}"); + warnings.push(warning); + return None; + }; + *pixels_left -= cost; + textures.push(Arc::new(Texture { wrap: wrap_mode, ..(**image).clone() })); + } else { + textures.push(image.clone()); + } + let index = textures.len() - 1; + texture_of.insert(key, index); + Some(index) +} + +/// One primitive per part, each with one vertex per distinct corner of its triangles. Normals +/// and UVs are kept for a part when every corner of it has them; a triangle naming a vertex +/// that is not there is left out. +fn mesh(m: &cm::Mesh, materials: &[Material], missing: MissingNormals, adapter_bytes: &mut u64) -> Result { + let skinned = !m.joints.is_empty() && m.joints.len() == m.positions.len() && m.weights.len() == m.positions.len(); + let uv_set = m.uv_sets.first(); + // Include temporary hash keys, smoothing maps and the peak duplicate produced by + // flat-normal expansion. + // Account against the whole scene before building any primitive arrays. + let projected = m + .parts + .iter() + .try_fold(0u64, |sum, part| { + let has_missing = part.corners.iter().any(|c| (c.normal as usize) >= m.normals.len()); + let flat = missing == MissingNormals::Flat || (missing == MissingNormals::BySmoothing && part.smoothing == 0); + let vertices = if flat && has_missing { (part.triangle_count() as u64).checked_mul(3)? } else { part.corners.len() as u64 }; + let bytes_per_vertex = if missing == MissingNormals::Flat { 64 } else { 128 }; + sum.checked_add(vertices.checked_mul(bytes_per_vertex)?) + }) + .ok_or_else(|| ModelError::Parse("expanded mesh size overflow".into()))?; + *adapter_bytes = adapter_bytes.checked_add(projected).ok_or_else(|| ModelError::Parse("expanded mesh size overflow".into()))?; + if *adapter_bytes > (2u64 << 30) { + return Err(ModelError::Parse("expanded mesh data exceeds the 2 GiB import limit".into())); + } + let smooth = smooth_normals(m, missing); + let mut primitives = vec![]; + for part in &m.parts { + let normals = part.corners.iter().any(|c| (c.normal as usize) < m.normals.len()); + let tangents = part.has_tangents && m.tangents.len() == m.positions.len(); + let uvs = uv_set.filter(|set| part.corners.iter().any(|c| (c.uv as usize) < set.len())); + let flat_missing = missing == MissingNormals::BySmoothing && part.smoothing == 0; + let mut authored_normals = vec![]; + let mut ids: HashMap<(cm::Corner, Option), u32> = HashMap::new(); + let mut p = Primitive { material: part.material.filter(|&i| i < materials.len()), ..Primitive::default() }; + for (face, t) in part.triangles().enumerate() { + if t.iter().any(|c| c.position as usize >= m.positions.len()) { + continue; + } + let flat_face_normal = (normals && flat_missing).then(|| face_normal(m, t)); + for c in t { + let has_normal = (c.normal as usize) < m.normals.len(); + let has_uv = uvs.is_some_and(|set| (c.uv as usize) < set.len()); + let key = ( + cm::Corner { position: c.position, normal: if has_normal { c.normal } else { cm::NONE }, uv: if has_uv { c.uv } else { cm::NONE } }, + (!has_normal && flat_face_normal.is_some()).then_some(face), + ); + let next = p.positions.len() as u32; + let id = *ids.entry(key).or_insert_with(|| { + let at = c.position as usize; + p.positions.push(m.positions.get(at).copied().unwrap_or_default().map(|x| x as f32)); + if normals { + let authored = m.normals.get(c.normal as usize).copied().map(|n| n.map(|x| x as f32)); + let fallback = flat_face_normal.or_else(|| smooth.get(&(c.position, part.material, smooth_group(part, missing))).copied()); + authored_normals.push(authored.or(fallback)); + p.normals.push(authored.or(fallback).unwrap_or([0.0, 0.0, 1.0])); + } else if let Some(n) = smooth.get(&(c.position, part.material, smooth_group(part, missing))) { + p.normals.push(*n); + } + if tangents { + p.tangents.push(m.tangents.get(at).copied().unwrap_or_default().map(|x| x as f32)); + } + if let Some(set) = uvs { + p.uvs.push(set.get(c.uv as usize).copied().unwrap_or_default()); + } + if skinned { + p.joints.push(m.joints.get(at).copied().unwrap_or_default()); + p.weights.push(m.weights.get(at).copied().unwrap_or_default()); + } + next + }); + p.indices.push(id); + } + } + if p.indices.is_empty() { + continue; + } + if normals && authored_normals.iter().any(Option::is_none) { + // Keep authored corner normals, and fill only absent ones from the surrounding + // triangles. The generated normals are smooth in a mixed-authorship part. + if authored_normals.iter().any(Option::is_none) { + p.compute_normals(); + for (n, authored) in p.normals.iter_mut().zip(authored_normals) { + if let Some(authored) = authored { + *n = authored; + } + } + } + } else if p.normals.is_empty() { + match missing { + MissingNormals::Flat => p.flat_normals(), + MissingNormals::BySmoothing if part.smoothing == 0 => p.flat_normals(), + MissingNormals::Smooth | MissingNormals::BySmoothing => p.compute_normals(), + } + } + if p.tangents.is_empty() && p.material.is_some_and(|i| materials.get(i).is_some_and(|mat| mat.normal_tex.is_some())) { + p.compute_tangents(); + } + primitives.push(p); + } + Ok(Mesh { name: m.name.clone(), primitives }) +} + +fn smooth_group(part: &cm::Part, missing: MissingNormals) -> u32 { + match missing { + MissingNormals::Smooth => 1, + MissingNormals::BySmoothing => part.smoothing, + MissingNormals::Flat => 0, + } +} + +fn face_normal(m: &cm::Mesh, tri: [cm::Corner; 3]) -> [f32; 3] { + let [a, b, c] = tri.map(|corner| m.positions.get(corner.position as usize).copied().unwrap_or_default()); + let u = [b[0] - a[0], b[1] - a[1], b[2] - a[2]]; + let v = [c[0] - a[0], c[1] - a[1], c[2] - a[2]]; + let n = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]]; + let len = (n[0] * n[0] + n[1] * n[1] + n[2] * n[2]).sqrt(); + if len > 0.0 { n.map(|x| (x / len) as f32) } else { [0.0, 0.0, 1.0] } +} + +/// Area weighted generated normals across parts with the same material and smoothing state. +fn smooth_normals(m: &cm::Mesh, missing: MissingNormals) -> HashMap<(u32, Option, u32), [f32; 3]> { + let mut sums: HashMap<(u32, Option, u32), [f64; 3]> = HashMap::new(); + if missing == MissingNormals::Flat { + return HashMap::new(); + } + for part in &m.parts { + let group = smooth_group(part, missing); + if group == 0 { + continue; + } + for tri in part.triangles() { + let Some(a) = m.positions.get(tri[0].position as usize) else { continue }; + let Some(b) = m.positions.get(tri[1].position as usize) else { continue }; + let Some(c) = m.positions.get(tri[2].position as usize) else { continue }; + let u = [b[0] - a[0], b[1] - a[1], b[2] - a[2]]; + let v = [c[0] - a[0], c[1] - a[1], c[2] - a[2]]; + let face = [u[1] * v[2] - u[2] * v[1], u[2] * v[0] - u[0] * v[2], u[0] * v[1] - u[1] * v[0]]; + for corner in tri { + if (corner.normal as usize) < m.normals.len() { + continue; + } + let n = sums.entry((corner.position, part.material, group)).or_default(); + for i in 0..3 { + n[i] += face[i]; + } + } + } + } + sums.into_iter() + .map(|(key, n)| { + let len = (n[0] * n[0] + n[1] * n[1] + n[2] * n[2]).sqrt(); + let n = if len > 0.0 { n.map(|x| (x / len) as f32) } else { [0.0, 0.0, 1.0] }; + (key, n) + }) + .collect() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn wrap_variants_share_and_charge_the_import_pixel_budget() { + let scene = cm::Scene { images: vec![cm::Image { name: "texture.png".into(), ..cm::Image::default() }], ..cm::Scene::default() }; + let texture = Arc::new(Texture { width: 2, height: 2, data: vec![[1.0; 4]; 4], wrap: [Wrap::Repeat; 2] }); + let decoded = vec![Some(texture)]; + let mut textures = vec![]; + let mut texture_of = HashMap::new(); + // The decoded image has already taken four pixels from this budget. + let mut pixels_left = 4; + let mut warnings = vec![]; + let clamped = cm::TextureRef { image: 0, uv_set: 0, wrap: [cm::Wrap::Clamp; 2] }; + + let first = ensure_texture(&scene, &decoded, clamped, &mut textures, &mut texture_of, &mut pixels_left, &mut warnings).unwrap(); + let shared = ensure_texture(&scene, &decoded, clamped, &mut textures, &mut texture_of, &mut pixels_left, &mut warnings).unwrap(); + assert_eq!(first, shared); + assert_eq!(pixels_left, 0); + + let repeated = cm::TextureRef { wrap: [cm::Wrap::Repeat; 2], ..clamped }; + assert!(ensure_texture(&scene, &decoded, repeated, &mut textures, &mut texture_of, &mut pixels_left, &mut warnings).is_some()); + assert_eq!(pixels_left, 0); + + let mirrored = cm::TextureRef { wrap: [cm::Wrap::Mirror; 2], ..clamped }; + assert!(ensure_texture(&scene, &decoded, mirrored, &mut textures, &mut texture_of, &mut pixels_left, &mut warnings).is_none()); + assert_eq!(textures.len(), 2); + assert_eq!(warnings.len(), 1); + } +} diff --git a/crates/model/src/stl.rs b/crates/model/src/stl.rs index 34e9a7f06..4fb8ee084 100644 --- a/crates/model/src/stl.rs +++ b/crates/model/src/stl.rs @@ -1,201 +1,23 @@ -//! STL (stereolithography) meshes, binary and ASCII. +//! STL (stereolithography) meshes, binary and ASCII, read with `craft-mesh` +//! (`craft_mesh::stl`): every facet keeps its own three vertices and its face normal, and binary +//! colour extensions become one plain material per colour. //! -//! Written from the public description of the format (3D Systems' StereoLithography Interface -//! Specification, 1989, and its widely documented colour extensions): -//! -//! - Binary: an 80-byte header, a little-endian `u32` facet count, then 50 bytes per facet: a -//! normal and three vertices (12 `f32`) and a 16-bit attribute word. Bytes after the last -//! facet are ignored. -//! - ASCII: `solid name`, then `facet normal nx ny nz` / `outer loop` / `vertex x y z`… / -//! `endloop` / `endfacet`, closed by `endsolid`; several solids may follow each other. -//! Loops with more than three vertices are fan-triangulated. -//! - Colour (binary only): with `COLOR=r g b a` (four bytes) in the header (Materialise Magics), -//! that is the part's colour and a facet whose attribute has bit 15 clear has its own colour -//! (red in bits 0–4, green 5–9, blue 10–14); otherwise (VisCAM / SolidView) a facet with bit 15 -//! set has its own colour (blue in bits 0–4, green 5–9, red 10–14). Each colour becomes a -//! plain dielectric material; uncoloured files get none (the renderer's default material). -//! -//! STL has no units, no UVs and no shared vertices: every facet keeps its own three vertices -//! with the face normal from its counter-clockwise winding (the stored normal is only used when -//! the triangle is degenerate), which gives the faceted look of an STL part. STL files are -//! Z-up (3D printing and CAD); they are turned to the +Y-up convention of [`crate::Model`] -//! (`(x, y, z)` → `(x, z, −y)`, a proper rotation, so winding is kept). Facets with non-finite -//! coordinates are skipped. +//! STL files are Z-up (3D printing and CAD); they are turned to the +Y-up convention of +//! [`crate::Model`] (`(x, y, z)` → `(x, z, −y)`, a proper rotation, so winding is kept). -use std::collections::HashMap; - -use crate::{Material, Mesh, Model, Primitive, Result, cross, normalize, obj::srgb_to_linear, perr, sub}; - -/// Header (80) plus facet count (4). -const HEADER: usize = 84; -/// Bytes per binary facet. -const FACET: usize = 50; - -/// Parse an STL file (binary or ASCII, detected from the contents). -pub fn parse(bytes: &[u8]) -> Result { - let count = bytes.get(80..HEADER).and_then(|b| <[u8; 4]>::try_from(b).ok()).map(u32::from_le_bytes); - let needed = count.and_then(|n| (n as usize).checked_mul(FACET)).and_then(|n| n.checked_add(HEADER)); - // A binary file's size is exact; many binary headers still begin with `solid`, so the size - // decides first, then the ASCII keyword. - if needed.is_some_and(|n| n == bytes.len()) { - return binary(bytes); - } - if looks_ascii(bytes) { - return ascii(bytes); - } - if needed.is_some_and(|n| n <= bytes.len()) { - return binary(bytes); - } - Err(perr("not an STL file (truncated binary facets or no `solid` keyword)")) -} - -fn looks_ascii(bytes: &[u8]) -> bool { - let head = bytes.get(..bytes.len().min(512)).unwrap_or(&[]); - let text = String::from_utf8_lossy(head); - let t = text.trim_start(); - t.get(..5).is_some_and(|k| k.eq_ignore_ascii_case("solid")) && (t.contains("facet") || t.contains("endsolid")) -} +use crate::scene::{MissingNormals, error, limits, to_model}; +use crate::{Model, Result}; /// The Z-up → Y-up turn. -fn y_up(v: [f32; 3]) -> [f32; 3] { +fn y_up(v: [f64; 3]) -> [f64; 3] { [v[0], v[2], -v[1]] } -/// Facets grouped into primitives by colour, in order of first use. -#[derive(Default)] -struct Builder { - /// (colour key, primitive); `None` = uncoloured. - prims: Vec<(Option<[u8; 3]>, Primitive)>, - /// Colour → index into `prims` (up to 32 768 colours, so not a linear search). - slots: HashMap, usize>, - facets: usize, -} - -impl Builder { - /// Add one triangle (file coordinates); `stored` is the file's facet normal. - fn tri(&mut self, color: Option<[u8; 3]>, stored: [f32; 3], v: [[f32; 3]; 3]) { - if v.iter().flatten().any(|c| !c.is_finite()) { - return; - } - let v = v.map(y_up); - let n = normalize(cross(sub(v[1], v[0]), sub(v[2], v[0]))) - .or_else(|| stored.iter().all(|c| c.is_finite()).then(|| normalize(y_up(stored))).flatten()) - .unwrap_or([0.0, 1.0, 0.0]); - let slot = *self.slots.entry(color).or_insert_with(|| { - self.prims.push((color, Primitive::default())); - self.prims.len() - 1 - }); - let Some((_, p)) = self.prims.get_mut(slot) else { return }; - for c in v { - p.indices.push(p.positions.len() as u32); - p.positions.push(c); - p.normals.push(n); - } - self.facets += 1; - } - - fn finish(self, name: String) -> Result { - if self.facets == 0 { - return Err(perr("STL file without facets")); - } - let mut materials = vec![]; - let mut mesh = Mesh { name, primitives: vec![] }; - for (color, mut p) in self.prims { - if let Some(c) = color { - let lin = c.map(|x| srgb_to_linear(x as f32 / 255.0)); - let name = format!("#{:02X}{:02X}{:02X}", c[0], c[1], c[2]); - materials.push(Material { name, ..Material::plain([lin[0], lin[1], lin[2], 1.0], 0.0, 0.5) }); - p.material = Some(materials.len() - 1); - } - mesh.primitives.push(p); - } - // Uncoloured facets next to coloured ones: a neutral grey of their own. - if !materials.is_empty() { - for p in mesh.primitives.iter_mut().filter(|p| p.material.is_none()) { - materials.push(Material { name: "STL".into(), ..Material::plain([0.6, 0.6, 0.6, 1.0], 0.0, 0.5) }); - p.material = Some(materials.len() - 1); - } - } - Ok(Model::single(mesh, materials)) +/// Parse an STL file (binary or ASCII, detected from the contents). +pub fn parse(bytes: &[u8]) -> Result { + let mut scene = craft_mesh::stl::read(bytes, &limits()).map_err(error)?; + for m in &mut scene.meshes { + m.positions.iter_mut().chain(m.normals.iter_mut()).for_each(|v| *v = y_up(*v)); } -} - -fn f32_at(b: &[u8], at: usize) -> f32 { - b.get(at..at + 4).and_then(|s| <[u8; 4]>::try_from(s).ok()).map_or(f32::NAN, f32::from_le_bytes) -} - -/// A 5-bit channel expanded to 8 bits. -fn five(x: u16) -> u8 { - let x = (x & 31) as u8; - (x << 3) | (x >> 2) -} - -/// The Magics `COLOR=` part colour in the header (RGB; alpha is ignored). -fn header_color(header: &[u8]) -> Option<[u8; 3]> { - let at = header.windows(6).position(|w| w == b"COLOR=")?; - let c = header.get(at + 6..at + 10)?; - Some([*c.first()?, *c.get(1)?, *c.get(2)?]) -} - -fn binary(bytes: &[u8]) -> Result { - let header = bytes.get(..80).ok_or_else(|| perr("STL header truncated"))?; - let magics = header_color(header); - let body = bytes.get(HEADER..).unwrap_or(&[]); - let count = bytes.get(80..HEADER).and_then(|b| <[u8; 4]>::try_from(b).ok()).map_or(0, u32::from_le_bytes) as usize; - let mut b = Builder::default(); - for f in body.as_chunks::().0.iter().take(count) { - let n = [f32_at(f, 0), f32_at(f, 4), f32_at(f, 8)]; - let v = [0usize, 1, 2].map(|k| [f32_at(f, 12 + 12 * k), f32_at(f, 16 + 12 * k), f32_at(f, 20 + 12 * k)]); - let attr = f.get(48..50).and_then(|a| <[u8; 2]>::try_from(a).ok()).map_or(0, u16::from_le_bytes); - let color = match magics { - Some(part) => Some(if attr & 0x8000 == 0 { [five(attr), five(attr >> 5), five(attr >> 10)] } else { part }), - None => (attr & 0x8000 != 0).then(|| [five(attr >> 10), five(attr >> 5), five(attr)]), - }; - b.tri(color, n, v); - } - let text = String::from_utf8_lossy(header); - let name = text.trim_matches(|c: char| c == '\0' || c.is_whitespace()); - b.finish(name.strip_prefix("solid").unwrap_or(name).trim().to_string()) -} - -/// Three numbers from the rest of an ASCII line. -fn three<'a>(it: &mut impl Iterator) -> Option<[f32; 3]> { - Some([it.next()?.parse().ok()?, it.next()?.parse().ok()?, it.next()?.parse().ok()?]) -} - -fn ascii(bytes: &[u8]) -> Result { - let text = String::from_utf8_lossy(bytes); - let mut b = Builder::default(); - let mut name: Option = None; - let mut normal = [0.0f32; 3]; - let mut loop_v: Vec<[f32; 3]> = vec![]; - for (ln, line) in text.lines().enumerate() { - let line = line.trim(); - let mut it = line.split_whitespace(); - let Some(key) = it.next() else { continue }; - let bad = || perr(format!("STL line {}: expected three numbers", ln + 1)); - match key.to_ascii_lowercase().as_str() { - "solid" if name.is_none() => { - name = Some(line.get(5..).unwrap_or("").trim().to_string()); - } - "facet" => { - // `facet normal nx ny nz` - normal = it.next().and_then(|_| three(&mut it)).unwrap_or([0.0; 3]); - loop_v.clear(); - } - "vertex" => loop_v.push(three(&mut it).ok_or_else(bad)?), - "endloop" | "endfacet" => { - if let Some((&first, rest)) = loop_v.split_first() { - for w in rest.windows(2) { - if let [a, c] = w { - b.tri(None, normal, [first, *a, *c]); - } - } - } - loop_v.clear(); - } - _ => {} - } - } - b.finish(name.unwrap_or_default()) + to_model(scene, MissingNormals::Flat, &|_| None) } diff --git a/crates/model/src/tests.rs b/crates/model/src/tests.rs index 5ee6a6950..8c6a347fb 100644 --- a/crates/model/src/tests.rs +++ b/crates/model/src/tests.rs @@ -119,6 +119,22 @@ fn obj_without_normals_gets_them() { assert!(obj::parse(b"v 0 0 0\n", &|_| None).is_err()); } +#[test] +fn obj_mixed_authored_normals_keep_flat_missing_corners() { + let src = b"v 0 0 0\nv 1 0 0\nv 0 1 0\nv 0 0 1\nvn 0 1 0\ns off\nf 1//1 2 3\nf 1 3 4\n"; + let m = obj::parse(src, &|_| None).unwrap(); + let corners: Vec<_> = m.meshes[0] + .primitives + .iter() + .flat_map(|p| p.positions.iter().zip(&p.normals)) + .filter(|(position, _)| **position == [0.0, 1.0, 0.0]) + .map(|(_, normal)| *normal) + .collect(); + assert!(corners.contains(&[0.0, 0.0, 1.0]), "{corners:?}"); + assert!(corners.contains(&[1.0, 0.0, 0.0]), "{corners:?}"); + assert!(m.meshes[0].primitives.iter().any(|p| p.normals.contains(&[0.0, 1.0, 0.0]))); +} + #[test] fn obj_textures_from_another_machine_find_the_file_next_to_the_model() { // No committed media: the material file and its textures are written by the test itself. @@ -432,6 +448,58 @@ fn contours_group_into_outlines_by_nesting() { assert_eq!(g.iter().map(|o| o.holes.len()).sum::(), 2); } +#[test] +fn overlapping_contours_keep_every_container_in_their_depth() { + let rect = |x0: f64, y0: f64, x1: f64, y1: f64| vec![[x0, y0], [x1, y0], [x1, y1], [x0, y1]]; + // C's first vertex lies inside both A and B, which overlap without nesting: C is two deep, + // an outer contour, not a hole cut out of B. + let g = group_contours(vec![rect(0.0, 0.0, 10.0, 10.0), rect(5.0, -2.0, 13.0, 8.0), rect(9.0, 1.0, 12.0, 2.0)]); + assert_eq!(g.len(), 3); + assert_eq!(g.iter().map(|o| o.holes.len()).sum::(), 0); +} + +#[test] +fn a_contour_inside_a_hole_takes_the_innermost_outline_not_the_hole() { + let rect = |x0: f64, y0: f64, x1: f64, y1: f64| vec![[x0, y0], [x1, y0], [x1, y1], [x0, y1]]; + // A and B overlap; C lies in A only (a hole of A); D lies in A, B and C (three deep, a hole). + // The smallest container of D is the hole C, which has no outline of its own: D goes to B. + let g = group_contours(vec![rect(0.0, 0.0, 10.0, 10.0), rect(5.0, -2.0, 13.0, 8.0), rect(1.0, 1.0, 9.0, 9.0), rect(6.0, 2.0, 7.0, 3.0)]); + assert_eq!(g.len(), 2); + assert_eq!(g.iter().map(|o| o.holes.len()).collect::>(), [1, 1], "C is a hole of A, D a hole of B (not dropped)"); +} + +#[test] +fn a_hole_whose_outline_is_deeper_than_it_is_still_attached() { + let rect = |x0: f64, y0: f64, x1: f64, y1: f64| vec![[x0, y0], [x1, y0], [x1, y1], [x0, y1]]; + // D is three deep and its innermost outline A four deep: A's slot must exist before D is attached. + let a = rect(0.0, 0.0, 10.0, 10.0); + let g = group_contours(vec![ + a.clone(), + rect(-1.0, -1.0, 20.0, 20.0), + rect(-2.0, -2.0, 25.0, 25.0), + rect(5.0, 5.0, 6.0, 6.0), + rect(-100.0, -100.0, 3.0, 3.0), + rect(-0.5, -1000.0, 0.5, 1000.0), + ]); + let o = g.iter().find(|o| o.outer == a).expect("A is an outline"); + assert_eq!(o.holes.len(), 1, "D is a hole of A"); +} + +#[test] +fn gltf_images_naming_one_file_share_their_wrap_variants() { + let png = { + let img = image::RgbaImage::from_fn(2, 2, |x, y| if (x + y) % 2 == 0 { image::Rgba([255, 0, 0, 255]) } else { image::Rgba([0, 0, 255, 255]) }); + let mut out = std::io::Cursor::new(Vec::new()); + img.write_to(&mut out, image::ImageFormat::Png).unwrap(); + out.into_inner() + }; + // Two image entries with one URI share a decode; two textures clamp it, so they share one copy. + let doc = br#"{"asset":{"version":"2.0"},"images":[{"uri":"t.png"},{"uri":"t.png"}], + "samplers":[{"wrapS":33071,"wrapT":33071}],"textures":[{"source":0,"sampler":0},{"source":1,"sampler":0}]}"#; + let m = gltf::parse(doc, &|u| (u == "t.png").then(|| png.clone())).unwrap(); + assert_eq!(m.textures.len(), 1, "one clamped copy for both textures"); +} + #[test] fn gltf_cameras_and_punctual_lights() { let doc = r#"{ @@ -597,9 +665,9 @@ fn gltf_accessor_counts_are_checked_against_the_buffer_before_allocating() { let view = r#"{"buffer": 0, "byteLength": 36}"#; let cases = [ // A count far beyond the 36-byte buffer. - (r#"{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": 4000000000}"#, view, "past its buffer"), + (r#"{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": 4000000000}"#, view, "limit allows"), // count * components overflows. - (r#"{"bufferView": 0, "componentType": 5126, "type": "MAT4", "count": 9223372036854775807}"#, view, "too large"), + (r#"{"bufferView": 0, "componentType": 5126, "type": "MAT4", "count": 9223372036854775807}"#, view, "limit allows"), // Offsets that overflow when added. ( r#"{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": 3, "byteOffset": 16}"#, @@ -607,11 +675,11 @@ fn gltf_accessor_counts_are_checked_against_the_buffer_before_allocating() { "past its buffer", ), // A stride that overflows with the count. - (r#"{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": 3000000000}"#, r#"{"buffer": 0, "byteStride": 252}"#, "past its buffer"), + (r#"{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": 3000000000}"#, r#"{"buffer": 0, "byteStride": 252}"#, "limit allows"), // A stride smaller than an element would re-read the same bytes for a huge count. (r#"{"bufferView": 0, "componentType": 5126, "type": "MAT4", "count": 30}"#, r#"{"buffer": 0, "byteStride": 1}"#, "smaller than"), // No buffer view: nothing backs the count, so it is capped. - (r#"{"componentType": 5126, "type": "VEC3", "count": 1000000000}"#, view, "without a bufferView"), + (r#"{"componentType": 5126, "type": "VEC3", "count": 1000000000}"#, view, "limit allows"), ]; let t0 = std::time::Instant::now(); for (acc, v, want) in cases { @@ -669,65 +737,112 @@ fn gltf_issue_2139_huge_mat4_count_is_an_error() { } #[test] -fn gltf_buffer_less_accessors_share_one_zero_budget() { - // Each buffer-less accessor is capped, but nothing backs any of them, so referencing a capped - // one from many primitives must not multiply the allocation (#2139). +fn gltf_reused_buffer_less_accessor_is_read_once() { + // The shared reader parses a repeated accessor only once, so referencing it from several + // primitives does not multiply its one bounded allocation. let acc = r#"{"componentType": 5126, "type": "VEC3", "count": 5000000}"#; let prims = [r#"{"attributes": {"POSITION": 0}}"#; 4].join(", "); let doc = gltf_doc(acc, r#"{"buffer": 0}"#, 3).replace(r#"[{"attributes": {"POSITION": 0}}]"#, &format!("[{prims}]")); assert_eq!(doc.matches(r#""POSITION": 0"#).count(), 4); - let e = crate::gltf::parse(doc.as_bytes(), &|_| None).err().unwrap_or_else(|| panic!("imported")); - assert!(e.to_string().contains("without a bufferView"), "{e}"); - // One such accessor read once still imports. - let doc = gltf_doc(acc, r#"{"buffer": 0}"#, 3); - assert!(crate::gltf::parse(doc.as_bytes(), &|_| None).is_ok()); -} - -/// `refs` primitives sharing one buffer-backed `verts`-vertex POSITION accessor, without indices. -fn gltf_shared_positions(verts: usize, refs: usize) -> String { - let acc = format!(r#"{{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": {verts}}}"#); - let prims = vec![r#"{"attributes": {"POSITION": 0}}"#; refs].join(", "); - gltf_doc(&acc, r#"{"buffer": 0}"#, verts * 12).replace(r#"[{"attributes": {"POSITION": 0}}]"#, &format!("[{prims}]")) + let result = crate::gltf::parse(doc.as_bytes(), &|_| None); + assert!(result.is_ok(), "{result:?}"); } #[test] -fn gltf_buffer_backed_reads_share_one_read_budget() { - // A buffer-backed accessor is checked against its buffer, but each primitive that references - // it reads and keeps its own copy, so a small file listing many references must not ask for - // memory set by the reference count (#2139 review). Everything a primitive keeps is charged - // to one per-file budget: 1,000 vertices without indices or normals cost 3,000 position - // components, 1,000 generated indices, a 999-index triangle list and 999 flat-shaded - // vertices of 6 components, 10,993 in all. - let one = gltf_shared_positions(1000, 1); - let m = crate::gltf::parse_with_budget(one.as_bytes(), &|_| None, 20_000).unwrap(); - assert_eq!(m.meshes[0].primitives.len(), 1); - let three = gltf_shared_positions(1000, 3); - assert_eq!(three.matches(r#""POSITION": 0"#).count(), 3); - let e = crate::gltf::parse_with_budget(three.as_bytes(), &|_| None, 20_000).err().unwrap_or_else(|| panic!("imported")); - assert!(e.to_string().contains("more than 20000 components"), "{e}"); - // The real cap leaves room for legitimate sharing: many primitives over one vertex buffer. - let m = crate::gltf::parse(gltf_shared_positions(1000, 50).as_bytes(), &|_| None).unwrap(); - assert_eq!(m.meshes[0].primitives.len(), 50); +fn texture_decoding_is_charged_to_the_import_budget() { + let png = { + let img = image::RgbaImage::from_pixel(2, 2, image::Rgba([0, 255, 0, 255])); + let mut b = std::io::Cursor::new(vec![]); + img.write_to(&mut b, image::ImageFormat::Png).unwrap(); + b.into_inner() + }; + let mut left = 4; + assert_eq!(Texture::decode_within(&png, &mut left).unwrap().data.len(), 4); + assert_eq!(left, 0); + assert!(matches!(Texture::decode_within(&png, &mut left), Err(ModelError::Unsupported(_)))); } #[test] -fn gltf_missing_indices_are_charged_to_the_read_budget() { - // Without `indices` every vertex gets a generated index, allocated like a read: after the - // 3,000 position components, 999 left is one short for the 1,000 indices. - let doc = gltf_shared_positions(1000, 1); - let e = crate::gltf::parse_with_budget(doc.as_bytes(), &|_| None, 3999).err().unwrap_or_else(|| panic!("imported")); - assert!(e.to_string().contains("(1000 requested, 999 left)"), "{e}"); +fn obj_repeated_material_libraries_and_textures_load_once() { + let png = { + let img = image::RgbaImage::from_pixel(1, 1, image::Rgba([0, 255, 0, 255])); + let mut b = std::io::Cursor::new(vec![]); + img.write_to(&mut b, image::ImageFormat::Png).unwrap(); + b.into_inner() + }; + let mtl = b"newmtl A\nmap_Kd t.png\nnewmtl B\nmap_Kd t.png\n".to_vec(); + let src = b"mtllib m.mtl\nmtllib m.mtl\nv 0 0 0\nv 1 0 0\nv 0 1 0\nusemtl A\nf 1 2 3\nusemtl B\nf 1 2 3\nusemtl A\nf 1 2 3\n"; + let m = obj::parse(src, &|name| match name { + "m.mtl" => Some(mtl.clone()), + "t.png" => Some(png.clone()), + _ => None, + }) + .unwrap(); + assert_eq!(m.materials.iter().map(|m| m.name.as_str()).collect::>(), ["A", "B"]); + assert_eq!(m.textures.len(), 1); + assert_eq!(m.meshes[0].primitives.iter().map(|p| (p.material, p.triangle_count())).collect::>(), [(Some(0), 2), (Some(1), 1)]); } #[test] -fn gltf_strip_expansion_is_charged_to_the_read_budget() { - // A strip of k indices becomes 3(k-2) triangle indices and as many flat-shaded vertices, so - // the output is charged, not only the 1,009 components read. - let doc = gltf_doc(r#"{"bufferView": 0, "componentType": 5126, "type": "VEC3", "count": 3}"#, r#"{"buffer": 0}"#, 1036) - .replace(r#""count": 3}]"#, r#""count": 3}, {"bufferView": 0, "componentType": 5121, "type": "SCALAR", "count": 1000}]"#) - .replace(r#""attributes": {"POSITION": 0}"#, r#""attributes": {"POSITION": 0}, "indices": 1, "mode": 5"#); - let m = crate::gltf::parse_with_budget(doc.as_bytes(), &|_| None, 30_000).unwrap(); - assert_eq!(m.meshes[0].primitives[0].indices.len(), 2994); - let e = crate::gltf::parse_with_budget(doc.as_bytes(), &|_| None, 5000).err().unwrap_or_else(|| panic!("imported")); - assert!(e.to_string().contains("more than 5000 components"), "{e}"); +fn gltf_textures_naming_one_image_share_it() { + let doc = String::from_utf8(fixture("quad.gltf")).unwrap(); + // Three textures of one image: the fixture's sampler, the same sampler again, no sampler. + let doc = doc.replace( + "\"textures\": [\n {\n \"source\": 0,\n \"sampler\": 0\n }\n ]", + "\"textures\": [{\"source\": 0, \"sampler\": 0}, {\"source\": 0, \"sampler\": 0}, {\"source\": 0}]", + ); + let m = gltf::parse(doc.as_bytes(), &|_| None).unwrap(); + assert_eq!(m.textures.len(), 2); + assert_eq!(m.textures[0].wrap, [Wrap::Clamp, Wrap::Repeat]); + assert_eq!(m.textures[1].wrap, [Wrap::Repeat, Wrap::Repeat]); +} + +#[test] +fn instances_of_one_skin_share_its_joint_matrices() { + let p = mesh(PrimitiveKind::Plane, &PrimParams { size: [2.0, 2.0, 0.0], ..Default::default() }); + let mut m = Model::single(Mesh { name: "s".into(), primitives: vec![p] }, vec![Material::default()]); + m.nodes[0].skin = Some(0); + m.nodes.push(Node { mesh: Some(0), skin: Some(0), ..Node::default() }); + m.roots = vec![0, 1]; + m.skins.push(Skin { joints: vec![0], inverse_bind: vec![Mat4::IDENTITY] }); + let inst = m.instances(None, 0.0); + assert_eq!(inst.len(), 2); + assert!(Arc::ptr_eq(inst[0].joints.as_ref().unwrap(), inst[1].joints.as_ref().unwrap())); +} + +#[test] +fn contour_grouping_is_bounded() { + let sq = |x: f64, y: f64, s: f64| vec![[x, y], [x + s, y], [x + s, y + s], [x, y + s]]; + let n = extrude::MAX_CONTOURS + 1; + let cs: Vec> = (0..n).map(|i| sq(i as f64 * 2.0, 0.0, 1.0)).collect(); + let g = group_contours(cs); + assert_eq!(g.len(), extrude::MAX_CONTOURS); + assert!(g.iter().all(|o| o.holes.is_empty())); +} + +/// A texture the import leaves out (too large, or not an image) is named in `Model::warnings`, +/// which the import shows the user; the model still loads. +#[test] +fn left_out_textures_are_reported_as_import_warnings() { + // A 24-bit BMP header claiming 9000×9000 (81 MP, over one texture's limit) over no pixel data. + let mut big = b"BM".to_vec(); + big.extend_from_slice(&[0; 8]); + big.extend_from_slice(&54u32.to_le_bytes()); + big.extend_from_slice(&40u32.to_le_bytes()); + big.extend_from_slice(&9000u32.to_le_bytes()); + big.extend_from_slice(&9000u32.to_le_bytes()); + big.extend_from_slice(&[1, 0, 24, 0]); + big.extend_from_slice(&[0; 24]); + let mtl = b"newmtl A\nmap_Kd big.bmp\nnewmtl B\nmap_Kd junk.png\nnewmtl C\nmap_Kd gone.png\n".to_vec(); + let src = b"mtllib m.mtl\nv 0 0 0\nv 1 0 0\nv 0 1 0\nusemtl A\nf 1 2 3\n"; + let m = obj::parse(src, &|name| match name { + "m.mtl" => Some(mtl.clone()), + "big.bmp" => Some(big.clone()), + "junk.png" => Some(b"not an image".to_vec()), + _ => None, + }) + .unwrap(); + assert!(m.textures.is_empty()); + let all = m.warnings.join("|"); + assert!(all.contains("big.bmp") && all.contains("junk.png") && all.contains("gone.png"), "{all}"); } diff --git a/crates/opusenc/Cargo.toml b/crates/opusenc/Cargo.toml index 489c648ea..db7f2b7f8 100644 --- a/crates/opusenc/Cargo.toml +++ b/crates/opusenc/Cargo.toml @@ -12,4 +12,4 @@ workspace = true [dependencies] [dev-dependencies] -filmcraft-opus = { workspace = true } +craft-audio = { workspace = true } diff --git a/crates/opusenc/README.md b/crates/opusenc/README.md index 1ebf6fedb..8a822ceac 100644 --- a/crates/opusenc/README.md +++ b/crates/opusenc/README.md @@ -85,7 +85,7 @@ recursive band splitting, greedy PVQ search. Not implemented: transient frames, pitch post-filter, intensity stereo, dynamic allocation, VBR. All-zero CELT frames become 3-byte silence packets. -## Measured (tests in `tests/`, FilmCraft decoder) +## Measured (tests in `tests/`, craft-audio's Opus decoder) Synthetic speech (glottal pulses 100–200 Hz through three moving formants, syllable envelopes, pauses) and music (three-note harmonic chords); waveform SNR against the input band-limited to @@ -129,8 +129,8 @@ stage-1/2 codebooks and prediction weights, gain, pitch, contour, LTP and pulse weights) and the decoder-side normative arithmetic the encoder must reproduce bit-exactly (CELT allocation; SILK NLSF dequantisation and stabilisation, NLSF → LPC conversion, `log2lin`, the fixed-point division/inverse helpers and the LPC analysis filter) are mirrored from FilmCraft's -first-party, spec-derived `filmcraft-opus` decoder (MIT OR Apache-2.0), which is also the -round-trip oracle in `tests/` and `crates/export/tests/it/opus_roundtrip.rs` (ffmpeg is a second, +first-party, spec-derived `filmcraft-opus` decoder (MIT OR Apache-2.0). That decoder, now +`craft_audio::opus` in craft-libs, is also the round-trip oracle in `tests/` and `crates/export/tests/it/opus_roundtrip.rs` (ffmpeg is a second, external oracle when installed). All encoder-side analysis and search (pitch, LPC, NLSF and LTP search, noise feedback, rate control, stereo prediction, the decimator) is our own design. No third-party encoder or decoder source (libopus or otherwise) was consulted. diff --git a/crates/opusenc/tests/it/common/mod.rs b/crates/opusenc/tests/it/common/mod.rs index 9b420f31b..8f00b88e9 100644 --- a/crates/opusenc/tests/it/common/mod.rs +++ b/crates/opusenc/tests/it/common/mod.rs @@ -124,9 +124,9 @@ pub fn encode(mut enc: OpusEncoder, planar: &[Vec]) -> (OpusEncoder, Vec]) -> Vec> { - let mut dec = filmcraft_opus::Decoder::new(head).expect("OpusHead"); + let mut dec = craft_audio::opus::Decoder::new(head).expect("OpusHead"); dec.set_trim_pre_skip(true); let mut out: Vec> = vec![Vec::new(); dec.channels()]; for p in packets { diff --git a/crates/path/src/interp.rs b/crates/path/src/interp.rs index 4087b26b5..89e7edc51 100644 --- a/crates/path/src/interp.rs +++ b/crates/path/src/interp.rs @@ -311,6 +311,9 @@ fn frame(v: &[P]) -> (P, f64) { (c, r) } +/// Vertex counts above this skip the shape contexts (quadratic to build) and search the starting +/// vertex coarsely; no mask comes near it (the Add Vertices option itself stops at 2000). +const MAX_CONTEXT_VERTICES: usize = 4096; const RBINS: usize = 5; const ABINS: usize = 12; @@ -412,10 +415,18 @@ pub fn correspond(a: &ShapePath, b: &ShapePath, o: &InterpOpts) -> (ShapePath, S } if !o.first_vertices_match { let n = ra.len(); - let use_sc = o.quality > 0.0; + let large = n > MAX_CONTEXT_VERTICES; + let use_sc = o.quality > 0.0 && !large; let (sa, sb) = if use_sc { (Some(shape_contexts(&ra.vertices)), Some(shape_contexts(&rb.vertices))) } else { (None, None) }; // Quality limits the offsets examined exhaustively (coarse step), then refines. - let step = if o.quality >= 50.0 { 1 } else { ((n as f64 / 24.0).ceil() as usize).max(1) }; + // (A very large shape tries about 3 √n offsets, not n, each costing a pass over it.) + let step = if large { + (n as f64).sqrt().ceil() as usize + } else if o.quality >= 50.0 { + 1 + } else { + ((n as f64 / 24.0).ceil() as usize).max(1) + }; let mut best = (f64::MAX, 0usize); let mut k = 0; while k < n { @@ -592,4 +603,22 @@ mod tests { let l2 = (lin.vertices[1][0] - lin.vertices[0][0]).hypot(lin.vertices[1][1] - lin.vertices[0][1]); assert!(l2 < 80.0); } + + /// A shape with tens of thousands of vertices is matched without the quadratic shape contexts + /// and exhaustive offset search. + #[test] + fn very_large_shapes_are_matched_in_bounded_time() { + let n = 30_000; + let circle = |rot: f64| -> ShapePath { + let pts: Vec

= (0..n) + .map(|i| [100.0 * (rot + i as f64 * std::f64::consts::TAU / n as f64).cos(), 100.0 * (rot + i as f64 * std::f64::consts::TAU / n as f64).sin()]) + .collect(); + ShapePath::polygon(&pts, true) + }; + let o = InterpOpts { one_to_one: true, quality: 100.0, ..Default::default() }; + let t = std::time::Instant::now(); + let (a, b) = correspond(&circle(0.0), &circle(1.0), &o); + assert_eq!((a.len(), b.len()), (n, n)); + assert!(t.elapsed().as_secs() < 30, "{:?}", t.elapsed()); + } } diff --git a/crates/path/src/varstroke.rs b/crates/path/src/varstroke.rs index 61e6a1ab7..da00b02d0 100644 --- a/crates/path/src/varstroke.rs +++ b/crates/path/src/varstroke.rs @@ -220,6 +220,56 @@ fn disc(out: &mut BezPath, c: Point, r: f64) { } } +/// `path` with each curve whose extent is over 10⁷ × `tol` replaced by lines flattened at 10⁻⁷ of +/// that extent. `None` when a coordinate is not finite. +fn coarsen_huge(path: &BezPath, tol: f64) -> Option { + use kurbo::Shape as _; + let mut out = BezPath::new(); + let (mut cur, mut start) = (Point::ZERO, Point::ZERO); + for el in path.elements() { + let seg = match *el { + PathEl::MoveTo(p) => { + (cur, start) = (p, p); + out.push(*el); + continue; + } + PathEl::LineTo(p) => { + cur = p; + out.push(*el); + continue; + } + PathEl::ClosePath => { + cur = start; + out.push(*el); + continue; + } + PathEl::QuadTo(_, p) | PathEl::CurveTo(_, _, p) => { + let mut one = BezPath::new(); + one.move_to(cur); + one.push(*el); + (one, p) + } + }; + let (one, end) = seg; + let bb = one.bounding_box(); + let extent = bb.width().max(bb.height()); + if !extent.is_finite() { + return None; + } + if extent * 1e-7 > tol { + kurbo::flatten(one.elements().iter().copied(), extent * 1e-7, |e| { + if let PathEl::LineTo(p) = e { + out.line_to(p); + } + }); + } else { + out.push(*el); + } + cur = end; + } + Some(out) +} + /// Outline of a tapered / waved stroke (local space; `res_scale` = device/local scale). pub fn outline(paths: &[BezPath], style: &StrokeStyle, res_scale: f64) -> Option { if style.width <= 0.0 { @@ -230,7 +280,11 @@ pub fn outline(paths: &[BezPath], style: &StrokeStyle, res_scale: f64) -> Option let half = style.width / 2.0; for path in paths { // Fine enough for the width profile: ½ device pixel, at most ~20 000 samples per path. - let rough = flatten(path, 0.1 / rs, f64::INFINITY); + // Curves with huge extents are first cut into lines at a tolerance of 10⁻⁷ of their own + // extent, so none subdivides into billions of points before the step below applies; + // every other segment (small curves in a large path included) keeps the ½-pixel tolerance. + let Some(path) = coarsen_huge(path, 0.1 / rs) else { continue }; + let rough = flatten(&path, 0.1 / rs, f64::INFINITY); for poly0 in rough { let len0 = poly0.len(); if len0 <= 0.0 { @@ -396,4 +450,37 @@ mod tests { let area: f32 = m.data.iter().sum(); assert!(area > 240.0 * 6.0 * 0.8 && area < 240.0 * 6.0 * 1.05, "{area}"); } + + /// A curve with enormous coordinates is approximated within a bounded number of points. + #[test] + fn huge_coordinates_do_not_explode_the_first_approximation() { + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.curve_to((1e13, 0.0), (-1e13, 1e13), (1e13, 1e13)); + let st = StrokeStyle { + width: 4.0, + taper: Some(Taper { percent: true, start_len: 50.0, end_len: 50.0, start_width: 0.0, end_width: 0.0, start_ease: 0.0, end_ease: 0.0 }), + ..Default::default() + }; + let t = std::time::Instant::now(); + let o = outline(&[p], &st, 1.0).unwrap(); + assert!(o.elements().len() < 200_000, "{}", o.elements().len()); + assert!(t.elapsed().as_secs() < 20); + } + + /// Small curves keep their shape in a path that also has a huge segment. + #[test] + fn small_curves_survive_a_huge_segment() { + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.curve_to((100.0, 0.0), (0.0, 100.0), (0.0, 0.0)); + p.line_to((1e10, 0.0)); + let c = coarsen_huge(&p, 0.1).unwrap(); + assert_eq!(c.elements().len(), p.elements().len(), "nothing here is huge enough to cut"); + let mut q = BezPath::new(); + q.move_to((0.0, 0.0)); + q.curve_to((1e13, 0.0), (-1e13, 1e13), (1e13, 1e13)); + let c = coarsen_huge(&q, 0.1).unwrap(); + assert!(c.elements().iter().skip(1).all(|e| matches!(e, PathEl::LineTo(_))) && c.elements().len() < 10_000); + } } diff --git a/crates/pdf/Cargo.toml b/crates/pdf/Cargo.toml index bf6148569..68aabfbd7 100644 --- a/crates/pdf/Cargo.toml +++ b/crates/pdf/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-eps = { workspace = true } craft-pdf.workspace = true effectcraft-svg = { workspace = true } kurbo = { workspace = true } diff --git a/crates/pdf/README.md b/crates/pdf/README.md index b38c9032e..53689ba9a 100644 --- a/crates/pdf/README.md +++ b/crates/pdf/README.md @@ -144,7 +144,7 @@ ffmpeg elsewhere) to check the code tables against an independent implementation ## Shared parser setup and bounds The workspace pins `craft-pdf` to `craft-libs` Git revision -`e11f9d9aebea5f6b8e74643c1ea1ed172ba5f545`, with `default-features = false` and only the explicit `read` +`091863e4a615f38743bfd5d6dc62a2e8f37cd5d5`, with `default-features = false` and only the explicit `read` feature. This excludes the backend's bundled fonts and Adobe CMaps and preserves EffectCraft's font and asset policies. The shared parser does not change the supported drawing operators, image codecs, continuously rasterized SVG tree, editable shapes, or EPS interpreter. diff --git a/crates/pdf/src/build.rs b/crates/pdf/src/build.rs index 0b1586f89..0f295a045 100644 --- a/crates/pdf/src/build.rs +++ b/crates/pdf/src/build.rs @@ -7,6 +7,9 @@ use effectcraft_svg::{Affine, BezPath, FillRule, Geom, Group, Node, Paint, Shape /// PostScript program, or the PDF content stream. pub(crate) const MAX_PATH: usize = 1 << 20; +/// The deepest the open groups nest (the render tree and its consumers recurse through them). +const MAX_DEPTH: usize = 256; + #[derive(Clone, Copy, PartialEq, Eq)] enum Kind { Plain, @@ -20,6 +23,9 @@ pub(crate) struct Builder { pub top_layers: Vec, pub skipped: Vec, pub shapes: usize, + /// Groups the finished nodes will sit under once placed (an enclosing builder's open groups + /// and the pattern or mask groups around them), counted against [`MAX_DEPTH`]. + base: usize, } pub(crate) fn group(name: &str) -> Group { @@ -28,13 +34,25 @@ pub(crate) fn group(name: &str) -> Group { impl Builder { pub fn new() -> Builder { - Builder { stack: vec![(group("page"), Kind::Plain)], top_layers: vec![], skipped: vec![], shapes: 0 } + Builder { stack: vec![(group("page"), Kind::Plain)], top_layers: vec![], skipped: vec![], shapes: 0, base: 0 } + } + + /// A builder for content that will be placed inside this one's open groups and `wrap` more + /// groups (a pattern's `Pattern` and `Tile`, a soft mask's two), so its nesting limit counts + /// them. + pub fn nested(&self, wrap: usize) -> Builder { + Builder { base: self.base.saturating_add(self.stack.len()).saturating_add(wrap), ..Builder::new() } } pub fn depth(&self) -> usize { self.stack.len() } + /// `wrap` more groups fit under the open ones within [`MAX_DEPTH`]. + pub fn has_room(&self, wrap: usize) -> bool { + self.base.saturating_add(self.stack.len()).saturating_add(wrap) <= MAX_DEPTH + } + pub fn skip(&mut self, what: &str) { if !self.skipped.iter().any(|s| s == what) { self.skipped.push(what.to_string()); @@ -62,23 +80,33 @@ impl Builder { } } + /// Open `g` as the group drawn into from now on; past [`MAX_DEPTH`] the group is dropped + /// (what would have been drawn inside it goes to the open group) and noted as skipped. + fn push_group(&mut self, g: Group, kind: Kind) { + if self.base.saturating_add(self.stack.len()) >= MAX_DEPTH { + self.skip("group nesting limit"); + return; + } + self.stack.push((g, kind)); + } + /// Children drawn from now on are clipped by `path` (page space) until the group closes. pub fn clip(&mut self, path: BezPath, rule: FillRule) { let mut g = group("Clip Group"); g.clip.push((path, rule)); // Clipping is not a transparency group: blend modes inside reach the backdrop. g.isolated = false; - self.stack.push((g, Kind::Clip)); + self.push_group(g, Kind::Clip); } /// Open an optional-content layer (or a named group). pub fn open(&mut self, name: &str, layer: bool) { - self.stack.push((group(name), if layer { Kind::Layer } else { Kind::Plain })); + self.push_group(group(name), if layer { Kind::Layer } else { Kind::Plain }); } /// Open a group (blend mode, soft mask) closed with the graphics state. pub fn open_group(&mut self, g: Group) { - self.stack.push((g, Kind::Plain)); + self.push_group(g, Kind::Plain); } /// Add a finished node (an image, pattern tiles). diff --git a/crates/pdf/src/color.rs b/crates/pdf/src/color.rs index 6943476bc..5a7e9af86 100644 --- a/crates/pdf/src/color.rs +++ b/crates/pdf/src/color.rs @@ -215,19 +215,44 @@ pub enum PsOp { Proc(Vec), } -fn ps_parse(lx: &mut crate::object::Lexer, depth: usize) -> Vec { +/// Parse a procedure. `ops` counts the tokens read (those skipped as unsupported included); past +/// [`MAX_CALC_OPS`] the rest is not read, so an oversized program is never fully scanned or built +/// (the caller rejects it when `ops` ends past the cap). +fn ps_parse(lx: &mut crate::object::Lexer, depth: usize, ops: &mut usize) -> Vec { let mut out = vec![]; - while let Some(o) = lx.next() { - match o { - Obj::Num(n) => out.push(PsOp::Num(n)), - Obj::Bool(b) => out.push(PsOp::Num(if b { 1.0 } else { 0.0 })), - Obj::Op(op) if op == "{" && depth < 32 => out.push(PsOp::Proc(ps_parse(lx, depth + 1))), - // Nested too deep: skip the procedure's opening brace (never push it as an operator). - Obj::Op(op) if op == "{" => {} - Obj::Op(op) if op == "}" => return out, - Obj::Op(op) => out.push(PsOp::Op(op)), - _ => {} + loop { + // A calculator holds no arrays or dictionaries: one is skipped as a single token without + // being built (the lexer would allocate every element before this counted it). + if lx.at_compound() { + if *ops > MAX_CALC_OPS { + break; + } + lx.skip_compound(); + *ops += 1; + continue; } + let Some(o) = lx.next() else { break }; + if *ops > MAX_CALC_OPS { + break; + } + let op = match o { + Obj::Num(n) => PsOp::Num(n), + Obj::Bool(b) => PsOp::Num(if b { 1.0 } else { 0.0 }), + Obj::Op(op) if op == "{" && depth < 32 => PsOp::Proc(ps_parse(lx, depth + 1, ops)), + // Nested too deep: skip the procedure's opening brace (never push it as an operator). + Obj::Op(op) if op == "{" => { + *ops += 1; + continue; + } + Obj::Op(op) if op == "}" => return out, + Obj::Op(op) => PsOp::Op(op), + _ => { + *ops += 1; + continue; + } + }; + *ops += 1; + out.push(op); } out } @@ -243,6 +268,15 @@ fn ps_push(st: &mut Vec, v: f64) { } } +/// The most operators and operands a calculator program may hold (nested procedures included). +/// It has no loops, so this bounds what one evaluation runs; real programs hold a few dozen. +const MAX_CALC_OPS: usize = 4096; + +/// The operators and operands in `code`, nested procedures included. +fn ps_len(code: &[PsOp]) -> usize { + code.iter().map(|op| if let PsOp::Proc(p) = op { 1 + ps_len(p) } else { 1 }).sum() +} + fn ps_run(code: &[PsOp], st: &mut Vec, depth: usize) { if depth > 32 { return; @@ -431,6 +465,12 @@ impl Budget { Budget { nodes: MAX_NODES, samples: MAX_SAMPLES, overrun: false } } + /// Charge `n` retained values (coefficients, bounds, program operators) as nodes, eight to a + /// node, so a cached copy of a function is charged for what it holds, not just its node. + fn take_values(&mut self, n: usize) -> bool { + self.take_nodes(n.div_ceil(8)) + } + /// Charge `n` nodes; `false` (and the read is abandoned) once the cap is passed. fn take_nodes(&mut self, n: usize) -> bool { match self.nodes.checked_sub(n) { @@ -484,7 +524,8 @@ impl Func { /// [`Func::read`] nested `depth` levels deep, charging `budget`: unsupported past [`MAX_DEPTH`] /// or once the budget is spent. fn read_at(file: &File, o: &Obj, depth: usize, budget: &mut Budget) -> Func { - if depth >= MAX_DEPTH || !budget.take_nodes(1) { + // Charged first: the fallback past the depth limit is a node a copy keeps too. + if !budget.take_nodes(1) || depth >= MAX_DEPTH { return Func::Unsupported; } let o = file.resolve(o); @@ -499,12 +540,14 @@ impl Func { let dom = file.get(d, "Domain").map(|x| file.nums(x)).unwrap_or_default(); let domain = [dom.first().copied().unwrap_or(0.0), dom.get(1).copied().unwrap_or(1.0)]; match file.get_num(d, "FunctionType").unwrap_or(-1.0) as i32 { - 2 => Func::Exp { - domain, - c0: file.get(d, "C0").map(|x| file.nums(x)).unwrap_or_else(|| vec![0.0]), - c1: file.get(d, "C1").map(|x| file.nums(x)).unwrap_or_else(|| vec![1.0]), - n: file.get_num(d, "N").unwrap_or(1.0), - }, + 2 => { + let c0 = file.get(d, "C0").map(|x| file.nums(x)).unwrap_or_else(|| vec![0.0]); + let c1 = file.get(d, "C1").map(|x| file.nums(x)).unwrap_or_else(|| vec![1.0]); + if !budget.take_values(c0.len() + c1.len()) { + return Func::Unsupported; + } + Func::Exp { domain, c0, c1, n: file.get_num(d, "N").unwrap_or(1.0) } + } 3 => { // A stitching function's pieces: no element cap (a repeating gradient lists one // piece once per repeat); the budget bounds the total work. @@ -513,12 +556,12 @@ impl Func { None => Some(vec![]), }; let Some(funcs) = funcs else { return Func::Unsupported }; - Func::Stitch { - domain, - funcs, - bounds: file.get(d, "Bounds").map(|x| file.nums(x)).unwrap_or_default(), - encode: file.get(d, "Encode").map(|x| file.nums(x)).unwrap_or_default(), + let bounds = file.get(d, "Bounds").map(|x| file.nums(x)).unwrap_or_default(); + let encode = file.get(d, "Encode").map(|x| file.nums(x)).unwrap_or_default(); + if !budget.take_values(bounds.len() + encode.len()) { + return Func::Unsupported; } + Func::Stitch { domain, funcs, bounds, encode } } 0 => { let Obj::Stream(sd, raw) = o else { return Func::Unsupported }; @@ -537,6 +580,10 @@ impl Func { if !budget.take_samples(count) { return Func::Unsupported; } + // The stream must hold the table: missing bytes are not made up as zeros. + if count.checked_mul(bps).is_none_or(|bits| bits.div_ceil(8) > data.len()) { + return Func::Unsupported; + } let enc = file.get(d, "Encode").map(|x| file.nums(x)).unwrap_or_default(); let encode = [enc.first().copied().unwrap_or(0.0), enc.get(1).copied().unwrap_or(size as f64 - 1.0)]; let decode = file.get(d, "Decode").map(|x| file.nums(x)).filter(|v| v.len() >= outputs * 2).unwrap_or_else(|| range.clone()); @@ -567,10 +614,15 @@ impl Func { let Some(data) = decode_stream(file, sd, raw) else { return Func::Unsupported }; let mut lx = crate::object::Lexer::new(&data, 0); // The program is one procedure: `{ … }`. - let code = match ps_parse(&mut lx, 0).into_iter().next() { + let mut scanned = 0; + let code = match ps_parse(&mut lx, 0, &mut scanned).into_iter().next() { Some(PsOp::Proc(p)) => p, _ => return Func::Unsupported, }; + let ops = ps_len(&code); + if scanned > MAX_CALC_OPS || ops > MAX_CALC_OPS || !budget.take_values(ops) { + return Func::Unsupported; + } Func::Calc { domain: dom, range: file.get(d, "Range").map(|x| file.nums(x)).unwrap_or_default(), code } } _ => Func::Unsupported, @@ -756,12 +808,56 @@ mod tests { assert_eq!(sample_count(1 << 22, usize::MAX / (1 << 22) + 1), None); } + #[test] + fn oversized_calculator_program_is_cut_short() { + let src = format!("{{ {}}}", "1 ".repeat(MAX_CALC_OPS + 10)); + let mut lx = crate::object::Lexer::new(src.as_bytes(), 0); + let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0, &mut 0).into_iter().next() else { panic!() }; + assert_eq!(ps_len(&code), MAX_CALC_OPS + 1); + } + + #[test] + fn arrays_and_dictionaries_in_a_calculator_are_skipped_whole() { + // Strings with brackets, nested arrays and a dictionary are one skipped token each; the + // operators around them still parse. + let src = b"{ 1 [ (a]b) [1 2] << /K [3 4] /S (>>) >> 5 ] 2 add << /A 1 >> mul }"; + let mut lx = crate::object::Lexer::new(src, 0); + let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0, &mut 0).into_iter().next() else { panic!() }; + assert_eq!(code, vec![PsOp::Num(1.0), PsOp::Num(2.0), PsOp::Op("add".into()), PsOp::Op("mul".into())]); + // A huge array is skipped once the cap is passed, not read to its end. + let src = format!("{{ [ {}] 1 }}", "0 ".repeat(MAX_CALC_OPS * 100)); + let mut lx = crate::object::Lexer::new(src.as_bytes(), 0); + let mut scanned = 0; + let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0, &mut scanned).into_iter().next() else { panic!() }; + assert_eq!(code, vec![PsOp::Num(1.0)]); + // A large string inside a skipped array is passed over, not decoded: escapes, nested + // parentheses, a hexadecimal string and names all end where the lexer would end them. + let big = format!("{{ [ ({}) <{}> /{} (a\\)b(c)) 7 ] 1 }}", "x".repeat(1 << 20), "ab".repeat(1 << 19), "N".repeat(1 << 10)); + let mut lx = crate::object::Lexer::new(big.as_bytes(), 0); + let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0, &mut 0).into_iter().next() else { panic!() }; + assert_eq!(code, vec![PsOp::Num(1.0)]); + // An unclosed one ends at the end of the data. + let mut lx = crate::object::Lexer::new(b"[ 1 2 ", 0); + lx.skip_compound(); + assert_eq!(lx.pos, 6); + } + + #[test] + fn skipped_calculator_tokens_count_toward_the_cap() { + // `null` is not a calculator token: skipped, but still scanned. + let src = format!("{{ {}}}", "null ".repeat(MAX_CALC_OPS + 10)); + let mut lx = crate::object::Lexer::new(src.as_bytes(), 0); + let mut scanned = 0; + ps_parse(&mut lx, 0, &mut scanned); + assert!(scanned > MAX_CALC_OPS && scanned < MAX_CALC_OPS + 10, "parsing stops once the cap is passed ({scanned})"); + } + #[test] fn calculator_functions() { // Two inputs → three outputs: { 2 copy mul 3 1 roll add 2 div dup 0.5 gt { pop 1 } if 0 } let code = b"{ 2 copy mul 3 1 roll add 2 div dup 0.5 gt { pop 1 } { 0.25 mul } ifelse 0 }"; let mut lx = crate::object::Lexer::new(code, 0); - let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0).into_iter().next() else { panic!() }; + let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0, &mut 0).into_iter().next() else { panic!() }; let f = Func::Calc { domain: vec![0.0, 1.0, 0.0, 1.0], range: vec![0.0, 1.0, 0.0, 1.0, 0.0, 1.0], code }; assert_eq!(f.eval(&[0.5, 0.4]), vec![0.2, 0.1125, 0.0]); assert_eq!(f.eval(&[1.0, 0.8]), vec![0.8, 1.0, 0.0]); @@ -771,7 +867,7 @@ mod tests { fn run(src: &str, mut st: Vec) -> Vec { let src = format!("{{ {src} }}"); let mut lx = crate::object::Lexer::new(src.as_bytes(), 0); - let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0).into_iter().next() else { panic!() }; + let Some(PsOp::Proc(code)) = ps_parse(&mut lx, 0, &mut 0).into_iter().next() else { panic!() }; ps_run(&code, &mut st, 0); st } diff --git a/crates/pdf/src/object.rs b/crates/pdf/src/object.rs index 79a91dde8..df475a4bb 100644 --- a/crates/pdf/src/object.rs +++ b/crates/pdf/src/object.rs @@ -82,6 +82,91 @@ impl<'a> Lexer<'a> { } } + /// Whether the next token opens an array or a dictionary (skipping white space first). + pub fn at_compound(&mut self) -> bool { + self.skip_ws(); + match self.data.get(self.pos) { + Some(b'[') => true, + Some(b'<') => self.data.get(self.pos + 1) == Some(&b'<'), + _ => false, + } + } + + /// Skip the array or dictionary at the current position (see [`Lexer::at_compound`]) as + /// [`Lexer::next`] would read it, without building it: for readers that have no use for one + /// and must not allocate a vector per element of a hostile stream. + pub fn skip_compound(&mut self) { + let mut open = 0usize; + loop { + self.skip_ws(); + match self.data.get(self.pos) { + None => return, + Some(b'[') => { + open += 1; + self.pos += 1; + } + Some(b'<') if self.data.get(self.pos + 1) == Some(&b'<') => { + open += 1; + self.pos += 2; + } + Some(b']') | Some(b'>') if self.data[self.pos] == b']' || self.data.get(self.pos + 1) == Some(&b'>') => { + open = open.saturating_sub(1); + self.pos += if self.data[self.pos] == b']' { 1 } else { 2 }; + if open == 0 { + return; + } + } + // Anything else is one token (a string, name, number or word), passed over + // without building it. + Some(_) => self.skip_scalar(), + } + } + } + + /// Pass over one token that is not an array or dictionary bracket, as [`Lexer::next`] reads + /// it but without building its value. + fn skip_scalar(&mut self) { + let Some(&c) = self.data.get(self.pos) else { return }; + match c { + b'(' => { + // A literal string: balanced parentheses, a backslash escapes the next byte. + let mut depth = 0usize; + while let Some(&d) = self.data.get(self.pos) { + self.pos += 1; + match d { + b'\\' => self.pos += 1, + b'(' => depth += 1, + b')' => { + depth -= 1; + if depth == 0 { + break; + } + } + _ => {} + } + } + self.pos = self.pos.min(self.data.len()); + } + b'<' => { + // A hexadecimal string. + while self.data.get(self.pos).is_some_and(|d| *d != b'>') { + self.pos += 1; + } + self.pos = (self.pos + 1).min(self.data.len()); + } + b'/' => { + self.pos += 1; + self.word(); + } + b']' | b'{' | b'}' | b')' | b'>' => self.pos += 1, + _ => { + if self.word().is_empty() { + self.pos += 1; + } + } + } + } + fn word(&mut self) -> &'a [u8] { let s = self.pos; while self.pos < self.data.len() && !is_white(self.data[self.pos]) && !is_delim(self.data[self.pos]) { diff --git a/crates/pdf/src/page.rs b/crates/pdf/src/page.rs index 0ebc0421d..ba67b39aa 100644 --- a/crates/pdf/src/page.rs +++ b/crates/pdf/src/page.rs @@ -669,7 +669,12 @@ impl<'a> Interp<'a> { let bc = f.get(&sm, "BC").map(|b| f.nums(b)).unwrap_or_default(); let gcs = f.get_dict(&gd, "Group").and_then(|gr| f.get(gr, "CS")).map(|c| color_space(f, c, Some(res))).unwrap_or(Cs::Rgb); let backdrop = if bc.is_empty() { [0.0; 3] } else { gcs.to_rgb(&bc) }; - let saved_b = std::mem::replace(&mut self.b, Builder::new()); + // The mask it replaces closes first: its groups don't enclose the new one. + if let Some(d) = self.gs.mask_depth { + self.close_to(d); + } + let inner = self.b.nested(2); + let saved_b = std::mem::replace(&mut self.b, inner); let ctm = self.gs.ctm; let saved_gs = std::mem::replace(&mut self.gs, GState { ctm, ..GState::default() }); let saved_stack = std::mem::take(&mut self.saved); @@ -681,9 +686,6 @@ impl<'a> Interp<'a> { for s in sk { self.b.skip(&s); } - if let Some(d) = self.gs.mask_depth { - self.close_to(d); - } let mut content = Group::new("Soft Mask"); content.children = nodes; let mut grp = Group::new("Soft Mask Group"); @@ -784,8 +786,15 @@ impl<'a> Interp<'a> { if depth > 8 { return; } + // The `Pattern` and `Tile` wrappers must fit under the open groups too. + if !self.b.has_room(2) { + self.b.skip("group nesting limit"); + return; + } // The cell, drawn once in pattern space. - let saved_b = std::mem::replace(&mut self.b, Builder::new()); + // The cell ends up under the open groups and this pattern's `Pattern` and `Tile`. + let inner = self.b.nested(2); + let saved_b = std::mem::replace(&mut self.b, inner); let saved_gs = std::mem::take(&mut self.gs); let saved_stack = std::mem::take(&mut self.saved); let saved_path = std::mem::take(&mut self.path); diff --git a/crates/pdf/src/ps/builtin.rs b/crates/pdf/src/ps/builtin.rs index dcafa9417..a19aeb6da 100644 --- a/crates/pdf/src/ps/builtin.rs +++ b/crates/pdf/src/ps/builtin.rs @@ -1,4 +1,5 @@ use super::eps::find_from; +use super::exec::MAX_STACK; use super::scanner::Src; use super::text::encoding_array; use super::value::{Flow, V, array, matrix_of, matrix_val, new_dict}; @@ -181,8 +182,13 @@ impl Interp { match self.pop() { V::Num(k) => { let k = (k.max(0.0) as usize).min(self.st.len()); - let tail: Vec = self.st[self.st.len() - k..].to_vec(); - self.st.extend(tail); + // A copy past the operand limit copies nothing, and the values copied + // count as operations (one for eight): repeated doubling spends the budget. + if self.st.len().saturating_add(k) <= MAX_STACK { + self.charge(k / 8); + let tail: Vec = self.st[self.st.len() - k..].to_vec(); + self.st.extend(tail); + } } V::Array(dst) => { let s = self.pop().items().unwrap_or_default(); @@ -507,12 +513,16 @@ impl Interp { fn try_collection_op(&mut self, n: &str) -> bool { match n { // Arrays and strings. + // The storage made counts as operations (a value, or eight bytes, each), so a loop + // of large constructors spends the budget rather than the memory. "array" => { let k = self.popn().clamp(0.0, 1e6) as usize; + self.charge(k); self.push(array(vec![V::Null; k])); } "string" => { let k = self.popn().clamp(0.0, 1e7) as usize; + self.charge(k / 8); self.push(V::Str(Rc::new(RefCell::new(vec![0; k])))); } "length" => { diff --git a/crates/pdf/src/ps/eps.rs b/crates/pdf/src/ps/eps.rs index 90d60cfbe..e89b1d276 100644 --- a/crates/pdf/src/ps/eps.rs +++ b/crates/pdf/src/ps/eps.rs @@ -1,38 +1,26 @@ use super::{HashMap, Rc, is_white}; /// The PostScript section of an EPS file (DOS EPS binary header handled) and its bounding box -/// (`%%HiResBoundingBox` preferred). +/// (`%%HiResBoundingBox` preferred), read with `craft-eps`: the header comments, and the trailer +/// for a box deferred with `(atend)`. A binary header that points outside the file is refused. pub fn eps_parts(bytes: &[u8]) -> Option<(&[u8], [f64; 4])> { - let ps = if bytes.starts_with(&[0xC5, 0xD0, 0xD3, 0xC6]) && bytes.len() >= 12 { - let off = u32::from_le_bytes([bytes[4], bytes[5], bytes[6], bytes[7]]) as usize; - let len = u32::from_le_bytes([bytes[8], bytes[9], bytes[10], bytes[11]]) as usize; - bytes.get(off..off.checked_add(len)?.min(bytes.len()))? - } else { - bytes - }; - let find_box = |key: &[u8]| -> Option<[f64; 4]> { - let mut from = 0; - while let Some(p) = ps[from..].windows(key.len()).position(|w| w == key) { - let s = from + p + key.len(); - let e = ps[s..].iter().position(|c| matches!(c, b'\n' | b'\r')).map_or(ps.len(), |q| s + q); - let v: Vec = String::from_utf8_lossy(&ps[s..e]).split_whitespace().filter_map(|t| t.parse().ok()).collect(); - if v.len() == 4 && v[2] > v[0] && v[3] > v[1] { - return Some([v[0], v[1], v[2], v[3]]); - } - from = s; - } - None - }; - let bbox = find_box(b"%%HiResBoundingBox:").or_else(|| find_box(b"%%BoundingBox:"))?; - Some((ps, bbox)) + let ps = craft_eps::sections(bytes).ok()?.postscript; + Some((ps, craft_eps::Comments::read(ps).page_box()?)) } pub(super) fn find_from(hay: &[u8], needle: &[u8], from: usize) -> Option { hay.get(from..)?.windows(needle.len()).position(|w| w == needle).map(|p| p + from) } -fn rfind_before(hay: &[u8], needle: &[u8], to: usize) -> Option { - hay.get(..to)?.windows(needle.len()).rposition(|w| w == needle) +/// Every position of `needle` in `hay`, in order (one pass over the file). +fn positions(hay: &[u8], needle: &[u8]) -> Vec { + let mut out = vec![]; + let mut from = 0; + while let Some(p) = find_from(hay, needle, from) { + out.push(p); + from = p + needle.len(); + } + out } /// The name after `key` (`/FontName /Name`). @@ -48,20 +36,26 @@ fn name_after(b: &[u8], key: &[u8]) -> Option { /// … cleartomark`, hexadecimal or binary) and CFF font sets (`… StartData `). pub(super) fn embedded_fonts(ps: &[u8]) -> HashMap>, bool)> { let mut out = HashMap::new(); + // The headers are found once, in one pass each; every `eexec` then takes the last header + // before it that no earlier `eexec` has used, so no prefix of the file is searched again. + let mut heads = positions(ps, b"%!PS-AdobeFont"); + heads.extend(positions(ps, b"%!FontType1")); + heads.sort_unstable(); + let names = positions(ps, b"/FontName"); let mut from = 0; + let mut used = 0; while let Some(ee) = find_from(ps, b"eexec", from) { from = ee + 5; - let start = [b"%!PS-AdobeFont".as_slice(), b"%!FontType1"] - .iter() - .filter_map(|h| rfind_before(ps, h, ee)) - .max() - .or_else(|| rfind_before(ps, b"/FontName", ee).map(|p| p.saturating_sub(512))); + let last_before = |v: &[usize]| v[..v.partition_point(|&p| p < ee)].last().copied().filter(|&p| p >= used); + // The fallback look-back stops at the previous font's end, so it cannot pick up its header. + let start = last_before(&heads).or_else(|| last_before(&names).map(|p| p.saturating_sub(512).max(used))); let Some(start) = start else { continue }; let end = find_from(ps, b"cleartomark", ee).map_or(ps.len(), |p| p + 11); if let Some(name) = name_after(&ps[start..ee], b"/FontName") { out.insert(name, (Rc::new(ps[start..end].to_vec()), false)); } from = end; + used = end; } let mut from = 0; while let Some(sd) = find_from(ps, b"StartData", from) { @@ -77,3 +71,30 @@ pub(super) fn embedded_fonts(ps: &[u8]) -> HashMap>, bool)> } out } + +#[cfg(test)] +mod tests { + use super::embedded_fonts; + + #[test] + fn font_discovery_looks_back_once_per_header() { + // 20,000 `eexec` words before any font header: each used to search the whole prefix + // for a header again. The font after them is still found. + let mut ps = b"%!PS-Adobe-3.0 EPSF-3.0\n".to_vec(); + ps.extend_from_slice("eexec ".repeat(20_000).as_bytes()); + ps.extend_from_slice(b"\n%!PS-AdobeFont-1.0: Real\n/FontName /Real def\ncurrentfile eexec\n0000\ncleartomark\n"); + let fonts = embedded_fonts(&ps); + assert_eq!(fonts.len(), 1); + assert!(fonts.contains_key("Real")); + } + + #[test] + fn header_less_font_after_a_short_one_does_not_take_its_header() { + let a = "%!PS-AdobeFont-1.0: A\n/FontName /A def\ncurrentfile eexec\n0000\ncleartomark\n"; + let b = "/FontName /B def\ncurrentfile eexec\n0000\ncleartomark\n"; + let ps = format!("%!PS-Adobe-3.0 EPSF-3.0\n{a}{b}"); + let fonts = embedded_fonts(ps.as_bytes()); + let (data, _) = fonts.get("B").expect("second font found"); + assert!(!String::from_utf8_lossy(data).contains("AdobeFont"), "{}", String::from_utf8_lossy(data)); + } +} diff --git a/crates/pdf/src/ps/exec.rs b/crates/pdf/src/ps/exec.rs index 27697527c..233ff82b0 100644 --- a/crates/pdf/src/ps/exec.rs +++ b/crates/pdf/src/ps/exec.rs @@ -6,6 +6,10 @@ use super::{Affine, BezPath, Builder, Cap, HashMap, Interp, Join}; /// The deepest procedure nesting run (deeper recursion stops the program). const MAX_CALL_DEPTH: usize = 256; +/// The most values the operand stack holds: a push past it is dropped, and `copy` copies +/// nothing rather than grow the stack past it. +pub(super) const MAX_STACK: usize = 100_000; + impl Interp { pub fn new(page: [f64; 4]) -> Interp { Interp { @@ -56,11 +60,17 @@ impl Interp { } pub(super) fn push(&mut self, v: V) { - if self.st.len() < 100_000 { + if self.st.len() < MAX_STACK { self.st.push(v); } } + /// Count `n` units of work (values copied, storage allocated) against the budget without + /// stopping the program here: once it is spent, the next operator stops it. + pub(super) fn charge(&mut self, n: usize) { + self.budget = self.budget.saturating_sub(n); + } + pub(super) fn lookup(&self, k: &str) -> Option { self.dicts.iter().rev().find_map(|d| d.borrow().get(k).cloned()) } diff --git a/crates/pdf/src/ps/paths.rs b/crates/pdf/src/ps/paths.rs index b1fe07092..30b5a7087 100644 --- a/crates/pdf/src/ps/paths.rs +++ b/crates/pdf/src/ps/paths.rs @@ -22,7 +22,7 @@ impl Interp { } /// Stop the program when a path of `len` elements would be longer than [`MAX_PATH`]. - fn path_fits(&mut self, len: usize) -> Result<(), Flow> { + pub(super) fn path_fits(&mut self, len: usize) -> Result<(), Flow> { if len <= MAX_PATH { return Ok(()); } diff --git a/crates/pdf/src/ps/text.rs b/crates/pdf/src/ps/text.rs index b138965bb..d4cee07f8 100644 --- a/crates/pdf/src/ps/text.rs +++ b/crates/pdf/src/ps/text.rs @@ -95,7 +95,14 @@ impl Interp { let ctm = self.gs.ctm; for (i, &code) in bytes.iter().enumerate() { let code = code as u32; + // Every input character costs at least one unit, so empty outlines are not free. + self.spend(1)?; if let Some(g) = font.glyph(code) { + // Each outline element counts against the path limit and the budget before it + // is copied, so a long string cannot expand into unbounded geometry. + let n = g.elements().len(); + self.path_fits(path.elements().len().saturating_add(n))?; + self.spend(n)?; path.extend(ctm * Affine::translate(p.to_vec2()) * m * (*g).clone()); } text.push_str(&font.unicode(code)); diff --git a/crates/pdf/src/shading.rs b/crates/pdf/src/shading.rs index df5e5f9c7..aa83adebf 100644 --- a/crates/pdf/src/shading.rs +++ b/crates/pdf/src/shading.rs @@ -18,6 +18,8 @@ const MAX_SIDE: f64 = 1024.0; const MAX_SCALE: f64 = 4.0; /// The most triangles one shading draws. const MAX_TRIANGLES: usize = 2_000_000; +/// How many times over the mesh raster may be covered by triangle bounding boxes in all. +const MAX_RASTER_PASSES: usize = 64; /// A mesh vertex: page-space position and its value (RGB, or `t` in `[0]` with a function). #[derive(Clone, Copy, Debug, PartialEq)] @@ -234,13 +236,17 @@ fn free_form(r: &mut Bits, l: &Layout, colors: &Colors, m: Affine) -> Vec<[V; 3] /// Type 5: a lattice of `per_row` vertices per row, two triangles per cell. fn lattice(r: &mut Bits, l: &Layout, colors: &Colors, m: Affine, per_row: usize) -> Vec<[V; 3]> { - if per_row < 2 { + if !(2..=MAX_TRIANGLES).contains(&per_row) { return vec![]; } let mut rows: Vec> = vec![]; let mut row = vec![]; while let (Some(p), Some(c)) = (l.point(r), l.comps(r)) { r.align(); + // Vertices kept, the unfinished row's included, stay within the triangle limit. + if (rows.len() * per_row).saturating_add(row.len()) >= MAX_TRIANGLES { + break; + } row.push(V { p: m * p, c: colors.value(&c) }); if row.len() == per_row { rows.push(std::mem::take(&mut row)); @@ -447,6 +453,9 @@ fn rasterize(tris: &[[V; 3]], colors: &Colors, page_box: [f64; 4]) -> Option Option usize { + 1 + g.children.iter().filter_map(|c| if let effectcraft_svg::Node::Group(g) = c { Some(depth(g)) } else { None }).max().unwrap_or(0) + } + let clips = "0 0 200 100 re W n ".repeat(250); + let cell = format!("{} 1 0 0 rg 0 0 10 10 re f", "0 0 20 20 re W n ".repeat(250)).into_bytes(); + let bytes = page_pdf( + &format!("{clips} /Pattern cs /P1 scn 0 0 100 100 re f"), + "/Pattern << /P1 10 0 R >>", + vec![(10, "<< /Type /Pattern /PatternType 1 /PaintType 1 /TilingType 1 /BBox [0 0 20 20] /XStep 20 /YStep 20 /Resources << >> >>".into(), Some(cell))], + ); + let doc = parse(&bytes).unwrap(); + assert!(depth(&doc.root) <= 260, "{}", depth(&doc.root)); + assert!(doc.skipped.iter().any(|s| s == "group nesting limit"), "{:?}", doc.skipped); +} + +/// A pattern whose `Pattern` and `Tile` wrappers would pass the depth limit is skipped, not built +/// past it. +#[test] +fn a_pattern_whose_wrappers_pass_the_depth_limit_is_skipped() { + let clips = "0 0 200 100 re W n ".repeat(255); + let bytes = page_pdf( + &format!("{clips} /Pattern cs /P1 scn 0 0 100 100 re f"), + "/Pattern << /P1 10 0 R >>", + vec![( + 10, + "<< /Type /Pattern /PatternType 1 /PaintType 1 /TilingType 1 /BBox [0 0 20 20] /XStep 20 /YStep 20 /Resources << >> >>".into(), + Some(b"0 0 10 10 re f".to_vec()), + )], + ); + let doc = parse(&bytes).unwrap(); + assert!(doc.skipped.iter().any(|s| s == "group nesting limit"), "{:?}", doc.skipped); +} + +/// A soft mask replacing another is nested under what is open once the old one has closed, so +/// groups inside the old mask don't count against the new mask's content. +#[test] +fn a_replaced_soft_mask_does_not_count_against_the_new_one() { + let form = |n: &str| { + ( + n.parse().unwrap(), + "<< /Type /XObject /Subtype /Form /BBox [0 0 200 100] /Group << /S /Transparency /CS /DeviceGray >> >>".to_string(), + Some(format!("{} 1 g 0 0 100 100 re f", "0 0 200 100 re W n ".repeat(250)).into_bytes()), + ) + }; + let bytes = page_pdf( + &format!("/GS1 gs {} /GS2 gs 1 0 0 rg 0 0 200 100 re f", "0 0 200 100 re W n ".repeat(250)), + "/ExtGState << /GS1 << /SMask << /S /Luminosity /G 10 0 R >> >> /GS2 << /SMask << /S /Luminosity /G 11 0 R >> >> >>", + vec![form("10"), form("11")], + ); + let doc = parse(&bytes).unwrap(); + assert!(doc.skipped.iter().all(|s| s != "group nesting limit"), "{:?}", doc.skipped); +} + /// Build isolated interpreter objects without presenting a function or colour space as a /// document catalog. Complete-document parsing is covered by the page and reader fixtures. fn object_file(objs: Objs) -> object::File { @@ -1068,6 +1125,35 @@ fn a_fanning_out_reference_graph_is_refused_within_the_budget() { assert_eq!(read_function(objs), color::Func::Unsupported); } +#[test] +fn a_sampled_function_shorter_than_its_table_is_refused() { + // 4,096 8-bit samples declared, ten bytes given: the missing ones are not made up. + let f = "<< /FunctionType 0 /Domain [0 1] /Size [4096] /Range [0 1] /BitsPerSample 8 >>"; + assert_eq!(read_function(vec![(1, f.into(), Some(vec![7; 10]))]), color::Func::Unsupported); + assert_ne!(read_function(vec![(1, f.into(), Some(vec![7; 4096]))]), color::Func::Unsupported); +} + +#[test] +fn a_calculator_program_past_the_operator_limit_is_refused() { + let f = "<< /FunctionType 4 /Domain [0 1] /Range [0 1] >>"; + let long = format!("{{ {} }}", "1 pop ".repeat(3000)); + assert_eq!(read_function(vec![(1, f.into(), Some(long.into_bytes()))]), color::Func::Unsupported); + assert_ne!(read_function(vec![(1, f.into(), Some(b"{ 1 exch sub }".to_vec()))]), color::Func::Unsupported); +} + +#[test] +fn copies_of_a_function_are_charged_for_its_coefficients() { + // A stitching function listing one object 1,000 times, whose coefficient arrays hold 2,000 + // values: each copy is charged its values, so the budget refuses it instead of copying + // two million values. + let c = format!("[{}]", "0.5 ".repeat(1000)); + let objs: Objs = vec![ + (1, format!("<< /FunctionType 3 /Domain [0 1] /Functions [{}] >>", "2 0 R ".repeat(1000)), None), + (2, format!("<< /FunctionType 2 /Domain [0 1] /C0 {c} /C1 {c} /N 1 >>"), None), + ]; + assert_eq!(read_function(objs), color::Func::Unsupported); +} + #[test] fn colour_space_chain_of_depth_3() { // Indexed → Separation → ICCBased → DeviceRGB: entry 0 is tint 1 (blue), entry 1 tint 0 (white). diff --git a/crates/pdf/src/tests/import.rs b/crates/pdf/src/tests/import.rs index c7dcbee57..f8c6509c2 100644 --- a/crates/pdf/src/tests/import.rs +++ b/crates/pdf/src/tests/import.rs @@ -513,6 +513,9 @@ fn paths_stop_at_the_path_limit() { // The outlines of 100,000 H's, 13 elements each. "/Helvetica findfont 10 scalefont setfont /s 100000 string def 0 1 99999 { s exch 72 put } for \ 0 0 moveto s false charpath", + // The same outlines shown: the text path is bounded like the current path. + "/Helvetica findfont 10 scalefont setfont /s 100000 string def 0 1 99999 { s exch 72 put } for \ + 0 0 moveto s show", // 210,000 rectangles of five elements each. "/a 840000 array def 0 1 839999 { a exch 0 put } for a rectfill", ] { @@ -528,6 +531,46 @@ fn paths_stop_at_the_path_limit() { assert_eq!(doc.flatten().len(), 1); } +#[test] +fn copies_past_the_operand_limit_copy_nothing() { + // `count copy` doubles the operand stack: 40 doublings would be 2^40 values. A copy that would + // pass the operand limit (100,000) copies nothing, so the program runs on to its end. + let doc = eps_soon("0 0 10 10 rectfill 1 40 { count copy } repeat clear 20 20 10 10 rectfill"); + assert!(doc.skipped.is_empty(), "{:?}", doc.skipped); + assert_eq!(doc.flatten().len(), 2); +} + +#[test] +fn storage_made_in_a_loop_runs_out_of_the_budget() { + // Each value of an array and each eight bytes of a string count as an operation when they + // are made, so a loop keeping large arrays or strings spends the budget, not the memory. + for body in ["/a 1000 array def 0 1 999 { a exch 1000000 array put } for", "/a 1000 array def 0 1 999 { a exch 10000000 string put } for"] { + runs_out_of_budget(body); + } +} + +#[test] +fn groups_stop_nesting_at_the_depth_limit() { + // Every `rectclip` opens a clipping group inside the last: past 256 open groups the group is + // dropped (and noted), and what is drawn inside goes to the open one. + let doc = eps_soon("300 { 0 0 100 100 rectclip } repeat 0 0 10 10 rectfill"); + assert_eq!(doc.skipped, ["group nesting limit"]); + assert_eq!(doc.flatten().len(), 1); +} + +#[test] +fn bounding_box_comments_are_scanned_once() { + // A rejected `%%BoundingBox:` comment is not scanned again from each later marker on its + // line: 20,000 markers on one line would otherwise take quadratic work. + let mut src = b"%!PS-Adobe-3.0 EPSF-3.0\n".to_vec(); + // Keep the valid comment inside craft-eps's bounded header window. + src.extend_from_slice("%%BoundingBox: x ".repeat(3_000).as_bytes()); + src.extend_from_slice(b"\n%%BoundingBox: 0 0 50 50\n0 0 10 10 rectfill\n"); + let doc = parse(&src).unwrap(); + assert_eq!((doc.width, doc.height), (50.0, 50.0)); + assert_eq!(doc.flatten().len(), 1); +} + #[test] fn pdf_paths_stop_at_the_path_limit() { // A content stream's current path holds at most 1,048,576 elements: `re` (five elements each) diff --git a/crates/pdf/src/tests/shading.rs b/crates/pdf/src/tests/shading.rs index 8e96193ab..4b5f9645d 100644 --- a/crates/pdf/src/tests/shading.rs +++ b/crates/pdf/src/tests/shading.rs @@ -262,3 +262,32 @@ fn corrupt_mesh_data_draws_what_parses() { let doc = parse(&bytes).unwrap(); assert!(doc.skipped.iter().any(|s| s.contains("layout")), "{:?}", doc.skipped); } + +#[test] +fn overlapping_mesh_triangles_stop_at_the_raster_budget() { + // 20,000 triangles each covering the whole page would test every sample 20,000 times; the + // raster budget stops after about 64 passes, and the shading is still drawn. + let mut m = Mesh::default(); + for _ in 0..20_000 { + m.flag(0).pt(0, 0).c(&[255, 0, 0]); + m.flag(0).pt(400, 0).c(&[255, 0, 0]); + m.flag(0).pt(0, 400).c(&[255, 0, 0]); + } + let sh = format!("<< /ShadingType 4 /ColorSpace /DeviceRGB /BitsPerCoordinate 16 /BitsPerComponent 8 /BitsPerFlag 8 {RGB_DECODE} >>"); + let bytes = page_pdf("/Sh sh", "/Shading << /Sh 10 0 R >>", vec![(10, sh, Some(m.0))]); + let (tx, rx) = std::sync::mpsc::channel(); + std::thread::spawn(move || tx.send(parse(&bytes)).ok()); + let doc = rx.recv_timeout(std::time::Duration::from_secs(20)).expect("the mesh finishes").unwrap(); + assert!(render(&doc).get(50, 50)[0] > 0.99); +} + +#[test] +fn a_lattice_row_longer_than_the_triangle_limit_draws_nothing() { + let mut m = Mesh::default(); + for i in 0..8 { + m.pt(i * 10, 0).c(&[255, 0, 0]); + } + let sh = format!("<< /ShadingType 5 /ColorSpace /DeviceRGB /BitsPerCoordinate 16 /BitsPerComponent 8 /VerticesPerRow 3000000 {RGB_DECODE} >>"); + let doc = parse(&page_pdf("/Sh sh", "/Shading << /Sh 10 0 R >>", vec![(10, sh, Some(m.0))])).unwrap(); + assert!(doc.flatten().is_empty()); +} diff --git a/crates/plugin/src/wasm.rs b/crates/plugin/src/wasm.rs index 499d57397..18f3fb0d0 100644 --- a/crates/plugin/src/wasm.rs +++ b/crates/plugin/src/wasm.rs @@ -13,6 +13,8 @@ const FUEL_BASE: u64 = 50_000_000; const FUEL_PER_PIXEL: u64 = 20_000; /// The most linear memory a plug-in instance may have (a 4K float frame is ~130 MB). const MAX_MEMORY: usize = 1 << 30; +/// The most elements one table of a plug-in may hold. +const MAX_TABLE_ELEMENTS: usize = 1 << 16; /// The longest manifest read. const MAX_MANIFEST: i32 = 1 << 20; @@ -84,7 +86,10 @@ fn err(e: impl std::fmt::Display) -> String { /// Instantiate `module` in a fresh, limited store and read its memory and allocator. fn begin(engine: &Engine, module: &Module) -> Result { - let mut store = Store::new(engine, StoreLimitsBuilder::new().memory_size(MAX_MEMORY).instances(1).build()); + // One memory and a few small tables: a module declaring many of them would otherwise make + // the host allocate and initialise each before an export or fuel check could refuse it. + let limits = StoreLimitsBuilder::new().memory_size(MAX_MEMORY).memories(1).tables(4).table_elements(MAX_TABLE_ELEMENTS).instances(1).build(); + let mut store = Store::new(engine, limits); store.limiter(|l| l); store.set_fuel(FUEL_BASE).map_err(err)?; let linker = Linker::::new(engine); diff --git a/crates/project/src/ae_order.rs b/crates/project/src/ae_order.rs new file mode 100644 index 000000000..b6dce1d44 --- /dev/null +++ b/crates/project/src/ae_order.rs @@ -0,0 +1,139 @@ +//! After Effects' numeric order of a layer's top-level property groups. +//! +//! In After Effects `thisLayer(4)` and `layer.property(4)` reach the same group on every layer of a +//! kind, whatever the layer holds: Marker is always 1, and the groups a layer has not used yet +//! (Time Remap, Motion Trackers, Layer Styles…) still take their slot. EffectCraft's tree holds only +//! the groups a layer has, without Marker, so its own positions differ and move as groups are +//! added. Rigs that address groups by number (`comp("Palette").layer(1)(4)(n)(1)`) read the wrong +//! group, or none, unless numbers go through this table. +//! +//! The order was observed in After Effects 26.3 by reading `layer.property(i).matchName` from a +//! script and `thisComp.layer(..)(i).name` from an expression on new layers of each kind; both +//! agree. 3D model and primitive layers have no table: their numbers stay EffectCraft's own. + +use crate::{Layer, LayerSource, Node}; + +/// One top-level slot in After Effects' order. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct AeSlot { + /// The group's match id in EffectCraft's tree, or `""` when EffectCraft has no such group. + pub match_id: &'static str, + /// The display name After Effects gives the slot. + pub name: &'static str, + /// After Effects' match name for the slot. + pub match_name: &'static str, +} + +const fn slot(match_id: &'static str, name: &'static str, match_name: &'static str) -> AeSlot { + AeSlot { match_id, name, match_name } +} + +/// The marker slot: number 1 on every layer. Markers are a field of [`Layer`], not a tree node. +pub const MARKER: AeSlot = slot("marker", "Marker", "ADBE Marker"); + +/// Footage, solid, adjustment, precomp and null layers. +const AV: &[AeSlot] = &[ + MARKER, + slot("timeRemap", "Time Remap", "ADBE Time Remapping"), + slot("motionTrackers", "Motion Trackers", "ADBE MTrackers"), + slot("masks", "Masks", "ADBE Mask Parade"), + slot("effects", "Effects", "ADBE Effect Parade"), + slot("transform", "Transform", "ADBE Transform Group"), + slot("layerStyles", "Layer Styles", "ADBE Layer Styles"), + slot("", "Geometry Options", "ADBE Plane Options Group"), + slot("geometryOptions", "Geometry Options", "ADBE Extrsn Options Group"), + slot("materialOptions", "Material Options", "ADBE Material Options Group"), + slot("audio", "Audio", "ADBE Audio Group"), + slot("", "Data", "ADBE Data Group"), + slot("", "Essential Properties", "ADBE Layer Overrides"), + slot("", "Sets", "ADBE Layer Sets"), + slot("", "Source Options", "ADBE Source Options Group"), +]; + +const TEXT: &[AeSlot] = &[ + MARKER, + slot("text", "Text", "ADBE Text Properties"), + slot("masks", "Masks", "ADBE Mask Parade"), + slot("effects", "Effects", "ADBE Effect Parade"), + slot("transform", "Transform", "ADBE Transform Group"), + slot("layerStyles", "Layer Styles", "ADBE Layer Styles"), + slot("geometryOptions", "Geometry Options", "ADBE Extrsn Options Group"), + slot("materialOptions", "Material Options", "ADBE Material Options Group"), + slot("audio", "Audio", "ADBE Audio Group"), + slot("", "Sets", "ADBE Layer Sets"), +]; + +const SHAPE: &[AeSlot] = &[ + MARKER, + slot("contents", "Contents", "ADBE Root Vectors Group"), + slot("masks", "Masks", "ADBE Mask Parade"), + slot("effects", "Effects", "ADBE Effect Parade"), + slot("transform", "Transform", "ADBE Transform Group"), + slot("layerStyles", "Layer Styles", "ADBE Layer Styles"), + slot("geometryOptions", "Geometry Options", "ADBE Extrsn Options Group"), + slot("materialOptions", "Material Options", "ADBE Material Options Group"), + slot("audio", "Audio", "ADBE Audio Group"), + slot("", "Sets", "ADBE Layer Sets"), +]; + +const CAMERA: &[AeSlot] = + &[MARKER, slot("transform", "Transform", "ADBE Transform Group"), slot("cameraOptions", "Camera Options", "ADBE Camera Options Group")]; + +const LIGHT: &[AeSlot] = &[MARKER, slot("transform", "Transform", "ADBE Transform Group"), slot("lightOptions", "Light Options", "ADBE Light Options Group")]; + +/// After Effects' top-level slots for a layer of this kind, or `None` for 3D model and primitive +/// layers, which keep EffectCraft's own numbers. +pub fn ae_slots(source: &LayerSource) -> Option<&'static [AeSlot]> { + match source { + LayerSource::Footage { .. } | LayerSource::Comp { .. } | LayerSource::Solid { .. } | LayerSource::Null => Some(AV), + LayerSource::Text => Some(TEXT), + LayerSource::Shape => Some(SHAPE), + LayerSource::Camera => Some(CAMERA), + LayerSource::Light { .. } => Some(LIGHT), + LayerSource::Model { .. } | LayerSource::Primitive { .. } => None, + } +} + +/// What After Effects' top-level number `index` (1-based) reaches on `layer`. +#[derive(Clone, Copy, Debug)] +pub enum AeChild<'a> { + /// The layer's markers (number 1). + Marker, + /// A group or property the layer has. + Node(&'a Node), + /// A slot After Effects always has and this layer does not (an empty group there). + Absent(&'static AeSlot), +} + +/// The top-level node After Effects' number `index` (1-based) reaches, or `None` when the number is +/// past the last slot or the layer kind has no table ([`ae_slots`]). +pub fn ae_child(layer: &Layer, index: usize) -> Option> { + let s = ae_slots(&layer.source)?.get(index.checked_sub(1)?)?; + if *s == MARKER { + return Some(AeChild::Marker); + } + if s.match_id.is_empty() { + return Some(AeChild::Absent(s)); + } + Some(layer.props.children.iter().find(|n| n.match_id() == s.match_id).map_or(AeChild::Absent(s), AeChild::Node)) +} + +/// After Effects' 1-based number for the top-level node with this match id, when it has one. +pub fn ae_index(layer: &Layer, match_id: &str) -> Option { + if match_id.is_empty() { + return None; + } + ae_slots(&layer.source)?.iter().position(|s| s.match_id == match_id).map(|i| i + 1) +} + +/// How many top-level properties After Effects counts on `layer` (`numProperties`), or `None` for +/// layer kinds without a table. +pub fn ae_count(layer: &Layer) -> Option { + ae_slots(&layer.source).map(<[AeSlot]>::len) +} + +/// After Effects' 1-based number for the top-level slot with this After Effects match name +/// (`ADBE Effect Parade`), when the layer kind has one. +pub fn ae_index_of_match_name(layer: &Layer, match_name: &str) -> Option { + ae_slots(&layer.source)?.iter().position(|s| s.match_name == match_name).map(|i| i + 1) +} diff --git a/crates/project/src/comp.rs b/crates/project/src/comp.rs index d8d7cda16..c0c401c82 100644 --- a/crates/project/src/comp.rs +++ b/crates/project/src/comp.rs @@ -268,8 +268,19 @@ impl Comp { /// `base`, or the next free numbered name when a layer already has it (`Shape Layer 2`, /// `v-b1.mp4 2`; see `numbered_name`). pub fn unique_layer_name(&self, base: &str) -> String { - let taken = |n: &str| self.layers.iter().any(|l| l.name == n); - if taken(base) { crate::item::numbered_name(base, taken) } else { base.to_string() } + if !self.layers.iter().any(|l| l.name == base) { + return base.to_string(); + } + let stem = crate::item::name_stem(base); + // The suffixes in use, gathered in one pass: trying each candidate against every layer + // made importing many layers of one name cubic. + let taken: std::collections::HashSet = self + .layers + .iter() + .filter_map(|l| l.name.strip_prefix(stem)?.strip_prefix(' ')) + .filter_map(|s| s.parse::().ok().filter(|n| n.to_string() == s)) + .collect(); + (2..).find(|i| !taken.contains(i)).map(|i| format!("{stem} {i}")).unwrap_or_default() } } diff --git a/crates/project/src/item.rs b/crates/project/src/item.rs index 4fcc06ab9..b055c60ba 100644 --- a/crates/project/src/item.rs +++ b/crates/project/src/item.rs @@ -8,12 +8,18 @@ use super::{Arc, BTreeMap, Deserialize, FrameRate, Label, Project, Serialize, Ti /// another layer of the same name. A number set off by a space is a counter and is replaced /// (`Red Solid 1` → `Red Solid 2`, `shot 2` → `shot 3`); digits that end a word belong to the /// name and stay (`v-b1.mp4` → `v-b1.mp4 2`, `clip2.mov` → `clip2.mov 2`). -pub(crate) fn numbered_name(base: &str, taken: impl Fn(&str) -> bool) -> String { +/// `base` without a trailing ` N`: digits are dropped only when a space separates them from a +/// nonempty stem, so `v-b1.mp4` and `Layer1` keep theirs. +pub(crate) fn name_stem(base: &str) -> &str { let head = base.trim_end_matches(|c: char| c.is_ascii_digit()); - let stem = match head.strip_suffix(' ') { + match head.strip_suffix(' ') { Some(stem) if head.len() < base.len() && !stem.trim_end().is_empty() => stem.trim_end(), _ => base.trim_end(), - }; + } +} + +pub(crate) fn numbered_name(base: &str, taken: impl Fn(&str) -> bool) -> String { + let stem = name_stem(base); (2u64..).map(|k| format!("{stem} {k}")).find(|n| !taken(n)).unwrap_or_default() } diff --git a/crates/project/src/lib.rs b/crates/project/src/lib.rs index 6d0a72976..9f5f399e0 100644 --- a/crates/project/src/lib.rs +++ b/crates/project/src/lib.rs @@ -6,6 +6,7 @@ #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +pub mod ae_order; pub mod build; pub mod essential; mod file_check; diff --git a/crates/project/src/render_queue.rs b/crates/project/src/render_queue.rs index 5418e5ac7..b935c2fc8 100644 --- a/crates/project/src/render_queue.rs +++ b/crates/project/src/render_queue.rs @@ -421,7 +421,12 @@ impl RenderSettings { /// The output frame rate: the Frame Rate override, unless the comp preserves its frame rate /// (Composition Settings ▸ Preserve frame rate when nested or in render queue). pub fn rate(&self, comp: &Comp) -> FrameRate { - if comp.preserve_frame_rate { comp.frame_rate } else { self.frame_rate.unwrap_or(comp.frame_rate) } + if comp.preserve_frame_rate { + return comp.frame_rate; + } + // A saved override is held to the supported rates, as a comp's own rate is: its frame count + // is the export's work. + self.frame_rate.map_or(comp.frame_rate, |r| crate::limits::frame_rate(r, comp.frame_rate)) } /// First output-rate frame starting at or after `t`. fn ceil_frame(r: FrameRate, t: Tick) -> i64 { @@ -480,6 +485,8 @@ impl RenderSettings { TimeSpan::Custom { start, end } => format!("Custom ({:.3}s – {:.3}s)", start.seconds(), end.seconds()), }; let rate = match (self.frame_rate, comp) { + // A saved override outside the supported rates renders at the clamped one: say so. + (Some(r), Some(c)) if self.rate(c) != r => format!("{:.3} fps (renders at {:.3})", r.as_f64(), self.rate(c).as_f64()), (Some(r), _) => format!("{:.3} fps", r.as_f64()), (None, Some(c)) => format!("Use comp's frame rate ({:.3})", c.frame_rate.as_f64()), (None, None) => "Use comp's frame rate".into(), @@ -1713,7 +1720,22 @@ pub fn numbered_template(template: &str, n: u32) -> String { /// Make a name safe as a file name component. pub fn sanitize(name: &str) -> String { - name.chars().map(|c| if matches!(c, '/' | '\\' | ':' | '*' | '?' | '"' | '<' | '>' | '|') { '_' } else { c }).collect() + let mut s: String = name.chars().map(|c| if matches!(c, '/' | '\\' | ':' | '*' | '?' | '"' | '<' | '>' | '|') { '_' } else { c }).collect(); + // At most a file name's worth (255 UTF-8 bytes, whole characters only): a template repeating + // a long name token must not expand to gigabytes. A cut name ends in a hash of the whole + // name so long names that share a prefix stay distinct. + if s.len() > 255 { + // shortcut: 64-bit FNV-1a, not collision-resistant against crafted names; use a real hash if names become untrusted keys. + let hash = name.bytes().fold(0xcbf2_9ce4_8422_2325u64, |h, b| (h ^ u64::from(b)).wrapping_mul(0x0100_0000_01b3)); + let mut end = 255 - 17; + while !s.is_char_boundary(end) { + end -= 1; + } + s.truncate(end); + s.push_str(&format!("-{hash:016x}")); + } + // `.` and `..` would name the folder itself or its parent when the token is a path component. + if !s.is_empty() && s.chars().all(|c| c == '.') { "_".repeat(s.len()) } else { s } } #[cfg(test)] @@ -1737,10 +1759,32 @@ mod tests { use super::*; + #[test] + fn sanitize_limits_the_name_in_bytes() { + // 255 two-byte characters are cut to whole characters plus a 17-byte hash suffix. + let s = sanitize(&"é".repeat(255)); + assert!(s.len() <= 255 && s.len() > 235, "{}", s.len()); + assert!(s.starts_with("éé") && s.is_char_boundary(s.len() - 17)); + // Names that share their first 255 bytes stay distinct, and a name that fits is untouched. + let (a, b) = (sanitize(&format!("{}A", "界".repeat(85))), sanitize(&format!("{}B", "界".repeat(85)))); + assert_ne!(a, b); + assert!(a.len() <= 255 && b.len() <= 255); + assert_eq!(sanitize(&"n".repeat(255)), "n".repeat(255)); + assert_eq!(sanitize(&"é".repeat(127)), "é".repeat(127)); + } + #[test] fn templates_and_sequences() { let v = TemplateVars { comp_name: "Main/Title", project_name: "P", width: 1920, height: 1080, frame_rate: 29.97, start_frame: 0, end_frame: 9 }; assert_eq!(expand_template(DEFAULT_TEMPLATE, OutputFormat::H264, &v), "Main_Title.mp4"); + // A dot-only name is not a parent-folder component; a long one is cut to a file name. + for name in ["..", "."] { + let v = TemplateVars { comp_name: name, ..v }; + assert_eq!(expand_template("out/[compName]/x.[fileExtension]", OutputFormat::Gif, &v), format!("out/{}/x.gif", "_".repeat(name.len()))); + } + let long = "n".repeat(100_000); + let v2 = TemplateVars { comp_name: &long, ..v }; + assert_eq!(expand_template(&"[compName]".repeat(100), OutputFormat::Gif, &v2).len(), 255 * 100); assert_eq!(expand_template("[compName]_[width]x[height]@[frameRate].[fileExtension]", OutputFormat::Gif, &v), "Main_Title_1920x1080@29.97.gif"); assert_eq!(sequence_path("out/a_[#####].png", 42), "out/a_00042.png"); assert_eq!(sequence_path("a###.tif", 7), "a007.tif"); @@ -1890,6 +1934,22 @@ mod tests { assert_eq!(p.sample(&c, 3), FrameSample::Progressive(Tick::from_seconds_f64(0.12))); } + /// A saved Frame Rate override outside the supported rates is clamped, so a short comp cannot + /// ask for billions of output frames. + #[test] + fn frame_rate_override_is_held_to_the_supported_rates() { + let c = Comp::new(64, 48, FrameRate::new(25, 1), Tick::from_seconds_f64(2.0)); + let s = |r| RenderSettings { frame_rate: Some(r), time_span: TimeSpan::LengthOfComp, ..Default::default() }; + let huge = s(FrameRate::new(1_000_000_000_000, 1)); + assert_eq!(huge.rate(&c).as_f64(), crate::limits::MAX_FPS); + assert!(huge.frame_count(&c) <= 2001, "{}", huge.frame_count(&c)); + assert_eq!(s(FrameRate::new(0, 1)).rate(&c), c.frame_rate); + assert_eq!(s(FrameRate::new(60, 1)).rate(&c), FrameRate::new(60, 1)); + let shown = |r| s(r).describe(Some(&c)).into_iter().find(|l| l.0 == "Frame Rate").map(|l| l.1).unwrap_or_default(); + assert!(shown(FrameRate::new(1_000_000_000_000, 1)).contains("renders at 1000.000"), "{}", shown(FrameRate::new(1_000_000_000_000, 1))); + assert_eq!(shown(FrameRate::new(60, 1)), "60.000 fps"); + } + #[test] fn crop_and_resize_sizes() { let c = Comp::new(1920, 1080, FrameRate::new(25, 1), Tick::from_seconds_f64(1.0)); diff --git a/crates/project/src/tests.rs b/crates/project/src/tests.rs index d040c8f0b..80ba3c771 100644 --- a/crates/project/src/tests.rs +++ b/crates/project/src/tests.rs @@ -146,6 +146,18 @@ fn unique_names_and_cycles() { let c = p.comp(cid).unwrap(); assert_eq!(c.unique_layer_name("Red Solid 1"), "Red Solid 2"); assert_eq!(c.unique_layer_name("Shape Layer 1"), "Shape Layer 1"); + // A suffix written another way (`02`) is not the number taken. + let mut d = c.clone(); + for n in ["Red Solid 02", "Red Solid 3"] { + let mut l = d.layers[0].clone(); + l.name = n.into(); + d.layers.push(l); + } + assert_eq!(d.unique_layer_name("Red Solid 1"), "Red Solid 2"); + // Digits that end a word stay in the stem. + let mut e = c.clone(); + e.layers[0].name = "v-b1.mp4".into(); + assert_eq!(e.unique_layer_name("v-b1.mp4"), "v-b1.mp4 2"); assert!(p.comp_contains(cid, cid)); } diff --git a/crates/psd/Cargo.toml b/crates/psd/Cargo.toml index b6849041b..46ad240d7 100644 --- a/crates/psd/Cargo.toml +++ b/crates/psd/Cargo.toml @@ -10,4 +10,5 @@ rust-version.workspace = true workspace = true [dependencies] +craft-psd = { workspace = true } miniz_oxide = "0.9" diff --git a/crates/psd/src/engine_data.rs b/crates/psd/src/engine_data.rs index 20fa1676d..43dec23d5 100644 --- a/crates/psd/src/engine_data.rs +++ b/crates/psd/src/engine_data.rs @@ -1,316 +1,9 @@ -//! The text engine data of type layers (`EngineData` in the `TySh` descriptor): a PostScript-like -//! tree of dictionaries (`<< /Key value >>`), arrays (`[ ]`), numbers, names, booleans and -//! strings (`(þÿ` + UTF-16BE with backslash escapes `)`). Read best-effort. +//! Engine data (the text engine document of type layers, `TySh`): `craft-psd`'s +//! `engine_data`, re-exported. [`text_style`] is its typed view of the first style run. -/// Bytes that end a bare token or a `/Name` (besides whitespace). -const DELIMITERS: &[u8] = b"[]<>/("; +pub use craft_psd::engine_data::{TextStyle, Value, minimal, parse, parse_lossy, write}; -#[derive(Clone, Debug, PartialEq)] -pub enum EValue { - Dict(Vec<(String, EValue)>), - Array(Vec), - Num(f64), - Bool(bool), - Name(String), - Str(String), -} - -impl EValue { - pub fn get(&self, key: &str) -> Option<&EValue> { - match self { - EValue::Dict(v) => v.iter().find(|(k, _)| k == key).map(|(_, v)| v), - _ => None, - } - } - pub fn idx(&self, i: usize) -> Option<&EValue> { - match self { - EValue::Array(v) => v.get(i), - _ => None, - } - } - /// Follow a `/`-separated path; numeric segments index arrays. - pub fn path(&self, p: &str) -> Option<&EValue> { - let mut cur = self; - for seg in p.split('/').filter(|s| !s.is_empty()) { - cur = match seg.parse::() { - Ok(i) => cur.idx(i)?, - Err(_) => cur.get(seg)?, - }; - } - Some(cur) - } - pub fn num(&self) -> Option { - match self { - EValue::Num(n) => Some(*n), - _ => None, - } - } - pub fn str(&self) -> Option<&str> { - match self { - EValue::Str(s) | EValue::Name(s) => Some(s), - _ => None, - } - } -} - -struct P<'a> { - b: &'a [u8], - i: usize, -} - -impl P<'_> { - fn ws(&mut self) { - while self.i < self.b.len() && (self.b[self.i].is_ascii_whitespace() || self.b[self.i] == 0) { - self.i += 1; - } - } - fn peek(&self, s: &[u8]) -> bool { - self.b[self.i..].starts_with(s) - } - fn value(&mut self, depth: usize) -> Option { - if depth > 128 { - return None; - } - self.ws(); - if self.i >= self.b.len() { - return None; - } - if self.peek(b"<<") { - self.i += 2; - let mut v = vec![]; - loop { - self.ws(); - if self.i >= self.b.len() { - return Some(EValue::Dict(v)); - } - if self.peek(b">>") { - self.i += 2; - return Some(EValue::Dict(v)); - } - if self.b[self.i] != b'/' { - // Unexpected token: skip it. - self.i += 1; - continue; - } - let key = self.name(); - let val = self.value(depth + 1)?; - v.push((key, val)); - } - } - match self.b[self.i] { - b'[' => { - self.i += 1; - let mut v = vec![]; - loop { - self.ws(); - if self.i >= self.b.len() { - return Some(EValue::Array(v)); - } - if self.b[self.i] == b']' { - self.i += 1; - return Some(EValue::Array(v)); - } - let start = self.i; - match self.value(depth + 1) { - Some(x) => v.push(x), - None => return Some(EValue::Array(v)), - } - if self.i == start { - self.i += 1; - } - } - } - b'/' => Some(EValue::Name(self.name())), - b'(' => Some(EValue::Str(self.string())), - _ => { - let start = self.i; - while self.i < self.b.len() && !self.b[self.i].is_ascii_whitespace() && !DELIMITERS.contains(&self.b[self.i]) { - self.i += 1; - } - let tok = std::str::from_utf8(&self.b[start..self.i]).unwrap_or(""); - if self.i == start { - self.i += 1; - return Some(EValue::Name(String::new())); - } - Some(match tok { - "true" => EValue::Bool(true), - "false" => EValue::Bool(false), - // "nan", "inf" and overflowing literals parse as f64 but are not numbers here. - t => match t.parse::() { - Ok(n) if n.is_finite() => EValue::Num(n), - _ => EValue::Name(t.to_string()), - }, - }) - } - } - } - fn name(&mut self) -> String { - self.i += 1; // '/' - let start = self.i; - while self.i < self.b.len() && !self.b[self.i].is_ascii_whitespace() && !DELIMITERS.contains(&self.b[self.i]) { - self.i += 1; - } - String::from_utf8_lossy(&self.b[start..self.i]).into_owned() - } - fn string(&mut self) -> String { - self.i += 1; // '(' - let mut raw = vec![]; - while self.i < self.b.len() { - let c = self.b[self.i]; - self.i += 1; - match c { - b'\\' if self.i < self.b.len() => { - let e = self.b[self.i]; - self.i += 1; - raw.push(match e { - b'n' => b'\n', - b'r' => b'\r', - b't' => b'\t', - other => other, - }); - } - b')' => break, - _ => raw.push(c), - } - } - if raw.starts_with(&[0xFE, 0xFF]) { - let u: Vec = raw[2..].as_chunks::<2>().0.iter().map(|c| u16::from_be_bytes([c[0], c[1]])).collect(); - String::from_utf16_lossy(&u).trim_end_matches('\0').to_string() - } else { - String::from_utf8_lossy(&raw).into_owned() - } - } -} - -/// Parse engine data (returns an empty dictionary on garbage). -pub fn parse(b: &[u8]) -> EValue { - let mut p = P { b, i: 0 }; - p.value(0).unwrap_or(EValue::Dict(vec![])) -} - -/// Encode a string the way engine data stores it (UTF-16BE with a BOM, escaped). -pub fn encode_string(s: &str) -> Vec { - let mut out = vec![b'(', 0xFE, 0xFF]; - for u in s.encode_utf16() { - for b in u.to_be_bytes() { - if matches!(b, b'(' | b')' | b'\\') { - out.push(b'\\'); - } - out.push(b); - } - } - out.push(b')'); - out -} - -/// The first style run's character attributes. -#[derive(Clone, Debug, Default, PartialEq)] -pub struct TextStyle { - pub font: Option, - pub size: Option, - /// RGB 0..1. - pub color: Option<[f64; 3]>, - /// 0 left, 1 right, 2 centre, 3+ justified variants. - pub justification: Option, - pub tracking: Option, - pub leading: Option, - pub faux_bold: bool, - pub faux_italic: bool, - /// Paragraph (box) text rather than point text. - pub box_text: bool, -} - -/// Sane upper bound for a font size in points (Photoshop's own limit is 1296 pt). -const MAX_FONT_SIZE: f64 = 10_000.0; -/// Sane bound for tracking (1/1000 em) and leading (points). -const MAX_SPACING: f64 = 100_000.0; - -pub fn text_style(ed: &EValue) -> TextStyle { - let engine = ed.get("EngineDict").unwrap_or(ed); - let resources = ed.get("ResourceDict").or_else(|| ed.get("DocumentResources")); - let run = engine.path("StyleRun/RunArray/0/StyleSheet/StyleSheetData"); - let normal = resources.and_then(|r| r.path("StyleSheetSet/0/StyleSheetData")); - let attr = |k: &str| run.and_then(|r| r.get(k)).or_else(|| normal.and_then(|n| n.get(k))); - let font = - attr("Font").and_then(EValue::num).and_then(|i| resources?.path(&format!("FontSet/{}/Name", i as usize))).and_then(EValue::str).map(str::to_string); - let color = attr("FillColor").and_then(|c| c.get("Values")).and_then(|v| match v { - EValue::Array(a) if a.len() >= 4 => Some([a[1].num()?, a[2].num()?, a[3].num()?]), - _ => None, - }); - let para = engine.path("ParagraphRun/RunArray/0/ParagraphSheet/Properties"); - let para_normal = resources.and_then(|r| r.path("ParagraphSheetSet/0/Properties")); - let justification = - para.and_then(|p| p.get("Justification")).or_else(|| para_normal.and_then(|p| p.get("Justification"))).and_then(EValue::num).map(|n| n as u8); - let auto_leading = attr("AutoLeading").is_none_or(|v| *v != EValue::Bool(false)); - let box_text = engine.path("Rendered/Shapes/Children/0/ShapeType").and_then(EValue::num) == Some(1.0); - TextStyle { - font, - size: attr("FontSize").and_then(EValue::num).filter(|s| *s > 0.0).map(|s| s.min(MAX_FONT_SIZE)), - color, - justification, - tracking: attr("Tracking").and_then(EValue::num).map(|t| t.clamp(-MAX_SPACING, MAX_SPACING)), - leading: if auto_leading { None } else { attr("Leading").and_then(EValue::num).map(|l| l.clamp(-MAX_SPACING, MAX_SPACING)) }, - faux_bold: attr("FauxBold") == Some(&EValue::Bool(true)), - faux_italic: attr("FauxItalic") == Some(&EValue::Bool(true)), - box_text, - } -} - -/// Minimal engine data for a type layer with one style run (fixtures, and what a writer needs). -pub fn minimal(text: &str, font: &str, size: f64, color: [f64; 3], justification: u8) -> Vec { - let mut out = Vec::new(); - out.extend_from_slice(b"\n\n<<\n\t/EngineDict\n\t<<\n\t\t/Editor << /Text "); - out.extend_from_slice(&encode_string(&format!("{text}\r"))); - out.extend_from_slice(b" >>\n\t\t/ParagraphRun << /RunArray [ << /ParagraphSheet << /Properties << /Justification "); - out.extend_from_slice(justification.to_string().as_bytes()); - out.extend_from_slice(b" >> >> >> ] >>\n\t\t/StyleRun << /RunArray [ << /StyleSheet << /StyleSheetData << /Font 0 /FontSize "); - out.extend_from_slice(format!("{size:.1}").as_bytes()); - out.extend_from_slice( - format!(" /FillColor << /Type 1 /Values [ 1.0 {:.5} {:.5} {:.5} ] >> /AutoLeading true >> >> >> ] >>\n\t>>\n", color[0], color[1], color[2]).as_bytes(), - ); - out.extend_from_slice(b"\t/ResourceDict << /FontSet [ << /Name "); - out.extend_from_slice(&encode_string(font)); - out.extend_from_slice(b" /Type 0 >> ] >>\n>>"); - out -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn parses_minimal() { - let b = minimal("Hi (there)", "Arial-BoldMT", 36.0, [1.0, 0.5, 0.0], 2); - let v = parse(&b); - assert_eq!(v.path("EngineDict/Editor/Text").and_then(EValue::str), Some("Hi (there)\r")); - let st = text_style(&v); - assert_eq!(st.font.as_deref(), Some("Arial-BoldMT")); - assert_eq!(st.size, Some(36.0)); - assert_eq!(st.color, Some([1.0, 0.5, 0.0])); - assert_eq!(st.justification, Some(2)); - assert!(!st.box_text); - } - - #[test] - fn garbage_is_harmless() { - let _ = parse(b"<< /A [ 1 2 << /B (unterminated"); - let _ = parse(b"]]]>>>> /x"); - let _ = parse(&[0xFF; 64]); - } - - #[test] - fn non_finite_and_out_of_range_numbers_are_not_numbers() { - let b = b"<< /FontSize nan /Tracking inf /Leading -inf /Other 1e999 >>"; - let v = parse(b); - assert_eq!(v.get("FontSize").and_then(EValue::num), None); - assert_eq!(v.get("Other").and_then(EValue::num), None); - let ed = parse(b"<< /EngineDict << /StyleRun << /RunArray [ << /StyleSheet << /StyleSheetData << /FontSize nan /Tracking inf /Leading -inf /AutoLeading false >> >> >> ] >> >> >>"); - let st = text_style(&ed); - assert_eq!((st.size, st.tracking, st.leading), (None, None, None)); - let ed = parse(b"<< /EngineDict << /StyleRun << /RunArray [ << /StyleSheet << /StyleSheetData << /FontSize 1e300 /Tracking -1e300 /AutoLeading false /Leading 1e300 >> >> >> ] >> >> >>"); - let st = text_style(&ed); - assert_eq!(st.size, Some(MAX_FONT_SIZE)); - assert_eq!(st.tracking, Some(-MAX_SPACING)); - assert_eq!(st.leading, Some(MAX_SPACING)); - } +/// The first style run's character and paragraph attributes of a parsed document. +pub fn text_style(ed: &Value) -> TextStyle { + craft_psd::engine_data::first_style(ed) } diff --git a/crates/psd/src/limits.rs b/crates/psd/src/limits.rs index c1c23b390..6db366c00 100644 --- a/crates/psd/src/limits.rs +++ b/crates/psd/src/limits.rs @@ -107,7 +107,7 @@ impl Budget { /// Inflate a zlib stream to at most `limit` bytes. pub(crate) fn inflate(src: &[u8], limit: usize) -> Result> { - miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(src, limit).map_err(|e| Error::Invalid(format!("zip: {e:?}"))) + miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(src, limit).map_err(|e| Error::Invalid(format!("zip: {:?}", e.status))) } /// Give back what a channel buffer from `Psd::channel_bytes` / `Psd::decode_plane` was charged: diff --git a/crates/psd/src/memory_tests.rs b/crates/psd/src/memory_tests.rs index 108046b66..96ac5c70c 100644 --- a/crates/psd/src/memory_tests.rs +++ b/crates/psd/src/memory_tests.rs @@ -28,10 +28,11 @@ impl Psd { } 2 | 3 => { let rest = r.bytes(r.remaining())?; - let mut v = miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, rowb * h).map_err(|e| Error::Invalid(format!("zip: {e:?}")))?; + let mut v = + miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, rowb * h).map_err(|e| Error::Invalid(format!("zip: {:?}", e.status)))?; v.resize(rowb * h, 0); if comp == 3 { - self.unpredict(&mut v, w, h); + self.unpredict(&mut v, w, h, &mut Budget::new(u64::MAX))?; } v } @@ -128,11 +129,12 @@ impl Psd { } 2 | 3 => { let rest = r.bytes(r.remaining())?; - let v = miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, want * rowb * h).map_err(|e| Error::Invalid(format!("zip: {e:?}")))?; + let v = miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, want * rowb * h) + .map_err(|e| Error::Invalid(format!("zip: {:?}", e.status)))?; for (c, p) in planes.iter_mut().enumerate().take(want) { let mut plane = v.get(c * rowb * h..(c + 1) * rowb * h).ok_or(Error::Truncated)?.to_vec(); if comp == 3 { - self.unpredict(&mut plane, w, h); + self.unpredict(&mut plane, w, h, &mut Budget::new(u64::MAX))?; } *p = Some(self.ref_samples(&plane, w, h)); } diff --git a/crates/psd/src/parse.rs b/crates/psd/src/parse.rs index d221b9044..6357b0024 100644 --- a/crates/psd/src/parse.rs +++ b/crates/psd/src/parse.rs @@ -287,7 +287,7 @@ impl Psd { let d = descriptor::read_descriptor(&mut r)?; let text = d.text("Txt ").unwrap_or_default().replace("\r\n", "\n").replace('\r', "\n"); let text = text.strip_suffix('\n').map(str::to_string).unwrap_or(text); - let style = d.raw("EngineData").map(|e| engine_data::text_style(&engine_data::parse(e))).unwrap_or_default(); + let style = d.raw("EngineData").map(|e| engine_data::text_style(&engine_data::parse_lossy(e))).unwrap_or_default(); let bounds = d.obj("bounds").or_else(|| d.obj("boundingBox")).and_then(|o| Some([o.num("Left")?, o.num("Top ")?, o.num("Rght")?, o.num("Btom")?])); l.text = Some(TextInfo { text, transform: t, style, bounds }); diff --git a/crates/psd/src/pixels.rs b/crates/psd/src/pixels.rs index 21a5c8845..290a7b6f4 100644 --- a/crates/psd/src/pixels.rs +++ b/crates/psd/src/pixels.rs @@ -37,7 +37,7 @@ impl Psd { PlaneStream::Rle(counts) => Cow::Owned(Self::unpack_plane(&counts, 0, r, rowb, h, budget)?), PlaneStream::Zip(mut v) => { v.resize(size, 0); - self.zip_plane(comp, &mut v, 0, w, h)?; + self.zip_plane(comp, &mut v, 0, w, h, budget)?; Cow::Owned(v) } }) @@ -90,7 +90,7 @@ impl Psd { Ok(match planes { PlaneStream::Raw => Cow::Borrowed(r.bytes(size)?), PlaneStream::Rle(counts) => Cow::Owned(Self::unpack_plane(counts, c, r, rowb, h, budget)?), - PlaneStream::Zip(v) => Cow::Borrowed(self.zip_plane(comp, v, c, w, h)?), + PlaneStream::Zip(v) => Cow::Borrowed(self.zip_plane(comp, v, c, w, h, budget)?), }) } @@ -106,11 +106,11 @@ impl Psd { } /// Plane `c` of the inflated ZIP data of consecutive planes, un-predicted in place (`comp` 3). - pub(crate) fn zip_plane<'v>(&self, comp: u16, v: &'v mut [u8], c: usize, w: usize, h: usize) -> Result<&'v [u8]> { + pub(crate) fn zip_plane<'v>(&self, comp: u16, v: &'v mut [u8], c: usize, w: usize, h: usize, budget: &mut Budget) -> Result<&'v [u8]> { let rowb = self.row_bytes(w); let plane = v.get_mut(c * rowb * h..(c + 1) * rowb * h).ok_or(Error::Truncated)?; if comp == 3 { - self.unpredict(plane, w, h); + self.unpredict(plane, w, h, budget)?; } Ok(plane) } @@ -132,7 +132,8 @@ impl Psd { if self.depth == 1 { w.div_ceil(8) } else { w * self.bytes_per_sample() } } - pub(crate) fn unpredict(&self, v: &mut [u8], w: usize, h: usize) { + /// Undo ZIP prediction in place; the 32-bit scratch row is charged to `budget`. + pub(crate) fn unpredict(&self, v: &mut [u8], w: usize, h: usize, budget: &mut Budget) -> Result<()> { match self.depth { 16 => { for row in v.chunks_exact_mut(w * 2).take(h) { @@ -145,8 +146,9 @@ impl Psd { } } 32 => { - // One scratch row for the whole plane. - let mut planar = vec![0u8; w * 4]; + // One scratch row for the whole plane, charged: a wide, short layer passes the + // decode's peak check and would otherwise allocate it on top. + let mut planar = budget.filled(w.checked_mul(4).ok_or_else(|| too_large(w, h))?, 0u8)?; #[cfg(test)] counters::bump(&counters::SCRATCH); for row in v.chunks_exact_mut(w * 4).take(h) { @@ -161,6 +163,7 @@ impl Psd { } } } + budget.release(planar.len() as u64); } _ => { for row in v.chunks_exact_mut(w).take(h) { @@ -170,6 +173,7 @@ impl Psd { } } } + Ok(()) } /// Hand every sample of `raw` (`w`×`h`, row-major, in order) to `f` as a float. Samples a short @@ -483,15 +487,17 @@ pub(crate) fn unpack_bits(src: &[u8], row: usize, out: &mut Vec) -> Result<( while i < src.len() && out.len() - start < row { let n = src[i] as i8; i += 1; + // A packet is written only up to the row's end, so the reserved plane never grows. + let room = row - (out.len() - start); if n >= 0 { let k = n as usize + 1; let s = src.get(i..i + k).ok_or(Error::Truncated)?; - out.extend_from_slice(s); + out.extend_from_slice(&s[..k.min(room)]); i += k; } else if n != -128 { let k = (1 - n as isize) as usize; let v = *src.get(i).ok_or(Error::Truncated)?; - out.extend(std::iter::repeat_n(v, k)); + out.extend(std::iter::repeat_n(v, k.min(room))); i += 1; } } diff --git a/crates/psd/src/tests.rs b/crates/psd/src/tests.rs index 074976510..fd041138a 100644 --- a/crates/psd/src/tests.rs +++ b/crates/psd/src/tests.rs @@ -493,3 +493,29 @@ fn rle_composite_matches_the_raw_one() { assert_eq!(rle.layer_pixels(2, true).unwrap().data, raw.layer_pixels(2, true).unwrap().data, "{depth} bit"); } } + +#[test] +fn packbits_packets_stop_at_the_row_end() { + // A 128-byte repeat and a 128-byte literal into 3-byte rows: the reserved row is never + // outgrown (capacity stays what was reserved). + for src in [vec![0x81u8, 7], { + let mut v = vec![0x7fu8]; + v.extend([1u8; 128]); + v + }] { + let mut out = Vec::with_capacity(3); + unpack_bits(&src, 3, &mut out).unwrap(); + assert_eq!(out.len(), 3); + assert_eq!(out.capacity(), 3); + } +} + +#[test] +fn a_failed_inflate_reports_its_status_not_its_output() { + // A stream that inflates a megabyte of zeros, then breaks its checksum. + let mut z = miniz_oxide::deflate::compress_to_vec_zlib(&vec![0u8; 1 << 20], 6); + let n = z.len(); + z[n - 1] ^= 0xff; + let Err(Error::Invalid(msg)) = crate::limits::inflate(&z, 1 << 21) else { panic!("the checksum fails") }; + assert!(msg.len() < 100, "{} bytes", msg.len()); +} diff --git a/crates/psd/src/tests/opt.rs b/crates/psd/src/tests/opt.rs index 908026d07..44bcec071 100644 --- a/crates/psd/src/tests/opt.rs +++ b/crates/psd/src/tests/opt.rs @@ -69,7 +69,7 @@ fn ref_decode_channel(p: &Psd, offset: usize, len: usize, w: usize, h: usize) -> } 2 | 3 => { let rest = r.bytes(r.remaining())?; - let mut v = miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, rowb * h).map_err(|e| Error::Invalid(format!("zip: {e:?}")))?; + let mut v = miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, rowb * h).map_err(|e| Error::Invalid(format!("zip: {:?}", e.status)))?; v.resize(rowb * h, 0); if comp == 3 { ref_unpredict(p.depth, &mut v, w, h); @@ -112,7 +112,8 @@ fn ref_composite(p: &Psd) -> Result { } 2 | 3 => { let rest = r.bytes(r.remaining())?; - let v = miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, want * rowb * h).map_err(|e| Error::Invalid(format!("zip: {e:?}")))?; + let v = + miniz_oxide::inflate::decompress_to_vec_zlib_with_limit(rest, want * rowb * h).map_err(|e| Error::Invalid(format!("zip: {:?}", e.status)))?; for (c, pl) in planes.iter_mut().enumerate().take(want) { let mut plane = v.get(c * rowb * h..(c + 1) * rowb * h).ok_or(Error::Truncated)?.to_vec(); if comp == 3 { @@ -448,7 +449,7 @@ fn unpredict_matches_the_reference_and_allocates_one_scratch_row() { let mut a: Vec = (0..w * h * bps).map(|i| (i * 31 % 251) as u8).collect(); let mut b = a.clone(); counters::take(&SCRATCH); - p.unpredict(&mut a, w, h); + p.unpredict(&mut a, w, h, &mut Budget::new(u64::MAX)).unwrap(); let scratch = counters::take(&SCRATCH); let old_allocs = ref_unpredict(depth, &mut b, w, h); assert_eq!(a, b, "{depth} bit"); @@ -473,11 +474,11 @@ fn raw_planes_are_borrowed_and_zip_planes_are_unpredicted_in_place() { let mut v: Vec = (0..3 * 40 * 30).map(|i| (i % 255) as u8).collect(); let range = v.as_ptr_range(); for comp in [2, 3] { - let got = q.zip_plane(comp, &mut v, 1, 40, 30).unwrap(); + let got = q.zip_plane(comp, &mut v, 1, 40, 30, &mut Budget::new(u64::MAX)).unwrap(); assert_eq!(got.len(), 1200); assert!(range.contains(&got.as_ptr()), "compression {comp}"); } - assert!(q.zip_plane(2, &mut v, 3, 40, 30).is_err()); + assert!(q.zip_plane(2, &mut v, 3, 40, 30, &mut Budget::new(u64::MAX)).is_err()); } #[test] diff --git a/crates/raster/Cargo.toml b/crates/raster/Cargo.toml index 7cd4fbe5a..9e11b781d 100644 --- a/crates/raster/Cargo.toml +++ b/crates/raster/Cargo.toml @@ -10,6 +10,7 @@ rust-version.workspace = true workspace = true [dependencies] +craft-exr = { workspace = true } effectcraft-geom = { workspace = true } effectcraft-color = { workspace = true } rayon = { workspace = true } diff --git a/crates/raster/src/blur.rs b/crates/raster/src/blur.rs index d92148658..76e51f865 100644 --- a/crates/raster/src/blur.rs +++ b/crates/raster/src/blur.rs @@ -27,13 +27,25 @@ fn box_h_into(src: &[Px], out: &mut [Px], w: usize, r: usize, repeat: bool) { row[i as usize] } }; + // The starting window: the pixels inside the row once each, and the repeated edge pixels + // counted rather than visited (a radius far past the row would otherwise loop over it). let mut acc = [0.0f32; 4]; - for i in -(r as isize)..=(r as isize) { - let p = get(i); + let inside = r.min(w - 1); + for p in &row[..=inside] { for c in 0..4 { acc[c] += p[c]; } } + if repeat { + let (left, right) = (r as f32, (r - inside) as f32); + for c in 0..4 { + acc[c] += row[0][c] * left; + // A zero count adds nothing (0 * NaN would be NaN). + if right > 0.0 { + acc[c] += row[w - 1][c] * right; + } + } + } for x in 0..w { o[x] = acc.map(|v| v * norm); let add = get(x as isize + r as isize + 1); @@ -65,14 +77,27 @@ fn box_v_into(src: &[Px], out: &mut [Px], w: usize, h: usize, r: usize, repeat: out.par_chunks_mut(w * block).enumerate().for_each(|(bi, chunk)| { let ya = (bi * block) as isize; let mut acc = vec![[0.0f32; 4]; w]; - for i in ya - r as isize..=ya + r as isize { - if let Some(rw) = row(i) { - for (a, p) in acc.iter_mut().zip(rw) { - for c in 0..4 { - a[c] += p[c]; - } + // The starting window: rows inside the image once each, the repeated edge rows counted. + let (lo, hi) = (ya - r as isize, ya + r as isize); + let add = |acc: &mut [Px], rw: &[Px], k: f32| { + // A zero count adds nothing (0 * NaN would be NaN). + if k == 0.0 { + return; + } + for (a, p) in acc.iter_mut().zip(rw) { + for c in 0..4 { + a[c] += p[c] * k; } } + }; + for i in lo.max(0)..=hi.min(h as isize - 1) { + add(&mut acc, &src[i as usize * w..(i as usize + 1) * w], 1.0); + } + if repeat { + let above = (-lo).max(0) as f32; + let below = (hi - (h as isize - 1)).max(0) as f32; + add(&mut acc, &src[0..w], above); + add(&mut acc, &src[(h - 1) * w..h * w], below); } for (yy, o) in chunk.chunks_mut(w).enumerate() { let y = ya + yy as isize; @@ -360,6 +385,59 @@ mod tests { } } + #[test] + fn a_non_finite_edge_pixel_outside_every_window_is_not_counted() { + // 9 wide, radius 1: the last pixel is in no window of the first pixels; likewise the last row. + let mut src = vec![[1.0f32; 4]; 81]; + src[80] = [f32::NAN; 4]; + let mut out = vec![[0.0f32; 4]; 81]; + box_h_into(&src, &mut out, 9, 1, true); + assert!(out[0].iter().all(|v| v.is_finite()), "{:?}", out[0]); + box_v_into(&src, &mut out, 9, 9, 1, true); + assert!(out[0].iter().all(|v| v.is_finite()), "{:?}", out[0]); + } + + #[test] + fn box_windows_count_repeated_edges_and_take_any_radius() { + // Against a window summed pixel by pixel, for radii inside and far past the image. + let (w, h) = (7usize, 5usize); + let src: Vec = (0..w * h).map(|i| [i as f32, (i % 3) as f32, 1.0, 0.5]).collect(); + let at = |x: isize, y: isize, repeat: bool| -> Px { + if !repeat && (x < 0 || y < 0 || x >= w as isize || y >= h as isize) { + return [0.0; 4]; + } + src[y.clamp(0, h as isize - 1) as usize * w + x.clamp(0, w as isize - 1) as usize] + }; + for repeat in [true, false] { + for r in [1usize, 3, 6, 9, 40] { + let (mut hx, mut vx) = (vec![[0.0; 4]; w * h], vec![[0.0; 4]; w * h]); + box_h_into(&src, &mut hx, w, r, repeat); + box_v_into(&src, &mut vx, w, h, r, repeat); + for y in 0..h as isize { + for x in 0..w as isize { + let (mut eh, mut ev) = ([0.0f32; 4], [0.0f32; 4]); + for d in -(r as isize)..=r as isize { + for c in 0..4 { + eh[c] += at(x + d, y, repeat)[c]; + ev[c] += at(x, y + d, repeat)[c]; + } + } + let n = (2 * r + 1) as f32; + let i = y as usize * w + x as usize; + for c in 0..4 { + assert!((hx[i][c] - eh[c] / n).abs() < 1e-3, "h r={r} repeat={repeat}"); + assert!((vx[i][c] - ev[c] / n).abs() < 1e-3, "v r={r} repeat={repeat}"); + } + } + } + } + } + // A radius of 2^40 finishes at once. + let mut out = vec![[0.0; 4]; w * h]; + box_h_into(&src, &mut out, w, 1 << 40, true); + box_v_into(&src, &mut out.clone(), w, h, 1 << 40, true); + } + #[test] fn gaussian_preserves_mass() { let mut img = Image::new(64, 64); diff --git a/crates/raster/src/channels3d.rs b/crates/raster/src/channels3d.rs index ae2d38303..05473ca80 100644 --- a/crates/raster/src/channels3d.rs +++ b/crates/raster/src/channels3d.rs @@ -66,36 +66,19 @@ impl AuxChannels { /// The layers of the channels (OpenEXR layers: the name before the last `.`; `""` for the /// unnamed layer), in channel order. pub fn layers(&self) -> Vec<&str> { - let mut out: Vec<&str> = vec![]; - for (n, _) in &self.channels { - let (layer, _) = split_channel(n); - if !out.contains(&layer) { - out.push(layer); - } - } - out + craft_exr::channels::layers(self.channels.iter().map(|(n, _)| n.as_str())) } /// A layer's channels as the names to show in red, green, blue and alpha (`""` = none): /// its R, G, B, A channels (or red / green / blue / alpha, X / Y / Z, U / V); a layer of one /// channel (depth, an ID) shows it in all three colours. pub fn layer_rgba(&self, layer: &str) -> [String; 4] { - let chans: Vec<&str> = self.channels.iter().map(|(n, _)| n.as_str()).filter(|n| split_channel(n).0 == layer).collect(); - let pick = |names: &[&str]| -> String { - chans.iter().find(|c| names.iter().any(|n| split_channel(c).1.eq_ignore_ascii_case(n))).map_or(String::new(), |c| c.to_string()) - }; - if let [one] = chans.as_slice() { - return [one.to_string(), one.to_string(), one.to_string(), String::new()]; - } - [pick(&["R", "red", "X", "U"]), pick(&["G", "green", "Y", "V"]), pick(&["B", "blue", "Z"]), pick(&["A", "alpha"])] + craft_exr::channels::layer_rgba(self.channels.iter().map(|(n, _)| n.as_str()), layer) + .map(|i| i.and_then(|i| self.channels.get(i)).map_or(String::new(), |(n, _)| n.clone())) } } -/// A channel name's layer and channel: `diffuse.R` → (`diffuse`, `R`), `ViewLayer.Combined.R` -/// → (`ViewLayer.Combined`, `R`), `Z` → (`""`, `Z`). -pub fn split_channel(name: &str) -> (&str, &str) { - name.rsplit_once('.').unwrap_or(("", name)) -} +pub use craft_exr::channels::split_channel; impl AuxChannels { pub fn depth(&self) -> Option<&[f32]> { @@ -206,42 +189,7 @@ impl AuxChannels { } } -/// MurmurHash3 x86 32-bit (public-domain algorithm by Austin Appleby). -pub fn murmur3_32(data: &[u8], seed: u32) -> u32 { - const C1: u32 = 0xcc9e_2d51; - const C2: u32 = 0x1b87_3593; - let mut h = seed; - let (chunks, tail) = data.as_chunks::<4>(); - for c in chunks { - let mut k = u32::from_le_bytes([c[0], c[1], c[2], c[3]]); - k = k.wrapping_mul(C1).rotate_left(15).wrapping_mul(C2); - h ^= k; - h = h.rotate_left(13).wrapping_mul(5).wrapping_add(0xe654_6b64); - } - let mut k = 0u32; - for (i, b) in tail.iter().enumerate() { - k ^= (*b as u32) << (8 * i); - } - if !tail.is_empty() { - k = k.wrapping_mul(C1).rotate_left(15).wrapping_mul(C2); - h ^= k; - } - h ^= data.len() as u32; - h ^= h >> 16; - h = h.wrapping_mul(0x85eb_ca6b); - h ^= h >> 13; - h = h.wrapping_mul(0xc2b2_ae35); - h ^= h >> 16; - h -} - -/// Cryptomatte hash of a name (the manifest value). -pub fn crypto_hash(name: &str) -> u32 { - let h = murmur3_32(name.as_bytes(), 0); - // Keep the float finite and normal: flip the low exponent bit when it is all 0s or 1s. - let e = (h >> 23) & 0xff; - if e == 0 || e == 255 { h ^ (1 << 23) } else { h } -} +pub use craft_exr::cryptomatte::{hash as crypto_hash, murmur3_32}; /// The ID float stored in Cryptomatte channels for a hash. pub fn crypto_float(hash: u32) -> f32 { diff --git a/crates/raster/src/flow.rs b/crates/raster/src/flow.rs index 4fdf0e060..3a4a9d6f8 100644 --- a/crates/raster/src/flow.rs +++ b/crates/raster/src/flow.rs @@ -113,16 +113,63 @@ pub fn block_flow(a: &Image, b: &Image, block: u32, radius: i32) -> Flow { block_flow_window(a, b, block, block, radius) } +/// Largest coarse search radius honoured (the effects use at most 64). +const MAX_RADIUS: i32 = 1024; +/// Upper bound on the pixel comparisons of one motion search (about 4·10¹²: minutes of work on +/// many cores). A finer vector grid than this allows is made coarser, by doubling the tile. +const MAX_SEARCH_WORK: f64 = 4.4e12; + +/// The pixel comparisons [`block_flow_window`] makes for tiles of `bs`: every tile, at every +/// pyramid level, tries its candidate vectors with a `window`-sized block, then refines. +/// The pyramid depth follows the requested tile `fine`, not the coarsened one, so a coarser vector +/// grid keeps the full search range. +fn search_work(w: usize, h: usize, bs: usize, fine: usize, win: i64, radius: i64) -> f64 { + let tiles = (w.div_ceil(bs).max(1) as f64) * (h.div_ceil(bs).max(1) as f64); + let reach = (fine as i64).max(win) as usize * 2; + let (mut lw, mut lh, mut top) = (w, h, 0u32); + while top < 3 && lw / 2 >= reach && lh / 2 >= reach { + (lw, lh, top) = (lw / 2, lh / 2, top + 1); + } + let mut per_tile = 5.0 * (win * win) as f64; + for level in 0..=top { + let lbs = (win >> level).max(4) as f64; + let (seeds, r) = if level == top { (1.0, radius as f64) } else { (6.0, 1.0) }; + per_tile += seeds * (2.0 * r + 1.0).powi(2) * lbs * lbs; + } + tiles * per_tile +} + +/// The tile size and radius to search with: `tile`, doubled (while it still fits the frame) and +/// then, if that is not enough, the radius halved, until the search is within [`MAX_SEARCH_WORK`]. +fn planned(w: usize, h: usize, tile: usize, win: i64, radius: i64) -> (usize, i64) { + let (mut bs, mut r) = (tile, radius); + while bs * 2 <= w.min(h) && search_work(w, h, bs, tile, win, r) > MAX_SEARCH_WORK { + bs *= 2; + } + while r > 1 && search_work(w, h, bs, tile, win, r) > MAX_SEARCH_WORK { + r /= 2; + } + (bs, r) +} + /// [`block_flow`] with separate vector spacing and matching window: one vector per /// `tile × tile` tile, each matched with the `window × window` block centred on its tile /// (Timewarp's Vector Detail and Block Size). pub fn block_flow_window(a: &Image, b: &Image, tile: u32, window: u32, radius: i32) -> Flow { - let bs = tile.max(2) as usize; // The matching cost per vector grows with the window's area; 512 is far above any block size the effects offer. let win = i64::from(window.clamp(4, 512)); + let radius = radius.min(MAX_RADIUS); + let fine = tile.max(2) as usize; + let (bs, radius) = planned(a.width as usize, a.height as usize, fine, win, i64::from(radius)); + let coarse = bs != fine; // Window origin relative to the tile origin. let wo = bs as i64 / 2 - win / 2; let (w, h) = (a.width as usize, a.height as usize); + // A coarsened grid's last (partial) tiles keep their window inside the frame. + let origin = |c: i64, dim: usize| { + let o = c * bs as i64 + wo; + if coarse { o.clamp(0, (dim as i64 - win).max(0)) } else { o } + }; let cols = w.div_ceil(bs).max(1); let rows = h.div_ceil(bs).max(1); let mut flow = Flow { width: a.width, height: a.height, block: bs as u32, cols, rows, v: vec![[0.0; 2]; cols * rows] }; @@ -132,7 +179,7 @@ pub fn block_flow_window(a: &Image, b: &Image, tile: u32, window: u32, radius: i // Pyramids (level 0 = full resolution); stop while blocks still fit. let mut pa = vec![Plane::luma(a)]; let mut pb = vec![Plane::luma(b)]; - while pa.len() < 4 && pa.last().is_some_and(|p| p.w / 2 >= (bs as i64).max(win) as usize * 2 && p.h / 2 >= (bs as i64).max(win) as usize * 2) { + while pa.len() < 4 && pa.last().is_some_and(|p| p.w / 2 >= (fine as i64).max(win) as usize * 2 && p.h / 2 >= (fine as i64).max(win) as usize * 2) { let (na, nb) = (pa.last().map(Plane::half), pb.last().map(Plane::half)); pa.extend(na); pb.extend(nb); @@ -145,14 +192,14 @@ pub fn block_flow_window(a: &Image, b: &Image, tile: u32, window: u32, radius: i let k = 1i64 << level; // The block covers the tile's footprint at this level (at least 4 pixels). let lbs = (win / k).max(4); - let r = if level == top { radius as i64 } else { 1 }; + let r = if level == top { radius } else { 1 }; let prev = cur.clone(); cur = (0..cols * rows) .into_par_iter() .map(|i| { let (c, rr) = ((i % cols) as i64, (i / cols) as i64); - let bx = (c * bs as i64 + wo) / k; - let by = (rr * bs as i64 + wo) / k; + let bx = origin(c, w) / k; + let by = origin(rr, h) / k; // Candidates: this tile's and its neighbours' vectors from the coarser level. let mut seeds: Vec<[i64; 2]> = vec![[0, 0]]; if level != top { @@ -185,12 +232,11 @@ pub fn block_flow_window(a: &Image, b: &Image, tile: u32, window: u32, radius: i } // Sub-pixel refinement (parabola through the SAD of the neighbours) at full resolution. let (la, lb) = (&pa[0], &pb[0]); - let bsi = bs as i64; let wsi = win; let fine: Vec<[f32; 2]> = (0..cols * rows) .into_par_iter() .map(|i| { - let (bx, by) = ((i % cols) as i64 * bsi + wo, (i / cols) as i64 * bsi + wo); + let (bx, by) = (origin((i % cols) as i64, w), origin((i / cols) as i64, h)); let d = cur[i]; let e0 = sad(la, lb, bx, by, wsi, d[0], d[1]); let fit = |em: f32, ep: f32| { @@ -296,6 +342,19 @@ mod tests { s / n as f32 } + #[test] + fn a_fine_vector_grid_with_a_huge_window_is_made_coarser() { + // 8K frame, a vector per 2 px, a 512-px window and a 1024-px search: far past the budget. + let (t, r) = super::planned(7680, 4320, 2, 512, 1024); + assert!(t > 2 && t <= 4320 && super::search_work(7680, 4320, t, 2, 512, r) <= super::MAX_SEARCH_WORK, "{t} {r}"); + // The tile stays inside the frame, and the pyramid (search range) follows the requested tile. + let (t, _) = super::planned(7680, 4320, 2, 512, 710); + assert!(t <= 4320); + // Pixel Motion Blur's finest grid with its largest search keeps its grid on a 1080p frame. + assert_eq!(super::planned(1920, 1080, 2, 16, 64), (2, 64)); + assert_eq!(super::planned(1920, 1080, 8, 64, 4), (8, 4)); + } + #[test] fn a_huge_matching_window_is_held_to_the_cap() { let (a, b) = (texture(520, 520, 0.0), texture(520, 520, 2.0)); diff --git a/crates/render/src/audio.rs b/crates/render/src/audio.rs index 00342847d..2c1538133 100644 --- a/crates/render/src/audio.rs +++ b/crates/render/src/audio.rs @@ -24,6 +24,15 @@ use crate::{EvalCtx, ExprHost, FootageSource}; const MAX_DEPTH: usize = 16; +/// The fastest a layer's audio plays (a Stretch of 1%). +const MAX_SPEED: f64 = 100.0; + +/// The most effect preroll (history before a block) mixed, in seconds, across a layer's effects. +const MAX_PREROLL_SECONDS: f64 = 30.0; + +/// The longest footage a waveform summarises (a day). +const MAX_PEAK_SECONDS: i64 = 24 * 3600; + /// `frames` stereo sample frames of `comp`'s mix from comp time `start` at `rate` Hz, /// interleaved (L R L R …). pub fn mix_comp(project: &Project, footage: &dyn FootageSource, expr: Option<&dyn ExprHost>, comp: ItemId, start: Tick, frames: usize, rate: u32) -> Vec { @@ -35,22 +44,29 @@ pub fn mix_comp(project: &Project, footage: &dyn FootageSource, expr: Option<&dy /// Whether the comp has anything audible (footage with audio, a sound generator, or a precomp /// that has). pub fn comp_has_audio(project: &Project, comp: ItemId) -> bool { - fn walk(project: &Project, comp: ItemId, depth: usize) -> bool { - let Some(c) = project.comp(comp) else { return false }; - depth < MAX_DEPTH - && c.layers.iter().any(|l| { - l.switches.audio - && (generates(l) - || match &l.source { - LayerSource::Footage { item } => { - matches!(project.item(*item).map(|i| &i.kind), Some(ItemKind::Footage(f)) if f.has_audio && !f.missing) - } - LayerSource::Comp { item } => walk(project, *item, depth + 1), - _ => false, - }) - }) + // Breadth first, so each comp is looked at once and at its shallowest level: a comp reached + // first through a long chain (past MAX_DEPTH) is still found by a shorter route, and a cycle + // cannot hide a result (nothing is cached as "silent" while it is being explored). + let mut seen = std::collections::HashSet::from([comp]); + let mut level = vec![comp]; + for _ in 0..MAX_DEPTH { + let mut next = vec![]; + for id in level { + let Some(c) = project.comp(id) else { continue }; + for l in c.layers.iter().filter(|l| l.switches.audio) { + match &l.source { + _ if generates(l) => return true, + LayerSource::Footage { item } if matches!(project.item(*item).map(|i| &i.kind), Some(ItemKind::Footage(f)) if f.has_audio && !f.missing) => { + return true; + } + LayerSource::Comp { item } if seen.insert(*item) => next.push(*item), + _ => {} + } + } + } + level = next; } - walk(project, comp, 0) + false } /// Enabled audio effects of a layer (in stack order) with their effect ids. @@ -157,7 +173,7 @@ impl MixEnv<'_> { let m = b - a; // Within ±1 % to ±9900 % (#3247): a stretch of 1e-300 % set in memory read about // usize::MAX source samples for one block. - let speed = 100.0 / l.effective_stretch(); + let speed = (100.0 / l.effective_stretch()).min(MAX_SPEED); let src_n = ((m as f64 * speed).ceil() as usize).max(1); let lt = l.layer_time(sample_tick(i0 + a as i64, rate)); let buf = match &l.source { @@ -213,7 +229,7 @@ impl MixEnv<'_> { return self.layer_raw(l, i0, n, false); } let reversed = fx.iter().any(|(id, _, _)| audio_fx::reverses(id)); - let pre_s: f64 = fx.iter().map(|(id, _, p)| audio_fx::preroll(id, p)).sum(); + let pre_s: f64 = fx.iter().map(|(id, _, p)| audio_fx::preroll(id, p)).sum::().clamp(0.0, MAX_PREROLL_SECONDS); let pre = (pre_s * self.rate as f64).ceil() as usize; let b0 = i0 - pre as i64; let mut buf = self.layer_raw(l, b0, n + pre, reversed); @@ -342,12 +358,14 @@ pub fn footage_peaks(footage: &dyn FootageSource, item: ItemId, f: &effectcraft_ let bin = (64usize).max(4000 / bins_per_sec as usize); let rate = bin as u32 * bins_per_sec; let chunk = bin * bins_per_sec as usize; - let total = units_ceil(duration, rate).max(0) as usize; + // The stated duration comes from the project: at most a day is summarised, and the summary + // ends where the audio does. + let total = units_ceil(duration, rate).clamp(0, MAX_PEAK_SECONDS.saturating_mul(rate as i64)) as usize; let mut out = Vec::with_capacity(total / bin + 1); let mut i = 0usize; while i < total { let n = chunk.min(total - i); - let buf = footage.audio(item, f, sample_tick(i as i64, rate), n, rate).unwrap_or_else(|| vec![0.0; n * 2]); + let Some(buf) = footage.audio(item, f, sample_tick(i as i64, rate), n, rate) else { break }; out.extend(peak_summary(&buf, bin)); i += n; } @@ -375,6 +393,55 @@ mod tests { } } + #[test] + fn audio_detection_answers_each_comp_once() { + // Twenty levels, each comp holding two layers of the one below: 2^20 walks without a + // memo, and all silent. A cycle is answered too. + let mut p = Project::default(); + let mk = |p: &mut Project, layers: Vec| { + let mut c = Comp::new(8, 8, FrameRate::new(25, 1), Tick::from_seconds_f64(1.0)); + c.layers = layers.into(); + p.add_item("C", effectcraft_color::Label::Sandstone, None, ItemKind::Comp(c.into())) + }; + let base = Comp::new(8, 8, FrameRate::new(25, 1), Tick::from_seconds_f64(1.0)); + let mut below = mk(&mut p, vec![]); + for _ in 0..20 { + let a = build::layer(&mut p, &base, "a", LayerSource::Comp { item: below }, (0, 0), None); + let b = build::layer(&mut p, &base, "b", LayerSource::Comp { item: below }, (0, 0), None); + below = mk(&mut p, vec![a, b]); + } + let (tx, rx) = std::sync::mpsc::channel(); + std::thread::spawn(move || tx.send(comp_has_audio(&p, below)).ok()); + assert!(!rx.recv_timeout(std::time::Duration::from_secs(20)).expect("detection finishes")); + } + + #[test] + fn audio_found_by_a_short_route_is_not_hidden_by_a_deep_one() { + let mut p = Project::default(); + let base = Comp::new(8, 8, FrameRate::new(25, 1), Tick::from_seconds_f64(1.0)); + let mk = |p: &mut Project, layers: Vec| { + let mut c = base.clone(); + c.layers = layers.into(); + p.add_item("C", effectcraft_color::Label::Sandstone, None, ItemKind::Comp(c.into())) + }; + let f = Footage { kind: FootageKind::Audio, has_audio: true, ..Default::default() }; + let fid = p.add_item("x.wav", effectcraft_color::Label::SeaFoam, None, ItemKind::Footage(f)); + let sound = build::layer(&mut p, &base, "s", LayerSource::Footage { item: fid }, (0, 0), None); + let audible = mk(&mut p, vec![sound]); + // A chain of MAX_DEPTH comps ends in `audible` one level past what is searched; the root + // reaches `audible` directly as well, after the chain. + let mut chain = audible; + for _ in 0..MAX_DEPTH { + let l = build::layer(&mut p, &base, "c", LayerSource::Comp { item: chain }, (0, 0), None); + chain = mk(&mut p, vec![l]); + } + assert!(!comp_has_audio(&p, chain), "too deep to be found"); + let via_chain = build::layer(&mut p, &base, "chain", LayerSource::Comp { item: chain }, (0, 0), None); + let direct = build::layer(&mut p, &base, "direct", LayerSource::Comp { item: audible }, (0, 0), None); + let root = mk(&mut p, vec![via_chain, direct]); + assert!(comp_has_audio(&p, root)); + } + #[test] fn mixes_layers_with_levels_and_in_out() { let mut p = Project::default(); diff --git a/crates/render/src/cache/dependencies.rs b/crates/render/src/cache/dependencies.rs index dc4216098..6f14ddcde 100644 --- a/crates/render/src/cache/dependencies.rs +++ b/crates/render/src/cache/dependencies.rs @@ -33,6 +33,8 @@ impl Dependencies<'_> { { for g in fx.groups().take(limit.unwrap_or(usize::MAX)).filter(|g| g.enabled) { self.group(ctx, layer, g, 0)?; + // A LUT file edited on disk changes the pixels without an edit (#3493). + crate::reads::lut_files(ctx, layer, g).hash(self.h); } } self.other_times = previous; @@ -169,6 +171,14 @@ impl Dependencies<'_> { ItemKind::Comp(comp) => { let time = ctx.source_time(layer); time.0.hash(self.h); + // The nested layers are walked without this instance's Essential + // Properties overrides, which the render applies: a LUT file one of + // them names is read too (#3493). + for o in crate::fx_host::essential_overrides(ctx, layer) { + if let effectcraft_keyframe::Value::Str(src) = &o.value { + crate::reads::source_files(src).hash(self.h); + } + } let nested = EvalCtx::new(ctx.project, item, comp, time); for child in &comp.layers { self.layer(&nested, child)?; diff --git a/crates/render/src/disk_cache.rs b/crates/render/src/disk_cache.rs index 5c34348fe..3674b2667 100644 --- a/crates/render/src/disk_cache.rs +++ b/crates/render/src/disk_cache.rs @@ -483,12 +483,54 @@ pub fn default_folder() -> PathBuf { if let Some(x) = std::env::var_os("XDG_CACHE_HOME") { return PathBuf::from(x).join("effectcraft/disk-cache"); } - home.map(|h| h.join(".cache/effectcraft/disk-cache")).unwrap_or_else(|| std::env::temp_dir().join("effectcraft-disk-cache")) + // Without a home folder: a per-user folder in the shared temp folder, made private by `open`. + let user = std::env::var("USER").or_else(|_| std::env::var("USERNAME")).unwrap_or_default(); + home.map(|h| h.join(".cache/effectcraft/disk-cache")).unwrap_or_else(|| std::env::temp_dir().join(format!("effectcraft-disk-cache-{user}"))) +} + +/// A cache folder in the shared temp folder must be ours alone: not a link someone placed there, +/// and private (setting the mode fails unless we own it), so another user cannot redirect the +/// cache's writes and clean-up or read its files. +#[cfg(unix)] +fn make_private(folder: &Path) -> std::io::Result<()> { + use std::os::unix::fs::PermissionsExt; + // Judge the folder as written and as it resolves (a relative path, a link or an alias such as + // /tmp -> /private/tmp can all land in the shared temp folder). + // The shared roots: the process's temp folder (`TMPDIR`) and the system's own, which a cache + // configured by path lands in whatever `TMPDIR` says. + let roots: Vec = [std::env::temp_dir(), PathBuf::from("/tmp"), PathBuf::from("/var/tmp")] + .into_iter() + .flat_map(|t| { + let real = t.canonicalize().unwrap_or_else(|_| t.clone()); + [t, real] + }) + .collect(); + let given = std::path::absolute(folder).unwrap_or_else(|_| folder.to_path_buf()); + let real = folder.canonicalize().unwrap_or_else(|_| given.clone()); + // The shared folder itself is not ours to change or to keep a cache in: refused. + if [&given, &real].iter().any(|p| roots.contains(p)) { + return Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "the disk cache folder is the shared temp folder")); + } + // Only folders inside it are made private. + if ![&given, &real].iter().any(|p| roots.iter().any(|t| p.starts_with(t) && **p != *t)) { + return Ok(()); + } + if std::fs::symlink_metadata(folder)?.file_type().is_symlink() { + return Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "the disk cache folder is a link")); + } + std::fs::set_permissions(folder, std::fs::Permissions::from_mode(0o700)) +} + +#[cfg(not(unix))] +fn make_private(_: &Path) -> std::io::Result<()> { + Ok(()) } impl DiskCache { /// Open (or create) the cache in `folder`, holding at most `max_bytes`. pub fn open(folder: impl AsRef, max_bytes: u64) -> std::io::Result> { + std::fs::create_dir_all(folder.as_ref())?; + make_private(folder.as_ref())?; let dir = folder.as_ref().join(VERSION); std::fs::create_dir_all(&dir)?; let dc = Arc::new(DiskCache { @@ -1145,8 +1187,9 @@ impl DiskCache { /// started at. /// The buffer is shared, and encoded on the writer thread. pub fn put_layer(&self, key: u128, buf: &Arc, files: &EntryFiles, since: u64) { - // (no room on the disk: refused before the buffer is queued and compressed) - if self.contains(Kind::Layer, key) || !self.accepts_writes() { + // (no room on the disk, or a buffer no entry could hold: refused before it is queued and + // compressed) + if !layer_fits(buf.img.data.len()) || self.contains(Kind::Layer, key) || !self.accepts_writes() { return; } self.count_encode(); @@ -1155,6 +1198,9 @@ impl DiskCache { /// Write a layer buffer synchronously (tests); a list that can't be stored is not. pub fn put_layer_now(&self, key: u128, buf: &Buf, files: &ReadFiles) { + if !layer_fits(buf.img.data.len()) { + return; + } if let Some(files) = EntryFiles::of(files, None) { self.write_format(Kind::Layer, key, FORMAT_LAYER_FILES, &with_files(&files, encode_layer(buf))); } @@ -1163,8 +1209,12 @@ impl DiskCache { /// A segmentation (chain key, scale) written by [`DiskCache::put_seg`]. pub fn get_seg(&self, key: u64, scale: f64) -> Option { let p = self.read(Kind::Matte, seg_key(key, scale))?; - let raw = lz4_flex::decompress_size_prepended(&p).ok()?; - effectcraft_effects::roto::FrameSeg::from_bytes(&raw) + let seg = decompress_checked(&p, None).and_then(|raw| effectcraft_effects::roto::FrameSeg::from_bytes(&raw)); + if seg.is_none() { + // A rejected entry would otherwise stay indexed and keep `put_seg` from replacing it. + self.discard(Kind::Matte, seg_key(key, scale)); + } + seg } /// Queue a segmentation for writing. @@ -1403,16 +1453,38 @@ fn encode_frame(w: u32, h: u32, rgba: &[u8]) -> Vec { out } +/// The most bytes one cache entry decompresses to (a 16384² frame of 8-bit RGBA): the size an +/// entry states is checked against it, and against what the entry's dimensions need, before +/// anything is allocated. +const MAX_ENTRY_BYTES: usize = 1 << 30; + +/// An LZ4 payload with its stated size prepended, decompressed only when that size is +/// `expected` (any size up to [`MAX_ENTRY_BYTES`] when `None`). +fn decompress_checked(p: &[u8], expected: Option) -> Option> { + let size = u32::from_le_bytes(p.get(..4)?.try_into().ok()?) as usize; + if size > MAX_ENTRY_BYTES || expected.is_some_and(|e| e != size) { + return None; + } + // A block that ends short of the size it states is damaged: callers index by that size. + lz4_flex::decompress(p.get(4..)?, size).ok().filter(|raw| raw.len() == size) +} + fn decode_frame(p: &[u8]) -> Option { if p.len() < 8 { return None; } let w = u32::from_le_bytes(p[0..4].try_into().ok()?); let h = u32::from_le_bytes(p[4..8].try_into().ok()?); - let rgba = lz4_flex::decompress_size_prepended(&p[8..]).ok()?; + let rgba = decompress_checked(&p[8..], Some((w as usize).checked_mul(h as usize)?.checked_mul(4)?))?; (rgba.len() == w as usize * h as usize * 4).then_some(Frame8 { width: w, height: h, rgba }) } +/// Whether a layer of `pixels` pixels (16 bytes each, decompressed) is within what a cache entry +/// may hold: a larger one could never be read back, so it is not compressed or written. +fn layer_fits(pixels: usize) -> bool { + pixels.checked_mul(16).is_some_and(|b| b <= MAX_ENTRY_BYTES) +} + /// Half floats with their low and high bytes in planes (per channel), then LZ4: the high bytes /// (sign, exponent) repeat a lot, mixed with the low ones LZ4 finds little. fn encode_frame_f16(w: u32, h: u32, rgba: &[u16]) -> Vec { @@ -1440,10 +1512,7 @@ fn decode_frame_f16(p: &[u8]) -> Option { let w = u32::from_le_bytes(p[0..4].try_into().ok()?); let h = u32::from_le_bytes(p[4..8].try_into().ok()?); let n = (w as usize).checked_mul(h as usize)?; - let planes = lz4_flex::decompress_size_prepended(&p[8..]).ok()?; - if planes.len() != n.checked_mul(8)? { - return None; - } + let planes = decompress_checked(&p[8..], Some(n.checked_mul(8)?))?; let mut rgba = vec![0u16; n * 4]; for (i, px) in rgba.as_chunks_mut::<4>().0.iter_mut().enumerate() { for (c, v) in px.iter_mut().enumerate() { @@ -1486,9 +1555,9 @@ fn decode_layer(p: &[u8]) -> Option { let f = |i: usize| -> Option { Some(f64::from_le_bytes(p[i..i + 8].try_into().ok()?)) }; let offset = [f(8)?, f(16)?]; let scale = f(24)?; - let planes = lz4_flex::decompress_size_prepended(&p[32..]).ok()?; let n = (w as usize).checked_mul(h as usize)?; - if planes.len() != n.checked_mul(16)? { + let planes = decompress_checked(&p[32..], Some(n.checked_mul(16)?))?; + if planes.len() != n * 16 { return None; } let mut img = Image::new(w, h); @@ -1507,7 +1576,7 @@ fn decode_layer(p: &[u8]) -> Option { // ---------------------------------------------------------------- content keys /// Bump when rendering changes in a way that makes old disk entries wrong. -const RENDER_VERSION: &str = "effectcraft-render-6"; +const RENDER_VERSION: &str = "effectcraft-render-7"; /// Feeds the `Debug` form of `v` into the hash, followed by a separator byte. fn hash_debug(h: &mut Hash128, v: &impl std::fmt::Debug) { @@ -1619,6 +1688,82 @@ pub fn frame_key(content: u128, frame: i64, scale_milli: u32, view: u64) -> u128 mod tests { use super::*; + #[cfg(unix)] + #[test] + fn a_cache_folder_in_the_temp_folder_is_made_private_and_never_a_link() { + use std::os::unix::fs::PermissionsExt; + let d = tmpdir("private"); + let dc = DiskCache::open(&d, 1 << 20).unwrap(); + assert_eq!(std::fs::metadata(&d).unwrap().permissions().mode() & 0o777, 0o700); + drop(dc); + let link = tmpdir("link-private-temp"); + std::os::unix::fs::symlink(&d, &link).unwrap(); + assert!(DiskCache::open(&link, 1 << 20).is_err()); + let _ = std::fs::remove_file(&link); + let _ = std::fs::remove_dir_all(&d); + } + + #[cfg(unix)] + #[test] + fn the_shared_temp_folder_itself_is_refused_as_a_cache_folder() { + let tmp = std::env::temp_dir(); + assert!(DiskCache::open(&tmp, 1 << 20).is_err()); + } + + #[cfg(unix)] + #[test] + fn a_folder_that_resolves_into_the_temp_folder_is_made_private() { + use std::os::unix::fs::PermissionsExt; + // `/link` names a folder in the temp folder only through the link. + let real = tmpdir("alias-real"); + std::fs::create_dir_all(&real).unwrap(); + let link = std::env::current_dir().unwrap().join(format!("effectcraft-alias-link-{}", std::process::id())); + let _ = std::fs::remove_file(&link); + std::os::unix::fs::symlink(&real, &link).unwrap(); + let dc = DiskCache::open(link.join("cache"), 1 << 20).unwrap(); + let mode = std::fs::metadata(real.join("cache")).map(|m| m.permissions().mode() & 0o777); + drop(dc); + let _ = std::fs::remove_file(&link); + let _ = std::fs::remove_dir_all(&real); + assert_eq!(mode.unwrap(), 0o700); + } + + #[test] + fn layers_too_big_to_read_back_are_not_written() { + assert!(layer_fits(MAX_ENTRY_BYTES / 16)); + assert!(!layer_fits(MAX_ENTRY_BYTES / 16 + 1)); + assert!(!layer_fits(10_000 * 10_000)); + assert!(!layer_fits(usize::MAX)); + } + + #[test] + fn an_entry_stating_a_size_its_dimensions_do_not_need_is_not_decompressed() { + // A 2×2 frame whose payload states 3 GiB: refused before any allocation. + let mut p = 2u32.to_le_bytes().to_vec(); + p.extend_from_slice(&2u32.to_le_bytes()); + p.extend_from_slice(&(3u32 << 30).to_le_bytes()); + p.extend_from_slice(&[0; 16]); + assert!(decode_frame(&p).is_none()); + assert!(decompress_checked(&p[8..], None).is_none()); + // A well-formed entry still decodes. + let ok = encode_frame(2, 2, &[7; 16]); + assert_eq!(decode_frame(&ok).map(|f| f.rgba), Some(vec![7; 16])); + } + + #[test] + fn a_block_shorter_than_the_size_it_states_is_rejected() { + // The payload states 100 bytes but holds a valid block of 10: `lz4_flex` returns the 10. + let mut p = 100u32.to_le_bytes().to_vec(); + p.extend_from_slice(&lz4_flex::block::compress(&[5u8; 10])); + assert!(decompress_checked(&p, None).is_none()); + // A half-float frame whose planes come up short is refused, not indexed past. + let mut f16 = 2u32.to_le_bytes().to_vec(); + f16.extend_from_slice(&2u32.to_le_bytes()); + f16.extend_from_slice(&32u32.to_le_bytes()); + f16.extend_from_slice(&lz4_flex::block::compress(&[1u8; 8])); + assert!(decode_frame_f16(&f16).is_none()); + } + fn tmpdir(name: &str) -> PathBuf { let d = std::env::temp_dir().join(format!("effectcraft-disk-cache-{name}-{}", std::process::id())); let _ = std::fs::remove_dir_all(&d); diff --git a/crates/render/src/eval.rs b/crates/render/src/eval.rs index 41e6132d3..a9abefb16 100644 --- a/crates/render/src/eval.rs +++ b/crates/render/src/eval.rs @@ -283,7 +283,7 @@ impl<'a> EvalCtx<'a> { } impl crate::PropertyOverride { - fn value(&self, layer: &Layer, prop: &Property, time: Tick) -> Value { + pub(crate) fn value(&self, layer: &Layer, prop: &Property, time: Tick) -> Value { if self.font { // A Font control merges only the font into the target text, as // `essential::with_overrides` does. diff --git a/crates/render/src/pipeline.rs b/crates/render/src/pipeline.rs index b1ec0ca02..c0f4c8dd9 100644 --- a/crates/render/src/pipeline.rs +++ b/crates/render/src/pipeline.rs @@ -56,6 +56,29 @@ pub struct MediaOverride { pub(crate) item: ItemId, } +/// The most pixels a solid layer's buffer holds (as the other layer buffers are held to). +const MAX_SOLID_PIXELS: f64 = 16.0e6; + +/// The scale and whole-pixel size of a `width`×`height` solid rendered at `scale`, lowered until +/// the rounded size (each side at least one pixel) is within [`MAX_SOLID_PIXELS`]. +pub(crate) fn solid_size(width: u32, height: u32, mut scale: f64) -> (f64, u32, u32) { + let size = |s: f64| (((width as f64 * s).ceil() as u32).max(1), ((height as f64 * s).ceil() as u32).max(1)); + // Rounding up leaves an elongated solid over the cap after one step; each step shrinks the + // overshoot geometrically, so a few are enough. + for i in 0..64 { + let (w, h) = size(scale); + let area = w as f64 * h as f64; + if area <= MAX_SOLID_PIXELS { + break; + } + // The first step is the exact area ratio; later ones undershoot a little so rounding up + // cannot leave the size stuck just over the cap. + scale *= (MAX_SOLID_PIXELS / area).sqrt() * if i == 0 { 1.0 } else { 0.99 }; + } + let (w, h) = size(scale); + (scale, w, h) +} + impl MediaOverride { /// A Media Replacement of `layer`'s footage by `item`. pub fn new(layer: LayerId, item: ItemId) -> Self { @@ -757,6 +780,15 @@ impl<'a> Renderer<'a> { return; } let Some(fx) = layer.effects() else { return }; + // The LUT files the stack reads go to this render's files: a frame on disk made with one + // that changed since is not used (#3493). + if let Some(log) = self.reads { + for g in fx.groups().take(limit).filter(|g| g.enabled) { + for f in super::reads::lut_files(ctx, layer, g) { + log.note(f); + } + } + } let lt = layer.layer_time(ctx.time); let layer_size = ctx.effect_bounds(layer).0; // #659 / #1205: an authored layer's buffer spans only its painted content. Effects that @@ -890,8 +922,9 @@ impl<'a> Renderer<'a> { match &layer.source { LayerSource::Solid { item } => { let ItemKind::Solid(sol) = &self.project.item(*item)?.kind else { return None }; - let w = ((sol.width as f64 * s).ceil() as u32).max(1); - let h = ((sol.height as f64 * s).ceil() as u32).max(1); + // One colour: a solid larger than MAX_SOLID_PIXELS is made at a lower scale (the + // buffer carries it) instead of allocating gigabytes for a uniform plane. + let (s, w, h) = solid_size(sol.width, sol.height, s); if layer.switches.adjustment { return Some(Buf { img: Image::filled(w, h, [1.0; 4]), offset: [0.0; 2], scale: s }); } diff --git a/crates/render/src/reads.rs b/crates/render/src/reads.rs index ed97e50fd..af0535e5a 100644 --- a/crates/render/src/reads.rs +++ b/crates/render/src/reads.rs @@ -35,9 +35,10 @@ impl FileStamp { } /// The identity of the file at `path` now: one `metadata` call. `None` when the file system - /// can't describe it (missing, or a path served from memory). + /// can't describe it (missing, not a regular file, or a path served from memory). pub fn native(path: &str) -> Option { - std::fs::metadata(path).ok().map(|md| FileStamp::of_metadata(&md)) + let md = std::fs::metadata(path).ok()?; + md.is_file().then(|| FileStamp::of_metadata(&md)) } } @@ -65,6 +66,34 @@ impl ReadFile { } } +/// The files effect `g` of `layer` reads at the context time (Apply Color LUT, Lumetri's Input +/// LUT and Look, OCIO File Transform, a custom OCIO config and its LUTs: see +/// [`effectcraft_effects::lut_params`]), each with its identity now. A layer's cache key holds them and a render +/// notes them, so what was made with a file that changed since is not used (#3493). +pub(crate) fn lut_files(ctx: &crate::EvalCtx, layer: &effectcraft_project::Layer, g: &effectcraft_project::PropGroup) -> Vec { + let effectcraft_project::GroupKind::Effect { effect } = &g.kind else { return Vec::new() }; + effectcraft_effects::lut_params(effect) + .iter() + .filter_map(|param| match ctx.value(layer, g.prop(param)?) { + effectcraft_keyframe::Value::Str(src) => Some(source_files(&src)), + _ => None, + }) + .flatten() + .collect() +} + +/// The files a file parameter set to `src` reads (an OCIO config's also the LUTs it names, #3538), +/// each with its identity now. +pub(crate) fn source_files(src: &str) -> Vec { + effectcraft_effects::lut_files(src) + .into_iter() + .map(|path| { + let stamp = FileStamp::native(&path).unwrap_or(FileStamp::Missing); + ReadFile::new(path, stamp) + }) + .collect() +} + /// At most this many files are listed per render or cached buffer; more mark the list /// incomplete (a comp reading more files than this for one frame is not checked file by file). pub const MAX_READ_FILES: usize = 4096; @@ -327,6 +356,15 @@ mod tests { let _ = std::fs::remove_dir_all(&dir); } + #[test] + fn a_directory_is_not_a_native_file_stamp() { + let dir = std::env::temp_dir().join(format!("effectcraft-stamp-directory-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + assert_eq!(FileStamp::native(&dir.to_string_lossy()), None); + let _ = std::fs::remove_dir_all(&dir); + } + #[test] fn the_list_is_bounded() { let files: ReadFiles = (0..MAX_READ_FILES + 3).map(|i| file(&format!("/f{i:06}"), 1)).collect(); diff --git a/crates/render/src/tests.rs b/crates/render/src/tests.rs index 4cfa35d0b..2d0f90ac5 100644 --- a/crates/render/src/tests.rs +++ b/crates/render/src/tests.rs @@ -2002,3 +2002,17 @@ fn a_copy_of_an_overridden_clip_is_not_served_the_keyed_clips_pixels() { assert_same(&render(&keyed, Some(&cache)), &render(&keyed, None), "the keyed clip's copy"); assert_same(&render(&overridden, Some(&cache)), &render(&overridden, None), "the overridden clip's copy"); } + +#[test] +fn elongated_solids_stay_within_the_pixel_cap_after_rounding() { + use crate::pipeline::solid_size; + // 1 × 100 million at full scale: rounding up used to leave 40 million pixels. + for (w, h) in [(1u32, 100_000_000u32), (100_000_000, 1), (u32::MAX, u32::MAX), (1, u32::MAX)] { + let (s, pw, ph) = solid_size(w, h, 1.0); + assert!(s > 0.0 && f64::from(pw) * f64::from(ph) <= 16.0e6, "{w}x{h} -> {pw}x{ph} at {s}"); + } + // A solid within the cap keeps its scale; an over-cap square is lowered by the exact ratio. + assert_eq!(solid_size(4000, 4000, 1.0), (1.0, 4000, 4000)); + let (s, pw, ph) = solid_size(5000, 5000, 1.0); + assert!((s - 0.8).abs() < 0.01 && pw * ph <= 16_000_000); +} diff --git a/crates/render/src/text.rs b/crates/render/src/text.rs index 1e95bbc11..eef5b4067 100644 --- a/crates/render/src/text.rs +++ b/crates/render/src/text.rs @@ -198,6 +198,35 @@ pub fn in_index_units(layer: &Layer, uid: effectcraft_project::Uid) -> bool { /// Selection of every glyph by an animator's selectors, per dimension. pub fn animator_selection(ctx: &EvalCtx, layer: &Layer, anim: &PropGroup, lay: &TextLayout) -> Vec<[f64; 3]> { + animator_selection_within(ctx, layer, anim, lay, &SelectorBudget::new()) +} + +/// The Expression Selector evaluations one layer's animators may run in all: counted, not timed, +/// so the same frame renders the same on every machine. +pub struct SelectorBudget(std::cell::Cell); + +impl SelectorBudget { + pub fn new() -> SelectorBudget { + SelectorBudget(std::cell::Cell::new(MAX_SELECTOR_EVALS)) + } + + /// Take one evaluation; `false` when none are left. + fn take(&self) -> bool { + let left = self.0.get(); + self.0.set(left.saturating_sub(1)); + left > 0 + } +} + +impl Default for SelectorBudget { + fn default() -> Self { + Self::new() + } +} + +/// [`animator_selection`] drawing its Expression Selector evaluations from `budget`, which the +/// caller shares across the layer's animators. +pub fn animator_selection_within(ctx: &EvalCtx, layer: &Layer, anim: &PropGroup, lay: &TextLayout, budget: &SelectorBudget) -> Vec<[f64; 3]> { let sels: Vec<&PropGroup> = anim.sub("selectors").map(|s| s.groups().filter(|g| g.enabled).collect()).unwrap_or_default(); if sels.is_empty() { // No selectors: every character is fully affected. @@ -250,13 +279,31 @@ pub fn animator_selection(ctx: &EvalCtx, layer: &Layer, anim: &PropGroup, lay: & { log.mark_unkeyed(); } - let stat = ctx.v3(layer, sel, "amount", [100.0; 3]); + // The keyframed amount, read without running its expression (the fallback when the + // expression cannot run); an Essential Property override still applies. + let stat = if prop.has_expression() { + // The expression is not run here, but an Essential Property override still wins over the base value. + match ctx.property_overrides.iter().rev().find(|o| o.layer == layer.id && o.prop == prop.uid) { + Some(o) => o.value(layer, prop, ctx.time), + None => prop.value_at(layer.layer_time(ctx.time)), + } + } else { + ctx.value(layer, prop) + } + .as_vec3(); + // One allowance for the whole layer (`budget`, shared by its animators): the + // expression runs per character, so a slow expression on a long text is stopped + // once it has failed or the layer's evaluations pass MAX_SELECTOR_EVALS. + let stopped = std::cell::Cell::new(false); Box::new(move |i, n, prev| { let pv = prev.map(|x| x * 100.0); // Without an expression engine: the static amount scales the selection. let fallback = [0, 1, 2].map(|d| stat[d] * prev[d]); - let r = match ctx.expr.filter(|_| prop.has_expression()) { - Some(h) => h.eval_text_selector(ctx, layer, prop, i, n, pv).unwrap_or(fallback), + let r = match ctx.expr.filter(|_| prop.has_expression() && !stopped.get() && budget.take()) { + Some(h) => h.eval_text_selector(ctx, layer, prop, i, n, pv).unwrap_or_else(|_| { + stopped.set(true); + fallback + }), None => fallback, }; r.map(|x| (x / 100.0).clamp(-1.0, 1.0)) @@ -282,13 +329,17 @@ pub fn animator_selection(ctx: &EvalCtx, layer: &Layer, anim: &PropGroup, lay: & acc } +/// The most Expression Selector evaluations one layer's animators run across all its characters +/// (a text of 32,768 characters under one expression selector, or fewer under several). +const MAX_SELECTOR_EVALS: usize = 32_768; /// Evaluate animators for every glyph. pub fn char_transforms(ctx: &EvalCtx, layer: &Layer, text: &PropGroup, lay: &TextLayout) -> Vec { let mut out = vec![CharXf::default(); lay.glyphs.len()]; let Some(anims) = text.sub("animators") else { return out }; + let budget = SelectorBudget::new(); for anim in anims.groups().filter(|g| g.enabled) { let Some(props) = anim.sub("properties") else { continue }; - let sel = animator_selection(ctx, layer, anim, lay); + let sel = animator_selection_within(ctx, layer, anim, lay, &budget); let get = |m: &str| props.get(m).map(|p| ctx.value(layer, p).components()); let get1 = |m: &str| props.get(m).map(|p| ctx.value(layer, p).as_f64()); let c3 = |v: Vec, d: f64| [v.first().copied().unwrap_or(d), v.get(1).copied().unwrap_or(d), v.get(2).copied().unwrap_or(d)]; diff --git a/crates/render/src/text/tests.rs b/crates/render/src/text/tests.rs index 9b52d3098..bbc1cd28e 100644 --- a/crates/render/src/text/tests.rs +++ b/crates/render/src/text/tests.rs @@ -802,3 +802,12 @@ fn text_notes_the_font_files_it_draws_with() { assert!(files.is_complete(), "{files:?}"); assert_eq!(files.get(&font.to_string_lossy()), Some(stamp), "{files:?}"); } + +#[test] +fn selector_evaluations_are_counted_across_the_layer_not_timed() { + let b = SelectorBudget(std::cell::Cell::new(3)); + // Taken by any animator's selectors in turn; the fourth finds none, and stays none. + assert!([b.take(), b.take(), b.take()].iter().all(|t| *t)); + assert!(!b.take() && !b.take()); + assert_eq!(SelectorBudget::new().0.get(), MAX_SELECTOR_EVALS); +} diff --git a/crates/render/src/three_d/adv/raster.rs b/crates/render/src/three_d/adv/raster.rs index 1c37a6267..f0d6028f9 100644 --- a/crates/render/src/three_d/adv/raster.rs +++ b/crates/render/src/three_d/adv/raster.rs @@ -126,11 +126,14 @@ fn setup(s: &Scene, clip: &[[f32; 4]], range: std::ops::Range) -> Vec= bbox[2] || bbox[1] >= bbox[3] { continue; diff --git a/crates/render/src/three_d/camera.rs b/crates/render/src/three_d/camera.rs index 6aee50a78..18f6dfe8a 100644 --- a/crates/render/src/three_d/camera.rs +++ b/crates/render/src/three_d/camera.rs @@ -302,6 +302,13 @@ pub fn auto_orient_2d(ctx: &EvalCtx, layer: &Layer) -> f64 { path_tangent(ctx, layer).map(|t| t.y.atan2(t.x).to_degrees()).unwrap_or(0.0) } +/// The most camera-facing layers whose parents are evaluated inside one another. +const MAX_ORIENT_NESTING: usize = 8; + +thread_local! { + static ORIENT_NESTING: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + /// Whether `id` is `layer` or one of its parents. fn in_parent_chain(ctx: &EvalCtx, layer: &Layer, id: effectcraft_project::LayerId) -> bool { let mut cur = Some(layer); @@ -336,8 +343,27 @@ pub fn auto_orient_3d(ctx: &EvalCtx, layer: &Layer, pos: Vec3) -> Option { if ctx.comp.active_camera(ctx.time).is_some_and(|c| in_parent_chain(ctx, c, layer.id)) { return None; } + // The parent's world matrix evaluates the parent's own orientation: a parent cycle + // of camera-facing layers would recurse without end, and a chain of them is walked + // again from every link. Past MAX_ORIENT_NESTING the layer keeps its Orientation. + let nesting = ORIENT_NESTING.with(|n| n.get()); + if nesting >= MAX_ORIENT_NESTING { + return None; + } + // Restored when this scope ends, a panic unwinding through it included (the CPU retry + // after one must not start with a raised count). + struct Restore(usize); + impl Drop for Restore { + fn drop(&mut self) { + ORIENT_NESTING.with(|n| n.set(self.0)); + } + } + ORIENT_NESTING.with(|n| n.set(nesting + 1)); + let restore = Restore(nesting); + let parent = parent_world(ctx, layer); + drop(restore); let eye = active_camera(ctx).eye; - let e = parent_world(ctx, layer).inverse().unwrap_or(Mat4::IDENTITY).apply(eye); + let e = parent.inverse().unwrap_or(Mat4::IDENTITY).apply(eye); let d = pos - e; (d.length() > 1e-9).then(|| basis_rotation(d, vec3(0.0, 1.0, 0.0))) } diff --git a/crates/script/src/model.rs b/crates/script/src/model.rs index e662c1cdc..62f3a8557 100644 --- a/crates/script/src/model.rs +++ b/crates/script/src/model.rs @@ -5,6 +5,7 @@ use effectcraft_engine::Session; use effectcraft_engine::color::Label; use effectcraft_keyframe::{Interp, TextDoc, Value as KV}; +use effectcraft_project::ae_order::{self, AeChild}; use effectcraft_project::{Comp, GroupKind, ItemId, ItemKind, Layer, LayerId, LayerSource, Node, ParamUi, PropGroup}; use effectcraft_render::EvalCtx; use effectcraft_time::Tick; @@ -318,7 +319,8 @@ fn indexed_parade(g: &PropGroup) -> bool { fn node_json(c: &Comp, l: &Layer, uid: u64) -> R { if uid == 0 || uid == l.props.uid { - let n = l.props.children.len(); + // After Effects' count (every slot, used or not); 3D model layers count their own groups. + let n = ae_order::ae_count(l).unwrap_or(l.props.children.len()); return Ok(json!({ "uid": l.props.uid, "kind": "group", "name": l.name, "matchName": matchnames::layer(&l.source), "matchId": "layer", "index": c.index_of(l.id).unwrap_or(0), "depth": 0, "parent": null, "isLayer": true, "numProperties": n, @@ -329,7 +331,8 @@ fn node_json(c: &Comp, l: &Layer, uid: u64) -> R { let ch = chain(l, uid).ok_or("the property no longer exists (it was deleted)")?; let node = *ch.last().ok_or("bad property")?; let parent_group: &PropGroup = if ch.len() >= 2 { ch[ch.len() - 2].as_group().ok_or("bad tree")? } else { &l.props }; - let index = parent_group.children.iter().position(|x| x.uid() == uid).map(|i| i + 1).unwrap_or(0); + let top = if ch.len() == 1 { ae_order::ae_index(l, node.match_id()) } else { None }; + let index = top.unwrap_or_else(|| parent_group.children.iter().position(|x| x.uid() == uid).map(|i| i + 1).unwrap_or(0)); let parent_uid = if ch.len() >= 2 { ch[ch.len() - 2].uid() } else { l.props.uid }; let match_name = matchnames::node(&ch); let instance_parent = indexed_parade(parent_group) && ch.len() >= 2 || (ch.len() == 2 && ch[0].match_id() == "contents"); @@ -475,6 +478,25 @@ fn child(s: &Session, a: &J) -> R { let uid = u(a, "uid").unwrap_or(0); let g: &PropGroup = if uid == 0 || uid == l.props.uid { &l.props } else { l.props.find_group(uid).ok_or("not a property group")? }; let key = a.get("key").cloned().unwrap_or(J::Null); + // A layer's numbers and match names are After Effects' (Marker is 1, unused groups keep their + // slot and resolve to the same empty group by number or by match name). + let slot = match &key { + J::Number(n) => Some(n.as_u64().and_then(|i| usize::try_from(i).ok())), + J::String(name) => ae_order::ae_index_of_match_name(l, name).map(Some), + _ => None, + }; + if std::ptr::eq(g, &l.props) + && ae_order::ae_slots(&l.source).is_some() + && let Some(slot) = slot + { + let Some(i) = slot else { return Ok(J::Null) }; + return match ae_order::ae_child(l, i) { + Some(AeChild::Node(n)) => node_json(c, l, n.uid()), + Some(AeChild::Marker) => Ok(json!({"marker": true})), + Some(AeChild::Absent(s)) => Ok(json!({"absent": true, "name": s.name, "matchName": s.match_name, "index": i})), + None => Ok(J::Null), + }; + } let found = match &key { J::Number(n) => n.as_u64().and_then(|i| g.children.get((i as usize).checked_sub(1)?)), J::String(k) => find_child(l, g, k, NESTED_CHILD_DEPTH), diff --git a/crates/script/src/prelude.js b/crates/script/src/prelude.js index 0c39c4dfe..ce6cd44f4 100644 --- a/crates/script/src/prelude.js +++ b/crates/script/src/prelude.js @@ -79,9 +79,10 @@ BlendingMode.SILHOUETTE_ALPHA = BlendingMode.SILHOUETE_ALPHA; var KeyframeInterpolationType = __enum("KeyframeInterpolationType", ["LINEAR", "BEZIER", "HOLD"], 6612); var TrackMatteType = __enum("TrackMatteType", ["NO_TRACK_MATTE", "ALPHA", "ALPHA_INVERTED", "LUMA", "LUMA_INVERTED"], 5012); var LightType = __enum("LightType", ["PARALLEL", "SPOT", "POINT", "AMBIENT", "ENVIRONMENT"], 4412); +// In After Effects' order and numbers (26.3): right comes before centre. var ParagraphJustification = __enum("ParagraphJustification", [ - "LEFT_JUSTIFY", "CENTER_JUSTIFY", "RIGHT_JUSTIFY", "FULL_JUSTIFY_LASTLINE_LEFT", "FULL_JUSTIFY_LASTLINE_CENTER", - "FULL_JUSTIFY_LASTLINE_RIGHT", "FULL_JUSTIFY_LASTLINE_FULL", "MULTIPLE_JUSTIFICATIONS"], 7413); + "MULTIPLE_JUSTIFICATIONS", "LEFT_JUSTIFY", "RIGHT_JUSTIFY", "CENTER_JUSTIFY", "FULL_JUSTIFY_LASTLINE_LEFT", + "FULL_JUSTIFY_LASTLINE_RIGHT", "FULL_JUSTIFY_LASTLINE_CENTER", "FULL_JUSTIFY_LASTLINE_FULL"], 7412); var PropertyValueType = __enum("PropertyValueType", [ "NO_VALUE", "ThreeD_SPATIAL", "ThreeD", "TwoD_SPATIAL", "TwoD", "OneD", "COLOR", "CUSTOM_VALUE", "MARKER", "LAYER_INDEX", "MASK_INDEX", "SHAPE", "TEXT_DOCUMENT"], 6412); @@ -120,7 +121,14 @@ function __blendLabel(v) { var __interpKey = { 6612: "linear", 6613: "bezier", 6614: "hold" }; var __matteKind = { 5013: "alpha", 5014: "alphaInverted", 5015: "luma", 5016: "lumaInverted" }; var __matteEnum = { Alpha: 5013, AlphaInverted: 5014, Luma: 5015, LumaInverted: 5016 }; -var __justKey = { 7413: "left", 7414: "center", 7415: "right", 7416: "justifyLeft", 7417: "justifyCenter", 7418: "justifyRight", 7419: "justifyAll" }; +var __justKey = {}; +__justKey[ParagraphJustification.LEFT_JUSTIFY] = "left"; +__justKey[ParagraphJustification.CENTER_JUSTIFY] = "center"; +__justKey[ParagraphJustification.RIGHT_JUSTIFY] = "right"; +__justKey[ParagraphJustification.FULL_JUSTIFY_LASTLINE_LEFT] = "justifyLeft"; +__justKey[ParagraphJustification.FULL_JUSTIFY_LASTLINE_CENTER] = "justifyCenter"; +__justKey[ParagraphJustification.FULL_JUSTIFY_LASTLINE_RIGHT] = "justifyRight"; +__justKey[ParagraphJustification.FULL_JUSTIFY_LASTLINE_FULL] = "justifyAll"; // ------------------------------------------------------------------ output, $ and dialogs @@ -292,6 +300,34 @@ function Folder(path) { if (!(this instanceof Folder)) return new Folder(path); this.__path = path === undefined ? "" : __str(path); } + +// ECMAScript's legacy case canonicalisation (what a `/i` regular expression compares with): the +// upper case form when it is one code unit, and not an ASCII letter for a non-ASCII one. +function __canon(ch) { + var u = ch.toUpperCase(); + if (u.length !== 1) return ch; + if (ch.charCodeAt(0) >= 128 && u.charCodeAt(0) < 128) return ch; + return u; +} + +// A case-insensitive `*` / `?` file mask match in time bounded by mask × name length (a +// regular expression of `.*` runs backtracks combinatorially on overlapping wildcards). +function __globMatch(mask, name) { + // Wildcards run over the original name (lowercasing it can change its length: "İ" becomes + // two code units); literal characters compare one at a time, case-insensitively as `/i` does + // ("ς" and "σ" and "Σ" match each other). + var p = mask, s = name; + var i = 0, j = 0, star = -1, mark = 0; + while (j < s.length) { + if (i < p.length && (p[i] === "?" || p[i] === s[j] || __canon(p[i]) === __canon(s[j]))) { i++; j++; } + else if (i < p.length && p[i] === "*") { star = i++; mark = j; } + else if (star !== -1) { i = star + 1; j = ++mark; } + else return false; + } + while (i < p.length && p[i] === "*") i++; + return i === p.length; +} + Folder.prototype = { constructor: Folder, get fsName() { return this.__path; }, @@ -310,10 +346,7 @@ Folder.prototype = { var out = []; for (var i = 0; i < names.length; i++) { var n = names[i]; - if (typeof mask === "string" && mask !== "*") { - var re = new RegExp("^" + mask.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".") + "$", "i"); - if (!re.test(n.split(/[\/\\]/).pop())) continue; - } + if (typeof mask === "string" && mask !== "*" && !__globMatch(mask, n.split(/[\/\\]/).pop())) continue; var isDir = JSON.parse(__file("isDir", n)); var f = isDir ? new Folder(n) : new File(n); if (typeof mask === "function" && !mask(f)) continue; @@ -628,10 +661,46 @@ TextDocument.prototype = { function __propOf(layer, info) { if (!info) return null; if (info.isLayer) return layer; + if (info.marker) return layer.marker; + if (info.absent) return __absentGroup(layer, info); if (info.kind === "group") return info.isMask ? new MaskPropertyGroup(layer, info.uid) : new PropertyGroup(layer, info.uid); return new Property(layer, info.uid); } +// A top-level slot After Effects always has and this layer does not use yet (Layer Styles before +// any style, Data, Sets…): an empty group, so loops over `numProperties` meet no null. +function __absentGroup(layer, info) { + var g = { + __kind: "PropertyGroup", + get name() { return info.name; }, + get matchName() { return info.matchName; }, + get propertyIndex() { return info.index; }, + get propertyDepth() { return 1; }, + get propertyType() { return PropertyType.NAMED_GROUP; }, + get parentProperty() { return layer; }, + get numProperties() { return 0; }, + get enabled() { return true; }, + get active() { return layer.enabled; }, + get canSetEnabled() { return false; }, + get isModified() { return false; }, + get isEffect() { return false; }, + get isMask() { return false; }, + get elided() { return false; }, + get selected() { return false; }, + property: function () { return null; }, + propertyGroup: function (n) { return n === undefined || n === 1 ? layer : null; }, + canAddProperty: function () { return false; }, + addProperty: function (n) { throw __err("Can not add \"" + n + "\" to \"" + info.name + "\""); }, + toString: function () { return "[object PropertyGroup]"; }, + }; + // Callable like any group: `layer.property(7)(1)` is `.property(1)`, null. + var f = function (k) { return g.property(k); }; + delete f.name; + delete f.length; + for (const k of Object.getOwnPropertyNames(g)) Object.defineProperty(f, k, Object.getOwnPropertyDescriptor(g, k)); + return f; +} + function PropertyBase() {} PropertyBase.prototype = { __info: function () { return __get("node", { comp: this.__layer.__comp, layer: this.__layer.__id, uid: this.__uid }); }, @@ -867,6 +936,12 @@ Property.prototype.property = function () { return null; }; if (!idx) return null; return this.__layer.containingComp.layer(idx).__id; } + // A string parameter (a LUT or look file, a text field) takes the text, or a File's path (#3395). + // A hidden one (Mesh Warp's mesh) stays refused by the key setters too, as by setValue. + if (info.type === "string") { + if (info.hidden) throw __err("\"" + info.name + "\" can not be set"); + return __str(v); + } if (info.type === "enum") return __num(v) - 1; if (info.type === "bool") return typeof v === "boolean" ? v : __num(v) !== 0; if (info.type === "color") { @@ -1652,7 +1727,7 @@ CompItem.prototype.constructor = CompItem; P.saveFrameToPng = function (time, file) { var f = __str(file); if (!f) throw __err("saveFrameToPng: missing file"); - __file("write", f, ""); + __file("checkWrite", f); __call("comp.saveFrameAs", { comp: this.__id, path: f, time: __num(time, "time") }); }; P.openInEssentialGraphics = function () { __call("comp.openInEssentialGraphics", { comp: this.__id }); }; @@ -1662,8 +1737,8 @@ CompItem.prototype.constructor = CompItem; if (!/\.[A-Za-z0-9]+$/.test(f)) f += ".ectemplate"; if (!overwrite && JSON.parse(__file("exists", f)) === true) return false; if (this.__controllers().length === 0) return false; - // The file gate applies to templates too. - __file("write", f, ""); + // The file gate applies to templates too (checked without touching the file). + __file("checkWrite", f); __call("essential.exportTemplate", { comp: this.__id, path: f }); return true; }; diff --git a/crates/script/src/runtime.rs b/crates/script/src/runtime.rs index c23eaefb0..28e490158 100644 --- a/crates/script/src/runtime.rs +++ b/crates/script/src/runtime.rs @@ -427,6 +427,8 @@ fn native_file(_: &JsValue, args: &[JsValue], ctx: &mut Context) -> JsResult check_access(s, &path, true).map(|_| json!(true)), "read" | "readBinary" => { let p = check_access(s, &path, false)?; let bytes = s.services.read_file(&p.to_string_lossy()).map_err(|e| format!("Unable to read {path}: {e}"))?; @@ -530,8 +532,33 @@ fn native_eval_file(_: &JsValue, args: &[JsValue], ctx: &mut Context) -> JsResul r } +/// Host hooks: code a script compiles at run time (`eval`, `new Function`, …) passes the same +/// nesting check as the script itself, since the parser recurses per level and a deep string +/// built at run time would overflow the stack. +struct Hooks; + +impl boa_engine::context::HostHooks for Hooks { + fn ensure_can_compile_strings( + &self, + _realm: boa_engine::realm::Realm, + parameters: &[JsString], + body: &JsString, + _direct: bool, + _context: &mut Context, + ) -> JsResult<()> { + let mut code: String = parameters.iter().map(|p| p.to_std_string_escaped()).collect::>().join(","); + // With no parameters (`eval`) the body is the source as it stands, so a leading `#!` line + // is still its first line; with parameters it sits inside a function, where it is no comment. + if !parameters.is_empty() { + code.push('\n'); + } + code.push_str(&body.to_std_string_escaped()); + check_nesting(&code).map_err(|e| JsNativeError::syntax().with_message(e).into()) + } +} + pub(crate) fn new_context() -> Result { - let mut ctx = Context::default(); + let mut ctx = boa_engine::context::ContextBuilder::new().host_hooks(std::rc::Rc::new(Hooks)).build().map_err(|e| e.to_string())?; let limits = ctx.runtime_limits_mut(); limits.set_loop_iteration_limit(200_000_000); limits.set_recursion_limit(2000); @@ -769,19 +796,129 @@ fn run_expanded(session: &mut Session, req: &ScriptRequest) -> Outcome { /// 8 MiB thread such as the Script Console's, so deeper scripts are rejected up front. pub const MAX_NESTING: usize = 96; -/// An error when `code` nests brackets deeper than [`MAX_NESTING`] (strings, template literals -/// and comments are skipped). +/// Skip template-literal text from `*i` (just past a backtick or an interpolation's `}`). Returns +/// true when it stopped past a `${` (code follows), false at the closing backtick or the end. +fn skip_template_text(b: &[u8], i: &mut usize) -> bool { + while let Some(&d) = b.get(*i) { + match d { + b'\\' => *i += 2, + b'`' => { + *i += 1; + return false; + } + b'$' if b.get(*i + 1) == Some(&b'{') => { + *i += 2; + return true; + } + _ => *i += 1, + } + } + false +} + +/// Whether a `/` after the last significant byte `prev` (at `at` in `b`) starts a regular +/// expression literal rather than dividing: after an operator, an opening bracket, a separator, +/// a keyword that takes an expression, or at the start. After a name, a number, a string or a +/// closing bracket it divides (a regular expression after `)` is the one case this misreads). +/// `after_dot`: the word ending at `at` follows a `.` (a property name, never a keyword); a `++` +/// or `--` before the `/` is a postfix update, so it divides. +fn regex_may_start(b: &[u8], prev: u8, at: usize, after_dot: bool) -> bool { + match prev { + 0 => true, + b'+' | b'-' if at > 0 && b.get(at - 1) == Some(&prev) => false, + b'(' | b',' | b'=' | b':' | b'[' | b'!' | b'&' | b'|' | b'?' | b'{' | b';' | b'+' | b'-' | b'*' | b'%' | b'<' | b'>' | b'~' | b'^' => true, + _ if after_dot => false, + c if c.is_ascii_alphanumeric() || c == b'_' || c == b'$' => { + let start = (0..=at).rev().find(|&k| !b.get(k).is_some_and(|d| d.is_ascii_alphanumeric() || *d == b'_' || *d == b'$')).map_or(0, |k| k + 1); + let word = b.get(start..=at).unwrap_or_default(); + [&b"return"[..], b"typeof", b"instanceof", b"in", b"of", b"new", b"delete", b"void", b"throw", b"case", b"do", b"else", b"yield", b"await"] + .contains(&word) + } + _ => false, + } +} + +/// Whether the `.` at `at` is a property access: not the decimal point of a number (`1.`, `12.`) +/// that ends there. A number written `1.5.x` has a fraction before the dot, so that dot accesses. +fn dot_is_property(b: &[u8], at: usize) -> bool { + let word = |d: u8| d.is_ascii_alphanumeric() || d == b'_' || d == b'$'; + let start = (0..at).rev().find(|&k| !b.get(k).is_some_and(|d| word(*d))).map_or(0, |k| k + 1); + let before = b.get(start..at).unwrap_or_default(); + let integer = !before.is_empty() && before.iter().all(u8::is_ascii_digit); + // `1.5.x`: digits that follow another `.` are a fraction. + !(integer && !(start > 0 && b.get(start - 1) == Some(&b'.'))) +} + +/// Skip a regular expression literal that starts at `b[*i]` (a `/`), to its closing `/` (flags +/// follow as ordinary letters). A `/` inside a class `[…]` or after a backslash does not end it, +/// and neither a quote nor a backtick inside it starts a string; a line break ends it. +fn skip_regex(b: &[u8], i: &mut usize) { + *i += 1; + let mut class = false; + while let Some(&d) = b.get(*i) { + match d { + b'\\' => *i += 1, + b'[' => class = true, + b']' => class = false, + b'/' if !class => return, + b'\n' => return, + _ => {} + } + *i += 1; + } +} + +/// An error when `code` nests brackets deeper than [`MAX_NESTING`] (strings, regular expression +/// literals, template literal text and comments are skipped; the code inside `${…}` +/// interpolations is checked). pub fn check_nesting(code: &str) -> Result<(), String> { let b = code.as_bytes(); let (mut i, mut depth, mut max) = (0usize, 0usize, 0usize); + // The last significant byte (not space or comment), and where it is. + let (mut prev, mut prev_at) = (0u8, 0usize); + // A `#!` line at the very start is a comment (Boa reads it so): its text is not scanned. + if b.starts_with(b"#!") { + i = b.iter().position(|d| *d == b'\n').unwrap_or(b.len()); + } + // Whether the word that ends at `prev_at` came right after a `.` token (comments and + // whitespace between them do not matter). + let mut word_after_dot = false; + // The bracket depth of each open `${`, to tell its closing `}` from an inner one. + let mut interpolations: Vec = vec![]; while let Some(&c) = b.get(i) { match c { + b'`' => { + i += 1; + if skip_template_text(b, &mut i) { + depth += 1; + max = max.max(depth); + interpolations.push(depth); + (prev, prev_at) = (b'{', i - 1); + } else { + (prev, prev_at) = (b'`', i.saturating_sub(1)); + } + continue; + } + b'}' if interpolations.last() == Some(&depth) => { + interpolations.pop(); + depth -= 1; + i += 1; + if skip_template_text(b, &mut i) { + depth += 1; + max = max.max(depth); + interpolations.push(depth); + (prev, prev_at) = (b'{', i - 1); + } else { + (prev, prev_at) = (b'`', i.saturating_sub(1)); + } + continue; + } b'(' | b'[' | b'{' => { depth += 1; max = max.max(depth); } b')' | b']' | b'}' => depth = depth.saturating_sub(1), - b'"' | b'\'' | b'`' => { + b'"' | b'\'' => { // Skip to the closing quote (escapes skip a byte). i += 1; while let Some(&d) = b.get(i) { @@ -797,16 +934,29 @@ pub fn check_nesting(code: &str) -> Result<(), String> { while b.get(i).is_some_and(|d| *d != b'\n') { i += 1; } + continue; } b'/' if b.get(i + 1) == Some(&b'*') => { i += 2; while i < b.len() && !(b.get(i) == Some(&b'*') && b.get(i + 1) == Some(&b'/')) { i += 1; } - i += 1; + i += 2; + continue; } + b'/' if regex_may_start(b, prev, prev_at, word_after_dot) => skip_regex(b, &mut i), _ => {} } + if !c.is_ascii_whitespace() { + let word = |d: u8| d.is_ascii_alphanumeric() || d == b'_' || d == b'$'; + // A word starts where the byte before it is not a word byte (white space and comments + // end a word too): it is a property name when a `.` that is not part of a number + // comes right before it. + if word(c) && (i == 0 || !b.get(i - 1).is_some_and(|d| word(*d))) { + word_after_dot = prev == b'.' && dot_is_property(b, prev_at); + } + (prev, prev_at) = (c, i); + } i += 1; } if max > MAX_NESTING { @@ -880,6 +1030,44 @@ mod nesting_tests { assert!(check_nesting(&("(".repeat(MAX_NESTING) + &")".repeat(MAX_NESTING))).is_ok()); } + #[test] + fn regular_expression_literals_are_skipped_not_read_as_strings_or_templates() { + let deep = |n: usize| format!("{}1{}", "(".repeat(n), ")".repeat(n)); + // A backtick, a quote or a slash inside a class in a regular expression opens nothing, so + // the deep expression after it is still counted. + for re in ["/`/", "/\"/", "/'/", "/[/]/", "/\\//"] { + assert!(check_nesting(&format!("`x${{ {re}.test('x') ? {} : 0 }}`", deep(5000))).is_err(), "{re} in an interpolation"); + assert!(check_nesting(&format!("x = {re}.test(y) ? {} : 0", deep(5000))).is_err(), "{re}"); + assert!(check_nesting(&format!("x = {re}.test(y) ? {} : 0", deep(10))).is_ok(), "{re} shallow"); + } + // Division is not a regular expression: what follows it is still scanned. + assert!(check_nesting(&format!("a = 4 / 2; b = {}", deep(5000))).is_err()); + assert!(check_nesting(&format!("a = (4) / 2 / 3; b = {}", deep(5000))).is_err()); + // After a keyword that takes an expression a slash starts a regular expression. + assert!(check_nesting(&format!("typeof /`/ ; {}", deep(5000))).is_err()); + // A postfix update or a property named like a keyword is followed by a division, not a + // regular expression (the deep brackets after it must still be counted). + for head in ["i++ /", "i-- /", "obj.in /", "obj . in /", "obj . /* c */ in /", "obj.\n typeof /", "a1.in /", "1.5.in /"] { + assert!(check_nesting(&format!("x = {head} {} / 2", deep(5000))).is_err(), "{head}"); + } + // A keyword after a property name is still a keyword (`obj.in in /re/`), and the dot of a + // number does not make the word after it a property (`1. in /re/`): the regular expression + // is skipped, so the backtick inside it opens nothing and the brackets after it count. + for head in ["obj.in in", "1. in", "12. typeof"] { + assert!(check_nesting(&format!("x = {head} /`/; y = {}", deep(5000))).is_err(), "{head}"); + } + } + + #[test] + fn template_interpolations_are_checked_but_template_text_is_not() { + let deep = |n: usize| format!("`a${{{}1{}}}b`", "(".repeat(n), ")".repeat(n)); + assert!(check_nesting(&deep(5000)).is_err()); + assert!(check_nesting(&deep(10)).is_ok()); + // Brackets in the literal text, and a nested template, are fine; depth carries across `}`. + assert!(check_nesting(&format!("`{} ${{ `x${{1+(2)}}y` }} {}`", "(".repeat(500), "{".repeat(500))).is_ok()); + assert!(check_nesting(&format!("`${{1}}${{{}2{}}}`", "[".repeat(MAX_NESTING), "]".repeat(MAX_NESTING))).is_err()); + } + /// A canonical drive path and a lexical one compare once the `\\?\` prefix is gone; a UNC /// share and a Unix path are left as they are. #[test] diff --git a/crates/script/src/scriptfile.rs b/crates/script/src/scriptfile.rs index 2b6afcfbe..c3179711b 100644 --- a/crates/script/src/scriptfile.rs +++ b/crates/script/src/scriptfile.rs @@ -56,6 +56,10 @@ pub(crate) fn read(s: &Session, path: &Path) -> Result { if std::fs::metadata(path).is_ok_and(|m| m.len() > MAX_FILE_BYTES as u64) { return Err(too_big()); } + // A pipe or device reports no size and may never end: only regular files are read. + if std::fs::metadata(path).is_ok_and(|m| !m.is_file()) { + return Err(format!("Unable to read {}: not a regular file", path.display())); + } let bytes = s.services.read_file(&path.to_string_lossy()).map_err(|e| format!("Unable to read {}: {e}", path.display()))?; if bytes.len() > MAX_FILE_BYTES { return Err(too_big()); diff --git a/crates/script/src/socket.rs b/crates/script/src/socket.rs index c024fcad5..ff5d6d200 100644 --- a/crates/script/src/socket.rs +++ b/crates/script/src/socket.rs @@ -142,7 +142,7 @@ mod imp { /// Fill a stream's buffer until `done(buf)` or the timeout / end of stream. Fails only when /// the read deadline can't be set. - fn fill(s: &mut TcpStream, buf: &mut Vec, eof: &mut bool, limit: Duration, done: impl Fn(&[u8]) -> bool) -> std::io::Result<()> { + fn fill(s: &mut TcpStream, buf: &mut Vec, eof: &mut bool, limit: Duration, mut done: impl FnMut(&[u8]) -> bool) -> std::io::Result<()> { let end = Instant::now() + limit; let mut chunk = [0u8; 4096]; while !done(buf) && !*eof { @@ -322,7 +322,15 @@ mod imp { } } ("readln", Sock::Stream { s, buf, eof }) => { - if let Err(e) = fill(s, buf, eof, timeout(p), |b| b.contains(&b'\n')) { + // Only the bytes that arrived since the last look are searched: a peer + // sending no newline must not make every read rescan the whole buffer. + let mut seen = 0; + let newline = |b: &[u8]| { + let hit = b.get(seen..).is_some_and(|new| new.contains(&b'\n')); + seen = b.len(); + hit + }; + if let Err(e) = fill(s, buf, eof, timeout(p), newline) { return err(format!("cannot set the read timeout: {e}")); } let line: Vec = match buf.iter().position(|&c| c == b'\n') { diff --git a/crates/script/src/tests.rs b/crates/script/src/tests.rs index 78a16e5d3..25933d165 100644 --- a/crates/script/src/tests.rs +++ b/crates/script/src/tests.rs @@ -10,11 +10,13 @@ use serde_json::{Value, json}; use crate::{Outcome, run_code}; +mod ae_layer_order; mod callable; mod ease_presets; mod evalfile; mod include; mod panels; +mod paragraph_justification; #[cfg(not(target_arch = "wasm32"))] mod render_wait; #[cfg(not(windows))] @@ -700,6 +702,56 @@ fn save_frame_to_png_writes_behind_the_file_gate() { let _ = std::fs::remove_dir_all(&dir); } +/// A script that runs the export commands itself (`app.run`, `__exec`) meets the same file-write +/// preference as the wrappers; with the preference off nothing is created or replaced. +#[test] +fn export_commands_run_directly_by_a_script_respect_the_file_gate() { + let dir = std::env::temp_dir().join(format!("ec-direct-export-{}", std::process::id())); + // A leftover dir from an interrupted run (same pid) must not feed stale absence checks. + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let png = dir.join("frame.png"); + let tpl = dir.join("card.ectemplate"); + let kept = dir.join("kept.png"); + std::fs::write(&kept, b"original").unwrap(); + let mut s = session(); + s.execute("comp.new", json!({"name": "Card", "width": 64, "height": 64, "duration": 1})).unwrap(); + s.execute("layer.newText", json!({"text": "Hi"})).unwrap(); + ok(&mut s, "var c = app.project.activeItem; c.layer(1).property('ADBE Transform Group').property('ADBE Opacity').addToMotionGraphicsTemplate(c);"); + let q = |p: &std::path::Path| serde_json::to_string(&p.to_string_lossy()).unwrap(); + let comp = s.active_comp_id().unwrap().0; + for (code, target) in [ + (format!("app.run('comp.saveFrameAs', {{comp: {comp}, path: {}}})", q(&png)), &png), + (format!("__exec('comp.saveFrameAs', JSON.stringify({{comp: {comp}, path: {}}}))", q(&png)), &png), + (format!("app.run('essential.exportTemplate', {{comp: {comp}, path: {}}})", q(&tpl)), &tpl), + (format!("app.run('comp.saveFrameAs', {{comp: {comp}, path: {}}})", q(&kept)), &kept), + ] { + let o = run_code(&mut s, &code, "direct.jsx"); + let e = o.error.unwrap_or_else(|| panic!("`{code}` was not refused")); + assert!(e.message.contains("Allow Scripts to Write Files"), "{e:?}"); + if target == &kept { + assert_eq!(std::fs::read(&kept).unwrap(), b"original"); + } else { + assert!(!target.exists(), "{} was written", target.display()); + } + } + // The wrappers check the gate without touching the file: an existing one is left as it was. + let o = run_code(&mut s, &format!("app.project.activeItem.saveFrameToPng(0, new File({}))", q(&kept)), "wrap.jsx"); + assert!(o.error.is_some()); + assert_eq!(std::fs::read(&kept).unwrap(), b"original"); + let o = run_code(&mut s, &format!("app.project.activeItem.exportAsMotionGraphicsTemplate(true, {})", q(&tpl)), "wrap.jsx"); + assert!(o.error.is_some()); + assert!(!tpl.exists()); + // The user, from the UI, is not a script: the same command writes. + s.execute("comp.saveFrameAs", json!({"comp": comp, "path": png.to_string_lossy()})).unwrap(); + assert!(png.exists()); + // With the preference on, the script's direct call writes too. + s.prefs.scripting.allow_scripts_write_files = true; + ok(&mut s, &format!("app.run('essential.exportTemplate', {{comp: {comp}, path: {}}})", q(&tpl))); + assert!(std::fs::metadata(&tpl).unwrap().len() > 100); + let _ = std::fs::remove_dir_all(&dir); +} + /// #1246: with Warn User When Executing Files on, a script that asserts `confirmed` itself still /// gets the question; only the user's answer opens the file. #[test] @@ -1949,3 +2001,77 @@ fn setting_comp_width_and_height_leaves_the_layers_where_they_are() { let (_, c) = comp_named(&s, "w"); assert_eq!(layer(c, "s").props.prop("transform/position").unwrap().value, KV::Vec3([100.0, 100.0, 0.0])); } + +#[test] +fn a_hashbang_line_does_not_hide_deep_nesting_from_eval() { + // Boa reads a leading `#!` line of eval source as a comment, so the backtick on it opens no + // template: the brackets after it are counted and refused. + let mut s = session(); + let code = "var deep = new Array(5000).join('(') + '1' + new Array(5000).join(')'); var r; \ + try { eval('#! `\\n' + deep); r = 'ran'; } catch (e) { r = 'refused'; } r"; + assert_eq!(ok(&mut s, code).result.as_str(), Some("refused")); + assert!(crate::runtime::check_nesting(&format!("#! `\n{}1{}", "(".repeat(5000), ")".repeat(5000))).is_err()); + assert!(crate::runtime::check_nesting("#! `\n(1)").is_ok()); +} + +#[test] +fn code_compiled_at_run_time_passes_the_nesting_check() { + // `eval` and `new Function` of a string nested past the limit are refused with a catchable + // error instead of overflowing the parser's stack; shallow code still compiles. + let mut s = session(); + for call in ["eval(deep)", "new Function(deep)", "Function('a', deep)"] { + let code = format!( + "var deep = new Array(5000).join('(') + '1' + new Array(5000).join(')'); var r; try {{ {call}; r = 'ran'; }} catch (e) {{ r = 'refused'; }} r" + ); + assert_eq!(ok(&mut s, &code).result.as_str(), Some("refused"), "{call}"); + } + assert_eq!(ok(&mut s, "eval('1 + (2 * 3)') + new Function('return 4')()").result.as_f64(), Some(11.0)); +} + +#[test] +fn file_masks_match_without_backtracking() { + let mut s = session(); + let r = ok( + &mut s, + "[__globMatch('*.JSX', 'a.jsx'), __globMatch('a?c*', 'abcdef'), __globMatch('*a*b', 'xaxb'), __globMatch('*.png', 'a.jsx'), __globMatch('*a*a*a*a*a*a*a*a*a*a*a*b', new Array(60).join('a'))].join()", + ); + assert_eq!(r.result.as_str(), Some("true,true,true,false,false")); + // `?` still matches one character that lowercases to two. + let r = ok(&mut s, "[__globMatch('?.txt', '\\u0130.txt'), __globMatch('\\u0130*', '\\u0130x')].join()"); + assert_eq!(r.result.as_str(), Some("true,true")); + // Greek sigma matches in every case form, as the case-insensitive regular expression did. + let r = ok( + &mut s, + "[__globMatch('\\u03bf\\u03c2.txt', '\\u039f\\u03a3.txt'), __globMatch('\\u03a3*', '\\u03c2x'), __globMatch('k', '\\u212a'), __globMatch('a', 'b')].join()", + ); + assert_eq!(r.result.as_str(), Some("true,true,false,false")); +} + +/// #3395: setValue on a string effect parameter stores the text, or a File's path, as `prop.set` +/// does. Before, every string fell through to the number check ("value must be a number"). +/// Hidden string parameters (Mesh Warp's Distortion Mesh) stay refused, keys included. +#[test] +fn set_value_stores_a_string_parameter() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("Str", 64, 36, 1, 1, 24); + var l = c.layers.addSolid([1, 0, 0], "s", 64, 36, 1); + var fx = l.property("ADBE Effect Parade"); + var lut = fx.addProperty("Apply Color LUT").property("LUT"); + lut.setValue("/luts/look.cube"); + var fromString = lut.value; + lut.setValue(new File("/luts/other.cube")); + var mesh = fx.addProperty("Mesh Warp").property("Distortion Mesh"); + function attempt(f) { try { f(); return "no error"; } catch (e) { return e.message; } } + var hidden = attempt(function () { mesh.setValue("x"); }); + var keyed = attempt(function () { mesh.setValueAtTime(0, "x"); }); + [lut.propertyValueType === PropertyValueType.CUSTOM_VALUE, fromString, lut.value, hidden, keyed, mesh.numKeys] + "#, + ); + let refused = "\"Distortion Mesh\" can not be set"; + assert_eq!(o.result, json!([true, "/luts/look.cube", "/luts/other.cube", refused, refused, 0])); + let (_, c) = comp_named(&s, "Str"); + assert_eq!(layer(c, "s").props.prop("effects/#1/lut").unwrap().value, KV::Str("/luts/other.cube".into())); +} diff --git a/crates/script/src/tests/ae_layer_order.rs b/crates/script/src/tests/ae_layer_order.rs new file mode 100644 index 000000000..869ce348a --- /dev/null +++ b/crates/script/src/tests/ae_layer_order.rs @@ -0,0 +1,121 @@ +//! `layer.property(n)` and the layer's `numProperties` use After Effects' top-level numbers +//! (`project::ae_order`): Marker is 1 and unused slots keep their place as empty groups, so a loop +//! over `numProperties` meets every slot and never a null. + +use std::sync::Arc; + +use effectcraft_engine::Session; +use serde_json::json; + +use crate::{Outcome, run_code}; + +fn session() -> Session { + let mut s = Session { expr: Some(Arc::new(effectcraft_expr::Expressions)), expr_check: Some(effectcraft_expr::check_syntax), ..Default::default() }; + crate::install(&mut s); + s +} + +fn ok(s: &mut Session, code: &str) -> Outcome { + let o = run_code(s, code, "test.jsx"); + assert!(o.error.is_none(), "script failed: {:?}\noutput: {:?}", o.error, o.output); + o +} + +#[test] +fn layer_numbers_follow_after_effects() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("M", 200, 200, 1, 2, 30); + var solid = c.layers.addSolid([1, 1, 1], "S", 200, 200, 1); + solid.Effects.addProperty("ADBE Slider Control"); + var shape = c.layers.addShape(); + var text = c.layers.addText("t"); + var cam = c.layers.addCamera("Cam", [100, 100]); + function names(l) { var o = []; for (var i = 1; i <= l.numProperties; i++) o.push(l.property(i).matchName); return o; } + [names(solid), names(shape), names(text), names(cam), + solid.property(5)(1)(1).value, solid.property(5).propertyIndex, solid.property("Effects").propertyIndex, + solid.property(1) === solid.marker || solid.property(1).matchName, solid.property(16)] + "#, + ); + let av = [ + "ADBE Marker", + "ADBE Time Remapping", + "ADBE MTrackers", + "ADBE Mask Parade", + "ADBE Effect Parade", + "ADBE Transform Group", + "ADBE Layer Styles", + "ADBE Plane Options Group", + "ADBE Extrsn Options Group", + "ADBE Material Options Group", + "ADBE Audio Group", + "ADBE Data Group", + "ADBE Layer Overrides", + "ADBE Layer Sets", + "ADBE Source Options Group", + ]; + let vector = |first: &str| { + json!([ + "ADBE Marker", + first, + "ADBE Mask Parade", + "ADBE Effect Parade", + "ADBE Transform Group", + "ADBE Layer Styles", + "ADBE Extrsn Options Group", + "ADBE Material Options Group", + "ADBE Audio Group", + "ADBE Layer Sets" + ]) + }; + let r = o.result.as_array().unwrap(); + assert_eq!(r[0], json!(av), "solid"); + assert_eq!(r[1], vector("ADBE Root Vectors Group"), "shape"); + assert_eq!(r[2], vector("ADBE Text Properties"), "text"); + assert_eq!(r[3], json!(["ADBE Marker", "ADBE Transform Group", "ADBE Camera Options Group"]), "camera"); + assert_eq!(r[4], json!(0), "the slider's value through property(5)"); + assert_eq!(r[5], json!(5)); + assert_eq!(r[6], json!(5), "propertyIndex by name is After Effects' too"); + assert_eq!(r[7], json!("ADBE Marker")); + assert_eq!(r[8], json!(null), "past the last slot"); +} + +#[test] +fn walking_every_property_meets_no_null() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("M", 200, 200, 1, 2, 30); + var l = c.layers.addShape(); + var n = 0; + function walk(g) { + for (var i = 1; i <= g.numProperties; i++) { + var p = g.property(i); + if (p === null) throw new Error("null at " + i + " of " + g.name); + if (p.propertyType === PropertyType.PROPERTY) n++; else walk(p); + } + } + walk(l); + n > 0 + "#, + ); + assert_eq!(o.result, json!(true)); +} + +#[test] +fn an_unused_slot_is_the_same_by_number_and_match_name_and_callable() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("M", 200, 200, 1, 2, 30); + var l = c.layers.addSolid([1, 1, 1], "S", 200, 200, 1); + var byName = l.property("ADBE Layer Styles"), byNumber = l.property(7); + [byName !== null && byName.matchName, byName !== null && byName.numProperties, byNumber.propertyIndex, l.property(7)(1), l(12).name] + "#, + ); + assert_eq!(o.result, json!(["ADBE Layer Styles", 0, 7, null, "Data"])); +} diff --git a/crates/script/src/tests/paragraph_justification.rs b/crates/script/src/tests/paragraph_justification.rs new file mode 100644 index 000000000..3b618170c --- /dev/null +++ b/crates/script/src/tests/paragraph_justification.rs @@ -0,0 +1,48 @@ +//! `ParagraphJustification` has After Effects' numbers (26.3): MULTIPLE_JUSTIFICATIONS 7412, +//! LEFT 7413, RIGHT 7414, CENTER 7415, then the justified variants with the last line left (7416), +//! right (7417), centred (7418) and full (7419). A script that stores or compares the numbers gets +//! the same paragraph in both applications. + +use serde_json::json; + +use super::{comp_named, ok, session}; +use effectcraft_engine::keyframe::{Justify, Value as KV}; + +#[test] +fn the_numbers_are_after_effects() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var P = ParagraphJustification; + [P.MULTIPLE_JUSTIFICATIONS, P.LEFT_JUSTIFY, P.RIGHT_JUSTIFY, P.CENTER_JUSTIFY, P.FULL_JUSTIFY_LASTLINE_LEFT, + P.FULL_JUSTIFY_LASTLINE_RIGHT, P.FULL_JUSTIFY_LASTLINE_CENTER, P.FULL_JUSTIFY_LASTLINE_FULL] + "#, + ); + assert_eq!(o.result, json!([7412, 7413, 7414, 7415, 7416, 7417, 7418, 7419])); +} + +#[test] +fn each_number_sets_and_reads_its_paragraph() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("J", 200, 100, 1, 2, 30); + var t = c.layers.addText("ab"); + var st = t.property("ADBE Text Properties").property("ADBE Text Document"); + var back = []; + for (var n = 7413; n <= 7419; n++) { + var d = st.value; d.justification = n; st.setValue(d); + back.push(st.value.justification); + } + var d = st.value; d.justification = 7414; st.setValue(d); + back + "#, + ); + assert_eq!(o.result, json!([7413, 7414, 7415, 7416, 7417, 7418, 7419])); + // 7414 is right-aligned, as in After Effects. + let (_, c) = comp_named(&s, "J"); + let KV::Text(d) = &c.layers[0].props.prop("text/sourceText").unwrap().value else { panic!("not text") }; + assert_eq!(d.justify, Justify::Right); +} diff --git a/crates/segment/src/mobilesam.rs b/crates/segment/src/mobilesam.rs index 6599b018a..abb12fb0f 100644 --- a/crates/segment/src/mobilesam.rs +++ b/crates/segment/src/mobilesam.rs @@ -19,6 +19,9 @@ const IMG: usize = 1024; const EMB: usize = 64; const DIM: usize = 256; const LOW: usize = 256; +/// Most prompt points the decoder takes (each is an attention token, and self-attention is +/// quadratic in them); SAM is used with a handful. More are thinned evenly, keeping both ends. +const MAX_POINTS: usize = 256; const MEAN: [f32; 3] = [123.675, 116.28, 103.53]; const STD: [f32; 3] = [58.395, 57.12, 57.375]; @@ -609,7 +612,7 @@ impl MobileSam { /// Foreground probability (`w×h`) for a prompt on an embedded image, and the predicted IoU. pub fn predict(&self, e: &Embedding, prompt: &Prompt) -> (Vec, f32) { let s = e.scale; - let points: Vec<([f32; 2], bool)> = prompt.points.iter().map(|(p, fg)| ([p[0] * s, p[1] * s], *fg)).collect(); + let points: Vec<([f32; 2], bool)> = thin(&prompt.points).iter().map(|(p, fg)| ([p[0] * s, p[1] * s], *fg)).collect(); let bbox = prompt.bbox.map(|b| b.map(|v| v * s)); // A prior mask (probabilities at image size) → logits on the low-res grid. let mask: Option> = prompt.mask.as_ref().filter(|m| m.len() == e.w * e.h).map(|m| { @@ -675,3 +678,28 @@ fn sample(rgb: &[[f32; 3]], w: usize, h: usize, x: f32, y: f32, foot: f32) -> [f } s.map(|v| v / f32::max(n, 1.0)) } + +/// `points`, or `MAX_POINTS` evenly spaced ones (first and last kept) when there are more. +fn thin(points: &[([f32; 2], bool)]) -> Vec<([f32; 2], bool)> { + let n = points.len(); + if n <= MAX_POINTS { + return points.to_vec(); + } + (0..MAX_POINTS).filter_map(|i| points.get(i * (n - 1) / (MAX_POINTS - 1)).copied()).collect() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn many_prompt_points_are_thinned_to_the_budget() { + let few: Vec<_> = (0..MAX_POINTS).map(|i| ([i as f32, 0.0], i % 2 == 0)).collect(); + assert_eq!(thin(&few), few, "a prompt within the budget is untouched"); + let many: Vec<_> = (0..1_000_000).map(|i| ([i as f32, 0.0], i % 2 == 0)).collect(); + let t = thin(&many); + assert_eq!(t.len(), MAX_POINTS); + assert_eq!((t[0].0, t[MAX_POINTS - 1].0), (many[0].0, many[many.len() - 1].0)); + assert!(t.windows(2).all(|w| w[0].0[0] < w[1].0[0]), "spread in order"); + } +} diff --git a/crates/segment/src/tflite.rs b/crates/segment/src/tflite.rs index 34e85dfab..6aafd056f 100644 --- a/crates/segment/src/tflite.rs +++ b/crates/segment/src/tflite.rs @@ -131,6 +131,8 @@ const MAX_VALUES: u64 = 1 << 30; const MAX_LIVE: u64 = 1 << 29; /// The most constant values decoded and laid out at load (a weight shared by several tensors or /// operators counts once per use). +/// Bytes of tensor names and shapes a model may carry in all (the official ones take well under 1 MB). +const MAX_META: usize = 1 << 24; const MAX_CONSTS: usize = 1 << 27; /// Tensor types (`TensorType`). @@ -261,6 +263,7 @@ impl Model { let mut ints: Vec>> = vec![None; n]; let mut data: Vec<(usize, u8, usize, &[u8])> = vec![]; let mut consts = 0usize; + let mut meta = 0usize; for (i, t) in tensors.iter().enumerate() { let shape: Vec = fb .ints(*t, 0)? @@ -269,7 +272,13 @@ impl Model { .collect::>()?; let ty = fb.byte(*t, 1, FLOAT32)?; let buf = fb.int(*t, 2, 0)? as u32 as usize; - names.push(fb.string(*t, 3)?); + let name = fb.string(*t, 3)?; + // Names and shapes are copied per tensor: bound them in all. + meta = meta.saturating_add(name.len()).saturating_add(shape.len().saturating_mul(8)); + if meta > MAX_META { + return Err("the model's tensor metadata is too large".into()); + } + names.push(name); // Every size computed from shapes later stays in range, even a product of some of the // dimensions (a zero dimension does not let the others grow without bound). let count = shape.iter().try_fold(1usize, |a, &d| a.checked_mul(d)).ok_or("a tensor is too large")?; @@ -329,6 +338,11 @@ impl Model { && let Some(i) = ins.first().copied().flatten() && let Some(len) = floats[i].as_ref().map(Vec::len) { + // The folded constant is what the graph outputs and the run's memory estimate count: + // it must be the declared size. + if shapes[output].iter().try_fold(1usize, |a, &d| a.checked_mul(d)) != Some(len) { + return Err(format!("{}: DEQUANTIZE output size disagrees with its input", names[output])); + } spend(len)?; floats[output] = floats[i].clone(); continue; diff --git a/crates/segment/src/tflite/tests.rs b/crates/segment/src/tflite/tests.rs index 29a781d34..9ba96971f 100644 --- a/crates/segment/src/tflite/tests.rs +++ b/crates/segment/src/tflite/tests.rs @@ -334,6 +334,26 @@ fn shapes_computed_at_run_time_must_match_the_declared_ones() { refused(&zero, "tensor is too large"); } +#[test] +fn a_folded_dequantize_has_its_declared_size() { + let half = |n: usize| vec![0u8; 2 * n]; + let fold = |declared: Vec| { + model(vec![half(4)], vec![(vec![1, 4], FLOAT16, Some(0)), (declared, FLOAT32, None)], vec![(op::DEQUANTIZE, vec![0], vec![1], vec![])], vec![], vec![1]) + }; + // A declared output of one value would let the folded four-value constant be copied out per reference. + refused(&fold(vec![1, 1]), "DEQUANTIZE output size"); + assert!(Model::read(&fold(vec![1, 4])).is_ok()); +} + +#[test] +fn tensor_metadata_is_bounded_in_all() { + // A rank of 4 million dimensions of 1 is a valid shape by size, but copied per tensor. + let m = model(vec![], vec![(vec![1; 1 << 22], FLOAT32, None)], vec![], vec![], vec![]); + refused(&m, "metadata is too large"); + let ok = model(vec![], (0..70).map(|_| (vec![1, 2, 3], FLOAT32, None)).collect(), vec![], vec![], vec![]); + assert!(Model::read(&ok).is_ok()); +} + #[test] fn shared_weights_count_once_per_use() { // One 128 KB buffer decoded for 2100 tensors would be 2100 copies of 2¹⁶ floats. diff --git a/crates/svg/Cargo.toml b/crates/svg/Cargo.toml index 0e1af7719..8b011879b 100644 --- a/crates/svg/Cargo.toml +++ b/crates/svg/Cargo.toml @@ -1,18 +1,20 @@ -[package] -name = "effectcraft-svg" -description = "SVG import: parses SVG 1.1 / SVG 2 static vector content (paths, basic shapes, groups, transforms, use, CSS styles, solid and gradient fills/strokes, opacity) and rasterises it at any scale" -version.workspace = true -edition.workspace = true -license.workspace = true -rust-version.workspace = true - -[lints] -workspace = true - -[dependencies] -effectcraft-geom = { workspace = true } -effectcraft-raster = { workspace = true } -effectcraft-path = { workspace = true } -kurbo = { workspace = true } -roxmltree = "0.21" -rayon = { workspace = true } +[package] +name = "effectcraft-svg" +description = "SVG import: parses SVG 1.1 / SVG 2 static vector content (paths, basic shapes, groups, transforms, use, CSS styles, solid, gradient and pattern fills/strokes, opacity) and rasterises it at any scale" +version.workspace = true +edition.workspace = true +license.workspace = true +rust-version.workspace = true + +[lints] +workspace = true + +[dependencies] +craft-svg = { workspace = true } +effectcraft-geom = { workspace = true } +effectcraft-raster = { workspace = true } +effectcraft-path = { workspace = true } +kurbo = { workspace = true } +roxmltree = "0.21" +rayon = { workspace = true } +log = { workspace = true } diff --git a/crates/svg/README.md b/crates/svg/README.md index 862bd01d0..8496bb9f0 100644 --- a/crates/svg/README.md +++ b/crates/svg/README.md @@ -1,26 +1,48 @@ -# effectcraft-svg - -SVG import for EffectCraft: `.svg` files import as footage (rasterised at any scale, so -Continuously Rasterize stays sharp) and Layer ▸ Create ▸ Create Shapes from Vector Layer turns -them into editable shape layers. - -Implemented from the W3C **Scalable Vector Graphics (SVG) 1.1 (Second Edition)** recommendation -(16 August 2011) and the **SVG 2** candidate recommendation (4 October 2018) for the parts listed -here, plus **CSS Color Module Level 3** for colour keywords and functions: - -- document: `svg` (width/height, `viewBox`, `preserveAspectRatio`), nested `svg`, `g`, `defs`, - `use` (x/y, `href` / `xlink:href`), `symbol` (through `use`), `title`/`desc`/`metadata` ignored; -- shapes: `path` (all path data commands incl. elliptical arcs), `rect` (rx/ry), `circle`, - `ellipse`, `line`, `polyline`, `polygon`; -- `transform` lists (matrix, translate, scale, rotate with centre, skewX, skewY); -- painting: `fill`, `fill-rule`, `fill-opacity`, `stroke`, `stroke-width`, `stroke-linecap`, - `stroke-linejoin`, `stroke-miterlimit`, `stroke-dasharray`, `stroke-dashoffset`, - `stroke-opacity`, `opacity`, `display`, `visibility`, `color`/`currentColor`; -- `linearGradient` and `radialGradient` (with `fx`/`fy` focal point), `gradientUnits`, - `gradientTransform`, `spreadMethod`, `href` inheritance of stops and attributes; -- styling through presentation attributes, the `style` attribute and `"##, r##""##); - let doc = parse(small.as_bytes()).unwrap(); - assert_eq!(depth_and_shapes(&doc.root).1, 1024); -} - -#[test] -fn mutually_referencing_uses_are_cut_at_the_first_repeat() { - // A uses B and B uses A, neither inside the other: once each, not down to the depth limit. - let svg = r##" - - - "##; - let doc = parse(svg.as_bytes()).unwrap(); - let (depth, shapes) = depth_and_shapes(&doc.root); - assert_eq!(shapes, 2, "a's and b's rectangle, once each"); - assert!(depth <= 6, "{depth}"); -} - -#[test] -fn a_symbol_used_a_thousand_times_still_imports() { - let uses: String = (0..1000).map(|i| format!(r##""##)).collect(); - let svg = format!( - r##"{uses}"## - ); - let doc = parse(svg.as_bytes()).unwrap(); - assert_eq!(depth_and_shapes(&doc.root).1, 3000); -} - -/// An SVG with one `{rects}"#).into_bytes() -} - -#[test] -fn comma_selector_lists_share_one_declaration_block() { - // Before #2140 every selector of a comma list got its own copy of the declaration block, so - // `a,a,a…{…}` stored selectors × declarations strings; one selector past the cap is refused. - let sels = vec!["rect"; MAX_CSS_SELECTORS + 1].join(","); - let decls: String = (0..10).map(|i| format!("p{i}:v;")).collect(); - let svg = styled(&format!("{sels}{{fill:red;{decls}}}"), &[""]); - let e = parse(&svg).unwrap_err(); - assert!(e.to_string().contains("selectors"), "{e}"); -} - -#[test] -fn a_style_sheet_with_too_many_declarations_errors() { - let decls: String = (0..=MAX_CSS_DECLARATIONS).map(|i| format!("p{i}:v;")).collect(); - let svg = styled(&format!("rect{{{decls}}}"), &[""]); - let e = parse(&svg).unwrap_err(); - assert!(e.to_string().contains("declarations"), "{e}"); -} - -#[test] -fn selector_lists_keep_the_css_cascade() { - let green = Some(Paint::Color([0.0, 1.0, 0.0])); - let blue = Some(Paint::Color([0.0, 0.0, 1.0])); - let red = Some(Paint::Color([1.0, 0.0, 0.0])); - let css = "rect, .b, #c { fill: #00ff00 } .b, .d { fill: #0000ff; stroke: #000000; stroke-width: 3 } rect.e, #c { fill: #ff0000 }"; - let svg = styled(css, &["", r#"class="b""#, r#"id="c" class="b""#, r#"class="b" style="fill:#00ff00""#, r##"class="e" fill="#0000ff""##, r#"class="d""#]); - let doc = parse(&svg).unwrap(); - let shapes = doc.flatten(); - let fills: Vec<_> = shapes.iter().map(|s| s.2.fill.clone()).collect(); - // Type selector; class beats type; id beats class; inline style beats every rule; a later, - // more specific rule beats the presentation attribute. - assert_eq!(fills, vec![green.clone(), blue.clone(), red.clone(), green, red, blue]); - assert!(shapes[0].2.stroke.is_none()); - // The second list's block reaches both of its selectors. - for i in [1, 5] { - assert_eq!(shapes[i].2.stroke.as_ref().map(|s| s.width), Some(3.0), "shape {i}"); - } -} - -#[test] -fn a_comma_list_stores_its_declarations_once() { - let sels = vec!["rect"; 1000].join(","); - let decls: String = (0..50).map(|i| format!("p{i}:v;")).collect(); - let mut sheet = StyleSheet::default(); - parse_css(&format!("{sels}{{{decls}}}"), &mut sheet).unwrap(); - assert_eq!(sheet.rules.len(), 1000); - assert_eq!(sheet.blocks.len(), 1); - assert_eq!(sheet.decls, 50); -} - -#[test] -fn rules_of_unsupported_selectors_store_no_blocks() { - let mut sheet = StyleSheet::default(); - parse_css(&"a b{}".repeat(100_000), &mut sheet).unwrap(); - parse_css("a b{fill:red} a>b, rect{fill:blue} c:hover, d{fill:red}", &mut sheet).unwrap(); - assert_eq!(sheet.rules.len(), 2); - assert_eq!(sheet.blocks.len(), 2); - assert!(sheet.rules.iter().all(|r| sheet.blocks.get(r.block).is_some_and(|b| b.len() == 1))); -} - -#[test] -fn huge_class_lists_count_against_the_matching_budget() { - // One rule, but a 1 MB class attribute re-split on each of 100 `` copies (#2140). - let class = "a ".repeat(500_000); - let uses: String = (0..100).map(|i| format!(r##""##)).collect(); - let svg = |uses: &str| { - format!( - r##"{uses}"## - ) - }; - let e = parse(svg(&uses).as_bytes()).unwrap_err(); - assert!(e.to_string().contains("{uses}"## - ) - }; - let e = parse(svg(&uses).as_bytes()).unwrap_err(); - assert!(e.to_string().contains("{rects}"#).into_bytes() +} + +#[test] +fn comma_selector_lists_share_one_declaration_block() { + // Before #2140 every selector of a comma list got its own copy of the declaration block, so + // `a,a,a…{…}` stored selectors × declarations strings; one selector past the cap is refused. + let sels = vec!["rect"; MAX_CSS_SELECTORS + 1].join(","); + let decls: String = (0..10).map(|i| format!("p{i}:v;")).collect(); + let svg = styled(&format!("{sels}{{fill:red;{decls}}}"), &[""]); + let e = parse(&svg).unwrap_err(); + assert!(e.to_string().contains("selectors"), "{e}"); +} + +#[test] +fn a_style_sheet_with_too_many_declarations_errors() { + let decls: String = (0..=MAX_CSS_DECLARATIONS).map(|i| format!("p{i}:v;")).collect(); + let svg = styled(&format!("rect{{{decls}}}"), &[""]); + let e = parse(&svg).unwrap_err(); + assert!(e.to_string().contains("declarations"), "{e}"); +} + +#[test] +fn selector_lists_keep_the_css_cascade() { + let green = Some(Paint::Color([0.0, 1.0, 0.0])); + let blue = Some(Paint::Color([0.0, 0.0, 1.0])); + let red = Some(Paint::Color([1.0, 0.0, 0.0])); + let css = "rect, .b, #c { fill: #00ff00 } .b, .d { fill: #0000ff; stroke: #000000; stroke-width: 3 } rect.e, #c { fill: #ff0000 }"; + let svg = styled(css, &["", r#"class="b""#, r#"id="c" class="b""#, r#"class="b" style="fill:#00ff00""#, r##"class="e" fill="#0000ff""##, r#"class="d""#]); + let doc = parse(&svg).unwrap(); + let shapes = doc.flatten(); + let fills: Vec<_> = shapes.iter().map(|s| s.2.fill.clone()).collect(); + // Type selector; class beats type; id beats class; inline style beats every rule; a later, + // more specific rule beats the presentation attribute. + assert_eq!(fills, vec![green.clone(), blue.clone(), red.clone(), green, red, blue]); + assert!(shapes[0].2.stroke.is_none()); + // The second list's block reaches both of its selectors. + for i in [1, 5] { + assert_eq!(shapes[i].2.stroke.as_ref().map(|s| s.width), Some(3.0), "shape {i}"); + } +} + +#[test] +fn a_comma_list_stores_its_declarations_once() { + let sels = vec!["rect"; 1000].join(","); + let decls: String = (0..50).map(|i| format!("p{i}:v;")).collect(); + let mut sheet = StyleSheet::default(); + parse_css(&format!("{sels}{{{decls}}}"), &mut sheet).unwrap(); + assert_eq!(sheet.rules.len(), 1000); + assert_eq!(sheet.blocks.len(), 1); + assert_eq!(sheet.decls, 50); +} + +#[test] +fn rules_of_unsupported_selectors_store_no_blocks() { + let mut sheet = StyleSheet::default(); + parse_css(&"a b{}".repeat(100_000), &mut sheet).unwrap(); + parse_css("a b{fill:red} a>b, rect{fill:blue} c:hover, d{fill:red}", &mut sheet).unwrap(); + assert_eq!(sheet.rules.len(), 2); + assert_eq!(sheet.blocks.len(), 2); + assert!(sheet.rules.iter().all(|r| sheet.blocks.get(r.block).is_some_and(|b| b.len() == 1))); +} + +#[test] +fn huge_class_lists_count_against_the_matching_budget() { + // One rule, but a 1 MB class attribute re-split on each of 100 `` copies (#2140). + let class = "a ".repeat(500_000); + let uses: String = (0..100).map(|i| format!(r##""##)).collect(); + let svg = |uses: &str| { + format!( + r##"{uses}"## + ) + }; + let e = parse(svg(&uses).as_bytes()).unwrap_err(); + assert!(e.to_string().contains("{uses}"## + ) + }; + let e = parse(svg(&uses).as_bytes()).unwrap_err(); + assert!(e.to_string().contains("