Fix #30270, #30265: cycles not displaying textured objects, and not rendering
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 21 Feb 2012 14:39:59 +0000 (14:39 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 21 Feb 2012 14:39:59 +0000 (14:39 +0000)
text/curve objects after the bmesh merge. Also removed a debug print.

CMakeLists.txt
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/makesrna/intern/rna_object_api.c

index fab87c04ef98e8f6d21dc71863304540466e4c10..d973c7c946558fd4fb5356a2a5df57ef9c7c74bb 100644 (file)
@@ -254,7 +254,6 @@ if(APPLE)
                "Choose the minimum OSX version required: 10.4 or 10.5"
                FORCE)
        endif()
-       MESSAGE(STATUS ${CMAKE_GENERATOR})
        if(${CMAKE_GENERATOR} MATCHES "Xcode")
                if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4)
                        # Xcode 4 defaults to the Apple LLVM Compiler.
index 7e491ff5f7c8d561b8bca757aee0b9782e69a407..ca453cc6703843fdd20b06e964aa7222ad116804 100644 (file)
@@ -2628,7 +2628,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                attribs->tface[a].array = tfdata->layers[layer].data;
                                attribs->tface[a].emOffset = tfdata->layers[layer].offset;
                                attribs->tface[a].glIndex = gattribs->layer[b].glindex;
-                               /* attribs->tface[a].glTexco = gattribs->layer[b].gltexco; */ /* BMESH_TODO, trunk has this but not bmesh, need to investigate whats going on here - campbell */
+                               attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
                        }
                        /* BMESH ONLY, may need to get this working?, otherwise remove */
                        /* else {
index 766febc06031d06b3636083f153d89092d4bef7c..5a82fde8487e9c1e283cd9cd9aaad18b08158a43 100644 (file)
@@ -1129,12 +1129,18 @@ static void emDM_drawMappedFacesMat(
 
 #define PASSATTRIB(loop, eve, vert) {                                                                                  \
        if (attribs.totorco) {                                                                                                          \
-               float *orco = attribs.orco.array[BM_elem_index_get(eve)];                                               \
-               glVertexAttrib3fvARB(attribs.orco.glIndex, orco);                                               \
+               float *orco = attribs.orco.array[BM_elem_index_get(eve)];                               \
+               if (attribs.orco.glTexco)                                                                                               \
+                       glTexCoord3fv(orco);                                                                                            \
+               else                                                                                                                                    \
+                       glVertexAttrib3fvARB(attribs.orco.glIndex, orco);                                       \
        }                                                                                                                                                       \
        for (b = 0; b < attribs.tottface; b++) {                                                                        \
                MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
-               glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);                               \
+               if (attribs.tface[b].glTexco)                                                                                   \
+                       glTexCoord2fv(_luv->uv);                                                                                        \
+               else                                                                                                                                    \
+                       glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);                       \
        }                                                                                                                                                       \
        for (b = 0; b < attribs.totmcol; b++) {                                                                         \
                MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
index d736a18068d2c3da98af58695a6aeefc791d408c..78c3c66579709cdfeb2727a6f6d224b4748e67b5 100644 (file)
@@ -116,7 +116,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
                copycu->editnurb = NULL;
 
                nurbs_to_mesh( tmpobj );
-               
+
                /* nurbs_to_mesh changes the type to a mesh, check it worked */
                if (tmpobj->type != OB_MESH) {
                        free_libblock_us( &(G.main->object), tmpobj );
@@ -239,11 +239,14 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
                break;
        } /* end copy materials */
 
+       /* cycles and exporters rely on this still */
+       BKE_mesh_tessface_ensure(tmpmesh);
+
        /* we don't assign it to anything */
        tmpmesh->id.us--;
        
        /* make sure materials get updated in objects */
-       test_object_materials( ( ID * ) tmpmesh );
+       test_object_materials(&tmpmesh->id);
 
        return tmpmesh;
 }