Modifiers: port shapekey modifier, some cleanup.
This commit is contained in:
parent
97c99fb034
commit
c850fcc2c0
|
@ -34,11 +34,11 @@
|
|||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_particle.h"
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
static void deformVerts(
|
||||
ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
|
||||
DerivedMesh *UNUSED(derivedData),
|
||||
Mesh *UNUSED(mesh),
|
||||
float (*vertexCos)[3],
|
||||
int numVerts)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ static void deformVerts(
|
|||
}
|
||||
|
||||
static void deformMatrices(
|
||||
ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
|
||||
ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||
{
|
||||
Key *key = BKE_key_from_object(ctx->object);
|
||||
|
@ -81,26 +81,26 @@ static void deformMatrices(
|
|||
copy_m3_m3(defMats[a], scale);
|
||||
}
|
||||
|
||||
deformVerts(md, ctx, derivedData, vertexCos, numVerts);
|
||||
deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||
}
|
||||
|
||||
static void deformVertsEM(
|
||||
ModifierData *md, const ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *UNUSED(editData),
|
||||
DerivedMesh *derivedData,
|
||||
Mesh *mesh,
|
||||
float (*vertexCos)[3],
|
||||
int numVerts)
|
||||
{
|
||||
Key *key = BKE_key_from_object(ctx->object);
|
||||
|
||||
if (key && key->type == KEY_RELATIVE)
|
||||
deformVerts(md, ctx, derivedData, vertexCos, numVerts);
|
||||
deformVerts(md, ctx, mesh, vertexCos, numVerts);
|
||||
}
|
||||
|
||||
static void deformMatricesEM(
|
||||
ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
|
||||
struct BMEditMesh *UNUSED(editData),
|
||||
DerivedMesh *UNUSED(derivedData),
|
||||
Mesh *UNUSED(mesh),
|
||||
float (*vertexCos)[3],
|
||||
float (*defMats)[3][3],
|
||||
int numVerts)
|
||||
|
@ -132,17 +132,17 @@ ModifierTypeInfo modifierType_ShapeKey = {
|
|||
|
||||
/* copyData */ NULL,
|
||||
|
||||
/* deformVerts_DM */ deformVerts,
|
||||
/* deformMatrices_DM */ deformMatrices,
|
||||
/* deformVertsEM_DM */ deformVertsEM,
|
||||
/* deformMatricesEM_DM*/deformMatricesEM,
|
||||
/* deformVerts_DM */ NULL,
|
||||
/* deformMatrices_DM */ NULL,
|
||||
/* deformVertsEM_DM */ NULL,
|
||||
/* deformMatricesEM_DM*/NULL,
|
||||
/* applyModifier_DM */ NULL,
|
||||
/* applyModifierEM_DM */NULL,
|
||||
|
||||
/* deformVerts */ NULL,
|
||||
/* deformMatrices */ NULL,
|
||||
/* deformVertsEM */ NULL,
|
||||
/* deformMatricesEM */ NULL,
|
||||
/* deformVerts */ deformVerts,
|
||||
/* deformMatrices */ deformMatrices,
|
||||
/* deformVertsEM */ deformVertsEM,
|
||||
/* deformMatricesEM */ deformMatricesEM,
|
||||
/* applyModifier */ NULL,
|
||||
/* applyModifierEM */ NULL,
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_library.h"
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "BLI_bitmap.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_deform.h"
|
||||
|
|
|
@ -140,7 +140,7 @@ static void uv_warp_compute(
|
|||
|
||||
static Mesh *applyModifier(
|
||||
ModifierData *md, const ModifierEvalContext *ctx,
|
||||
Mesh *me_eval)
|
||||
Mesh *mesh)
|
||||
{
|
||||
UVWarpModifierData *umd = (UVWarpModifierData *) md;
|
||||
int numPolys, numLoops;
|
||||
|
@ -158,12 +158,12 @@ static Mesh *applyModifier(
|
|||
const int axis_v = umd->axis_v;
|
||||
|
||||
/* make sure there are UV Maps available */
|
||||
if (!CustomData_has_layer(&me_eval->ldata, CD_MLOOPUV)) {
|
||||
return me_eval;
|
||||
if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
|
||||
return mesh;
|
||||
}
|
||||
else if (ELEM(NULL, umd->object_src, umd->object_dst)) {
|
||||
modifier_setError(md, "From/To objects must be set");
|
||||
return me_eval;
|
||||
return mesh;
|
||||
}
|
||||
|
||||
/* make sure anything moving UVs is available */
|
||||
|
@ -189,16 +189,16 @@ static Mesh *applyModifier(
|
|||
}
|
||||
|
||||
/* make sure we're using an existing layer */
|
||||
CustomData_validate_layer_name(&me_eval->ldata, CD_MLOOPUV, umd->uvlayer_name, uvname);
|
||||
CustomData_validate_layer_name(&mesh->ldata, CD_MLOOPUV, umd->uvlayer_name, uvname);
|
||||
|
||||
numPolys = me_eval->totpoly;
|
||||
numLoops = me_eval->totloop;
|
||||
numPolys = mesh->totpoly;
|
||||
numLoops = mesh->totloop;
|
||||
|
||||
mpoly = me_eval->mpoly;
|
||||
mloop = me_eval->mloop;
|
||||
mpoly = mesh->mpoly;
|
||||
mloop = mesh->mloop;
|
||||
/* make sure we are not modifying the original UV map */
|
||||
mloopuv = CustomData_duplicate_referenced_layer_named(&me_eval->ldata, CD_MLOOPUV, uvname, numLoops);
|
||||
modifier_get_vgroup_mesh(ctx->object, me_eval, umd->vgroup_name, &dvert, &defgrp_index);
|
||||
mloopuv = CustomData_duplicate_referenced_layer_named(&mesh->ldata, CD_MLOOPUV, uvname, numLoops);
|
||||
modifier_get_vgroup_mesh(ctx->object, mesh, umd->vgroup_name, &dvert, &defgrp_index);
|
||||
|
||||
UVWarpData data = {.mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv,
|
||||
.dvert = dvert, .defgrp_index = defgrp_index,
|
||||
|
@ -214,7 +214,7 @@ static Mesh *applyModifier(
|
|||
/* XXX TODO is this still needed? */
|
||||
// me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS;
|
||||
|
||||
return me_eval;
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "DNA_modifier_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_bvhutils.h"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_deform.h"
|
||||
|
|
Loading…
Reference in New Issue