diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 68 |
1 files changed, 16 insertions, 52 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 1e4931ac792..dbb29997102 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -40,7 +40,6 @@ #include "BLI_dial.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" -#include "BLI_threads.h" #include "BLF_translation.h" @@ -56,7 +55,6 @@ #include "BKE_brush.h" #include "BKE_ccg.h" #include "BKE_context.h" -#include "BKE_crazyspace.h" #include "BKE_depsgraph.h" #include "BKE_image.h" #include "BKE_key.h" @@ -85,7 +83,6 @@ #include "RNA_access.h" #include "RNA_define.h" -#include "RE_render_ext.h" #include "GPU_buffers.h" @@ -106,6 +103,8 @@ #if defined(__APPLE__) && defined _OPENMP #include <sys/sysctl.h> +#include "BLI_threads.h" + /* Query how many cores not counting HT aka physical cores we've got. */ static int system_physical_thread_count(void) { @@ -116,33 +115,6 @@ static int system_physical_thread_count(void) } #endif /* __APPLE__ */ -void ED_sculpt_stroke_get_average(Object *ob, float stroke[3]) -{ - if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) { - float fac = 1.0f / ob->sculpt->average_stroke_counter; - mul_v3_v3fl(stroke, ob->sculpt->average_stroke_accum, fac); - } - else { - copy_v3_v3(stroke, ob->obmat[3]); - } -} - -bool ED_sculpt_minmax(bContext *C, float min[3], float max[3]) -{ - Object *ob = CTX_data_active_object(C); - - if (ob && ob->sculpt && ob->sculpt->last_stroke_valid) { - copy_v3_v3(min, ob->sculpt->last_stroke); - copy_v3_v3(max, ob->sculpt->last_stroke); - - return 1; - } - else { - return 0; - } -} - - /* Check if there are any active modifiers in stack (used for flushing updates at enter/exit sculpt mode) */ static bool sculpt_has_active_modifiers(Scene *scene, Object *ob) { @@ -2957,7 +2929,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) /* Note: we do the topology update before any brush actions to avoid * issues with the proxies. The size of the proxy can't change, so * topology must be updated first. */ -static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush) +static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *UNUSED(ups)) { SculptSession *ss = ob->sculpt; SculptSearchSphereData data; @@ -3018,13 +2990,10 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush) /* update average stroke position */ copy_v3_v3(location, ss->cache->true_location); mul_m4_v3(ob->obmat, location); - - add_v3_v3(ob->sculpt->average_stroke_accum, location); - ob->sculpt->average_stroke_counter++; } } -static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush) +static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups) { SculptSession *ss = ob->sculpt; SculptSearchSphereData data; @@ -3138,8 +3107,10 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush) copy_v3_v3(location, ss->cache->true_location); mul_m4_v3(ob->obmat, location); - add_v3_v3(ob->sculpt->average_stroke_accum, location); - ob->sculpt->average_stroke_counter++; + add_v3_v3(ups->average_stroke_accum, location); + ups->average_stroke_counter++; + /* update last stroke position */ + ups->last_stroke_valid = true; } } @@ -3348,9 +3319,9 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, } } -typedef void (*BrushActionFunc)(Sculpt *sd, Object *ob, Brush *brush); +typedef void (*BrushActionFunc)(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups); -static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, +static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, BrushActionFunc action, const char symm, const int axis, const float feather) @@ -3362,7 +3333,7 @@ static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, const float angle = 2 * M_PI * i / sd->radial_symm[axis - 'X']; ss->cache->radial_symmetry_pass = i; calc_brushdata_symm(sd, ss->cache, symm, axis, angle, feather); - action(sd, ob, brush); + action(sd, ob, brush, ups); } } @@ -3400,11 +3371,11 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob, cache->radial_symmetry_pass = 0; calc_brushdata_symm(sd, cache, i, 0, 0, feather); - action(sd, ob, brush); + action(sd, ob, brush, ups); - do_radial_symmetry(sd, ob, brush, action, i, 'X', feather); - do_radial_symmetry(sd, ob, brush, action, i, 'Y', feather); - do_radial_symmetry(sd, ob, brush, action, i, 'Z', feather); + do_radial_symmetry(sd, ob, brush, ups, action, i, 'X', feather); + do_radial_symmetry(sd, ob, brush, ups, action, i, 'Y', feather); + do_radial_symmetry(sd, ob, brush, ups, action, i, 'Z', feather); } } } @@ -4156,9 +4127,6 @@ static bool sculpt_brush_stroke_init(bContext *C, wmOperator *op) is_smooth = sculpt_any_smooth_mode(brush, NULL, mode); BKE_sculpt_update_mesh_elements(scene, sd, ob, is_smooth, need_mask); - zero_v3(ob->sculpt->average_stroke_accum); - ob->sculpt->average_stroke_counter = 0; - return 1; } @@ -4365,10 +4333,6 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str } } - /* update last stroke position */ - ob->sculpt->last_stroke_valid = 1; - ED_sculpt_stroke_get_average(ob, ob->sculpt->last_stroke); - sculpt_cache_free(ss->cache); ss->cache = NULL; @@ -4985,7 +4949,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) "Object has negative scale, sculpting may be unpredictable"); } - BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT); + BKE_paint_init(&ts->unified_paint_settings, &ts->sculpt->paint, PAINT_CURSOR_SCULPT); paint_cursor_start(C, sculpt_poll_view3d); } |