Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-02-10 20:03:37 +0300
committerJacques Lucke <jacques@blender.org>2022-02-10 20:03:37 +0300
commit25c4000796833966386b125744b17ede81aa62b1 (patch)
treee729ecb2f083835de90c808ed34d96a27c040873 /source
parent720d653b418bb5760c5891a2c8b74b72ea9889a9 (diff)
Fix T95613: remove anonymous attributes when converting object
This is the same behavior as when applying a geometry nodes modifier that adds anonymous attributes.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_mesh.h2
-rw-r--r--source/blender/blenkernel/intern/mesh.cc8
-rw-r--r--source/blender/editors/object/object_add.c5
-rw-r--r--source/blender/editors/object/object_modifier.c7
4 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index e1c706a82dc..376bb5c8d2e 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -327,6 +327,8 @@ void BKE_mesh_vert_coords_apply_with_mat4(struct Mesh *mesh,
const float mat[4][4]);
void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float (*vert_coords)[3]);
+void BKE_mesh_anonymous_attributes_remove(struct Mesh *mesh);
+
/* *** mesh_tessellate.c *** */
/**
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 73fe279552d..76a15fd0a1c 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1922,6 +1922,14 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh,
BKE_mesh_normals_tag_dirty(mesh);
}
+void BKE_mesh_anonymous_attributes_remove(Mesh *mesh)
+{
+ CustomData_free_layers_anonymous(&mesh->vdata, mesh->totvert);
+ CustomData_free_layers_anonymous(&mesh->edata, mesh->totedge);
+ CustomData_free_layers_anonymous(&mesh->pdata, mesh->totpoly);
+ CustomData_free_layers_anonymous(&mesh->ldata, mesh->totloop);
+}
+
void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spacearr)
{
float(*r_loopnors)[3];
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 8a493eb0743..e9cbd7bed55 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2930,7 +2930,10 @@ static int object_convert_exec(bContext *C, wmOperator *op)
/* Full (edge-angle based) draw calculation should ideally be performed. */
BKE_mesh_edges_set_draw_render(me_eval);
BKE_object_material_from_eval_data(bmain, newob, &me_eval->id);
- BKE_mesh_nomain_to_mesh(me_eval, newob->data, newob, &CD_MASK_MESH, true);
+ Mesh *new_mesh = (Mesh *)newob->data;
+ BKE_mesh_nomain_to_mesh(me_eval, new_mesh, newob, &CD_MASK_MESH, true);
+ /* Anonymous attributes shouldn't be available on the applied geometry. */
+ BKE_mesh_anonymous_attributes_remove(new_mesh);
BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */
}
else if (ob->type == OB_FONT) {
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 4ac2a9dca62..d8247d86e07 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -763,11 +763,8 @@ static bool modifier_apply_obdata(
BKE_object_material_from_eval_data(bmain, ob, &mesh_applied->id);
BKE_mesh_nomain_to_mesh(mesh_applied, me, ob, &CD_MASK_MESH, true);
- /* Anonymous attributes shouldn't by available on the applied geometry. */
- CustomData_free_layers_anonymous(&me->vdata, me->totvert);
- CustomData_free_layers_anonymous(&me->edata, me->totedge);
- CustomData_free_layers_anonymous(&me->pdata, me->totpoly);
- CustomData_free_layers_anonymous(&me->ldata, me->totloop);
+ /* Anonymous attributes shouldn't be available on the applied geometry. */
+ BKE_mesh_anonymous_attributes_remove(me);
if (md_eval->type == eModifierType_Multires) {
multires_customdata_delete(me);