[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37164] branches/soc-2011-onion: Revision: 29536

Jason Wilkins Jason.A.Wilkins at gmail.com
Sat Jun 4 07:45:06 CEST 2011


Revision: 37164
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37164
Author:   jwilkins
Date:     2011-06-04 05:45:05 +0000 (Sat, 04 Jun 2011)
Log Message:
-----------
Revision: 29536
Author: nicholasbishop
Date: 10:28:27 PM, Thursday, June 17, 2010
Message:
* Changed gridkey to be a struct rather than an int. Has fields for the total number of each type it contains (types currently being coords, masks, normals.)
* This is a step towards having multiple layers of coords or masks.
* Should be no visible change in behavior from this commit.

Modified Paths:
--------------
    branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h
    branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h
    branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.c
    branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.h
    branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
    branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
    branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_undo.c
    branches/soc-2011-onion/source/blender/gpu/GPU_buffers.h
    branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c

Property Changed:
----------------
    branches/soc-2011-onion/


Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-29483,29503,29514
/trunk/blender:36833-37054
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-29483,29503,29514,29536
/trunk/blender:36833-37054

Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-04 05:45:05 UTC (rev 37164)
@@ -721,7 +721,7 @@
         col.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
         col.operator("paint.mask_set", text="Fill").mode = 'FILL'
         col.operator("paint.mask_set", text="Invert").mode = 'INVERT'
-        col.operator("paint.mask_set", text="Random").mode = 'RANDOM'
+        #col.operator("paint.mask_set", text="Random").mode = 'RANDOM'
 
         if context.sculpt_object:
             layout.separator()

Modified: branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/source/blender/blenkernel/BKE_DerivedMesh.h	2011-06-04 05:45:05 UTC (rev 37164)
@@ -71,6 +71,7 @@
 #define SUB_ELEMS_FACE 4
 
 typedef struct DMGridData DMGridData;
+typedef struct GridKey GridKey;
 
 typedef struct DMGridAdjacency {
 	int index[4];
@@ -157,7 +158,7 @@
 	DMGridData **(*getGridData)(DerivedMesh *dm);
 	DMGridAdjacency *(*getGridAdjacency)(DerivedMesh *dm);
 	int *(*getGridOffset)(DerivedMesh *dm);
-	int (*getGridKey)(DerivedMesh *dm);
+	struct GridKey *(*getGridKey)(DerivedMesh *dm);
 
 	/* Iterate over each mapped vertex in the derived mesh, calling the
 	 * given function with the original vert and the mapped vert's new

Modified: branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/source/blender/blenkernel/BKE_subsurf.h	2011-06-04 05:45:05 UTC (rev 37164)
@@ -52,29 +52,25 @@
 
 /* Grids */
 
-/* Format of the data in a grid element */
-typedef enum {
-	GRID_ELEM_KEY_CO_NO = 0,
-	GRID_ELEM_KEY_CO_MASK_NO,
-	GRID_ELEM_KEY_TOTAL
-} DMGridElemKey;
+/* Each grid element can contain zero or more layers of coordinates,
+   paint masks, and normals; these numbers are stored in the GridKey
 
-/* Information about the data stored by each type of key */
-typedef struct {
-	int size;
-	int has_mask;
-	int no_offset;
-	int mask_offset;
-	int interp_count;
-} DMGridElemKeyInfo;
+   For now, co and no can have only zero or one layers, only mask is
+   really variable.
+*/
+struct GridKey {
+	int co;
+	int mask;
+	int no;
+};
 
-extern DMGridElemKeyInfo GridElemKeyInfo[GRID_ELEM_KEY_TOTAL];
+#define GRIDELEM_KEY_INIT(_gridkey, _totco, _totmask, _totno)	\
+	(_gridkey->co = _totco, _gridkey->mask = _totmask, _gridkey->no = _totno)
 
-#define GRIDELEM_SIZE(_key) GridElemKeyInfo[_key].size
-#define GRIDELEM_HAS_MASK(_key) GridElemKeyInfo[_key].has_mask
-#define GRIDELEM_NO_OFFSET(_key) GridElemKeyInfo[_key].no_offset
-#define GRIDELEM_MASK_OFFSET(_key) GridElemKeyInfo[_key].mask_offset
-#define GRIDELEM_INTERP_COUNT(_key) GridElemKeyInfo[_key].interp_count
+#define GRIDELEM_SIZE(_key) ((3*_key->co + _key->mask + 3*_key->no) * sizeof(float))
+#define GRIDELEM_MASK_OFFSET(_key) (_key->mask ? 3*_key->co*sizeof(float) : -1)
+#define GRIDELEM_NO_OFFSET(_key) (_key->no ? (3*_key->co + _key->mask) * sizeof(float) : -1)
+#define GRIDELEM_INTERP_COUNT(_key) (3*_key->co + _key->mask)
 
 #define GRIDELEM_AT(_grid, _elem, _key) (struct DMGridData*)(((char*)(_grid)) + (_elem) * GRIDELEM_SIZE(_key))
 #define GRIDELEM_INC(_grid, _inc, _key) ((_grid) = GRIDELEM_AT(_grid, _inc, _key))

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.c	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.c	2011-06-04 05:45:05 UTC (rev 37164)
@@ -759,6 +759,8 @@
 	_ehash_free(ss->eMap, (EHEntryFreeFP) _edge_free, ss);
 	_ehash_free(ss->vMap, (EHEntryFreeFP) _vert_free, ss);
 
+	MEM_freeN(ss->meshIFC.gridkey);
+
 	CCGSUBSURF_free(ss, ss);
 
 	if (allocatorIFC.release) {
@@ -2576,7 +2578,7 @@
 	}
 }
 
