diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 97 |
1 files changed, 51 insertions, 46 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 53d7684e331..4684395c18d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -376,7 +376,8 @@ static bool sculpt_stroke_is_dynamic_topology( /*** paint mesh ***/ -static void paint_mesh_restore_co_task_cb(void *userdata, const int n) +static void paint_mesh_restore_co_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -794,7 +795,8 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache *cache) * \note These are all _very_ similar, when changing one, check others. * \{ */ -static void calc_area_normal_and_center_task_cb(void *userdata, const int n) +static void calc_area_normal_and_center_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1626,7 +1628,7 @@ typedef struct { } SculptFindNearestToRayData; static void do_smooth_brush_mesh_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1648,7 +1650,7 @@ static void do_smooth_brush_mesh_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, smooth_mask ? 0.0f : (vd.mask ? *vd.mask : 0.0f), thread_id); + vd.no, vd.fno, smooth_mask ? 0.0f : (vd.mask ? *vd.mask : 0.0f), tls->thread_id); if (smooth_mask) { float val = neighbor_average_mask(ss, vd.vert_indices[vd.i]) - *vd.mask; val *= fade * bstrength; @@ -1674,7 +1676,7 @@ static void do_smooth_brush_mesh_task_cb_ex( } static void do_smooth_brush_bmesh_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1696,7 +1698,7 @@ static void do_smooth_brush_bmesh_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, smooth_mask ? 0.0f : *vd.mask, thread_id); + vd.no, vd.fno, smooth_mask ? 0.0f : *vd.mask, tls->thread_id); if (smooth_mask) { float val = bmesh_neighbor_average_mask(vd.bm_vert, vd.cd_vert_mask_offset) - *vd.mask; val *= fade * bstrength; @@ -1722,10 +1724,10 @@ static void do_smooth_brush_bmesh_task_cb_ex( } static void do_smooth_brush_multires_task_cb_ex( - void *userdata, void *userdata_chunk, const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; - SculptDoBrushSmoothGridDataChunk *data_chunk = userdata_chunk; + SculptDoBrushSmoothGridDataChunk *data_chunk = tls->userdata_chunk; SculptSession *ss = data->ob->sculpt; Sculpt *sd = data->sd; const Brush *brush = data->brush; @@ -1837,7 +1839,7 @@ static void do_smooth_brush_multires_task_cb_ex( const float strength_mask = (smooth_mask ? 0.0f : *mask); const float fade = bstrength * tex_strength( ss, brush, co, sqrtf(test.dist), - NULL, fno, strength_mask, thread_id); + NULL, fno, strength_mask, tls->thread_id); float f = 1.0f / 16.0f; if (x == 0 || x == gridsize - 1) @@ -1940,7 +1942,7 @@ static void do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_mask_brush_draw_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1958,7 +1960,7 @@ static void do_mask_brush_draw_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, 0.0f, thread_id); + vd.no, vd.fno, 0.0f, tls->thread_id); (*vd.mask) += fade * bstrength; CLAMP(*vd.mask, 0, 1); @@ -2000,7 +2002,7 @@ static void do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_draw_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2022,7 +2024,7 @@ static void do_draw_brush_task_cb_ex( /* offset vertex */ const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -2060,7 +2062,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) * Used for 'SCULPT_TOOL_CREASE' and 'SCULPT_TOOL_BLOB' */ static void do_crease_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2084,7 +2086,7 @@ static void do_crease_brush_task_cb_ex( /* offset vertex */ const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float val1[3]; float val2[3]; @@ -2154,7 +2156,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_pinch_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2175,7 +2177,7 @@ static void do_pinch_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float val[3]; sub_v3_v3v3(val, test.location, vd.co); @@ -2205,7 +2207,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_grab_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2232,7 +2234,7 @@ static void do_grab_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { const float fade = bstrength * tex_strength( ss, brush, orig_data.co, sqrtf(test.dist), - orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, thread_id); + orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -2266,7 +2268,7 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_nudge_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2288,7 +2290,7 @@ static void do_nudge_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -2322,7 +2324,7 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_snake_hook_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2349,7 +2351,7 @@ static void do_snake_hook_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -2428,7 +2430,7 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to } static void do_thumb_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2455,7 +2457,7 @@ static void do_thumb_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { const float fade = bstrength * tex_strength( ss, brush, orig_data.co, sqrtf(test.dist), - orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, thread_id); + orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -2489,7 +2491,7 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_rotate_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2517,7 +2519,7 @@ static void do_rotate_brush_task_cb_ex( float vec[3], rot[3][3]; const float fade = bstrength * tex_strength( ss, brush, orig_data.co, sqrtf(test.dist), - orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, thread_id); + orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, tls->thread_id); sub_v3_v3v3(vec, orig_data.co, ss->cache->location); axis_angle_normalized_to_mat3(rot, ss->cache->sculpt_normal_symm, angle * fade); @@ -2551,7 +2553,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_layer_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2585,7 +2587,7 @@ static void do_layer_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float *disp = &layer_disp[vd.i]; float val[3]; @@ -2638,7 +2640,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_inflate_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2659,7 +2661,7 @@ static void do_inflate_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float val[3]; if (vd.fno) @@ -2802,7 +2804,7 @@ static float get_offset(Sculpt *sd, SculptSession *ss) } static void do_flatten_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2835,7 +2837,7 @@ static void do_flatten_brush_task_cb_ex( if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2880,7 +2882,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno } static void do_clay_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2917,7 +2919,7 @@ static void do_clay_brush_task_cb_ex( * causes glitch with planes, see: T44390 */ const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2966,7 +2968,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_clay_strips_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3002,7 +3004,7 @@ static void do_clay_strips_brush_task_cb_ex( * causes glitch with planes, see: T44390 */ const float fade = bstrength * tex_strength( ss, brush, vd.co, ss->cache->radius * test.dist, - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -3076,7 +3078,7 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t } static void do_fill_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3110,7 +3112,7 @@ static void do_fill_brush_task_cb_ex( if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -3157,7 +3159,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_scrape_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3190,7 +3192,7 @@ static void do_scrape_brush_task_cb_ex( if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -3237,7 +3239,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_gravity_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3257,7 +3259,7 @@ static void do_gravity_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -3392,7 +3394,8 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush, Unified } } -static void do_brush_action_task_cb(void *userdata, const int n) +static void do_brush_action_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; @@ -3533,7 +3536,8 @@ static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd) copy_v3_v3(me->mvert[index].co, newco); } -static void sculpt_combine_proxies_task_cb(void *userdata, const int n) +static void sculpt_combine_proxies_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3628,7 +3632,8 @@ static void sculpt_update_keyblock(Object *ob) } } -static void sculpt_flush_stroke_deform_task_cb(void *userdata, const int n) +static void sculpt_flush_stroke_deform_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; |