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-10-09 05:19:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-09 05:20:20 +0300
commit75ac83610baeb296e530d82df8c9913a02f7acd8 (patch)
tree8f2092ae83c18a5ffcbd9b1760475b33c5597872 /source/blender/blenkernel/intern
parentc8c3bbaadeeb469a83f8b3ae47599f28fa94ad30 (diff)
Modifier: add non derived mesh modifier wrappers
Rename modifier_deformVerts_ensure_normals & modifier_applyModifier_ensure_normals with wrappers that match 2.7x convention.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c10
-rw-r--r--source/blender/blenkernel/intern/modifier.c113
-rw-r--r--source/blender/blenkernel/intern/multires_reshape.c2
3 files changed, 78 insertions, 47 deletions
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 *editData, struct DerivedMesh *dm,
+ float (*vertexCos)[3], int numVerts)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -973,9 +1001,10 @@ void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, const Modifie
}
}
-void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct BMEditMesh *editData, struct DerivedMesh *dm,
- float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
+void modifier_deformMatricesEM_DM_deprecated(
+ struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct BMEditMesh *editData, struct DerivedMesh *dm,
+ float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -993,8 +1022,9 @@ void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, const Modi
}
}
-struct DerivedMesh *modifier_applyModifier_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct DerivedMesh *dm)
+struct DerivedMesh *modifier_applyModifier_DM_deprecated(
+ struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct DerivedMesh *dm)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -1021,9 +1051,10 @@ struct DerivedMesh *modifier_applyModifier_DM_deprecated(struct ModifierData *md
}
-struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(struct ModifierData *md, const ModifierEvalContext *ctx,
- struct BMEditMesh *editData,
- struct DerivedMesh *dm)
+struct DerivedMesh *modifier_applyModifierEM_DM_deprecated(
+ struct ModifierData *md, const ModifierEvalContext *ctx,
+ struct BMEditMesh *editData,
+ struct DerivedMesh *dm)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.c
index dcd439e82dc..b14010f3a90 100644
--- a/source/blender/blenkernel/intern/multires_reshape.c
+++ b/source/blender/blenkernel/intern/multires_reshape.c
@@ -944,7 +944,7 @@ bool multiresModifier_reshapeFromDeformModifier(
.depsgraph = depsgraph,
.object = object,
.flag = MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY};
- modifier_deformVerts_ensure_normals(
+ modwrap_deformVerts(
md, &modifier_ctx, multires_mesh, deformed_verts,
multires_mesh->totvert);
BKE_id_free(NULL, multires_mesh);