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
This commit is contained in:
Pablo Dobarro
2020-03-04 12:12:28 +01:00
parent 6706ae5712
commit d83c0969f6

View File

@@ -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. */