From 645757448fb5e9dfc06764ab45f3d5d78af4337c Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 2 Nov 2026 11:30:39 +0700 Subject: [PATCH] .ai import: the layer-end operator gets its own method --- crates/eps/src/import/ai/read/ops.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index 0846c51a8..980d7a2f1 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -48,6 +48,15 @@ impl<'a> Reader<'a> { self.open(Kind::Mask, hidden) } + /// `LB`: a graph started in this layer that hasn't ended doesn't go on past it; the layer ends. + fn layer_end(&mut self) -> Result<(), String> { + if self.graph.as_ref().is_some_and(|g| g.frames >= self.frames.len()) { + self.graph = None; + self.warn(GRAPH_UNENDED); + } + self.end_layer_in_mask() + } + pub(super) fn op(&mut self, w: &str, hidden: bool) -> Result<(), String> { if self.blend_record.is_some() { self.end_blend(); @@ -148,14 +157,7 @@ impl<'a> Reader<'a> { a.name = vals.iter().rev().find_map(V::text).unwrap_or_default(); } } - "LB" => { - // A graph started in this layer that hasn't ended doesn't go on past it. - if self.graph.as_ref().is_some_and(|g| g.frames >= self.frames.len()) { - self.graph = None; - self.warn(GRAPH_UNENDED); - } - self.end_layer_in_mask()? - } + "LB" => self.layer_end()?, // Paths. "m" | "l" | "L" | "c" | "C" | "v" | "V" | "y" | "Y" => self.path_op(w, &vals)?, "h" => close(&mut self.path),