-int ccgSubSurf_getGridKey(CCGSubSurf *ss) {
+struct GridKey *ccgSubSurf_getGridKey(CCGSubSurf *ss) {
 	return ss->meshIFC.gridkey;
 }
 

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.h	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/CCGSubSurf.h	2011-06-04 05:45:05 UTC (rev 37164)
@@ -22,7 +22,7 @@
 	   that would be (3+1) floats, so finterpCount would be 4. */
 	int			finterpCount;
 
-	int			gridkey;
+	struct GridKey*		gridkey;
 };
 
 /***/
@@ -99,7 +99,7 @@
 int			ccgSubSurf_getEdgeLevelSize			(CCGSubSurf *ss, int level);
 int			ccgSubSurf_getGridSize				(CCGSubSurf *ss);
 int			ccgSubSurf_getGridLevelSize			(CCGSubSurf *ss, int level);
-int			ccgSubSurf_getGridKey				(CCGSubSurf *ss);
+struct GridKey*		ccgSubSurf_getGridKey				(CCGSubSurf *ss);
 
 CCGVert*	ccgSubSurf_getVert					(CCGSubSurf *ss, CCGVertHDL v);
 CCGVertHDL	ccgSubSurf_getVertVertHandle		(CCGVert *v);

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/multires.c	2011-06-04 05:45:05 UTC (rev 37164)
@@ -387,7 +387,7 @@
 	}
 }
 
-static void multires_copy_dm_grid(DMGridData *gridA, DMGridData *gridB, int gridkey, int sizeA, int sizeB)
+static void multires_copy_dm_grid(DMGridData *gridA, DMGridData *gridB, GridKey *gridkey, int sizeA, int sizeB)
 {
 	int x, y, j, skip;
 	int size = sizeof(float)*GRIDELEM_INTERP_COUNT(gridkey);
@@ -629,7 +629,7 @@
 	dispdm->release(dispdm);
 }
 
