#738: Edit ▸ Paste pastes SVG markup as a shape layer
Problem: After Effects 26.3 pastes copied vector artwork as shape layers. Edit ▸ Paste only
knew the app's own clipboard, so SVG markup on the system clipboard was ignored; turning SVG
into shapes needed an imported footage file and Create Shapes from Vector Layer.
Fix: a new `edit.pasteSvg {svg, name?, comp?}` command builds a shape layer from SVG text with
the same conversion as Create Shapes from Vector Layer (paths, fills, strokes, gradients, clip
masks), above the selected layer with the SVG canvas centred in the comp, as one undo step;
oversized, non-SVG or shapeless text is rejected. In the UI, Ctrl/Cmd+V (and the native Edit ▸
Paste) run it when the system clipboard holds SVG. Copying in the app already replaces the
system clipboard with a note, so SVG there is newer than the app's clipboard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a7d3e7699
commit
d58253cc5a
@@ -1,7 +1,7 @@
|
||||
//! Timeline rows for shape layers, masks and keyframing: the Contents "Add:" menu and the Classic
|
||||
//! 3D "Change Renderer…" row (#206), Alt+Shift+P revealing the key it adds and clicks below the
|
||||
//! layers deselecting them (#205), Mask Feather's linked values (#203), and copying shape items
|
||||
//! between shape layers (#227).
|
||||
//! between shape layers (#227), and Ctrl+V of SVG markup making a shape layer (#738).
|
||||
|
||||
use effectcraft_engine::Session;
|
||||
use effectcraft_engine::project::LayerId;
|
||||
@@ -243,3 +243,31 @@ fn timeline_colour_eyedropper_samples_the_comp() {
|
||||
assert!((c[k] - want[k]).abs() < 0.02, "{c:?} vs {want:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Ctrl+V with SVG markup on the system clipboard pastes it as a shape layer (After Effects
|
||||
/// 26.3), even with layers on the app's clipboard: copying in the app replaces the system
|
||||
/// clipboard, so the SVG was copied later (#738).
|
||||
#[test]
|
||||
fn ctrl_v_pastes_svg_markup_as_a_shape_layer() {
|
||||
let (mut h, a, b, _) = two_shape_layers();
|
||||
click(&mut h, &format!("timeline.layer.{b}.row"));
|
||||
h.input_mut().events.push(Event::Copy);
|
||||
h.step();
|
||||
assert_eq!(h.state().session.state.clipboard.len(), 1, "a layer on the app's clipboard");
|
||||
let svg = r##"<svg xmlns="http://www.w3.org/2000/svg" width="40" height="20"><circle cx="10" cy="10" r="8" fill="#00ff00"/><rect x="20" width="20" height="20"/></svg>"##;
|
||||
h.input_mut().events.push(Event::Paste(svg.into()));
|
||||
h.run_steps(3);
|
||||
let c = h.state().session.active_comp().unwrap().clone();
|
||||
assert_eq!(c.layers.len(), 3, "{:?}", h.state().ui.status);
|
||||
let top = &c.layers[0];
|
||||
assert!(top.id != LayerId(a) && top.id != LayerId(b));
|
||||
assert_eq!(top.name, "Shape Layer 3");
|
||||
assert_eq!(top.props.sub("contents").unwrap().groups().count(), 2);
|
||||
assert_eq!(h.state().session.state.selected_layers, vec![top.id]);
|
||||
// The app's own clipboard note pastes the copied layer as before.
|
||||
h.input_mut().events.push(Event::Paste("EffectCraft: 1 layer".into()));
|
||||
h.run_steps(3);
|
||||
let c = h.state().session.active_comp().unwrap();
|
||||
assert_eq!(c.layers.len(), 4);
|
||||
assert_eq!(c.layers[0].name, "Oval 2");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user