[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34333] trunk/blender/source/blender/ editors/sculpt_paint: IRC bugreport fix: thumb brush works incorrect when using tablet by Dan McGrath (troubled)

Sergey Sharybin g.ulairi at gmail.com
Sat Jan 15 15:48:45 CET 2011


Revision: 34333
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34333
Author:   nazgul
Date:     2011-01-15 14:48:44 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
IRC bugreport fix: thumb brush works incorrect when using tablet by Dan McGrath (troubled)

Quite silly fix, not sure if it could be smarter with current events/brushes design.
Use pressure_value from first brush step for brushes which don't support strokes -- thumb.
brush, brushes with anchored stroke method.

Should be fixed in nicer way after events redesigning.

P.S. Tried to place pressure saving into invaliants update fuunction, but it seens
     that this function wouldn't know about pressure yet.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2011-01-15 14:07:11 UTC (rev 34332)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2011-01-15 14:48:44 UTC (rev 34333)
@@ -56,6 +56,8 @@
 					 StrokeUpdateStep update_step, StrokeDone done);
 void paint_stroke_free(struct PaintStroke *stroke);
 
+int paint_space_stroke_enabled(struct Brush *br);
+
 int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
 struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2011-01-15 14:07:11 UTC (rev 34332)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2011-01-15 14:48:44 UTC (rev 34333)
@@ -738,14 +738,6 @@
 	return 1;
 }
 
-/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
-static int paint_space_stroke_enabled(Brush *br)
-{
-	return (br->flag & BRUSH_SPACE) &&
-	       !(br->flag & BRUSH_ANCHORED) &&
-	       !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
-}
-
 /* For brushes with stroke spacing enabled, moves mouse in steps
    towards the final mouse location. */
 static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const float final_mouse[2])
@@ -818,6 +810,14 @@
 	MEM_freeN(stroke);
 }
 
+/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
+int paint_space_stroke_enabled(Brush *br)
+{
+	return (br->flag & BRUSH_SPACE) &&
+	       !(br->flag & BRUSH_ANCHORED) &&
+	       !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
+}
+
 int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	PaintStroke *stroke = op->customdata;

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-01-15 14:07:11 UTC (rev 34332)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-01-15 14:48:44 UTC (rev 34333)
@@ -2916,7 +2916,13 @@
 	cache->pen_flip = RNA_boolean_get(ptr, "pen_flip");
 	RNA_float_get_array(ptr, "mouse", cache->mouse);
 
-	cache->pressure = RNA_float_get(ptr, "pressure");
+	/* XXX: Use preassure value from first brush step for brushes which don't
+	        support strokes (grab, thumb). They depends on initial state and
+	        brush coord/pressure/etc.
+	        It's more an events design issue, which doesn't split coordinate/pressure/angle
+	        changing events. We should avoid this after events system re-design */
+	if(paint_space_stroke_enabled(brush) || cache->first_time)
+		cache->pressure = RNA_float_get(ptr, "pressure");
 
 	/* Truly temporary data that isn't stored in properties */
 




More information about the Bf-blender-cvs mailing list