made editmode only force smooth shading when vcols are present (as joe suggested)
authorCampbell Barton <ideasman42@gmail.com>
Thu, 27 Mar 2008 11:52:58 +0000 (11:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 27 Mar 2008 11:52:58 +0000 (11:52 +0000)
pythons api's image.unpack() was broken

source/blender/blenkernel/intern/DerivedMesh.c
source/blender/python/api2_2x/Image.c

index 63fa59ccbfe1a1d6990202338acae09eded68428..273575883b8c78773cd0491ec82de86487edcc1c 100644 (file)
@@ -757,12 +757,16 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
                                flag= 1;
 
                        if(flag != 0) { /* flag 0 == the face is hidden or invisible */
-                               if (flag==1 && mcol)
-                                       cp= (unsigned char*)mcol;
-
+                               
                                /* we always want smooth here since otherwise vertex colors dont interpolate */
-                               /* glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT); */
-
+                               if (mcol) {
+                                       if (flag==1) {
+                                               cp= (unsigned char*)mcol;
+                                       }
+                               } else {
+                                       glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT);
+                               } 
+                               
                                glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
                                if (!drawSmooth) {
                                        glNormal3fv(emdm->faceNos[i]);
@@ -826,11 +830,14 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
                                flag= 1;
 
                        if(flag != 0) { /* flag 0 == the face is hidden or invisible */
-                               if (flag==1 && mcol)
-                                       cp= (unsigned char*)mcol;
-
                                /* we always want smooth here since otherwise vertex colors dont interpolate */
-                               /*glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT);*/
+                               if (mcol) {
+                                       if (flag==1) {
+                                               cp= (unsigned char*)mcol;
+                                       }
+                               } else {
+                                       glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT);
+                               } 
 
                                glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
                                if (!drawSmooth) {
index c8217eba2b298709997c4aa1e7e873fa82692cc4..a06079dd18296a4aea5705aca0b948c20b00ba8c 100644 (file)
@@ -191,7 +191,7 @@ static PyMethodDef BPy_Image_methods[] = {
         "(int) - Change Image object animation speed (fps)"},
        {"save", ( PyCFunction ) Image_save, METH_NOARGS,
         "() - Write image buffer to file"},
-       {"unpack", ( PyCFunction ) Image_unpack, METH_VARARGS,
+       {"unpack", ( PyCFunction ) Image_unpack, METH_O,
         "(int) - Unpack image. Uses the values defined in Blender.UnpackModes."},
        {"pack", ( PyCFunction ) Image_pack, METH_NOARGS,
         "() - Pack the image"},