[Bf-blender-cvs] [2a3bd46] master: Sculpt: use Ctrl to set grab/sculpt normal-weight
Campbell Barton
noreply at git.blender.org
Mon Feb 22 20:28:56 CET 2016
Commit: 2a3bd4621b04c6ddb3883f72909ffcec8f788c35
Author: Campbell Barton
Date: Tue Feb 23 06:16:53 2016 +1100
Branches: master
https://developer.blender.org/rB2a3bd4621b04c6ddb3883f72909ffcec8f788c35
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.
===================================================================
M source/blender/editors/sculpt_paint/sculpt.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d1249c1..40ff662 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) */
More information about the Bf-blender-cvs
mailing list