[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36800] trunk/blender/source/blender/ editors: edit gp_stroke_convertcoords not to modify the mval passed to it & make some mval args const elsewhere too .

Campbell Barton ideasman42 at gmail.com
Fri May 20 16:11:05 CEST 2011


Revision: 36800
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36800
Author:   campbellbarton
Date:     2011-05-20 14:11:05 +0000 (Fri, 20 May 2011)
Log Message:
-----------
edit gp_stroke_convertcoords not to modify the mval passed to it & make some mval args const elsewhere too.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    trunk/blender/source/blender/editors/space_outliner/outliner.c

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-05-20 13:50:41 UTC (rev 36799)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-05-20 14:11:05 UTC (rev 36800)
@@ -239,7 +239,7 @@
 
 /* convert screen-coordinates to buffer-coordinates */
 // XXX this method needs a total overhaul!
-static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], float *depth)
+static void gp_stroke_convertcoords (tGPsdata *p, const int mval[2], float out[3], float *depth)
 {
 	bGPdata *gpd= p->gpd;
 	
@@ -251,10 +251,10 @@
 			 */
 		}
 		else {
-			const int mx=mval[0], my=mval[1];
+			int mval_prj[2];
 			float rvec[3], dvec[3];
 			float mval_f[2];
-			
+
 			/* Current method just converts each point in screen-coordinates to
 			 * 3D-coordinates using the 3D-cursor as reference. In general, this
 			 * works OK, but it could of course be improved.
@@ -267,10 +267,9 @@
 			gp_get_3d_reference(p, rvec);
 			
 			/* method taken from editview.c - mouse_cursor() */
-			project_int_noclip(p->ar, rvec, mval);
+			project_int_noclip(p->ar, rvec, mval_prj);
 
-			mval_f[0]= mval[0] - mx;
-			mval_f[0]= mval[1] - my;
+			VECSUB2D(mval_f, mval_prj, mval);
 			ED_view3d_win_to_delta(p->ar, mval_f, dvec);
 			sub_v3_v3v3(out, rvec, dvec);
 		}
@@ -278,12 +277,7 @@
 	
 	/* 2d - on 'canvas' (assume that p->v2d is set) */
 	else if ((gpd->sbuffer_sflag & GP_STROKE_2DSPACE) && (p->v2d)) {
-		float x, y;
-		
-		UI_view2d_region_to_view(p->v2d, mval[0], mval[1], &x, &y);
-		
-		out[0]= x;
-		out[1]= y;
+		UI_view2d_region_to_view(p->v2d, mval[0], mval[1], &out[0], &out[1]);
 	}
 	
 #if 0

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2011-05-20 13:50:41 UTC (rev 36799)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2011-05-20 14:11:05 UTC (rev 36800)
@@ -3975,7 +3975,7 @@
 }
 
 
-static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure)
+static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, const int UNUSED(prevmval_i[2]), const int mval_i[2], double time, float pressure)
 {
 	
 	/* Use mouse coords as floats for projection painting */
@@ -3994,7 +3994,7 @@
 }
 
 
-static int project_paint_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure)
+static int project_paint_stroke(ProjPaintState *ps, BrushPainter *painter, const int prevmval_i[2], const int mval_i[2], double time, float pressure)
 {
 	int a, redraw;
 	
@@ -4417,7 +4417,7 @@
 	else return 0;
 }
 
-static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPainter *painter, short texpaint, int *prevmval, int *mval, double time, float pressure)
+static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPainter *painter, short texpaint, const int prevmval[2], const int mval[2], double time, float pressure)
 {
 	Image *newimage = NULL;
 	float fwuv[2], bkuv[2], newuv[2];

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2011-05-20 13:50:41 UTC (rev 36799)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2011-05-20 14:11:05 UTC (rev 36800)
@@ -106,8 +106,8 @@
 void projectf(struct bglMats *mats, const float v[3], float p[2]);
 float paint_calc_object_space_radius(struct ViewContext *vc, float center[3], float pixel_radius);
 float paint_get_tex_pixel(struct Brush* br, float u, float v);
-int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
-void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv);
+int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, const int mval[2], unsigned int *index);
+void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
 
 void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
 void BRUSH_OT_curve_preset(struct wmOperatorType *ot);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2011-05-20 13:50:41 UTC (rev 36799)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2011-05-20 14:11:05 UTC (rev 36800)
@@ -148,7 +148,7 @@
 }
 
 /* compute uv coordinates of mouse in face */
-void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv)
+void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const int xy[2], float uv[2])
 {
 	DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
 	const int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
@@ -214,7 +214,7 @@
 }
 
 ///* returns 0 if not found, otherwise 1 */
-int imapaint_pick_face(ViewContext *vc, Mesh *me, int *mval, unsigned int *index)
+int imapaint_pick_face(ViewContext *vc, Mesh *me, const int mval[2], unsigned int *index)
 {
 	if(!me || me->totface==0)
 		return 0;

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-05-20 13:50:41 UTC (rev 36799)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2011-05-20 14:11:05 UTC (rev 36800)
@@ -731,7 +731,7 @@
 	return tot;
 }
 
-static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], float *vert_nor, float *mval, float pressure)
+static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], float *vert_nor, const float mval[2], float pressure)
 {
 	Brush *brush = paint_brush(&vp->paint);
 	float fac, fac_2, size, dx, dy;
@@ -1724,7 +1724,7 @@
 	return 1;
 }
 
-static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int UNUSED(flip))
+static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, const float mval[2], float pressure, int UNUSED(flip))
 {
 	ViewContext *vc = &vpd->vc;
 	Brush *brush = paint_brush(&vp->paint);

Modified: trunk/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner.c	2011-05-20 13:50:41 UTC (rev 36799)
+++ trunk/blender/source/blender/editors/space_outliner/outliner.c	2011-05-20 14:11:05 UTC (rev 36800)
@@ -2482,7 +2482,7 @@
 	return 0;
 }
 
-static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, float *mval)
+static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
 {
 	
 	if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -2628,7 +2628,7 @@
 
 /* *********** */
 
-static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, float *mval)
+static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2])
 {
 	
 	if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -2693,7 +2693,7 @@
 
 /* ********************************************** */
 
-static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, float *mval)
+static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2])
 {
 	
 	if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -3728,7 +3728,7 @@
 /* ******************** */
 
 
-static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, wmEvent *event, float *mval)
+static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, wmEvent *event, const float mval[2])
 {
 	
 	if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {




More information about the Bf-blender-cvs mailing list