diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-04 14:12:28 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-04 14:24:02 +0300 |
commit | d83c0969f6ee6d193f384341cbbd0455ef46dabd (patch) | |
tree | f6b1e9229535051106ec5992c2738e6f40ad47cb /source/blender/editors/sculpt_paint/paint_cursor.c | |
parent | 6706ae57123357a9e2e3ea518cbafefe55f1cf15 (diff) |
Fix T74426: Crash in the IK Pose Brush preview with null preview chain
After switching tools, the active vertex can be the same and the cursor
won't update the previews, so the pose_ik_chain_preview will be null.
This often happens in low poly meshes where chances of hovering the same
vertex are high.
Reviewed By: sergey
Maniphest Tasks: T74426
Differential Revision: https://developer.blender.org/D7021
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index a5da577859a..7198fb7df11 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1477,7 +1477,11 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* Draw pose brush origins. */ if (brush->sculpt_tool == SCULPT_TOOL_POSE) { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.8f); - if (update_previews) { + + /* Just after switching to the Pose Brush, the active vertex can be the same and the + * cursor won't be tagged to update, so always initialize the preview chain if it is + * null before drawing it. */ + if (update_previews || !ss->pose_ik_chain_preview) { BKE_sculpt_update_object_for_edit(depsgraph, vc.obact, true, false); /* Free the previous pose brush preview. */ |