[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47564] trunk/blender/source/blender/ editors/space_view3d: fix for armature specular material color overriding the wire color when instanced in a dupli

Campbell Barton ideasman42 at gmail.com
Thu Jun 7 11:04:59 CEST 2012


Revision: 47564
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47564
Author:   campbellbarton
Date:     2012-06-07 09:04:45 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
fix for armature specular material color overriding the wire color when instanced in a dupli

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawarmature.c
    trunk/blender/source/blender/editors/space_view3d/drawmesh.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2012-06-07 08:43:21 UTC (rev 47563)
+++ trunk/blender/source/blender/editors/space_view3d/drawarmature.c	2012-06-07 09:04:45 UTC (rev 47564)
@@ -1753,8 +1753,13 @@
 					if (bone == arm->act_bone)
 						flag |= BONE_DRAW_ACTIVE;
 					
-					/* set color-set to use */
-					set_pchan_colorset(ob, pchan);
+					if (do_const_color) {
+						/* keep color */
+					}
+					else {
+						/* set color-set to use */
+						set_pchan_colorset(ob, pchan);
+					}
 					
 					if (use_custom) {
 						/* if drawwire, don't try to draw in solid */
@@ -1950,7 +1955,12 @@
 					/* extra draw service for pose mode */
 
 					/* set color-set to use */
-					set_pchan_colorset(ob, pchan);
+					if (do_const_color) {
+						/* keep color */
+					}
+					else {
+						set_pchan_colorset(ob, pchan);
+					}
 					
 					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
 						/* custom bone shapes should not be drawn here! */
@@ -2001,7 +2011,6 @@
 			float vec[3];
 
 			unsigned char col[4];
-
 			if (do_const_color) {
 				/* so we can draw bone names in current const color */
 				float tcol[4];
@@ -2562,11 +2571,8 @@
 	
 	if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
 		/* we use color for solid lighting */
-		glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-		glEnable(GL_COLOR_MATERIAL);
-		glColor3ub(255, 255, 255);    // clear spec
-		glDisable(GL_COLOR_MATERIAL);
-		
+		const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+		glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
 		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 		glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); // only for lighting...
 	}

Modified: trunk/blender/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawmesh.c	2012-06-07 08:43:21 UTC (rev 47563)
+++ trunk/blender/source/blender/editors/space_view3d/drawmesh.c	2012-06-07 09:04:45 UTC (rev 47564)
@@ -1015,14 +1015,14 @@
 	if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
 
 		if (do_light) {
+			const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f};
+
 			/* enforce default material settings */
 			GPU_enable_material(0, NULL);
 		
 			/* but set default spec */
 			glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-			glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
-			glColor3ub(120, 120, 120);
-			glDisable(GL_COLOR_MATERIAL);
+			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
 
 			/* diffuse */
 			glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-06-07 08:43:21 UTC (rev 47563)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-06-07 09:04:45 UTC (rev 47564)
@@ -3434,6 +3434,8 @@
 				dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			}
 			else {
+				const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f};
+
 				/* draw outline */
 				if ( (v3d->flag & V3D_SELECT_OUTLINE) &&
 				     ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
@@ -3451,9 +3453,7 @@
 				
 				/* set default spec */
 				glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-				glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
-				glColor3ub(120, 120, 120);
-				glDisable(GL_COLOR_MATERIAL);
+				glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
 				/* diffuse */
 				glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 				glEnable(GL_LIGHTING);




More information about the Bf-blender-cvs mailing list