forked from blender/blender
Cleanup: Reduce use and scope of templates in vertex paint #2
@ -1179,7 +1179,7 @@ static void vwpaint_init_stroke(Depsgraph *depsgraph, Object *ob)
|
|||||||
* vwpaint_update_cache_invariants and vwpaint_update_cache_variants.
|
* vwpaint_update_cache_invariants and vwpaint_update_cache_variants.
|
||||||
*/
|
*/
|
||||||
if (!ss->cache) {
|
if (!ss->cache) {
|
||||||
ss->cache = (StrokeCache *)MEM_callocN(sizeof(StrokeCache), "stroke cache");
|
ss->cache = MEM_new<StrokeCache>(__func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,7 +1582,7 @@ static void vwpaint_update_cache_invariants(
|
|||||||
|
|
||||||
/* VW paint needs to allocate stroke cache before update is called. */
|
/* VW paint needs to allocate stroke cache before update is called. */
|
||||||
if (!ss->cache) {
|
if (!ss->cache) {
|
||||||
cache = (StrokeCache *)MEM_callocN(sizeof(StrokeCache), "stroke cache");
|
cache = MEM_new<StrokeCache>(__func__);
|
||||||
ss->cache = cache;
|
ss->cache = cache;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2795,10 +2795,10 @@ static void to_static_color_type(const eCustomDataType type, const Func &func)
|
|||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CD_PROP_COLOR:
|
case CD_PROP_COLOR:
|
||||||
func(ColorPaint4f());
|
func(ColorGeometry4f());
|
||||||
break;
|
break;
|
||||||
case CD_PROP_BYTE_COLOR:
|
case CD_PROP_BYTE_COLOR:
|
||||||
func(ColorPaint4b());
|
func(ColorGeometry4b());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BLI_assert_unreachable();
|
BLI_assert_unreachable();
|
||||||
@ -2923,15 +2923,6 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||||||
const Brush *brush = ob->sculpt->cache->brush;
|
const Brush *brush = ob->sculpt->cache->brush;
|
||||||
const Scene *scene = CTX_data_scene(C);
|
const Scene *scene = CTX_data_scene(C);
|
||||||
|
|
||||||
GMutableSpan g_previous_color = ss->cache->prev_colors_vpaint;
|
|
||||||
|
|
||||||
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
|
||||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
|
||||||
const blender::VArray<bool> select_poly = *me->attributes().lookup_or_default<bool>(
|
|
||||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
|
||||||
|
|
||||||
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
|
||||||
for (int n : range) {
|
|
||||||
const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
|
const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
|
||||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||||
|
|
||||||
@ -2941,16 +2932,26 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||||||
get_brush_alpha_data(
|
get_brush_alpha_data(
|
||||||
scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
|
scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
|
||||||
const bool use_normal = vwpaint_use_normal(vp);
|
const bool use_normal = vwpaint_use_normal(vp);
|
||||||
const bool use_vert_sel = (me->editflag &
|
const bool use_vert_sel = (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) !=
|
||||||
(ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) != 0;
|
0;
|
||||||
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
||||||
|
|
||||||
SculptBrushTest test;
|
SculptBrushTest test_init;
|
||||||
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
||||||
ss, &test, brush->falloff_shape);
|
ss, &test_init, brush->falloff_shape);
|
||||||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||||
ss, brush->falloff_shape);
|
ss, brush->falloff_shape);
|
||||||
|
|
||||||
|
GMutableSpan g_previous_color = ss->cache->prev_colors_vpaint;
|
||||||
|
|
||||||
|
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
||||||
|
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||||
|
const blender::VArray<bool> select_poly = *me->attributes().lookup_or_default<bool>(
|
||||||
|
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||||
|
|
||||||
|
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
||||||
|
SculptBrushTest test = test_init;
|
||||||
|
for (int n : range) {
|
||||||
/* For each vertex */
|
/* For each vertex */
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
|
BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
|
||||||
@ -2980,11 +2981,13 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||||||
const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius);
|
const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius);
|
||||||
|
|
||||||
to_static_color_type(vpd->type, [&](auto dummy) {
|
to_static_color_type(vpd->type, [&](auto dummy) {
|
||||||
using Color = decltype(dummy);
|
using T = decltype(dummy);
|
||||||
|
using Color =
|
||||||
|
std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
|
||||||
using Traits = color::Traits<Color>;
|
using Traits = color::Traits<Color>;
|
||||||
using Blend = typename Traits::BlendType;
|
using Blend = typename Traits::BlendType;
|
||||||
MutableSpan<Color> previous_color = g_previous_color.typed<Color>();
|
MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
|
||||||
MutableSpan<Color> colors = attribute.typed<Color>();
|
MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
|
||||||
/* Get the average poly color */
|
/* Get the average poly color */
|
||||||
Color color_final(0, 0, 0, 0);
|
Color color_final(0, 0, 0, 0);
|
||||||
|
|
||||||
@ -3070,15 +3073,6 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||||||
const Brush *brush = ob->sculpt->cache->brush;
|
const Brush *brush = ob->sculpt->cache->brush;
|
||||||
const Scene *scene = CTX_data_scene(C);
|
const Scene *scene = CTX_data_scene(C);
|
||||||
|
|
||||||
GMutableSpan g_previous_color = ss->cache->prev_colors_vpaint;
|
|
||||||
|
|
||||||
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
|
||||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
|
||||||
const blender::VArray<bool> select_poly = *me->attributes().lookup_or_default<bool>(
|
|
||||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
|
||||||
|
|
||||||
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
|
||||||
for (int n : range) {
|
|
||||||
const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
|
const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
|
||||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||||
|
|
||||||
@ -3088,16 +3082,26 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||||||
get_brush_alpha_data(
|
get_brush_alpha_data(
|
||||||
scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
|
scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
|
||||||
const bool use_normal = vwpaint_use_normal(vp);
|
const bool use_normal = vwpaint_use_normal(vp);
|
||||||
const bool use_vert_sel = (me->editflag &
|
const bool use_vert_sel = (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) !=
|
||||||
(ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) != 0;
|
0;
|
||||||
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
||||||
|
|
||||||
SculptBrushTest test;
|
SculptBrushTest test_init;
|
||||||
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
||||||
ss, &test, brush->falloff_shape);
|
ss, &test_init, brush->falloff_shape);
|
||||||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||||
ss, brush->falloff_shape);
|
ss, brush->falloff_shape);
|
||||||
|
|
||||||
|
GMutableSpan g_previous_color = ss->cache->prev_colors_vpaint;
|
||||||
|
|
||||||
|
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
||||||
|
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||||
|
const blender::VArray<bool> select_poly = *me->attributes().lookup_or_default<bool>(
|
||||||
|
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||||
|
|
||||||
|
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
||||||
|
SculptBrushTest test = test_init;
|
||||||
|
for (int n : range) {
|
||||||
/* For each vertex */
|
/* For each vertex */
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
|
BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
|
||||||
@ -3127,11 +3131,13 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||||||
|
|
||||||
/* Get the average poly color */
|
/* Get the average poly color */
|
||||||
to_static_color_type(vpd->type, [&](auto dummy) {
|
to_static_color_type(vpd->type, [&](auto dummy) {
|
||||||
using Color = decltype(dummy);
|
using T = decltype(dummy);
|
||||||
|
using Color =
|
||||||
|
std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
|
||||||
using Traits = color::Traits<Color>;
|
using Traits = color::Traits<Color>;
|
||||||
using Blend = typename Traits::BlendType;
|
using Blend = typename Traits::BlendType;
|
||||||
MutableSpan<Color> previous_color = g_previous_color.typed<Color>();
|
MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
|
||||||
MutableSpan<Color> colors = attribute.typed<Color>();
|
MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
|
||||||
Color color_final(0, 0, 0, 0);
|
Color color_final(0, 0, 0, 0);
|
||||||
|
|
||||||
int total_hit_loops = 0;
|
int total_hit_loops = 0;
|
||||||
@ -3230,9 +3236,9 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SculptBrushTest test;
|
SculptBrushTest test_init;
|
||||||
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
||||||
ss, &test, brush->falloff_shape);
|
ss, &test_init, brush->falloff_shape);
|
||||||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||||
ss, brush->falloff_shape);
|
ss, brush->falloff_shape);
|
||||||
|
|
||||||
@ -3242,6 +3248,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||||
|
|
||||||
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
||||||
|
SculptBrushTest test = test_init;
|
||||||
for (int n : range) {
|
for (int n : range) {
|
||||||
/* For each vertex */
|
/* For each vertex */
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
@ -3281,12 +3288,15 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||||||
/* Get the color of the loop in the opposite
|
/* Get the color of the loop in the opposite
|
||||||
* direction of the brush movement */
|
* direction of the brush movement */
|
||||||
to_static_color_type(vpd->type, [&](auto dummy) {
|
to_static_color_type(vpd->type, [&](auto dummy) {
|
||||||
using Color = decltype(dummy);
|
using T = decltype(dummy);
|
||||||
|
using Color =
|
||||||
|
std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
|
||||||
using Traits = color::Traits<Color>;
|
using Traits = color::Traits<Color>;
|
||||||
MutableSpan<Color> color_curr = g_color_curr.typed<Color>();
|
MutableSpan<Color> color_curr = g_color_curr.typed<T>().template cast<Color>();
|
||||||
MutableSpan<Color> color_prev_smear = g_color_prev_smear.typed<Color>();
|
MutableSpan<Color> color_prev_smear =
|
||||||
MutableSpan<Color> color_prev = g_color_prev.typed<Color>();
|
g_color_prev_smear.typed<T>().template cast<Color>();
|
||||||
MutableSpan<Color> colors = attribute.typed<Color>();
|
MutableSpan<Color> color_prev = g_color_prev.typed<T>().template cast<Color>();
|
||||||
|
MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
|
||||||
|
|
||||||
Color color_final(0, 0, 0, 0);
|
Color color_final(0, 0, 0, 0);
|
||||||
|
|
||||||
@ -3399,21 +3409,24 @@ static void calculate_average_color(VPaintData *vpd,
|
|||||||
const bool use_vert_sel = (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) !=
|
const bool use_vert_sel = (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)) !=
|
||||||
0;
|
0;
|
||||||
|
|
||||||
SculptBrushTest test;
|
SculptBrushTest test_init;
|
||||||
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
||||||
ss, &test, brush->falloff_shape);
|
ss, &test_init, brush->falloff_shape);
|
||||||
|
|
||||||
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
||||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||||
|
|
||||||
to_static_color_type(vpd->type, [&](auto dummy) {
|
to_static_color_type(vpd->type, [&](auto dummy) {
|
||||||
using Color = decltype(dummy);
|
using T = decltype(dummy);
|
||||||
|
using Color =
|
||||||
|
std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
|
||||||
using Traits = color::Traits<Color>;
|
using Traits = color::Traits<Color>;
|
||||||
using Blend = typename Traits::BlendType;
|
using Blend = typename Traits::BlendType;
|
||||||
const Span<Color> colors = attribute.typed<Color>();
|
const Span<Color> colors = attribute.typed<T>().template cast<Color>();
|
||||||
|
|
||||||
Array<VPaintAverageAccum<Blend>> accum(nodes.size());
|
Array<VPaintAverageAccum<Blend>> accum(nodes.size());
|
||||||
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
||||||
|
SculptBrushTest test = test_init;
|
||||||
for (int n : range) {
|
for (int n : range) {
|
||||||
VPaintAverageAccum<Blend> &accum2 = accum[n];
|
VPaintAverageAccum<Blend> &accum2 = accum[n];
|
||||||
accum2.len = 0;
|
accum2.len = 0;
|
||||||
@ -3525,14 +3538,12 @@ static void vpaint_do_draw(bContext *C,
|
|||||||
0;
|
0;
|
||||||
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
||||||
|
|
||||||
SculptBrushTest test;
|
SculptBrushTest test_init;
|
||||||
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape(
|
||||||
ss, &test, brush->falloff_shape);
|
ss, &test_init, brush->falloff_shape);
|
||||||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||||
ss, brush->falloff_shape);
|
ss, brush->falloff_shape);
|
||||||
|
|
||||||
const ColorPaint4f paintcol = vpd->paintcol;
|
|
||||||
|
|
||||||
GMutableSpan g_previous_color = ss->cache->prev_colors_vpaint;
|
GMutableSpan g_previous_color = ss->cache->prev_colors_vpaint;
|
||||||
|
|
||||||
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
const blender::VArray<bool> select_vert = *me->attributes().lookup_or_default<bool>(
|
||||||
@ -3542,6 +3553,7 @@ static void vpaint_do_draw(bContext *C,
|
|||||||
|
|
||||||
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
blender::threading::parallel_for(nodes.index_range(), 1LL, [&](IndexRange range) {
|
||||||
for (int n : range) {
|
for (int n : range) {
|
||||||
|
SculptBrushTest test = test_init;
|
||||||
/* For each vertex */
|
/* For each vertex */
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
|
BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
|
||||||
@ -3573,11 +3585,13 @@ static void vpaint_do_draw(bContext *C,
|
|||||||
const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius);
|
const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius);
|
||||||
|
|
||||||
to_static_color_type(vpd->type, [&](auto dummy) {
|
to_static_color_type(vpd->type, [&](auto dummy) {
|
||||||
using Color = decltype(dummy);
|
using T = decltype(dummy);
|
||||||
|
using Color =
|
||||||
|
std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
|
||||||
using Traits = color::Traits<Color>;
|
using Traits = color::Traits<Color>;
|
||||||
MutableSpan<Color> colors = attribute.typed<Color>();
|
MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
|
||||||
MutableSpan<Color> previous_color = g_previous_color.typed<Color>();
|
MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
|
||||||
Color color_final = fromFloat<Color>(paintcol);
|
Color color_final = fromFloat<Color>(vpd->paintcol);
|
||||||
|
|
||||||
/* If we're painting with a texture, sample the texture color and alpha. */
|
/* If we're painting with a texture, sample the texture color and alpha. */
|
||||||
float tex_alpha = 1.0;
|
float tex_alpha = 1.0;
|
||||||
@ -3849,7 +3863,7 @@ static void vpaint_stroke_done(const bContext *C, PaintStroke *stroke)
|
|||||||
|
|
||||||
SculptSession *ss = ob->sculpt;
|
SculptSession *ss = ob->sculpt;
|
||||||
|
|
||||||
if (ss->cache->alt_smooth) {
|
if (ss->cache && ss->cache->alt_smooth) {
|
||||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||||
VPaint *vp = ts->vpaint;
|
VPaint *vp = ts->vpaint;
|
||||||
smooth_brush_toggle_off(C, &vp->paint, ss->cache);
|
smooth_brush_toggle_off(C, &vp->paint, ss->cache);
|
||||||
|
@ -4334,7 +4334,6 @@ void SCULPT_cache_free(StrokeCache *cache)
|
|||||||
MEM_SAFE_FREE(cache->detail_directions);
|
MEM_SAFE_FREE(cache->detail_directions);
|
||||||
MEM_SAFE_FREE(cache->prev_displacement);
|
MEM_SAFE_FREE(cache->prev_displacement);
|
||||||
MEM_SAFE_FREE(cache->limit_surface_co);
|
MEM_SAFE_FREE(cache->limit_surface_co);
|
||||||
cache->prev_colors_vpaint = {};
|
|
||||||
|
|
||||||
if (cache->pose_ik_chain) {
|
if (cache->pose_ik_chain) {
|
||||||
SCULPT_pose_ik_chain_free(cache->pose_ik_chain);
|
SCULPT_pose_ik_chain_free(cache->pose_ik_chain);
|
||||||
@ -4350,7 +4349,7 @@ void SCULPT_cache_free(StrokeCache *cache)
|
|||||||
SCULPT_cloth_simulation_free(cache->cloth_sim);
|
SCULPT_cloth_simulation_free(cache->cloth_sim);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(cache);
|
MEM_delete(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize mirror modifier clipping. */
|
/* Initialize mirror modifier clipping. */
|
||||||
@ -4454,8 +4453,7 @@ static void smooth_brush_toggle_off(const bContext *C, Paint *paint, StrokeCache
|
|||||||
static void sculpt_update_cache_invariants(
|
static void sculpt_update_cache_invariants(
|
||||||
bContext *C, Sculpt *sd, SculptSession *ss, wmOperator *op, const float mval[2])
|
bContext *C, Sculpt *sd, SculptSession *ss, wmOperator *op, const float mval[2])
|
||||||
{
|
{
|
||||||
StrokeCache *cache = static_cast<StrokeCache *>(
|
StrokeCache *cache = MEM_new<StrokeCache>(__func__);
|
||||||
MEM_callocN(sizeof(StrokeCache), "stroke cache"));
|
|
||||||
ToolSettings *tool_settings = CTX_data_tool_settings(C);
|
ToolSettings *tool_settings = CTX_data_tool_settings(C);
|
||||||
UnifiedPaintSettings *ups = &tool_settings->unified_paint_settings;
|
UnifiedPaintSettings *ups = &tool_settings->unified_paint_settings;
|
||||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||||
|
Loading…
Reference in New Issue
Block a user