Fix [#29256] Import images as planes add on doesn't work correctly in bmesh
authorAndrew Wiggin <ender79bl@gmail.com>
Thu, 17 Nov 2011 18:48:49 +0000 (18:48 +0000)
committerAndrew Wiggin <ender79bl@gmail.com>
Thu, 17 Nov 2011 18:48:49 +0000 (18:48 +0000)
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/subsurf_ccg.c

index 1e09dc43f61058c3108b64797259b96d144153e7..5985049ea565a640e8e6af43c25d87e44d5c6400 100644 (file)
@@ -1454,6 +1454,12 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
        }
 #endif /* WITH_GAMEENGINE */
 
+       /* Re-tesselation is necessary to push render data (uvs, textures, colors)
+          from loops and polys onto the tessfaces. This may be currently be redundant
+          in cases where the render mode doesn't use these inputs, but ideally
+          eventually tesselation would happen on-demand, and this is one of the primary
+          places it would be needed. */
+       finaldm->recalcTesselation(finaldm);
        finaldm->calcNormals(finaldm);
 
        *final_r = finaldm;
index c890ca9d01f87630b6b3ea1bac98c7e59f676e47..bf055592e3da0317ca452395dc24e2d3e3159eb4 100644 (file)
@@ -1644,8 +1644,7 @@ static CDDerivedMesh *cdDM_create(const char *desc)
        dm->getTessFaceDataArray = DM_get_tessface_data_layer;
 
        dm->calcNormals = CDDM_calc_normals;
-       //doesn't work yet for all cases
-       //dm->recalcTesselation = CDDM_recalc_tesselation;
+       dm->recalcTesselation = CDDM_recalc_tesselation;
 
        dm->getVertCos = cdDM_getVertCos;
        dm->getVertCo = cdDM_getVertCo;
index 9e82bae91950f8c4e4c610c22bebc3af3635f995..5f23b547e984efff5d7d315fceefb3998f607dfb 100644 (file)
@@ -2758,6 +2758,11 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
        return ccgdm->pbvh;
 }
 
+static void ccgDM_recalcTesselection(DerivedMesh *UNUSED(dm))
+{
+       /* Nothing to do: CCG handles creating its own tessfaces */
+}
+
 static void ccgDM_calcNormals(DerivedMesh *UNUSED(dm))
 {
        /* Nothing to do: CCG calculates normals during drawing */
@@ -2853,6 +2858,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
        ccgdm->dm.getTessFaceData = DM_get_face_data;
 
        ccgdm->dm.calcNormals = ccgDM_calcNormals;
+       ccgdm->dm.recalcTesselation = ccgDM_recalcTesselection;
 
        ccgdm->dm.getVertCos = cgdm_getVertCos;
        ccgdm->dm.foreachMappedVert = cgdm_foreachMappedVert;