[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58572] branches/soc-2013-paint/source/ blender: * Draw pressure as soon as the user starts the stroke
Antony Riakiotakis
kalast at gmail.com
Wed Jul 24 14:58:27 CEST 2013
Revision: 58572
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58572
Author: psy-fi
Date: 2013-07-24 12:58:27 +0000 (Wed, 24 Jul 2013)
Log Message:
-----------
* Draw pressure as soon as the user starts the stroke
* Do not calculate rake in cursor display while a stroke is active. It
can mess up a stroke easily, since the variables are global.
* Reset the brush rotation on stroke end not in brush display.
* Rename dispay_pressure to stroke_active (since this is what the
variable stores)
Modified Paths:
--------------
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_cursor.c
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h
Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_cursor.c 2013-07-24 11:59:10 UTC (rev 58571)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_cursor.c 2013-07-24 12:58:27 UTC (rev 58572)
@@ -546,7 +546,7 @@
glTranslatef(-0.5f, -0.5f, 0);
/* scale based on tablet pressure */
- if (primary && ups->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) {
+ if (primary && ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) {
glTranslatef(0.5f, 0.5f, 0);
glScalef(1.0f / ups->pressure_value, 1.0f / ups->pressure_value, 1);
glTranslatef(-0.5f, -0.5f, 0);
@@ -650,7 +650,7 @@
glDepthFunc(GL_ALWAYS);
/* scale based on tablet pressure */
- if (ups->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) {
+ if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) {
glTranslatef(0.5f, 0.5f, 0);
glScalef(1.0f / ups->pressure_value, 1.0f / ups->pressure_value, 1);
glTranslatef(-0.5f, -0.5f, 0);
@@ -753,7 +753,7 @@
projected_radius);
/* scale 3D brush radius by pressure */
- if (ups->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush))
+ if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush))
unprojected_radius *= ups->pressure_value;
/* set cached value in either Brush or UnifiedPaintSettings */
@@ -793,11 +793,13 @@
outline_col = brush->add_col;
final_radius = BKE_brush_size_get(scene, brush) * zoomx;
- if (brush->flag & BRUSH_RAKE)
- /* here, translation contains the mouse coordinates. */
- paint_calculate_rake_rotation(ups, translation);
- else if (!(brush->flag & BRUSH_ANCHORED))
- ups->brush_rotation = 0.0;
+ /* don't calculate rake angles while a stroke is active because the rake variables are global and
+ * we may get interference with the stroke itself. For line strokes, such interference is visible */
+ if (!ups->stroke_active) {
+ if (brush->flag & BRUSH_RAKE)
+ /* here, translation contains the mouse coordinates. */
+ paint_calculate_rake_rotation(ups, translation);
+ }
/* draw overlay */
paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode);
@@ -848,7 +850,7 @@
glTranslatef(translation[0], translation[1], 0);
/* draw an inner brush */
- if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) {
+ if (ups->stroke_active && 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: 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-24 11:59:10 UTC (rev 58571)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c 2013-07-24 12:58:27 UTC (rev 58572)
@@ -873,7 +873,7 @@
{
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)) {
+ if (ups->stroke_active && 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 */
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-24 11:59:10 UTC (rev 58571)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c 2013-07-24 12:58:27 UTC (rev 58572)
@@ -178,7 +178,6 @@
/* Truly temporary data that isn't stored in properties */
- ups->draw_pressure = true;
ups->pressure_value = stroke->cached_pressure;
ups->pixel_radius = BKE_brush_size_get(scene, brush);
@@ -540,7 +539,8 @@
/* initialize here */
ups->overlap_factor = 1.0;
-
+ ups->stroke_active = true;
+
BKE_paint_set_overlay_override(br->overlay_flags);
return stroke;
@@ -559,8 +559,12 @@
UnifiedPaintSettings *ups = stroke->ups;
ups->draw_anchored = false;
- ups->draw_pressure = false;
+ ups->stroke_active = false;
+ /* reset rotation here to avoid doing so in cursor display */
+ if (!(stroke->brush->flag & BRUSH_RAKE))
+ ups->brush_rotation = 0.0f;
+
if (stroke->stroke_started) {
if (stroke->redraw)
stroke->redraw(C, stroke, true);
Modified: branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h 2013-07-24 11:59:10 UTC (rev 58571)
+++ branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h 2013-07-24 12:58:27 UTC (rev 58572)
@@ -917,7 +917,7 @@
float anchored_initial_mouse[2];
/* drawing pressure */
- int draw_pressure;
+ int stroke_active;
float pressure_value;
/* position of mouse, used to sample the texture */
More information about the Bf-blender-cvs
mailing list