Disable multithreaded weight paint when mirroring is enabled.
authorAlexander Gavrilov <alexander.gavrilov@jetbrains.com>
Mon, 2 Oct 2017 14:33:51 +0000 (17:33 +0300)
committerAlexander Gavrilov <alexander.gavrilov@jetbrains.com>
Mon, 2 Oct 2017 14:33:51 +0000 (17:33 +0300)
Mirroring writes to the mirror vertex within the direct vertex
draw function, which violates assumptions required for processing
vertices in parallel.

source/blender/editors/sculpt_paint/paint_vertex.c

index ea85ae7079449cd2aafeeffdbe5519e847301735..4dd218114f64de3e93bf11e84ed6476c0c759402 100644 (file)
@@ -1841,27 +1841,30 @@ static void wpaint_paint_leaves(
                .sd = sd, .ob = ob, .brush = brush, .nodes = nodes, .vp = vp, .wpd = wpd, .wpi = wpi, .me = me, .C = C,
        };
 
+       /* current mirroring code cannot be run in parallel */
+       bool use_threading = !(me->editflag & ME_EDIT_MIRROR_X);
+
        switch (brush->vertexpaint_tool) {
                case PAINT_BLEND_AVERAGE:
                        calculate_average_weight(&data, nodes, totnode);
                        BLI_task_parallel_range_ex(
                                0, totnode, &data, NULL, 0,
-                               do_wpaint_brush_draw_task_cb_ex, true, false);
+                               do_wpaint_brush_draw_task_cb_ex, use_threading, false);
                        break;
                case PAINT_BLEND_SMEAR:
                        BLI_task_parallel_range_ex(
                                0, totnode, &data, NULL, 0,
-                               do_wpaint_brush_smear_task_cb_ex, true, false);
+                               do_wpaint_brush_smear_task_cb_ex, use_threading, false);
                        break;
                case PAINT_BLEND_BLUR:
                        BLI_task_parallel_range_ex(
                                0, totnode, &data, NULL, 0,
-                               do_wpaint_brush_blur_task_cb_ex, true, false);
+                               do_wpaint_brush_blur_task_cb_ex, use_threading, false);
                        break;
                default:
                        BLI_task_parallel_range_ex(
                                0, totnode, &data, NULL, 0,
-                               do_wpaint_brush_draw_task_cb_ex, true, false);
+                               do_wpaint_brush_draw_task_cb_ex, use_threading, false);
                        break;
        }
 }