code cleanup: pass mval to ED_view3d_cursor3d_position() rather then event x/y
This commit is contained in:
@@ -85,7 +85,7 @@ typedef struct ViewDepths {
|
||||
} ViewDepths;
|
||||
|
||||
float *give_cursor(struct Scene *scene, struct View3D *v3d);
|
||||
void ED_view3d_cursor3d_position(struct bContext *C, float *fp, int mx, int my);
|
||||
void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]);
|
||||
|
||||
void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist);
|
||||
void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist);
|
||||
|
||||
@@ -815,7 +815,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
|
||||
if (0 == RNA_struct_property_is_set(op->ptr, "location")) {
|
||||
wmEvent *event = CTX_wm_window(C)->eventstate;
|
||||
ED_object_location_from_view(C, loc);
|
||||
ED_view3d_cursor3d_position(C, loc, event->x, event->y);
|
||||
ED_view3d_cursor3d_position(C, loc, event->mval);
|
||||
RNA_float_set_array(op->ptr, "location", loc);
|
||||
}
|
||||
}
|
||||
@@ -2040,7 +2040,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (event) {
|
||||
ED_object_location_from_view(C, basen->object->loc);
|
||||
ED_view3d_cursor3d_position(C, basen->object->loc, event->x, event->y);
|
||||
ED_view3d_cursor3d_position(C, basen->object->loc, event->mval);
|
||||
}
|
||||
|
||||
ED_base_object_activate(C, basen);
|
||||
|
||||
@@ -3858,18 +3858,14 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
|
||||
|
||||
/* cursor position in vec, result in vec, mval in region coords */
|
||||
/* note: cannot use event->mval here (called by object_add() */
|
||||
void ED_view3d_cursor3d_position(bContext *C, float *fp, int mx, int my)
|
||||
void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
float mval_fl[2];
|
||||
int mval[2];
|
||||
int flip;
|
||||
|
||||
mval[0] = mx - ar->winrct.xmin;
|
||||
mval[1] = my - ar->winrct.ymin;
|
||||
|
||||
flip = initgrabz(rv3d, fp[0], fp[1], fp[2]);
|
||||
|
||||
@@ -3917,7 +3913,7 @@ static int view3d_cursor3d_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
float *fp = give_cursor(scene, v3d);
|
||||
|
||||
ED_view3d_cursor3d_position(C, fp, event->x, event->y);
|
||||
ED_view3d_cursor3d_position(C, fp, event->mval);
|
||||
|
||||
if (v3d && v3d->localvd)
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
|
||||
|
||||
Reference in New Issue
Block a user