Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-12-10 18:45:30 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-12-10 18:45:30 +0400
commita912afd202ecfdd0b459d85fba18280c38b0062f (patch)
tree246fb8565e354ea94d9f4a7ac7ff0494f3bf5bd7 /source/blender/editors/sculpt_paint
parente9a0a42dd3493c1a4456696cc6912b34a8548b25 (diff)
Fix #29516: Twist brush giving crazy results
- Rotation now happens around initial stroke location rather than around scene origin - Added slider for rotation strength which helps in cases only few rotation is needed to be to increase the precision of such strokes
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index a63a9256055..b84fea29e62 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -648,9 +648,11 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
return feather;
case SCULPT_TOOL_GRAB:
- case SCULPT_TOOL_ROTATE:
return feather;
+ case SCULPT_TOOL_ROTATE:
+ return alpha*pressure*feather;
+
default:
return 0;
}
@@ -1502,13 +1504,20 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
float bstrength= ss->cache->bstrength;
float an[3];
int n;
- float m[3][3];
+ float m[4][4], rot[4][4], lmat[4][4], ilmat[4][4];
static const int flip[8] = { 1, -1, -1, 1, -1, 1, 1, -1 };
float angle = ss->cache->vertex_rotation * flip[ss->cache->mirror_symmetry_pass];
calc_sculpt_normal(sd, ob, an, nodes, totnode);
- axis_angle_to_mat3(m, an, angle);
+ unit_m4(m);
+ unit_m4(lmat);
+
+ copy_v3_v3(lmat[3], ss->cache->location);
+ invert_m4_m4(ilmat, lmat);
+ axis_angle_to_mat4(rot, an, angle);
+
+ mul_serie_m4(m, lmat, rot, ilmat, NULL, NULL, NULL, NULL, NULL);
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for(n=0; n<totnode; n++) {
@@ -1532,7 +1541,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
an, origno[vd.i], NULL);
- mul_v3_m3v3(proxy[vd.i], m, origco[vd.i]);
+ mul_v3_m4v3(proxy[vd.i], m, origco[vd.i]);
sub_v3_v3(proxy[vd.i], origco[vd.i]);
mul_v3_fl(proxy[vd.i], fade);
@@ -3160,7 +3169,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
dx = cache->mouse[0] - cache->initial_mouse[0];
dy = cache->mouse[1] - cache->initial_mouse[1];
- cache->vertex_rotation = -atan2(dx, dy);
+ cache->vertex_rotation = -atan2(dx, dy) * cache->bstrength;
sd->draw_anchored = 1;
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);