[Bf-blender-cvs] [75ac83610ba] blender2.8: Modifier: add non derived mesh modifier wrappers
Campbell Barton
noreply at git.blender.org
Tue Oct 9 04:21:54 CEST 2018
Commit: 75ac83610baeb296e530d82df8c9913a02f7acd8
Author: Campbell Barton
Date: Tue Oct 9 13:19:21 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB75ac83610baeb296e530d82df8c9913a02f7acd8
Modifier: add non derived mesh modifier wrappers
Rename modifier_deformVerts_ensure_normals &
modifier_applyModifier_ensure_normals with wrappers that match 2.7x
convention.
===================================================================
M source/blender/blenkernel/BKE_modifier.h
M source/blender/blenkernel/intern/DerivedMesh.c
M source/blender/blenkernel/intern/modifier.c
M source/blender/blenkernel/intern/multires_reshape.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index ee5a76302db..581b69619f2 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -427,20 +427,34 @@ const char *modifier_path_relbase_from_global(struct Object *ob);
struct DerivedMesh *modwrap_applyModifier_DM_deprecated(
ModifierData *md, const struct ModifierEvalContext *ctx,
struct DerivedMesh *dm);
+struct Mesh *modwrap_applyModifier(
+ ModifierData *md, const struct ModifierEvalContext *ctx,
+ struct Mesh *me);
struct DerivedMesh *modwrap_applyModifierEM_DM_deprecated(
ModifierData *md, const struct ModifierEvalContext *ctx,
struct BMEditMesh *em, struct DerivedMesh *dm);
+struct Mesh *modwrap_applyModifierEM(
+ ModifierData *md, const struct ModifierEvalContext *ctx,
+ struct BMEditMesh *em, struct Mesh *me);
void modwrap_deformVerts_DM_deprecated(
ModifierData *md, const struct ModifierEvalContext *ctx,
struct DerivedMesh *dm,
float (*vertexCos)[3], int numVerts);
+void modwrap_deformVerts(
+ ModifierData *md, const struct ModifierEvalContext *ctx,
+ struct Mesh *me,
+ float (*vertexCos)[3], int numVerts);
void modwrap_deformVertsEM_DM_deprecated(
ModifierData *md, const struct ModifierEvalContext *ctx,
struct BMEditMesh *em, struct DerivedMesh *dm,
float (*vertexCos)[3], int numVerts);
+void modwrap_deformVertsEM(
+ ModifierData *md, const struct ModifierEvalContext *ctx,
+ struct BMEditMesh *em, struct Mesh *me,
+ float (*vertexCos)[3], int numVerts);
#define applyModifier_DM_wrapper(NEW_FUNC_NAME, OLD_FUNC_NAME) \
static Mesh *NEW_FUNC_NAME(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) \
@@ -456,16 +470,6 @@ void modwrap_deformVertsEM_DM_deprecated(
* depending on if the modifier has been ported to Mesh or is still using DerivedMesh
*/
-void modifier_deformVerts_ensure_normals(
- struct ModifierData *md, const struct ModifierEvalContext *ctx,
- struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
-
-struct Mesh *modifier_applyModifier_ensure_normals(
- struct ModifierData *md, const struct ModifierEvalContext *ctx,
- struct Mesh *mesh);
-
-/* deprecated variants of above that accept DerivedMesh */
-
void modifier_deformVerts_DM_deprecated(
struct ModifierData *md, const struct ModifierEvalContext *ctx,
struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 605ffb41344..e4c2c935a33 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1560,7 +1560,7 @@ static void mesh_calc_modifiers(
if (!deformedVerts)
deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
- modifier_deformVerts_ensure_normals(md, &mectx_deform, NULL, deformedVerts, numVerts);
+ modwrap_deformVerts(md, &mectx_deform, NULL, deformedVerts, numVerts);
}
else {
break;
@@ -1700,7 +1700,7 @@ static void mesh_calc_modifiers(
}
}
- modifier_deformVerts_ensure_normals(md, &mectx_deform, mesh, deformedVerts, numVerts);
+ modwrap_deformVerts(md, &mectx_deform, mesh, deformedVerts, numVerts);
}
else {
/* determine which data layers are needed by following modifiers */
@@ -1767,7 +1767,7 @@ static void mesh_calc_modifiers(
}
}
- Mesh *new_mesh = modifier_applyModifier_ensure_normals(md, &mectx_apply, mesh);
+ Mesh *new_mesh = modwrap_applyModifier(md, &mectx_apply, mesh);
ASSERT_IS_VALID_MESH(new_mesh);
if (new_mesh) {
@@ -1798,7 +1798,7 @@ static void mesh_calc_modifiers(
(mti->requiredDataMask ?
mti->requiredDataMask(ob, md) : 0));
- new_mesh = modifier_applyModifier_ensure_normals(md, &mectx_orco, orco_mesh);
+ new_mesh = modwrap_applyModifier(md, &mectx_orco, orco_mesh);
ASSERT_IS_VALID_MESH(new_mesh);
if (new_mesh) {
@@ -1821,7 +1821,7 @@ static void mesh_calc_modifiers(
nextmask &= ~CD_MASK_CLOTH_ORCO;
mesh_set_only_copy(cloth_orco_mesh, nextmask | CD_MASK_ORIGINDEX);
- new_mesh = modifier_applyModifier_ensure_normals(md, &mectx_orco, cloth_orco_mesh);
+ new_mesh = modwrap_applyModifier(md, &mectx_orco, cloth_orco_mesh);
ASSERT_IS_VALID_DM(new_mesh);
if (new_mesh) {
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index d9d3730b29f..2a7c900379b 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -838,6 +838,18 @@ struct DerivedMesh *modwrap_applyModifier_DM_deprecated(
}
return modifier_applyModifier_DM_deprecated(md, ctx, dm);
}
+struct Mesh *modwrap_applyModifier(
+ ModifierData *md, const ModifierEvalContext *ctx,
+ struct Mesh *me)
+{
+ const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ BLI_assert(CustomData_has_layer(&me->pdata, CD_NORMAL) == false);
+
+ if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ BKE_mesh_calc_normals(me);
+ }
+ return mti->applyModifier(md, ctx, me);
+}
struct DerivedMesh *modwrap_applyModifierEM_DM_deprecated(
ModifierData *md, const ModifierEvalContext *ctx,
@@ -851,6 +863,18 @@ struct DerivedMesh *modwrap_applyModifierEM_DM_deprecated(
}
return modifier_applyModifierEM_DM_deprecated(md, ctx, em, dm);
}
+struct Mesh *modwrap_applyModifierEM(
+ ModifierData *md, const ModifierEvalContext *ctx,
+ struct BMEditMesh *em, Mesh *me)
+{
+ const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ BLI_assert(CustomData_has_layer(&me->pdata, CD_NORMAL) == false);
+
+ if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ BKE_mesh_calc_normals(me);
+ }
+ return mti->applyModifierEM(md, ctx, em, me);
+}
void modwrap_deformVerts_DM_deprecated(
ModifierData *md, const ModifierEvalContext *ctx,
@@ -864,6 +888,18 @@ void modwrap_deformVerts_DM_deprecated(
}
modifier_deformVerts_DM_deprecated(md, ctx, dm, vertexCos, numVerts);
}
+void modwrap_deformVerts(
+ ModifierData *md, const ModifierEvalContext *ctx,
+ Mesh *me, float (*vertexCos)[3], int numVerts)
+{
+ const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ BLI_assert(!me || CustomData_has_layer(&me->pdata, CD_NORMAL) == false);
+
+ if (me && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ BKE_mesh_calc_normals(me);
+ }
+ mti->deformVerts(md, ctx, me, vertexCos, numVerts);
+}
void modwrap_deformVertsEM_DM_deprecated(
ModifierData *md, const ModifierEvalContext *ctx,
@@ -878,43 +914,33 @@ void modwrap_deformVertsEM_DM_deprecated(
}
modifier_deformVertsEM_DM_deprecated(md, ctx, em, dm, vertexCos, numVerts);
}
-/* end modifier callback wrappers */
-
-
-/* wrappers for modifier callbacks that accept Mesh and select the proper implementation
- * depending on if the modifier has been ported to Mesh or is still using DerivedMesh
- */
-
-void modifier_deformVerts_ensure_normals(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct Mesh *mesh,
- float (*vertexCos)[3], int numVerts)
+void modwrap_deformVertsEM(
+ ModifierData *md, const ModifierEvalContext *ctx,
+ struct BMEditMesh *em, Mesh *me,
+ float (*vertexCos)[3], int numVerts)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- BLI_assert(!mesh || CustomData_has_layer(&mesh->pdata, CD_NORMAL) == false);
+ BLI_assert(!me || CustomData_has_layer(&me->pdata, CD_NORMAL) == false);
- if (mesh && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
- BKE_mesh_calc_normals(mesh);
+ if (me && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+ BKE_mesh_calc_normals(me);
}
- mti->deformVerts(md, ctx, mesh, vertexCos, numVerts);
+ mti->deformVertsEM(md, ctx, em, me, vertexCos, numVerts);
}
-struct Mesh *modifier_applyModifier_ensure_normals(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct Mesh *mesh)
-{
- const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- BLI_assert(CustomData_has_layer(&mesh->pdata, CD_NORMAL) == false);
+/* end modifier callback wrappers */
- if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
- BKE_mesh_calc_normals(mesh);
- }
- return mti->applyModifier(md, ctx, mesh);
-}
+
+/* wrappers for modifier callbacks that accept Mesh and select the proper implementation
+ * depending on if the modifier has been ported to Mesh or is still using DerivedMesh
+ */
/* deprecated variants of above that accept DerivedMesh */
-void modifier_deformVerts_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+void modifier_deformVerts_DM_deprecated(
+ struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct DerivedMesh *dm,
+ float (*vertexCos)[3], int numVerts)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -932,9 +958,10 @@ void modifier_deformVerts_DM_deprecated(struct ModifierData *md, const ModifierE
}
}
-void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct DerivedMesh *dm,
- float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
+void modifier_deformMatrices_DM_deprecated(
+ struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct DerivedMesh *dm,
+ float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -953,9 +980,10 @@ void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, const Modifi
}
}
-void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct BMEditMesh *editData, struct DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+void modifier_deformVertsEM_DM_deprecated(
+ struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct BMEditMesh *edit
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list