diff options
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvwarp.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index c650ae995db..8e79a035734 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -27,6 +27,7 @@ #include <string.h> +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" @@ -35,7 +36,6 @@ #include "BLI_utildefines.h" #include "BKE_action.h" /* BKE_pose_channel_find_name */ -#include "BKE_cdderivedmesh.h" #include "BKE_deform.h" #include "BKE_library_query.h" #include "BKE_modifier.h" @@ -138,9 +138,9 @@ static void uv_warp_compute( } } -static DerivedMesh *applyModifier( +static Mesh *applyModifier( ModifierData *md, const ModifierEvalContext *ctx, - DerivedMesh *dm) + Mesh *me_eval) { UVWarpModifierData *umd = (UVWarpModifierData *) md; int numPolys, numLoops; @@ -158,12 +158,12 @@ static DerivedMesh *applyModifier( const int axis_v = umd->axis_v; /* make sure there are UV Maps available */ - if (!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) { - return dm; + if (!CustomData_has_layer(&me_eval->ldata, CD_MLOOPUV)) { + return me_eval; } else if (ELEM(NULL, umd->object_src, umd->object_dst)) { modifier_setError(md, "From/To objects must be set"); - return dm; + return me_eval; } /* make sure anything moving UVs is available */ @@ -189,16 +189,16 @@ static DerivedMesh *applyModifier( } /* make sure we're using an existing layer */ - CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, umd->uvlayer_name, uvname); + CustomData_validate_layer_name(&me_eval->ldata, CD_MLOOPUV, umd->uvlayer_name, uvname); - numPolys = dm->getNumPolys(dm); - numLoops = dm->getNumLoops(dm); + numPolys = me_eval->totpoly; + numLoops = me_eval->totloop; - mpoly = dm->getPolyArray(dm); - mloop = dm->getLoopArray(dm); + mpoly = me_eval->mpoly; + mloop = me_eval->mloop; /* make sure we are not modifying the original UV map */ - mloopuv = CustomData_duplicate_referenced_layer_named(&dm->loopData, CD_MLOOPUV, uvname, numLoops); - modifier_get_vgroup(ctx->object, dm, umd->vgroup_name, &dvert, &defgrp_index); + 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); UVWarpData data = {.mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv, .dvert = dvert, .defgrp_index = defgrp_index, @@ -211,9 +211,10 @@ static DerivedMesh *applyModifier( uv_warp_compute, &settings); - dm->dirty |= DM_DIRTY_TESS_CDLAYERS; + /* XXX TODO is this still needed? */ +// me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS; - return dm; + return me_eval; } static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) @@ -260,14 +261,14 @@ ModifierTypeInfo modifierType_UVWarp = { /* deformMatrices_DM */ NULL, /* deformVertsEM_DM */ NULL, /* deformMatricesEM_DM*/NULL, - /* applyModifier_DM */ applyModifier, + /* applyModifier_DM */ NULL, /* applyModifierEM_DM */NULL, /* deformVerts */ NULL, /* deformMatrices */ NULL, /* deformVertsEM */ NULL, /* deformMatricesEM */ NULL, - /* applyModifier */ NULL, + /* applyModifier */ applyModifier, /* applyModifierEM */ NULL, /* initData */ initData, |