Commit: 17241bba4c6f5d634854b6bbeb26d7b226063477
Author: Sergey Sharybin
Date:   Mon Jun 16 23:15:18 2014 +0600
https://developer.blender.org/rB17241bba4c6f5d634854b6bbeb26d7b226063477

Merge branch 'master' into opensubdiv-modifier

Conflicts:
        source/blender/blenkernel/intern/subsurf_ccg.c
        source/blender/windowmanager/intern/wm_init_exit.c

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/subsurf_ccg.c
index 15287a4,990e7e9..d927129
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@@ -3688,146 -3680,129 +3688,147 @@@ static CCGDerivedMesh *getCCGDerivedMes
                                        vertNum++;
                                }
                        }
 -              }
  
 -              if (edgeOrigIndex) {
 -                      for (i = 0; i < numFinalEdges; ++i) {
 -                              edgeOrigIndex[edgeNum + i] = ORIGINDEX_NONE;
 -                      }
 -              }
 +                      /*interpolate per-vert data*/
 +                      for (s = 0; s < numVerts; s++) {
 +                              for (y = 1; y < gridFaces; y++) {
 +                                      for (x = 1; x < gridFaces; x++) {
 +                                              w2 = w + s * numVerts * g2_wid 
* g2_wid + (y * g2_wid + x) * numVerts;
 +                                              DM_interp_vert_data(dm, 
&ccgdm->dm, vertidx, w2,
 +                                                                  numVerts, 
vertNum);
 +
 +                                              if (vertOrigIndex) {
 +                                                      *vertOrigIndex = 
ORIGINDEX_NONE;
 +                                                      vertOrigIndex++;
 +                                              }
  
 -              for (s = 0; s < numVerts; s++) {
 -                      /*interpolate per-face data*/
 -                      for (y = 0; y < gridFaces; y++) {
 -                              for (x = 0; x < gridFaces; x++) {
 -                                      w2 = w + s * numVerts * g2_wid * g2_wid 
+ (y * g2_wid + x) * numVerts;
 -                                      CustomData_interp(&dm->loopData, 
&ccgdm->dm.loopData,
 -                                                        loopidx, w2, NULL, 
numVerts, loopindex2);
 -                                      loopindex2++;
 -
 -                                      w2 = w + s * numVerts * g2_wid * g2_wid 
+ ((y + 1) * g2_wid + (x)) * numVerts;
 -                                      CustomData_interp(&dm->loopData, 
&ccgdm->dm.loopData,
 -                                                        loopidx, w2, NULL, 
numVerts, loopindex2);
 -                                      loopindex2++;
 -
 -                                      w2 = w + s * numVerts * g2_wid * g2_wid 
+ ((y + 1) * g2_wid + (x + 1)) * numVerts;
 -                                      CustomData_interp(&dm->loopData, 
&ccgdm->dm.loopData,
 -                                                        loopidx, w2, NULL, 
numVerts, loopindex2);
 -                                      loopindex2++;
 -                                      
 -                                      w2 = w + s * numVerts * g2_wid * g2_wid 
+ ((y) * g2_wid + (x + 1)) * numVerts;
 -                                      CustomData_interp(&dm->loopData, 
&ccgdm->dm.loopData,
 -                                                        loopidx, w2, NULL, 
numVerts, loopindex2);
 -                                      loopindex2++;
 -
 -                                      /*copy over poly data, e.g. mtexpoly*/
 -                                      CustomData_copy_data(&dm->polyData, 
&ccgdm->dm.polyData, origIndex, faceNum, 1);
 -
 -                                      /*generate tessellated face data used 
for drawing*/
 -                                      
ccg_loops_to_corners(&ccgdm->dm.faceData, &ccgdm->dm.loopData,
 -                                                           
&ccgdm->dm.polyData, loopindex2 - 4, faceNum, faceNum,
 -                                                           numTex, numCol, 
hasPCol, hasOrigSpace);
 -                                      
 -                                      /*set original index data*/
 -                                      if (faceOrigIndex) {
 -                                              /* reference the index in 
'polyOrigIndex' */
 -                                              *faceOrigIndex = faceNum;
 -                                              faceOrigIndex++;
 +                                              vertNum++;
                                        }
 -                                      if (polyOrigIndex) {
 -                                              *polyOrigIndex = 
base_polyOrigIndex ? base_polyOrigIndex[origIndex] : origIndex;
 -                                              polyOrigIndex++;
 -                                      }
 -
 -                                      ccgdm->reverseFaceMap[faceNum] = index;
 -
 -                                      /* This is a simple one to one mapping, 
here... */
 -                                      polyidx[faceNum] = faceNum;
 -
 -                                      faceNum++;
                                }
                        }
 -              }
  
 -              edgeNum += numFinalEdges;
 -      }
 +                      if (edgeOrigIndex) {
 +                              for (i = 0; i < numFinalEdges; ++i) {
 +                                      edgeOrigIndex[edgeNum + i] = 
ORIGINDEX_NONE;
 +                              }
 +                      }
  
 -      for (index = 0; index < totedge; ++index) {
 -              CCGEdge *e = ccgdm->edgeMap[index].edge;
 -              int numFinalEdges = edgeSize - 1;
 -              int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
 -              int x;
 -              int vertIdx[2];
 -              int edgeIdx = 
GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
 +                      for (s = 0; s < numVerts; s++) {
 +                              /*interpolate per-face data*/
 +                              for (y = 0; y < gridFaces; y++) {
 +                                      for (x = 0; x < gridFaces; x++) {
 +                                              w2 = w + s * numVerts * g2_wid 
* g2_wid + (y * g2_wid + x) * numVerts;
 +                                              
CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
 +                                                                loopidx, w2, 
NULL, numVerts, loopindex2);
 +                                              loopindex2++;
 +
 +                                              w2 = w + s * numVerts * g2_wid 
* g2_wid + ((y + 1) * g2_wid + (x)) * numVerts;
 +                                              
CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
 +                                                                loopidx, w2, 
NULL, numVerts, loopindex2);
 +                                              loopindex2++;
 +
 +                                              w2 = w + s * numVerts * g2_wid 
* g2_wid + ((y + 1) * g2_wid + (x + 1)) * numVerts;
 +                                              
CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
 +                                                                loopidx, w2, 
NULL, numVerts, loopindex2);
 +                                              loopindex2++;
 +
 +                                              w2 = w + s * numVerts * g2_wid 
* g2_wid + ((y) * g2_wid + (x + 1)) * numVerts;
 +                                              
CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
 +                                                                loopidx, w2, 
NULL, numVerts, loopindex2);
 +                                              loopindex2++;
 +
 +                                              /*copy over poly data, e.g. 
mtexpoly*/
 +                                              
CustomData_copy_data(&dm->polyData, &ccgdm->dm.polyData, origIndex, faceNum, 1);
 +
 +                                              /*generate tessellated face 
data used for drawing*/
 +                                              
ccg_loops_to_corners(&ccgdm->dm.faceData, &ccgdm->dm.loopData,
 +                                                                   
&ccgdm->dm.polyData, loopindex2 - 4, faceNum, faceNum,
 +                                                                   numTex, 
numCol, hasPCol, hasOrigSpace);
 +
 +                                              /*set original index data*/
 +                                              if (faceOrigIndex) {
 +                                                      /* reference the index 
in 'polyOrigIndex' */
 +                                                      *faceOrigIndex = 
faceNum;
 +                                                      faceOrigIndex++;
 +                                              }
 +                                              if (polyOrigIndex) {
 +                                                      *polyOrigIndex = 
base_polyOrigIndex ? base_polyOrigIndex[origIndex] : origIndex;
 +                                                      polyOrigIndex++;
 +                                              }
  
 -              CCGVert *v;
 -              v = ccgSubSurf_getEdgeVert0(e);
 -              vertIdx[0] = 
GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
 -              v = ccgSubSurf_getEdgeVert1(e);
 -              vertIdx[1] = 
GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
 +                                              ccgdm->reverseFaceMap[faceNum] 
= index;
  
 -              ccgdm->edgeMap[index].startVert = vertNum;
 -              ccgdm->edgeMap[index].startEdge = edgeNum;
 +                                              /* This is a simple one to one 
mapping, here... */
 +                                              polyidx[faceNum] = faceNum;
  
 -              if (edgeIdx >= 0 && edgeFlags)
 -                      edgeFlags[edgeIdx] = medge[edgeIdx].flag;
 +                                              faceNum++;
 +                                      }
 +                              }
 +                      }
  
 -              /* set the edge base vert */
 -              *((int *)ccgSubSurf_getEdgeUserData(ss, e)) = vertNum;
 +                      edgeNum += numFinalEdges;
 +              }
  
 -              for (x = 1; x < edgeSize - 1; x++) {
 -                      float w[2];
 -                      w[1] = (float) x / (edgeSize - 1);
 -                      w[0] = 1 - w[1];
 -                      DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, 2, 
vertNum);
 -                      if (vertOrigIndex) {
 -                              *vertOrigIndex = ORIGINDEX_NONE;
 -                              vertOrigIndex++;
 +              for (index = 0; index < totedge; ++index) {
 +                      CCGEdge *e = ccgdm->edgeMap[index].edge;
 +                      int numFinalEdges = edgeSize - 1;
 +                      int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
 +                      int x;
 +                      int vertIdx[2];
 +                      int edgeIdx = 
GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
 +
 +                      CCGVert *v;
 +                      v = ccgSubSurf_getEdgeVert0(e);
 +                      vertIdx[0] = 
GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
 +                      v = ccgSubSurf_getEdgeVert1(e);
 +                      vertIdx[1] = 
GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
 +
 +                      ccgdm->edgeMap[index].startVert = vertNum;
 +                      ccgdm->edgeMap[index].startEdge = edgeNum;
 +
 +                      if (edgeIdx >= 0 && edgeFlags)
 +                              edgeFlags[edgeIdx] = medge[edgeIdx].flag;
 +
 +                      /* set the edge base vert */
 +                      *((int *)ccgSubSurf_getEdgeUserData(ss, e)) = vertNum;
 +
 +                      for (x = 1; x < edgeSize - 1; x++) {
 +                              float w[2];
 +                              w[1] = (float) x / (edgeSize - 1);
 +                              w[0] = 1 - w[1];
 +                              DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, 
2, vertNum);
 +                              if (vertOrigIndex) {
 +                                      *vertOrigIndex = ORIGINDEX_NONE;
 +                                      vertOrigIndex++;
 +                              }
 +                              vertNum++;
                        }
 -                      vertNum++;
 -              }
  
 -              if (has_edge_cd) {
 -                      BLI_assert(edgeIdx >= 0 && edgeIdx < 
dm->getNumEdges(dm));
 -                      for (i = 0; i < numFinalEdges; ++i) {
 -                              CustomData_copy_data(&dm->edgeData, 
&ccgdm->dm.edgeData, edgeIdx, edgeNum + i, 1);
 +                      if (has_edge_cd) {
++                              BLI_assert(edgeIdx >= 0 && edgeIdx < 
dm->getNumEdges(dm));
 +                              for (i = 0; i < numFinalEdges; ++i) {
-                                       CustomData_copy_data(&dm->edgeData, 
&ccgdm->dm.edgeData, mapIndex, edgeNum + i, 1);
++                                      CustomData_copy_data(&dm->edgeData, 
&ccgdm->dm.edgeData, edgeIdx, edgeNum + i, 1);
 +                              }
                        }
 -              }
  
 -              if (edgeOrigIndex) {
 -                      for (i = 0; i < numFinalEdges; ++i) {
 -                              edgeOrigIndex[edgeNum + i] = mapIndex;
 +                      if (edgeOrigIndex) {
 +                              for (i = 0; i < numFinalEdges; ++i) {
 +                                      edgeOrigIndex[edgeNum + i] = mapIndex;
 +                              }
                        }
 -              }
  
 -              edgeNum += numFinalEdges;
 -      }
 +                      edgeNum += numFinalEdges;
 +              }
  
 -      if (useSubsurfUv) {
 -              CustomData *ldata = &ccgdm->dm.loopData;
 -              CustomData *dmldata = &dm->loopData;
 -              int numlayer = CustomData_number_of_layers(ldata, CD_MLOOPUV);
 -              int dmnumlayer = CustomData_number_of_layers(dmldata, 
CD_MLOOPUV);
 +              if (useSubsurfUv) {
 +                      CustomData *ldata = &ccgdm->dm.loopData;
 +                      CustomData *dmldata = &dm->loopData;
 +                      int numlayer = CustomData_number_of_layers(ldata, 
CD_MLOOPUV);
 +                      int dmnumlayer = CustomData_number_of_layers(dmldata, 
CD_MLOOPUV);
  
 -              for (i = 0; i < numlayer && i < dmnumlayer; i++)
 -                      set_subsurf_uv(ss, dm, &ccgdm->dm, i);
 +                      for (i = 0; i < numlayer && i < dmnumlayer; i++)
 +                              set_subsurf_uv(ss, dm, &ccgdm->dm, i);
 +              }
        }
  
        for (index = 0; index < totvert; ++index) {
diff --cc source/blender/windowmanager/intern/wm_init_exit.c
index e2a09ca,675eb5e..967410f
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@@ -494,13 -490,11 +494,15 @@@ void WM_exit_ext(bContext *C, const boo
        (void)do_python;
  #endif
  
 +#ifdef WITH_OPENSUBDIV
 +      openSubdiv_cleanup();
 +#endif
 +
-       GPU_global_buffer_pool_free();
-       GPU_free_unused_buffers();
-       GPU_extensions_exit();
+       if (!G.background) {
+               GPU_global_buffer_pool_free();
+               GPU_free_unused_buffers();
+               GPU_extensions_exit();
+       }
  
        BKE_reset_undo();

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to