Fix: Vertex group data lost after draw tool or delete operator. #119034

Merged
Hans Goudey merged 1 commits from casey-bianco-davis/blender:GPv3-draw-tool-loss-of-vertex-groups into main 2024-03-11 03:02:06 +01:00
2 changed files with 7 additions and 0 deletions

View File

@ -1197,6 +1197,8 @@ CurvesGeometry curves_copy_point_selection(
CurvesGeometry dst_curves(points_to_copy.size(), curves_to_copy.size());
BKE_defgroup_copy_list(&dst_curves.vertex_group_names, &curves.vertex_group_names);
threading::parallel_invoke(
dst_curves.curves_num() > 1024,
[&]() {
@ -1256,6 +1258,8 @@ CurvesGeometry curves_copy_curve_selection(
points_by_curve, curves_to_copy, dst_curves.offsets_for_write());
dst_curves.resize(dst_points_by_curve.total_size(), dst_curves.curves_num());
BKE_defgroup_copy_list(&dst_curves.vertex_group_names, &curves.vertex_group_names);
const AttributeAccessor src_attributes = curves.attributes();
MutableAttributeAccessor dst_attributes = dst_curves.attributes_for_write();

View File

@ -20,6 +20,7 @@
#include "BKE_attribute.hh"
#include "BKE_context.hh"
#include "BKE_curves_utils.hh"
#include "BKE_deform.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_lib_id.hh"
#include "BKE_material.h"
@ -412,6 +413,8 @@ static bke::CurvesGeometry remove_points_and_split(const bke::CurvesGeometry &cu
bke::CurvesGeometry dst_curves(total_points, total_curves);
BKE_defgroup_copy_list(&dst_curves.vertex_group_names, &curves.vertex_group_names);
MutableSpan<int> new_curve_offsets = dst_curves.offsets_for_write();
array_utils::copy(dst_curve_counts.as_span(), new_curve_offsets.drop_back(1));
offset_indices::accumulate_counts_to_offsets(new_curve_offsets);