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:
authorCampbell Barton <ideasman42@gmail.com>2016-02-22 22:16:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-22 22:21:14 +0300
commit2a3bd4621b04c6ddb3883f72909ffcec8f788c35 (patch)
treeb4dd9e158d56ec4048bb06f3d27ec6699bd1651e /source/blender/editors/sculpt_paint
parentf8ee24b1a85c63de0276fff501a99a276da082b7 (diff)
Sculpt: use Ctrl to set grab/sculpt normal-weight
Having to change this with the slider each time isn't so convenient and invert in this case does nothing.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d1249c14e81..40ff662a2c2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -142,10 +142,10 @@ static bool sculpt_tool_is_proxy_used(const char sculpt_tool)
/**
* Test whether the #StrokeCache.sculpt_normal needs update in #do_brush_action
*/
-static int sculpt_brush_needs_normal(const Brush *brush)
+static int sculpt_brush_needs_normal(const Brush *brush, float normal_weight)
{
return ((SCULPT_TOOL_HAS_NORMAL_WEIGHT(brush->sculpt_tool) &&
- (brush->normal_weight > 0)) ||
+ (normal_weight > 0.0f)) ||
ELEM(brush->sculpt_tool,
SCULPT_TOOL_BLOB,
@@ -204,6 +204,7 @@ typedef struct StrokeCache {
float pressure;
float mouse[2];
float bstrength;
+ float normal_weight; /* from brush (with optional override) */
/* The rest is temporary storage that isn't saved as a property */
@@ -2230,8 +2231,8 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
- if (brush->normal_weight > 0) {
- sculpt_project_v3_normal_align(ss, brush->normal_weight, grab_delta);
+ if (ss->cache->normal_weight > 0.0f) {
+ sculpt_project_v3_normal_align(ss, ss->cache->normal_weight, grab_delta);
}
SculptThreadedTaskData data = {
@@ -2372,19 +2373,16 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
Brush *brush = BKE_paint_brush(&sd->paint);
const float bstrength = ss->cache->bstrength;
float grab_delta[3];
- float len;
SculptProjectVector spvc;
copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
- len = len_v3(grab_delta);
-
if (bstrength < 0)
negate_v3(grab_delta);
- if (brush->normal_weight > 0) {
- sculpt_project_v3_normal_align(ss, brush->normal_weight, grab_delta);
+ if (ss->cache->normal_weight > 0.0f) {
+ sculpt_project_v3_normal_align(ss, ss->cache->normal_weight, grab_delta);
}
/* optionally pinch while painting */
@@ -3405,7 +3403,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
0, totnode, &task_data, do_brush_action_task_cb,
((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT));
- if (sculpt_brush_needs_normal(brush))
+ if (sculpt_brush_needs_normal(brush, ss->cache->normal_weight))
update_sculpt_normal(sd, ob, nodes, totnode);
if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)
@@ -4032,6 +4030,15 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
mode = RNA_enum_get(op->ptr, "mode");
cache->invert = mode == BRUSH_STROKE_INVERT;
cache->alt_smooth = mode == BRUSH_STROKE_SMOOTH;
+ cache->normal_weight = brush->normal_weight;
+
+ /* interpret invert as following normal, for grab brushes */
+ if (SCULPT_TOOL_HAS_NORMAL_WEIGHT(brush->sculpt_tool)) {
+ if (cache->invert) {
+ cache->invert = false;
+ cache->normal_weight = (cache->normal_weight == 0.0f);
+ }
+ }
/* not very nice, but with current events system implementation
* we can't handle brush appearance inversion hotkey separately (sergey) */