[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10871] trunk/blender/source/blender/src/ sculptmode.c: == Sculpt Mode ==

Nicholas Bishop nicholasbishop at gmail.com
Mon Jun 4 10:03:37 CEST 2007


Revision: 10871
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10871
Author:   nicholasbishop
Date:     2007-06-04 10:03:37 +0200 (Mon, 04 Jun 2007)

Log Message:
-----------
== Sculpt Mode ==

Kind of fixed [#6688] sculpt - if 2.44 blend is openned in 2.43 with flatten brush selected causes crash

* Added better handling for new brushes; if more brushes are added they will no longer cause a crash (but this doesn't help older Blenders compiled without this fix.)

Modified Paths:
--------------
    trunk/blender/source/blender/src/sculptmode.c

Modified: trunk/blender/source/blender/src/sculptmode.c
===================================================================
--- trunk/blender/source/blender/src/sculptmode.c	2007-06-04 05:27:06 UTC (rev 10870)
+++ trunk/blender/source/blender/src/sculptmode.c	2007-06-04 08:03:37 UTC (rev 10871)
@@ -1096,13 +1096,22 @@
 BrushData *sculptmode_brush(void)
 {
 	SculptData *sd= &G.scene->sculptdata;
-	return (sd->brush_type==DRAW_BRUSH ? &sd->drawbrush :
-		sd->brush_type==SMOOTH_BRUSH ? &sd->smoothbrush :
-		sd->brush_type==PINCH_BRUSH ? &sd->pinchbrush :
-		sd->brush_type==INFLATE_BRUSH ? &sd->inflatebrush :
-		sd->brush_type==GRAB_BRUSH ? &sd->grabbrush :
-		sd->brush_type==LAYER_BRUSH ? &sd->layerbrush :
-		sd->brush_type==FLATTEN_BRUSH ? &sd->flattenbrush : NULL);
+
+	BrushData *bd = 
+		(sd->brush_type==DRAW_BRUSH ? &sd->drawbrush :
+		 sd->brush_type==SMOOTH_BRUSH ? &sd->smoothbrush :
+		 sd->brush_type==PINCH_BRUSH ? &sd->pinchbrush :
+		 sd->brush_type==INFLATE_BRUSH ? &sd->inflatebrush :
+		 sd->brush_type==GRAB_BRUSH ? &sd->grabbrush :
+		 sd->brush_type==LAYER_BRUSH ? &sd->layerbrush :
+		 sd->brush_type==FLATTEN_BRUSH ? &sd->flattenbrush : NULL);
+
+	if(!bd) {
+		sculptmode_init(G.scene);
+		bd = &sd->drawbrush;
+	}
+
+	return bd;
 }
 
 void sculptmode_update_tex()
@@ -1853,8 +1862,8 @@
 	else {
 		G.f |= G_SCULPTMODE;
 
-		if(!sculptmode_brush())
-			sculptmode_init(G.scene);
+		/* Called here to sanity-check the brush */
+		sculptmode_brush();
 
 		sculpt_init_session();
 		





More information about the Bf-blender-cvs mailing list