[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57879] branches/soc-2013-paint/source/ blender/editors/sculpt_paint: Refactor:
Antony Riakiotakis
kalast at gmail.com
Sat Jun 29 14:13:59 CEST 2013
Revision: 57879
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57879
Author: psy-fi
Date: 2013-06-29 12:13:59 +0000 (Sat, 29 Jun 2013)
Log Message:
-----------
Refactor:
* Draw pressure is handled in stroke level.
* Anchored brush drawing is correctly handled outside sculpt mode too.
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/editors/sculpt_paint/paint_vertex.c
branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c
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-06-29 11:42:16 UTC (rev 57878)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_cursor.c 2013-06-29 12:13:59 UTC (rev 57879)
@@ -829,12 +829,12 @@
/* only do if brush is over the mesh */
if (hit)
paint_cursor_on_hit(ups, brush, &vc, location);
+ }
- if (ups->draw_anchored) {
- final_radius = ups->anchored_size;
- translation[0] = ups->anchored_initial_mouse[0];
- translation[1] = ups->anchored_initial_mouse[1];
- }
+ if (ups->draw_anchored) {
+ final_radius = ups->anchored_size;
+ translation[0] = ups->anchored_initial_mouse[0];
+ translation[1] = ups->anchored_initial_mouse[1];
}
/* make lines pretty */
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-06-29 11:42:16 UTC (rev 57878)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c 2013-06-29 12:13:59 UTC (rev 57879)
@@ -518,11 +518,6 @@
undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
image_undo_restore, image_undo_free);
- {
- UnifiedPaintSettings *ups = &settings->unified_paint_settings;
- ups->draw_pressure = true;
- }
-
return pop;
}
@@ -622,11 +617,6 @@
BKE_reportf(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted: %s", pop->s.warnpackedfile);
#endif
MEM_freeN(pop);
-
- {
- UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
- ups->draw_pressure = false;
- }
}
static int paint_stroke_test_start(bContext *UNUSED(C), wmOperator *UNUSED(op), const float UNUSED(mouse[2]))
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-06-29 11:42:16 UTC (rev 57878)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c 2013-06-29 12:13:59 UTC (rev 57879)
@@ -173,7 +173,7 @@
/* Truly temporary data that isn't stored in properties */
- ups->draw_pressure = TRUE;
+ ups->draw_pressure = true;
ups->pressure_value = stroke->cached_pressure;
ups->pixel_radius = BKE_brush_size_get(scene, brush);
@@ -493,7 +493,12 @@
static void stroke_done(struct bContext *C, struct wmOperator *op)
{
struct PaintStroke *stroke = op->customdata;
+ Scene *scene = CTX_data_scene(C);
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+ ups->draw_anchored = false;
+ ups->draw_pressure = false;
+
if (stroke->stroke_started) {
if (stroke->redraw)
stroke->redraw(C, stroke, true);
Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_vertex.c 2013-06-29 11:42:16 UTC (rev 57878)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_vertex.c 2013-06-29 12:13:59 UTC (rev 57879)
@@ -2249,11 +2249,6 @@
wpd->vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, wpd->vgroup_active);
}
- {
- UnifiedPaintSettings *ups = &ts->unified_paint_settings;
- ups->draw_pressure = true;
- }
-
return TRUE;
}
@@ -2539,10 +2534,6 @@
}
}
- {
- UnifiedPaintSettings *ups = &ts->unified_paint_settings;
- ups->draw_pressure = false;
- }
DAG_id_tag_update(ob->data, 0);
@@ -2860,11 +2851,6 @@
invert_m4_m4(imat, mat);
copy_m3_m4(vpd->vpimat, imat);
- {
- UnifiedPaintSettings *ups = &ts->unified_paint_settings;
- ups->draw_pressure = true;
- }
-
return 1;
}
@@ -3088,11 +3074,6 @@
if (vpd->mfacetag)
MEM_freeN(vpd->mfacetag);
- {
- UnifiedPaintSettings *ups = &ts->unified_paint_settings;
- ups->draw_pressure = false;
- }
-
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
MEM_freeN(vpd);
Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c 2013-06-29 11:42:16 UTC (rev 57878)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c 2013-06-29 12:13:59 UTC (rev 57879)
@@ -4406,17 +4406,12 @@
static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(stroke))
{
- UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
sculpt_omp_done(ss);
- /* reset values used to draw brush after completing the stroke */
- ups->draw_anchored = 0;
- ups->draw_pressure = 0;
-
/* Finished */
if (ss->cache) {
Brush *brush = BKE_paint_brush(&sd->paint);
More information about the Bf-blender-cvs
mailing list