[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22572] branches/blender2.5/blender/source /blender: 2.5:

Nicholas Bishop nicholasbishop at gmail.com
Mon Aug 17 19:14:37 CEST 2009


Revision: 22572
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22572
Author:   nicholasbishop
Date:     2009-08-17 19:14:37 +0200 (Mon, 17 Aug 2009)

Log Message:
-----------
2.5:

* Added icons to viewport shading enum. On a side note, why do we have an icon called "ICON_POTATO" for texture mode?
* Fixed clay brush at zero-strength bug, was dividing by zero. Still todo is fixing clay brush strength relative to other brushes.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c

Modified: branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c	2009-08-17 17:04:58 UTC (rev 22571)
+++ branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c	2009-08-17 17:14:37 UTC (rev 22572)
@@ -542,12 +542,27 @@
 	VecAddf(intr, intr, p1);
 }
 
+static int plane_point_side(float co[3], float plane_normal[3], float plane_center[3], int flip)
+{
+	float delta[3];
+	float d;
+
+	VecSubf(delta, co, plane_center);
+	d = Inpf(plane_normal, delta);
+
+	if(flip)
+		d = -d;
+
+	return d <= 0.0f;
+}
+
 static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, const ListBase *active_verts, int clay)
 {
 	ActiveData *node= active_verts->first;
 	/* area_normal and cntr define the plane towards which vertices are squashed */
 	float area_normal[3];
 	float cntr[3], cntr2[3], bstr;
+	int flip = 0;
 
 	calc_area_normal(sd, ss, area_normal, active_verts);
 	calc_flatten_center(ss, node, cntr);
@@ -558,31 +573,24 @@
 		cntr2[0]=cntr[0]+area_normal[0]*bstr*ss->cache->scale[0];
 		cntr2[1]=cntr[1]+area_normal[1]*bstr*ss->cache->scale[1];
 		cntr2[2]=cntr[2]+area_normal[2]*bstr*ss->cache->scale[2];
+		flip = bstr < 0;
 	}
 	
 	while(node){
 		float *co= ss->mvert[node->Index].co;
-		float intr[3], val[3], d;
+		float intr[3], val[3];
 		
-		if(clay) {
-			float delta[3];
-
-			VecSubf(delta, co, cntr2);
-			d = Inpf(area_normal, delta);
-
-			/* Check for subtractive mode */
-			if(bstr < 0)
-				d = -d;
-		}
-
-		if(!clay || d <= 0.0f) {
+		if(!clay || plane_point_side(co, area_normal, cntr2, flip)) {
 			/* Find the intersection between squash-plane and vertex (along the area normal) */		
 			point_plane_project(intr, co, area_normal, cntr);
 
 			VecSubf(val, intr, co);
 
 			if(clay) {
-				VecMulf(val, node->Fade / bstr);
+				if(bstr > FLT_EPSILON)
+					VecMulf(val, node->Fade / bstr);
+				else
+					VecMulf(val, node->Fade);
 				/* Clay displacement */
 				val[0]+=area_normal[0] * ss->cache->scale[0]*node->Fade;
 				val[1]+=area_normal[1] * ss->cache->scale[1]*node->Fade;
@@ -592,6 +600,7 @@
 				VecMulf(val, fabs(node->Fade));
 
 			VecAddf(val, val, co);
+
 			sculpt_clip(sd, ss, co, val);
 		}
 		

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-08-17 17:04:58 UTC (rev 22571)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_space.c	2009-08-17 17:14:37 UTC (rev 22572)
@@ -519,11 +519,11 @@
 	PropertyRNA *prop;
 
 	static EnumPropertyItem viewport_shading_items[] = {
-		{OB_BOUNDBOX, "BOUNDBOX", 0, "Bounding Box", "Display the object's local bounding boxes only"},
-		{OB_WIRE, "WIREFRAME", 0, "Wireframe", "Display the object as wire edges"},
-		{OB_SOLID, "SOLID", 0, "Solid", "Display the object solid, lit with default OpenGL lights"},
-		{OB_SHADED, "SHADED", 0, "Shaded", "Display the object solid, with preview shading interpolated at vertices"},
-		{OB_TEXTURE, "TEXTURED", 0, "Textured", "Display the object solid, with face-assigned textures"},
+		{OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"},
+		{OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
+		{OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"},
+		{OB_SHADED, "SHADED", ICON_SMOOTH, "Shaded", "Display the object solid, with preview shading interpolated at vertices"},
+		{OB_TEXTURE, "TEXTURED", ICON_POTATO, "Textured", "Display the object solid, with face-assigned textures"},
 		{0, NULL, 0, NULL, NULL}};
 		
 	static EnumPropertyItem pivot_items[] = {





More information about the Bf-blender-cvs mailing list