diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2013-04-18 16:03:27 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2013-04-18 16:03:27 +0400 |
commit | 3bb53bbeae0e710c4186299c82d894d32b020214 (patch) | |
tree | c3bdf4e81ad152a18bc8e2aa039c8b15e676da17 /source/blender/editors/sculpt_paint/sculpt.c | |
parent | 7669d3c17d724311d3e6c6a8ee56da049fdbb4d6 (diff) |
Fix: view plane for sculpting did not work correctly for rotated
objects. Reuse the object space view vector. Also, minor cleanup, reused
cache values instead of requering.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 2c8aab8e5b9..75a00ba4f76 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1138,9 +1138,7 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, switch (brush->sculpt_plane) { case SCULPT_DISP_DIR_VIEW: - ED_view3d_global_to_vector(ss->cache->vc->rv3d, - ss->cache->vc->rv3d->twmat[3], - an); + copy_v3_v3(an, ss->cache->true_view_normal); break; case SCULPT_DISP_DIR_X: @@ -2410,7 +2408,7 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn { switch (brush->sculpt_plane) { case SCULPT_DISP_DIR_VIEW: - ED_view3d_global_to_vector(ss->cache->vc->rv3d, ss->cache->vc->rv3d->twmat[3], an); + copy_v3_v3(an, ss->cache->true_view_normal); break; case SCULPT_DISP_DIR_X: @@ -3870,7 +3868,6 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru /* Initialize the stroke cache variants from operator properties */ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, - struct PaintStroke *stroke, PointerRNA *ptr) { Scene *scene = CTX_data_scene(C); @@ -3937,7 +3934,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, } } - cache->radius = paint_calc_object_space_radius(paint_stroke_view_context(stroke), + cache->radius = paint_calc_object_space_radius(cache->vc, cache->true_location, ups->pixel_radius); cache->radius_squared = cache->radius * cache->radius; @@ -4249,7 +4246,7 @@ static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op, return 0; } -static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr) +static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *UNUSED(stroke), PointerRNA *itemptr) { UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; @@ -4258,7 +4255,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, P const Brush *brush = BKE_paint_brush(&sd->paint); sculpt_stroke_modifiers_check(C, ob); - sculpt_update_cache_variants(C, sd, ob, stroke, itemptr); + sculpt_update_cache_variants(C, sd, ob, itemptr); sculpt_restore_mesh(sd, ob); BKE_pbvh_bmesh_detail_size_set(ss->pbvh, |