[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61217] branches/soc-2013-paint/source/ blender/editors/sculpt_paint: Make mode stroke enum normal if operator is using Curve or Polyline

Antony Riakiotakis kalast at gmail.com
Sat Nov 9 22:19:12 CET 2013


Revision: 61217
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61217
Author:   psy-fi
Date:     2013-11-09 21:19:11 +0000 (Sat, 09 Nov 2013)
Log Message:
-----------
Make mode stroke enum normal if operator is using Curve or Polyline
mode. It made it confusing because users used ctrl-click to add extra
points, often inverting the stroke.

Modified Paths:
--------------
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_intern.h
    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_image.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c	2013-11-09 20:37:41 UTC (rev 61216)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image.c	2013-11-09 21:19:11 UTC (rev 61217)
@@ -685,7 +685,7 @@
 }
 
 
-static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, float mouse[2])
+static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const float mouse[2])
 {
 	Scene *scene = CTX_data_scene(C);
 	ToolSettings *toolsettings = scene->toolsettings;
@@ -856,32 +856,31 @@
 	MEM_freeN(pop);
 }
 
-static int paint_stroke_test_start(bContext *UNUSED(C), wmOperator *UNUSED(op), const float UNUSED(mouse[2]))
+static int paint_stroke_test_start(bContext *C, wmOperator *op, const float mouse[2])
 {
-	return true;
-}
-
-
-static int paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
-{
 	PaintOperation *pop;
-	float mouse[2];
-	int retval;
 
 	/* TODO Should avoid putting this here. Instead, last position should be requested
 	 * from stroke system. */
-	mouse[0] = event->mval[0];
-	mouse[1] = event->mval[1];
 
 	if (!(pop = texture_paint_init(C, op, mouse))) {
-		return OPERATOR_CANCELLED;
+		return false;
 	}
 
-	op->customdata = paint_stroke_new(C, NULL, paint_stroke_test_start,
+	paint_stroke_set_mode_data(op->customdata, pop);
+
+	return true;
+}
+
+
+static int paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+	int retval;
+
+	op->customdata = paint_stroke_new(C, op, NULL, paint_stroke_test_start,
 	                                  paint_stroke_update_step,
 	                                  paint_stroke_redraw,
 	                                  paint_stroke_done, event->type);
-	paint_stroke_set_mode_data(op->customdata, pop);
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
 
@@ -910,12 +909,10 @@
 		return OPERATOR_CANCELLED;
 	}
 
-	op->customdata = paint_stroke_new(C, NULL, paint_stroke_test_start,
+	op->customdata = paint_stroke_new(C, op, NULL, paint_stroke_test_start,
 	                                  paint_stroke_update_step,
 	                                  paint_stroke_redraw,
 	                                  paint_stroke_done, 0);
-	paint_stroke_set_mode_data(op->customdata, pop);
-
 	/* frees op->customdata */
 	paint_stroke_exec(C, op);
 

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_intern.h	2013-11-09 20:37:41 UTC (rev 61216)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_intern.h	2013-11-09 21:19:11 UTC (rev 61217)
@@ -64,7 +64,7 @@
 typedef void (*StrokeRedraw)(const struct bContext *C, struct PaintStroke *stroke, bool final);
 typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
 
-struct PaintStroke *paint_stroke_new(struct bContext *C,
+struct PaintStroke *paint_stroke_new(struct bContext *C, struct wmOperator *op,
                                      StrokeGetLocation get_location, StrokeTestStart test_start,
                                      StrokeUpdateStep update_step, StrokeRedraw redraw,
                                      StrokeDone done, int event_type);

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-11-09 20:37:41 UTC (rev 61216)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_stroke.c	2013-11-09 21:19:11 UTC (rev 61217)
@@ -735,6 +735,7 @@
 /**** Public API ****/
 
 PaintStroke *paint_stroke_new(bContext *C,
+							  wmOperator *op,
                               StrokeGetLocation get_location,
                               StrokeTestStart test_start,
                               StrokeUpdateStep update_step,
@@ -761,6 +762,10 @@
 	get_imapaint_zoom(C, &zoomx, &zoomy);
 	stroke->zoom_2d = max_ff(zoomx, zoomy);
 
+	if ((br->flag & (BRUSH_POLYLINE | BRUSH_CURVE))
+		&& RNA_struct_property_is_set(op->ptr, "mode")) {
+		RNA_enum_set(op->ptr, "mode", BRUSH_STROKE_NORMAL);
+	}
 	/* initialize here */
 	ups->overlap_factor = 1.0;
 	ups->stroke_active = 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-11-09 20:37:41 UTC (rev 61216)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_vertex.c	2013-11-09 21:19:11 UTC (rev 61217)
@@ -2558,7 +2558,7 @@
 {
 	int retval;
 
-	op->customdata = paint_stroke_new(C, NULL, wpaint_stroke_test_start,
+	op->customdata = paint_stroke_new(C, op, NULL, wpaint_stroke_test_start,
 	                                  wpaint_stroke_update_step, NULL,
 	                                  wpaint_stroke_done, event->type);
 	
@@ -2574,7 +2574,7 @@
 
 static int wpaint_exec(bContext *C, wmOperator *op)
 {
-	op->customdata = paint_stroke_new(C, NULL, wpaint_stroke_test_start,
+	op->customdata = paint_stroke_new(C, op, NULL, wpaint_stroke_test_start,
 	                                  wpaint_stroke_update_step, NULL,
 	                                  wpaint_stroke_done, 0);
 
@@ -3097,7 +3097,7 @@
 {
 	int retval;
 
-	op->customdata = paint_stroke_new(C, NULL, vpaint_stroke_test_start,
+	op->customdata = paint_stroke_new(C, op, NULL, vpaint_stroke_test_start,
 	                                  vpaint_stroke_update_step, NULL,
 	                                  vpaint_stroke_done, event->type);
 	
@@ -3113,7 +3113,7 @@
 
 static int vpaint_exec(bContext *C, wmOperator *op)
 {
-	op->customdata = paint_stroke_new(C, NULL, vpaint_stroke_test_start,
+	op->customdata = paint_stroke_new(C, op, NULL, vpaint_stroke_test_start,
 	                                  vpaint_stroke_update_step, NULL,
 	                                  vpaint_stroke_done, 0);
 

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c	2013-11-09 20:37:41 UTC (rev 61216)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c	2013-11-09 21:19:11 UTC (rev 61217)
@@ -4540,7 +4540,7 @@
 	if (!sculpt_brush_stroke_init(C, op))
 		return OPERATOR_CANCELLED;
 
-	stroke = paint_stroke_new(C, sculpt_stroke_get_location,
+	stroke = paint_stroke_new(C, op, sculpt_stroke_get_location,
 	                          sculpt_stroke_test_start,
 	                          sculpt_stroke_update_step, NULL,
 	                          sculpt_stroke_done, event->type);
@@ -4570,7 +4570,7 @@
 	if (!sculpt_brush_stroke_init(C, op))
 		return OPERATOR_CANCELLED;
 
-	op->customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start,
+	op->customdata = paint_stroke_new(C, op, sculpt_stroke_get_location, sculpt_stroke_test_start,
 	                                  sculpt_stroke_update_step, NULL, sculpt_stroke_done, 0);
 
 	/* frees op->customdata */




More information about the Bf-blender-cvs mailing list