[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55145] trunk/blender: Time to start reaping the benefits of code unification.

Antony Riakiotakis kalast at gmail.com
Sun Mar 10 01:58:09 CET 2013


Revision: 55145
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55145
Author:   psy-fi
Date:     2013-03-10 00:58:09 +0000 (Sun, 10 Mar 2013)
Log Message:
-----------
Time to start reaping the benefits of code unification. Support for
pressure spacing across all paint systems (was supported only for
texture painting earlier). Also, switch paint code to use the new code
path from now on. No shift-Lclick required anymore.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-03-10 00:42:47 UTC (rev 55144)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-03-10 00:58:09 UTC (rev 55145)
@@ -808,9 +808,10 @@
 
             if brush.use_space:
                 col.separator()
-                row = col.row()
+                row = col.row(align=True)
                 row.active = brush.use_space
                 row.prop(brush, "spacing", text="Spacing")
+                row.prop(brush, "use_pressure_spacing", toggle=True, text="")
 
             if brush.sculpt_capabilities.has_smooth_stroke:
                 col = layout.column()
@@ -853,9 +854,10 @@
             col.active = brush.sculpt_capabilities.has_spacing
             col.prop(brush, "use_space")
 
-            row = col.row()
+            row = col.row(align=True)
             row.active = brush.use_space
             row.prop(brush, "spacing", text="Spacing")
+            row.prop(brush, "use_pressure_spacing", toggle=True, text="")
 
 
 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2013-03-10 00:42:47 UTC (rev 55144)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c	2013-03-10 00:58:09 UTC (rev 55145)
@@ -760,8 +760,8 @@
 	keymap = WM_keymap_find(keyconf, "Image Paint", 0, 0);
 	keymap->poll = image_texture_paint_poll;
 
-	WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "PAINT_OT_image_paint_proj", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
+//	WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "PAINT_OT_image_paint_proj", LEFTMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", RIGHTMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_clone_cursor_set", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-03-10 00:42:47 UTC (rev 55144)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-03-10 00:58:09 UTC (rev 55145)
@@ -247,17 +247,23 @@
 			const Scene *scene = CTX_data_scene(C);
 			int steps;
 			int i;
-			float pressure = 1.0f;
+			float size_pressure = 1.0f;
+			float pressure = event_tablet_data(event, NULL);
 
 			/* XXX mysterious :) what has 'use size' do with this here... if you don't check for it, pressure fails */
 			if (BKE_brush_use_size_pressure(scene, stroke->brush))
-				pressure = event_tablet_data(event, NULL);
+				size_pressure = pressure;
 			
-			if (pressure > FLT_EPSILON) {
+			if (size_pressure > FLT_EPSILON) {
 				/* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel
 				 * causing very high step sizes, hanging blender [#32381] */
-				const float size_clamp = max_ff(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure);
-				scale = (size_clamp * stroke->brush->spacing / 50.0f) / length;
+				const float size_clamp = max_ff(1.0f, BKE_brush_size_get(scene, stroke->brush) * size_pressure);
+				float spacing = stroke->brush->spacing;
+
+				if (stroke->brush->flag & BRUSH_SPACING_PRESSURE)
+					spacing = max_ff(1.0f, spacing * (1.5f - pressure));
+
+				scale = (size_clamp * spacing / 50.0f) / length;
 				if (scale > FLT_EPSILON) {
 					mul_v2_fl(vec, scale);
 




More information about the Bf-blender-cvs mailing list