CurvesGeometry: Add initial vertex group support #106944
@ -466,10 +466,6 @@ const ListBase *BKE_id_defgroup_list_get(const ID *id)
|
||||
const bGPdata *gpd = (const bGPdata *)id;
|
||||
return &gpd->vertex_group_names;
|
||||
}
|
||||
case ID_CV: {
|
||||
const Curves *curves_id = reinterpret_cast<const Curves *>(id);
|
||||
return &curves_id->geometry.vertex_group_names;
|
||||
}
|
||||
default: {
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
@ -493,10 +489,6 @@ static const int *object_defgroup_active_index_get_p(const Object *ob)
|
||||
const bGPdata *gpd = (const bGPdata *)ob->data;
|
||||
return &gpd->vertex_group_active_index;
|
||||
}
|
||||
case OB_CURVES: {
|
||||
const Curves *curves_id = static_cast<const Curves *>(ob->data);
|
||||
return &curves_id->geometry.vertex_group_active_index;
|
||||
}
|
||||
default: {
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
|
@ -122,10 +122,6 @@ MDeformVert *BKE_object_defgroup_data_create(ID *id)
|
||||
sizeof(MDeformVert) * lt->pntsu * lt->pntsv * lt->pntsw, "lattice deformVert"));
|
||||
return lt->dvert;
|
||||
}
|
||||
case ID_CV: {
|
||||
Curves *curves_id = reinterpret_cast<Curves *>(id);
|
||||
return curves_id->geometry.wrap().deform_verts_for_write().data();
|
||||
}
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
filedescriptor marked this conversation as resolved
Outdated
|
||||
}
|
||||
@ -206,25 +202,6 @@ bool BKE_object_defgroup_clear(Object *ob, bDeformGroup *dg, const bool use_sele
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ob->type == OB_CURVES) {
|
||||
using namespace blender;
|
||||
Curves *curves_id = static_cast<Curves *>(ob->data);
|
||||
bke::CurvesGeometry &curves = curves_id->geometry.wrap();
|
||||
const Span<MDeformVert> dverts = curves.deform_verts();
|
||||
if (!dverts.is_empty()) {
|
||||
const VArray<bool> selection = *curves.attributes().lookup_or_default<bool>(
|
||||
".selection", ATTR_DOMAIN_POINT, true);
|
||||
|
||||
MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
|
||||
for (const int64_t index : curves.points_range()) {
|
||||
if (&dverts[index] && (!use_selection || selection[index])) {
|
||||
MDeformWeight *dw = BKE_defvert_find_index(&dverts[index], def_nr);
|
||||
BKE_defvert_remove_group(&dverts[index], dw); /* dw can be nullptr */
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
@ -292,11 +269,6 @@ static void object_defgroup_remove_common(Object *ob, bDeformGroup *dg, const in
|
||||
Lattice *lt = object_defgroup_lattice_get((ID *)(ob->data));
|
||||
MEM_SAFE_FREE(lt->dvert);
|
||||
}
|
||||
else if (ob->type == OB_CURVES) {
|
||||
Curves *curves_id = static_cast<Curves *>(ob->data);
|
||||
CustomData_free_layer_active(
|
||||
&curves_id->geometry.point_data, CD_MDEFORMVERT, curves_id->geometry.point_num);
|
||||
}
|
||||
}
|
||||
else if (BKE_object_defgroup_active_index_get(ob) < 1) {
|
||||
/* Keep a valid active index if we still have some vgroups. */
|
||||
@ -390,25 +362,6 @@ static void object_defgroup_remove_edit_mode(Object *ob, bDeformGroup *dg)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ob->type == OB_CURVES) {
|
||||
using namespace blender;
|
||||
Curves *curves_id = static_cast<Curves *>(ob->data);
|
||||
bke::CurvesGeometry &curves = curves_id->geometry.wrap();
|
||||
|
||||
MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
|
||||
threading::parallel_for(curves.points_range(), 4096, [&](const IndexRange range) {
|
||||
for (const int64_t index : range) {
|
||||
MDeformVert *dvert = &dverts[index];
|
||||
if (dvert) {
|
||||
for (int64_t i = 0; i < dvert->totweight; i++) {
|
||||
if (dvert->dw[i].def_nr > def_nr) {
|
||||
dvert->dw[i].def_nr--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
object_defgroup_remove_common(ob, dg, def_nr);
|
||||
}
|
||||
@ -463,11 +416,6 @@ void BKE_object_defgroup_remove_all_ex(Object *ob, bool only_unlocked)
|
||||
Lattice *lt = object_defgroup_lattice_get((ID *)(ob->data));
|
||||
MEM_SAFE_FREE(lt->dvert);
|
||||
}
|
||||
else if (ob->type == OB_CURVES) {
|
||||
Curves *curves_id = static_cast<Curves *>(ob->data);
|
||||
CustomData_free_layer_active(
|
||||
&curves_id->geometry.point_data, CD_MDEFORMVERT, curves_id->geometry.point_num);
|
||||
}
|
||||
/* Fix counters/indices */
|
||||
BKE_object_defgroup_active_index_set(ob, 0);
|
||||
}
|
||||
@ -563,11 +511,6 @@ bool BKE_object_defgroup_array_get(ID *id, MDeformVert **dvert_arr, int *dvert_t
|
||||
*dvert_tot = lt->pntsu * lt->pntsv * lt->pntsw;
|
||||
return true;
|
||||
}
|
||||
case ID_CV: {
|
||||
Curves *curves_id = reinterpret_cast<Curves *>(id);
|
||||
*dvert_arr = const_cast<MDeformVert *>(curves_id->geometry.wrap().deform_verts().data());
|
||||
*dvert_tot = curves_id->geometry.point_num;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
Same here,
ID_CV
andOB_CURVES
don't need to be supported right now (at least in this commit)