edit gp_stroke_convertcoords not to modify the mval passed to it & make some mval args const elsewhere too.
This commit is contained in:
@@ -239,7 +239,7 @@ static short gp_stroke_filtermval (tGPsdata *p, const int mval[2], int pmval[2])
|
||||
|
||||
/* 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 @@ static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], flo
|
||||
*/
|
||||
}
|
||||
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 @@ static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], flo
|
||||
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 @@ static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], flo
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -3975,7 +3975,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f
|
||||
}
|
||||
|
||||
|
||||
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_sub_stroke(ProjPaintState *ps, BrushPainter *painter, i
|
||||
}
|
||||
|
||||
|
||||
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 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter,
|
||||
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];
|
||||
|
||||
@@ -106,8 +106,8 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot);
|
||||
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);
|
||||
|
||||
@@ -148,7 +148,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
|
||||
}
|
||||
|
||||
/* 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 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy,
|
||||
}
|
||||
|
||||
///* 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;
|
||||
|
||||
@@ -731,7 +731,7 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x
|
||||
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 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent
|
||||
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);
|
||||
|
||||
@@ -2482,7 +2482,7 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops,
|
||||
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 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
|
||||
|
||||
/* *********** */
|
||||
|
||||
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 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
|
||||
|
||||
/* ********************************************** */
|
||||
|
||||
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 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
|
||||
/* ******************** */
|
||||
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user