diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 05:30:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 05:30:13 +0400 |
commit | a59682f0b7362896ff1d7d3d6a7b107b932bc320 (patch) | |
tree | 3bafc54997e0f93b12f63831609d9746e479dd27 | |
parent | 9bd1e46b4a31ee19834b39ec997f746307486941 (diff) |
fix for crash with project paint when there is no brush (possible applying projection from the camera only)
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index b9b3b1da762..1f8c06f6bf7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5016,23 +5016,29 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps) { 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); |