mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-15 15:54:53 +00:00
Commands whose `id` or `ids` the shared check in Session::execute does not
read still parsed them with id_param/ids_param, which drop anything that is
not a non-negative integer, and then acted on the selection or the current
layer. `object.blend.make {"ids": 3}` blended the selection,
`object.envelope.makeWithWarp {"ids": [2, "x"]}` warped the selection,
`graph.setData {"id": "2"}` changed the selected graph and
`layer.newSublayer {"parent": "2"}` added a sublayer to the current layer.
- cmd::named_ids and cmd::named_id read `ids`/`id` as targets does: a value
that is not an object id, or an unresolved step reference, is an error.
- The symbol and brush, Live Paint, Shape Builder and Image Trace, blend,
envelope and mesh, perspective, Liquify, Puppet Warp and graph helpers use
them in place of the lenient readers.
- layer.clippingMask.toggle checks `id`, and layer.newSublayer checks
`parent`, with checked_id before falling back to the highlighted row or the
current layer.
37 lines
1.4 KiB
Rust
37 lines
1.4 KiB
Rust
//! Live Blends (Object → Blend), Envelope Distort (Object → Envelope Distort) and Gradient Mesh
|
|
//! (Object → Create Gradient Mesh, Mesh tool edits).
|
|
//!
|
|
//! The objects are live document nodes (`NodeKind::Blend`, `NodeKind::Envelope`,
|
|
//! `NodeKind::Mesh`); evaluation lives in `vectorcraft_doc::live` and the renderer. **Expand**
|
|
//! replaces a live object by its evaluated geometry (`vectorcraft_render::expand_live`).
|
|
|
|
use std::sync::Arc;
|
|
|
|
use serde_json::{Value, json};
|
|
use vectorcraft_color::{Color, Paint};
|
|
use vectorcraft_doc::live::{
|
|
self, BlendDefaults, BlendEase, BlendEaseType, BlendOrientation, BlendSpacing, BlendSpec, EnvelopeKind, EnvelopeMap, EnvelopeOptions,
|
|
GradientMesh, MeshAppearance, PreserveShape, Spine,
|
|
};
|
|
use vectorcraft_doc::{Appearance, Document, Node, NodeId, NodeKind, Selection};
|
|
use vectorcraft_geom::{Affine, Anchor, PathData, Point, Vec2};
|
|
|
|
use super::edit::selected_roots;
|
|
use super::expand::gradient_sampler;
|
|
use super::pathops::Beside;
|
|
use super::{
|
|
CommandSpec, EngineError, Result, Session, always, bad, check_numbers, check_switches, cmd, color_value, f64_or, f64_req, finite_numbers,
|
|
has_doc, has_multi, has_selection, id_param, named_ids, number_or, ok, str_param, switch_or,
|
|
};
|
|
|
|
mod blend;
|
|
mod commands;
|
|
mod common;
|
|
mod envelope;
|
|
mod mesh;
|
|
|
|
pub(crate) use blend::expand_blends;
|
|
pub use commands::specs;
|
|
pub(super) use common::fix_ids;
|
|
pub(super) use envelope::expand_envelopes_under;
|