diff options
author | Hans Goudey <h.goudey@me.com> | 2022-04-26 16:06:04 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-26 16:06:04 +0300 |
commit | db45292d8e0c29f399cba191e33f8388d9254357 (patch) | |
tree | c5540f9c433449f1d0e1d05a9a7daa209db8b62f /source/blender/editors/object | |
parent | b7458f909cc2ada343207603f0ecbf0c42b28173 (diff) |
Cleanup: Move anonymous attribute removal to geometry component
Implementing removal of anonymous attributes with `GeometryComponent`
instead of `Mesh` makes it more reusable for other types like curves.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.cc | 7 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.cc | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 508d452bfe4..5b857d2dba1 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -52,6 +52,7 @@ #include "BKE_duplilist.h" #include "BKE_effect.h" #include "BKE_geometry_set.h" +#include "BKE_geometry_set.hh" #include "BKE_gpencil_curve.h" #include "BKE_gpencil_geom.h" #include "BKE_gpencil_modifier.h" @@ -3120,8 +3121,12 @@ static int object_convert_exec(bContext *C, wmOperator *op) BKE_object_material_from_eval_data(bmain, newob, &me_eval->id); 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); + MeshComponent component; + component.replace(new_mesh, GeometryOwnershipType::Editable); + component.attributes_remove_anonymous(); + BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */ } else if (ob->type == OB_FONT) { diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc index 8b2dbd4a865..8dec2a5eb1c 100644 --- a/source/blender/editors/object/object_modifier.cc +++ b/source/blender/editors/object/object_modifier.cc @@ -41,6 +41,7 @@ #include "BKE_displist.h" #include "BKE_editmesh.h" #include "BKE_effect.h" +#include "BKE_geometry_set.hh" #include "BKE_global.h" #include "BKE_gpencil_modifier.h" #include "BKE_key.h" @@ -750,7 +751,9 @@ static bool modifier_apply_obdata( BKE_mesh_nomain_to_mesh(mesh_applied, me, ob, &CD_MASK_MESH, true); /* Anonymous attributes shouldn't be available on the applied geometry. */ - BKE_mesh_anonymous_attributes_remove(me); + MeshComponent component; + component.replace(me, GeometryOwnershipType::Editable); + component.attributes_remove_anonymous(); if (md_eval->type == eModifierType_Multires) { multires_customdata_delete(me); |