[Bf-blender-cvs] [41d6d1463f8] master: Fix paint cursor crash
Philipp Oeser
noreply at git.blender.org
Tue Sep 17 15:45:33 CEST 2019
Commit: 41d6d1463f8e86dd6cc65ec4d1290957580c48f7
Author: Philipp Oeser
Date: Tue Sep 17 14:41:18 2019 +0200
Branches: master
https://developer.blender.org/rB41d6d1463f8e86dd6cc65ec4d1290957580c48f7
Fix paint cursor crash
The new paint cursor (introduced in rBe0c792135adf) could crash for 2d
painting without an active object.
Note there are still drawing asserts (because we are mixing 2d and 3d
drawing in 'paint_draw_cursor'), but these will be handled in a seperate
commit.
part of T69957
Reviewers: jbakker
Maniphest Tasks: T69957
Differential Revision: https://developer.blender.org/D5820
===================================================================
M source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index a41ff09e514..d8f1f0d3eab 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1263,7 +1263,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* TODO: as sculpt and other paint modes are unified, this
* special mode of drawing will go away */
- if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) {
+ Object *obact = vc.obact;
+ if ((mode == PAINT_MODE_SCULPT) && obact && obact->sculpt) {
float location[3];
int pixel_radius;
@@ -1318,7 +1319,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* Only sculpt mode cursor for now */
/* Disable for PBVH_GRIDS */
- SculptSession *ss = vc.obact->sculpt;
+ SculptSession *ss = obact ? obact->sculpt : NULL;
bool is_multires = ss && ss->pbvh && BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS;
if ((mode == PAINT_MODE_SCULPT) && ss && !is_multires &&
More information about the Bf-blender-cvs
mailing list