[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53856] trunk/blender/source/blender: fix for airbrush not using tablet pressure ( any brush with BRUSH_SPACE disabled).

Campbell Barton ideasman42 at gmail.com
Wed Jan 16 20:59:56 CET 2013


Revision: 53856
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53856
Author:   campbellbarton
Date:     2013-01-16 19:59:55 +0000 (Wed, 16 Jan 2013)
Log Message:
-----------
fix for airbrush not using tablet pressure (any brush with BRUSH_SPACE disabled).

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
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-01-16 19:51:47 UTC (rev 53855)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-01-16 19:59:55 UTC (rev 53856)
@@ -61,7 +61,8 @@
                                      StrokeUpdateStep update_step, StrokeDone done, int event_type);
 void paint_stroke_data_free(struct wmOperator *op);
 
-int paint_space_stroke_enabled(struct Brush *br);
+bool paint_space_stroke_enabled(struct Brush *br);
+bool paint_supports_dynamic_size(struct Brush *br);
 
 struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
 int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-01-16 19:51:47 UTC (rev 53855)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-01-16 19:59:55 UTC (rev 53856)
@@ -324,10 +324,15 @@
 }
 
 /* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
-int paint_space_stroke_enabled(Brush *br)
+bool paint_space_stroke_enabled(Brush *br)
 {
-	return (br->flag & BRUSH_SPACE) &&
-	       !(br->flag & BRUSH_ANCHORED) &&
+	return (br->flag & BRUSH_SPACE) && paint_supports_dynamic_size(br);
+}
+
+/* return true if the brush size can change during paint (normally used for pressure) */
+bool paint_supports_dynamic_size(Brush *br)
+{
+	return !(br->flag & BRUSH_ANCHORED) &&
 	       !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
 }
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-01-16 19:51:47 UTC (rev 53855)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-01-16 19:59:55 UTC (rev 53856)
@@ -3882,8 +3882,9 @@
 	 *      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)
+	if (paint_supports_dynamic_size(brush) || cache->first_time) {
 		cache->pressure = RNA_float_get(ptr, "pressure");
+	}
 
 	/* Truly temporary data that isn't stored in properties */
 

Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2013-01-16 19:51:47 UTC (rev 53855)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c	2013-01-16 19:59:55 UTC (rev 53856)
@@ -2655,7 +2655,7 @@
 		event->custom = EVT_DATA_TABLET;
 		event->customdata = wmtab;
 		event->customdatafree = 1;
-		// printf("%s: using tablet %.5f\n", wmtab->Pressure, __func__);
+		// printf("%s: using tablet %.5f\n", __func__, wmtab->Pressure);
 	}
 	else {
 		// printf("%s: not using tablet\n", __func__);




More information about the Bf-blender-cvs mailing list