diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 10 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 3 |
4 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index fc0c6d748cb..372ea954630 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -335,6 +335,7 @@ static bool paint_brush_update(bContext *C, ups->size_pressure_value = stroke->cached_size_pressure; ups->pixel_radius = BKE_brush_size_get(scene, brush); + ups->initial_pixel_radius = BKE_brush_size_get(scene, brush); if (BKE_brush_use_size_pressure(brush) && paint_supports_dynamic_size(brush, mode)) { ups->pixel_radius *= stroke->cached_size_pressure; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8be44066741..b35fc11aedc 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -6730,11 +6730,12 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po if (BKE_brush_use_size_pressure(brush) && paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) { cache->radius = sculpt_brush_dynamic_size_get(brush, cache, cache->initial_radius); - cache->dyntopo_radius = cache->initial_radius * cache->pressure; + cache->dyntopo_pixel_radius = sculpt_brush_dynamic_size_get( + brush, cache, ups->initial_pixel_radius); } else { cache->radius = cache->initial_radius; - cache->dyntopo_radius = cache->initial_radius; + cache->dyntopo_pixel_radius = ups->initial_pixel_radius; } cache->radius_squared = cache->radius * cache->radius; @@ -7345,12 +7346,11 @@ static void sculpt_stroke_update_step(bContext *C, BKE_pbvh_bmesh_detail_size_set(ss->pbvh, object_space_constant_detail); } else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) { - BKE_pbvh_bmesh_detail_size_set(ss->pbvh, - ss->cache->dyntopo_radius * sd->detail_percent / 100.0f); + BKE_pbvh_bmesh_detail_size_set(ss->pbvh, ss->cache->radius * sd->detail_percent / 100.0f); } else { BKE_pbvh_bmesh_detail_size_set(ss->pbvh, - (ss->cache->dyntopo_radius / (float)ups->pixel_radius) * + (ss->cache->radius / ss->cache->dyntopo_pixel_radius) * (float)(sd->detail_size * U.pixelsize) / 0.4f); } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 324ca250c86..e9ad31d6f25 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -319,8 +319,8 @@ typedef struct StrokeCache { float location[3]; float last_location[3]; - /* This radius variable is not affected by pressure curves */ - float dyntopo_radius; + /* Original pixel radius with the pressure curve applied for dyntopo detail size */ + float dyntopo_pixel_radius; bool is_last_valid; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5336ea381c3..980fbfa72e0 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1277,6 +1277,9 @@ typedef struct UnifiedPaintSettings { /* radius of brush, premultiplied with pressure. * In case of anchored brushes contains the anchored radius */ float pixel_radius; + float initial_pixel_radius; + + char _pad[4]; /* drawing pressure */ float size_pressure_value; |