From d721bca85f945d48f939b762a372c3ce557a18d0 Mon Sep 17 00:00:00 2001 From: Priyanshu Date: Wed, 18 Jun 2025 15:40:40 +0530 Subject: [PATCH] Fix 'Solidify Stroke' node not appending elements in the BezPath after the first ClosePath element (#2732) Issue: Previously the `AppendBezpath::append_bezpath()` method didn't append the elements after the first `ClosePath` element in the given BezPath, but the Bezpath can contain more than one path. The 'Solidify Stroke' node creates at least two paths, but the `append_bezpath` method only appends the first path, and hence 'Solidify Stroke' didn't work correctly. Fix: Now `AppendBezpath::append_bezpath()` appends all the paths in the given BezPath, which also fixes the 'Solidify Stroke' node. --- .../gcore/src/vector/vector_data/modification.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/node-graph/gcore/src/vector/vector_data/modification.rs b/node-graph/gcore/src/vector/vector_data/modification.rs index 73c47362..4e4ba3c5 100644 --- a/node-graph/gcore/src/vector/vector_data/modification.rs +++ b/node-graph/gcore/src/vector/vector_data/modification.rs @@ -583,6 +583,15 @@ impl<'a> AppendBezpath<'a> { self.last_point_index = Some(next_point_index); } + fn reset(&mut self) { + self.first_point = None; + self.last_point = None; + self.first_point_index = None; + self.last_point_index = None; + self.first_segment_id = None; + self.last_segment_id = None; + } + pub fn append_bezpath(vector_data: &'a mut VectorData, bezpath: BezPath) { let mut this = Self::new(vector_data); let mut elements = bezpath.elements().iter().peekable(); @@ -621,8 +630,8 @@ impl<'a> AppendBezpath<'a> { } } PathEl::ClosePath => { - // Already handled using `append_segment_and_close_path()`; - break; + // Already handled using `append_segment_and_close_path()` hence we reset state and continue. + this.reset(); } } }