[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55176] trunk/blender/source/blender/ editors/sculpt_paint: Fix: stroke spacing fails in image editor, we need to account for

Antony Riakiotakis kalast at gmail.com
Sun Mar 10 19:46:32 CET 2013


Revision: 55176
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55176
Author:   psy-fi
Date:     2013-03-10 18:46:31 +0000 (Sun, 10 Mar 2013)
Log Message:
-----------
Fix: stroke spacing fails in image editor, we need to account for
zooming because spacing used to happen in unscaled screen space

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

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2013-03-10 18:05:13 UTC (rev 55175)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2013-03-10 18:46:31 UTC (rev 55176)
@@ -623,7 +623,7 @@
 }
 
 
-static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
+int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
 {
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-03-10 18:05:13 UTC (rev 55175)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-03-10 18:46:31 UTC (rev 55176)
@@ -126,6 +126,7 @@
 void set_imapaintpartial(struct ImagePaintPartialRedraw * ippr);
 void imapaint_clear_partial_redraw(void);
 void imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h);
+int get_imapaint_zoom(struct bContext *C, float *zoomx, float *zoomy);
 void *paint_2d_new_stroke(struct bContext *, struct wmOperator *);
 void paint_2d_redraw(const bContext *C, void *ps, int final);
 void paint_2d_stroke_done(void *ps);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-03-10 18:05:13 UTC (rev 55175)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-03-10 18:46:31 UTC (rev 55176)
@@ -269,14 +269,21 @@
 				size_pressure = pressure;
 			
 			if (size_pressure > FLT_EPSILON) {
+				float zoomx, zoomy;
 				/* 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) * size_pressure);
 				float spacing = stroke->brush->spacing;
 
+				/* stroke system is used for 2d paint too, so we need to account for
+				 * the fact that brush can be scaled there. */
+				get_imapaint_zoom(C, &zoomx, &zoomy);
+
 				if (stroke->brush->flag & BRUSH_SPACING_PRESSURE)
 					spacing = max_ff(1.0f, spacing * (1.5f - pressure));
 
+				spacing *= max_ff(zoomx, zoomy);
+
 				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