From be4df85919b42cb2cf8a01c904a8552c5c173944 Mon Sep 17 00:00:00 2001 From: Mai Lavelle Date: Wed, 18 Apr 2018 15:45:54 +0200 Subject: Modifiers: Add wrapper functions with Mesh / DerivedMesh conversion Makes the follow changes: - Add new `deform*` and `apply*` function pointers to `ModifierTypeInfo` that take `Mesh`, and rename the old functions to indicate that they take `DerivedMesh`. These new functions are currently set to `NULL` for all modifiers. - Add wrapper `modifier_deform*` and `modifier_apply*` functions in two variants: one that works with `Mesh` and the other which works with `DerivedMesh` that is named with `*_DM_depercated`. These functions check which type of data the modifier supports and converts if necessary - Update the rest of Blender to be aware and make use of these new functions The goal of these changes is to make it possible to port to using `Mesh` incrementally without ever needing to enter into a state where modifiers don't work. After everything has been ported over the old functions and wrappers could be removed. Reviewers: campbellbarton, sergey, mont29 Subscribers: sybren Tags: #bf_blender_2.8 Differential Revision: https://developer.blender.org/D3155 --- source/blender/blenkernel/intern/crazyspace.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/crazyspace.c') diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c index f5795444b7d..ad332220032 100644 --- a/source/blender/blenkernel/intern/crazyspace.c +++ b/source/blender/blenkernel/intern/crazyspace.c @@ -276,7 +276,7 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh( if (!editbmesh_modifier_is_enabled(scene, md, dm)) continue; - if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { + if (mti->type == eModifierTypeType_OnlyDeform && (mti->deformMatricesEM || mti->deformMatricesEM_DM)) { if (!defmats) { const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; CustomDataMask data_mask = CD_MASK_BAREMESH; @@ -292,8 +292,7 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh( unit_m3(defmats[a]); } - mti->deformMatricesEM(md, depsgraph, ob, em, dm, deformedVerts, defmats, - numVerts); + modifier_deformMatricesEM_DM_deprecated(md, depsgraph, ob, em, dm, deformedVerts, defmats, numVerts); } else break; @@ -350,7 +349,9 @@ int BKE_sculpt_get_first_deform_matrices( unit_m3(defmats[a]); } - if (mti->deformMatrices) mti->deformMatrices(md, depsgraph, ob, dm, deformedVerts, defmats, numVerts); + if (mti->deformMatrices || mti->deformMatrices_DM) { + modifier_deformMatrices_DM_deprecated(md, depsgraph, ob, dm, deformedVerts, defmats, numVerts); + } else break; } } @@ -397,10 +398,10 @@ void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, Scene *scene, Obje if (mti->type == eModifierTypeType_OnlyDeform) { /* skip leading modifiers which have been already * handled in sculpt_get_first_deform_matrices */ - if (mti->deformMatrices && !deformed) + if ((mti->deformMatrices || mti->deformMatrices_DM) && !deformed) continue; - mti->deformVerts(md, depsgraph, ob, NULL, deformedVerts, me->totvert, 0); + modifier_deformVerts_DM_deprecated(md, depsgraph, ob, NULL, deformedVerts, me->totvert, 0); deformed = 1; } } -- cgit v1.2.3