[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35285] trunk/blender/source/blender/ editors/sculpt_paint: Bugfix #26249
Ton Roosendaal
ton at blender.org
Tue Mar 1 17:26:37 CET 2011
Revision: 35285
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35285
Author: ton
Date: 2011-03-01 16:26:37 +0000 (Tue, 01 Mar 2011)
Log Message:
-----------
Bugfix #26249
Paint strokes now can be mapped to any key. The operators now store the
event it was started with, so it ends with a release. Even hotkeys work
(while hold).
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h 2011-03-01 15:54:49 UTC (rev 35284)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h 2011-03-01 16:26:37 UTC (rev 35285)
@@ -58,7 +58,7 @@
struct PaintStroke *paint_stroke_new(struct bContext *C,
StrokeGetLocation get_location, StrokeTestStart test_start,
- StrokeUpdateStep update_step, StrokeDone done);
+ StrokeUpdateStep update_step, StrokeDone done, int event_type);
void paint_stroke_free(struct PaintStroke *stroke);
int paint_space_stroke_enabled(struct Brush *br);
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2011-03-01 15:54:49 UTC (rev 35284)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c 2011-03-01 16:26:37 UTC (rev 35285)
@@ -79,7 +79,9 @@
e.g. in sculpt mode, stroke doesn't start until cursor
passes over the mesh */
int stroke_started;
-
+ /* event that started stroke, for modal() return */
+ int event_type;
+
StrokeGetLocation get_location;
StrokeTestStart test_start;
StrokeUpdateStep update_step;
@@ -374,7 +376,7 @@
float window[2];
int hit;
- stroke = paint_stroke_new(C, NULL, NULL, NULL, NULL);
+ stroke = paint_stroke_new(C, NULL, NULL, NULL, NULL, 0);
window[0] = x + stroke->vc.ar->winrct.xmin;
window[1] = y + stroke->vc.ar->winrct.ymin;
@@ -794,7 +796,7 @@
StrokeGetLocation get_location,
StrokeTestStart test_start,
StrokeUpdateStep update_step,
- StrokeDone done)
+ StrokeDone done, int event_type)
{
PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke");
@@ -806,7 +808,8 @@
stroke->test_start = test_start;
stroke->update_step = update_step;
stroke->done = done;
-
+ stroke->event_type= event_type; /* for modal, return event */
+
return stroke;
}
@@ -846,8 +849,7 @@
//ED_region_tag_redraw(ar);
}
- /* TODO: fix hardcoded events here */
- if(event->type == LEFTMOUSE && event->val == KM_RELEASE) {
+ if(event->type == stroke->event_type && event->val == KM_RELEASE) {
/* exit stroke, free data */
if(stroke->smooth_stroke_cursor)
WM_paint_cursor_end(CTX_wm_manager(C), stroke->smooth_stroke_cursor);
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2011-03-01 15:54:49 UTC (rev 35284)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c 2011-03-01 16:26:37 UTC (rev 35285)
@@ -1642,7 +1642,7 @@
op->customdata = paint_stroke_new(C, NULL, wpaint_stroke_test_start,
wpaint_stroke_update_step,
- wpaint_stroke_done);
+ wpaint_stroke_done, event->type);
/* add modal handler */
WM_event_add_modal_handler(C, op);
@@ -1934,7 +1934,7 @@
op->customdata = paint_stroke_new(C, NULL, vpaint_stroke_test_start,
vpaint_stroke_update_step,
- vpaint_stroke_done);
+ vpaint_stroke_done, event->type);
/* add modal handler */
WM_event_add_modal_handler(C, op);
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-03-01 15:54:49 UTC (rev 35284)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-03-01 16:26:37 UTC (rev 35285)
@@ -3501,7 +3501,7 @@
stroke = paint_stroke_new(C, sculpt_stroke_get_location,
sculpt_stroke_test_start,
sculpt_stroke_update_step,
- sculpt_stroke_done);
+ sculpt_stroke_done, event->type);
op->customdata = stroke;
@@ -3531,7 +3531,7 @@
return OPERATOR_CANCELLED;
op->customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start,
- sculpt_stroke_update_step, sculpt_stroke_done);
+ sculpt_stroke_update_step, sculpt_stroke_done, 0);
sculpt_update_cache_invariants(C, sd, ss, op, NULL);
More information about the Bf-blender-cvs
mailing list