[Bf-blender-cvs] [b97d3bc] master: Fix T40834, grab brush not working after recent jittering fix.

Antony Riakiotakis noreply at git.blender.org
Fri Jun 27 12:57:37 CEST 2014


Commit: b97d3bc198244d88d71b5e514af6b4c039eec584
Author: Antony Riakiotakis
Date:   Fri Jun 27 13:56:57 2014 +0300
https://developer.blender.org/rBb97d3bc198244d88d71b5e514af6b4c039eec584

Fix T40834, grab brush not working after recent jittering fix.

Some brushes do not require location always. Made a list here, there may
be others but I think this pretty much covers this.

===================================================================

M	source/blender/editors/sculpt_paint/paint_stroke.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 9340858..452e288 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -155,6 +155,23 @@ static float event_tablet_data(const wmEvent *event, int *pen_flip)
 	return pressure;
 }
 
+static bool paint_tool_require_location(Brush *brush, PaintMode mode) {
+	switch (mode) {
+		case PAINT_SCULPT:
+			if (ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+			                              SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
+			{
+				return false;
+			}
+			else
+				return true;
+
+		default:
+			break;
+	}
+
+	return true;
+}
 
 /* Initialize the stroke cache variants from operator properties */
 static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode,
@@ -257,6 +274,9 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode,
 				if (stroke->get_location(C, out, halfway)) {
 					hit = true;
 				}
+				else if (!paint_tool_require_location(brush, mode)) {
+					hit = true;
+				}
 			}
 			else {
 				hit = true;
@@ -338,9 +358,11 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
 	/* TODO: can remove the if statement once all modes have this */
 	if (stroke->get_location) {
 		if (!stroke->get_location(C, location, mouse_out)) {
-			if (ar && (paint->flags & PAINT_SHOW_BRUSH))
-				WM_paint_cursor_tag_redraw(window, ar);
-			return;
+			if (paint_tool_require_location(brush, mode)) {
+				if (ar && (paint->flags & PAINT_SHOW_BRUSH))
+					WM_paint_cursor_tag_redraw(window, ar);
+				return;
+			}
 		}
 	}
 	else




More information about the Bf-blender-cvs mailing list