Commit: 5d30862318be28d4093881402c2dad0c3d24e542
Author: Joshua Leung
Date: Sun Nov 22 20:34:20 2015 +1300
Branches: PSketch
https://developer.blender.org/rB5d30862318be28d4093881402c2dad0c3d24e542
PSculpt: Store pressure data from tablet too
Although this is not used by the current brushes, it helps to have this in place
so that we can make use of it for later brush ideas.
===================================================================
M source/blender/editors/armature/pose_sculpt.c
===================================================================
diff --git a/source/blender/editors/armature/pose_sculpt.c
b/source/blender/editors/armature/pose_sculpt.c
index b2430a6..7a9bf28 100644
--- a/source/blender/editors/armature/pose_sculpt.c
+++ b/source/blender/editors/armature/pose_sculpt.c
@@ -1161,11 +1161,28 @@ static void psculpt_brush_apply_event(bContext *C,
wmOperator *op, const wmEvent
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
- RNA_float_set_array(&itemptr, "mouse", mouse);
- // XXX: tablet data...
+ RNA_float_set_array(&itemptr, "mouse", mouse);
RNA_boolean_set(&itemptr, "pen_flip", event->shift != false); // XXX
hardcoded
+ /* handle pressure sensitivity (which is supplied by tablets) */
+ if (event->tablet_data) {
+ const wmTabletData *wmtab = event->tablet_data;
+ float pressure = wmtab->Pressure;
+ bool tablet = (wmtab->Active != EVT_TABLET_NONE);
+
+ /* special exception here for too high pressure values on first
touch in
+ * windows for some tablets: clamp the values to be sane
+ */
+ if (tablet && (pressure >= 0.99f)) {
+ pressure = 1.0f;
+ }
+ RNA_float_set(&itemptr, "pressure", pressure);
+ }
+ else {
+ RNA_float_set(&itemptr, "pressure", 1.0f);
+ }
+
/* apply */
psculpt_brush_apply(C, op, &itemptr);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs