mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 15:53:26 -10:00
Compare commits
41
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3224e7325 | ||
|
|
0531769c41 | ||
|
|
5aca75dcbd | ||
|
|
7ca6470656 | ||
|
|
5a1503fc98 | ||
|
|
ba177c4c5d | ||
|
|
bd1c54907d | ||
|
|
da278e0264 | ||
|
|
258748ec51 | ||
|
|
3f999bf231 | ||
|
|
6824f55929 | ||
|
|
e1357c5c34 | ||
|
|
9bf3605b85 | ||
|
|
b433ddd007 | ||
|
|
5d5993bcca | ||
|
|
e5827f2b81 | ||
|
|
f801ed72bb | ||
|
|
3571c0d577 | ||
|
|
2fe0cf7a4c | ||
|
|
3b1a51b393 | ||
|
|
723f7b14ea | ||
|
|
ed20f4ac9b | ||
|
|
20e12edd45 | ||
|
|
5b92901715 | ||
|
|
f186465220 | ||
|
|
b697cc8131 | ||
|
|
82f7dc7062 | ||
|
|
87739ff877 | ||
|
|
2f8ee1b1bf | ||
|
|
97c86125f6 | ||
|
|
df0c9dcba2 | ||
|
|
c574f58ecd | ||
|
|
84f91eb795 | ||
|
|
8738e59c21 | ||
|
|
6c10364c8c | ||
|
|
8b67840f0c | ||
|
|
f2dfd42754 | ||
|
|
1b1400b989 | ||
|
|
011bd724bc | ||
|
|
b5b896f89f | ||
|
|
119a554260 |
No files matched your search
@@ -65,11 +65,11 @@ jobs:
|
||||
|
||||
flatpak-builder --user --force-clean --install-deps-from=flathub --repo=repo build ./manifest.json
|
||||
|
||||
flatpak build-bundle repo graphite.flatpak art.graphite.Graphite --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak build-bundle repo Graphite.flatpak art.graphite.Graphite --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Upload Flatpak
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: graphite-flatpak
|
||||
path: .flatpak/graphite.flatpak
|
||||
path: .flatpak/Graphite.flatpak
|
||||
compression-level: 0
|
||||
@@ -0,0 +1,129 @@
|
||||
name: "CI"
|
||||
|
||||
on:
|
||||
pull_request: {}
|
||||
merge_group: {}
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
# Rust format check on GitHub runner
|
||||
rust-fmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 📥 Clone and checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 🚦 Check if CI can be skipped
|
||||
id: skip-check
|
||||
uses: cariad-tech/merge-queue-ci-skipper@main
|
||||
|
||||
- name: 🦀 Install the latest Rust
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
|
||||
- name: 🔬 Check Rust formatting
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
# License compatibility check on GitHub runner
|
||||
cargo-deny:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 📥 Clone and checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 📜 Check crate license compatibility for root workspace
|
||||
uses: EmbarkStudios/cargo-deny-action@v2
|
||||
with:
|
||||
command: check bans licenses sources
|
||||
|
||||
- name: 📜 Check crate license compatibility for /libraries/rawkit
|
||||
uses: EmbarkStudios/cargo-deny-action@v2
|
||||
with:
|
||||
command: check bans licenses sources
|
||||
manifest-path: libraries/rawkit/Cargo.toml
|
||||
|
||||
# Full build and tests on self-hosted runner
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
permissions:
|
||||
contents: write
|
||||
deployments: write
|
||||
pull-requests: write
|
||||
actions: write
|
||||
env:
|
||||
RUSTC_WRAPPER: /usr/bin/sccache
|
||||
CARGO_INCREMENTAL: 0
|
||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||
|
||||
steps:
|
||||
- name: 📥 Clone and checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 🚦 Check if CI can be skipped
|
||||
id: skip-check
|
||||
uses: cariad-tech/merge-queue-ci-skipper@main
|
||||
|
||||
- name: 🗑 Clear wasm-bindgen cache
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
run: rm -r ~/.cache/.wasm-pack || true
|
||||
|
||||
- name: 🟢 Install the latest Node.js
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'latest'
|
||||
|
||||
- name: 🚧 Install build dependencies
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
run: |
|
||||
cd frontend
|
||||
npm run setup
|
||||
|
||||
- name: 🦀 Install the latest Rust
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
run: |
|
||||
rustup update stable
|
||||
|
||||
- name: 🦀 Fetch Rust dependencies
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
run: |
|
||||
cargo fetch --locked
|
||||
|
||||
- name: 🌐 Build Graphite web code
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
env:
|
||||
NODE_ENV: production
|
||||
run: |
|
||||
cd frontend
|
||||
mold -run npm run build
|
||||
|
||||
- name: 📤 Publish to Cloudflare Pages
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
uses: cloudflare/pages-action@1
|
||||
continue-on-error: true
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
projectName: graphite-dev
|
||||
directory: frontend/dist
|
||||
|
||||
- name: 👕 Lint Graphite web formatting
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
env:
|
||||
NODE_ENV: production
|
||||
run: |
|
||||
cd frontend
|
||||
npm run lint
|
||||
|
||||
- name: 🧪 Run Rust tests
|
||||
if: steps.skip-check.outputs.skip-check != 'true'
|
||||
env:
|
||||
RUSTFLAGS: -Dwarnings
|
||||
run: |
|
||||
mold -run cargo test --all-features
|
||||
@@ -92,13 +92,38 @@ jobs:
|
||||
echo "Failed to detect if the build command written in the comment should have been '!build-dev', '!build-profiling', or '!build'" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: 💬 Comment Actions run link
|
||||
id: comment_actions_run_link
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.updateComment({
|
||||
comment_id: ${{ github.event.comment.id }},
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '!build ([Run ID ' + context.runId + '](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + '))'
|
||||
});
|
||||
|
||||
- name: 🌐 Build Graphite web code
|
||||
env:
|
||||
NODE_ENV: production
|
||||
if: ${{ success() || failure()}}
|
||||
run: |
|
||||
cd frontend
|
||||
mold -run npm run ${{ steps.build_command.outputs.command }}
|
||||
|
||||
- name: ❗ Warn on build failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'The build process has failed. Please check the [build logs](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + ') for details.'
|
||||
});
|
||||
|
||||
- name: 📤 Publish to Cloudflare Pages
|
||||
id: cloudflare
|
||||
uses: cloudflare/pages-action@1
|
||||
@@ -110,6 +135,18 @@ jobs:
|
||||
projectName: graphite-dev
|
||||
directory: frontend/dist
|
||||
|
||||
- name: ❗ Warn on publish failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'The deployment to Cloudflare Pages has failed. Please check the [build logs](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + ') for details.
|
||||
});
|
||||
|
||||
- name: 💬 Comment build link
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
name: "Editor: Dev & CI"
|
||||
name: "Deploy Master"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request: {}
|
||||
merge_group: {}
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.art" data-api="https://graphite.art/visit/event" src="https://graphite.art/visit/script.hash.js"></script>
|
||||
|
||||
jobs:
|
||||
build:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
permissions:
|
||||
contents: write
|
||||
deployments: write
|
||||
pull-requests: write
|
||||
actions: write
|
||||
env:
|
||||
RUSTC_WRAPPER: /usr/bin/sccache
|
||||
@@ -33,7 +31,7 @@ jobs:
|
||||
- name: 🟢 Install the latest Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "latest"
|
||||
node-version: 'latest'
|
||||
|
||||
- name: 🚧 Install build dependencies
|
||||
run: |
|
||||
@@ -42,21 +40,10 @@ jobs:
|
||||
|
||||
- name: 🦀 Install the latest Rust
|
||||
run: |
|
||||
echo "Initial system version:"
|
||||
rustc --version
|
||||
rustup update stable
|
||||
echo "Latest updated version:"
|
||||
rustc --version
|
||||
|
||||
- name: 🦀 Fetch Rust dependencies
|
||||
run: |
|
||||
echo "If it fails here, the committed Cargo.lock may be out of date"
|
||||
cargo fetch --locked
|
||||
|
||||
- name: ✂ Replace template in <head> of index.html
|
||||
run: |
|
||||
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
|
||||
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
|
||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
||||
|
||||
- name: 🌐 Build Graphite web code
|
||||
@@ -78,7 +65,6 @@ jobs:
|
||||
directory: frontend/dist
|
||||
|
||||
- name: 💬 Comment build link URL to commit hash page on GitHub
|
||||
if: github.ref == 'refs/heads/master'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
@@ -90,29 +76,7 @@ jobs:
|
||||
|-|
|
||||
| ${{ steps.cloudflare.outputs.url }} |"
|
||||
|
||||
- name: 👕 Lint Graphite web formatting
|
||||
env:
|
||||
NODE_ENV: production
|
||||
run: |
|
||||
cd frontend
|
||||
npm run lint
|
||||
|
||||
- name: 🔬 Check Rust formatting
|
||||
run: |
|
||||
mold -run cargo fmt --all -- --check
|
||||
|
||||
- name: 🦀 Build Rust code
|
||||
env:
|
||||
RUSTFLAGS: -Dwarnings
|
||||
run: |
|
||||
mold -run cargo build --all-features
|
||||
|
||||
- name: 🧪 Run Rust tests
|
||||
run: |
|
||||
mold -run cargo test --all-features
|
||||
|
||||
- name: 📃 Generate code documentation info for website
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
cd tools/editor-message-tree
|
||||
cargo run
|
||||
@@ -121,7 +85,6 @@ jobs:
|
||||
mv website/generated/hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
|
||||
|
||||
- name: 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
|
||||
if: github.ref == 'refs/heads/master'
|
||||
id: cache-website-code-docs
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
@@ -129,7 +92,6 @@ jobs:
|
||||
key: website-code-docs
|
||||
|
||||
- name: 🔍 Check if auto-generated code docs artifacts changed
|
||||
if: github.ref == 'refs/heads/master'
|
||||
id: website-code-docs-changed
|
||||
run: |
|
||||
if ! diff --brief --recursive artifacts-generated artifacts; then
|
||||
@@ -157,31 +119,3 @@ jobs:
|
||||
run: |
|
||||
rm -rf artifacts
|
||||
gh workflow run website.yml --ref master
|
||||
|
||||
# miri:
|
||||
# runs-on: self-hosted
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v3
|
||||
|
||||
# - name: 🧪 Run Rust miri
|
||||
# run: |
|
||||
# mold -run cargo +nightly miri nextest run -j32 --all-features
|
||||
|
||||
cargo-deny:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 📥 Clone and checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 📜 Check crate license compatibility for root workspace
|
||||
uses: EmbarkStudios/cargo-deny-action@v2
|
||||
with:
|
||||
command: check bans licenses sources
|
||||
|
||||
- name: 📜 Check crate license compatibility for /libraries/rawkit
|
||||
uses: EmbarkStudios/cargo-deny-action@v2
|
||||
with:
|
||||
command: check bans licenses sources
|
||||
manifest-path: libraries/rawkit/Cargo.toml
|
||||
Generated
+31
@@ -2216,6 +2216,7 @@ dependencies = [
|
||||
"text-nodes",
|
||||
"tokio",
|
||||
"url",
|
||||
"vector-nodes",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
"wgpu-executor",
|
||||
@@ -2294,6 +2295,7 @@ dependencies = [
|
||||
"path-bool-nodes",
|
||||
"raster-nodes",
|
||||
"rendering",
|
||||
"repeat-nodes",
|
||||
"reqwest",
|
||||
"text-nodes",
|
||||
"tokio",
|
||||
@@ -2305,6 +2307,7 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"wgpu",
|
||||
"wgpu-executor",
|
||||
]
|
||||
|
||||
@@ -4659,6 +4662,12 @@ dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qrcodegen"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4339fc7a1021c9c1621d87f5e3505f2805c8c105420ba2f2a4df86814590c142"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "2.0.1"
|
||||
@@ -5071,6 +5080,25 @@ dependencies = [
|
||||
"vello",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "repeat-nodes"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"core-types",
|
||||
"dyn-any",
|
||||
"glam",
|
||||
"graphene-core",
|
||||
"graphic-types",
|
||||
"kurbo 0.12.0",
|
||||
"log",
|
||||
"node-macro",
|
||||
"raster-types",
|
||||
"serde",
|
||||
"tokio",
|
||||
"vector-nodes",
|
||||
"vector-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.23"
|
||||
@@ -6424,6 +6452,7 @@ dependencies = [
|
||||
"glam",
|
||||
"graphic-types",
|
||||
"node-macro",
|
||||
"rand 0.9.2",
|
||||
"serde",
|
||||
"vector-types",
|
||||
]
|
||||
@@ -6725,7 +6754,9 @@ dependencies = [
|
||||
"kurbo 0.12.0",
|
||||
"log",
|
||||
"node-macro",
|
||||
"qrcodegen",
|
||||
"rand 0.9.2",
|
||||
"repeat-nodes",
|
||||
"rustc-hash 2.1.1",
|
||||
"serde",
|
||||
"tokio",
|
||||
|
||||
@@ -31,6 +31,7 @@ members = [
|
||||
"node-graph/nodes/raster/shaders/entrypoint",
|
||||
"node-graph/nodes/text",
|
||||
"node-graph/nodes/transform",
|
||||
"node-graph/nodes/repeat",
|
||||
"node-graph/nodes/vector",
|
||||
"node-graph/graph-craft",
|
||||
"node-graph/graphene-cli",
|
||||
@@ -116,6 +117,7 @@ graphic-nodes = { path = "node-graph/nodes/graphic" }
|
||||
text-nodes = { path = "node-graph/nodes/text" }
|
||||
transform-nodes = { path = "node-graph/nodes/transform" }
|
||||
vector-nodes = { path = "node-graph/nodes/vector" }
|
||||
repeat-nodes = { path = "node-graph/nodes/repeat" }
|
||||
math-nodes = { path = "node-graph/nodes/math" }
|
||||
path-bool-nodes = { path = "node-graph/nodes/path-bool" }
|
||||
graph-craft = { path = "node-graph/graph-craft" }
|
||||
@@ -244,6 +246,7 @@ spin = "0.10"
|
||||
clap = "4.5"
|
||||
spirv-std = { git = "https://github.com/Firestar99/rust-gpu-new", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] }
|
||||
cargo-gpu = { git = "https://github.com/Firestar99/cargo-gpu", rev = "3952a22d16edbd38689f3a876e417899f21e1fe7", default-features = false }
|
||||
qrcodegen = "1.8"
|
||||
|
||||
[workspace.lints.rust]
|
||||
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
||||
|
||||
Generated
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[10316247453530667000,{"inputs":[{"Node":{"node_id":9079109751490757000,"output_index":0}},{"Node":{"node_id":1250460246919467000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":false,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7954638344846060000,{"inputs":[{"Node":{"node_id":5991296268862790000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.1875,"green":0.0,"blue":0.0,"alpha":0.203125}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.19140625,"green":0.0,"blue":0.0,"alpha":0.203125}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17021405646895729000,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":1.0,"green":0.31764707,"blue":0.15686275,"alpha":1.0}],[0.5,{"red":1.0,"green":0.5686275,"blue":0.25490198,"alpha":1.0}],[1.0,{"red":1.0,"green":0.7294118,"blue":0.16078432,"alpha":1.0}]]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"math_nodes::GradientValueNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[8366826746721323000,{"inputs":[{"Node":{"node_id":5591755359500854000,"output_index":0}},{"Node":{"node_id":13846904447064916285,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":trLine truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[10316247453530667000,{"inputs":[{"Node":{"node_id":9079109751490757000,"output_index":0}},{"Node":{"node_id":1250460246919467000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":false,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7954638344846060000,{"inputs":[{"Node":{"node_id":5991296268862790000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.1875,"green":0.0,"blue":0.0,"alpha":0.203125}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.19140625,"green":0.0,"blue":0.0,"alpha":0.203125}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17021405646895729000,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":1.0,"green":0.31764707,"blue":0.15686275,"alpha":1.0}],[0.5,{"red":1.0,"green":0.5686275,"blue":0.25490198,"alpha":1.0}],[1.0,{"red":1.0,"green":0.7294118,"blue":0.16078432,"alpha":1.0}]]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"math_nodes::GradientValueNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[8366826746721323000,{"inputs":[{"Node":{"node_id":5591755359500854000,"output_index":0}},{"Node":{"node_id":13846904447064916285,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":trLine truncated
|
||||
Generated
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[10507084483235320484,{"inputs":[{"Node":{"node_id":9157963288496356916,"output_index":0}},{"Node":{"node_id":1396768435017101055,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4741515246389989284,{"inputs":[{"Node":{"node_id":14255588039347536657,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.2435565297001,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4105329493214975815,{"inputs":[{"Node":{"node_id":12931264630175648107,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.24355652969916,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::conteLine truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[10507084483235320484,{"inputs":[{"Node":{"node_id":9157963288496356916,"output_index":0}},{"Node":{"node_id":1396768435017101055,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4741515246389989284,{"inputs":[{"Node":{"node_id":14255588039347536657,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.2435565297001,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4105329493214975815,{"inputs":[{"Node":{"node_id":12931264630175648107,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.24355652969916,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::conteLine truncated
|
||||
Generated
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[4388711862172196665,{"inputs":[],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[0.3237704918032787,{"red":0.23828125,"green":0.0,"blue":0.08377075,"alpha":1.0}],[0.5655737704918032,{"red":0.92578125,"green":0.8676921,"blue":0.5569153,"alpha":1.0}],[0.8155737704918032,{"red":0.17333984,"green":0.625,"blue":0.625,"alpha":1.0}],[1.0,{"red":0.106292725,"green":0.3359375,"blue":0.3359375,"alpha":1.0}]]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::gradient_map::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7624113397561636853,{"inputs":[{"Value":{"tagged_value":{"Graphic":{"element":[],"transform":[],"alpha_blending":[],"source_node_id":[]}},"exposed":true}},{"Node":{"node_id":3606681156406984991,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProLine truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[4388711862172196665,{"inputs":[],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[0.3237704918032787,{"red":0.23828125,"green":0.0,"blue":0.08377075,"alpha":1.0}],[0.5655737704918032,{"red":0.92578125,"green":0.8676921,"blue":0.5569153,"alpha":1.0}],[0.8155737704918032,{"red":0.17333984,"green":0.625,"blue":0.625,"alpha":1.0}],[1.0,{"red":0.106292725,"green":0.3359375,"blue":0.3359375,"alpha":1.0}]]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"raster_nodes::gradient_map::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7624113397561636853,{"inputs":[{"Value":{"tagged_value":{"Graphic":{"element":[],"transform":[],"alpha_blending":[],"source_node_id":[]}},"exposed":true}},{"Node":{"node_id":3606681156406984991,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_featLine truncated
|
||||
Generated
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[13353438235848911576,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[6379137305818664393,18442321214082298093,18118267825025549699,6351696498298648253,17863574903157697896,4691860614575868200,301778328144628917,10625296323957562985,533731991408535384,13357220652574593654,15992617814592812350],"remove":[],"delta":[[10625296323957562985,[473.4814814814815,272.5925925925926]],[18118267825025549699,[642.0740740740741,0.0]],[301778328144628917,[493.5149940383244,200.29629629629628]],[533731991408535384,[501.6296296296296,175.40740740740742]],[18442321214082298093,[565.6296296296297,122.96296296296298]],[4691860614575868200,[528.2962962962963,283.8518518518518]],[6379137305818664393,[625.4814814814813,0.0]],[15992617814592812350,[621.0370370370368,0.0]],[6351696498298648253,[646.8148148148149,0.0]],[17863574903157697896,[606.8148151308641,95.19407372365433]],[13357220652574593654,[574.2222222222222,108.44444444444449]]]},"segments":{"add":[13662059715350867364,3384102572540409881,12035095010819582754,10146665273368938971,318560030360358929,8462655819889292900,3303411878775644985,8661113083384527971,2035327810332855521,11346538709718766144,3710133387837274291],"remove":[],"start_point":[[3303411878775644985,301778328144628917],[11346538709718766144,13357220652574593654],[2035327810332855521,533731991408535384],[10146665273368938971,6351696498298648253],[8661113083384527971,10625296323957562985],[8462655819889292900,4691860614575868200],[12035095010819582754,18118267825025549699],[13662059715350867364,6379137305818664393],[318560030360358929,17863574903157697896],[3710133387837274291,15992617814592812350],[3384102572540409881,18442321214082298093]],"end_point":[[11346538709718766144,15992617814592812350],[8462655819889292900,301778328144628917],[3710133387837274291,6379137305818664393],[10146665273368938971,17863574903157697896],[2035327810332855521,13357220652574593654],[8661113083384527971,533731991408535384],[3303411878775644985,10625296323957562985],[3384102572540409881,18118267825025549699],[12035095010819582754,6351696498298648253],[318560030360358929,4691860614575868200],[13662059715350867364,18442321214082298093]],"handle_primary":[[11346538709718766144,[9.925839724176626,-9.951533978271286]],[8462655819889292900,[0.0,0.0]],[8661113083384527971,[0.2962962962963047,0.2962962962963047]],[2035327810332855521,[42.96296296296293,-41.7777777777778]],[3384102572540409881,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[3710133387837274291,[0.0,0.0]],[3303411878775644985,[0.0,0.0]],[10146665273368938971,[0.0,0.0]],[13662059715350867364,[0.0,0.0]],[318560030360358929,[-46.95465552079859,46.40007297527743]]],"handle_end":[[10146665273368938971,[48.16592595101224,-47.597037061827145]],[3384102572540409881,[0.5807410754567854,77.36888852918523]],[3710133387837274291,[0.0,0.0]],[11346538709718766144,[1.1377781018271662,63.71555518874077]],[12035095010819582754,[0.0,0.0]],[8661113083384527971,[-42.34888386913234,41.180638796880466]],[318560030360358929,[-97.48148148148152,-81.18518518518522]],[8462655819889292900,[-21.74426522093495,47.99999999999997]],[3303411878775644985,[-6.2222222222222285,-40.59259259259261]],[2035327810332855521,[-8.299214014278164,8.32069754812484]],[13662059715350867364,[68.68148181185177,-54.8859262904691]]],"stroke":[[10146665273368938971,0],[3710133387837274291,0],[13662059715350867364,0],[11346538709718766144,0],[318560030360358929,0],[2035327810332855521,0],[3384102572540409881,0],[3303411878775644985,0],[8661113083384527971,0],[8462655819889292900,0],[12035095010819582754,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[[{"ty":"End","segment":10146665273368938971},{"ty":"Primary","segment":318560030360358929}],[{"ty":"Primary","segment":11346538709718766144},{"ty":"End","segment":2035327810332855521}],[{"ty":"End","segment":8661113083384527971},{"ty":"Primary","segment":2035327810332855521}],[{"ty":"End","segment":12035095010819582754},{"ty":"Primary","segment":10146665273368938971}]],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exportsLine truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[13353438235848911576,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[6379137305818664393,18442321214082298093,18118267825025549699,6351696498298648253,17863574903157697896,4691860614575868200,301778328144628917,10625296323957562985,533731991408535384,13357220652574593654,15992617814592812350],"remove":[],"delta":[[13357220652574593654,[574.2222222222222,108.44444444444449]],[6379137305818664393,[625.4814814814813,0.0]],[18118267825025549699,[642.0740740740741,0.0]],[17863574903157697896,[606.8148151308641,95.19407372365433]],[10625296323957562985,[473.4814814814815,272.5925925925926]],[533731991408535384,[501.6296296296296,175.40740740740742]],[4691860614575868200,[528.2962962962963,283.8518518518518]],[6351696498298648253,[646.8148148148149,0.0]],[15992617814592812350,[621.0370370370368,0.0]],[18442321214082298093,[565.6296296296297,122.96296296296298]],[301778328144628917,[493.5149940383244,200.29629629629628]]]},"segments":{"add":[13662059715350867364,3384102572540409881,12035095010819582754,10146665273368938971,318560030360358929,8462655819889292900,3303411878775644985,8661113083384527971,2035327810332855521,11346538709718766144,3710133387837274291],"remove":[],"start_point":[[10146665273368938971,6351696498298648253],[2035327810332855521,533731991408535384],[13662059715350867364,6379137305818664393],[11346538709718766144,13357220652574593654],[318560030360358929,17863574903157697896],[8661113083384527971,10625296323957562985],[8462655819889292900,4691860614575868200],[3384102572540409881,18442321214082298093],[3303411878775644985,301778328144628917],[3710133387837274291,15992617814592812350],[12035095010819582754,18118267825025549699]],"end_point":[[3303411878775644985,10625296323957562985],[11346538709718766144,15992617814592812350],[12035095010819582754,6351696498298648253],[3384102572540409881,18118267825025549699],[8661113083384527971,533731991408535384],[3710133387837274291,6379137305818664393],[10146665273368938971,17863574903157697896],[2035327810332855521,13357220652574593654],[318560030360358929,4691860614575868200],[13662059715350867364,18442321214082298093],[8462655819889292900,301778328144628917]],"handle_primary":[[318560030360358929,[-46.95465552079859,46.40007297527743]],[8661113083384527971,[0.2962962962963047,0.2962962962963047]],[10146665273368938971,[0.0,0.0]],[11346538709718766144,[9.925839724176626,-9.951533978271286]],[3710133387837274291,[0.0,0.0]],[13662059715350867364,[0.0,0.0]],[3384102572540409881,[0.0,0.0]],[2035327810332855521,[42.96296296296293,-41.7777777777778]],[3303411878775644985,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[8462655819889292900,[0.0,0.0]]],"handle_end":[[318560030360358929,[-97.48148148148152,-81.18518518518522]],[13662059715350867364,[68.68148181185177,-54.8859262904691]],[10146665273368938971,[48.16592595101224,-47.597037061827145]],[3384102572540409881,[0.5807410754567854,77.36888852918523]],[12035095010819582754,[0.0,0.0]],[8661113083384527971,[-42.34888386913234,41.180638796880466]],[3710133387837274291,[0.0,0.0]],[3303411878775644985,[-6.2222222222222285,-40.59259259259261]],[8462655819889292900,[-21.74426522093495,47.99999999999997]],[2035327810332855521,[-8.299214014278164,8.32069754812484]],[11346538709718766144,[1.1377781018271662,63.71555518874077]]],"stroke":[[8661113083384527971,0],[3710133387837274291,0],[13662059715350867364,0],[2035327810332855521,0],[8462655819889292900,0],[3303411878775644985,0],[12035095010819582754,0],[11346538709718766144,0],[10146665273368938971,0],[3384102572540409881,0],[318560030360358929,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[[{"ty":"Primary","segment":11346538709718766144},{"ty":"End","segment":2035327810332855521}],[{"ty":"End","segment":10146665273368938971},{"ty":"Primary","segment":318560030360358929}],[{"ty":"End","segment":8661113083384527971},{"ty":"Primary","segment":2035327810332855521}],[{"ty":"End","segment":12035095010819582754},{"ty":"Primary","segment":10146665273368938971}]],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exportsLine truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[17154757625902243313,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.23529412,"green":0.23529412,"blue":0.24313726,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":1670.79570439},"exposed":false}},{"Value":{"tagged_value":{"F64":24.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"core_types::vector::SplineNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[14158287945315818946,{"inputs":[{"Node":{"node_id":16943732999059587742,"output_index":0}},{"Node":{"node_id":14577956936089455769,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.6181095265062186,3.496297826945966]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[11731553664207576737,{"inputs":[{"Node":{"node_id":757876048866560520,"output_index":0}},{"Value":{"tagged_value":{"F64":48.900000000000006},"exposed":false}},{"Node":{"node_id":7828034197076821310,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"core_types::vector::JitterPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7828034197076821310,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":3}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"math_nodes::ToU32Node"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"vector_nodes::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.99607843,"green":0.827451,"blue":0.65882355,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_valueLine truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[17154757625902243313,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.23529412,"green":0.23529412,"blue":0.24313726,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":1670.79570439},"exposed":false}},{"Value":{"tagged_value":{"F64":24.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"core_types::vector::SplineNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[14158287945315818946,{"inputs":[{"Node":{"node_id":16943732999059587742,"output_index":0}},{"Node":{"node_id":14577956936089455769,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.6181095265062186,3.496297826945966]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[11731553664207576737,{"inputs":[{"Node":{"node_id":757876048866560520,"output_index":0}},{"Value":{"tagged_value":{"F64":48.900000000000006},"exposed":false}},{"Node":{"node_id":7828034197076821310,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"core_types::vector::JitterPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7828034197076821310,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":3}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"math_nodes::ToU32Node"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"vector_nodes::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.99607843,"green":0.827451,"blue":0.65882355,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_valueLine truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[665049002420596400,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"delta":[[32,[9.333333333333314,38.66666666666663]],[1,[-103.55555555555554,126.66666666666664]],[24,[57.77777777777777,-129.33333333333334]],[4,[18.66666666666663,157.77777777777771]],[14,[183.11111111111103,-19.111111111111143]],[26,[22.66666666666663,-81.33333333333337]],[22,[71.11111111111109,-201.7777777777778]],[3,[45.77777777777777,145.33333333333331]],[27,[-11.111111111111144,-72.00000000000003]],[28,[39.111111111111086,-58.22222222222226]],[33,[-78.22222222222223,75.55555555555554]],[15,[111.11111111111114,-60.888888888888914]],[2,[-67.55555555555554,158.22222222222217]],[17,[123.99999999999994,-84.00000000000003]],[19,[90.66666666666664,-129.33333333333334]],[20,[128.4444444444444,-142.22222222222223]],[12,[199.5555555555555,10.666666666666629]],[7,[229.33333333333331,152.4444444444444]],[29,[-32.888888888888914,-14.666666666666686]],[34,[-5.333333333333371,99.11111111111109]],[5,[66.22222222222223,152.88888888888886]],[10,[216.4444444444444,72.4444444444444]],[31,[-53.33333333333337,13.777777777777771]],[11,[136.88888888888886,39.111111111111086]],[16,[159.5555555555555,-75.55555555555557]],[13,[153.77777777777777,-1.3333333333333712]],[18,[145.77777777777777,-97.7777777777778]],[23,[19.555555555555543,-139.55555555555557]],[30,[-9.333333333333371,0.0]],[25,[0.8888888888888573,-94.66666666666669]],[6,[123.99999999999994,148.4444444444444]],[21,[76.0,-202.22222222222223]],[9,[156.4444444444444,97.33333333333331]],[8,[252.4444444444444,124.88888888888886]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"start_point":[[19,19],[2,2],[33,33],[20,20],[31,31],[23,23Line truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[665049002420596400,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"delta":[[24,[57.77777777777777,-129.33333333333334]],[27,[-11.111111111111144,-72.00000000000003]],[10,[216.4444444444444,72.4444444444444]],[1,[-103.55555555555554,126.66666666666664]],[33,[-78.22222222222223,75.55555555555554]],[5,[66.22222222222223,152.88888888888886]],[20,[128.4444444444444,-142.22222222222223]],[8,[252.4444444444444,124.88888888888886]],[18,[145.77777777777777,-97.7777777777778]],[4,[18.66666666666663,157.77777777777771]],[28,[39.111111111111086,-58.22222222222226]],[6,[123.99999999999994,148.4444444444444]],[19,[90.66666666666664,-129.33333333333334]],[22,[71.11111111111109,-201.7777777777778]],[21,[76.0,-202.22222222222223]],[23,[19.555555555555543,-139.55555555555557]],[14,[183.11111111111103,-19.111111111111143]],[15,[111.11111111111114,-60.888888888888914]],[7,[229.33333333333331,152.4444444444444]],[12,[199.5555555555555,10.666666666666629]],[17,[123.99999999999994,-84.00000000000003]],[32,[9.333333333333314,38.66666666666663]],[3,[45.77777777777777,145.33333333333331]],[11,[136.88888888888886,39.111111111111086]],[9,[156.4444444444444,97.33333333333331]],[29,[-32.888888888888914,-14.666666666666686]],[30,[-9.333333333333371,0.0]],[2,[-67.55555555555554,158.22222222222217]],[16,[159.5555555555555,-75.55555555555557]],[25,[0.8888888888888573,-94.66666666666669]],[26,[22.66666666666663,-81.33333333333337]],[31,[-53.33333333333337,13.777777777777771]],[34,[-5.333333333333371,99.11111111111109]],[13,[153.77777777777777,-1.3333333333333712]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"start_point":[[12,12],[11,11],[26,26],[2,2],[30,30],[31,31Line truncated
|
||||
Generated
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[10127467043900015225,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2],"remove":[],"delta":[[1,[258.00000000000006,994.6666666666664]],[2,[644.0,726.6666666666666]]]},"segments":{"add":[1],"remove":[],"start_point":[[1,1]],"end_point":[[1,2]],"handle_primary":[[1,[0.0,0.0]]],"handle_end":[[1,[-328.66666666666674,129.33333333333337]]],"stroke":[[1,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graphene_core::table::Table<graphene_core::vector::vector_types::Vector>","alias":null}},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"graphene_core::vector::vector_modification::VectorModification","alias":null}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[15961046538654083626,{"inputs":[{"Node":{"node_id":1889157037801767612,"output_index":0}},{"Node":{"node_id":4332145463108161926,"output_index":0}},{"Value":{"tagged_value":{"F64":0.5},"exposed":false}},{"Value":{"tagged_value":{"F64":10.0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"core_types::vector::CopyToPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17378885078543074499,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8],"remove":[],"delta":[[4,[709.5555555555554,1026.6666666666667]],[7,[727.5555555555554,1026.6666666666663]],[2,[745.5,826.0]],[5,[740.4444444444443,857.1111111111111]],[8,[746.0000000000001,842.9999999999999]],[1,[823.2222222222221,660.4444444444445]],[3,[707.5,1026.5]],[6,[725.7777777777779,1026.370370370371]]]},"segments":{"add":[1,2,3,4,5,6,7,8],"remove":[],"start_point":[[5,5],[7,7],[6,6],[8,8],[1,1],[2,2],[3,3],[4,4]],"end_point":[[6,7],[8,1],[5,6],[4,5],[3,4],[7,8],[1,2],[2,3]],"handle_primary":[[8,[17.33333333333337,-84.99999999999989]],[2,[-24.5,85.0]],[3,[0.0,0.0]],[4,[0.0,0.0]],[6,[0.0,0.0]],[5,[0.0,0.0]],[1,[0.0,0.0]],[7,[0.0,0.0]]],"handle_end":[[6,[0.0,0.0]],[3,[0.0,0.0]],[8,[1.772016460905547,0.9591220850479658]],[2,[0.0,0.0]],[7,[-26.Line truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[10127467043900015225,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2],"remove":[],"delta":[[1,[258.00000000000006,994.6666666666664]],[2,[644.0,726.6666666666666]]]},"segments":{"add":[1],"remove":[],"start_point":[[1,1]],"end_point":[[1,2]],"handle_primary":[[1,[0.0,0.0]]],"handle_end":[[1,[-328.66666666666674,129.33333333333337]]],"stroke":[[1,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graphene_core::table::Table<graphene_core::vector::vector_types::Vector>","alias":null}},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"graphene_core::vector::vector_modification::VectorModification","alias":null}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[15961046538654083626,{"inputs":[{"Node":{"node_id":1889157037801767612,"output_index":0}},{"Node":{"node_id":4332145463108161926,"output_index":0}},{"Value":{"tagged_value":{"F64":0.5},"exposed":false}},{"Value":{"tagged_value":{"F64":10.0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"core_types::vector::CopyToPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17378885078543074499,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_data":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8],"remove":[],"delta":[[3,[707.5,1026.5]],[1,[823.2222222222221,660.4444444444445]],[5,[740.4444444444443,857.1111111111111]],[7,[727.5555555555554,1026.6666666666663]],[6,[725.7777777777779,1026.370370370371]],[4,[709.5555555555554,1026.6666666666667]],[8,[746.0000000000001,842.9999999999999]],[2,[745.5,826.0]]]},"segments":{"add":[1,2,3,4,5,6,7,8],"remove":[],"start_point":[[2,2],[8,8],[5,5],[3,3],[6,6],[1,1],[7,7],[4,4]],"end_point":[[3,4],[5,6],[4,5],[6,7],[8,1],[1,2],[7,8],[2,3]],"handle_primary":[[4,[0.0,0.0]],[2,[-24.5,85.0]],[3,[0.0,0.0]],[7,[0.0,0.0]],[5,[0.0,0.0]],[8,[17.33333333333337,-84.99999999999989]],[6,[0.0,0.0]],[1,[0.0,0.0]]],"handle_end":[[7,[-26.8034437596026,131.4399645903585]],[2,[0.0,0.0]],[4,[-23.11111111111109,90.44444444444Line truncated
|
||||
Generated
+1
-1
@@ -1 +1 @@
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[202,{"inputs":[{"Node":{"node_id":206,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[404,{"inputs":[{"Node":{"node_id":402,"output_index":0}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.24313726,"green":0.18431373,"blue":0.19215687,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":2.0},"exposed":false}},{"Value":{"tagged_value":{"StrokeAlign":"Center"},"exposed":false}},{"Value":{"tagged_value":{"StrokeCap":"Butt"},"exposed":false}},{"Value":{"tagged_value":{"StrokeJoin":"Miter"},"exposed":false}},{"Value":{"tagged_value":{"F64":4.0},"exposed":false}},{"Value":{"tagged_value":{"PaintOrder":"StrokeAbove"},"exposed":false}},{"Value":{"tagged_value":{"VecF64":[]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::StrokeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[93,{"inputs":[{"Node":{"node_id":94,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[851.1666666666667,668.5377104806669]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[39.677869315599935,39.67786931560005]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[155,{"inputs":[{"Node":{"node_id":159,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],Line truncated
|
||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[202,{"inputs":[{"Node":{"node_id":206,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[404,{"inputs":[{"Node":{"node_id":402,"output_index":0}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.24313726,"green":0.18431373,"blue":0.19215687,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":2.0},"exposed":false}},{"Value":{"tagged_value":{"StrokeAlign":"Center"},"exposed":false}},{"Value":{"tagged_value":{"StrokeCap":"Butt"},"exposed":false}},{"Value":{"tagged_value":{"StrokeJoin":"Miter"},"exposed":false}},{"Value":{"tagged_value":{"F64":4.0},"exposed":false}},{"Value":{"tagged_value":{"PaintOrder":"StrokeAbove"},"exposed":false}},{"Value":{"tagged_value":{"VecF64":[]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::StrokeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[93,{"inputs":[{"Node":{"node_id":94,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[851.1666666666667,668.5377104806669]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[39.677869315599935,39.67786931560005]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[155,{"inputs":[{"Node":{"node_id":159,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],Line truncated
|
||||
+50
-3
@@ -15,6 +15,7 @@ use crate::cli::Cli;
|
||||
use crate::consts::CEF_MESSAGE_LOOP_MAX_ITERATIONS;
|
||||
use crate::event::{AppEvent, AppEventScheduler};
|
||||
use crate::persist::PersistentData;
|
||||
use crate::preferences;
|
||||
use crate::render::{RenderError, RenderState};
|
||||
use crate::window::Window;
|
||||
use crate::wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage, InputMessage, MouseKeys, MouseState};
|
||||
@@ -45,6 +46,7 @@ pub(crate) struct App {
|
||||
cli: Cli,
|
||||
startup_time: Option<Instant>,
|
||||
exit_reason: ExitReason,
|
||||
hide_ui: bool,
|
||||
}
|
||||
|
||||
impl App {
|
||||
@@ -74,7 +76,7 @@ impl App {
|
||||
loop {
|
||||
let result = runtime.block_on(DesktopWrapper::execute_node_graph());
|
||||
rendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));
|
||||
let _ = start_render_receiver.recv();
|
||||
let _ = start_render_receiver.recv_timeout(Duration::from_millis(10));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,6 +110,7 @@ impl App {
|
||||
cli,
|
||||
exit_reason: ExitReason::Shutdown,
|
||||
startup_time: None,
|
||||
hide_ui: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +127,10 @@ impl App {
|
||||
}
|
||||
|
||||
fn resize(&mut self) {
|
||||
if self.hide_ui {
|
||||
self.handle_desktop_frontend_message(DesktopFrontendMessage::TmpToggleHideUI, &mut Vec::new());
|
||||
}
|
||||
|
||||
let Some(window) = &self.window else {
|
||||
tracing::error!("Resize failed due to missing window");
|
||||
return;
|
||||
@@ -238,6 +245,19 @@ impl App {
|
||||
});
|
||||
}
|
||||
DesktopFrontendMessage::UpdateViewportPhysicalBounds { x, y, width, height } => {
|
||||
if self.hide_ui {
|
||||
if x != 0.0 && y != 0.0 {
|
||||
let message = DesktopWrapperMessage::TmpUpdateViewport {
|
||||
x: 0.,
|
||||
y: 0.,
|
||||
width: self.window_size.width as f64 / self.window_scale,
|
||||
height: self.window_size.height as f64 / self.window_scale,
|
||||
};
|
||||
self.dispatch_desktop_wrapper_message(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(render_state) = &mut self.render_state
|
||||
&& let Some(window) = &self.window
|
||||
{
|
||||
@@ -253,6 +273,9 @@ impl App {
|
||||
}
|
||||
}
|
||||
DesktopFrontendMessage::UpdateUIScale { scale } => {
|
||||
if self.hide_ui {
|
||||
return;
|
||||
}
|
||||
self.ui_scale = scale;
|
||||
self.resize();
|
||||
}
|
||||
@@ -277,10 +300,10 @@ impl App {
|
||||
self.persistent_data.set_document_order(ids);
|
||||
}
|
||||
DesktopFrontendMessage::PersistenceWritePreferences { preferences } => {
|
||||
self.persistent_data.write_preferences(preferences);
|
||||
preferences::write(preferences);
|
||||
}
|
||||
DesktopFrontendMessage::PersistenceLoadPreferences => {
|
||||
let preferences = self.persistent_data.load_preferences();
|
||||
let preferences = preferences::read();
|
||||
let message = DesktopWrapperMessage::LoadPreferences { preferences };
|
||||
responses.push(message);
|
||||
}
|
||||
@@ -398,6 +421,25 @@ impl App {
|
||||
window.show_all();
|
||||
}
|
||||
}
|
||||
DesktopFrontendMessage::Restart => {
|
||||
self.exit(Some(ExitReason::Restart));
|
||||
}
|
||||
|
||||
DesktopFrontendMessage::TmpToggleHideUI => {
|
||||
if self.hide_ui {
|
||||
self.hide_ui = false;
|
||||
} else {
|
||||
let message = DesktopWrapperMessage::TmpUpdateViewport {
|
||||
x: 0.,
|
||||
y: 0.,
|
||||
width: self.window_size.width as f64 / self.window_scale,
|
||||
height: self.window_size.height as f64 / self.window_scale,
|
||||
};
|
||||
self.dispatch_desktop_wrapper_message(message);
|
||||
self.render_state.as_mut().unwrap().unbind_ui_texture();
|
||||
self.hide_ui = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,6 +489,10 @@ impl App {
|
||||
NodeGraphExecutionResult::NotRun => {}
|
||||
},
|
||||
AppEvent::UiUpdate(texture) => {
|
||||
if self.hide_ui {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(render_state) = self.render_state.as_mut() {
|
||||
render_state.bind_ui_texture(texture);
|
||||
}
|
||||
@@ -663,5 +709,6 @@ impl ApplicationHandler for App {
|
||||
|
||||
pub(crate) enum ExitReason {
|
||||
Shutdown,
|
||||
Restart,
|
||||
UiAccelerationFailure,
|
||||
}
|
||||
+27
-18
@@ -1,30 +1,28 @@
|
||||
use crate::app::App;
|
||||
use crate::cef::CefHandler;
|
||||
use crate::cli::Cli;
|
||||
use crate::consts::APP_LOCK_FILE_NAME;
|
||||
use crate::event::CreateAppEventSchedulerEventLoopExt;
|
||||
use clap::Parser;
|
||||
use std::io::Write;
|
||||
use std::process::exit;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use winit::event_loop::EventLoop;
|
||||
|
||||
pub(crate) mod consts;
|
||||
pub(crate) use graphite_desktop_wrapper as wrapper;
|
||||
|
||||
mod app;
|
||||
mod cef;
|
||||
mod cli;
|
||||
mod dirs;
|
||||
mod event;
|
||||
mod gpu_context;
|
||||
mod persist;
|
||||
mod preferences;
|
||||
mod render;
|
||||
mod window;
|
||||
|
||||
mod gpu_context;
|
||||
|
||||
pub(crate) use graphite_desktop_wrapper as wrapper;
|
||||
|
||||
use app::App;
|
||||
use cef::CefHandler;
|
||||
use cli::Cli;
|
||||
use event::CreateAppEventSchedulerEventLoopExt;
|
||||
|
||||
use crate::consts::APP_LOCK_FILE_NAME;
|
||||
pub(crate) mod consts;
|
||||
|
||||
pub fn start() {
|
||||
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init();
|
||||
@@ -77,12 +75,13 @@ pub fn start() {
|
||||
|
||||
let (cef_view_info_sender, cef_view_info_receiver) = std::sync::mpsc::channel();
|
||||
|
||||
if cli.disable_ui_acceleration {
|
||||
let disable_ui_acceleration = preferences::read().disable_ui_acceleration || cli.disable_ui_acceleration;
|
||||
if disable_ui_acceleration {
|
||||
println!("UI acceleration is disabled");
|
||||
}
|
||||
|
||||
let cef_handler = cef::CefHandler::new(wgpu_context.clone(), app_event_scheduler.clone(), cef_view_info_receiver);
|
||||
let cef_context = match cef_context_builder.initialize(cef_handler, cli.disable_ui_acceleration) {
|
||||
let cef_context = match cef_context_builder.initialize(cef_handler, disable_ui_acceleration) {
|
||||
Ok(context) => {
|
||||
tracing::info!("CEF initialized successfully");
|
||||
context
|
||||
@@ -109,16 +108,26 @@ pub fn start() {
|
||||
|
||||
let exit_reason = app.run(event_loop);
|
||||
|
||||
// If exiting due to a UI acceleration failure, update preferences to disable it for next launch
|
||||
if matches!(exit_reason, app::ExitReason::UiAccelerationFailure) {
|
||||
tracing::error!("Disabling UI acceleration");
|
||||
preferences::modify(|prefs| {
|
||||
prefs.disable_ui_acceleration = true;
|
||||
});
|
||||
}
|
||||
|
||||
// Explicitly drop the instance lock
|
||||
drop(lock);
|
||||
|
||||
match exit_reason {
|
||||
#[cfg(target_os = "linux")]
|
||||
app::ExitReason::UiAccelerationFailure => {
|
||||
use std::os::unix::process::CommandExt;
|
||||
|
||||
tracing::error!("Restarting application without UI acceleration");
|
||||
let _ = std::process::Command::new(std::env::current_exe().unwrap()).arg("--disable-ui-acceleration").exec();
|
||||
app::ExitReason::Restart | app::ExitReason::UiAccelerationFailure => {
|
||||
tracing::error!("Restarting application");
|
||||
let mut command = std::process::Command::new(std::env::current_exe().unwrap());
|
||||
#[cfg(target_family = "unix")]
|
||||
let _ = std::os::unix::process::CommandExt::exec(&mut command);
|
||||
#[cfg(not(target_family = "unix"))]
|
||||
let _ = command.spawn();
|
||||
tracing::error!("Failed to restart application");
|
||||
}
|
||||
_ => {}
|
||||
|
||||
+1
-23
@@ -1,4 +1,4 @@
|
||||
use crate::wrapper::messages::{Document, DocumentId, Preferences};
|
||||
use crate::wrapper::messages::{Document, DocumentId};
|
||||
|
||||
#[derive(Default, serde::Serialize, serde::Deserialize)]
|
||||
pub(crate) struct PersistentData {
|
||||
@@ -72,22 +72,6 @@ impl PersistentData {
|
||||
self.flush();
|
||||
}
|
||||
|
||||
pub(crate) fn write_preferences(&mut self, preferences: Preferences) {
|
||||
let Ok(preferences) = ron::ser::to_string_pretty(&preferences, Default::default()) else {
|
||||
tracing::error!("Failed to serialize preferences");
|
||||
return;
|
||||
};
|
||||
std::fs::write(Self::preferences_file_path(), &preferences).unwrap_or_else(|e| {
|
||||
tracing::error!("Failed to write preferences to disk: {e}");
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn load_preferences(&self) -> Option<Preferences> {
|
||||
let data = std::fs::read_to_string(Self::preferences_file_path()).ok()?;
|
||||
let preferences = ron::from_str(&data).ok()?;
|
||||
Some(preferences)
|
||||
}
|
||||
|
||||
fn flush(&self) {
|
||||
let data = match ron::ser::to_string_pretty(self, Default::default()) {
|
||||
Ok(d) => d,
|
||||
@@ -129,12 +113,6 @@ impl PersistentData {
|
||||
path.push(crate::consts::APP_STATE_FILE_NAME);
|
||||
path
|
||||
}
|
||||
|
||||
fn preferences_file_path() -> std::path::PathBuf {
|
||||
let mut path = crate::dirs::app_data_dir();
|
||||
path.push(crate::consts::APP_PREFERENCES_FILE_NAME);
|
||||
path
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, serde::Serialize, serde::Deserialize)]
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
use graphite_desktop_wrapper::messages::Preferences;
|
||||
|
||||
pub(crate) fn write(preferences: Preferences) {
|
||||
let Ok(preferences) = ron::ser::to_string_pretty(&preferences, Default::default()) else {
|
||||
tracing::error!("Failed to serialize preferences");
|
||||
return;
|
||||
};
|
||||
std::fs::write(file_path(), &preferences).unwrap_or_else(|e| {
|
||||
tracing::error!("Failed to write preferences to disk: {e}");
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn read() -> Preferences {
|
||||
let Ok(data) = std::fs::read_to_string(file_path()) else {
|
||||
return Preferences::default();
|
||||
};
|
||||
let Ok(preferences) = ron::from_str(&data) else {
|
||||
return Preferences::default();
|
||||
};
|
||||
preferences
|
||||
}
|
||||
|
||||
pub(crate) fn modify(f: impl FnOnce(&mut Preferences)) {
|
||||
let mut preferences = read();
|
||||
f(&mut preferences);
|
||||
write(preferences);
|
||||
}
|
||||
|
||||
fn file_path() -> std::path::PathBuf {
|
||||
let mut path = crate::dirs::app_data_dir();
|
||||
path.push(crate::consts::APP_PREFERENCES_FILE_NAME);
|
||||
path
|
||||
}
|
||||
@@ -217,6 +217,11 @@ impl RenderState {
|
||||
self.update_bindgroup();
|
||||
}
|
||||
|
||||
pub(crate) fn unbind_ui_texture(&mut self) {
|
||||
self.ui_texture = None;
|
||||
self.update_bindgroup();
|
||||
}
|
||||
|
||||
pub(crate) fn set_viewport_scale(&mut self, scale: [f32; 2]) {
|
||||
self.surface_outdated = true;
|
||||
self.viewport_scale = scale;
|
||||
@@ -335,7 +340,7 @@ impl RenderState {
|
||||
},
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&overlays_texture_view.as_ref()),
|
||||
resource: wgpu::BindingResource::TextureView(overlays_texture_view.as_ref()),
|
||||
},
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
|
||||
@@ -97,5 +97,10 @@ pub(super) fn handle_desktop_wrapper_message(dispatcher: &mut DesktopWrapperMess
|
||||
let message = AppWindowMessage::PointerLockMove { x, y };
|
||||
dispatcher.queue_editor_message(message);
|
||||
}
|
||||
|
||||
DesktopWrapperMessage::TmpUpdateViewport { x, y, width, height } => {
|
||||
let message = ViewportMessage::TmpUpdateBounds { x, y, width, height };
|
||||
dispatcher.queue_editor_message(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,13 @@ pub(super) fn intercept_frontend_message(dispatcher: &mut DesktopWrapperMessageD
|
||||
FrontendMessage::WindowShowAll => {
|
||||
dispatcher.respond(DesktopFrontendMessage::WindowShowAll);
|
||||
}
|
||||
FrontendMessage::WindowRestart => {
|
||||
dispatcher.respond(DesktopFrontendMessage::Restart);
|
||||
}
|
||||
|
||||
FrontendMessage::TmpToggleHideUI => {
|
||||
dispatcher.respond(DesktopFrontendMessage::TmpToggleHideUI);
|
||||
}
|
||||
m => return Some(m),
|
||||
}
|
||||
None
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
use graph_craft::wasm_application_io::WasmApplicationIo;
|
||||
use graphite_editor::application::{Editor, Environment, Host, Platform};
|
||||
use graphite_editor::messages::prelude::{FrontendMessage, Message};
|
||||
use message_dispatcher::DesktopWrapperMessageDispatcher;
|
||||
use messages::{DesktopFrontendMessage, DesktopWrapperMessage};
|
||||
|
||||
pub use graphite_editor::consts::FILE_EXTENSION;
|
||||
|
||||
pub use wgpu_executor::TargetTexture;
|
||||
pub use wgpu_executor::WgpuContext;
|
||||
pub use wgpu_executor::WgpuContextBuilder;
|
||||
pub use wgpu_executor::WgpuExecutor;
|
||||
pub use wgpu_executor::WgpuFeatures;
|
||||
|
||||
pub mod messages;
|
||||
use messages::{DesktopFrontendMessage, DesktopWrapperMessage};
|
||||
|
||||
mod message_dispatcher;
|
||||
use message_dispatcher::DesktopWrapperMessageDispatcher;
|
||||
|
||||
mod handle_desktop_wrapper_message;
|
||||
mod intercept_editor_message;
|
||||
mod intercept_frontend_message;
|
||||
|
||||
mod message_dispatcher;
|
||||
pub mod messages;
|
||||
pub(crate) mod utils;
|
||||
|
||||
pub struct DesktopWrapper {
|
||||
|
||||
@@ -74,6 +74,9 @@ pub enum DesktopFrontendMessage {
|
||||
WindowHide,
|
||||
WindowHideOthers,
|
||||
WindowShowAll,
|
||||
Restart,
|
||||
|
||||
TmpToggleHideUI,
|
||||
}
|
||||
|
||||
pub enum DesktopWrapperMessage {
|
||||
@@ -113,7 +116,7 @@ pub enum DesktopWrapperMessage {
|
||||
id: DocumentId,
|
||||
},
|
||||
LoadPreferences {
|
||||
preferences: Option<Preferences>,
|
||||
preferences: Preferences,
|
||||
},
|
||||
MenuEvent {
|
||||
id: String,
|
||||
@@ -125,6 +128,13 @@ pub enum DesktopWrapperMessage {
|
||||
x: f64,
|
||||
y: f64,
|
||||
},
|
||||
|
||||
TmpUpdateViewport {
|
||||
x: f64,
|
||||
y: f64,
|
||||
width: f64,
|
||||
height: f64,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, serde::Serialize, serde::Deserialize, Debug)]
|
||||
|
||||
@@ -26,7 +26,7 @@ pub const VIEWPORT_SCROLL_RATE: f64 = 0.6;
|
||||
|
||||
pub const VIEWPORT_ROTATE_SNAP_INTERVAL: f64 = 15.;
|
||||
|
||||
pub const VIEWPORT_ZOOM_TO_FIT_PADDING_SCALE_FACTOR: f64 = 0.95;
|
||||
pub const VIEWPORT_ZOOM_TO_FIT_PADDING_SCALE_FACTOR: f64 = 0.999;
|
||||
|
||||
pub const DRAG_BEYOND_VIEWPORT_MAX_OVEREXTENSION_PIXELS: f64 = 50.;
|
||||
pub const DRAG_BEYOND_VIEWPORT_SPEED_FACTOR: f64 = 20.;
|
||||
|
||||
@@ -51,6 +51,7 @@ const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
|
||||
NodeGraphMessageDiscriminant::RunDocumentGraph,
|
||||
))),
|
||||
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::SubmitActiveGraphRender),
|
||||
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::SubmitEyedropperPreviewRender),
|
||||
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::TriggerFontDataLoad),
|
||||
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateUIScale),
|
||||
];
|
||||
|
||||
@@ -5,6 +5,7 @@ use crate::messages::prelude::*;
|
||||
pub enum AppWindowMessage {
|
||||
PointerLock,
|
||||
PointerLockMove { x: f64, y: f64 },
|
||||
Restart,
|
||||
Close,
|
||||
Minimize,
|
||||
Maximize,
|
||||
@@ -13,4 +14,5 @@ pub enum AppWindowMessage {
|
||||
Hide,
|
||||
HideOthers,
|
||||
ShowAll,
|
||||
TmpToggleHideUI
|
||||
}
|
||||
@@ -40,6 +40,23 @@ impl MessageHandler<AppWindowMessage, ()> for AppWindowMessageHandler {
|
||||
AppWindowMessage::ShowAll => {
|
||||
responses.add(FrontendMessage::WindowShowAll);
|
||||
}
|
||||
AppWindowMessage::Restart => {
|
||||
responses.add(PortfolioMessage::AutoSaveAllDocuments);
|
||||
responses.add(FrontendMessage::WindowRestart);
|
||||
}
|
||||
AppWindowMessage::TmpToggleHideUI => {
|
||||
responses.add(FrontendMessage::TmpToggleHideUI);
|
||||
responses.add(PortfolioMessage::ToggleFocusDocument);
|
||||
responses.add(DeferMessage::AfterGraphRun {
|
||||
messages: vec![
|
||||
DocumentMessage::ZoomCanvasToFitAll.into(),
|
||||
DeferMessage::AfterGraphRun {
|
||||
messages: vec![DocumentMessage::ZoomCanvasToFitAll.into()],
|
||||
}
|
||||
.into(),
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
advertise_actions!(AppWindowMessageDiscriminant;
|
||||
@@ -50,6 +67,7 @@ impl MessageHandler<AppWindowMessage, ()> for AppWindowMessageHandler {
|
||||
Drag,
|
||||
Hide,
|
||||
HideOthers,
|
||||
TmpToggleHideUI,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,12 @@ pub enum DialogMessage {
|
||||
PreferencesDialog(PreferencesDialogMessage),
|
||||
|
||||
// Messages
|
||||
CloseAllDocumentsWithConfirmation,
|
||||
CloseDialogAndThen {
|
||||
Dismiss,
|
||||
Close,
|
||||
CloseAndThen {
|
||||
followups: Vec<Message>,
|
||||
},
|
||||
CloseAllDocumentsWithConfirmation,
|
||||
DisplayDialogError {
|
||||
title: String,
|
||||
description: String,
|
||||
@@ -35,4 +37,5 @@ pub enum DialogMessage {
|
||||
},
|
||||
RequestNewDocumentDialog,
|
||||
RequestPreferencesDialog,
|
||||
RequestConfirmRestartDialog,
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::simple_dialogs::{self, AboutGraphiteDialog, DemoArtworkDialog, LicensesDialog};
|
||||
use crate::application::GRAPHITE_GIT_COMMIT_DATE;
|
||||
use crate::messages::dialog::simple_dialogs::LicensesThirdPartyDialog;
|
||||
use crate::messages::dialog::simple_dialogs::{ConfirmRestartDialog, LicensesThirdPartyDialog};
|
||||
use crate::messages::frontend::utility_types::ExportBounds;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
@@ -13,6 +14,7 @@ pub struct DialogMessageContext<'a> {
|
||||
/// Stores the dialogs which require state. These are the ones that have their own message handlers, and are not the ones defined in `simple_dialogs`.
|
||||
#[derive(Debug, Default, Clone, ExtractField)]
|
||||
pub struct DialogMessageHandler {
|
||||
on_dismiss: Option<Message>,
|
||||
export_dialog: ExportDialogMessageHandler,
|
||||
new_document_dialog: NewDocumentDialogMessageHandler,
|
||||
preferences_dialog: PreferencesDialogMessageHandler,
|
||||
@@ -28,26 +30,38 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
|
||||
DialogMessage::NewDocumentDialog(message) => self.new_document_dialog.process_message(message, responses, ()),
|
||||
DialogMessage::PreferencesDialog(message) => self.preferences_dialog.process_message(message, responses, PreferencesDialogMessageContext { preferences }),
|
||||
|
||||
DialogMessage::CloseAllDocumentsWithConfirmation => {
|
||||
let dialog = simple_dialogs::CloseAllDocumentsDialog {
|
||||
unsaved_document_names: portfolio.unsaved_document_names(),
|
||||
};
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
DialogMessage::Dismiss => {
|
||||
if let Some(message) = self.on_dismiss.take() {
|
||||
responses.add(message);
|
||||
}
|
||||
}
|
||||
DialogMessage::CloseDialogAndThen { followups } => {
|
||||
DialogMessage::Close => {
|
||||
self.on_dismiss = None;
|
||||
responses.add(FrontendMessage::DialogClose)
|
||||
}
|
||||
DialogMessage::CloseAndThen { followups } => {
|
||||
for message in followups.into_iter() {
|
||||
responses.add(message);
|
||||
}
|
||||
|
||||
// This come after followups, so that the followups (which can cause the dialog to open) happen first, then we close it afterwards.
|
||||
// If it comes before, the dialog reopens (and appears to not close at all).
|
||||
responses.add(FrontendMessage::DisplayDialogDismiss);
|
||||
responses.add(DialogMessage::Close);
|
||||
}
|
||||
DialogMessage::CloseAllDocumentsWithConfirmation => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
let dialog = simple_dialogs::CloseAllDocumentsDialog {
|
||||
unsaved_document_names: portfolio.unsaved_document_names(),
|
||||
};
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::DisplayDialogError { title, description } => {
|
||||
self.on_dismiss = None;
|
||||
let dialog = simple_dialogs::ErrorDialog { title, description };
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::RequestAboutGraphiteDialog => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
responses.add(FrontendMessage::TriggerAboutGraphiteLocalizedCommitDate {
|
||||
commit_date: GRAPHITE_GIT_COMMIT_DATE.into(),
|
||||
});
|
||||
@@ -56,6 +70,7 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
|
||||
localized_commit_date,
|
||||
localized_commit_year,
|
||||
} => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
let dialog = AboutGraphiteDialog {
|
||||
localized_commit_date,
|
||||
localized_commit_year,
|
||||
@@ -64,10 +79,12 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::RequestDemoArtworkDialog => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
let dialog = DemoArtworkDialog;
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::RequestExportDialog => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
if let Some(document) = portfolio.active_document() {
|
||||
let artboards = document
|
||||
.metadata()
|
||||
@@ -85,20 +102,29 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
|
||||
.collect();
|
||||
|
||||
self.export_dialog.artboards = artboards;
|
||||
|
||||
if let ExportBounds::Artboard(layer) = self.export_dialog.bounds
|
||||
&& !self.export_dialog.artboards.contains_key(&layer)
|
||||
{
|
||||
self.export_dialog.bounds = ExportBounds::AllArtwork;
|
||||
}
|
||||
|
||||
self.export_dialog.has_selection = document.network_interface.selected_nodes().selected_layers(document.metadata()).next().is_some();
|
||||
self.export_dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
}
|
||||
DialogMessage::RequestLicensesDialogWithLocalizedCommitDate { localized_commit_year } => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
let dialog = LicensesDialog { localized_commit_year };
|
||||
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::RequestLicensesThirdPartyDialogWithLicenseText { license_text } => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
let dialog = LicensesThirdPartyDialog { license_text };
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::RequestNewDocumentDialog => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
self.new_document_dialog = NewDocumentDialogMessageHandler {
|
||||
name: portfolio.generate_new_document_name(),
|
||||
infinite: false,
|
||||
@@ -107,9 +133,16 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
|
||||
self.new_document_dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
DialogMessage::RequestPreferencesDialog => {
|
||||
self.preferences_dialog = PreferencesDialogMessageHandler {};
|
||||
self.on_dismiss = Some(PreferencesDialogMessage::Confirm.into());
|
||||
self.preferences_dialog.send_dialog_to_frontend(responses, preferences);
|
||||
}
|
||||
DialogMessage::RequestConfirmRestartDialog => {
|
||||
self.on_dismiss = Some(DialogMessage::Close.into());
|
||||
let dialog = ConfirmRestartDialog {
|
||||
changed_settings: vec!["Disable UI Acceleration".into()],
|
||||
};
|
||||
dialog.send_dialog_to_frontend(responses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,8 @@ impl MessageHandler<ExportDialogMessage, ExportDialogMessageContext<'_>> for Exp
|
||||
self.send_dialog_to_frontend(responses);
|
||||
}
|
||||
|
||||
advertise_actions! {ExportDialogUpdate;}
|
||||
advertise_actions!(ExportDialogUpdate;
|
||||
);
|
||||
}
|
||||
|
||||
impl DialogLayoutHolder for ExportDialogMessageHandler {
|
||||
@@ -75,13 +76,13 @@ impl DialogLayoutHolder for ExportDialogMessageHandler {
|
||||
TextButton::new("Export")
|
||||
.emphasized(true)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![ExportDialogMessage::Submit.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DialogClose.into()).widget_instance(),
|
||||
];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
@@ -130,7 +131,7 @@ impl LayoutHolder for ExportDialogMessageHandler {
|
||||
} else {
|
||||
self.bounds
|
||||
};
|
||||
let index = choices.iter().flatten().position(|(bounds, _, _)| *bounds == current_bounds).unwrap();
|
||||
let index = choices.iter().flatten().position(|(bounds, _, _)| *bounds == current_bounds).unwrap_or(0);
|
||||
|
||||
let mut entries = choices
|
||||
.into_iter()
|
||||
|
||||
+10
-5
@@ -12,7 +12,7 @@ pub struct NewDocumentDialogMessageHandler {
|
||||
}
|
||||
|
||||
#[message_handler_data]
|
||||
impl<'a> MessageHandler<NewDocumentDialogMessage, ()> for NewDocumentDialogMessageHandler {
|
||||
impl MessageHandler<NewDocumentDialogMessage, ()> for NewDocumentDialogMessageHandler {
|
||||
fn process_message(&mut self, message: NewDocumentDialogMessage, responses: &mut VecDeque<Message>, _: ()) {
|
||||
match message {
|
||||
NewDocumentDialogMessage::Name { name } => self.name = name,
|
||||
@@ -34,7 +34,11 @@ impl<'a> MessageHandler<NewDocumentDialogMessage, ()> for NewDocumentDialogMessa
|
||||
responses.add(ViewportMessage::RepropagateUpdate);
|
||||
|
||||
responses.add(DeferMessage::AfterNavigationReady {
|
||||
messages: vec![DocumentMessage::ZoomCanvasToFitAll.into(), DocumentMessage::DeselectAllLayers.into()],
|
||||
messages: vec![
|
||||
DocumentMessage::ZoomCanvasToFitAll.into(),
|
||||
DocumentMessage::DeselectAllLayers.into(),
|
||||
PortfolioMessage::AutoSaveActiveDocument.into(),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +49,8 @@ impl<'a> MessageHandler<NewDocumentDialogMessage, ()> for NewDocumentDialogMessa
|
||||
self.send_dialog_to_frontend(responses);
|
||||
}
|
||||
|
||||
advertise_actions! {NewDocumentDialogUpdate;}
|
||||
advertise_actions!(NewDocumentDialogUpdate;
|
||||
);
|
||||
}
|
||||
|
||||
impl DialogLayoutHolder for NewDocumentDialogMessageHandler {
|
||||
@@ -57,13 +62,13 @@ impl DialogLayoutHolder for NewDocumentDialogMessageHandler {
|
||||
TextButton::new("OK")
|
||||
.emphasized(true)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![NewDocumentDialogMessage::Submit.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DialogClose.into()).widget_instance(),
|
||||
];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
|
||||
@@ -3,5 +3,7 @@ use crate::messages::prelude::*;
|
||||
#[impl_message(Message, DialogMessage, PreferencesDialog)]
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub enum PreferencesDialogMessage {
|
||||
MayRequireRestart,
|
||||
Confirm,
|
||||
Update,
|
||||
}
|
||||
+181
-52
@@ -3,6 +3,7 @@ use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::utility_types::wires::GraphWireStyle;
|
||||
use crate::messages::preferences::SelectionMode;
|
||||
use crate::messages::prelude::*;
|
||||
use graphene_std::render_node::{EditorPreferences, wgpu_available};
|
||||
|
||||
#[derive(ExtractField)]
|
||||
pub struct PreferencesDialogMessageContext<'a> {
|
||||
@@ -11,21 +12,35 @@ pub struct PreferencesDialogMessageContext<'a> {
|
||||
|
||||
/// A dialog to allow users to customize Graphite editor options
|
||||
#[derive(Debug, Clone, Default, ExtractField)]
|
||||
pub struct PreferencesDialogMessageHandler {}
|
||||
pub struct PreferencesDialogMessageHandler {
|
||||
unmodified_preferences: Option<PreferencesMessageHandler>,
|
||||
}
|
||||
|
||||
#[message_handler_data]
|
||||
impl MessageHandler<PreferencesDialogMessage, PreferencesDialogMessageContext<'_>> for PreferencesDialogMessageHandler {
|
||||
fn process_message(&mut self, message: PreferencesDialogMessage, responses: &mut VecDeque<Message>, context: PreferencesDialogMessageContext) {
|
||||
let PreferencesDialogMessageContext { preferences } = context;
|
||||
|
||||
match message {
|
||||
PreferencesDialogMessage::Confirm => {}
|
||||
PreferencesDialogMessage::MayRequireRestart => {
|
||||
if self.unmodified_preferences.is_none() {
|
||||
self.unmodified_preferences = Some(preferences.clone());
|
||||
}
|
||||
}
|
||||
PreferencesDialogMessage::Confirm => {
|
||||
if let Some(unmodified_preferences) = &self.unmodified_preferences
|
||||
&& unmodified_preferences.needs_restart(preferences)
|
||||
{
|
||||
responses.add(DialogMessage::RequestConfirmRestartDialog);
|
||||
} else {
|
||||
responses.add(DialogMessage::Close);
|
||||
}
|
||||
}
|
||||
PreferencesDialogMessage::Update => {}
|
||||
}
|
||||
|
||||
self.send_dialog_to_frontend(responses, preferences);
|
||||
}
|
||||
|
||||
advertise_actions! {PreferencesDialogUpdate;}
|
||||
advertise_actions!(PreferencesDialogUpdate;
|
||||
);
|
||||
}
|
||||
|
||||
// This doesn't actually implement the `DialogLayoutHolder` trait like the other dialog message handlers.
|
||||
@@ -44,7 +59,12 @@ impl PreferencesDialogMessageHandler {
|
||||
{
|
||||
let header = vec![TextLabel::new("Navigation").italic(true).widget_instance()];
|
||||
|
||||
let zoom_rate_description = "Adjust how fast zooming occurs when using the scroll wheel or pinch gesture (relative to a default of 50).";
|
||||
let zoom_rate_description = "
|
||||
Adjust how fast zooming occurs when using the scroll wheel or pinch gesture.\n\
|
||||
\n\
|
||||
*Default: 50.*
|
||||
"
|
||||
.trim();
|
||||
let zoom_rate_label = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
@@ -72,7 +92,12 @@ impl PreferencesDialogMessageHandler {
|
||||
];
|
||||
|
||||
let checkbox_id = CheckboxId::new();
|
||||
let zoom_with_scroll_description = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads).";
|
||||
let zoom_with_scroll_description = "
|
||||
Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads).\n\
|
||||
\n\
|
||||
*Default: Off.*
|
||||
"
|
||||
.trim();
|
||||
let zoom_with_scroll = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
@@ -103,12 +128,18 @@ impl PreferencesDialogMessageHandler {
|
||||
{
|
||||
let header = vec![TextLabel::new("Editing").italic(true).widget_instance()];
|
||||
|
||||
let selection_label_description = "
|
||||
Choose how targets are selected within dragged rectangular and lasso areas.\n\
|
||||
\n\
|
||||
*Default: Touched.*
|
||||
"
|
||||
.trim();
|
||||
let selection_label = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
TextLabel::new("Selection")
|
||||
.tooltip_label("Selection")
|
||||
.tooltip_description("Choose how targets are selected within dragged rectangular and lasso areas.")
|
||||
.tooltip_description(selection_label_description)
|
||||
.widget_instance(),
|
||||
];
|
||||
|
||||
@@ -162,7 +193,12 @@ impl PreferencesDialogMessageHandler {
|
||||
{
|
||||
let header = vec![TextLabel::new("Interface").italic(true).widget_instance()];
|
||||
|
||||
let scale_description = "Adjust the scale of the entire user interface (100% is default).";
|
||||
let scale_description = "
|
||||
Adjust the scale of the entire user interface.\n\
|
||||
\n\
|
||||
*Default: 100%.*
|
||||
"
|
||||
.trim();
|
||||
let scale_label = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
@@ -202,7 +238,12 @@ impl PreferencesDialogMessageHandler {
|
||||
{
|
||||
let header = vec![TextLabel::new("Experimental").italic(true).widget_instance()];
|
||||
|
||||
let node_graph_section_description = "Configure the appearance of the wires running between node connections in the graph.";
|
||||
let node_graph_section_description = "
|
||||
Configure the appearance of the wires running between node connections in the graph.\n\
|
||||
\n\
|
||||
*Default: Direct.*
|
||||
"
|
||||
.trim();
|
||||
let node_graph_wires_label = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
@@ -231,39 +272,16 @@ impl PreferencesDialogMessageHandler {
|
||||
graph_wire_style,
|
||||
];
|
||||
|
||||
let checkbox_id = CheckboxId::new();
|
||||
let vello_description = "Use the experimental Vello renderer instead of SVG-based rendering.".to_string();
|
||||
#[cfg(target_family = "wasm")]
|
||||
let mut vello_description = vello_description;
|
||||
#[cfg(target_family = "wasm")]
|
||||
vello_description.push_str("\n\n(Your browser must support WebGPU.)");
|
||||
|
||||
let use_vello = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
CheckboxInput::new(preferences.use_vello && preferences.supports_wgpu())
|
||||
.tooltip_label("Vello Renderer")
|
||||
.tooltip_description(vello_description.clone())
|
||||
.disabled(!preferences.supports_wgpu())
|
||||
.on_update(|checkbox_input: &CheckboxInput| PreferencesMessage::UseVello { use_vello: checkbox_input.checked }.into())
|
||||
.for_label(checkbox_id)
|
||||
.widget_instance(),
|
||||
TextLabel::new("Vello Renderer")
|
||||
.tooltip_label("Vello Renderer")
|
||||
.tooltip_description(vello_description)
|
||||
.disabled(!preferences.supports_wgpu())
|
||||
.for_checkbox(checkbox_id)
|
||||
.widget_instance(),
|
||||
];
|
||||
|
||||
let checkbox_id = CheckboxId::new();
|
||||
let brush_tool_description = "
|
||||
Enable the Brush tool to support basic raster-based layer painting.\n\
|
||||
\n\
|
||||
This legacy experimental tool has performance and quality limitations and is slated for replacement in future versions of Graphite that will focus on raster graphics editing.\n\
|
||||
\n\
|
||||
Content created with the Brush tool may not be compatible with future versions of Graphite.
|
||||
"
|
||||
Enable the Brush tool to support basic raster-based layer painting.\n\
|
||||
\n\
|
||||
This legacy experimental tool has performance and quality limitations and is slated for replacement in future versions of Graphite that will have a renewed focus on raster graphics editing.\n\
|
||||
\n\
|
||||
Content created with the Brush tool may not be compatible with future versions of Graphite.\n\
|
||||
\n\
|
||||
*Default: Off.*
|
||||
"
|
||||
.trim();
|
||||
let brush_tool = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
@@ -281,7 +299,126 @@ impl PreferencesDialogMessageHandler {
|
||||
.widget_instance(),
|
||||
];
|
||||
|
||||
rows.extend_from_slice(&[header, node_graph_wires_label, graph_wire_style, use_vello, brush_tool]);
|
||||
rows.extend_from_slice(&[header, node_graph_wires_label, graph_wire_style, brush_tool]);
|
||||
}
|
||||
|
||||
// =============
|
||||
// COMPATIBILITY
|
||||
// =============
|
||||
{
|
||||
let wgpu_available = wgpu_available().unwrap_or(false);
|
||||
let is_desktop = cfg!(not(target_family = "wasm"));
|
||||
if wgpu_available || is_desktop {
|
||||
let header = vec![TextLabel::new("Compatibility").italic(true).widget_instance()];
|
||||
rows.push(header);
|
||||
}
|
||||
|
||||
if wgpu_available {
|
||||
let vello_description = "Auto uses Vello renderer when GPU is available.";
|
||||
let vello_renderer_label = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
TextLabel::new("Vello Renderer")
|
||||
.tooltip_label("Vello Renderer")
|
||||
.tooltip_description(vello_description)
|
||||
.widget_instance(),
|
||||
];
|
||||
let vello_preference = RadioInput::new(vec![
|
||||
RadioEntryData::new("Auto").label("Auto").on_update(move |_| {
|
||||
PreferencesMessage::VelloPreference {
|
||||
preference: graph_craft::wasm_application_io::VelloPreference::Auto,
|
||||
}
|
||||
.into()
|
||||
}),
|
||||
RadioEntryData::new("Disabled").label("Disabled").on_update(move |_| {
|
||||
PreferencesMessage::VelloPreference {
|
||||
preference: graph_craft::wasm_application_io::VelloPreference::Disabled,
|
||||
}
|
||||
.into()
|
||||
}),
|
||||
])
|
||||
.selected_index(Some(preferences.vello_preference as u32))
|
||||
.widget_instance();
|
||||
let vello_preference = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
vello_preference,
|
||||
];
|
||||
rows.extend_from_slice(&[vello_renderer_label, vello_preference]);
|
||||
|
||||
let render_tile_resolution_description = "
|
||||
Maximum X or Y resolution per render tile. Larger tiles may improve performance but can cause flickering or missing content in complex artwork if set too high.\n\
|
||||
\n\
|
||||
*Default: 1280 px.*
|
||||
"
|
||||
.trim();
|
||||
let render_tile_resolution_label = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
TextLabel::new("Render Tile Resolution")
|
||||
.tooltip_label("Render Tile Resolution")
|
||||
.tooltip_description(render_tile_resolution_description)
|
||||
.widget_instance(),
|
||||
];
|
||||
let render_tile_resolution = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
NumberInput::new(Some(preferences.max_render_region_size as f64))
|
||||
.tooltip_label("Render Tile Resolution")
|
||||
.tooltip_description(render_tile_resolution_description)
|
||||
.mode_range()
|
||||
.int()
|
||||
.min(256.)
|
||||
.max(4096.)
|
||||
.increment_step(256.)
|
||||
.unit(" px")
|
||||
.on_update(|number_input: &NumberInput| {
|
||||
let size = number_input.value.unwrap_or(EditorPreferences::default().max_render_region_size as f64) as u32;
|
||||
PreferencesMessage::MaxRenderRegionSize { size }.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
];
|
||||
|
||||
rows.extend_from_slice(&[render_tile_resolution_label, render_tile_resolution]);
|
||||
}
|
||||
|
||||
if is_desktop {
|
||||
let ui_acceleration_description = "
|
||||
Use the CPU to draw the Graphite user interface (areas outside of the canvas) instead of the GPU. This does not affect the rendering of artwork in the canvas, which remains hardware accelerated.\n\
|
||||
\n\
|
||||
Disabling UI acceleration may slightly degrade performance, so this should be used as a workaround only if issues are observed with displaying the UI. This setting may become enabled automatically if Graphite launches, detects that it cannot draw the UI normally, and restarts in compatibility mode.\n\
|
||||
\n\
|
||||
*Default: Off.*
|
||||
"
|
||||
.trim();
|
||||
|
||||
let checkbox_id = CheckboxId::new();
|
||||
let ui_acceleration = vec![
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
CheckboxInput::new(preferences.disable_ui_acceleration)
|
||||
.tooltip_label("Disable UI Acceleration")
|
||||
.tooltip_description(ui_acceleration_description)
|
||||
.on_update(|number_input: &CheckboxInput| Message::Batched {
|
||||
messages: Box::new([
|
||||
PreferencesDialogMessage::MayRequireRestart.into(),
|
||||
PreferencesMessage::DisableUIAcceleration {
|
||||
disable_ui_acceleration: number_input.checked,
|
||||
}
|
||||
.into(),
|
||||
]),
|
||||
})
|
||||
.for_label(checkbox_id)
|
||||
.widget_instance(),
|
||||
TextLabel::new("Disable UI Acceleration")
|
||||
.tooltip_label("Disable UI Acceleration")
|
||||
.tooltip_description(ui_acceleration_description)
|
||||
.for_checkbox(checkbox_id)
|
||||
.widget_instance(),
|
||||
];
|
||||
|
||||
rows.push(ui_acceleration);
|
||||
}
|
||||
}
|
||||
|
||||
Layout(rows.into_iter().map(|r| LayoutGroup::Row { widgets: r }).collect())
|
||||
@@ -307,15 +444,7 @@ impl PreferencesDialogMessageHandler {
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![
|
||||
TextButton::new("OK")
|
||||
.emphasized(true)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
followups: vec![PreferencesDialogMessage::Confirm.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
TextButton::new("OK").emphasized(true).on_update(|_| PreferencesDialogMessage::Confirm.into()).widget_instance(),
|
||||
TextButton::new("Reset to Defaults").on_update(|_| PreferencesMessage::ResetToDefaults.into()).widget_instance(),
|
||||
];
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ impl DialogLayoutHolder for AboutGraphiteDialog {
|
||||
const TITLE: &'static str = "About Graphite";
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DialogClose.into()).widget_instance()];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ impl DialogLayoutHolder for CloseAllDocumentsDialog {
|
||||
TextButton::new("Discard All")
|
||||
.emphasized(true)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![PortfolioMessage::CloseAllDocuments.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DialogClose.into()).widget_instance(),
|
||||
];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
|
||||
@@ -18,7 +18,7 @@ impl DialogLayoutHolder for CloseDocumentDialog {
|
||||
TextButton::new("Save")
|
||||
.emphasized(true)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![DocumentMessage::SaveDocument.into()],
|
||||
}
|
||||
.into()
|
||||
@@ -26,13 +26,13 @@ impl DialogLayoutHolder for CloseDocumentDialog {
|
||||
.widget_instance(),
|
||||
TextButton::new("Discard")
|
||||
.on_update(move |_| {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![EventMessage::ToolAbort.into(), PortfolioMessage::CloseDocument { document_id }.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
|
||||
TextButton::new("Cancel").on_update(|_| FrontendMessage::DialogClose.into()).widget_instance(),
|
||||
];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::prelude::*;
|
||||
|
||||
/// A dialog for confirming the restart of the application when changing a preference that requires a restart to take effect.
|
||||
pub struct ConfirmRestartDialog {
|
||||
pub changed_settings: Vec<String>,
|
||||
}
|
||||
|
||||
impl DialogLayoutHolder for ConfirmRestartDialog {
|
||||
const ICON: &'static str = "Warning";
|
||||
const TITLE: &'static str = "Restart Required";
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![
|
||||
TextButton::new("Restart Now")
|
||||
.emphasized(true)
|
||||
.on_update(|_| {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![AppWindowMessage::Restart.into()],
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance(),
|
||||
TextButton::new("Later").on_update(|_| FrontendMessage::DialogClose.into()).widget_instance(),
|
||||
];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
}
|
||||
}
|
||||
|
||||
impl LayoutHolder for ConfirmRestartDialog {
|
||||
fn layout(&self) -> Layout {
|
||||
let changed_settings = "• ".to_string() + &self.changed_settings.join("\n• ");
|
||||
|
||||
Layout(vec![
|
||||
LayoutGroup::Row {
|
||||
widgets: vec![TextLabel::new("Restart to apply changes?").bold(true).multiline(true).widget_instance()],
|
||||
},
|
||||
LayoutGroup::Row {
|
||||
widgets: vec![
|
||||
TextLabel::new(
|
||||
format!(
|
||||
"
|
||||
Settings that only take effect on next launch:\n\
|
||||
{changed_settings}\n\
|
||||
\n\
|
||||
This only takes a few seconds. Open documents,\n\
|
||||
even unsaved ones, will be automatically restored.
|
||||
"
|
||||
)
|
||||
.trim(),
|
||||
)
|
||||
.multiline(true)
|
||||
.widget_instance(),
|
||||
],
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ impl DialogLayoutHolder for DemoArtworkDialog {
|
||||
const TITLE: &'static str = "Demo Artwork";
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![TextButton::new("Close").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
|
||||
let widgets = vec![TextButton::new("Close").emphasized(true).on_update(|_| FrontendMessage::DialogClose.into()).widget_instance()];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
}
|
||||
@@ -32,7 +32,7 @@ impl LayoutHolder for DemoArtworkDialog {
|
||||
.chunks(4)
|
||||
.flat_map(|chunk| {
|
||||
fn make_dialog(name: &str, filename: &str) -> Message {
|
||||
DialogMessage::CloseDialogAndThen {
|
||||
DialogMessage::CloseAndThen {
|
||||
followups: vec![
|
||||
FrontendMessage::TriggerFetchAndOpenDocument {
|
||||
name: name.to_string(),
|
||||
|
||||
@@ -12,7 +12,7 @@ impl DialogLayoutHolder for ErrorDialog {
|
||||
const TITLE: &'static str = "Error";
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DialogClose.into()).widget_instance()];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ impl DialogLayoutHolder for LicensesDialog {
|
||||
const TITLE: &'static str = "Licenses";
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DialogClose.into()).widget_instance()];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ impl DialogLayoutHolder for LicensesThirdPartyDialog {
|
||||
const TITLE: &'static str = "Third-Party Software License Notices";
|
||||
|
||||
fn layout_buttons(&self) -> Layout {
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
|
||||
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DialogClose.into()).widget_instance()];
|
||||
|
||||
Layout(vec![LayoutGroup::Row { widgets }])
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
mod about_graphite_dialog;
|
||||
mod close_all_documents_dialog;
|
||||
mod close_document_dialog;
|
||||
mod confirm_restart_dialog;
|
||||
mod demo_artwork_dialog;
|
||||
mod error_dialog;
|
||||
mod licenses_dialog;
|
||||
@@ -9,6 +10,7 @@ mod licenses_third_party_dialog;
|
||||
pub use about_graphite_dialog::AboutGraphiteDialog;
|
||||
pub use close_all_documents_dialog::CloseAllDocumentsDialog;
|
||||
pub use close_document_dialog::CloseDocumentDialog;
|
||||
pub use confirm_restart_dialog::ConfirmRestartDialog;
|
||||
pub use demo_artwork_dialog::ARTWORK;
|
||||
pub use demo_artwork_dialog::DemoArtworkDialog;
|
||||
pub use error_dialog::ErrorDialog;
|
||||
|
||||
@@ -28,7 +28,7 @@ pub enum FrontendMessage {
|
||||
title: String,
|
||||
icon: String,
|
||||
},
|
||||
DisplayDialogDismiss,
|
||||
DialogClose,
|
||||
DisplayDialogPanic {
|
||||
#[serde(rename = "panicInfo")]
|
||||
panic_info: String,
|
||||
@@ -376,4 +376,7 @@ pub enum FrontendMessage {
|
||||
WindowHide,
|
||||
WindowHideOthers,
|
||||
WindowShowAll,
|
||||
WindowRestart,
|
||||
|
||||
TmpToggleHideUI,
|
||||
}
|
||||
@@ -60,6 +60,7 @@ pub fn input_mappings(zoom_with_scroll: bool) -> Mapping {
|
||||
entry!(KeyDown(F11); disabled=is_mac, action_dispatch=AppWindowMessage::Fullscreen),
|
||||
entry!(KeyDown(KeyF); modifiers=[Command, Control], disabled=!is_mac, action_dispatch=AppWindowMessage::Fullscreen),
|
||||
entry!(KeyDown(KeyQ); modifiers=[Command], disabled=cfg!(not(target_os = "macos")), action_dispatch=AppWindowMessage::Close),
|
||||
entry!(KeyDown(F11); modifiers=[Alt], action_dispatch=AppWindowMessage::TmpToggleHideUI),
|
||||
//
|
||||
// ClipboardMessage
|
||||
entry!(KeyDown(KeyX); modifiers=[Accel], action_dispatch=ClipboardMessage::Cut),
|
||||
@@ -74,7 +75,7 @@ pub fn input_mappings(zoom_with_scroll: bool) -> Mapping {
|
||||
entry!(KeyDown(MouseLeft); modifiers=[Alt], action_dispatch=NodeGraphMessage::PointerDown { shift_click: false, control_click: false, alt_click: true, right_click: false }),
|
||||
entry!(KeyDown(MouseRight); action_dispatch=NodeGraphMessage::PointerDown { shift_click: false, control_click: false, alt_click: false, right_click: true }),
|
||||
entry!(DoubleClick(MouseButton::Left); action_dispatch=NodeGraphMessage::EnterNestedNetwork),
|
||||
entry!(PointerMove; refresh_keys=[Shift], action_dispatch=NodeGraphMessage::PointerMove { shift: Shift }),
|
||||
entry!(PointerMove; refresh_keys=[Control, Alt, Shift], action_dispatch=NodeGraphMessage::PointerMove { shift: Shift }),
|
||||
entry!(PointerShake; action_dispatch=NodeGraphMessage::ShakeNode),
|
||||
entry!(KeyUp(MouseLeft); action_dispatch=NodeGraphMessage::PointerUp),
|
||||
entry!(KeyDown(Delete); modifiers=[Accel], action_dispatch=NodeGraphMessage::DeleteSelectedNodes { delete_children: false }),
|
||||
|
||||
@@ -717,7 +717,23 @@ impl TableRowLayout for Affine2 {
|
||||
}
|
||||
|
||||
fn format_transform_matrix(transform: &DAffine2) -> String {
|
||||
let (scale, angle, translation) = transform.to_scale_angle_translation();
|
||||
let (scale, angle, translation) = if transform.matrix2.determinant().abs() <= f64::EPSILON {
|
||||
let [col_0, col_1] = transform.matrix2.to_cols_array_2d().map(|[x, y]| DVec2::new(x, y));
|
||||
|
||||
let scale = DVec2::new(col_0.length(), col_1.length());
|
||||
|
||||
let rotation = if scale.x > f64::EPSILON {
|
||||
col_0.y.atan2(col_0.x)
|
||||
} else if scale.y > f64::EPSILON {
|
||||
col_1.y.atan2(col_1.x) - std::f64::consts::FRAC_PI_2
|
||||
} else {
|
||||
0.
|
||||
};
|
||||
|
||||
(scale, rotation, transform.translation)
|
||||
} else {
|
||||
transform.to_scale_angle_translation()
|
||||
};
|
||||
let rotation = if angle == -0. { 0. } else { angle.to_degrees() };
|
||||
let round = |x: f64| (x * 1e3).round() / 1e3;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ use graphene_std::Color;
|
||||
use graphene_std::raster::BlendMode;
|
||||
use graphene_std::raster::Image;
|
||||
use graphene_std::transform::Footprint;
|
||||
use graphene_std::vector::Vector;
|
||||
use graphene_std::vector::click_target::ClickTarget;
|
||||
use graphene_std::vector::style::RenderMode;
|
||||
|
||||
@@ -209,6 +210,9 @@ pub enum DocumentMessage {
|
||||
UpdateClipTargets {
|
||||
clip_targets: HashSet<NodeId>,
|
||||
},
|
||||
UpdateVectorData {
|
||||
vector_data: HashMap<NodeId, Arc<Vector>>,
|
||||
},
|
||||
Undo,
|
||||
UngroupSelectedLayers,
|
||||
UngroupLayer {
|
||||
|
||||
@@ -92,7 +92,6 @@ pub struct DocumentMessageHandler {
|
||||
pub document_ptz: PTZ,
|
||||
/// The current mode that the user has set for rendering the document within the viewport.
|
||||
/// This is usually "Normal" but can be set to "Outline" or "Pixels" to see the canvas differently.
|
||||
#[serde(alias = "view_mode")]
|
||||
pub render_mode: RenderMode,
|
||||
/// Sets whether or not all the viewport overlays should be drawn on top of the artwork.
|
||||
/// This includes tool interaction visualizations (like the transform cage and path anchors/handles), the grid, and more.
|
||||
@@ -623,145 +622,10 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
||||
responses.add(OverlaysMessage::Draw);
|
||||
}
|
||||
DocumentMessage::GroupSelectedLayers { group_folder_type } => {
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
let mut parent_per_selected_nodes: HashMap<LayerNodeIdentifier, Vec<NodeId>> = HashMap::new();
|
||||
let artboards = LayerNodeIdentifier::ROOT_PARENT
|
||||
.children(self.metadata())
|
||||
.filter(|x| self.network_interface.is_artboard(&x.to_node(), &self.selection_network_path))
|
||||
.collect::<Vec<_>>();
|
||||
let selected_nodes = self.network_interface.selected_nodes();
|
||||
|
||||
// Non-artboard (infinite canvas) workflow
|
||||
if artboards.is_empty() {
|
||||
let Some(parent) = self.network_interface.deepest_common_ancestor(&selected_nodes, &self.selection_network_path, false) else {
|
||||
return;
|
||||
};
|
||||
let Some(selected_nodes) = &self.network_interface.selected_nodes_in_nested_network(&self.selection_network_path) else {
|
||||
return;
|
||||
};
|
||||
let insert_index = DocumentMessageHandler::get_calculated_insert_index(self.metadata(), selected_nodes, parent);
|
||||
|
||||
DocumentMessageHandler::group_layers(responses, insert_index, parent, group_folder_type, &mut self.network_interface);
|
||||
}
|
||||
// Artboard workflow
|
||||
else {
|
||||
for artboard in artboards {
|
||||
let selected_descendants = artboard.descendants(self.metadata()).filter(|x| selected_nodes.selected_layers_contains(*x, self.metadata()));
|
||||
for selected_descendant in selected_descendants {
|
||||
parent_per_selected_nodes.entry(artboard).or_default().push(selected_descendant.to_node());
|
||||
}
|
||||
}
|
||||
|
||||
let mut new_folders: Vec<NodeId> = Vec::new();
|
||||
|
||||
for children in parent_per_selected_nodes.into_values() {
|
||||
let child_selected_nodes = SelectedNodes(children);
|
||||
let Some(parent) = self.network_interface.deepest_common_ancestor(&child_selected_nodes, &self.selection_network_path, false) else {
|
||||
continue;
|
||||
};
|
||||
let insert_index = DocumentMessageHandler::get_calculated_insert_index(self.metadata(), &child_selected_nodes, parent);
|
||||
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: child_selected_nodes.0 });
|
||||
|
||||
new_folders.push(DocumentMessageHandler::group_layers(responses, insert_index, parent, group_folder_type, &mut self.network_interface));
|
||||
}
|
||||
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: new_folders });
|
||||
}
|
||||
self.handle_group_selected_layers(group_folder_type, responses);
|
||||
}
|
||||
DocumentMessage::MoveSelectedLayersTo { parent, insert_index } => {
|
||||
if !self.selection_network_path.is_empty() {
|
||||
log::error!("Moving selected layers is only supported for the Document Network");
|
||||
return;
|
||||
}
|
||||
|
||||
// Disallow trying to insert into self.
|
||||
if self
|
||||
.network_interface
|
||||
.selected_nodes()
|
||||
.selected_layers(self.metadata())
|
||||
.any(|layer| parent.ancestors(self.metadata()).any(|ancestor| ancestor == layer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Artboards can only have `ROOT_PARENT` as the parent.
|
||||
let any_artboards = self
|
||||
.network_interface
|
||||
.selected_nodes()
|
||||
.selected_layers(self.metadata())
|
||||
.any(|layer| self.network_interface.is_artboard(&layer.to_node(), &self.selection_network_path));
|
||||
if any_artboards && parent != LayerNodeIdentifier::ROOT_PARENT {
|
||||
return;
|
||||
}
|
||||
|
||||
// Non-artboards cannot be put at the top level if artboards also exist there
|
||||
let selected_any_non_artboards = self
|
||||
.network_interface
|
||||
.selected_nodes()
|
||||
.selected_layers(self.metadata())
|
||||
.any(|layer| !self.network_interface.is_artboard(&layer.to_node(), &self.selection_network_path));
|
||||
|
||||
let top_level_artboards = LayerNodeIdentifier::ROOT_PARENT
|
||||
.children(self.metadata())
|
||||
.any(|layer| self.network_interface.is_artboard(&layer.to_node(), &self.selection_network_path));
|
||||
|
||||
if selected_any_non_artboards && parent == LayerNodeIdentifier::ROOT_PARENT && top_level_artboards {
|
||||
return;
|
||||
}
|
||||
|
||||
let layers_to_move = self.network_interface.shallowest_unique_layers_sorted(&self.selection_network_path);
|
||||
// Offset the index for layers to move that are below another layer to move. For example when moving 1 and 2 between 3 and 4, 2 should be inserted at the same index as 1 since 1 is moved first.
|
||||
let layers_to_move_with_insert_offset = layers_to_move
|
||||
.iter()
|
||||
.map(|layer| {
|
||||
if layer.parent(self.metadata()) != Some(parent) {
|
||||
return (*layer, 0);
|
||||
}
|
||||
|
||||
let upstream_selected_siblings = layer
|
||||
.downstream_siblings(self.network_interface.document_metadata())
|
||||
.filter(|sibling| {
|
||||
sibling != layer
|
||||
&& layers_to_move.iter().any(|layer| {
|
||||
layer == sibling
|
||||
&& layer
|
||||
.parent(self.metadata())
|
||||
.is_some_and(|parent| parent.children(self.metadata()).position(|child| child == *layer) < Some(insert_index))
|
||||
})
|
||||
})
|
||||
.count();
|
||||
(*layer, upstream_selected_siblings)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
for (layer_index, (layer_to_move, insert_offset)) in layers_to_move_with_insert_offset.into_iter().enumerate() {
|
||||
responses.add(NodeGraphMessage::MoveLayerToStack {
|
||||
layer: layer_to_move,
|
||||
parent,
|
||||
insert_index: insert_index + layer_index - insert_offset,
|
||||
});
|
||||
|
||||
if layer_to_move.parent(self.metadata()) != Some(parent) {
|
||||
// TODO: Fix this so it works when dragging a layer into a group parent which has a Transform node, which used to work before #2689 caused this regression by removing the empty vector table row.
|
||||
// TODO: See #2688 for this issue.
|
||||
let layer_local_transform = self.network_interface.document_metadata().transform_to_viewport(layer_to_move);
|
||||
let undo_transform = self.network_interface.document_metadata().transform_to_viewport(parent).inverse();
|
||||
let transform = undo_transform * layer_local_transform;
|
||||
|
||||
responses.add(GraphOperationMessage::TransformSet {
|
||||
layer: layer_to_move,
|
||||
transform,
|
||||
transform_in: TransformIn::Local,
|
||||
skip_rerender: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||
responses.add(NodeGraphMessage::SendGraph);
|
||||
self.handle_move_selected_layers_to(parent, insert_index, responses);
|
||||
}
|
||||
DocumentMessage::MoveSelectedLayersToGroup { parent } => {
|
||||
// Group all shallowest unique selected layers in order
|
||||
@@ -786,83 +650,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
||||
resize,
|
||||
resize_opposite_corner,
|
||||
} => {
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
let resize = ipp.keyboard.key(resize);
|
||||
let resize_opposite_corner = ipp.keyboard.key(resize_opposite_corner);
|
||||
|
||||
let can_move = |layer| {
|
||||
let selected = self.network_interface.selected_nodes();
|
||||
selected.layer_visible(layer, &self.network_interface) && !selected.layer_locked(layer, &self.network_interface)
|
||||
};
|
||||
|
||||
// Nudge translation without resizing
|
||||
if !resize {
|
||||
let transform = DAffine2::from_translation(DVec2::from_angle(-self.document_ptz.tilt()).rotate(DVec2::new(delta_x, delta_y)));
|
||||
responses.add(SelectToolMessage::ShiftSelectedNodes { offset: transform.translation });
|
||||
|
||||
for layer in self.network_interface.shallowest_unique_layers(&[]).filter(|layer| can_move(*layer)) {
|
||||
responses.add(GraphOperationMessage::TransformChange {
|
||||
layer,
|
||||
transform,
|
||||
transform_in: TransformIn::Local,
|
||||
skip_rerender: false,
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let selected_bounding_box = self.network_interface.selected_bounds_document_space(false, &[]);
|
||||
let Some([existing_top_left, existing_bottom_right]) = selected_bounding_box else { return };
|
||||
|
||||
// Swap and negate coordinates as needed to match the resize direction that's closest to the current tilt angle
|
||||
let tilt = (self.document_ptz.tilt() + std::f64::consts::TAU) % std::f64::consts::TAU;
|
||||
let (delta_x, delta_y, opposite_x, opposite_y) = match ((tilt + std::f64::consts::FRAC_PI_4) / std::f64::consts::FRAC_PI_2).floor() as i32 % 4 {
|
||||
0 => (delta_x, delta_y, false, false),
|
||||
1 => (delta_y, -delta_x, false, true),
|
||||
2 => (-delta_x, -delta_y, true, true),
|
||||
3 => (-delta_y, delta_x, true, false),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let size = existing_bottom_right - existing_top_left;
|
||||
// TODO: This is a hacky band-aid. It still results in the shape becoming zero-sized. Properly fix this using the correct math.
|
||||
// If size is zero we clamp it to minimun value to avoid dividing by zero vector to calculate enlargement.
|
||||
let size = size.max(DVec2::ONE);
|
||||
let enlargement = DVec2::new(
|
||||
if resize_opposite_corner != opposite_x { -delta_x } else { delta_x },
|
||||
if resize_opposite_corner != opposite_y { -delta_y } else { delta_y },
|
||||
);
|
||||
let enlargement_factor = (enlargement + size) / size;
|
||||
|
||||
let position = DVec2::new(
|
||||
existing_top_left.x + if resize_opposite_corner != opposite_x { delta_x } else { 0. },
|
||||
existing_top_left.y + if resize_opposite_corner != opposite_y { delta_y } else { 0. },
|
||||
);
|
||||
let mut pivot = (existing_top_left * enlargement_factor - position) / (enlargement_factor - DVec2::ONE);
|
||||
if !pivot.x.is_finite() {
|
||||
pivot.x = 0.;
|
||||
}
|
||||
if !pivot.y.is_finite() {
|
||||
pivot.y = 0.;
|
||||
}
|
||||
let scale = DAffine2::from_scale(enlargement_factor);
|
||||
let pivot = DAffine2::from_translation(pivot);
|
||||
let transformation = pivot * scale * pivot.inverse();
|
||||
let document_to_viewport = self.navigation_handler.calculate_offset_transform(viewport.center_in_viewport_space().into(), &self.document_ptz);
|
||||
|
||||
for layer in self.network_interface.shallowest_unique_layers(&[]).filter(|layer| can_move(*layer)) {
|
||||
let to = document_to_viewport.inverse() * self.metadata().downstream_transform_to_viewport(layer);
|
||||
let original_transform = self.metadata().upstream_transform(layer.to_node());
|
||||
let new = to.inverse() * transformation * to * original_transform;
|
||||
responses.add(GraphOperationMessage::TransformSet {
|
||||
layer,
|
||||
transform: new,
|
||||
transform_in: TransformIn::Local,
|
||||
skip_rerender: false,
|
||||
});
|
||||
}
|
||||
self.handle_nudge_selected_layers(delta_x, delta_y, resize, resize_opposite_corner, ipp, viewport, responses);
|
||||
}
|
||||
DocumentMessage::PasteImage {
|
||||
name,
|
||||
@@ -1028,7 +816,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
||||
let viewport_size = viewport.size().into_dvec2();
|
||||
let viewport_mid = viewport.center_in_viewport_space().into_dvec2();
|
||||
let [bounds1, bounds2] = if !self.graph_view_overlay_open {
|
||||
self.metadata().document_bounds_viewport_space().unwrap_or([viewport_mid; 2])
|
||||
self.network_interface.document_bounds_viewport_space(true).unwrap_or([viewport_mid; 2])
|
||||
} else {
|
||||
self.network_interface.graph_bounds_viewport_space(&self.breadcrumb_network_path).unwrap_or([viewport_mid; 2])
|
||||
};
|
||||
@@ -1424,6 +1212,20 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
||||
DocumentMessage::UpdateClipTargets { clip_targets } => {
|
||||
self.network_interface.update_clip_targets(clip_targets);
|
||||
}
|
||||
DocumentMessage::UpdateVectorData { vector_data } => {
|
||||
// Convert NodeId keys to LayerNodeIdentifier keys, filtering to only layers
|
||||
let layer_vector_data = vector_data
|
||||
.into_iter()
|
||||
.filter(|(node_id, _)| self.network_interface.document_network().nodes.contains_key(node_id))
|
||||
.filter_map(|(node_id, vector)| {
|
||||
self.network_interface.is_layer(&node_id, &[]).then(|| {
|
||||
let layer = LayerNodeIdentifier::new(node_id, &self.network_interface);
|
||||
(layer, vector)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
self.network_interface.update_vector_data(layer_vector_data);
|
||||
}
|
||||
DocumentMessage::Undo => {
|
||||
if self.network_interface.transaction_status() != TransactionStatus::Finished {
|
||||
return;
|
||||
@@ -1600,7 +1402,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
|
||||
responses.add(NavigationMessage::CanvasFlip);
|
||||
}
|
||||
responses.add(NavigationMessage::CanvasTiltSet { angle_radians: 0. });
|
||||
responses.add(NavigationMessage::FitViewportToBounds { bounds, prevent_zoom_past_100: true });
|
||||
responses.add(NavigationMessage::FitViewportToBounds { bounds, prevent_zoom_past_100: false });
|
||||
} else {
|
||||
warn!("Cannot zoom due to no bounds")
|
||||
}
|
||||
@@ -2127,6 +1929,244 @@ impl DocumentMessageHandler {
|
||||
folder_id
|
||||
}
|
||||
|
||||
/// Helper method for GroupSelectedLayers message.
|
||||
/// Handles grouping layers in both artboard and non-artboard workflows.
|
||||
fn handle_group_selected_layers(&mut self, group_folder_type: GroupFolderType, responses: &mut VecDeque<Message>) {
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
let mut parent_per_selected_nodes: HashMap<LayerNodeIdentifier, Vec<NodeId>> = HashMap::new();
|
||||
let artboards = LayerNodeIdentifier::ROOT_PARENT
|
||||
.children(self.metadata())
|
||||
.filter(|x| self.network_interface.is_artboard(&x.to_node(), &self.selection_network_path))
|
||||
.collect::<Vec<_>>();
|
||||
let selected_nodes = self.network_interface.selected_nodes();
|
||||
|
||||
// Non-artboard (infinite canvas) workflow
|
||||
if artboards.is_empty() {
|
||||
let Some(parent) = self.network_interface.deepest_common_ancestor(&selected_nodes, &self.selection_network_path, false) else {
|
||||
return;
|
||||
};
|
||||
let Some(selected_nodes) = &self.network_interface.selected_nodes_in_nested_network(&self.selection_network_path) else {
|
||||
return;
|
||||
};
|
||||
let insert_index = DocumentMessageHandler::get_calculated_insert_index(self.metadata(), selected_nodes, parent);
|
||||
|
||||
DocumentMessageHandler::group_layers(responses, insert_index, parent, group_folder_type, &mut self.network_interface);
|
||||
}
|
||||
// Artboard workflow
|
||||
else {
|
||||
for artboard in artboards {
|
||||
let selected_descendants = artboard.descendants(self.metadata()).filter(|x| selected_nodes.selected_layers_contains(*x, self.metadata()));
|
||||
for selected_descendant in selected_descendants {
|
||||
parent_per_selected_nodes.entry(artboard).or_default().push(selected_descendant.to_node());
|
||||
}
|
||||
}
|
||||
|
||||
let mut new_folders: Vec<NodeId> = Vec::new();
|
||||
|
||||
for children in parent_per_selected_nodes.into_values() {
|
||||
let child_selected_nodes = SelectedNodes(children);
|
||||
let Some(parent) = self.network_interface.deepest_common_ancestor(&child_selected_nodes, &self.selection_network_path, false) else {
|
||||
continue;
|
||||
};
|
||||
let insert_index = DocumentMessageHandler::get_calculated_insert_index(self.metadata(), &child_selected_nodes, parent);
|
||||
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: child_selected_nodes.0 });
|
||||
|
||||
new_folders.push(DocumentMessageHandler::group_layers(responses, insert_index, parent, group_folder_type, &mut self.network_interface));
|
||||
}
|
||||
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: new_folders });
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper method for MoveSelectedLayersTo message.
|
||||
/// Handles moving selected layers to a new parent with proper transform preservation.
|
||||
fn handle_move_selected_layers_to(&mut self, parent: LayerNodeIdentifier, insert_index: usize, responses: &mut VecDeque<Message>) {
|
||||
if !self.selection_network_path.is_empty() {
|
||||
log::error!("Moving selected layers is only supported for the Document Network");
|
||||
return;
|
||||
}
|
||||
|
||||
// Disallow trying to insert into self.
|
||||
if self
|
||||
.network_interface
|
||||
.selected_nodes()
|
||||
.selected_layers(self.metadata())
|
||||
.any(|layer| parent.ancestors(self.metadata()).any(|ancestor| ancestor == layer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Artboards can only have `ROOT_PARENT` as the parent.
|
||||
let any_artboards = self
|
||||
.network_interface
|
||||
.selected_nodes()
|
||||
.selected_layers(self.metadata())
|
||||
.any(|layer| self.network_interface.is_artboard(&layer.to_node(), &self.selection_network_path));
|
||||
if any_artboards && parent != LayerNodeIdentifier::ROOT_PARENT {
|
||||
return;
|
||||
}
|
||||
|
||||
// Non-artboards cannot be put at the top level if artboards also exist there
|
||||
let selected_any_non_artboards = self
|
||||
.network_interface
|
||||
.selected_nodes()
|
||||
.selected_layers(self.metadata())
|
||||
.any(|layer| !self.network_interface.is_artboard(&layer.to_node(), &self.selection_network_path));
|
||||
|
||||
let top_level_artboards = LayerNodeIdentifier::ROOT_PARENT
|
||||
.children(self.metadata())
|
||||
.any(|layer| self.network_interface.is_artboard(&layer.to_node(), &self.selection_network_path));
|
||||
|
||||
if selected_any_non_artboards && parent == LayerNodeIdentifier::ROOT_PARENT && top_level_artboards {
|
||||
return;
|
||||
}
|
||||
|
||||
let layers_to_move = self.network_interface.shallowest_unique_layers_sorted(&self.selection_network_path);
|
||||
// Offset the index for layers to move that are below another layer to move. For example when moving 1 and 2 between 3 and 4, 2 should be inserted at the same index as 1 since 1 is moved first.
|
||||
let layers_to_move_with_insert_offset = layers_to_move
|
||||
.iter()
|
||||
.map(|layer| {
|
||||
if layer.parent(self.metadata()) != Some(parent) {
|
||||
return (*layer, 0);
|
||||
}
|
||||
|
||||
let upstream_selected_siblings = layer
|
||||
.downstream_siblings(self.network_interface.document_metadata())
|
||||
.filter(|sibling| {
|
||||
sibling != layer
|
||||
&& layers_to_move.iter().any(|layer| {
|
||||
layer == sibling
|
||||
&& layer
|
||||
.parent(self.metadata())
|
||||
.is_some_and(|parent| parent.children(self.metadata()).position(|child| child == *layer) < Some(insert_index))
|
||||
})
|
||||
})
|
||||
.count();
|
||||
(*layer, upstream_selected_siblings)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
for (layer_index, (layer_to_move, insert_offset)) in layers_to_move_with_insert_offset.into_iter().enumerate() {
|
||||
responses.add(NodeGraphMessage::MoveLayerToStack {
|
||||
layer: layer_to_move,
|
||||
parent,
|
||||
insert_index: insert_index + layer_index - insert_offset,
|
||||
});
|
||||
|
||||
if layer_to_move.parent(self.metadata()) != Some(parent) {
|
||||
// TODO: Fix this so it works when dragging a layer into a group parent which has a Transform node, which used to work before #2689 caused this regression by removing the empty vector table row.
|
||||
// TODO: See #2688 for this issue.
|
||||
let layer_local_transform = self.network_interface.document_metadata().transform_to_viewport(layer_to_move);
|
||||
let undo_transform = self.network_interface.document_metadata().transform_to_viewport(parent).inverse();
|
||||
let transform = undo_transform * layer_local_transform;
|
||||
|
||||
responses.add(GraphOperationMessage::TransformSet {
|
||||
layer: layer_to_move,
|
||||
transform,
|
||||
transform_in: TransformIn::Local,
|
||||
skip_rerender: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||
responses.add(NodeGraphMessage::SendGraph);
|
||||
}
|
||||
|
||||
/// Helper method for NudgeSelectedLayers message.
|
||||
/// Handles keyboard nudging of selected layers with optional resize mode.
|
||||
fn handle_nudge_selected_layers(
|
||||
&mut self,
|
||||
delta_x: f64,
|
||||
delta_y: f64,
|
||||
resize: Key,
|
||||
resize_opposite_corner: Key,
|
||||
ipp: &InputPreprocessorMessageHandler,
|
||||
viewport: &ViewportMessageHandler,
|
||||
responses: &mut VecDeque<Message>,
|
||||
) {
|
||||
responses.add(DocumentMessage::AddTransaction);
|
||||
|
||||
let resize = ipp.keyboard.key(resize);
|
||||
let resize_opposite_corner = ipp.keyboard.key(resize_opposite_corner);
|
||||
|
||||
let can_move = |layer| {
|
||||
let selected = self.network_interface.selected_nodes();
|
||||
selected.layer_visible(layer, &self.network_interface) && !selected.layer_locked(layer, &self.network_interface)
|
||||
};
|
||||
|
||||
// Nudge translation without resizing
|
||||
if !resize {
|
||||
let transform = DAffine2::from_translation(DVec2::from_angle(-self.document_ptz.tilt()).rotate(DVec2::new(delta_x, delta_y)));
|
||||
responses.add(SelectToolMessage::ShiftSelectedNodes { offset: transform.translation });
|
||||
|
||||
for layer in self.network_interface.shallowest_unique_layers(&[]).filter(|layer| can_move(*layer)) {
|
||||
responses.add(GraphOperationMessage::TransformChange {
|
||||
layer,
|
||||
transform,
|
||||
transform_in: TransformIn::Local,
|
||||
skip_rerender: false,
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let selected_bounding_box = self.network_interface.selected_bounds_document_space(false, &[]);
|
||||
let Some([existing_top_left, existing_bottom_right]) = selected_bounding_box else { return };
|
||||
|
||||
// Swap and negate coordinates as needed to match the resize direction that's closest to the current tilt angle
|
||||
let tilt = (self.document_ptz.tilt() + std::f64::consts::TAU) % std::f64::consts::TAU;
|
||||
let (delta_x, delta_y, opposite_x, opposite_y) = match ((tilt + std::f64::consts::FRAC_PI_4) / std::f64::consts::FRAC_PI_2).floor() as i32 % 4 {
|
||||
0 => (delta_x, delta_y, false, false),
|
||||
1 => (delta_y, -delta_x, false, true),
|
||||
2 => (-delta_x, -delta_y, true, true),
|
||||
3 => (-delta_y, delta_x, true, false),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let size = existing_bottom_right - existing_top_left;
|
||||
// TODO: This is a hacky band-aid. It still results in the shape becoming zero-sized. Properly fix this using the correct math.
|
||||
// If size is zero we clamp it to minimun value to avoid dividing by zero vector to calculate enlargement.
|
||||
let size = size.max(DVec2::ONE);
|
||||
let enlargement = DVec2::new(
|
||||
if resize_opposite_corner != opposite_x { -delta_x } else { delta_x },
|
||||
if resize_opposite_corner != opposite_y { -delta_y } else { delta_y },
|
||||
);
|
||||
let enlargement_factor = (enlargement + size) / size;
|
||||
|
||||
let position = DVec2::new(
|
||||
existing_top_left.x + if resize_opposite_corner != opposite_x { delta_x } else { 0. },
|
||||
existing_top_left.y + if resize_opposite_corner != opposite_y { delta_y } else { 0. },
|
||||
);
|
||||
let mut pivot = (existing_top_left * enlargement_factor - position) / (enlargement_factor - DVec2::ONE);
|
||||
if !pivot.x.is_finite() {
|
||||
pivot.x = 0.;
|
||||
}
|
||||
if !pivot.y.is_finite() {
|
||||
pivot.y = 0.;
|
||||
}
|
||||
let scale = DAffine2::from_scale(enlargement_factor);
|
||||
let pivot = DAffine2::from_translation(pivot);
|
||||
let transformation = pivot * scale * pivot.inverse();
|
||||
let document_to_viewport = self.navigation_handler.calculate_offset_transform(viewport.center_in_viewport_space().into(), &self.document_ptz);
|
||||
|
||||
for layer in self.network_interface.shallowest_unique_layers(&[]).filter(|layer| can_move(*layer)) {
|
||||
let to = document_to_viewport.inverse() * self.metadata().downstream_transform_to_viewport(layer);
|
||||
let original_transform = self.metadata().upstream_transform(layer.to_node());
|
||||
let new = to.inverse() * transformation * to * original_transform;
|
||||
responses.add(GraphOperationMessage::TransformSet {
|
||||
layer,
|
||||
transform: new,
|
||||
transform_in: TransformIn::Local,
|
||||
skip_rerender: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Loads all of the fonts in the document.
|
||||
pub fn load_layer_resources(&self, responses: &mut VecDeque<Message>) {
|
||||
let mut fonts_to_load = HashSet::new();
|
||||
|
||||
+16
-41
@@ -388,7 +388,7 @@ fn import_usvg_node(modify_inputs: &mut ModifyInputsContext, node: &usvg::Node,
|
||||
|
||||
if let Some(fill) = path.fill() {
|
||||
let bounds_transform = DAffine2::from_scale_angle_translation(bounds[1] - bounds[0], 0., bounds[0]);
|
||||
apply_usvg_fill(fill, modify_inputs, transform * usvg_transform(node.abs_transform()), bounds_transform);
|
||||
apply_usvg_fill(fill, modify_inputs, bounds_transform);
|
||||
}
|
||||
if let Some(stroke) = path.stroke() {
|
||||
apply_usvg_stroke(stroke, modify_inputs, transform * usvg_transform(node.abs_transform()));
|
||||
@@ -432,63 +432,38 @@ fn apply_usvg_stroke(stroke: &usvg::Stroke, modify_inputs: &mut ModifyInputsCont
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_usvg_fill(fill: &usvg::Fill, modify_inputs: &mut ModifyInputsContext, transform: DAffine2, bounds_transform: DAffine2) {
|
||||
fn apply_usvg_fill(fill: &usvg::Fill, modify_inputs: &mut ModifyInputsContext, bounds_transform: DAffine2) {
|
||||
modify_inputs.fill_set(match &fill.paint() {
|
||||
usvg::Paint::Color(color) => Fill::solid(usvg_color(*color, fill.opacity().get())),
|
||||
usvg::Paint::LinearGradient(linear) => {
|
||||
let local = [DVec2::new(linear.x1() as f64, linear.y1() as f64), DVec2::new(linear.x2() as f64, linear.y2() as f64)];
|
||||
let gradient_transform = usvg_transform(linear.transform());
|
||||
let (start, end) = (DVec2::new(linear.x1() as f64, linear.y1() as f64), DVec2::new(linear.x2() as f64, linear.y2() as f64));
|
||||
let (start, end) = (gradient_transform.transform_point2(start), gradient_transform.transform_point2(end));
|
||||
let (start, end) = (bounds_transform.inverse().transform_point2(start), bounds_transform.inverse().transform_point2(end));
|
||||
|
||||
// TODO: fix this
|
||||
// let to_doc_transform = if linear.base.units() == usvg::Units::UserSpaceOnUse {
|
||||
// transform
|
||||
// } else {
|
||||
// transformed_bound_transform
|
||||
// };
|
||||
let to_doc_transform = transform;
|
||||
let to_doc = to_doc_transform * usvg_transform(linear.transform());
|
||||
let gradient_type = GradientType::Linear;
|
||||
|
||||
let document = [to_doc.transform_point2(local[0]), to_doc.transform_point2(local[1])];
|
||||
let layer = [transform.inverse().transform_point2(document[0]), transform.inverse().transform_point2(document[1])];
|
||||
|
||||
let [start, end] = [bounds_transform.inverse().transform_point2(layer[0]), bounds_transform.inverse().transform_point2(layer[1])];
|
||||
let stops = linear.stops().iter().map(|stop| (stop.offset().get() as f64, usvg_color(stop.color(), stop.opacity().get()))).collect();
|
||||
let stops = GradientStops::new(stops);
|
||||
|
||||
Fill::Gradient(Gradient {
|
||||
start,
|
||||
end,
|
||||
gradient_type: GradientType::Linear,
|
||||
stops,
|
||||
})
|
||||
Fill::Gradient(Gradient { start, end, gradient_type, stops })
|
||||
}
|
||||
usvg::Paint::RadialGradient(radial) => {
|
||||
let local = [DVec2::new(radial.cx() as f64, radial.cy() as f64), DVec2::new(radial.fx() as f64, radial.fy() as f64)];
|
||||
let gradient_transform = usvg_transform(radial.transform());
|
||||
let center = DVec2::new(radial.cx() as f64, radial.cy() as f64);
|
||||
let edge = center + DVec2::X * radial.r().get() as f64;
|
||||
let (start, end) = (gradient_transform.transform_point2(center), gradient_transform.transform_point2(edge));
|
||||
let (start, end) = (bounds_transform.inverse().transform_point2(start), bounds_transform.inverse().transform_point2(end));
|
||||
|
||||
// TODO: fix this
|
||||
// let to_doc_transform = if radial.base.units == usvg::Units::UserSpaceOnUse {
|
||||
// transform
|
||||
// } else {
|
||||
// transformed_bound_transform
|
||||
// };
|
||||
let to_doc_transform = transform;
|
||||
let to_doc = to_doc_transform * usvg_transform(radial.transform());
|
||||
let gradient_type = GradientType::Radial;
|
||||
|
||||
let document = [to_doc.transform_point2(local[0]), to_doc.transform_point2(local[1])];
|
||||
let layer = [transform.inverse().transform_point2(document[0]), transform.inverse().transform_point2(document[1])];
|
||||
|
||||
let [start, end] = [bounds_transform.inverse().transform_point2(layer[0]), bounds_transform.inverse().transform_point2(layer[1])];
|
||||
let stops = radial.stops().iter().map(|stop| (stop.offset().get() as f64, usvg_color(stop.color(), stop.opacity().get()))).collect();
|
||||
let stops = GradientStops::new(stops);
|
||||
|
||||
Fill::Gradient(Gradient {
|
||||
start,
|
||||
end,
|
||||
gradient_type: GradientType::Radial,
|
||||
stops,
|
||||
})
|
||||
Fill::Gradient(Gradient { start, end, gradient_type, stops })
|
||||
}
|
||||
usvg::Paint::Pattern(_) => {
|
||||
warn!("Skip pattern");
|
||||
warn!("SVG patterns are not currently supported");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -170,15 +170,6 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
self.network_interface.move_node_to_chain_start(&transform_id, layer, &[]);
|
||||
}
|
||||
|
||||
if include_fill {
|
||||
let fill = resolve_proto_node_type(graphene_std::vector_nodes::fill::IDENTIFIER)
|
||||
.expect("Fill node does not exist")
|
||||
.default_node_template();
|
||||
let fill_id = NodeId::new();
|
||||
self.network_interface.insert_node(fill_id, fill, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&fill_id, layer, &[]);
|
||||
}
|
||||
|
||||
if include_stroke {
|
||||
let stroke = resolve_proto_node_type(graphene_std::vector_nodes::stroke::IDENTIFIER)
|
||||
.expect("Stroke node does not exist")
|
||||
@@ -187,16 +178,18 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
self.network_interface.insert_node(stroke_id, stroke, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&stroke_id, layer, &[]);
|
||||
}
|
||||
|
||||
if include_fill {
|
||||
let fill = resolve_proto_node_type(graphene_std::vector_nodes::fill::IDENTIFIER)
|
||||
.expect("Fill node does not exist")
|
||||
.default_node_template();
|
||||
let fill_id = NodeId::new();
|
||||
self.network_interface.insert_node(fill_id, fill, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&fill_id, layer, &[]);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert_text(&mut self, text: String, font: Font, typesetting: TypesettingConfig, layer: LayerNodeIdentifier) {
|
||||
let stroke = resolve_proto_node_type(graphene_std::vector_nodes::stroke::IDENTIFIER)
|
||||
.expect("Stroke node does not exist")
|
||||
.default_node_template();
|
||||
let fill = resolve_proto_node_type(graphene_std::vector_nodes::fill::IDENTIFIER)
|
||||
.expect("Fill node does not exist")
|
||||
.default_node_template();
|
||||
let transform = resolve_network_node_type("Transform").expect("Transform node does not exist").default_node_template();
|
||||
let text = resolve_proto_node_type(graphene_std::text::text::IDENTIFIER)
|
||||
.expect("Text node does not exist")
|
||||
.node_template_input_override([
|
||||
@@ -213,6 +206,13 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
Some(NodeInput::value(TaggedValue::F64(typesetting.tilt), false)),
|
||||
Some(NodeInput::value(TaggedValue::TextAlign(typesetting.align), false)),
|
||||
]);
|
||||
let transform = resolve_network_node_type("Transform").expect("Transform node does not exist").default_node_template();
|
||||
let stroke = resolve_proto_node_type(graphene_std::vector_nodes::stroke::IDENTIFIER)
|
||||
.expect("Stroke node does not exist")
|
||||
.default_node_template();
|
||||
let fill = resolve_proto_node_type(graphene_std::vector_nodes::fill::IDENTIFIER)
|
||||
.expect("Fill node does not exist")
|
||||
.default_node_template();
|
||||
|
||||
let text_id = NodeId::new();
|
||||
self.network_interface.insert_node(text_id, text, &[]);
|
||||
@@ -222,13 +222,13 @@ impl<'a> ModifyInputsContext<'a> {
|
||||
self.network_interface.insert_node(transform_id, transform, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&transform_id, layer, &[]);
|
||||
|
||||
let fill_id = NodeId::new();
|
||||
self.network_interface.insert_node(fill_id, fill, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&fill_id, layer, &[]);
|
||||
|
||||
let stroke_id = NodeId::new();
|
||||
self.network_interface.insert_node(stroke_id, stroke, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&stroke_id, layer, &[]);
|
||||
|
||||
let fill_id = NodeId::new();
|
||||
self.network_interface.insert_node(fill_id, fill, &[]);
|
||||
self.network_interface.move_node_to_chain_start(&fill_id, layer, &[]);
|
||||
}
|
||||
|
||||
pub fn insert_image_data(&mut self, image_frame: Table<Raster<CPU>>, layer: LayerNodeIdentifier) {
|
||||
|
||||
@@ -239,7 +239,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
|
||||
}
|
||||
let document_bounds = if !graph_view_overlay_open {
|
||||
// TODO: Cache this in node graph coordinates and apply the transform to the rectangle to get viewport coordinates
|
||||
network_interface.document_metadata().document_bounds_viewport_space()
|
||||
network_interface.document_bounds_viewport_space(true)
|
||||
} else {
|
||||
network_interface.graph_bounds_viewport_space(breadcrumb_network_path)
|
||||
};
|
||||
@@ -257,7 +257,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
|
||||
NavigationMessage::CanvasZoomSet { zoom_factor } => {
|
||||
let document_bounds = if !graph_view_overlay_open {
|
||||
// TODO: Cache this in node graph coordinates and apply the transform to the rectangle to get viewport coordinates
|
||||
network_interface.document_metadata().document_bounds_viewport_space()
|
||||
network_interface.document_bounds_viewport_space(true)
|
||||
} else {
|
||||
network_interface.graph_bounds_viewport_space(breadcrumb_network_path)
|
||||
};
|
||||
@@ -454,7 +454,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
|
||||
|
||||
let document_bounds = if !graph_view_overlay_open {
|
||||
// TODO: Cache this in node graph coordinates and apply the transform to the rectangle to get viewport coordinates
|
||||
network_interface.document_metadata().document_bounds_viewport_space()
|
||||
network_interface.document_bounds_viewport_space(true)
|
||||
} else {
|
||||
network_interface.graph_bounds_viewport_space(breadcrumb_network_path)
|
||||
};
|
||||
|
||||
@@ -466,22 +466,22 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
// [IMPORTS]2 -> 0[0:Floor]
|
||||
// [0:Floor]0 -> 0[1:Subtract]
|
||||
// "1: f64" -> 1[1:Subtract]
|
||||
// "(): ()" -> 0[2:Instance Index]
|
||||
// "0: u32" -> 1[2:Instance Index]
|
||||
// [2:Instance Index]0 -> 0[3:Divide]
|
||||
// "(): ()" -> 0[2:Read Index]
|
||||
// "0: u32" -> 1[2:Read Index]
|
||||
// [2:Read Index]0 -> 0[3:Divide]
|
||||
// [1:Subtract]0 -> 1[3:Divide]
|
||||
// [IMPORTS]1 -> 0[4:Position on Path]
|
||||
// [3:Divide]0 -> 1[4:Position on Path]
|
||||
// "false: bool" -> 2[4:Position on Path]
|
||||
// "false: bool" -> 3[4:Position on Path]
|
||||
// "(): ()" -> 0[5:Instance Vector]
|
||||
// [5:Instance Vector]0 -> 0[6:Reset Transform]
|
||||
// "(): ()" -> 0[5:Read Vector]
|
||||
// [5:Read Vector]0 -> 0[6:Reset Transform]
|
||||
// "true: bool" -> 1[6:Reset Transform]
|
||||
// "false: bool" -> 2[6:Reset Transform]
|
||||
// "false: bool" -> 3[6:Reset Transform]
|
||||
// [12:Flatten Vector]0 -> 0[7:Instance Map]
|
||||
// [6:Reset Transform]0 -> 1[7:Instance Map]
|
||||
// [7:Instance Map]0 -> 0[8:Morph]
|
||||
// [12:Flatten Vector]0 -> 0[7:Map]
|
||||
// [6:Reset Transform]0 -> 1[7:Map]
|
||||
// [7:Map]0 -> 0[8:Morph]
|
||||
// [15:Multiply]0 -> 1[8:Morph]
|
||||
// [8:Morph]0 -> 0[9:Transform]
|
||||
// [4:Position on Path]0 -> 1[9:Transform]
|
||||
@@ -502,10 +502,10 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
// [11:Equals]0 -> 0[17:Switch]
|
||||
// [9:Transform]0 -> 1[17:Switch]
|
||||
// [16:Morph]0 -> 2[17:Switch]
|
||||
// [17:Switch]0 -> 0[18:Instance Repeat]
|
||||
// [0:Floor]0 -> 1[18:Instance Repeat]
|
||||
// [IMPORTS]3 -> 2[18:Instance Repeat]
|
||||
// [18:Instance Repeat]0 -> 0[EXPORTS]
|
||||
// [17:Switch]0 -> 0[18:Repeat]
|
||||
// [0:Floor]0 -> 1[18:Repeat]
|
||||
// [IMPORTS]3 -> 2[18:Repeat]
|
||||
// [18:Repeat]0 -> 0[EXPORTS]
|
||||
node_template: NodeTemplate {
|
||||
document_node: DocumentNode {
|
||||
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||
@@ -523,9 +523,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
inputs: vec![NodeInput::node(NodeId(0), 0), NodeInput::value(TaggedValue::F64(1.), false)],
|
||||
..Default::default()
|
||||
},
|
||||
// 2: Instance Index
|
||||
// 2: Read Index
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::instance_index::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(context::read_index::IDENTIFIER),
|
||||
inputs: vec![NodeInput::value(TaggedValue::None, false), NodeInput::value(TaggedValue::U32(0), false)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -546,9 +546,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
// 5: Instance Vector
|
||||
// 5: Read Vector
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::instance_vector::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(context::read_vector::IDENTIFIER),
|
||||
inputs: vec![NodeInput::value(TaggedValue::None, false)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -563,9 +563,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
// 7: Instance Map
|
||||
// 7: Map
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::instance_map::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(graphic::map::IDENTIFIER),
|
||||
inputs: vec![NodeInput::node(NodeId(12), 0), NodeInput::node(NodeId(6), 0)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -635,9 +635,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
inputs: vec![NodeInput::node(NodeId(11), 0), NodeInput::node(NodeId(9), 0), NodeInput::node(NodeId(16), 0)],
|
||||
..Default::default()
|
||||
},
|
||||
// 18: Instance Repeat
|
||||
// 18: Repeat
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::instance_repeat::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(repeat_nodes::repeat::IDENTIFIER),
|
||||
inputs: vec![NodeInput::node(NodeId(17), 0), NodeInput::node(NodeId(0), 0), NodeInput::import(generic!(T), 3)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -679,7 +679,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
// 2: Instance Index
|
||||
// 2: Read Index
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(7, -2)),
|
||||
@@ -703,7 +703,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
// 5: Instance Vector
|
||||
// 5: Read Vector
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(7, 2)),
|
||||
@@ -719,7 +719,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
// 7: Instance Map
|
||||
// 7: Map
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(21, 1)),
|
||||
@@ -807,7 +807,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
// 18: Instance Repeat
|
||||
// 18: Repeat
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(49, -1)),
|
||||
@@ -833,14 +833,14 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
DocumentNodeDefinition {
|
||||
identifier: "Origins to Polyline",
|
||||
category: "Vector",
|
||||
// "(): ()" -> 0[0:Instance Vector]
|
||||
// [0:Instance Vector]0 -> 0[1:Extract Transform]
|
||||
// "(): ()" -> 0[0:Read Vector]
|
||||
// [0:Read Vector]0 -> 0[1:Extract Transform]
|
||||
// [1:Extract Transform]0 -> 0[2:Decompose Translation]
|
||||
// [2:Decompose Translation]0 -> 0[3:Vec2 to Point]
|
||||
// [IMPORTS]0 -> 0[4:Flatten Vector]
|
||||
// [4:Flatten Vector]0 -> 0[5:Instance Map]
|
||||
// [3:Vec2 to Point]0 -> 1[5:Instance Map]
|
||||
// [5:Instance Map]0 -> 0[6: Flatten Path]
|
||||
// [4:Flatten Vector]0 -> 0[5:Map]
|
||||
// [3:Vec2 to Point]0 -> 1[5:Map]
|
||||
// [5:Map]0 -> 0[6: Flatten Path]
|
||||
// [6:Flatten Path]0 -> 0[7:Points to Polyline]
|
||||
// "false: bool" -> 1[7:Points to Polyline]
|
||||
// [7:Points to Polyline]0 -> 0[EXPORTS]
|
||||
@@ -849,9 +849,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||
exports: vec![NodeInput::node(NodeId(7), 0)],
|
||||
nodes: [
|
||||
// 0: Instance Vector
|
||||
// 0: Read Vector
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::instance_vector::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(context::read_vector::IDENTIFIER),
|
||||
inputs: vec![NodeInput::value(TaggedValue::None, false)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -879,9 +879,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
inputs: vec![NodeInput::import(generic!(T), 0)],
|
||||
..Default::default()
|
||||
},
|
||||
// 5: Instance Map
|
||||
// 5: Map
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::instance_map::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(graphic::map::IDENTIFIER),
|
||||
inputs: vec![NodeInput::node(NodeId(4), 0), NodeInput::node(NodeId(3), 0)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -914,7 +914,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
network_metadata: Some(NodeNetworkMetadata {
|
||||
persistent_metadata: NodeNetworkPersistentMetadata {
|
||||
node_metadata: [
|
||||
// 0: Instance Vector
|
||||
// 0: Read Vector
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(0, 1)),
|
||||
@@ -954,7 +954,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
// 5: Instance Map
|
||||
// 5: Map
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(28, 0)),
|
||||
@@ -2043,7 +2043,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
input_metadata: vec![
|
||||
("Content", "TODO").into(),
|
||||
InputMetadata::with_name_description_override(
|
||||
"Separation Disk Diameter",
|
||||
"Separation",
|
||||
"TODO",
|
||||
WidgetOverride::Number(NumberInputSettings {
|
||||
min: Some(0.01),
|
||||
|
||||
@@ -1498,19 +1498,25 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
||||
for input_index in 0..network_interface.number_of_inputs(selected_node, selection_network_path) {
|
||||
let input_connector = InputConnector::node(*selected_node, input_index);
|
||||
// Only disconnect inputs to non selected nodes
|
||||
if network_interface
|
||||
if !network_interface
|
||||
.upstream_output_connector(&input_connector, selection_network_path)
|
||||
.and_then(|connector| connector.node_id())
|
||||
.is_some_and(|node_id| !all_selected_nodes.contains(&node_id))
|
||||
.is_some_and(|node_id| all_selected_nodes.contains(&node_id))
|
||||
{
|
||||
responses.add(NodeGraphMessage::DisconnectInput { input_connector });
|
||||
}
|
||||
}
|
||||
|
||||
let number_of_outputs = network_interface.number_of_outputs(selected_node, selection_network_path);
|
||||
let first_deselected_upstream_node = network_interface
|
||||
.upstream_flow_back_from_nodes(vec![*selected_node], selection_network_path, FlowType::PrimaryFlow)
|
||||
.find(|upstream_node| !all_selected_nodes.contains(upstream_node));
|
||||
let mut first_deselected_upstream_output = network_interface.upstream_output_connector(&InputConnector::node(*selected_node, 0), selection_network_path);
|
||||
while let Some(OutputConnector::Node { node_id, .. }) = &first_deselected_upstream_output {
|
||||
if !all_selected_nodes.contains(node_id) {
|
||||
break;
|
||||
}
|
||||
|
||||
first_deselected_upstream_output = network_interface.upstream_output_connector(&InputConnector::node(*node_id, 0), selection_network_path);
|
||||
}
|
||||
|
||||
let Some(outward_wires) = network_interface.outward_wires(selection_network_path) else {
|
||||
log::error!("Could not get output wires in shake input");
|
||||
continue;
|
||||
@@ -1530,46 +1536,26 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
||||
|
||||
// Handle reconnection
|
||||
// Find first non selected upstream node by primary flow
|
||||
if let Some(first_deselected_upstream_node) = first_deselected_upstream_node {
|
||||
if let Some(first_deselected_upstream_output) = first_deselected_upstream_output {
|
||||
let Some(downstream_connections_to_first_output) = outward_wires.get(&OutputConnector::node(*selected_node, 0)).cloned() else {
|
||||
log::error!("Could not get downstream_connections_to_first_output in shake node");
|
||||
return;
|
||||
};
|
||||
// Reconnect only if all downstream outputs are not selected
|
||||
if !downstream_connections_to_first_output
|
||||
.iter()
|
||||
.any(|connector| connector.node_id().is_some_and(|node_id| all_selected_nodes.contains(&node_id)))
|
||||
{
|
||||
// Find what output on the deselected upstream node to reconnect to
|
||||
for output_index in 0..network_interface.number_of_outputs(&first_deselected_upstream_node, selection_network_path) {
|
||||
let output_connector = &OutputConnector::node(first_deselected_upstream_node, output_index);
|
||||
let Some(outward_wires) = network_interface.outward_wires(selection_network_path) else {
|
||||
log::error!("Could not get output wires in shake input");
|
||||
continue;
|
||||
};
|
||||
if let Some(inputs) = outward_wires.get(output_connector) {
|
||||
// This can only run once
|
||||
if inputs.iter().any(|input_connector| {
|
||||
input_connector
|
||||
.node_id()
|
||||
.is_some_and(|upstream_node| all_selected_nodes.contains(&upstream_node) && input_connector.input_index() == 0)
|
||||
}) {
|
||||
// Output index is the output of the deselected upstream node to reconnect to
|
||||
for downstream_connections_to_first_output in &downstream_connections_to_first_output {
|
||||
responses.add(NodeGraphMessage::CreateWire {
|
||||
output_connector: OutputConnector::node(first_deselected_upstream_node, output_index),
|
||||
input_connector: *downstream_connections_to_first_output,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set all chain nodes back to chain position
|
||||
// TODO: Fix
|
||||
// for chain_node_to_reset in std::mem::take(&mut self.drag_start_chain_nodes) {
|
||||
// responses.add(NodeGraphMessage::SetChainPosition { node_id: chain_node_to_reset });
|
||||
// }
|
||||
for downstream_connection_to_first_output in &downstream_connections_to_first_output {
|
||||
if !downstream_connection_to_first_output.node_id().is_some_and(|node_id| all_selected_nodes.contains(&node_id)) {
|
||||
// Reconnect the upstream output to all downstream inputs
|
||||
responses.add(NodeGraphMessage::CreateWire {
|
||||
output_connector: first_deselected_upstream_output,
|
||||
input_connector: *downstream_connection_to_first_output,
|
||||
});
|
||||
}
|
||||
|
||||
// Set all chain nodes back to chain position
|
||||
// TODO: Fix
|
||||
// for chain_node_to_reset in std::mem::take(&mut self.drag_start_chain_nodes) {
|
||||
// responses.add(NodeGraphMessage::SetChainPosition { node_id: chain_node_to_reset });
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1991,16 +1977,8 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
||||
}
|
||||
|
||||
if control {
|
||||
let mut non_layer_nodes = HashSet::new();
|
||||
|
||||
let layer_nodes = nodes.iter().filter(|node_id| network_interface.is_layer(node_id, selection_network_path));
|
||||
for &layer_id in layer_nodes {
|
||||
for child_id in network_interface.upstream_flow_back_from_nodes(vec![layer_id], selection_network_path, FlowType::LayerChildrenUpstreamFlow) {
|
||||
if nodes.contains(&child_id) && child_id != layer_id {
|
||||
non_layer_nodes.insert(child_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
let layer_nodes: HashSet<_> = nodes.iter().filter(|node_id| network_interface.is_layer(node_id, selection_network_path)).cloned().collect();
|
||||
let non_layer_nodes: HashSet<_> = nodes.difference(&layer_nodes).cloned().collect();
|
||||
|
||||
// Remove non-layer nodes from selection
|
||||
if alt {
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::document_node_definitions::{NODE_OVERRIDES, NodePropertiesContext};
|
||||
use super::utility_types::FrontendGraphDataType;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_document_node_type;
|
||||
use crate::messages::portfolio::document::utility_types::network_interface::InputConnector;
|
||||
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeNetworkInterface};
|
||||
use crate::messages::portfolio::utility_types::{FontCatalogStyle, PersistentData};
|
||||
use crate::messages::prelude::*;
|
||||
use choice::enum_choice;
|
||||
@@ -25,7 +25,8 @@ use graphene_std::raster::{
|
||||
use graphene_std::table::{Table, TableRow};
|
||||
use graphene_std::text::{Font, TextAlign};
|
||||
use graphene_std::transform::{Footprint, ReferencePoint, Transform};
|
||||
use graphene_std::vector::misc::{ArcType, CentroidType, ExtrudeJoiningAlgorithm, GridType, MergeByDistanceAlgorithm, PointSpacingType, SpiralType};
|
||||
use graphene_std::vector::QRCodeErrorCorrectionLevel;
|
||||
use graphene_std::vector::misc::{ArcType, CentroidType, ExtrudeJoiningAlgorithm, GridType, MergeByDistanceAlgorithm, PointSpacingType, RowsOrColumns, SpiralType};
|
||||
use graphene_std::vector::style::{Fill, FillChoice, FillType, GradientStops, GradientType, PaintOrder, StrokeAlign, StrokeCap, StrokeJoin};
|
||||
|
||||
pub(crate) fn string_properties(text: &str) -> Vec<LayoutGroup> {
|
||||
@@ -78,6 +79,29 @@ pub fn add_blank_assist(widgets: &mut Vec<WidgetInstance>) {
|
||||
]);
|
||||
}
|
||||
|
||||
pub fn jump_to_source_widget(input: &NodeInput, network_interface: &NodeNetworkInterface, selection_network_path: &[NodeId]) -> WidgetInstance {
|
||||
match input {
|
||||
NodeInput::Node { node_id: source_id, .. } => {
|
||||
let source_id = *source_id;
|
||||
let node_name = network_interface.implementation_name(&source_id, selection_network_path);
|
||||
TextButton::new(format!("From Graph ({})", node_name))
|
||||
.tooltip_description("Click to select the node producing this parameter's data.")
|
||||
.on_update(move |_| NodeGraphMessage::SelectedNodesSet { nodes: vec![source_id] }.into())
|
||||
.widget_instance()
|
||||
}
|
||||
_ => TextLabel::new("From Graph (Disconnected)")
|
||||
.tooltip_description(
|
||||
"
|
||||
This parameter is exposed as an input in the node graph, but not currently receiving data from any node.\n\
|
||||
\n\
|
||||
In the graph, drag a wire out from a compatible output connector of another node, and feed it into the input connector of this exposed node parameter. Alternatively, un-expose this parameter by clicking the triangle directly to the left of here.
|
||||
"
|
||||
.trim(),
|
||||
)
|
||||
.widget_instance(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start_widgets(parameter_widgets_info: ParameterWidgetsInfo) -> Vec<WidgetInstance> {
|
||||
let ParameterWidgetsInfo {
|
||||
document_node,
|
||||
@@ -88,6 +112,8 @@ pub fn start_widgets(parameter_widgets_info: ParameterWidgetsInfo) -> Vec<Widget
|
||||
input_type,
|
||||
blank_assist,
|
||||
exposable,
|
||||
network_interface,
|
||||
selection_network_path,
|
||||
..
|
||||
} = parameter_widgets_info;
|
||||
|
||||
@@ -105,6 +131,17 @@ pub fn start_widgets(parameter_widgets_info: ParameterWidgetsInfo) -> Vec<Widget
|
||||
widgets.push(expose_widget(node_id, index, input_type, input.is_exposed()));
|
||||
}
|
||||
widgets.push(TextLabel::new(name).tooltip_description(description).widget_instance());
|
||||
|
||||
let mut blank_assist = blank_assist;
|
||||
if input.is_exposed() {
|
||||
if blank_assist {
|
||||
add_blank_assist(&mut widgets);
|
||||
blank_assist = false;
|
||||
}
|
||||
widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance());
|
||||
widgets.push(jump_to_source_widget(input, network_interface, selection_network_path));
|
||||
}
|
||||
|
||||
if blank_assist {
|
||||
add_blank_assist(&mut widgets);
|
||||
}
|
||||
@@ -219,6 +256,7 @@ pub(crate) fn property_from_type(
|
||||
Some(x) if x == TypeId::of::<StrokeAlign>() => enum_choice::<StrokeAlign>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<PaintOrder>() => enum_choice::<PaintOrder>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<ArcType>() => enum_choice::<ArcType>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<RowsOrColumns>() => enum_choice::<RowsOrColumns>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<TextAlign>() => enum_choice::<TextAlign>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<MergeByDistanceAlgorithm>() => enum_choice::<MergeByDistanceAlgorithm>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<ExtrudeJoiningAlgorithm>() => enum_choice::<ExtrudeJoiningAlgorithm>().for_socket(default_info).property_row(),
|
||||
@@ -226,18 +264,24 @@ pub(crate) fn property_from_type(
|
||||
Some(x) if x == TypeId::of::<BooleanOperation>() => enum_choice::<BooleanOperation>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<CentroidType>() => enum_choice::<CentroidType>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<LuminanceCalculation>() => enum_choice::<LuminanceCalculation>().for_socket(default_info).property_row(),
|
||||
Some(x) if x == TypeId::of::<QRCodeErrorCorrectionLevel>() => enum_choice::<QRCodeErrorCorrectionLevel>().for_socket(default_info).property_row(),
|
||||
// =====
|
||||
// OTHER
|
||||
// =====
|
||||
_ => {
|
||||
let is_exposed = default_info.is_exposed();
|
||||
|
||||
let mut widgets = start_widgets(default_info);
|
||||
widgets.extend_from_slice(&[
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
TextLabel::new("-")
|
||||
.tooltip_label(format!("Data Type: {concrete_type}"))
|
||||
.tooltip_description("This data can only be supplied through the node graph because no widget exists for its type.")
|
||||
.widget_instance(),
|
||||
]);
|
||||
|
||||
if !is_exposed {
|
||||
widgets.extend_from_slice(&[
|
||||
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
|
||||
TextLabel::new("-")
|
||||
.tooltip_label(format!("Data Type: {concrete_type}"))
|
||||
.tooltip_description("This data can only be supplied through the node graph because no widget exists for its type.")
|
||||
.widget_instance(),
|
||||
]);
|
||||
}
|
||||
return Err(vec![widgets.into()]);
|
||||
}
|
||||
}
|
||||
@@ -2141,6 +2185,8 @@ pub fn math_properties(node_id: NodeId, context: &mut NodePropertiesContext) ->
|
||||
|
||||
pub struct ParameterWidgetsInfo<'a> {
|
||||
persistent_data: &'a PersistentData,
|
||||
network_interface: &'a NodeNetworkInterface,
|
||||
selection_network_path: &'a [NodeId],
|
||||
document_node: Option<&'a DocumentNode>,
|
||||
node_id: NodeId,
|
||||
index: usize,
|
||||
@@ -2162,6 +2208,8 @@ impl<'a> ParameterWidgetsInfo<'a> {
|
||||
|
||||
ParameterWidgetsInfo {
|
||||
persistent_data: context.persistent_data,
|
||||
network_interface: context.network_interface,
|
||||
selection_network_path: context.selection_network_path,
|
||||
document_node,
|
||||
node_id,
|
||||
index,
|
||||
@@ -2172,6 +2220,10 @@ impl<'a> ParameterWidgetsInfo<'a> {
|
||||
exposable: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_exposed(&self) -> bool {
|
||||
self.document_node.and_then(|node| node.inputs.get(self.index)).map(|input| input.is_exposed()).unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod choice {
|
||||
|
||||
@@ -30,6 +30,9 @@ pub struct DocumentMetadata {
|
||||
pub click_targets: HashMap<LayerNodeIdentifier, Vec<Arc<ClickTarget>>>,
|
||||
pub clip_targets: HashSet<NodeId>,
|
||||
pub vector_modify: HashMap<NodeId, Vector>,
|
||||
/// Vector data keyed by layer ID, used as fallback when no Path node exists.
|
||||
/// This provides accurate SegmentIds for layers without explicit Path nodes.
|
||||
pub layer_vector_data: HashMap<LayerNodeIdentifier, Arc<Vector>>,
|
||||
/// Transform from document space to viewport space.
|
||||
pub document_to_viewport: DAffine2,
|
||||
}
|
||||
|
||||
@@ -1210,6 +1210,13 @@ impl NodeNetworkInterface {
|
||||
.reduce(Quad::combine_bounds)
|
||||
}
|
||||
|
||||
pub fn document_bounds_viewport_space(&self, include_artboards: bool) -> Option<[DVec2; 2]> {
|
||||
let [min, max] = self.document_bounds_document_space(include_artboards)?;
|
||||
let quad = Quad::from_box([min, max]);
|
||||
let transformed = self.document_metadata.document_to_viewport * quad;
|
||||
Some(transformed.bounding_box())
|
||||
}
|
||||
|
||||
/// Calculates the selected layer bounds in document space
|
||||
pub fn selected_bounds_document_space(&self, include_artboards: bool, network_path: &[NodeId]) -> Option<[DVec2; 2]> {
|
||||
let Some(selected_nodes) = self.selected_nodes_in_nested_network(network_path) else {
|
||||
@@ -3076,11 +3083,7 @@ impl NodeNetworkInterface {
|
||||
return Some(modified);
|
||||
}
|
||||
|
||||
self.document_metadata
|
||||
.click_targets
|
||||
.get(&layer)
|
||||
.map(|click| click.iter().map(|x| x.target_type()))
|
||||
.map(|target_types| Vector::from_target_types(target_types, true))
|
||||
self.document_metadata.layer_vector_data.get(&layer).map(|arc| arc.as_ref().clone())
|
||||
}
|
||||
|
||||
/// Loads the structure of layer nodes from a node graph.
|
||||
@@ -3194,6 +3197,11 @@ impl NodeNetworkInterface {
|
||||
pub fn update_vector_modify(&mut self, new_vector_modify: HashMap<NodeId, Vector>) {
|
||||
self.document_metadata.vector_modify = new_vector_modify;
|
||||
}
|
||||
|
||||
/// Update the layer vector data (for layers without Path nodes)
|
||||
pub fn update_vector_data(&mut self, new_layer_vector_data: HashMap<LayerNodeIdentifier, Arc<Vector>>) {
|
||||
self.document_metadata.layer_vector_data = new_layer_vector_data;
|
||||
}
|
||||
}
|
||||
|
||||
// Public mutable methods
|
||||
@@ -5523,55 +5531,8 @@ impl NodeNetworkInterface {
|
||||
let _ = self.selected_nodes_mut(network_path).unwrap().replace_with(old_selected_nodes);
|
||||
}
|
||||
|
||||
// If inserting into a stack with a parent, ensure the parent stack has enough space for the child stack
|
||||
if parent != LayerNodeIdentifier::ROOT_PARENT
|
||||
&& let Some(upstream_sibling) = parent.next_sibling(&self.document_metadata)
|
||||
{
|
||||
let Some(parent_position) = self.position(&parent.to_node(), network_path) else {
|
||||
log::error!("Could not get parent position in move_layer_to_stack");
|
||||
return;
|
||||
};
|
||||
let last_child = parent.last_child(&self.document_metadata).unwrap_or(parent);
|
||||
|
||||
let Some(mut last_child_position) = self.position(&last_child.to_node(), network_path) else {
|
||||
log::error!("Could not get last child position in move_layer_to_stack");
|
||||
return;
|
||||
};
|
||||
|
||||
if self.is_layer(&last_child.to_node(), network_path) {
|
||||
last_child_position.y += 3;
|
||||
} else {
|
||||
last_child_position.y += 2;
|
||||
}
|
||||
|
||||
// If inserting below the current last child, then the last child is layer to move
|
||||
if post_node.node_id() == Some(last_child.to_node()) {
|
||||
last_child_position += height_above_layer + 3 + height_below_layer;
|
||||
}
|
||||
|
||||
let Some(upstream_sibling_position) = self.position(&upstream_sibling.to_node(), network_path) else {
|
||||
log::error!("Could not get upstream sibling position in move_layer_to_stack");
|
||||
return;
|
||||
};
|
||||
|
||||
let target_gap = last_child_position.y - parent_position.y + 3;
|
||||
let current_gap = upstream_sibling_position.y - parent_position.y;
|
||||
|
||||
let upstream_nodes = self
|
||||
.upstream_flow_back_from_nodes(vec![upstream_sibling.to_node()], network_path, FlowType::UpstreamFlow)
|
||||
.collect::<Vec<_>>();
|
||||
let Some(selected_nodes) = self.selected_nodes_mut(network_path) else {
|
||||
log::error!("Could not get selected nodes in move_layer_to_stack");
|
||||
return;
|
||||
};
|
||||
let old_selected_nodes = selected_nodes.replace_with(upstream_nodes);
|
||||
|
||||
for _ in 0..(target_gap - current_gap).max(0) {
|
||||
self.shift_selected_nodes(Direction::Down, true, network_path);
|
||||
}
|
||||
|
||||
let _ = self.selected_nodes_mut(network_path).unwrap().replace_with(old_selected_nodes);
|
||||
}
|
||||
// If true, this node should be inserted before the post node (toward root from the layer), and all outward wires from the pre node should be moved to its output.
|
||||
let mut insert_node_after_post = false;
|
||||
|
||||
// Connect the layer to a parent layer/node at the top of the stack, or a non layer node midway down the stack
|
||||
if !inserting_into_stack {
|
||||
@@ -5594,7 +5555,7 @@ impl NodeNetworkInterface {
|
||||
let final_layer_position = IVec2::new(stack_top_position.x, after_move_post_layer_position.y + 3 + height_above_layer);
|
||||
let shift = final_layer_position - previous_layer_position;
|
||||
self.shift_absolute_node_position(&layer.to_node(), shift, network_path);
|
||||
self.insert_node_between(&layer.to_node(), &post_node, 0, network_path);
|
||||
insert_node_after_post = true;
|
||||
}
|
||||
NodeInput::Import { .. } => {
|
||||
log::error!("Cannot move post node to parent which connects to the imports")
|
||||
@@ -5613,13 +5574,37 @@ impl NodeNetworkInterface {
|
||||
let final_layer_position = after_move_post_layer_position + IVec2::new(0, 3 + height_above_layer);
|
||||
let shift = final_layer_position - previous_layer_position;
|
||||
self.shift_absolute_node_position(&layer.to_node(), shift, network_path);
|
||||
self.insert_node_between(&layer.to_node(), &post_node, 0, network_path);
|
||||
insert_node_after_post = true;
|
||||
}
|
||||
NodeInput::Import { .. } => {
|
||||
log::error!("Cannot move post node to parent which connects to the imports")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if insert_node_after_post {
|
||||
self.insert_node_between(&layer.to_node(), &post_node, 0, network_path);
|
||||
|
||||
// Get the other wires which need to be moved to the output of the moved layer
|
||||
let layer_input_connector = InputConnector::node(layer.to_node(), 0);
|
||||
let other_outward_wires = self
|
||||
.upstream_output_connector(&layer_input_connector, network_path)
|
||||
.and_then(|pre_node_output| self.outward_wires(network_path).and_then(|wires| wires.get(&pre_node_output)))
|
||||
.map(|other| {
|
||||
other
|
||||
.iter()
|
||||
.filter(|other_input_connector| **other_input_connector != layer_input_connector)
|
||||
.cloned()
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
// Disconnect and reconnect
|
||||
for other_outward_wire in &other_outward_wires {
|
||||
self.disconnect_input(other_outward_wire, network_path);
|
||||
self.create_wire(&OutputConnector::node(layer.to_node(), 0), other_outward_wire, network_path);
|
||||
}
|
||||
}
|
||||
self.unload_upstream_node_click_targets(vec![layer.to_node()], network_path);
|
||||
}
|
||||
|
||||
|
||||
@@ -753,18 +753,10 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
node: graphene_std::vector::centroid::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::CentroidNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::circular_repeat::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::CircularRepeatNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::close_path::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::ClosePathNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::copy_to_points::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::CopyToPointsNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::count_elements::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::CountElementsNode"],
|
||||
@@ -834,29 +826,37 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
aliases: &["graphene_core::vector::generator_nodes::StarNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::instance_index::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceIndexNode"],
|
||||
node: graphene_std::context::read_index::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceIndexNode", "core_types::vector::InstanceIndexNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::instance_map::IDENTIFIER,
|
||||
node: graphene_std::graphic::map::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceMapNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::instance_on_points::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceOnPointsNode"],
|
||||
node: graphene_std::context::read_position::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstancePositionNode", "core_types::vector::InstancePositionNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::instance_position::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstancePositionNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::instance_repeat::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceRepeatNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::instance_vector::IDENTIFIER,
|
||||
node: graphene_std::context::read_vector::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceVectorNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::repeat::repeat::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceRepeatNode", "core_types::vector::InstanceRepeatNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::repeat::repeat_array::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::RepeatNode", "core_types::vector::RepeatNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::repeat::repeat_radial::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::CircularRepeatNode", "core_types::vector::CircularRepeatNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::repeat::repeat_on_points::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::InstanceOnPointsNode", "core_types::vector::InstanceOnPointsNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::jitter_points::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::JitterPointsNode"],
|
||||
@@ -866,8 +866,8 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
aliases: &["graphene_core::vector::MergeByDistanceNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::mirror::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::MirrorNode"],
|
||||
node: graphene_std::graphic::mirror::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::MirrorNode", "core_types::vector::MirrorNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::morph::IDENTIFIER,
|
||||
@@ -905,10 +905,6 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
node: graphene_std::vector::position_on_path::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::PositionOnPathNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::repeat::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::RepeatNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::round_corners::IDENTIFIER,
|
||||
aliases: &["graphene_core::vector::RoundCornersNode"],
|
||||
@@ -1337,7 +1333,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
}
|
||||
|
||||
// Upgrade the Mirror node to add the `keep_original` boolean input
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector::mirror::IDENTIFIER) && inputs_count == 3 {
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::graphic::mirror::IDENTIFIER) && inputs_count == 3 {
|
||||
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
|
||||
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
|
||||
|
||||
@@ -1352,7 +1348,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
}
|
||||
|
||||
// Upgrade the Mirror node to add the `reference_point` input and change `offset` from `DVec2` to `f64`
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector::mirror::IDENTIFIER) && inputs_count == 4 {
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::graphic::mirror::IDENTIFIER) && inputs_count == 4 {
|
||||
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
|
||||
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
|
||||
|
||||
@@ -1404,7 +1400,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
}
|
||||
}
|
||||
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector::instance_on_points::IDENTIFIER) && inputs_count == 2 {
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::repeat::repeat_on_points::IDENTIFIER) && inputs_count == 2 {
|
||||
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
|
||||
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
|
||||
|
||||
@@ -1546,11 +1542,11 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
}
|
||||
}
|
||||
|
||||
// Add the "Depth" parameter to the "Instance Index" node
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector::instance_index::IDENTIFIER) && inputs_count == 0 {
|
||||
// Add the "Depth" parameter to the "Read Index" node
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::context::read_index::IDENTIFIER) && inputs_count == 0 {
|
||||
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
|
||||
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
|
||||
document.network_interface.set_display_name(node_id, "Instance Index".to_string(), network_path);
|
||||
document.network_interface.set_display_name(node_id, "Read Index".to_string(), network_path);
|
||||
|
||||
let mut node_path = network_path.to_vec();
|
||||
node_path.push(*node_id);
|
||||
@@ -1646,8 +1642,8 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
.set_input(&InputConnector::node(*node_id, 1), NodeInput::value(TaggedValue::F64(1.), false), network_path);
|
||||
}
|
||||
|
||||
// Upgrade the "Instance Position" node to add the "Loop Level" input
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector_nodes::instance::instance_position::IDENTIFIER) && inputs_count < 2 {
|
||||
// Upgrade the "Read Position" node to add the "Loop Level" input
|
||||
if reference == DefinitionIdentifier::ProtoNode(graphene_std::context::read_position::IDENTIFIER) && inputs_count < 2 {
|
||||
let mut node_template = resolve_document_node_type(&reference)?.default_node_template();
|
||||
document.network_interface.replace_implementation(node_id, network_path, &mut node_template);
|
||||
let _ = document.network_interface.replace_inputs(node_id, network_path, &mut node_template);
|
||||
|
||||
@@ -1111,6 +1111,16 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
responses.add(PortfolioMessage::UpdateDocumentWidgets);
|
||||
responses.add(PropertiesPanelMessage::Clear);
|
||||
}
|
||||
|
||||
responses.add(DeferMessage::AfterGraphRun {
|
||||
messages: vec![
|
||||
DocumentMessage::ZoomCanvasToFitAll.into(),
|
||||
DeferMessage::AfterGraphRun {
|
||||
messages: vec![DocumentMessage::ZoomCanvasToFitAll.into()],
|
||||
}
|
||||
.into(),
|
||||
],
|
||||
});
|
||||
}
|
||||
PortfolioMessage::SubmitDocumentExport {
|
||||
name,
|
||||
@@ -1185,6 +1195,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
let Some(document) = self.documents.get_mut(&document_id) else { return };
|
||||
|
||||
let resolution = glam::UVec2::splat(EYEDROPPER_PREVIEW_AREA_RESOLUTION);
|
||||
let scale = viewport.scale();
|
||||
|
||||
let preview_offset_in_viewport = ipp.mouse.position - (glam::DVec2::splat(EYEDROPPER_PREVIEW_AREA_RESOLUTION as f64 / 2.));
|
||||
let preview_offset_in_viewport = DAffine2::from_translation(preview_offset_in_viewport);
|
||||
@@ -1196,7 +1207,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
|
||||
let result = self
|
||||
.executor
|
||||
.submit_eyedropper_preview(document_id, preview_transform, pointer_position, resolution, timing_information);
|
||||
.submit_eyedropper_preview(document_id, preview_transform, pointer_position, resolution, scale, timing_information);
|
||||
|
||||
match result {
|
||||
Err(description) => {
|
||||
@@ -1364,10 +1375,11 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
}
|
||||
}
|
||||
PortfolioMessage::UpdateVelloPreference => {
|
||||
let active = if cfg!(target_family = "wasm") { false } else { preferences.use_vello };
|
||||
// TODO: Resend this message once the GPU context is initialized to avoid having the hole punch be stuck in an invalid state
|
||||
let active = if cfg!(target_family = "wasm") { false } else { preferences.use_vello() };
|
||||
responses.add(FrontendMessage::UpdateViewportHolePunch { active });
|
||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||
self.persistent_data.use_vello = preferences.use_vello;
|
||||
self.persistent_data.use_vello = preferences.use_vello();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,17 @@ use crate::messages::prelude::*;
|
||||
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub enum PreferencesMessage {
|
||||
// Management messages
|
||||
Load { preferences: Option<PreferencesMessageHandler> },
|
||||
Load { preferences: PreferencesMessageHandler },
|
||||
ResetToDefaults,
|
||||
|
||||
// Per-preference messages
|
||||
UseVello { use_vello: bool },
|
||||
VelloPreference { preference: graph_craft::wasm_application_io::VelloPreference },
|
||||
SelectionMode { selection_mode: SelectionMode },
|
||||
BrushTool { enabled: bool },
|
||||
ModifyLayout { zoom_with_scroll: bool },
|
||||
GraphWireStyle { style: GraphWireStyle },
|
||||
ViewportZoomWheelRate { rate: f64 },
|
||||
UIScale { scale: f64 },
|
||||
DisableUIAcceleration { disable_ui_acceleration: bool },
|
||||
MaxRenderRegionSize { size: u32 },
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use crate::messages::preferences::SelectionMode;
|
||||
use crate::messages::prelude::*;
|
||||
use crate::messages::tool::utility_types::ToolType;
|
||||
use graph_craft::wasm_application_io::EditorPreferences;
|
||||
use graphene_std::application_io::GetEditorPreferences;
|
||||
|
||||
#[derive(ExtractField)]
|
||||
pub struct PreferencesMessageContext<'a> {
|
||||
@@ -16,27 +17,38 @@ pub struct PreferencesMessageContext<'a> {
|
||||
pub struct PreferencesMessageHandler {
|
||||
pub selection_mode: SelectionMode,
|
||||
pub zoom_with_scroll: bool,
|
||||
pub use_vello: bool,
|
||||
pub vello_preference: graph_craft::wasm_application_io::VelloPreference,
|
||||
pub brush_tool: bool,
|
||||
pub graph_wire_style: GraphWireStyle,
|
||||
pub viewport_zoom_wheel_rate: f64,
|
||||
pub ui_scale: f64,
|
||||
pub disable_ui_acceleration: bool,
|
||||
pub max_render_region_size: u32,
|
||||
}
|
||||
|
||||
impl PreferencesMessageHandler {
|
||||
pub fn needs_restart(&self, other: &Self) -> bool {
|
||||
self.disable_ui_acceleration != other.disable_ui_acceleration
|
||||
}
|
||||
|
||||
pub fn get_selection_mode(&self) -> SelectionMode {
|
||||
self.selection_mode
|
||||
}
|
||||
|
||||
pub fn editor_preferences(&self) -> EditorPreferences {
|
||||
EditorPreferences {
|
||||
use_vello: self.use_vello && self.supports_wgpu(),
|
||||
vello_preference: self.vello_preference,
|
||||
max_render_region_size: self.max_render_region_size,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn supports_wgpu(&self) -> bool {
|
||||
graph_craft::wasm_application_io::wgpu_available().unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn use_vello(&self) -> bool {
|
||||
self.editor_preferences().use_vello()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PreferencesMessageHandler {
|
||||
@@ -44,11 +56,13 @@ impl Default for PreferencesMessageHandler {
|
||||
Self {
|
||||
selection_mode: SelectionMode::Touched,
|
||||
zoom_with_scroll: matches!(MappingVariant::default(), MappingVariant::ZoomWithScroll),
|
||||
use_vello: EditorPreferences::default().use_vello,
|
||||
vello_preference: EditorPreferences::default().vello_preference,
|
||||
brush_tool: false,
|
||||
graph_wire_style: GraphWireStyle::default(),
|
||||
viewport_zoom_wheel_rate: VIEWPORT_ZOOM_WHEEL_RATE,
|
||||
ui_scale: UI_SCALE_DEFAULT,
|
||||
disable_ui_acceleration: false,
|
||||
max_render_region_size: EditorPreferences::default().max_render_region_size,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,9 +75,7 @@ impl MessageHandler<PreferencesMessage, PreferencesMessageContext<'_>> for Prefe
|
||||
match message {
|
||||
// Management messages
|
||||
PreferencesMessage::Load { preferences } => {
|
||||
if let Some(preferences) = preferences {
|
||||
*self = preferences;
|
||||
}
|
||||
*self = preferences;
|
||||
|
||||
responses.add(PortfolioMessage::EditorPreferences);
|
||||
responses.add(PortfolioMessage::UpdateVelloPreference);
|
||||
@@ -73,17 +85,16 @@ impl MessageHandler<PreferencesMessage, PreferencesMessageContext<'_>> for Prefe
|
||||
responses.add(FrontendMessage::UpdateUIScale { scale: self.ui_scale });
|
||||
}
|
||||
PreferencesMessage::ResetToDefaults => {
|
||||
refresh_dialog(responses);
|
||||
responses.add(KeyMappingMessage::ModifyMapping { mapping: MappingVariant::Default });
|
||||
|
||||
*self = Self::default()
|
||||
responses.add(PreferencesMessage::Load { preferences: Self::default() });
|
||||
responses.add(DialogMessage::RequestPreferencesDialog);
|
||||
}
|
||||
|
||||
// Per-preference messages
|
||||
PreferencesMessage::UseVello { use_vello } => {
|
||||
self.use_vello = use_vello;
|
||||
PreferencesMessage::VelloPreference { preference } => {
|
||||
self.vello_preference = preference;
|
||||
responses.add(PortfolioMessage::UpdateVelloPreference);
|
||||
responses.add(PortfolioMessage::EditorPreferences);
|
||||
responses.add(PreferencesDialogMessage::Update);
|
||||
}
|
||||
PreferencesMessage::BrushTool { enabled } => {
|
||||
self.brush_tool = enabled;
|
||||
@@ -115,6 +126,14 @@ impl MessageHandler<PreferencesMessage, PreferencesMessageContext<'_>> for Prefe
|
||||
self.ui_scale = scale;
|
||||
responses.add(FrontendMessage::UpdateUIScale { scale: self.ui_scale });
|
||||
}
|
||||
PreferencesMessage::DisableUIAcceleration { disable_ui_acceleration } => {
|
||||
self.disable_ui_acceleration = disable_ui_acceleration;
|
||||
}
|
||||
PreferencesMessage::MaxRenderRegionSize { size } => {
|
||||
self.max_render_region_size = size;
|
||||
responses.add(PortfolioMessage::UpdateVelloPreference);
|
||||
responses.add(PortfolioMessage::EditorPreferences);
|
||||
}
|
||||
}
|
||||
|
||||
responses.add(FrontendMessage::TriggerSavePreferences { preferences: self.clone() });
|
||||
@@ -123,9 +142,3 @@ impl MessageHandler<PreferencesMessage, PreferencesMessageContext<'_>> for Prefe
|
||||
advertise_actions!(PreferencesMessageDiscriminant;
|
||||
);
|
||||
}
|
||||
|
||||
fn refresh_dialog(responses: &mut VecDeque<Message>) {
|
||||
responses.add(DialogMessage::CloseDialogAndThen {
|
||||
followups: vec![DialogMessage::RequestPreferencesDialog.into()],
|
||||
});
|
||||
}
|
||||
@@ -27,6 +27,9 @@ impl CompassRose {
|
||||
.selected_nodes()
|
||||
.selected_visible_and_unlocked_layers(&document.network_interface)
|
||||
.filter_map(|layer| {
|
||||
if transform.matrix2.determinant().abs() <= f64::EPSILON {
|
||||
return None;
|
||||
}
|
||||
document
|
||||
.metadata()
|
||||
.bounding_box_with_transform(layer, transform.inverse() * document.metadata().transform_to_viewport(layer))
|
||||
|
||||
@@ -241,6 +241,9 @@ impl Pivot {
|
||||
.selected_nodes()
|
||||
.selected_visible_and_unlocked_layers(&document.network_interface)
|
||||
.filter_map(|layer| {
|
||||
if transform.matrix2.determinant().abs() <= f64::EPSILON {
|
||||
return None;
|
||||
}
|
||||
document
|
||||
.metadata()
|
||||
.bounding_box_with_transform(layer, transform.inverse() * document.metadata().transform_to_viewport(layer))
|
||||
|
||||
@@ -1879,6 +1879,7 @@ impl ShapeState {
|
||||
_ => self.sorted_selected_layers(network_interface.document_metadata()).find_map(closest_seg),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_dragging_state(&self, network_interface: &NodeNetworkInterface) -> PointSelectState {
|
||||
for &layer in self.selected_shape_state.keys() {
|
||||
let Some(vector) = network_interface.compute_modified_vector(layer) else { continue };
|
||||
|
||||
@@ -15,16 +15,16 @@ use std::collections::VecDeque;
|
||||
pub struct Arrow;
|
||||
|
||||
impl Arrow {
|
||||
pub fn create_node(document: &DocumentMessageHandler, drag_start: DVec2) -> NodeTemplate {
|
||||
pub fn create_node(document: &DocumentMessageHandler, drag_start: DVec2, shaft_width: f64, head_width: f64, head_length: f64) -> NodeTemplate {
|
||||
let node_type = resolve_proto_node_type(graphene_std::vector_nodes::arrow::IDENTIFIER).expect("Arrow node does not exist");
|
||||
let viewport_pos = document.metadata().document_to_viewport.transform_point2(drag_start);
|
||||
node_type.node_template_input_override([
|
||||
None,
|
||||
Some(NodeInput::value(TaggedValue::DVec2(viewport_pos), false)), // start
|
||||
Some(NodeInput::value(TaggedValue::DVec2(viewport_pos), false)), // end
|
||||
Some(NodeInput::value(TaggedValue::F64(10.), false)), // shaft_width
|
||||
Some(NodeInput::value(TaggedValue::F64(30.), false)), // head_width
|
||||
Some(NodeInput::value(TaggedValue::F64(20.), false)), // head_length
|
||||
Some(NodeInput::value(TaggedValue::F64(shaft_width), false)), // shaft_width
|
||||
Some(NodeInput::value(TaggedValue::F64(head_width), false)), // head_width
|
||||
Some(NodeInput::value(TaggedValue::F64(head_length), false)), // head_length
|
||||
])
|
||||
}
|
||||
|
||||
@@ -56,12 +56,7 @@ impl Arrow {
|
||||
return;
|
||||
};
|
||||
|
||||
// Calculate proportional dimensions based on arrow length
|
||||
let shaft_width = length_document * 0.1;
|
||||
let head_width = length_document * 0.3;
|
||||
let head_length = length_document * 0.2;
|
||||
|
||||
// Update Arrow node parameters with document space coordinates (like Line tool)
|
||||
// Update Arrow node start and end points with document space coordinates
|
||||
responses.add(NodeGraphMessage::SetInput {
|
||||
input_connector: InputConnector::node(node_id, 1),
|
||||
input: NodeInput::value(TaggedValue::DVec2(start_document), false),
|
||||
@@ -70,18 +65,6 @@ impl Arrow {
|
||||
input_connector: InputConnector::node(node_id, 2),
|
||||
input: NodeInput::value(TaggedValue::DVec2(end_document), false),
|
||||
});
|
||||
responses.add(NodeGraphMessage::SetInput {
|
||||
input_connector: InputConnector::node(node_id, 3),
|
||||
input: NodeInput::value(TaggedValue::F64(shaft_width), false),
|
||||
});
|
||||
responses.add(NodeGraphMessage::SetInput {
|
||||
input_connector: InputConnector::node(node_id, 4),
|
||||
input: NodeInput::value(TaggedValue::F64(head_width), false),
|
||||
});
|
||||
responses.add(NodeGraphMessage::SetInput {
|
||||
input_connector: InputConnector::node(node_id, 5),
|
||||
input: NodeInput::value(TaggedValue::F64(head_length), false),
|
||||
});
|
||||
|
||||
responses.add(NodeGraphMessage::RunDocumentGraph);
|
||||
}
|
||||
|
||||
@@ -290,8 +290,8 @@ impl Fsm for FreehandToolFsmState {
|
||||
let nodes = vec![(NodeId(0), node)];
|
||||
|
||||
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
||||
tool_options.fill.apply_fill(layer, responses);
|
||||
tool_options.stroke.apply_stroke(tool_data.weight, layer, responses);
|
||||
tool_options.fill.apply_fill(layer, responses);
|
||||
tool_data.layer = Some(layer);
|
||||
|
||||
FreehandToolFsmState::Drawing
|
||||
|
||||
@@ -2836,15 +2836,16 @@ impl Fsm for PathToolFsmState {
|
||||
|
||||
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
||||
|
||||
let fill_color = Color::WHITE;
|
||||
// Defaults chosen because the pasted geometry has no inherent associated style
|
||||
let stroke_color = Color::BLACK;
|
||||
|
||||
let fill = graphene_std::vector::style::Fill::solid(fill_color.to_gamma_srgb());
|
||||
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
||||
let fill_color = Color::WHITE;
|
||||
|
||||
let stroke = graphene_std::vector::style::Stroke::new(Some(stroke_color.to_gamma_srgb()), DEFAULT_STROKE_WIDTH);
|
||||
responses.add(GraphOperationMessage::StrokeSet { layer, stroke });
|
||||
|
||||
let fill = graphene_std::vector::style::Fill::solid(fill_color.to_gamma_srgb());
|
||||
responses.add(GraphOperationMessage::FillSet { layer, fill });
|
||||
|
||||
new_layers.push(layer);
|
||||
|
||||
responses.add(GraphOperationMessage::TransformSet {
|
||||
@@ -3182,10 +3183,9 @@ impl Fsm for PathToolFsmState {
|
||||
PathToolFsmState::Ready
|
||||
}
|
||||
(_, PathToolMessage::SelectedPointUpdated) => {
|
||||
let colinear = shape_editor.selected_manipulator_angles(&document.network_interface);
|
||||
tool_data.dragging_state = DraggingState {
|
||||
point_select_state: shape_editor.get_dragging_state(&document.network_interface),
|
||||
colinear,
|
||||
colinear: shape_editor.selected_manipulator_angles(&document.network_interface),
|
||||
};
|
||||
|
||||
let old = tool_data.make_path_editable_is_allowed;
|
||||
@@ -3663,4 +3663,5 @@ fn update_dynamic_hints(
|
||||
PathToolFsmState::SlidingPoint => HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()])]),
|
||||
};
|
||||
hint_data.send_layout(responses);
|
||||
responses.add(ToolMessage::UpdateHints);
|
||||
}
|
||||
@@ -1288,8 +1288,8 @@ impl PenToolData {
|
||||
let parent = document.new_layer_bounding_artboard(input, viewport);
|
||||
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
||||
self.current_layer = Some(layer);
|
||||
tool_options.fill.apply_fill(layer, responses);
|
||||
tool_options.stroke.apply_stroke(tool_options.line_weight, layer, responses);
|
||||
tool_options.fill.apply_fill(layer, responses);
|
||||
self.prior_segment = None;
|
||||
self.prior_segments = None;
|
||||
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: vec![layer.to_node()] });
|
||||
|
||||
@@ -44,6 +44,9 @@ pub struct ShapeToolOptions {
|
||||
grid_type: GridType,
|
||||
spiral_type: SpiralType,
|
||||
turns: f64,
|
||||
arrow_shaft_width: f64,
|
||||
arrow_head_width: f64,
|
||||
arrow_head_length: f64,
|
||||
}
|
||||
|
||||
impl Default for ShapeToolOptions {
|
||||
@@ -58,6 +61,9 @@ impl Default for ShapeToolOptions {
|
||||
spiral_type: SpiralType::Archimedean,
|
||||
turns: 5.,
|
||||
grid_type: GridType::Rectangular,
|
||||
arrow_shaft_width: 14.,
|
||||
arrow_head_width: 32.,
|
||||
arrow_head_length: 28.,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +82,9 @@ pub enum ShapeOptionsUpdate {
|
||||
SpiralType(SpiralType),
|
||||
Turns(f64),
|
||||
GridType(GridType),
|
||||
ArrowShaftWidth(f64),
|
||||
ArrowHeadWidth(f64),
|
||||
ArrowHeadLength(f64),
|
||||
}
|
||||
|
||||
#[impl_message(Message, ToolMessage, Shape)]
|
||||
@@ -236,6 +245,51 @@ fn create_weight_widget(line_weight: f64) -> WidgetInstance {
|
||||
.widget_instance()
|
||||
}
|
||||
|
||||
fn create_arrow_shaft_width_widget(shaft_width: f64) -> WidgetInstance {
|
||||
NumberInput::new(Some(shaft_width))
|
||||
.unit(" px")
|
||||
.label("Shaft")
|
||||
.min(0.1)
|
||||
.max(1000.)
|
||||
.on_update(|number_input: &NumberInput| {
|
||||
ShapeToolMessage::UpdateOptions {
|
||||
options: ShapeOptionsUpdate::ArrowShaftWidth(number_input.value.unwrap()),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance()
|
||||
}
|
||||
|
||||
fn create_arrow_head_width_widget(head_width: f64) -> WidgetInstance {
|
||||
NumberInput::new(Some(head_width))
|
||||
.unit(" px")
|
||||
.label("Head W")
|
||||
.min(0.1)
|
||||
.max(1000.)
|
||||
.on_update(|number_input: &NumberInput| {
|
||||
ShapeToolMessage::UpdateOptions {
|
||||
options: ShapeOptionsUpdate::ArrowHeadWidth(number_input.value.unwrap()),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance()
|
||||
}
|
||||
|
||||
fn create_arrow_head_length_widget(head_length: f64) -> WidgetInstance {
|
||||
NumberInput::new(Some(head_length))
|
||||
.unit(" px")
|
||||
.label("Head L")
|
||||
.min(0.1)
|
||||
.max(1000.)
|
||||
.on_update(|number_input: &NumberInput| {
|
||||
ShapeToolMessage::UpdateOptions {
|
||||
options: ShapeOptionsUpdate::ArrowHeadLength(number_input.value.unwrap()),
|
||||
}
|
||||
.into()
|
||||
})
|
||||
.widget_instance()
|
||||
}
|
||||
|
||||
fn create_spiral_type_widget(spiral_type: SpiralType) -> WidgetInstance {
|
||||
let entries = vec![vec![
|
||||
MenuListEntry::new("Archimedean").label("Archimedean").on_commit(move |_| {
|
||||
@@ -304,6 +358,15 @@ impl LayoutHolder for ShapeTool {
|
||||
widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance());
|
||||
}
|
||||
|
||||
if self.options.shape_type == ShapeType::Arrow {
|
||||
widgets.push(create_arrow_shaft_width_widget(self.options.arrow_shaft_width));
|
||||
widgets.push(Separator::new(SeparatorStyle::Related).widget_instance());
|
||||
widgets.push(create_arrow_head_width_widget(self.options.arrow_head_width));
|
||||
widgets.push(Separator::new(SeparatorStyle::Related).widget_instance());
|
||||
widgets.push(create_arrow_head_length_widget(self.options.arrow_head_length));
|
||||
widgets.push(Separator::new(SeparatorStyle::Unrelated).widget_instance());
|
||||
}
|
||||
|
||||
if self.options.shape_type != ShapeType::Line {
|
||||
widgets.append(&mut self.options.fill.create_widgets(
|
||||
"Fill",
|
||||
@@ -414,6 +477,15 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> for Shap
|
||||
ShapeOptionsUpdate::GridType(grid_type) => {
|
||||
self.options.grid_type = grid_type;
|
||||
}
|
||||
ShapeOptionsUpdate::ArrowShaftWidth(shaft_width) => {
|
||||
self.options.arrow_shaft_width = shaft_width;
|
||||
}
|
||||
ShapeOptionsUpdate::ArrowHeadWidth(head_width) => {
|
||||
self.options.arrow_head_width = head_width;
|
||||
}
|
||||
ShapeOptionsUpdate::ArrowHeadLength(head_length) => {
|
||||
self.options.arrow_head_length = head_length;
|
||||
}
|
||||
}
|
||||
|
||||
update_dynamic_hints(&self.fsm_state, responses, &self.tool_data);
|
||||
@@ -854,7 +926,13 @@ impl Fsm for ShapeToolFsmState {
|
||||
ShapeType::Grid => Grid::create_node(tool_options.grid_type),
|
||||
ShapeType::Rectangle => Rectangle::create_node(),
|
||||
ShapeType::Ellipse => Ellipse::create_node(),
|
||||
ShapeType::Arrow => Arrow::create_node(document, tool_data.data.drag_start),
|
||||
ShapeType::Arrow => Arrow::create_node(
|
||||
document,
|
||||
tool_data.data.drag_start,
|
||||
tool_options.arrow_shaft_width,
|
||||
tool_options.arrow_head_width,
|
||||
tool_options.arrow_head_length,
|
||||
),
|
||||
ShapeType::Line => Line::create_node(document, tool_data.data.drag_start),
|
||||
};
|
||||
|
||||
@@ -863,6 +941,8 @@ impl Fsm for ShapeToolFsmState {
|
||||
|
||||
let defered_responses = &mut VecDeque::new();
|
||||
|
||||
tool_options.stroke.apply_stroke(tool_options.line_weight, layer, defered_responses);
|
||||
|
||||
match tool_data.current_shape {
|
||||
ShapeType::Polygon | ShapeType::Star | ShapeType::Circle | ShapeType::Arc | ShapeType::Spiral | ShapeType::Grid | ShapeType::Rectangle | ShapeType::Ellipse => {
|
||||
defered_responses.add(GraphOperationMessage::TransformSet {
|
||||
@@ -884,9 +964,7 @@ impl Fsm for ShapeToolFsmState {
|
||||
tool_data.line_data.editing_layer = Some(layer);
|
||||
}
|
||||
}
|
||||
tool_options.stroke.apply_stroke(tool_options.line_weight, layer, defered_responses);
|
||||
|
||||
tool_options.stroke.apply_stroke(tool_options.line_weight, layer, defered_responses);
|
||||
tool_data.data.layer = Some(layer);
|
||||
|
||||
responses.add(DeferMessage::AfterGraphRun {
|
||||
|
||||
@@ -395,8 +395,8 @@ impl Fsm for SplineToolFsmState {
|
||||
let nodes = vec![(NodeId(1), path_node), (NodeId(0), spline_node)];
|
||||
|
||||
let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
|
||||
tool_options.fill.apply_fill(layer, responses);
|
||||
tool_options.stroke.apply_stroke(tool_data.weight, layer, responses);
|
||||
tool_options.fill.apply_fill(layer, responses);
|
||||
tool_data.current_layer = Some(layer);
|
||||
|
||||
SplineToolFsmState::Drawing
|
||||
@@ -468,9 +468,13 @@ impl Fsm for SplineToolFsmState {
|
||||
state
|
||||
}
|
||||
(SplineToolFsmState::Drawing, SplineToolMessage::Confirm) => {
|
||||
if tool_data.points.len() >= 2 {
|
||||
delete_preview(tool_data, responses);
|
||||
if tool_data.points.len() <= 1 {
|
||||
responses.add(DocumentMessage::AbortTransaction);
|
||||
return SplineToolFsmState::Ready;
|
||||
}
|
||||
|
||||
delete_preview(tool_data, responses);
|
||||
|
||||
responses.add(SplineToolMessage::MergeEndpoints);
|
||||
SplineToolFsmState::MergingEndpoints
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@ use crate::messages::prelude::*;
|
||||
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub enum ViewportMessage {
|
||||
Update { x: f64, y: f64, width: f64, height: f64, scale: f64 },
|
||||
TmpUpdateBounds { x: f64, y: f64, width: f64, height: f64 },
|
||||
RepropagateUpdate,
|
||||
}
|
||||
@@ -35,6 +35,14 @@ impl MessageHandler<ViewportMessage, ()> for ViewportMessageHandler {
|
||||
};
|
||||
responses.add(NodeGraphMessage::UpdateNodeGraphWidth);
|
||||
}
|
||||
ViewportMessage::TmpUpdateBounds { x, y, width, height } => {
|
||||
self.bounds = Bounds {
|
||||
offset: Point { x, y },
|
||||
size: Point { x: width, y: height },
|
||||
};
|
||||
responses.add(NodeGraphMessage::UpdateNodeGraphWidth);
|
||||
}
|
||||
|
||||
ViewportMessage::RepropagateUpdate => {}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use graph_craft::proto::GraphErrors;
|
||||
use graph_craft::wasm_application_io::EditorPreferences;
|
||||
use graphene_std::application_io::{NodeGraphUpdateMessage, RenderConfig};
|
||||
use graphene_std::application_io::{SurfaceFrame, TimingInformation};
|
||||
use graphene_std::raster::{CPU, Raster};
|
||||
use graphene_std::renderer::{RenderMetadata, format_transform_matrix};
|
||||
use graphene_std::text::FontCache;
|
||||
use graphene_std::transform::Footprint;
|
||||
@@ -44,6 +45,7 @@ pub struct CompilationResponse {
|
||||
pub enum NodeGraphUpdate {
|
||||
ExecutionResponse(ExecutionResponse),
|
||||
CompilationResponse(CompilationResponse),
|
||||
EyedropperPreview(Raster<CPU>),
|
||||
NodeGraphUpdateMessage(NodeGraphUpdateMessage),
|
||||
}
|
||||
|
||||
@@ -59,7 +61,6 @@ pub struct NodeGraphExecutor {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct ExecutionContext {
|
||||
render_config: RenderConfig,
|
||||
export_config: Option<ExportConfig>,
|
||||
document_id: DocumentId,
|
||||
}
|
||||
@@ -164,14 +165,7 @@ impl NodeGraphExecutor {
|
||||
// Execute the node graph
|
||||
let execution_id = self.queue_execution(render_config);
|
||||
|
||||
self.futures.push_back((
|
||||
execution_id,
|
||||
ExecutionContext {
|
||||
render_config,
|
||||
export_config: None,
|
||||
document_id,
|
||||
},
|
||||
));
|
||||
self.futures.push_back((execution_id, ExecutionContext { export_config: None, document_id }));
|
||||
|
||||
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
|
||||
}
|
||||
@@ -194,15 +188,23 @@ impl NodeGraphExecutor {
|
||||
}
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
pub(crate) fn submit_eyedropper_preview(&mut self, document_id: DocumentId, transform: DAffine2, pointer: DVec2, resolution: UVec2, time: TimingInformation) -> Result<Message, String> {
|
||||
pub(crate) fn submit_eyedropper_preview(
|
||||
&mut self,
|
||||
document_id: DocumentId,
|
||||
transform: DAffine2,
|
||||
pointer: DVec2,
|
||||
viewport_resolution: UVec2,
|
||||
viewport_scale: f64,
|
||||
time: TimingInformation,
|
||||
) -> Result<Message, String> {
|
||||
let viewport = Footprint {
|
||||
transform,
|
||||
resolution,
|
||||
resolution: viewport_resolution,
|
||||
..Default::default()
|
||||
};
|
||||
let render_config = RenderConfig {
|
||||
viewport,
|
||||
scale: 1.,
|
||||
scale: viewport_scale,
|
||||
time,
|
||||
pointer,
|
||||
export_format: graphene_std::application_io::ExportFormat::Raster,
|
||||
@@ -215,14 +217,7 @@ impl NodeGraphExecutor {
|
||||
// Execute the node graph
|
||||
let execution_id = self.queue_execution(render_config);
|
||||
|
||||
self.futures.push_back((
|
||||
execution_id,
|
||||
ExecutionContext {
|
||||
render_config,
|
||||
export_config: None,
|
||||
document_id,
|
||||
},
|
||||
));
|
||||
self.futures.push_back((execution_id, ExecutionContext { export_config: None, document_id }));
|
||||
|
||||
Ok(DeferMessage::SetGraphSubmissionIndex { execution_id }.into())
|
||||
}
|
||||
@@ -272,7 +267,6 @@ impl NodeGraphExecutor {
|
||||
self.futures.push_back((
|
||||
execution_id,
|
||||
ExecutionContext {
|
||||
render_config,
|
||||
export_config: Some(export_config),
|
||||
document_id,
|
||||
},
|
||||
@@ -325,9 +319,6 @@ impl NodeGraphExecutor {
|
||||
if let Some(export_config) = execution_context.export_config {
|
||||
// Special handling for exporting the artwork
|
||||
self.process_export(node_graph_output, export_config, responses)?;
|
||||
} else if execution_context.render_config.for_eyedropper {
|
||||
// Special handling for Eyedropper tool preview
|
||||
self.process_eyedropper_preview(node_graph_output, responses)?;
|
||||
} else {
|
||||
self.process_node_graph_output(node_graph_output, responses)?;
|
||||
}
|
||||
@@ -371,6 +362,10 @@ impl NodeGraphExecutor {
|
||||
});
|
||||
responses.add(NodeGraphMessage::SendGraph);
|
||||
}
|
||||
NodeGraphUpdate::EyedropperPreview(raster) => {
|
||||
let (data, width, height) = raster.to_flat_u8();
|
||||
responses.add(EyedropperToolMessage::PreviewImage { data, width, height });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,6 +407,7 @@ impl NodeGraphExecutor {
|
||||
first_element_source_id,
|
||||
click_targets,
|
||||
clip_targets,
|
||||
vector_data,
|
||||
} = render_output.metadata;
|
||||
|
||||
// Run these update state messages immediately
|
||||
@@ -422,6 +418,7 @@ impl NodeGraphExecutor {
|
||||
});
|
||||
responses.add(DocumentMessage::UpdateClickTargets { click_targets });
|
||||
responses.add(DocumentMessage::UpdateClipTargets { clip_targets });
|
||||
responses.add(DocumentMessage::UpdateVectorData { vector_data });
|
||||
responses.add(DocumentMessage::RenderScrollbars);
|
||||
responses.add(DocumentMessage::RenderRulers);
|
||||
responses.add(OverlaysMessage::Draw);
|
||||
@@ -429,23 +426,6 @@ impl NodeGraphExecutor {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn process_eyedropper_preview(&self, node_graph_output: TaggedValue, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
||||
match node_graph_output {
|
||||
#[cfg(feature = "gpu")]
|
||||
TaggedValue::RenderOutput(RenderOutput {
|
||||
data: RenderOutputType::Buffer { data, width, height },
|
||||
..
|
||||
}) => {
|
||||
responses.add(EyedropperToolMessage::PreviewImage { data, width, height });
|
||||
}
|
||||
_ => {
|
||||
// TODO: Support Eyedropper preview in SVG mode on desktop
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn process_export(&self, node_graph_output: TaggedValue, export_config: ExportConfig, responses: &mut VecDeque<Message>) -> Result<(), String> {
|
||||
let ExportConfig {
|
||||
file_type,
|
||||
|
||||
@@ -99,6 +99,10 @@ impl InternalNodeGraphUpdateSender {
|
||||
fn send_execution_response(&self, response: ExecutionResponse) {
|
||||
self.0.send(NodeGraphUpdate::ExecutionResponse(response)).expect("Failed to send response")
|
||||
}
|
||||
|
||||
fn send_eyedropper_preview(&self, raster: Raster<CPU>) {
|
||||
self.0.send(NodeGraphUpdate::EyedropperPreview(raster)).expect("Failed to send response")
|
||||
}
|
||||
}
|
||||
|
||||
impl NodeGraphUpdateSender for InternalNodeGraphUpdateSender {
|
||||
@@ -159,13 +163,22 @@ impl NodeRuntime {
|
||||
let mut font = None;
|
||||
let mut preferences = None;
|
||||
let mut graph = None;
|
||||
let mut eyedropper = None;
|
||||
let mut execution = None;
|
||||
for request in self.receiver.try_iter() {
|
||||
match request {
|
||||
GraphRuntimeRequest::GraphUpdate(_) => graph = Some(request),
|
||||
GraphRuntimeRequest::ExecutionRequest(ref execution_request) => {
|
||||
if execution_request.render_config.for_eyedropper {
|
||||
eyedropper = Some(request);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
let for_export = execution_request.render_config.for_export;
|
||||
|
||||
execution = Some(request);
|
||||
|
||||
// If we get an export request we always execute it immedeatly otherwise it could get deduplicated
|
||||
if for_export {
|
||||
break;
|
||||
@@ -175,7 +188,16 @@ impl NodeRuntime {
|
||||
GraphRuntimeRequest::EditorPreferencesUpdate(_) => preferences = Some(request),
|
||||
}
|
||||
}
|
||||
let requests = [font, preferences, graph, execution].into_iter().flatten();
|
||||
|
||||
// Eydropper should use the same time and pointer to not invalidate the cache
|
||||
if let Some(GraphRuntimeRequest::ExecutionRequest(eyedropper)) = &mut eyedropper
|
||||
&& let Some(GraphRuntimeRequest::ExecutionRequest(execution)) = &execution
|
||||
{
|
||||
eyedropper.render_config.time = execution.render_config.time;
|
||||
eyedropper.render_config.pointer = execution.render_config.pointer;
|
||||
}
|
||||
|
||||
let requests = [font, preferences, graph, eyedropper, execution].into_iter().flatten();
|
||||
|
||||
for request in requests {
|
||||
match request {
|
||||
@@ -236,7 +258,9 @@ impl NodeRuntime {
|
||||
let result = self.execute_network(render_config).await;
|
||||
let mut responses = VecDeque::new();
|
||||
// TODO: Only process monitor nodes if the graph has changed, not when only the Footprint changes
|
||||
self.process_monitor_nodes(&mut responses, self.update_thumbnails);
|
||||
if !render_config.for_eyedropper {
|
||||
self.process_monitor_nodes(&mut responses, self.update_thumbnails);
|
||||
}
|
||||
self.update_thumbnails = false;
|
||||
|
||||
// Resolve the result from the inspection by accessing the monitor node
|
||||
@@ -246,7 +270,7 @@ impl NodeRuntime {
|
||||
Ok(TaggedValue::RenderOutput(RenderOutput {
|
||||
data: RenderOutputType::Texture(image_texture),
|
||||
metadata,
|
||||
})) if render_config.for_export || render_config.for_eyedropper => {
|
||||
})) if render_config.for_export => {
|
||||
let executor = self
|
||||
.editor_api
|
||||
.application_io
|
||||
@@ -267,6 +291,23 @@ impl NodeRuntime {
|
||||
None,
|
||||
)
|
||||
}
|
||||
Ok(TaggedValue::RenderOutput(RenderOutput {
|
||||
data: RenderOutputType::Texture(image_texture),
|
||||
metadata: _,
|
||||
})) if render_config.for_eyedropper => {
|
||||
let executor = self
|
||||
.editor_api
|
||||
.application_io
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.gpu_executor()
|
||||
.expect("GPU executor should be available when we receive a texture");
|
||||
|
||||
let raster_cpu = Raster::new_gpu(image_texture.texture).convert(Footprint::BOUNDLESS, executor).await;
|
||||
|
||||
self.sender.send_eyedropper_preview(raster_cpu);
|
||||
continue;
|
||||
}
|
||||
#[cfg(all(target_family = "wasm", feature = "gpu"))]
|
||||
Ok(TaggedValue::RenderOutput(RenderOutput {
|
||||
data: RenderOutputType::Texture(image_texture),
|
||||
@@ -310,7 +351,7 @@ impl NodeRuntime {
|
||||
width: physical_resolution.x,
|
||||
height: physical_resolution.y,
|
||||
present_mode: surface_caps.present_modes[0],
|
||||
alpha_mode: vello::wgpu::CompositeAlphaMode::Opaque,
|
||||
alpha_mode: vello::wgpu::CompositeAlphaMode::PreMultiplied,
|
||||
view_formats: vec![],
|
||||
desired_maximum_frame_latency: 2,
|
||||
},
|
||||
@@ -329,6 +370,8 @@ impl NodeRuntime {
|
||||
executor.context.queue.submit([encoder.finish()]);
|
||||
surface_texture.present();
|
||||
|
||||
// TODO: Figure out if we can explicityl destroy the wgpu texture here to reduce the allocation pressure. We might also be able to use a texture allocation pool
|
||||
|
||||
let frame = graphene_std::application_io::SurfaceFrame {
|
||||
surface_id: surface.window_id,
|
||||
resolution: logical_resolution,
|
||||
|
||||
@@ -49,11 +49,11 @@ pub trait HierarchicalTree {
|
||||
fn build_message_tree() -> DebugMessageTree;
|
||||
|
||||
fn message_handler_data_str() -> MessageData {
|
||||
MessageData::new(String::new(), Vec::new(), "")
|
||||
MessageData::new(String::new(), Vec::new(), "", 0)
|
||||
}
|
||||
|
||||
fn message_handler_str() -> MessageData {
|
||||
MessageData::new(String::new(), Vec::new(), "")
|
||||
MessageData::new(String::new(), Vec::new(), "", 0)
|
||||
}
|
||||
|
||||
fn path() -> &'static str {
|
||||
@@ -64,5 +64,6 @@ pub trait HierarchicalTree {
|
||||
pub trait ExtractField {
|
||||
fn field_types() -> Vec<(String, usize)>;
|
||||
fn path() -> &'static str;
|
||||
fn line_number() -> usize;
|
||||
fn print_field_types();
|
||||
}
|
||||
@@ -3,11 +3,12 @@ pub struct MessageData {
|
||||
name: String,
|
||||
fields: Vec<(String, usize)>,
|
||||
path: &'static str,
|
||||
line_number: usize,
|
||||
}
|
||||
|
||||
impl MessageData {
|
||||
pub fn new(name: String, fields: Vec<(String, usize)>, path: &'static str) -> MessageData {
|
||||
MessageData { name, fields, path }
|
||||
pub fn new(name: String, fields: Vec<(String, usize)>, path: &'static str, line_number: usize) -> MessageData {
|
||||
MessageData { name, fields, path, line_number }
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &str {
|
||||
@@ -21,6 +22,10 @@ impl MessageData {
|
||||
pub fn path(&self) -> &'static str {
|
||||
self.path
|
||||
}
|
||||
|
||||
pub fn line_number(&self) -> usize {
|
||||
self.line_number
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -31,6 +36,7 @@ pub struct DebugMessageTree {
|
||||
message_handler: Option<MessageData>,
|
||||
message_handler_data: Option<MessageData>,
|
||||
path: &'static str,
|
||||
line_number: usize,
|
||||
}
|
||||
|
||||
impl DebugMessageTree {
|
||||
@@ -42,6 +48,7 @@ impl DebugMessageTree {
|
||||
message_handler: None,
|
||||
message_handler_data: None,
|
||||
path: "",
|
||||
line_number: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +60,10 @@ impl DebugMessageTree {
|
||||
self.path = path;
|
||||
}
|
||||
|
||||
pub fn set_line_number(&mut self, line_number: usize) {
|
||||
self.line_number = line_number
|
||||
}
|
||||
|
||||
pub fn add_variant(&mut self, variant: DebugMessageTree) {
|
||||
if let Some(variants) = &mut self.variants {
|
||||
variants.push(variant);
|
||||
@@ -81,6 +92,10 @@ impl DebugMessageTree {
|
||||
self.path
|
||||
}
|
||||
|
||||
pub fn line_number(&self) -> usize {
|
||||
self.line_number
|
||||
}
|
||||
|
||||
pub fn variants(&self) -> Option<&Vec<DebugMessageTree>> {
|
||||
self.variants.as_ref()
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { Color, contrastingOutlineFactor, Gradient } from "@graphite/messages";
|
||||
import type { TooltipState } from "@graphite/state-providers/tooltip";
|
||||
import { clamp } from "@graphite/utility-functions/math";
|
||||
import { isDesktop } from "@graphite/utility-functions/platform";
|
||||
|
||||
import FloatingMenu from "@graphite/components/layout/FloatingMenu.svelte";
|
||||
import { preventEscapeClosingParentFloatingMenu } from "@graphite/components/layout/FloatingMenu.svelte";
|
||||
@@ -376,6 +377,9 @@
|
||||
|
||||
// TODO: Replace this temporary usage of the browser eyedropper API, that only works in Chromium-based browsers, with the custom color sampler system used by the Eyedropper tool
|
||||
function eyedropperSupported(): boolean {
|
||||
// TODO: Implement support in the desktop app for OS-level color picking
|
||||
if (isDesktop()) return false;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return Boolean((window as any).EyeDropper);
|
||||
}
|
||||
|
||||
@@ -252,9 +252,6 @@
|
||||
/// Handles keyboard navigation for the menu.
|
||||
// Returns a boolean indicating whether the entire menu stack should be dismissed.
|
||||
export function keydown(e: KeyboardEvent, submenu = false): boolean {
|
||||
// Interactive menus should keep the active entry the same as the highlighted one
|
||||
if (interactive) highlighted = activeEntry;
|
||||
|
||||
const menuOpen = open;
|
||||
const flatEntries = filteredEntries.flat().filter((entry) => !entry.disabled);
|
||||
const openChild = (openChildValue !== undefined && flatEntries.findIndex((entry) => entry.value === openChildValue)) || -1;
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
addEventListener("pointermove", draggingPointerMove);
|
||||
addEventListener("mousedown", draggingMouseDown);
|
||||
addEventListener("keydown", draggingKeyDown);
|
||||
addEventListener("keydown", handleLayerPanelKeyDown);
|
||||
|
||||
addEventListener("pointermove", clippingHover);
|
||||
addEventListener("keydown", clippingKeyPress);
|
||||
@@ -123,6 +124,7 @@
|
||||
removeEventListener("pointermove", draggingPointerMove);
|
||||
removeEventListener("mousedown", draggingMouseDown);
|
||||
removeEventListener("keydown", draggingKeyDown);
|
||||
removeEventListener("keydown", handleLayerPanelKeyDown);
|
||||
|
||||
removeEventListener("pointermove", clippingHover);
|
||||
removeEventListener("keydown", clippingKeyPress);
|
||||
@@ -431,6 +433,49 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleLayerPanelKeyDown(e: KeyboardEvent) {
|
||||
// TODO: Handle this F2 shortcut detection in the backend, not frontend, so it uses the standard key binding system
|
||||
|
||||
// Only handle F2 if not currently editing a layer name
|
||||
if (e.key === "F2" && !layers.some((layer) => layer.editingName)) {
|
||||
// Find the first selected layer
|
||||
const selectedLayer = layers.find((layer) => layer.entry.selected);
|
||||
if (selectedLayer) {
|
||||
e.preventDefault();
|
||||
onEditLayerName(selectedLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function navigateToLayer(currentListing: LayerListingInfo, direction: "Up" | "Down") {
|
||||
// Save the current layer name
|
||||
const inputElement = document.activeElement;
|
||||
if (inputElement instanceof HTMLInputElement) {
|
||||
const name = inputElement.value || "";
|
||||
editor.handle.setLayerName(currentListing.entry.id, name);
|
||||
currentListing.entry.alias = name;
|
||||
}
|
||||
|
||||
// Find current layer index
|
||||
const currentIndex = layers.findIndex((layer) => layer.entry.id === currentListing.entry.id);
|
||||
if (currentIndex === -1) return;
|
||||
|
||||
// Calculate target index based on direction
|
||||
const targetIndex = direction === "Down" ? currentIndex + 1 : currentIndex - 1;
|
||||
if (targetIndex >= layers.length || targetIndex < 0) return;
|
||||
|
||||
const targetListing = layers[targetIndex];
|
||||
if (!targetListing) return;
|
||||
|
||||
// Exit edit mode on current layer
|
||||
currentListing.editingName = false;
|
||||
draggable = true;
|
||||
layers = layers;
|
||||
|
||||
// Start edit mode on target layer
|
||||
await onEditLayerName(targetListing);
|
||||
}
|
||||
|
||||
function fileDragOver(e: DragEvent) {
|
||||
if (!draggable || !e.dataTransfer || !e.dataTransfer.types.includes("Files")) return;
|
||||
|
||||
@@ -572,8 +617,22 @@
|
||||
placeholder={listing.entry.implementationName}
|
||||
disabled={!listing.editingName}
|
||||
on:blur={() => onEditLayerNameDeselect(listing)}
|
||||
on:keydown={(e) => e.key === "Escape" && onEditLayerNameDeselect(listing)}
|
||||
on:keydown={(e) => e.key === "Enter" && onEditLayerNameChange(listing, e)}
|
||||
on:keydown={(e) => {
|
||||
if (e.key === "Escape") {
|
||||
onEditLayerNameDeselect(listing);
|
||||
} else if (e.key === "Enter") {
|
||||
onEditLayerNameChange(listing, e);
|
||||
} else if (e.key === "Tab") {
|
||||
e.preventDefault();
|
||||
navigateToLayer(listing, e.shiftKey ? "Up" : "Down");
|
||||
} else if (e.key === "ArrowUp") {
|
||||
e.preventDefault();
|
||||
navigateToLayer(listing, "Up");
|
||||
} else if (e.key === "ArrowDown") {
|
||||
e.preventDefault();
|
||||
navigateToLayer(listing, "Down");
|
||||
}
|
||||
}}
|
||||
on:change={(e) => onEditLayerNameChange(listing, e)}
|
||||
/>
|
||||
</LayoutRow>
|
||||
|
||||
@@ -33,13 +33,11 @@
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -4px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 12px 0 12px 4px;
|
||||
border-color: var(--button-background-color) var(--button-background-color) var(--button-background-color) transparent;
|
||||
width: 8px;
|
||||
height: 100%;
|
||||
background: var(--button-background-color);
|
||||
clip-path: polygon(8px -1px, 0 -1px, 4px 12px, 0 25px, 8px 25px);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +48,11 @@
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -4px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 12px 0 12px 4px;
|
||||
border-color: transparent transparent transparent var(--button-background-color);
|
||||
width: 8px;
|
||||
height: 100%;
|
||||
background: var(--button-background-color);
|
||||
clip-path: polygon(0 -1px, 4px -1px, 8px 12px, 4px 25px, 0 25px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,8 @@
|
||||
}
|
||||
|
||||
// Hovered while unchecked
|
||||
&:hover .checkbox-box {
|
||||
&:hover .checkbox-box,
|
||||
&.label-is-hovered .checkbox-box {
|
||||
background: var(--color-6-lowergray);
|
||||
}
|
||||
|
||||
@@ -120,7 +121,8 @@
|
||||
}
|
||||
|
||||
// Hovered while checked
|
||||
&:hover .checkbox-box {
|
||||
&:hover .checkbox-box,
|
||||
&.label-is-hovered .checkbox-box {
|
||||
background: var(--color-f-white);
|
||||
}
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@
|
||||
cumulativeDragDelta += dragDelta;
|
||||
|
||||
const combined = initialValue + cumulativeDragDelta;
|
||||
const combineSnapped = snapping ? Math.round(combined) : combined;
|
||||
const combineSnapped = snapping || isInteger ? Math.round(combined) : combined;
|
||||
|
||||
const newValue = updateValue(combineSnapped);
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
|
||||
import type { ActionShortcut } from "@graphite/messages";
|
||||
|
||||
let className = "";
|
||||
@@ -28,12 +30,39 @@
|
||||
export let tooltipDescription: string | undefined = undefined;
|
||||
export let tooltipShortcut: ActionShortcut | undefined = undefined;
|
||||
|
||||
let self: HTMLLabelElement | undefined;
|
||||
|
||||
$: extraClasses = Object.entries(classes)
|
||||
.flatMap(([className, stateName]) => (stateName ? [className] : []))
|
||||
.join(" ");
|
||||
$: extraStyles = Object.entries(styles)
|
||||
.flatMap((styleAndValue) => (styleAndValue[1] !== undefined ? [`${styleAndValue[0]}: ${styleAndValue[1]};`] : []))
|
||||
.join(" ");
|
||||
|
||||
$: watchForCheckbox(forCheckbox);
|
||||
|
||||
function watchForCheckbox(forCheckbox: bigint | undefined) {
|
||||
if (!self) return;
|
||||
|
||||
self.removeEventListener("pointerenter", handlePointerEnter);
|
||||
self.removeEventListener("pointerleave", handlePointerLeave);
|
||||
|
||||
if (forCheckbox !== undefined) {
|
||||
self.addEventListener("pointerenter", handlePointerEnter);
|
||||
self.addEventListener("pointerleave", handlePointerLeave);
|
||||
}
|
||||
}
|
||||
|
||||
function handlePointerEnter() {
|
||||
document.querySelector(`[for="checkbox-input-${forCheckbox}"]`)?.classList.add("label-is-hovered");
|
||||
}
|
||||
|
||||
function handlePointerLeave() {
|
||||
document.querySelector(`[for="checkbox-input-${forCheckbox}"]`)?.classList.remove("label-is-hovered");
|
||||
}
|
||||
|
||||
onMount(() => watchForCheckbox(forCheckbox));
|
||||
onDestroy(() => watchForCheckbox(undefined));
|
||||
</script>
|
||||
|
||||
<label
|
||||
@@ -52,6 +81,7 @@
|
||||
data-tooltip-description={tooltipDescription}
|
||||
data-tooltip-shortcut={tooltipShortcut?.shortcut ? JSON.stringify(tooltipShortcut.shortcut) : undefined}
|
||||
for={forCheckbox !== undefined ? `checkbox-input-${forCheckbox}` : undefined}
|
||||
bind:this={self}
|
||||
>
|
||||
<slot />
|
||||
</label>
|
||||
|
||||
@@ -140,7 +140,7 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
|
||||
}
|
||||
|
||||
if (get(dialog).visible && key === "Escape") {
|
||||
dialog.dismissDialog();
|
||||
editor.handle.onDialogDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
|
||||
const inTextInput = target === textToolInteractiveInputElement;
|
||||
|
||||
if (get(dialog).visible && !inDialog) {
|
||||
dialog.dismissDialog();
|
||||
editor.handle.onDialogDismiss();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ export class LayerPanelEntry {
|
||||
clippable!: boolean;
|
||||
}
|
||||
|
||||
export class DisplayDialogDismiss extends JsMessage {}
|
||||
export class DialogClose extends JsMessage {}
|
||||
|
||||
export class Font {
|
||||
fontFamily!: string;
|
||||
@@ -1671,7 +1671,7 @@ type MessageMaker = typeof JsMessage | JSMessageFactory;
|
||||
export const messageMakers: Record<string, MessageMaker> = {
|
||||
ClearAllNodeGraphWires,
|
||||
DisplayDialog,
|
||||
DisplayDialogDismiss,
|
||||
DialogClose,
|
||||
DisplayDialogPanic,
|
||||
DisplayEditableTextbox,
|
||||
DisplayEditableTextboxTransform,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { writable } from "svelte/store";
|
||||
|
||||
import { type Editor } from "@graphite/editor";
|
||||
import { type IconName } from "@graphite/icons";
|
||||
import { DisplayDialog, DisplayDialogDismiss, UpdateDialogButtons, UpdateDialogColumn1, UpdateDialogColumn2, patchLayout, TriggerDisplayThirdPartyLicensesDialog } from "@graphite/messages";
|
||||
import { DisplayDialog, DialogClose, UpdateDialogButtons, UpdateDialogColumn1, UpdateDialogColumn2, patchLayout, TriggerDisplayThirdPartyLicensesDialog } from "@graphite/messages";
|
||||
import type { Layout } from "@graphite/messages";
|
||||
|
||||
export function createDialogState(editor: Editor) {
|
||||
@@ -76,7 +76,7 @@ export function createDialogState(editor: Editor) {
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(DisplayDialogDismiss, dismissDialog);
|
||||
editor.subscriptions.subscribeJsMessage(DialogClose, dismissDialog);
|
||||
|
||||
editor.subscriptions.subscribeJsMessage(TriggerDisplayThirdPartyLicensesDialog, async () => {
|
||||
const BACKUP_URL = "https://editor.graphite.art/third-party-licenses.txt";
|
||||
|
||||
@@ -55,6 +55,16 @@ export function createTooltipState(editor: Editor) {
|
||||
}, SHOW_TOOLTIP_DELAY_MS);
|
||||
});
|
||||
|
||||
// Hide tooltip and cancel any pending timeout when the mouse leaves the application window
|
||||
document.addEventListener("mouseleave", () => {
|
||||
if (tooltipTimeout) clearTimeout(tooltipTimeout);
|
||||
closeTooltip();
|
||||
});
|
||||
|
||||
document.addEventListener("mousedown", closeTooltip);
|
||||
document.addEventListener("keydown", closeTooltip);
|
||||
document.addEventListener("wheel", closeTooltip);
|
||||
|
||||
editor.subscriptions.subscribeJsMessage(SendShortcutShiftClick, async (data) => {
|
||||
update((state) => {
|
||||
state.shiftClickShortcut = data.shortcut;
|
||||
@@ -74,9 +84,6 @@ export function createTooltipState(editor: Editor) {
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener("mousedown", closeTooltip);
|
||||
document.addEventListener("keydown", closeTooltip);
|
||||
|
||||
// Stop showing a tooltip if the user clicks or presses a key, and require the user to first move out of the element before it can re-appear
|
||||
function closeTooltip() {
|
||||
update((state) => {
|
||||
|
||||
@@ -202,20 +202,20 @@ impl EditorHandle {
|
||||
if !EDITOR_HAS_CRASHED.load(Ordering::SeqCst) {
|
||||
handle(|handle| {
|
||||
// Process all messages that have been queued up
|
||||
let messages = MESSAGE_BUFFER.take();
|
||||
|
||||
for message in messages {
|
||||
handle.dispatch(message);
|
||||
}
|
||||
|
||||
handle.dispatch(InputPreprocessorMessage::CurrentTime {
|
||||
timestamp: js_sys::Date::now() as u64,
|
||||
});
|
||||
handle.dispatch(AnimationMessage::IncrementFrameCounter);
|
||||
let mut messages = MESSAGE_BUFFER.take();
|
||||
messages.push(
|
||||
InputPreprocessorMessage::CurrentTime {
|
||||
timestamp: js_sys::Date::now() as u64,
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
messages.push(AnimationMessage::IncrementFrameCounter.into());
|
||||
|
||||
// Used by auto-panning, but this could possibly be refactored in the future, see:
|
||||
// <https://github.com/GraphiteEditor/Graphite/pull/2562#discussion_r2041102786>
|
||||
handle.dispatch(BroadcastMessage::TriggerEvent(EventMessage::AnimationFrame));
|
||||
messages.push(BroadcastMessage::TriggerEvent(EventMessage::AnimationFrame).into());
|
||||
|
||||
handle.dispatch(Message::Batched { messages: messages.into() });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -384,18 +384,14 @@ impl EditorHandle {
|
||||
|
||||
#[wasm_bindgen(js_name = loadPreferences)]
|
||||
pub fn load_preferences(&self, preferences: Option<String>) {
|
||||
let preferences = if let Some(preferences) = preferences {
|
||||
if let Some(preferences) = preferences {
|
||||
let Ok(preferences) = serde_json::from_str(&preferences) else {
|
||||
log::error!("Failed to deserialize preferences");
|
||||
return;
|
||||
};
|
||||
Some(preferences)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let message = PreferencesMessage::Load { preferences };
|
||||
self.dispatch(message);
|
||||
let message = PreferencesMessage::Load { preferences };
|
||||
self.dispatch(message);
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = selectDocument)]
|
||||
@@ -602,6 +598,13 @@ impl EditorHandle {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Dialog got dismissed
|
||||
#[wasm_bindgen(js_name = onDialogDismiss)]
|
||||
pub fn on_dialog_dismiss(&self) {
|
||||
let message = DialogMessage::Dismiss;
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// A text box was changed
|
||||
#[wasm_bindgen(js_name = updateBounds)]
|
||||
pub fn update_bounds(&self, new_text: String) -> Result<(), JsValue> {
|
||||
|
||||
@@ -21,6 +21,7 @@ graphene-core = { workspace = true }
|
||||
graphene-application-io = { workspace = true }
|
||||
rendering = { workspace = true }
|
||||
raster-nodes = { workspace = true }
|
||||
vector-nodes = { workspace = true }
|
||||
graphic-types = { workspace = true }
|
||||
text-nodes = { workspace = true }
|
||||
|
||||
|
||||
@@ -238,6 +238,7 @@ tagged_value! {
|
||||
Fill(vector::style::Fill),
|
||||
BlendMode(core_types::blending::BlendMode),
|
||||
LuminanceCalculation(raster_nodes::adjustments::LuminanceCalculation),
|
||||
QRCodeErrorCorrectionLevel(vector_nodes::generator_nodes::QRCodeErrorCorrectionLevel),
|
||||
XY(graphene_core::extract_xy::XY),
|
||||
RedGreenBlue(raster_nodes::adjustments::RedGreenBlue),
|
||||
RedGreenBlueAlpha(raster_nodes::adjustments::RedGreenBlueAlpha),
|
||||
@@ -251,6 +252,7 @@ tagged_value! {
|
||||
SelectiveColorChoice(raster_nodes::adjustments::SelectiveColorChoice),
|
||||
GridType(vector::misc::GridType),
|
||||
ArcType(vector::misc::ArcType),
|
||||
RowsOrColumns(vector::misc::RowsOrColumns),
|
||||
MergeByDistanceAlgorithm(vector::misc::MergeByDistanceAlgorithm),
|
||||
ExtrudeJoiningAlgorithm(vector::misc::ExtrudeJoiningAlgorithm),
|
||||
PointSpacingType(vector::misc::PointSpacingType),
|
||||
|
||||
@@ -69,6 +69,10 @@ pub struct WasmApplicationIo {
|
||||
|
||||
static WGPU_AVAILABLE: std::sync::atomic::AtomicI8 = std::sync::atomic::AtomicI8::new(-1);
|
||||
|
||||
/// Returns:
|
||||
/// - `None` if the availability of WGPU has not been determined yet
|
||||
/// - `Some(true)` if WGPU is available
|
||||
/// - `Some(false)` if WGPU is not available
|
||||
pub fn wgpu_available() -> Option<bool> {
|
||||
match WGPU_AVAILABLE.load(Ordering::SeqCst) {
|
||||
-1 => None,
|
||||
@@ -332,24 +336,38 @@ pub type WasmSurfaceHandle = SurfaceHandle<wgpu_executor::Window>;
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub type WasmSurfaceHandleFrame = graphene_application_io::SurfaceHandleFrame<wgpu_executor::Window>;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, specta::Type, serde::Serialize, serde::Deserialize)]
|
||||
pub enum VelloPreference {
|
||||
Auto,
|
||||
Disabled,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Hash, specta::Type, serde::Serialize, serde::Deserialize)]
|
||||
pub struct EditorPreferences {
|
||||
pub use_vello: bool,
|
||||
pub vello_preference: VelloPreference,
|
||||
/// Maximum render region size in pixels along one dimension of the square area.
|
||||
pub max_render_region_size: u32,
|
||||
}
|
||||
|
||||
impl graphene_application_io::GetEditorPreferences for EditorPreferences {
|
||||
fn use_vello(&self) -> bool {
|
||||
self.use_vello
|
||||
match self.vello_preference {
|
||||
VelloPreference::Auto => wgpu_available().unwrap_or(false),
|
||||
VelloPreference::Disabled => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn max_render_region_area(&self) -> u32 {
|
||||
let size = self.max_render_region_size.min(u32::MAX.isqrt());
|
||||
size.pow(2)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for EditorPreferences {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
#[cfg(target_family = "wasm")]
|
||||
use_vello: false,
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use_vello: true,
|
||||
vello_preference: VelloPreference::Auto,
|
||||
max_render_region_size: 1280,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
let wgpu_executor_ref = application_io_arc.gpu_executor().unwrap();
|
||||
let device = wgpu_executor_ref.context.device.clone();
|
||||
|
||||
let preferences = EditorPreferences { use_vello: true };
|
||||
let preferences = EditorPreferences {
|
||||
vello_preference: graph_craft::wasm_application_io::VelloPreference::Auto,
|
||||
max_render_region_size: EditorPreferences::default().max_render_region_size,
|
||||
};
|
||||
let editor_api = Arc::new(WasmEditorApi {
|
||||
font_cache: FontCache::default(),
|
||||
application_io: Some(application_io_for_api),
|
||||
|
||||
@@ -126,6 +126,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::raster::adjustments::SelectiveColorChoice]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::GridType]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::ArcType]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::RowsOrColumns]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::MergeByDistanceAlgorithm]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::ExtrudeJoiningAlgorithm]),
|
||||
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::PointSpacingType]),
|
||||
@@ -140,6 +141,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
||||
#[cfg(feature = "gpu")]
|
||||
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => Arc<WasmSurfaceHandle>, Context => graphene_std::ContextFeatures]),
|
||||
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => RenderIntermediate, Context => graphene_std::ContextFeatures]),
|
||||
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => RenderOutput, Context => graphene_std::ContextFeatures]),
|
||||
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => WgpuSurface, Context => graphene_std::ContextFeatures]),
|
||||
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => Option<WgpuSurface>, Context => graphene_std::ContextFeatures]),
|
||||
async_node!(graphene_core::context_modification::ContextModificationNode<_, _>, input: Context, fn_params: [Context => WindowHandle, Context => graphene_std::ContextFeatures]),
|
||||
@@ -200,6 +202,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::style::Fill]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::blending::BlendMode]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::LuminanceCalculation]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::QRCodeErrorCorrectionLevel]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::extract_xy::XY]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::RedGreenBlue]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::RedGreenBlueAlpha]),
|
||||
@@ -213,6 +216,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::raster::SelectiveColorChoice]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::GridType]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::ArcType]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::RowsOrColumns]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::MergeByDistanceAlgorithm]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::ExtrudeJoiningAlgorithm]),
|
||||
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => graphene_std::vector::misc::PointSpacingType]),
|
||||
|
||||
@@ -28,7 +28,7 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, editor_api: Arc<WasmEdito
|
||||
let render_node = DocumentNode {
|
||||
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
||||
implementation: DocumentNodeImplementation::Network(NodeNetwork {
|
||||
exports: vec![NodeInput::node(NodeId(2), 0)],
|
||||
exports: vec![NodeInput::node(NodeId(3), 0)],
|
||||
nodes: [
|
||||
DocumentNode {
|
||||
call_argument: concrete!(Context),
|
||||
@@ -36,7 +36,7 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, editor_api: Arc<WasmEdito
|
||||
implementation: DocumentNodeImplementation::ProtoNode(graphene_std::render_node::render_intermediate::IDENTIFIER),
|
||||
context_features: graphene_std::ContextDependencies {
|
||||
extract: ContextFeatures::VARARGS,
|
||||
inject: ContextFeatures::empty(),
|
||||
inject: ContextFeatures::INDEX,
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
@@ -51,12 +51,23 @@ pub fn wrap_network_in_scope(mut network: NodeNetwork, editor_api: Arc<WasmEdito
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
call_argument: concrete!(Context),
|
||||
inputs: vec![NodeInput::scope("editor-api"), NodeInput::node(NodeId(1), 0)],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(graphene_std::render_cache::render_output_cache::IDENTIFIER),
|
||||
context_features: graphene_std::ContextDependencies {
|
||||
extract: ContextFeatures::FOOTPRINT | ContextFeatures::VARARGS,
|
||||
inject: ContextFeatures::VARARGS,
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
call_argument: concrete!(graphene_std::application_io::RenderConfig),
|
||||
inputs: vec![NodeInput::node(NodeId(1), 0)],
|
||||
inputs: vec![NodeInput::node(NodeId(2), 0)],
|
||||
implementation: DocumentNodeImplementation::ProtoNode(graphene_std::render_node::create_context::IDENTIFIER),
|
||||
context_features: graphene_std::ContextDependencies {
|
||||
extract: ContextFeatures::empty(),
|
||||
// We add the extract index annotation here to force the compiler to add a context nullification node before this node so the render context is properly nullified so the render cache node can do its's work
|
||||
extract: ContextFeatures::INDEX,
|
||||
inject: ContextFeatures::REAL_TIME | ContextFeatures::ANIMATION_TIME | ContextFeatures::POINTER_POSITION | ContextFeatures::FOOTPRINT | ContextFeatures::VARARGS,
|
||||
},
|
||||
..Default::default()
|
||||
|
||||
@@ -218,6 +218,7 @@ impl<T: NodeGraphUpdateSender> NodeGraphUpdateSender for std::sync::Mutex<T> {
|
||||
|
||||
pub trait GetEditorPreferences {
|
||||
fn use_vello(&self) -> bool;
|
||||
fn max_render_region_area(&self) -> u32;
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
@@ -261,6 +262,10 @@ impl GetEditorPreferences for DummyPreferences {
|
||||
fn use_vello(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn max_render_region_area(&self) -> u32 {
|
||||
1024 * 1024
|
||||
}
|
||||
}
|
||||
|
||||
pub struct EditorApi<Io> {
|
||||
|
||||
@@ -156,6 +156,54 @@ pub trait IntoGraphicTable {
|
||||
flatten_table(&mut output, content);
|
||||
output
|
||||
}
|
||||
|
||||
/// Deeply flattens any raster content within a graphic table, discarding non-raster content, and returning a table of only raster elements.
|
||||
fn into_flattened_raster_table(self) -> Table<Raster<CPU>>
|
||||
where
|
||||
Self: std::marker::Sized,
|
||||
{
|
||||
let content = self.into_graphic_table();
|
||||
|
||||
fn flatten_table(output_raster_table: &mut Table<Raster<CPU>>, current_graphic_table: Table<Graphic>) {
|
||||
for current_graphic_row in current_graphic_table.iter() {
|
||||
let current_graphic = current_graphic_row.element.clone();
|
||||
let source_node_id = *current_graphic_row.source_node_id;
|
||||
|
||||
match current_graphic {
|
||||
// If we're allowed to recurse, flatten any tables we encounter
|
||||
Graphic::Graphic(mut current_graphic_table) => {
|
||||
// Apply the parent graphic's transform to all child elements
|
||||
for graphic in current_graphic_table.iter_mut() {
|
||||
*graphic.transform = *current_graphic_row.transform * *graphic.transform;
|
||||
}
|
||||
|
||||
flatten_table(output_raster_table, current_graphic_table);
|
||||
}
|
||||
// Push any leaf RasterCPU elements we encounter
|
||||
Graphic::RasterCPU(raster_table) => {
|
||||
for current_raster_row in raster_table.iter() {
|
||||
output_raster_table.push(TableRow {
|
||||
element: current_raster_row.element.clone(),
|
||||
transform: *current_graphic_row.transform * *current_raster_row.transform,
|
||||
alpha_blending: AlphaBlending {
|
||||
blend_mode: current_raster_row.alpha_blending.blend_mode,
|
||||
opacity: current_graphic_row.alpha_blending.opacity * current_raster_row.alpha_blending.opacity,
|
||||
fill: current_raster_row.alpha_blending.fill,
|
||||
clip: current_raster_row.alpha_blending.clip,
|
||||
},
|
||||
source_node_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut output = Table::new();
|
||||
flatten_table(&mut output, content);
|
||||
output
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoGraphicTable for Table<Graphic> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::renderer::{RenderParams, format_transform_matrix};
|
||||
use core_types::consts::{LAYER_OUTLINE_STROKE_COLOR, LAYER_OUTLINE_STROKE_WEIGHT};
|
||||
use crate::renderer::{RenderParams, black_or_white_for_best_contrast, format_transform_matrix};
|
||||
use core_types::consts::LAYER_OUTLINE_STROKE_WEIGHT;
|
||||
use core_types::uuid::generate_uuid;
|
||||
use glam::DAffine2;
|
||||
use graphic_types::vector_types::gradient::{Gradient, GradientType};
|
||||
@@ -167,9 +167,12 @@ impl RenderExt for PathStyle {
|
||||
match render_mode {
|
||||
RenderMode::Outline => {
|
||||
let fill_attribute = Fill::None.render(svg_defs, element_transform, stroke_transform, bounds, transformed_bounds, render_params);
|
||||
let mut outline_stroke = Stroke::new(Some(LAYER_OUTLINE_STROKE_COLOR), LAYER_OUTLINE_STROKE_WEIGHT);
|
||||
|
||||
let outline_color = black_or_white_for_best_contrast(render_params.artboard_background);
|
||||
let mut outline_stroke = Stroke::new(Some(outline_color), LAYER_OUTLINE_STROKE_WEIGHT);
|
||||
// Outline strokes should be non-scaling by default
|
||||
outline_stroke.non_scaling = true;
|
||||
|
||||
let stroke_attribute = outline_stroke.render(svg_defs, element_transform, stroke_transform, bounds, transformed_bounds, render_params);
|
||||
format!("{fill_attribute}{stroke_attribute}")
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ pub struct RenderParams {
|
||||
pub alignment_parent_transform: Option<DAffine2>,
|
||||
pub aligned_strokes: bool,
|
||||
pub override_paint_order: bool,
|
||||
pub artboard_background: Option<Color>,
|
||||
}
|
||||
|
||||
impl Hash for RenderParams {
|
||||
@@ -198,6 +199,7 @@ impl Hash for RenderParams {
|
||||
}
|
||||
self.aligned_strokes.hash(state);
|
||||
self.override_paint_order.hash(state);
|
||||
self.artboard_background.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +237,26 @@ fn max_scale(transform: DAffine2) -> f64 {
|
||||
(sx + sy).sqrt()
|
||||
}
|
||||
|
||||
pub fn black_or_white_for_best_contrast(background: Option<Color>) -> Color {
|
||||
let Some(bg) = background else { return core_types::consts::LAYER_OUTLINE_STROKE_COLOR };
|
||||
|
||||
let alpha = bg.a();
|
||||
|
||||
// Un-premultiply, then convert to gamma sRGB
|
||||
let srgb = if alpha > f32::EPSILON {
|
||||
Color::from_rgbaf32_unchecked(bg.r() / alpha, bg.g() / alpha, bg.b() / alpha, alpha).to_gamma_srgb()
|
||||
} else {
|
||||
Color::TRANSPARENT
|
||||
};
|
||||
|
||||
// Composite over black in sRGB space, then convert back to linear for luminance
|
||||
let composited = Color::from_rgbaf32_unchecked(srgb.r() * alpha, srgb.g() * alpha, srgb.b() * alpha, 1.).to_linear_srgb();
|
||||
|
||||
let threshold = (1.05 * 0.05f32).sqrt() - 0.05;
|
||||
|
||||
if composited.luminance_srgb() > threshold { Color::BLACK } else { Color::WHITE }
|
||||
}
|
||||
|
||||
pub fn to_transform(transform: DAffine2) -> usvg::Transform {
|
||||
let cols = transform.to_cols_array();
|
||||
usvg::Transform::from_row(cols[0] as f32, cols[1] as f32, cols[2] as f32, cols[3] as f32, cols[4] as f32, cols[5] as f32)
|
||||
@@ -249,6 +271,7 @@ pub struct RenderMetadata {
|
||||
pub first_element_source_id: HashMap<NodeId, Option<NodeId>>,
|
||||
pub click_targets: HashMap<NodeId, Vec<Arc<ClickTarget>>>,
|
||||
pub clip_targets: HashSet<NodeId>,
|
||||
pub vector_data: HashMap<NodeId, Arc<Vector>>,
|
||||
}
|
||||
|
||||
impl RenderMetadata {
|
||||
@@ -257,6 +280,16 @@ impl RenderMetadata {
|
||||
value.transform = transform * value.transform;
|
||||
}
|
||||
}
|
||||
|
||||
/// Merge another RenderMetadata into this one.
|
||||
/// Values from `other` take precedence for duplicate keys.
|
||||
pub fn merge(&mut self, other: &RenderMetadata) {
|
||||
self.upstream_footprints.extend(other.upstream_footprints.iter().map(|(k, v)| (*k, *v)));
|
||||
self.local_transforms.extend(other.local_transforms.iter().map(|(k, v)| (*k, *v)));
|
||||
self.first_element_source_id.extend(other.first_element_source_id.iter().map(|(k, v)| (*k, *v)));
|
||||
self.click_targets.extend(other.click_targets.iter().map(|(k, v)| (*k, v.clone())));
|
||||
self.clip_targets.extend(other.clip_targets.iter().copied());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Rename to "Graphical"
|
||||
@@ -440,7 +473,9 @@ impl Render for Artboard {
|
||||
},
|
||||
// Artwork content
|
||||
|render| {
|
||||
self.content.render_svg(render, render_params);
|
||||
let mut render_params = render_params.clone();
|
||||
render_params.artboard_background = Some(self.background);
|
||||
self.content.render_svg(render, &render_params);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -462,7 +497,9 @@ impl Render for Artboard {
|
||||
}
|
||||
// Since the content's transform is right multiplied in when rendering the content, we just need to right multiply by the artboard offset here.
|
||||
let child_transform = transform * DAffine2::from_translation(self.location.as_dvec2());
|
||||
self.content.render_to_vello(scene, child_transform, context, render_params);
|
||||
let mut render_params = render_params.clone();
|
||||
render_params.artboard_background = Some(self.background);
|
||||
self.content.render_to_vello(scene, child_transform, context, &render_params);
|
||||
if self.clip {
|
||||
scene.pop_layer();
|
||||
}
|
||||
@@ -881,7 +918,7 @@ impl Render for Table<Vector> {
|
||||
}
|
||||
|
||||
fn render_to_vello(&self, scene: &mut Scene, parent_transform: DAffine2, _context: &mut RenderContext, render_params: &RenderParams) {
|
||||
use core_types::consts::{LAYER_OUTLINE_STROKE_COLOR, LAYER_OUTLINE_STROKE_WEIGHT};
|
||||
use core_types::consts::LAYER_OUTLINE_STROKE_WEIGHT;
|
||||
use graphic_types::vector_types::vector::style::{GradientType, StrokeCap, StrokeJoin};
|
||||
use vello::kurbo::{Cap, Join};
|
||||
use vello::peniko;
|
||||
@@ -1065,12 +1102,9 @@ impl Render for Table<Vector> {
|
||||
dash_pattern: Default::default(),
|
||||
dash_offset: 0.,
|
||||
};
|
||||
let outline_color = peniko::Color::new([
|
||||
LAYER_OUTLINE_STROKE_COLOR.r(),
|
||||
LAYER_OUTLINE_STROKE_COLOR.g(),
|
||||
LAYER_OUTLINE_STROKE_COLOR.b(),
|
||||
LAYER_OUTLINE_STROKE_COLOR.a(),
|
||||
]);
|
||||
|
||||
let outline_color = black_or_white_for_best_contrast(render_params.artboard_background);
|
||||
let outline_color = peniko::Color::new([outline_color.r(), outline_color.g(), outline_color.b(), outline_color.a()]);
|
||||
|
||||
scene.stroke(&outline_stroke, kurbo::Affine::new(element_transform.to_cols_array()), outline_color, None, &path);
|
||||
}
|
||||
@@ -1187,6 +1221,8 @@ impl Render for Table<Vector> {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
metadata.click_targets.entry(element_id).or_insert(click_targets);
|
||||
// Store the full vector data including segment IDs for accurate segment modification
|
||||
metadata.vector_data.entry(element_id).or_insert_with(|| Arc::new(vector.clone()));
|
||||
}
|
||||
|
||||
if let Some(upstream_nested_layers) = &vector.upstream_data {
|
||||
|
||||
@@ -330,14 +330,16 @@ impl<PointId: Identifier> Subpath<PointId> {
|
||||
let head_base_distance = (length - head_length).max(0.);
|
||||
let head_base = start + direction * head_base_distance;
|
||||
|
||||
// Arrow path starts at the tail, traces around the shape, and returns to the tail
|
||||
let anchors = [
|
||||
start - perpendicular * half_shaft, // Tail bottom
|
||||
head_base - perpendicular * half_shaft, // Head base bottom (shaft)
|
||||
head_base - perpendicular * half_head, // Head base bottom (wide)
|
||||
end, // Tip
|
||||
head_base + perpendicular * half_head, // Head base top (wide)
|
||||
head_base + perpendicular * half_shaft, // Head base top (shaft)
|
||||
start, // Tail center (origin)
|
||||
start + perpendicular * half_shaft, // Tail top
|
||||
head_base + perpendicular * half_shaft, // Head base top (shaft)
|
||||
head_base + perpendicular * half_head, // Head base top (wide)
|
||||
end, // Tip
|
||||
head_base - perpendicular * half_head, // Head base bottom (wide)
|
||||
head_base - perpendicular * half_shaft, // Head base bottom (shaft)
|
||||
start - perpendicular * half_shaft, // Tail bottom
|
||||
];
|
||||
|
||||
Self::from_anchors(anchors, true)
|
||||
|
||||
@@ -18,6 +18,15 @@ pub enum CentroidType {
|
||||
Length,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, Hash, DynAny, specta::Type, node_macro::ChoiceType)]
|
||||
#[widget(Radio)]
|
||||
pub enum RowsOrColumns {
|
||||
#[default]
|
||||
Rows = 0,
|
||||
Columns,
|
||||
}
|
||||
|
||||
pub trait AsU64 {
|
||||
fn as_u64(&self) -> u64;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
pub use crate::gradient::*;
|
||||
use core_types::Color;
|
||||
use core_types::color::Alpha;
|
||||
use core_types::table::Table;
|
||||
use dyn_any::DynAny;
|
||||
use glam::DAffine2;
|
||||
@@ -123,7 +124,9 @@ impl From<Option<Color>> for Fill {
|
||||
|
||||
impl From<Table<Color>> for Fill {
|
||||
fn from(color: Table<Color>) -> Fill {
|
||||
Fill::solid_or_none(color.into())
|
||||
let alpha = color.get(0).map(|c| c.alpha_blending.opacity).unwrap_or(1.);
|
||||
let color: Option<Color> = color.into();
|
||||
Fill::solid_or_none(color.map(|c| c.with_alpha(c.alpha() * alpha)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,12 +100,15 @@ impl RasterGpuToRasterCpuConverter {
|
||||
}
|
||||
}
|
||||
|
||||
async fn convert(self) -> Result<Raster<CPU>, wgpu::BufferAsyncError> {
|
||||
async fn convert(self, device: &std::sync::Arc<wgpu::Device>) -> Result<Raster<CPU>, wgpu::BufferAsyncError> {
|
||||
let buffer_slice = self.buffer.slice(..);
|
||||
let (sender, receiver) = futures::channel::oneshot::channel();
|
||||
buffer_slice.map_async(wgpu::MapMode::Read, move |result| {
|
||||
let _ = sender.send(result);
|
||||
});
|
||||
|
||||
let _ = device.poll(wgpu::wgt::PollType::wait_indefinitely());
|
||||
|
||||
receiver.await.expect("Failed to receive map result")?;
|
||||
|
||||
let view = buffer_slice.get_mapped_range();
|
||||
@@ -215,7 +218,7 @@ impl<'i> Convert<Table<Raster<CPU>>, &'i WgpuExecutor> for Table<Raster<GPU>> {
|
||||
|
||||
let mut map_futures = Vec::new();
|
||||
for converter in converters {
|
||||
map_futures.push(converter.convert());
|
||||
map_futures.push(converter.convert(device));
|
||||
}
|
||||
|
||||
let map_results = futures::future::try_join_all(map_futures)
|
||||
@@ -250,7 +253,7 @@ impl<'i> Convert<Raster<CPU>, &'i WgpuExecutor> for Raster<GPU> {
|
||||
|
||||
queue.submit([encoder.finish()]);
|
||||
|
||||
converter.convert().await.expect("Failed to download texture data")
|
||||
converter.convert(device).await.expect("Failed to download texture data")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user