Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2019-09-17 15:41:18 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2019-09-17 16:43:05 +0300
commit41d6d1463f8e86dd6cc65ec4d1290957580c48f7 (patch)
tree18f1808c99d4bfdc168da9a4226367a81b677f16
parent3a08153d7a842b7ab1e40a9048730e1a3ddab5f7 (diff)
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
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c5
1 files changed, 3 insertions, 2 deletions
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 &&