-static DMGridData **copy_grids(DMGridData **grids, int totgrid, int gridsize, int gridkey)
+static DMGridData **copy_grids(DMGridData **grids, int totgrid, int gridsize, GridKey *gridkey)
 {
 	DMGridData **grids_copy = MEM_callocN(sizeof(DMGridData*) * totgrid, "subgrids");
 	int i;
@@ -662,7 +662,8 @@
 		DerivedMesh *lowdm, *cddm, *highdm;
 		DMGridData **highGridData, **lowGridData, **subGridData;
 		CCGSubSurf *ss;
-		int i, numGrids, highGridSize, lowGridSize, gridkey;
+		int i, numGrids, highGridSize, lowGridSize;
+		GridKey *gridkey;
 
 		/* create subsurf DM from original mesh at high level */
 		cddm = CDDM_from_mesh(me, NULL);
@@ -721,7 +722,7 @@
 	multires_subdivide(mmd, ob, mmd->totlvl+1, updateblock, simple);
 }
 
-static void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGridData **gridData, int gridkey, float t[3])
+static void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGridData **gridData, GridKey *gridkey, float t[3])
 {
 	DMGridData *grid = gridData[index];
 
@@ -773,7 +774,8 @@
 	MFace *mface = me->mface;
 	MDisps *mdisps = CustomData_get_layer(&me->fdata, CD_MDISPS);
 	CustomData *stored_grids;
-	int *gridOffset, gridkey;
+	int *gridOffset;
+	GridKey *gridkey;
 	int i, /*numGrids,*/ gridSize, dGridSize, dSkip;
 
 	if(!mdisps) {
@@ -930,7 +932,8 @@
 			DerivedMesh *lowdm, *cddm, *highdm;
 			DMGridData **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid;
 			CCGSubSurf *ss;
-			int i, j, numGrids, highGridSize, lowGridSize, gridkey;
+			int i, j, numGrids, highGridSize, lowGridSize;
+			GridKey *gridkey;
 
 			/* create subsurf DM from original mesh at high level */
 			if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
@@ -1030,7 +1033,8 @@
 	CCGDerivedMesh *ccgdm;
 	DMGridData **gridData, **subGridData;
 	int lvl= multires_get_level(ob, mmd, useRenderParams);
-	int i, gridSize, numGrids, gridkey;
+	int i, gridSize, numGrids;
+	GridKey *gridkey;
 
 	if(lvl == 0)
 		return dm;
@@ -1715,7 +1719,7 @@
 	MDisps *mdisps;
 	int *gridOffset;
 	int i, /*numGrids,*/ gridSize, dGridSize, dSkip, totvert;
-	int gridKey, subGridKey;
+	struct GridKey *gridKey, *subGridKey;
 	float (*vertCos)[3] = NULL;
 	MultiresModifierData *mmd= get_multires_modifier(scene, ob, 1);
 	MultiresModifierData high_mmd;

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c	2011-06-04 04:46:55 UTC (rev 37163)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/subsurf_ccg.c	2011-06-04 05:45:05 UTC (rev 37164)
@@ -71,13 +71,6 @@
 
 #include "CCGSubSurf.h"
 
-/* Declared extern in BKE_subsurf.h */
-DMGridElemKeyInfo GridElemKeyInfo[GRID_ELEM_KEY_TOTAL] = {
-	/*size,            has_mask,  no_offset,        mask_offset,      interp_count */
-	{sizeof(float)*6,  0,         sizeof(float)*3,  -1,               3            },
-	{sizeof(float)*7,  1,         sizeof(float)*4,  sizeof(float)*3,  4            }
-};
-
 static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
 static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
 static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
@@ -101,7 +94,7 @@
 	BLI_memarena_free(a);
 }
 
-static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int gridkey, int subdivLevels, int useAging, int useArena, int UNUSED(useFlatSubdiv)) {
+static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, GridKey *gridkey, int subdivLevels, int useAging, int useArena, int UNUSED(useFlatSubdiv)) {
 	CCGMeshIFC ifc;
 	CCGSubSurf *ccgSS;
 
@@ -330,11 +323,14 @@
 	int index, gridSize, gridFaces, /*edgeSize,*/ totface, x, y, S;

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list