Cleanup: Remove some DerivedMesh wrappers for modifiers
Specifically the deformVerts_DM, deformMatrices_DM, deformVertsEM_DM and deformMatricesEM_DM functions are not used anymore. Reviewer: brecht
This commit is contained in:
parent
e81f7f25ac
commit
3614d9d2a2
|
@ -164,32 +164,10 @@ typedef struct ModifierTypeInfo {
|
|||
|
||||
/********************* Deform modifier functions *********************/ /* DEPRECATED */
|
||||
|
||||
/* Only for deform types, should apply the deformation
|
||||
* to the given vertex array. If the deformer requires information from
|
||||
* the object it can obtain it from the derivedData argument if non-NULL,
|
||||
* and otherwise the ob argument.
|
||||
*/
|
||||
void (*deformVerts_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct DerivedMesh *derivedData,
|
||||
float (*vertexCos)[3], int numVerts);
|
||||
|
||||
/* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */
|
||||
void (*deformMatrices_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct DerivedMesh *derivedData,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||
|
||||
/* Like deformVerts but called during editmode (for supporting modifiers)
|
||||
*/
|
||||
void (*deformVertsEM_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData,
|
||||
struct DerivedMesh *derivedData,
|
||||
float (*vertexCos)[3], int numVerts);
|
||||
|
||||
/* Set deform matrix per vertex for crazyspace correction */
|
||||
void (*deformMatricesEM_DM)(struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData,
|
||||
struct DerivedMesh *derivedData,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||
void (*deformVerts_DM_removed)(void);
|
||||
void (*deformMatrices_DM_removed)(void);
|
||||
void (*deformVertsEM_DM_removed)(void);
|
||||
void (*deformMatricesEM_DM_removed)(void);
|
||||
|
||||
/********************* Non-deform modifier functions *********************/ /* DEPRECATED */
|
||||
|
||||
|
@ -490,28 +468,10 @@ void modwrap_deformVertsEM(
|
|||
* depending on if the modifier has been ported to Mesh or is still using DerivedMesh
|
||||
*/
|
||||
|
||||
void modifier_deformVerts(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||
|
||||
void modifier_deformVerts_ensure_normals(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh, float (*vertexCos)[3], int numVerts);
|
||||
|
||||
void modifier_deformMatrices(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||
|
||||
void modifier_deformVertsEM(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||
float (*vertexCos)[3], int numVerts);
|
||||
|
||||
void modifier_deformMatricesEM(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
|
||||
|
||||
struct Mesh *modifier_applyModifier(
|
||||
struct ModifierData *md, const struct ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh);
|
||||
|
|
|
@ -2608,7 +2608,7 @@ static void editbmesh_calc_modifiers(
|
|||
}
|
||||
}
|
||||
|
||||
if (mti->deformVertsEM || mti->deformVertsEM_DM)
|
||||
if (mti->deformVertsEM)
|
||||
modwrap_deformVertsEM(md, &mectx, em, dm, deformedVerts, numVerts);
|
||||
else
|
||||
modwrap_deformVerts(md, &mectx, dm, deformedVerts, numVerts);
|
||||
|
|
|
@ -277,7 +277,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 || mti->deformMatricesEM_DM)) {
|
||||
if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
|
||||
if (!defmats) {
|
||||
const int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
|
||||
CustomDataMask data_mask = CD_MASK_BAREMESH;
|
||||
|
@ -351,7 +351,7 @@ int BKE_sculpt_get_first_deform_matrices(
|
|||
unit_m3(defmats[a]);
|
||||
}
|
||||
|
||||
if (mti->deformMatrices || mti->deformMatrices_DM) {
|
||||
if (mti->deformMatrices) {
|
||||
modifier_deformMatrices_DM_deprecated(md, &mectx, dm, deformedVerts, defmats, numVerts);
|
||||
}
|
||||
else break;
|
||||
|
@ -401,10 +401,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 || mti->deformMatrices_DM) && !deformed)
|
||||
if (mti->deformMatrices && !deformed)
|
||||
continue;
|
||||
|
||||
modifier_deformVerts(md, &mectx, NULL, deformedVerts, me->totvert);
|
||||
mti->deformVerts(md, &mectx, NULL, deformedVerts, me->totvert);
|
||||
deformed = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -864,7 +864,7 @@ static void curve_calc_modifiers_pre(
|
|||
deformedVerts = BKE_curve_nurbs_vertexCos_get(nurb, &numVerts);
|
||||
}
|
||||
|
||||
modifier_deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
|
||||
mti->deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
|
||||
|
||||
if (md == pretessellatePoint)
|
||||
break;
|
||||
|
@ -970,15 +970,13 @@ static void curve_calc_modifiers_post(
|
|||
if (!vertCos) {
|
||||
vertCos = BKE_mesh_vertexCos_get(modified, &totvert);
|
||||
}
|
||||
|
||||
modifier_deformVerts(md, &mectx_deform, modified, vertCos, totvert);
|
||||
mti->deformVerts(md, &mectx_deform, modified, vertCos, totvert);
|
||||
}
|
||||
else {
|
||||
if (!vertCos) {
|
||||
vertCos = displist_get_allverts(dispbase, &totvert);
|
||||
}
|
||||
|
||||
modifier_deformVerts(md, &mectx_deform, NULL, vertCos, totvert);
|
||||
mti->deformVerts(md, &mectx_deform, NULL, vertCos, totvert);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1052,7 +1052,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
|
|||
if (mti->type != eModifierTypeType_OnlyDeform) continue;
|
||||
|
||||
if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob_orig, &numVerts);
|
||||
modifier_deformVerts(md, &mectx, NULL, vertexCos, numVerts);
|
||||
mti->deformVerts(md, &mectx, NULL, vertexCos, numVerts);
|
||||
}
|
||||
|
||||
if (ob->id.tag & LIB_TAG_COPIED_ON_WRITE) {
|
||||
|
|
|
@ -1144,7 +1144,7 @@ Mesh *BKE_mesh_create_derived_for_modifier(
|
|||
int numVerts;
|
||||
float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
|
||||
|
||||
modifier_deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
|
||||
mti->deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
|
||||
BKE_id_copy_ex(
|
||||
NULL, &me->id, (ID **)&result,
|
||||
LIB_ID_CREATE_NO_MAIN |
|
||||
|
|
|
@ -710,7 +710,7 @@ bool modifiers_usesArmature(Object *ob, bArmature *arm)
|
|||
bool modifier_isCorrectableDeformed(ModifierData *md)
|
||||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
return (mti->deformMatricesEM != NULL) || (mti->deformMatricesEM_DM != NULL);
|
||||
return mti->deformMatricesEM != NULL;
|
||||
}
|
||||
|
||||
bool modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob)
|
||||
|
@ -885,29 +885,6 @@ void modwrap_deformVertsEM(
|
|||
* depending on if the modifier has been ported to Mesh or is still using DerivedMesh
|
||||
*/
|
||||
|
||||
void modifier_deformVerts(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh,
|
||||
float (*vertexCos)[3], int numVerts)
|
||||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformVerts) {
|
||||
mti->deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||
}
|
||||
else {
|
||||
DerivedMesh *dm = NULL;
|
||||
if (mesh) {
|
||||
dm = CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_EVERYTHING);
|
||||
}
|
||||
|
||||
mti->deformVerts_DM(md, ctx, dm, vertexCos, numVerts);
|
||||
|
||||
if (dm) {
|
||||
dm->release(dm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void modifier_deformVerts_ensure_normals(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh,
|
||||
float (*vertexCos)[3], int numVerts)
|
||||
|
@ -918,76 +895,7 @@ void modifier_deformVerts_ensure_normals(struct ModifierData *md, const Modifier
|
|||
if (mesh && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
|
||||
BKE_mesh_calc_normals(mesh);
|
||||
}
|
||||
modifier_deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||
}
|
||||
|
||||
void modifier_deformMatrices(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||
struct Mesh *mesh,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformMatrices) {
|
||||
mti->deformMatrices(md, ctx, mesh, vertexCos, defMats, numVerts);
|
||||
}
|
||||
else {
|
||||
DerivedMesh *dm = NULL;
|
||||
if (mesh) {
|
||||
dm = CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_EVERYTHING);
|
||||
}
|
||||
|
||||
mti->deformMatrices_DM(md, ctx, dm, vertexCos, defMats, numVerts);
|
||||
|
||||
if (dm) {
|
||||
dm->release(dm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void modifier_deformVertsEM(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||
float (*vertexCos)[3], int numVerts)
|
||||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformVertsEM) {
|
||||
mti->deformVertsEM(md, ctx, editData, mesh, vertexCos, numVerts);
|
||||
}
|
||||
else {
|
||||
DerivedMesh *dm = NULL;
|
||||
if (mesh) {
|
||||
dm = CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_EVERYTHING);
|
||||
}
|
||||
|
||||
mti->deformVertsEM_DM(md, ctx, editData, dm, vertexCos, numVerts);
|
||||
|
||||
if (dm) {
|
||||
dm->release(dm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void modifier_deformMatricesEM(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *editData, struct Mesh *mesh,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformMatricesEM) {
|
||||
mti->deformMatricesEM(md, ctx, editData, mesh, vertexCos, defMats, numVerts);
|
||||
}
|
||||
else {
|
||||
DerivedMesh *dm = NULL;
|
||||
if (mesh) {
|
||||
dm = CDDM_from_mesh_ex(mesh, CD_REFERENCE, CD_MASK_EVERYTHING);
|
||||
}
|
||||
|
||||
mti->deformMatricesEM_DM(md, ctx, editData, dm, vertexCos, defMats, numVerts);
|
||||
|
||||
if (dm) {
|
||||
dm->release(dm);
|
||||
}
|
||||
}
|
||||
mti->deformVerts(md, &ctx, mesh, vertexCos, numVerts);
|
||||
}
|
||||
|
||||
struct Mesh *modifier_applyModifier(struct ModifierData *md, const ModifierEvalContext *ctx,
|
||||
|
@ -1057,22 +965,17 @@ void modifier_deformVerts_DM_deprecated(struct ModifierData *md, const ModifierE
|
|||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformVerts_DM) {
|
||||
mti->deformVerts_DM(md, ctx, dm, vertexCos, numVerts);
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
else {
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
|
||||
mti->deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||
mti->deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1083,22 +986,17 @@ void modifier_deformMatrices_DM_deprecated(struct ModifierData *md, const Modifi
|
|||
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformMatrices_DM) {
|
||||
mti->deformMatrices_DM(md, ctx, dm, vertexCos, defMats, numVerts);
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
else {
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
|
||||
mti->deformMatrices(md, ctx, mesh, vertexCos, defMats, numVerts);
|
||||
mti->deformMatrices(md, ctx, mesh, vertexCos, defMats, numVerts);
|
||||
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1108,22 +1006,17 @@ void modifier_deformVertsEM_DM_deprecated(struct ModifierData *md, const Modifie
|
|||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformVertsEM_DM) {
|
||||
mti->deformVertsEM_DM(md, ctx, editData, dm, vertexCos, numVerts);
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
else {
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
|
||||
mti->deformVertsEM(md, ctx, editData, mesh, vertexCos, numVerts);
|
||||
mti->deformVertsEM(md, ctx, editData, mesh, vertexCos, numVerts);
|
||||
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1133,22 +1026,17 @@ void modifier_deformMatricesEM_DM_deprecated(struct ModifierData *md, const Modi
|
|||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
|
||||
|
||||
if (mti->deformMatricesEM_DM) {
|
||||
mti->deformMatricesEM_DM(md, ctx, editData, dm, vertexCos, defMats, numVerts);
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
else {
|
||||
/* TODO(sybren): deduplicate all the copies of this code in this file. */
|
||||
Mesh *mesh = NULL;
|
||||
if (dm != NULL) {
|
||||
mesh = BKE_id_new_nomain(ID_ME, NULL);
|
||||
DM_to_mesh(dm, mesh, ctx->object, CD_MASK_EVERYTHING, false);
|
||||
}
|
||||
|
||||
mti->deformMatricesEM(md, ctx, editData, mesh, vertexCos, defMats, numVerts);
|
||||
mti->deformMatricesEM(md, ctx, editData, mesh, vertexCos, defMats, numVerts);
|
||||
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
if (mesh != NULL) {
|
||||
BKE_id_free(NULL, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
|
|||
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
|
||||
|
||||
vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts);
|
||||
modifier_deformVerts(md, &mectx, NULL, vertexCos, numVerts);
|
||||
mti->deformVerts(md, &mectx, NULL, vertexCos, numVerts);
|
||||
BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos);
|
||||
|
||||
MEM_freeN(vertexCos);
|
||||
|
|
Loading…
Reference in New Issue