[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11838] branches/soc-2007-red_fox/source/ blender: Beginning the creation of a custom bevel weight flag.

Levi Schooley redfox at hhofministries.org
Mon Aug 27 03:43:17 CEST 2007


Revision: 11838
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11838
Author:   red_fox
Date:     2007-08-27 03:43:09 +0200 (Mon, 27 Aug 2007)

Log Message:
-----------
Beginning the creation of a custom bevel weight flag.

Basically, I've just copied the current crease code where I thought it relevant, duplicating the code but changing the flag name (I'm using a flag called "bweight" now). I've also bound Ctrl-Shift-E to the weighting function (you set it just like you would the edge creases).

I would like a review and comments on this.

Levi

Modified Paths:
--------------
    branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h
    branches/soc-2007-red_fox/source/blender/blenkernel/BKE_global.h
    branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_conversions.c
    branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c
    branches/soc-2007-red_fox/source/blender/blenkernel/intern/DerivedMesh.c
    branches/soc-2007-red_fox/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2007-red_fox/source/blender/blenlib/BLI_editVert.h
    branches/soc-2007-red_fox/source/blender/include/BIF_transform.h
    branches/soc-2007-red_fox/source/blender/include/butspace.h
    branches/soc-2007-red_fox/source/blender/include/transform.h
    branches/soc-2007-red_fox/source/blender/makesdna/DNA_meshdata_types.h
    branches/soc-2007-red_fox/source/blender/src/buttons_editing.c
    branches/soc-2007-red_fox/source/blender/src/drawobject.c
    branches/soc-2007-red_fox/source/blender/src/editmesh.c
    branches/soc-2007-red_fox/source/blender/src/editmesh_tools.c
    branches/soc-2007-red_fox/source/blender/src/header_view3d.c
    branches/soc-2007-red_fox/source/blender/src/space.c
    branches/soc-2007-red_fox/source/blender/src/toolbox.c
    branches/soc-2007-red_fox/source/blender/src/transform.c
    branches/soc-2007-red_fox/source/blender/src/transform_conversions.c

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -99,7 +99,7 @@
 	int eflag1, eflag2;								/*reserved for use by eulers*/
 	int tflag1, tflag2;								/*reserved for use by tools*/
 	unsigned char flag, h;
-	float crease;
+	float crease, bweight;
 } BME_Edge;
 
 typedef struct BME_Loop 

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/BKE_global.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/BKE_global.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/BKE_global.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -196,6 +196,7 @@
 #define G_SCULPTMODE    (1 << 29)
 
 #define G_AUTOMATKEYS	(1 << 30)
+#define G_DRAWBWEIGHTS	(1 << 31)
 
 /* G.fileflags */
 

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_conversions.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_conversions.c	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_conversions.c	2007-08-27 01:43:09 UTC (rev 11838)
@@ -96,6 +96,7 @@
 		v2 = (BME_Vert*)eed->v2->tmp.v;
 		e = BME_ME(bm, v1, v2);
 		e->crease = eed->crease;
+		e->bweight = eed->bweight;
 		e->flag = eed->f & SELECT;
 		if(eed->sharp) e->flag |= ME_SHARP;
 		if(eed->seam) e->flag |= ME_SEAM;
@@ -189,6 +190,7 @@
 	for (e=bm->edges.first;e;e=e->next) {
 		eed= addedgelist(evlist[e->v1->tflag1], evlist[e->v2->tflag1], NULL);
 		eed->crease = e->crease;
+		eed->bweight = e->bweight;
 		if(e->flag & ME_SEAM) eed->seam = 1;
 		if(e->flag & ME_SHARP) eed->sharp = 1;
 		if(e->flag & SELECT) eed->f |= SELECT;
@@ -279,7 +281,8 @@
 		v1 = vert_array[me->v1];
 		v2 = vert_array[me->v2];
 		e = BME_ME(bm, v1, v2);
-		e->crease = me->crease;
+		e->crease = me->crease/255.0f;
+		e->bweight = me->bweight/255.0f;
 		e->flag = (unsigned char)me->flag;
 		BLI_edgehash_insert(edge_hash,me->v1,me->v2,e);
 		CustomData_to_em_block(&dm->edgeData, &bm->edata, i, &e->data);
@@ -366,6 +369,7 @@
 			me->v2 = e->v1->tflag1;
 		}
 		me->crease = (char)(255.0*e->crease);
