svn merge -r39765:39781 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Tue, 30 Aug 2011 00:23:11 +0000 (00:23 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 30 Aug 2011 00:23:11 +0000 (00:23 +0000)
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/editderivedbmesh.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/editors/space_outliner/outliner_ops.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/gameengine/Converter/KX_ConvertControllers.cpp

index fae7e1492a2404beca5adea46d08ca7d6d209f43..73f0602cf3e4be45209af520675b1aece61f79e6 100644 (file)
@@ -338,7 +338,8 @@ struct DerivedMesh {
                                                        int (*setDrawOptions)(void *userData, int index,
                                                                                                  int *drawSmooth_r),
                                                        void *userData, int useColors,
-                                                       int (*setMaterial)(int, void *attribs));
+                                                       int (*setMaterial)(int, void *attribs),
+                                                       int (*compareDrawOptions)(void *userData, int cur_index, int next_index));
 
        /* Draw mapped faces using MTFace 
         *  o Drawing options too complicated to enumerate, look at code.
index e517f4ae7b105ead0525efeef96a650ef6a1b551..ad70e00a33ce1f350a47ace908c4b3ada52d3022 100644 (file)
@@ -874,7 +874,8 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tfa
        cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL);
 }
 
-static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs))
+static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs),
+                       int (*compareDrawOptions)(void *userData, int cur_index, int next_index))
 {
        CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
        MVert *mv = cddm->mvert;
@@ -991,6 +992,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
                                        MFace *mface= mf + actualFace;
                                        int drawSmooth= (mface->flag & ME_SMOOTH);
                                        int draw = 1;
+                                       int flush = 0;
 
                                        if(i != tottri-1)
                                                next_actualFace= dm->drawObject->triangle_to_mface[i+1];
@@ -1005,11 +1007,28 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
                                        /* Goal is to draw as long of a contiguous triangle
                                           array as possible, so draw when we hit either an
                                           invisible triangle or at the end of the array */
-                                       if(!draw || i == tottri - 1 || mf[actualFace].mat_nr != mf[next_actualFace].mat_nr) {
-                                               if(prevstart != i)
-                                                       /* Add one to the length (via `draw')
-                                                          if we're drawing at the end of the array */
-                                                       glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
+
+                                       /* flush buffer if current triangle isn't drawable or it's last triangle... */
+                                       flush= !draw || i == tottri - 1;
+
+                                       /* ... or when material setting is dissferent  */
+                                       flush|= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr;
+
+                                       if(!flush && compareDrawOptions) {
+                                               int next_orig= (index==NULL) ? next_actualFace : index[next_actualFace];
+
+                                               /* also compare draw options and flush buffer if they're different
+                                                  need for face selection highlight in edit mode */
+                                               flush|= compareDrawOptions(userData, orig, next_orig) == 0;
+                                       }
+
+                                       if(flush) {
+                                               int first= prevstart*3;
+                                               int count= (i-prevstart+(draw ? 1 : 0))*3; /* Add one to the length if we're drawing at the end of the array */
+
+                                               if(count)
+                                                       glDrawArrays(GL_TRIANGLES, first, count);
+
                                                prevstart = i + 1;
                                        }
                                }
index 9098ce248e09d5d1b81dcb6e540dc1d45117f126..bd9bbf7646a2d0ba61635ac10aafb306f1487257 100644 (file)
@@ -583,7 +583,8 @@ static void bmDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use
 static void bmDM_drawMappedFaces(DerivedMesh *dm, 
        int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), 
        void *userData, int useColors, 
-       int (*setMaterial)(int, void *attribs))
+       int (*setMaterial)(int, void *attribs),
+       int (*compareDrawOptions)(void *userData, int cur_index, int next_index))
 {
        EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMFace *efa;
@@ -592,7 +593,11 @@ static void bmDM_drawMappedFaces(DerivedMesh *dm,
 
        /*BMESH_TODO*/
        (void)useColors;
-       (void)setMaterial;
+
+       (void)setMaterial; /* UNUSED */
+
+       /* currently unused -- each original face is handled separately */
+       (void)compareDrawOptions;
 
        if (bmdm->vertexCos) {
                BMVert *eve;
index 5a96ce295fbf4f06fd7232540e0ea42e1058cce9..429323e38dd1a70122447f8a8a169b1ebb66f4c0 100644 (file)
@@ -1998,7 +1998,8 @@ static void cgdm_drawUVEdges(DerivedMesh *dm)
        }
 }
 
-static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) {
+static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs),
+                       int (*compareDrawOptions)(void *userData, int cur_index, int next_index)) {
        CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm;
        CCGSubSurf *ss = cgdm->ss;
        MCol *mcol= NULL;
@@ -2006,6 +2007,9 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u
        char *faceFlags = cgdm->faceFlags;
        int gridFaces = gridSize - 1, totface;
 
+       /* currently unused -- each original face is handled separately */
+       (void)compareDrawOptions;
+
        if(useColors) {
                mcol = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
                if(!mcol)
index f3e2c352172d504680d6a73e21af1ee3269bf0b6..2917aa5ffda1f0b8f1425f948889eb5bbc6a02fd 100644 (file)
@@ -90,8 +90,8 @@ void outliner_keymap(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
        
-       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_RELEASE, 0, 0)->ptr, "extend", 0);
-       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, 0, 0)->ptr, "extend", 0);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0)->ptr, "extend", 1);
        
        RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0)->ptr, "all", 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", 1);
index 9a6e14fcbad7ce4575505728e01e7e2f33428c2a..0b671dd970507c9184df0a8eae5929a709248976 100644 (file)
@@ -634,7 +634,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
        }
        else if(faceselect) {
                if(ob->mode & OB_MODE_WEIGHT_PAINT)
-                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material);
+                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material, NULL);
                else
                        dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me);
        }
