[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50712] trunk/blender/source: code cleanup : remove vertex/weight paint's VP_COLINDEX, this feature worked in the code but wasnt accessible from the UI this wasn 't even accessible from the UI in 2.4x.

Campbell Barton ideasman42 at gmail.com
Tue Sep 18 06:55:53 CEST 2012


Revision: 50712
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50712
Author:   campbellbarton
Date:     2012-09-18 04:55:52 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
code cleanup: remove vertex/weight paint's VP_COLINDEX, this feature worked in the code but wasnt accessible from the UI this wasn't even accessible from the UI in 2.4x.
This would only paint onto faces from the active material. however we're better off using selection here IMHO (adding support for material selection in paint mask mode).

also quiet some warnings.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2012-09-18 04:40:20 UTC (rev 50711)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2012-09-18 04:55:52 UTC (rev 50712)
@@ -2227,19 +2227,7 @@
 		if (indexar[0]) totindex = 1;
 		else totindex = 0;
 	}
-			
-	if (wp->flag & VP_COLINDEX) {
-		for (index = 0; index < totindex; index++) {
-			if (indexar[index] && indexar[index] <= me->totpoly) {
-				MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
-						
-				if (mpoly->mat_nr != ob->actcol - 1) {
-					indexar[index] = 0;
-				}
-			}
-		}
-	}
-			
+
 	if ((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
 		for (index = 0; index < totindex; index++) {
 			if (indexar[index] && indexar[index] <= me->totpoly) {
@@ -2639,53 +2627,14 @@
 	return 1;
 }
 
-#if 0
-static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob,
-                              const unsigned int index, const float mval[2],
-                              const float brush_size_pressure, const float brush_alpha_pressure,
-                              int UNUSED(flip))
+static void copy_lcol_to_mcol(MCol *mcol, const MLoopCol *lcol)
 {
-	ViewContext *vc = &vpd->vc;
-	Brush *brush = paint_brush(&vp->paint);
-	Mesh *me = BKE_mesh_from_object(ob);
-	MFace *mface = &me->mface[index];
-	unsigned int *mcol = ((unsigned int *)me->mcol) + 4 * index;
-	unsigned int *mcolorig = ((unsigned int *)vp->vpaint_prev) + 4 * index;
-	float alpha;
-	int i;
-
-	int brush_alpha_pressure_i;
-	
-	if ((vp->flag & VP_COLINDEX && mface->mat_nr != ob->actcol - 1) ||
-	    ((me->editflag & ME_EDIT_PAINT_MASK) && !(mface->flag & ME_FACE_SEL)))
-		return;
-
-	if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
-		unsigned int fcol1 = mcol_blend(mcol[0], mcol[1], 128);
-		if (mface->v4) {
-			unsigned int fcol2 = mcol_blend(mcol[2], mcol[3], 128);
-			vpd->paintcol = mcol_blend(fcol1, fcol2, 128);
-		}
-		else {
-			vpd->paintcol = mcol_blend(mcol[2], fcol1, 170);
-		}
-	}
-
-	brush_alpha_pressure_i = (int)(brush_alpha_pressure * 255.0f);
-
-	for (i = 0; i < (mface->v4 ? 4 : 3); ++i) {
-		alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos + 6 * (&mface->v1)[i],
-		                         mval, brush_size_pressure, brush_alpha_pressure);
-		if (alpha) {
-			const int alpha_i = (int)(alpha * 255.0f);
-			mcol[i] = vpaint_blend(vp, mcol[i], mcolorig[i], vpd->paintcol, alpha_i, brush_alpha_pressure_i);
-		}
-	}
+	mcol->a = lcol->a;
+	mcol->r = lcol->r;
+	mcol->g = lcol->g;
+	mcol->b = lcol->b;
 }
-#endif
 
-/* BMESH version of vpaint_paint_face (commented above) */
-
 static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
                               const unsigned int index, const float mval[2],
                               const float brush_size_pressure, const float brush_alpha_pressure)
