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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-04 09:45:43 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-04 09:45:43 +0300
commit29fc9275c7e0379c9cb37e80c0c0226ded1467f3 (patch)
treeabf520252de59cd89085c8866dc97c5e7528b7e9 /source/blender
parent352aea6b0df5a29c68af5dc5859ba4fff1ffbbbd (diff)
Modifiers: ported wire modifier to mesh
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/modifiers/intern/MOD_wireframe.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c
index f50b1446dc2..b2fe592cb37 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"
@@ -69,14 +71,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,
@@ -93,19 +103,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(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, const ModifierEvalContext *ctx,
- DerivedMesh *dm)
+static Mesh *applyModifier(
+ ModifierData *md,
+ const struct ModifierEvalContext *ctx,
+ struct Mesh *mesh)
{
- return WireframeModifier_do((WireframeModifierData *)md, ctx->object, dm);
+ return WireframeModifier_do((WireframeModifierData *)md, ctx->object, mesh);
}
@@ -123,14 +135,14 @@ ModifierTypeInfo modifierType_Wireframe = {
/* deformMatrices_DM */ NULL,
/* deformVertsEM_DM */ NULL,
/* deformMatricesEM_DM*/NULL,
- /* applyModifier_DM */ applyModifier,
+ /* applyModifier_DM */ NULL,
/* applyModifierEM_DM */NULL,
/* deformVerts */ NULL,
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatricesEM */ NULL,
- /* applyModifier */ NULL,
+ /* applyModifier */ applyModifier,
/* applyModifierEM */ NULL,
/* initData */ initData,