index 4b560048b68cd1321e8fd12dc1e553ae28dc9abe..6cd27d6178a00b76d02f10397a9750af60cf7a6e 100644 (file)
@@ -2070,6 +2070,28 @@ static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNU
        return 0;
 }
 
+static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int next_index)
+{
+       struct { unsigned char *cols[3]; BMEditMesh *em; BMFace *efa_act; Mesh *me;} * data = userData;
+       BMFace *efa = EDBM_get_face_for_index(data->em, index);
+       BMFace *next_efa = EDBM_get_face_for_index(data->em, next_index);
+       unsigned char *col, *next_col;
+
+       if(efa == next_efa)
+               return 1;
+
+       if(efa == data->efa_act || next_efa == data->efa_act)
+               return 0;
+
+       col = data->cols[BM_TestHFlag(efa, BM_SELECT)?1:0];
+       next_col = data->cols[BM_TestHFlag(next_efa, BM_SELECT)?1:0];
+
+       if(col[3]==0 || next_col[3]==0)
+               return 0;
+
+       return col == next_col;
+}
+
 /* also draws the active face */
 static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, 
                              unsigned char *selCol, unsigned char *actCol, BMFace *efa_act, Mesh *me) 
@@ -2083,7 +2105,7 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
        data.efa_act = efa_act;
        data.me = me;
 
-       dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material);
+       dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions);
 }
 
 static int draw_dm_creases__setDrawOptions(void *userData, int index)
@@ -2517,7 +2539,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
 
                        glEnable(GL_LIGHTING);
                        glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-                       finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, me->edit_btmesh, 0, GPU_enable_material);
+                       finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, me->edit_btmesh, 0, GPU_enable_material, NULL);
 
                        glFrontFace(GL_CCW);
                        glDisable(GL_LIGHTING);
@@ -2746,7 +2768,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                        /* weight paint in solid mode, special case. focus on making the weights clear
                         * rather than the shading, this is also forced in wire view */
                        GPU_enable_material(0, NULL);
-                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material);
+                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL);
                
                        bglPolygonOffset(rv3d->dist, 1.0);
                        glDepthMask(0); // disable write in zbuffer, selected edge wires show better
@@ -2826,7 +2848,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                                glEnable(GL_LIGHTING);
                                glEnable(GL_COLOR_MATERIAL);
 
-                               dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material);
+                               dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL);
                                glDisable(GL_COLOR_MATERIAL);
                                glDisable(GL_LIGHTING);
 
@@ -2834,10 +2856,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                        }
                        else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
                                if(me->mcol)
-                                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material);
+                                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material, NULL);
                                else {
                                        glColor3f(1.0f, 1.0f, 1.0f);
-                                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material);
+                                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material, NULL);
                                }
                        }
                }
@@ -6537,7 +6559,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
 
        if (facecol) {
                ptrs[1] = (void*)(intptr_t) 1;
-               dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, ptrs, 0, GPU_enable_material);
+               dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, ptrs, 0, GPU_enable_material, NULL);
 
                if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
                        glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
@@ -6548,7 +6570,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
                }
 
        } else {
-               dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, ptrs, 0, GPU_enable_material);
+               dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, ptrs, 0, GPU_enable_material, NULL);
        }
 }
 
@@ -6577,8 +6599,8 @@ static void bbs_mesh_solid(Scene *scene, Object *ob)
        
        glColor3ub(0, 0, 0);
                
-       if((me->editflag & ME_EDIT_PAINT_MASK)) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material);
-       else                                                                    dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material);
+       if((me->editflag & ME_EDIT_PAINT_MASK)) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material, NULL);
+       else                                                                    dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material, NULL);
 
        dm->release(dm);
 }
@@ -6685,7 +6707,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
                        GPU_end_object_materials();
                }
                else if(edm)
-                       edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material);
+                       edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material, NULL);
                
                glDisable(GL_LIGHTING);
        }
index 89a9141f9429a30c69cf3ca45d125dc0f4f3a7bd..0d56afcdbc52e92dc2afb519f0a57cd62643d401 100644 (file)
@@ -51,6 +51,7 @@ struct Curve;
 struct EditBone;
 struct EditFace;
 struct EditMesh;
+struct EnvMap;
 struct ID;
 struct FCurve;
 struct ImBuf;
@@ -163,6 +164,7 @@ double elbeemEstimateMemreq(int res, float sx, float sy, float sz, int refine, c
 struct Render *RE_NewRender(const char *name){return (struct Render*) NULL;}
 void RE_SwapResult(struct Render *re, struct RenderResult **rr){}
 void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame){}
+int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct EnvMap *env, const char *relpath, int imtype, float layout[12]) { return 0; }
 
 /* rna */
 float *give_cursor(struct Scene *scene, struct View3D *v3d){return (float *) NULL;}
index 98afc3a690aa12387205a6fd7c142bb32645f72a..fafaaf5cef6fa507d01967bcaed40c24c02ac9e5 100644 (file)
@@ -210,7 +210,11 @@ void BL_ConvertControllers(
                        CIntValue* uniqueval = new CIntValue(uniqueint);
                        uniquename += uniqueval->GetText();
                        uniqueval->Release();
-                       gamecontroller->SetName(uniquename);
+                       //unique name was never implemented for sensors and actuators, only for controllers
+                       //and it's producing difference in the keys for the lists: obj.controllers/sensors/actuators
+                       //at some point it should either be implemented globally (and saved as a separate var) or removed.
+                       //gamecontroller->SetName(uniquename);
+                       gamecontroller->SetName(bcontr->name);
                        gameobj->AddController(gamecontroller);
                        
                        converter->RegisterGameController(gamecontroller, bcontr);