1
1

Cleanup: Rename StrokeCache.original to .accum

Note: the value is inverted, StrokeCache.accum = !StrokeCache.original.
This commit is contained in:
2023-04-28 17:58:26 -07:00
parent 15d2487e26
commit 2d2f4d9d28
2 changed files with 15 additions and 10 deletions

View File

@@ -2049,7 +2049,7 @@ static void calc_area_normal_and_center_task_cb(void *__restrict userdata,
bool use_original = false;
bool normal_test_r, area_test_r;
if (ss->cache && ss->cache->original) {
if (ss->cache && !ss->cache->accum) {
unode = SCULPT_undo_push_node(data->ob, data->nodes[n], SCULPT_UNDO_COORDS);
use_original = (unode->co || unode->bm_entry);
}
@@ -3436,7 +3436,7 @@ static void sculpt_topology_update(Sculpt *sd,
/* Build a list of all nodes that are potentially within the brush's area of influence. */
const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true :
ss->cache->original;
!ss->cache->accum;
const float radius_scale = 1.25f;
Vector<PBVHNode *> nodes = sculpt_pbvh_gather_generic(ob, sd, brush, use_original, radius_scale);
@@ -3547,7 +3547,7 @@ static void do_brush_action(Sculpt *sd,
}
const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true :
ss->cache->original;
!ss->cache->accum;
const bool use_pixels = sculpt_needs_pbvh_pixels(paint_mode_settings, brush, ob);
if (sculpt_needs_pbvh_pixels(paint_mode_settings, brush, ob)) {
@@ -4546,22 +4546,24 @@ static void sculpt_update_cache_invariants(
normalize_v3(cache->true_gravity_direction);
}
cache->accum = true;
/* Make copies of the mesh vertex locations and normals for some tools. */
if (brush->flag & BRUSH_ANCHORED) {
cache->original = true;
cache->accum = false;
}
/* Draw sharp does not need the original coordinates to produce the accumulate effect, so it
* should work the opposite way. */
if (brush->sculpt_tool == SCULPT_TOOL_DRAW_SHARP) {
cache->original = true;
cache->accum = false;
}
if (SCULPT_TOOL_HAS_ACCUMULATE(brush->sculpt_tool)) {
if (!(brush->flag & BRUSH_ACCUMULATE)) {
cache->original = true;
cache->accum = false;
if (brush->sculpt_tool == SCULPT_TOOL_DRAW_SHARP) {
cache->original = false;
cache->accum = true;
}
}
}
@@ -4570,7 +4572,7 @@ static void sculpt_update_cache_invariants(
* for image brushes. It's also not necessary, just disable it. */
if (brush && brush->sculpt_tool == SCULPT_TOOL_PAINT &&
SCULPT_use_image_paint_brush(&tool_settings->paint_mode, ob)) {
cache->original = false;
cache->accum = true;
}
cache->first_time = true;
@@ -5249,7 +5251,7 @@ bool SCULPT_stroke_get_location_ex(bContext *C,
ss = ob->sculpt;
cache = ss->cache;
original = force_original || ((cache) ? cache->original : false);
original = force_original || ((cache) ? !cache->accum : false);
const Brush *brush = BKE_paint_brush(BKE_paint_get_active_from_context(C));

View File

@@ -613,7 +613,10 @@ struct StrokeCache {
int radial_symmetry_pass;
float symm_rot_mat[4][4];
float symm_rot_mat_inv[4][4];
bool original;
/* Accumulate mode. Note: inverted for SCULPT_TOOL_DRAW_SHARP. */
bool accum;
float anchored_location[3];
/* Paint Brush. */