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/intern/MOD_uvproject.c | |
parent | 5c6ee6b523c6a53c310683a9f7fbe5d730db6122 (diff) | |
parent | 90ef435145416313596cafa6f8c4c6c6aebe4e44 (diff) |
svn merge ^/trunk/blender -r42680:42722
Diffstat (limited to 'source/blender/modifiers/intern/MOD_uvproject.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_uvproject.c | 33 |
1 files changed, 13 insertions, 20 deletions
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); } } } |