Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/geometry_component_mesh.cc
| Show First 20 Lines • Show All 1,128 Lines • ▼ Show 20 Lines | bool try_delete(GeometryComponent &component, const AttributeIDRef &attribute_id) const final | ||||
| } | } | ||||
| MeshComponent &mesh_component = static_cast<MeshComponent &>(component); | MeshComponent &mesh_component = static_cast<MeshComponent &>(component); | ||||
| Mesh *mesh = mesh_component.get_for_write(); | Mesh *mesh = mesh_component.get_for_write(); | ||||
| if (mesh == nullptr) { | if (mesh == nullptr) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| const std::string name = attribute_id.name(); | const std::string name = attribute_id.name(); | ||||
| const int vertex_group_index = BLI_findstringindex( | |||||
| &mesh->vertex_group_names, name.c_str(), offsetof(bDeformGroup, name)); | int index; | ||||
| if (vertex_group_index < 0) { | bDeformGroup *group; | ||||
| if (!BKE_id_defgroup_name_find(&mesh->id, name.c_str(), &index, &group)) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| BLI_remlink(&mesh->vertex_group_names, group); | |||||
| MEM_freeN(group); | |||||
| if (mesh->dvert == nullptr) { | if (mesh->dvert == nullptr) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| for (MDeformVert &dvert : MutableSpan(mesh->dvert, mesh->totvert)) { | for (MDeformVert &dvert : MutableSpan(mesh->dvert, mesh->totvert)) { | ||||
| MDeformWeight *weight = BKE_defvert_find_index(&dvert, vertex_group_index); | MDeformWeight *weight = BKE_defvert_find_index(&dvert, index); | ||||
| BKE_defvert_remove_group(&dvert, weight); | BKE_defvert_remove_group(&dvert, weight); | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| bool foreach_attribute(const GeometryComponent &component, | bool foreach_attribute(const GeometryComponent &component, | ||||
| const AttributeForeachCallback callback) const final | const AttributeForeachCallback callback) const final | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 229 Lines • Show Last 20 Lines | |||||