@@ -2744,33 +2693,22 @@
 	}
 
 	if (vpd->use_fast_update) {
-
-#ifdef CPYCOL
-#  undef CPYCOL
-#endif
-#define CPYCOL(c, l) (c)->a = (l)->a, (c)->r = (l)->r, (c)->g = (l)->g, (c)->b = (l)->b
-
 		/* update vertex colors for tessellations incrementally,
 		 * rather then regenerating the tessellation altogether */
 		for (e = vpd->polyfacemap[index].first; e; e = e->next) {
-			mf = me->mface + e->facenr;
-			mc = me->mcol + e->facenr * 4;
+			mf = &me->mface[e->facenr];
+			mc = &me->mcol[e->facenr * 4];
 
 			ml = me->mloop + mpoly->loopstart;
 			mlc = me->mloopcol + mpoly->loopstart;
 			for (j = 0; j < mpoly->totloop; j++, ml++, mlc++) {
-				if (ml->v == mf->v1)
-					CPYCOL(mc, mlc);
-				else if (ml->v == mf->v2)
-					CPYCOL(mc + 1, mlc);
-				else if (ml->v == mf->v3)
-					CPYCOL(mc + 2, mlc);
-				else if (mf->v4 && ml->v == mf->v4)
-					CPYCOL(mc + 3, mlc);
+				if      (ml->v == mf->v1)            copy_lcol_to_mcol(mc + 0, mlc);
+				else if (ml->v == mf->v2)            copy_lcol_to_mcol(mc + 1, mlc);
+				else if (ml->v == mf->v3)            copy_lcol_to_mcol(mc + 2, mlc);
+				else if (mf->v4 && ml->v == mf->v4)  copy_lcol_to_mcol(mc + 3, mlc);
 
 			}
 		}
-#undef CPYCOL
 	}
 
 }
@@ -2804,7 +2742,7 @@
 	mval[0] -= vc->ar->winrct.xmin;
 	mval[1] -= vc->ar->winrct.ymin;
 
-			
+
 	/* which faces are involved */
 	if (vp->flag & VP_AREA) {
 		totindex = sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
@@ -2814,19 +2752,6 @@
 		if (indexar[0]) totindex = 1;
 		else totindex = 0;
 	}
-			
-			
-	if (vp->flag & VP_COLINDEX) {
-		for (index = 0; index < totindex; index++) {
-			if (indexar[index] && indexar[index] <= me->totpoly) {
-				MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
-						
-				if (mpoly->mat_nr != ob->actcol - 1) {
-					indexar[index] = 0;
-				}
-			}
-		}
-	}
 
 	if ((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
 		for (index = 0; index < totindex; index++) {
@@ -2835,15 +2760,13 @@
 						
 				if ((mpoly->flag & ME_FACE_SEL) == 0)
 					indexar[index] = 0;
-			}					
+			}
 		}
 	}
 	
 	swap_m4m4(vc->rv3d->persmat, mat);
 
-			
 	for (index = 0; index < totindex; index++) {
-				
 		if (indexar[index] && indexar[index] <= me->totpoly) {
 			vpaint_paint_poly(vp, vpd, ob, indexar[index] - 1, mval, brush_size_pressure, brush_alpha_pressure);
 		}

Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h	2012-09-18 04:40:20 UTC (rev 50711)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h	2012-09-18 04:55:52 UTC (rev 50712)
@@ -829,15 +829,16 @@
 	void *paintcursor;					/* wm handle */
 } VPaint;
 
-/* VPaint flag */
-#define VP_COLINDEX	1
-#define VP_AREA		2  /* vertex paint only */
+/* VPaint.flag */
+enum {
+	// VP_COLINDEX  = (1 << 0),  /* only paint onto active material*/  /* deprecated since before 2.49 */
+	VP_AREA         = (1 << 1),
+	VP_NORMALS      = (1 << 3),
+	VP_SPRAY        = (1 << 4),
+	// VP_MIRROR_X  = (1 << 5),  /* deprecated in 2.5x use (me->editflag & ME_EDIT_MIRROR_X) */
+	VP_ONLYVGROUP   = (1 << 7)   /* weight paint only */
+};
 
-#define VP_NORMALS	8
-#define VP_SPRAY	16
-// #define VP_MIRROR_X	32 // deprecated in 2.5x use (me->editflag & ME_EDIT_MIRROR_X)
-#define VP_ONLYVGROUP	128  /* weight paint only */
-
 /* *************************************************************** */
 /* Transform Orientations */
 

Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2012-09-18 04:40:20 UTC (rev 50711)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2012-09-18 04:55:52 UTC (rev 50712)
@@ -2119,8 +2119,7 @@
 	return NULL;
 }
 
-
-static void RBJconstraints(Object *ob)//not used
+static void UNUSED_FUNCTION(RBJconstraints)(Object *ob)//not used
 {
 	ListBase *conlist;
 	bConstraint *curcon;
@@ -2141,6 +2140,7 @@
 #include "KX_IPhysicsController.h"
 #include "PHY_DynamicTypes.h"
 
+#if 0  /* UNUSED */
 static KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc) {//not used
 
 	for (int j=0;j<sumolist->GetCount();j++)
@@ -2151,8 +2151,8 @@
 	}
 
 	return 0;
-
 }
+#endif
 
 static KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist)
 {




More information about the Bf-blender-cvs mailing list