[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54540] trunk/blender/source/blender/ editors/sculpt_paint/paint_image.c: fix for crash with project paint when there is no brush ( possible applying projection from the camera only)

Campbell Barton ideasman42 at gmail.com
Thu Feb 14 02:30:14 CET 2013


Revision: 54540
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54540
Author:   campbellbarton
Date:     2013-02-14 01:30:13 +0000 (Thu, 14 Feb 2013)
Log Message:
-----------
fix for crash with project paint when there is no brush (possible applying projection from the camera only)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2013-02-14 01:01:08 UTC (rev 54539)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2013-02-14 01:30:13 UTC (rev 54540)
@@ -5016,23 +5016,29 @@
 {
 	Scene *scene = CTX_data_scene(C);
 	ToolSettings *settings = scene->toolsettings;
-	Brush *brush = paint_brush(&settings->imapaint.paint);
 
 	/* brush */
-	ps->brush = brush;
-	ps->tool = brush->imagepaint_tool;
-	ps->blend = brush->blend;
+	ps->brush = paint_brush(&settings->imapaint.paint);
+	if (ps->brush) {
+		Brush *brush = ps->brush;
+		ps->tool = brush->imagepaint_tool;
+		ps->blend = brush->blend;
 
+		/* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
+		ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
+		                  brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
+		ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
+	}
+	else {
+		/* brush may be NULL*/
+		ps->do_masking = false;
+		ps->is_texbrush = false;
+	}
+
 	/* sizeof ProjPixel, since we alloc this a _lot_ */
 	ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool);
 	BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel));
 
-	/* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
-	ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
-	                  brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
-	ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
-
-
 	/* these can be NULL */
 	ps->v3d = CTX_wm_view3d(C);
 	ps->rv3d = CTX_wm_region_view3d(C);




More information about the Bf-blender-cvs mailing list