diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_wireframe.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_wireframe.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c index 84a507cd35c..9dfc23fbf5f 100644 --- a/source/blender/modifiers/intern/MOD_wireframe.c +++ b/source/blender/modifiers/intern/MOD_wireframe.c @@ -23,12 +23,14 @@ * \ingroup modifiers */ +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "BLI_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_deform.h" +#include "BKE_mesh.h" #include "MOD_modifiertypes.h" @@ -60,14 +62,22 @@ static bool dependsOnNormals(ModifierData *UNUSED(md)) return true; } -static DerivedMesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, DerivedMesh *dm) +static Mesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, Mesh *mesh) { - DerivedMesh *result; + Mesh *result; BMesh *bm; const int defgrp_index = defgroup_name_index(ob, wmd->defgrp_name); - bm = DM_to_bmesh(dm, true); + bm = BKE_mesh_to_bmesh_ex( + mesh, + &(struct BMeshCreateParams){0}, + &(struct BMeshFromMeshParams){ + .calc_face_normal = true, + .add_key_index = false, + .use_shapekey = true, + .active_shapekey = ob->shapenr, + }); BM_mesh_wireframe( bm, @@ -84,18 +94,21 @@ static DerivedMesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, MAX2(ob->totcol - 1, 0), false); - result = CDDM_from_bmesh(bm, true); + result = BKE_bmesh_to_mesh_nomain(bm, &(struct BMeshToMeshParams){0}); BM_mesh_free(bm); - result->dirty |= DM_DIRTY_NORMALS; + result->runtime.cd_dirty_vert |= CD_MASK_NORMAL; return result; } -static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) +static Mesh *applyModifier( + ModifierData *md, + const struct ModifierEvalContext *ctx, + struct Mesh *mesh) { - return WireframeModifier_do((WireframeModifierData *)md, ob, dm); + return WireframeModifier_do((WireframeModifierData *)md, ctx->object, mesh); } @@ -108,18 +121,26 @@ ModifierTypeInfo modifierType_Wireframe = { eModifierTypeFlag_SupportsEditmode, /* copyData */ modifier_copyData_generic, + + /* deformVerts_DM */ NULL, + /* deformMatrices_DM */ NULL, + /* deformVertsEM_DM */ NULL, + /* deformMatricesEM_DM*/NULL, + /* applyModifier_DM */ NULL, + /* applyModifierEM_DM */NULL, + /* deformVerts */ NULL, /* deformMatrices */ NULL, /* deformVertsEM */ NULL, /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, /* applyModifierEM */ NULL, + /* initData */ initData, /* requiredDataMask */ requiredDataMask, /* freeData */ NULL, /* isDisabled */ NULL, /* updateDepgraph */ NULL, - /* updateDepsgraph */ NULL, /* dependsOnTime */ NULL, /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ NULL, |