+		me->bweight = (char)(255.0*e->bweight);
 		me->flag = e->flag;
 		CustomData_from_em_block(&bm->edata, &result->edgeData, e->data, i);
 	}

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c	2007-08-27 01:43:09 UTC (rev 11838)
@@ -322,6 +322,7 @@
 		(*nl)->e->flag = example->flag;
 		(*nl)->e->h = example->h;
 		(*nl)->e->crease = example->crease;
+		(*nl)->e->bweight = example->bweight;
 	}
 
 	return nf;
@@ -343,6 +344,7 @@
 		(*ne)->flag = e->flag;
 		(*ne)->h = e->h;
 		(*ne)->crease = e->crease;
+		(*ne)->bweight = e->bweight;
 	}
 
 	return nv;
@@ -990,7 +992,7 @@
 			e->v2->flag |= SELECT;
 		}
 		else if (options & BME_BEVEL_EWEIGHT) {
-			weight = 1.0f-e->crease/255;
+			weight = e->bweight;
 		}
 		else if (options & BME_BEVEL_ANGLE) {
 			float ang1, ang2;

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/intern/DerivedMesh.c	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/intern/DerivedMesh.c	2007-08-27 01:43:09 UTC (rev 11838)
@@ -767,6 +767,7 @@
 	for(i = 0; i < index; ++i) ee = ee->next;
 
 	edge_r->crease = (unsigned char) (ee->crease*255.0f);
+	edge_r->bweight = (unsigned char) (ee->bweight*255.0f);
 	/* TODO what to do with edge_r->flag? */
 	edge_r->flag = ME_EDGEDRAW|ME_EDGERENDER;
 	if (ee->seam) edge_r->flag |= ME_SEAM;
@@ -863,6 +864,7 @@
 
 	for( ; ee; ee = ee->next, ++edge_r) {
 		edge_r->crease = (unsigned char) (ee->crease*255.0f);
+		edge_r->bweight = (unsigned char) (ee->bweight*255.0f);
 		/* TODO what to do with edge_r->flag? */
 		edge_r->flag = ME_EDGEDRAW|ME_EDGERENDER;
 		if (ee->seam) edge_r->flag |= ME_SEAM;
@@ -1129,6 +1131,7 @@
 				/* not supported yet */
 				edge_r->flag = 0;
 				edge_r->crease = 0;
+				edge_r->bweight = 0;
 				break;
 			}
 		}
@@ -1235,6 +1238,7 @@
 			/* not supported yet */
 			edge_r->flag = 0;
 			edge_r->crease = 0;
+			edge_r->bweight = 0;
 		}
 	}
 }

Modified: branches/soc-2007-red_fox/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/intern/cdderivedmesh.c	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/intern/cdderivedmesh.c	2007-08-27 01:43:09 UTC (rev 11838)
@@ -847,6 +847,7 @@
 		med->v1 = eed->v1->tmp.l;
 		med->v2 = eed->v2->tmp.l;
 		med->crease = (unsigned char) (eed->crease * 255.0f);
+		med->bweight = (unsigned char) (eed->bweight * 255.0f);
 		med->flag = ME_EDGEDRAW|ME_EDGERENDER;
 		
 		if(eed->seam) med->flag |= ME_SEAM;

Modified: branches/soc-2007-red_fox/source/blender/blenlib/BLI_editVert.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenlib/BLI_editVert.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/blenlib/BLI_editVert.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -103,6 +103,7 @@
 	short f1, f2;	/* short, f1 is (ab)used in subdiv */
 	unsigned char f, h, dir, seam, sharp;
 	float crease;
+	float bweight;
 	short fast; 		/* only 0 or 1, for editmesh_fastmalloc */
 	short fgoni;		/* index for fgon, for search */
 	HashEdge hash;

