Merge pull request #7114 from dotCooCoo/feat/group-effect-after-members

Effects: a group's geometry effects reshape what its members draw
This commit is contained in:
BFlat
2026-11-13 23:03:46 +07:00
committed by GitHub
10 changed files with 496 additions and 36 deletions
+3 -2
View File
@@ -123,7 +123,7 @@ impl Renderer {
/// ([`effects::plugin_revision`]), drop what the caches keep from plug-in effects: the effect
/// geometry of paths with a plug-in effect, the cull bounds of objects that have one or hold one,
/// of symbol instances and of the objects that hold them, and the art drawn for the effects of
/// objects with a plug-in effect. Rasters of raster effects and evaluations of live objects hold
/// objects that have a plug-in effect or hold one. Rasters of raster effects and evaluations of live objects hold
/// the revision in their keys when what they draw has a plug-in effect (`fx::Inputs`,
/// `live::resources_key`).
///
@@ -146,7 +146,8 @@ impl Renderer {
if stale {
self.fx_geom.retain(|_, e| !effects::has_plugin_effect(&e.node));
self.geom.retain(|_, e| !holds_plugin_effect(&e.node) && !holds_instance(&e.node));
self.fx_arts.retain(|(node, ..)| !effects::has_plugin_effect(node));
// The art of a group holds what its members' plug-in effects draw.
self.fx_arts.retain(|(node, ..)| !holds_plugin_effect(node));
}
}
+9 -1
View File
@@ -1716,7 +1716,8 @@ fn installing_a_plugin_keeps_what_is_kept_for_other_objects() {
}
/// The art drawn for an object's effects follows the plug-ins installed: in the next frame, a group
/// with a plug-in effect, the same group feathered (Feather clips to the art's outline), an
/// with a plug-in effect, the same group feathered (Feather clips to the art's outline), a group
/// with a Transform effect holding a square with a plug-in effect, an
/// instance of symbol `S` ([`symbol_art`]) and type, each with a plug-in effect, are drawn as the
/// plug-in installed again with another shape draws them.
#[test]
@@ -1738,6 +1739,13 @@ fn effect_art_follows_the_plugins_installed() {
plugin_change_draws_as_new(group(vec![]), ID, small.clone(), big.clone());
let feather = effect("stylize.feather", serde_json::json!({"radius": 2.0}));
plugin_change_draws_as_new(group(vec![feather]), ID, small.clone(), big.clone());
// A group with a Transform effect holding a square with the plug-in effect: the group's art
// holds what the plug-in draws for the square.
let mut d = Document::new(200.0, 100.0);
let square = filled(&mut d, rectangle(Rect::new(20.0, 30.0, 60.0, 70.0)), Paint::solid(Color::BLACK), vec![plugin()]);
let mut moved = Node::group(d.alloc_id(), vec![Arc::new(square)]);
moved.appearance.effects.push(effect("distort.transform", serde_json::json!({"moveH": 10.0})));
plugin_change_draws_as_new(with_art(d, vec![moved]), ID, small.clone(), big.clone());
let mut d = Document::new(200.0, 100.0);
let art = symbol_art(&mut d);
d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "S".into(), art: Arc::new(art) });