diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-19 14:40:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-19 14:40:48 +0400 |
commit | 2457d4f5abd65095ae48be937ed43d026d47124a (patch) | |
tree | 79c9b666420fa06262c90fa8f9d11ec77e285719 /source/blender/modifiers | |
parent | 5c6ee6b523c6a53c310683a9f7fbe5d730db6122 (diff) | |
parent | 90ef435145416313596cafa6f8c4c6c6aebe4e44 (diff) |
svn merge ^/trunk/blender -r42680:42722
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 33 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 14 |
3 files changed, 26 insertions, 25 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 86e16df0be5..0da5135ac26 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -79,8 +79,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) /* we don't want to overwrite any referenced layers */ /* - Dosnt work here! - mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT); + Doesn't work here! + mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, numVerts); cddm->mvert = mv; */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index bd82001dd1b..8f2d248b956 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -259,11 +259,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal); } + numFaces = dm->getNumTessFaces(dm); + /* make sure we are not modifying the original UV map */ tface = CustomData_duplicate_referenced_layer_named(&dm->faceData, - CD_MTFACE, uvname); + CD_MTFACE, uvname, numFaces); - numVerts = dm->getNumVerts(dm); coords = MEM_callocN(sizeof(*coords) * numVerts, @@ -295,15 +296,11 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, } else { /* apply transformed coords as UVs */ - tface->uv[0][0] = coords[mf->v1][0]; - tface->uv[0][1] = coords[mf->v1][1]; - tface->uv[1][0] = coords[mf->v2][0]; - tface->uv[1][1] = coords[mf->v2][1]; - tface->uv[2][0] = coords[mf->v3][0]; - tface->uv[2][1] = coords[mf->v3][1]; - if(mf->v4) { - tface->uv[3][0] = coords[mf->v4][0]; - tface->uv[3][1] = coords[mf->v4][1]; + copy_v2_v2(tface->uv[0], coords[mf->v1]); + copy_v2_v2(tface->uv[1], coords[mf->v2]); + copy_v2_v2(tface->uv[2], coords[mf->v3]); + if (mf->v4) { + copy_v2_v2(tface->uv[3], coords[mf->v4]); } } } else { @@ -358,15 +355,11 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, mul_project_m4_v3(best_projector->projmat, co4); /* apply transformed coords as UVs */ - tface->uv[0][0] = co1[0]; - tface->uv[0][1] = co1[1]; - tface->uv[1][0] = co2[0]; - tface->uv[1][1] = co2[1]; - tface->uv[2][0] = co3[0]; - tface->uv[2][1] = co3[1]; - if(mf->v4) { - tface->uv[3][0] = co4[0]; - tface->uv[3][1] = co4[1]; + copy_v2_v2(tface->uv[0], co1); + copy_v2_v2(tface->uv[1], co2); + copy_v2_v2(tface->uv[2], co3); + if (mf->v4) { + copy_v2_v2(tface->uv[3], co4); } } } diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 8b44f262e41..db561eb59a6 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -449,9 +449,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der MEM_freeN(tdw); /* Get our vertex coordinates. */ - v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos"); - for (i = 0; i < numIdx; i++) - ret->getVertCo(ret, indices[i], v_cos[i]); + { + /* XXX In some situations, this code can be up to about 50 times more performant + * than simply using getVertCo for each affected vertex... + */ + float (*tv_cos)[3] = MEM_mallocN(sizeof(float[3]) * numVerts, "WeightVGProximity Modifier, tv_cos"); + v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos"); + ret->getVertCos(ret, tv_cos); + for (i = 0; i < numIdx; i++) + copy_v3_v3(v_cos[i], tv_cos[indices[i]]); + MEM_freeN(tv_cos); + } /* Compute wanted distances. */ if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) { |