[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58411] branches/soc-2013-paint/source/ blender/editors/sculpt_paint: Fix space attenuation dependent on zoom, also painting not getting

Antony Riakiotakis kalast at gmail.com
Fri Jul 19 18:22:32 CEST 2013


Revision: 58411
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58411
Author:   psy-fi
Date:     2013-07-19 16:22:31 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
Fix space attenuation dependent on zoom, also painting not getting
correct space attenuation factor when space without accumulation option
and space attenuation was active

Modified Paths:
--------------
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c	2013-07-19 15:52:03 UTC (rev 58410)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c	2013-07-19 16:22:31 UTC (rev 58411)
@@ -627,6 +627,8 @@
 	UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings;
 	Brush *brush = BKE_paint_brush(&toolsettings->imapaint.paint);
 
+	float alphafac = (brush->flag & BRUSH_ACCUMULATE)? ups->overlap_factor : 1.0;
+
 	/* initial brush values. Maybe it should be considered moving these to stroke system */
 	float startsize = (float)BKE_brush_size_get(scene, brush);
 	float startalpha = BKE_brush_alpha_get(scene, brush);
@@ -642,7 +644,7 @@
 	size = RNA_float_get(itemptr, "size");
 
 	if (BKE_brush_use_alpha_pressure(scene, brush))
-		BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * pressure * ups->overlap_factor));
+		BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * pressure * alphafac));
 
 	BKE_brush_size_set(scene, brush, max_ff(1.0f, size));
 

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c	2013-07-19 15:52:03 UTC (rev 58410)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c	2013-07-19 16:22:31 UTC (rev 58411)
@@ -498,7 +498,7 @@
 				mouse[1] = stroke->last_mouse_position[1] + dmouse[1] * spacing;
 				pressure = stroke->last_pressure + (spacing / length) * dpressure;
 
-				ups->overlap_factor = paint_stroke_integrate_overlap(stroke->brush, spacing);
+				ups->overlap_factor = paint_stroke_integrate_overlap(stroke->brush, spacing/stroke->zoom_2d);
 
 				paint_brush_stroke_add_step(C, op, mouse, pressure);
 
@@ -530,6 +530,8 @@
 	ToolSettings *toolsettings = CTX_data_tool_settings(C);
 	UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings;
 	Brush *br = stroke->brush = BKE_paint_brush(BKE_paint_get_active_from_context(C));
+	float zoomx, zoomy;
+
 	view3d_set_viewcontext(C, &stroke->vc);
 	if (stroke->vc.v3d)
 		view3d_get_transformation(stroke->vc.ar, stroke->vc.rv3d, stroke->vc.obact, &stroke->mats);
@@ -541,6 +543,8 @@
 	stroke->done = done;
 	stroke->event_type = event_type; /* for modal, return event */
 	stroke->ups = ups;
+	get_imapaint_zoom(C, &zoomx, &zoomy);
+	stroke->zoom_2d = max_ff(zoomx, zoomy);
 
 	/* initialize here */
 	ups->overlap_factor = 1.0;
@@ -729,7 +733,6 @@
 	float mouse[2];
 	bool first_dab = false;
 	bool first_modal = false;
-	float zoomx, zoomy;
 	bool redraw = false;
 	float pressure;
 
@@ -739,9 +742,6 @@
 	paint_stroke_add_sample(p, stroke, event->mval[0], event->mval[1], pressure);
 	paint_stroke_sample_average(stroke, &sample_average);
 
-	get_imapaint_zoom(C, &zoomx, &zoomy);
-	stroke->zoom_2d = max_ff(zoomx, zoomy);
-
 	/* let NDOF motion pass through to the 3D view so we can paint and rotate simultaneously!
 	 * this isn't perfect... even when an extra MOUSEMOVE is spoofed, the stroke discards it
 	 * since the 2D deltas are zero -- code in this file needs to be updated to use the




More information about the Bf-blender-cvs mailing list