[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53872] trunk/blender/source/blender/ editors/sculpt_paint: - draw inner pressure circle for weightpaint, vertexpaint, projectpaint modes.

Campbell Barton ideasman42 at gmail.com
Thu Jan 17 05:24:27 CET 2013


Revision: 53872
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53872
Author:   campbellbarton
Date:     2013-01-17 04:24:22 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
- draw inner pressure circle for weightpaint, vertexpaint, projectpaint modes.
- only draw pressure circle if the pressure is used for brush size.
- remove 'last-pressure' workaround for project paint, its no longer needed.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c	2013-01-17 04:00:51 UTC (rev 53871)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c	2013-01-17 04:24:22 UTC (rev 53872)
@@ -597,7 +597,7 @@
 	glTranslatef(translation[0], translation[1], 0);
 
 	/* draw an inner brush */
-	if (ups->draw_pressure) {
+	if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) {
 		/* inner at full alpha */
 		glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius * ups->pressure_value, 40);
 		/* outer at half alpha */

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2013-01-17 04:00:51 UTC (rev 53871)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2013-01-17 04:24:22 UTC (rev 53872)
@@ -4965,7 +4965,6 @@
 
 	int first;
 	int prevmouse[2];
-	float prev_pressure; /* need this since we don't get tablet events for pressure change */
 	int orig_brush_size;
 	double starttime;
 
@@ -5183,6 +5182,11 @@
 	/* create painter */
 	pop->painter = BKE_brush_painter_new(scene, pop->s.brush);
 
+	{
+		UnifiedPaintSettings *ups = &settings->unified_paint_settings;
+		ups->draw_pressure = true;
+	}
+
 	return 1;
 }
 
@@ -5271,6 +5275,11 @@
 		BKE_reportf(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted: %s", pop->s.warnpackedfile);
 
 	MEM_freeN(pop);
+
+	{
+		UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+		ups->draw_pressure = false;
+	}
 }
 
 static int paint_exec(bContext *C, wmOperator *op)
@@ -5313,8 +5322,9 @@
 		if (wmtab->Active == EVT_TABLET_ERASER)
 			pop->s.blend = IMB_BLEND_ERASE_ALPHA;
 	}
-	else { /* otherwise airbrush becomes 1.0 pressure instantly */
-		pressure = pop->prev_pressure ? pop->prev_pressure : 1.0f;
+	else {
+		BLI_assert(fabsf(WM_cursor_pressure(CTX_wm_window(C))) == 1.0f);
+		pressure = 1.0f;
 	}
 
 	if (pop->first) {
@@ -5347,7 +5357,10 @@
 	/* apply */
 	paint_apply(C, op, &itemptr);
 
-	pop->prev_pressure = pressure;
+	{
+		UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+		ups->pressure_value = pressure;
+	}
 }
 
 static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -5358,7 +5371,7 @@
 		MEM_freeN(op->customdata);
 		return OPERATOR_CANCELLED;
 	}
-	
+
 	paint_apply_event(C, op, event);
 
 	pop = op->customdata;
@@ -5488,6 +5501,16 @@
 		glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha);
 		glEnable(GL_LINE_SMOOTH);
 		glEnable(GL_BLEND);
+		{
+			UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+			/* hrmf, duplicate paint_draw_cursor logic here */
+			if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) {
+				/* inner at full alpha */
+				glutil_draw_lined_arc(0, (float)(M_PI * 2.0), size * ups->pressure_value, 40);
+				/* outer at half alpha */
+				glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha * 0.5f);
+			}
+		}
 		glutil_draw_lined_arc(0, (float)(M_PI * 2.0), size, 40);
 		glDisable(GL_BLEND);
 		glDisable(GL_LINE_SMOOTH);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2013-01-17 04:00:51 UTC (rev 53871)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2013-01-17 04:24:22 UTC (rev 53872)
@@ -2172,6 +2172,11 @@
 	if (me->editflag & ME_EDIT_MIRROR_X) {
 		wpd->vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, wpd->vgroup_active);
 	}
+
+	{
+		UnifiedPaintSettings *ups = &ts->unified_paint_settings;
+		ups->draw_pressure = true;
+	}
 	
 	return TRUE;
 }
@@ -2414,6 +2419,11 @@
 
 	swap_m4m4(vc->rv3d->persmat, mat);
 
+	{
+		UnifiedPaintSettings *ups = &ts->unified_paint_settings;
+		ups->pressure_value = pressure;
+	}
+
 	DAG_id_tag_update(ob->data, 0);
 	ED_region_tag_redraw(vc->ar);
 }
@@ -2454,7 +2464,12 @@
 			}
 		}
 	}
-	
+
+	{
+		UnifiedPaintSettings *ups = &ts->unified_paint_settings;
+		ups->draw_pressure = false;
+	}
+
 	DAG_id_tag_update(ob->data, 0);
 
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
@@ -2735,6 +2750,11 @@
 	invert_m4_m4(imat, mat);
 	copy_m3_m4(vpd->vpimat, imat);
 
+	{
+		UnifiedPaintSettings *ups = &ts->unified_paint_settings;
+		ups->draw_pressure = true;
+	}
+
 	return 1;
 }
 
@@ -2889,6 +2909,11 @@
 		do_shared_vertexcol(me, do_tessface);
 	}
 
+	{
+		UnifiedPaintSettings *ups = &ts->unified_paint_settings;
+		ups->pressure_value = pressure;
+	}
+
 	ED_region_tag_redraw(vc->ar);
 
 	if (vpd->use_fast_update == FALSE) {
@@ -2920,6 +2945,11 @@
 		BLI_memarena_free(vpd->polyfacemap_arena);
 	}
 
+	{
+		UnifiedPaintSettings *ups = &ts->unified_paint_settings;
+		ups->draw_pressure = false;
+	}
+
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
 
 	MEM_freeN(vpd);




More information about the Bf-blender-cvs mailing list