Modified: branches/soc-2007-red_fox/source/blender/include/BIF_transform.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/include/BIF_transform.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/include/BIF_transform.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -56,6 +56,7 @@
 #define TFM_CURVE_SHRINKFATTEN		17
 #define TFM_BONE_ROLL		18
 #define TFM_BEVEL			19
+#define TFM_BWEIGHT			20
 
 /* TRANSFORM CONTEXTS */
 #define CTX_NONE			0

Modified: branches/soc-2007-red_fox/source/blender/include/butspace.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/include/butspace.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/include/butspace.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -408,6 +408,7 @@
 #define B_JOINTRIA			2081
 #define B_SETTFACE_RND		2082
 #define B_SETMCOL_RND		2083
+#define B_DRAWBWEIGHTS		2084
 
 /* *********************** */
 #define B_VGROUPBUTS		2100

Modified: branches/soc-2007-red_fox/source/blender/include/transform.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/include/transform.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/include/transform.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -331,6 +331,9 @@
 int handleEventBevel(TransInfo *t, unsigned short evenl, short val);
 int Bevel(TransInfo *t, short mval[2]);
 
+void initBevelWeight(TransInfo *t);
+int BevelWeight(TransInfo *t, short mval[2]);
+
 void initCrease(TransInfo *t);
 int Crease(TransInfo *t, short mval[2]);
 

Modified: branches/soc-2007-red_fox/source/blender/makesdna/DNA_meshdata_types.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/makesdna/DNA_meshdata_types.h	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/makesdna/DNA_meshdata_types.h	2007-08-27 01:43:09 UTC (rev 11838)
@@ -45,7 +45,7 @@
 
 typedef struct MEdge {
 	unsigned int v1, v2;
-	char crease, pad;
+	char crease, bweight;
 	short flag;
 } MEdge;
 

Modified: branches/soc-2007-red_fox/source/blender/src/buttons_editing.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/src/buttons_editing.c	2007-08-26 15:52:13 UTC (rev 11837)
+++ branches/soc-2007-red_fox/source/blender/src/buttons_editing.c	2007-08-27 01:43:09 UTC (rev 11838)
@@ -4338,6 +4338,10 @@
 		allqueue(REDRAWBUTSEDIT, 0);
 		allqueue(REDRAWVIEW3D, 0);
 		break;
+	//~ case B_DRAWBWEIGHTS:
+		//~ allqueue(REDRAWBUTSEDIT, 0);
+		//~ allqueue(REDRAWVIEW3D, 0);
+		//~ break;
 	case B_JOINTRIA:
 		join_triangles();
 		break;
@@ -4437,11 +4441,12 @@
 	uiBlockEndAlign(block);
 	
 	uiBlockBeginAlign(block);
-	uiDefButBitI(block, TOG, G_DRAWFACES, REDRAWVIEW3D, "Draw Faces",		955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
-	uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D, "Draw Edges", 	955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
-	uiDefButBitI(block, TOG, G_DRAWCREASES, REDRAWVIEW3D, "Draw Creases",	955,44,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
-	uiDefButBitI(block, TOG, G_DRAWSEAMS, REDRAWVIEW3D, "Draw Seams",	955,22,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
-	uiDefButBitI(block, TOG, G_DRAWSHARP, REDRAWVIEW3D, "Draw Sharp",	955,0,150,19, &G.f, 0, 0, 0, 0, "Displays sharp edges, used with the EdgeSplit modifier");
+	uiDefButBitI(block, TOG, G_DRAWFACES, REDRAWVIEW3D, "Draw Faces", 955,110,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
+	uiDefButBitI(block, TOG, G_DRAWEDGES, REDRAWVIEW3D, "Draw Edges", 955, 88,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
+	uiDefButBitI(block, TOG, G_DRAWCREASES, REDRAWVIEW3D, "Draw Creases", 955, 66,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
+	uiDefButBitI(block, TOG, G_DRAWBWEIGHTS, REDRAWVIEW3D, "Draw Bvl Wghts", 955, 44,150,19, &G.f, 0, 0, 0, 0, "Displays weights created for the Bevel modifier");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list