From 567cc7cf9ff831acb5d5339b66c643229b5ddca8 Mon Sep 17 00:00:00 2001 From: Falk David Date: Mon, 23 Oct 2023 10:43:09 +0200 Subject: [PATCH] Fix: GPv3: Make sure to call `.save()` on attribute writer In the draw tool in the `process_extension_sample` we would create an `GSpanAttributeWriter` to initialize the default values for the new points, but we would return early for curve attributes. This return needs to happen before we create the `GSpanAttributeWriter`. --- .../sculpt_paint/grease_pencil_paint.cc | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/source/blender/editors/sculpt_paint/grease_pencil_paint.cc b/source/blender/editors/sculpt_paint/grease_pencil_paint.cc index ce3af7776c9..2e43dc95b1e 100644 --- a/source/blender/editors/sculpt_paint/grease_pencil_paint.cc +++ b/source/blender/editors/sculpt_paint/grease_pencil_paint.cc @@ -441,21 +441,17 @@ struct PaintOperationExecutor { /* Initialize the rest of the attributes with default values. */ Set attributes_to_skip{{"position", "radius", "opacity", "vertex_color"}}; - attributes.for_all( - [&](const bke::AttributeIDRef &id, const bke::AttributeMetaData /*meta_data*/) { - if (attributes_to_skip.contains(id.name())) { - return true; - } - bke::GSpanAttributeWriter attribute = attributes.lookup_for_write_span(id); - if (attribute.domain != ATTR_DOMAIN_POINT) { - return true; - } - const CPPType &type = attribute.span.type(); - GMutableSpan new_data = attribute.span.slice(new_range); - type.fill_assign_n(type.default_value(), new_data.data(), new_data.size()); - attribute.finish(); - return true; - }); + attributes.for_all([&](const bke::AttributeIDRef &id, const bke::AttributeMetaData meta_data) { + if (attributes_to_skip.contains(id.name()) || meta_data.domain != ATTR_DOMAIN_POINT) { + return true; + } + bke::GSpanAttributeWriter attribute = attributes.lookup_for_write_span(id); + const CPPType &type = attribute.span.type(); + GMutableSpan new_data = attribute.span.slice(new_range); + type.fill_assign_n(type.default_value(), new_data.data(), new_data.size()); + attribute.finish(); + return true; + }); } void execute(PaintOperation &self, const bContext &C, const InputSample &extension_sample)