Cleanup: Rename view3d context set function
Use common prefix so adding related functions share the prefix.
This commit is contained in:
parent
28f86bf117
commit
ecab7bef69
|
@ -171,7 +171,7 @@ void *get_nearest_bone(bContext *C, const int xy[2], bool findunsel)
|
|||
unsigned int buffer[MAXPICKBUF];
|
||||
short hits;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
// rect.xmin = ... mouseco!
|
||||
rect.xmin = rect.xmax = xy[0];
|
||||
|
@ -486,7 +486,7 @@ bool ED_armature_select_pick(bContext *C, const int mval[2], bool extend, bool d
|
|||
EditBone *nearBone = NULL;
|
||||
int selmask;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (BIF_sk_selectStroke(C, mval, extend)) {
|
||||
return true;
|
||||
|
|
|
@ -1905,7 +1905,7 @@ static bool sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], c
|
|||
unsigned int buffer[MAXPICKBUF];
|
||||
short hits;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
BLI_rcti_init_pt_radius(&rect, mval, 5);
|
||||
|
||||
|
|
|
@ -4308,7 +4308,7 @@ bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], bool extend,
|
|||
short hand;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
location[0] = mval[0];
|
||||
location[1] = mval[1];
|
||||
|
@ -4984,7 +4984,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
{
|
||||
ViewContext vc;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (vc.rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
|
||||
Curve *cu;
|
||||
|
|
|
@ -581,7 +581,7 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
|
|||
struct CurveDrawData *cdd = MEM_callocN(sizeof(*cdd), __func__);
|
||||
|
||||
if (is_invoke) {
|
||||
view3d_set_viewcontext(C, &cdd->vc);
|
||||
ED_view3d_viewcontext_init(C, &cdd->vc);
|
||||
if (ELEM(NULL, cdd->vc.ar, cdd->vc.rv3d, cdd->vc.v3d, cdd->vc.win, cdd->vc.scene)) {
|
||||
MEM_freeN(cdd);
|
||||
BKE_report(op->reports, RPT_ERROR, "Unable to access 3D viewport");
|
||||
|
|
|
@ -559,7 +559,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (!ED_curve_pick_vert(&vc, 1, event->mval, &nu, &bezt, &bp, NULL)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -1677,7 +1677,7 @@ static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
|
|||
}
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (!ED_curve_pick_vert(&vc, 1, event->mval, &nu_dst, &bezt_dst, &bp_dst, NULL)) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
|
|
|
@ -1850,7 +1850,7 @@ bool ED_curve_editfont_select_pick(bContext *C, const int mval[2], bool extend,
|
|||
const float dist = ED_view3d_select_dist_px();
|
||||
float dist_sq_best = dist * dist;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ int view3d_opengl_select(
|
|||
|
||||
/* view3d_select.c */
|
||||
float ED_view3d_select_dist_px(void);
|
||||
void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc);
|
||||
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc);
|
||||
void view3d_operator_needs_opengl(const struct bContext *C);
|
||||
void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
|
||||
void view3d_opengl_read_pixels(struct ARegion *ar, int x, int y, int w, int h, int format, int type, void *data);
|
||||
|
|
|
@ -3381,7 +3381,7 @@ void MESH_OT_select_nth(wmOperatorType *ot)
|
|||
|
||||
void em_setup_viewcontext(bContext *C, ViewContext *vc)
|
||||
{
|
||||
view3d_set_viewcontext(C, vc);
|
||||
ED_view3d_viewcontext_init(C, vc);
|
||||
|
||||
if (vc->obedit) {
|
||||
vc->em = BKE_editmesh_from_object(vc->obedit);
|
||||
|
|
|
@ -1088,7 +1088,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
|
|||
if (!me || me->totpoly == 0)
|
||||
return false;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (size) {
|
||||
/* sample rect to increase chances of selecting, so that when clicking
|
||||
|
@ -1253,7 +1253,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
|
|||
if (!me || me->totvert == 0)
|
||||
return false;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (use_zbuf) {
|
||||
if (size > 0) {
|
||||
|
|
|
@ -595,7 +595,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
|
|||
unsigned int buffer[MAXPICKBUF];
|
||||
rcti rect;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
BLI_rcti_init_pt_radius(&rect, mval, 12);
|
||||
|
||||
|
|
|
@ -882,7 +882,7 @@ bool ED_lattice_select_pick(bContext *C, const int mval[2], bool extend, bool de
|
|||
BPoint *bp = NULL;
|
||||
Lattice *lt;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
lt = ((Lattice *)vc.obedit->data)->editlatt->latt;
|
||||
bp = findnearestLattvert(&vc, mval, true);
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
|
|||
{
|
||||
PE_set_data(C, data);
|
||||
|
||||
view3d_set_viewcontext(C, &data->vc);
|
||||
ED_view3d_viewcontext_init(C, &data->vc);
|
||||
/* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather than (obmat * viewmat) */
|
||||
view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats);
|
||||
|
||||
|
|
|
@ -1011,7 +1011,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
|
|||
|
||||
/* can't use stroke vc here because this will be called during
|
||||
* mouse over too, not just during a stroke */
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
if (vc.rv3d && (vc.rv3d->rflag & RV3D_NAVIGATING)) {
|
||||
return;
|
||||
|
|
|
@ -326,7 +326,7 @@ static void clip_planes_from_rect(bContext *C,
|
|||
bglMats mats = {{0}};
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats);
|
||||
ED_view3d_clipping_calc(&bb, clip_planes, &mats, rect);
|
||||
negate_m4(clip_planes);
|
||||
|
|
|
@ -741,7 +741,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo
|
|||
PaintOperation *pop = MEM_callocN(sizeof(PaintOperation), "PaintOperation"); /* caller frees */
|
||||
Brush *brush = BKE_paint_brush(&settings->imapaint.paint);
|
||||
int mode = RNA_enum_get(op->ptr, "mode");
|
||||
view3d_set_viewcontext(C, &pop->vc);
|
||||
ED_view3d_viewcontext_init(C, &pop->vc);
|
||||
|
||||
copy_v2_v2(pop->prevmouse, mouse);
|
||||
copy_v2_v2(pop->startmouse, mouse);
|
||||
|
|
|
@ -443,7 +443,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
|
|||
/* Calculations of individual vertices are done in 2D screen space to diminish the amount of
|
||||
* calculations done. Bounding box PBVH collision is not computed against enclosing rectangle
|
||||
* of lasso */
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats);
|
||||
|
||||
/* lasso data calculations */
|
||||
|
|
|
@ -689,7 +689,7 @@ PaintStroke *paint_stroke_new(bContext *C,
|
|||
Brush *br = stroke->brush = BKE_paint_brush(p);
|
||||
float zoomx, zoomy;
|
||||
|
||||
view3d_set_viewcontext(C, &stroke->vc);
|
||||
ED_view3d_viewcontext_init(C, &stroke->vc);
|
||||
|
||||
stroke->get_location = get_location;
|
||||
stroke->test_start = test_start;
|
||||
|
|
|
@ -465,7 +465,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
|
|||
unsigned int totpoly = me->totpoly;
|
||||
|
||||
if (dm->getLoopDataArray(dm, CD_MLOOPUV)) {
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
|
|
|
@ -1448,7 +1448,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
|
|||
/* make mode data storage */
|
||||
wpd = MEM_callocN(sizeof(struct WPaintData), "WPaintData");
|
||||
paint_stroke_set_mode_data(stroke, wpd);
|
||||
view3d_set_viewcontext(C, &wpd->vc);
|
||||
ED_view3d_viewcontext_init(C, &wpd->vc);
|
||||
view_angle_limits_init(&wpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
|
||||
(vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
|
||||
|
||||
|
@ -2437,7 +2437,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
|
|||
/* make mode data storage */
|
||||
vpd = MEM_callocN(sizeof(*vpd), "VPaintData");
|
||||
paint_stroke_set_mode_data(stroke, vpd);
|
||||
view3d_set_viewcontext(C, &vpd->vc);
|
||||
ED_view3d_viewcontext_init(C, &vpd->vc);
|
||||
view_angle_limits_init(&vpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
|
||||
(vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
|||
Mesh *me;
|
||||
bool changed = false;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
me = BKE_mesh_from_object(vc.obact);
|
||||
|
||||
if (me && me->dvert && vc.v3d && vc.rv3d && (vc.obact->actdef != 0)) {
|
||||
|
@ -292,7 +292,7 @@ static const EnumPropertyItem *weight_paint_sample_enum_itemf(
|
|||
ViewContext vc;
|
||||
Mesh *me;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
me = BKE_mesh_from_object(vc.obact);
|
||||
|
||||
if (me && me->dvert && vc.v3d && vc.rv3d && vc.obact->defbase.first) {
|
||||
|
@ -361,7 +361,7 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
int type = RNA_enum_get(op->ptr, "group");
|
||||
ViewContext vc;
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
BLI_assert(type + 1 >= 0);
|
||||
vc.obact->actdef = type + 1;
|
||||
|
|
|
@ -4721,7 +4721,7 @@ bool sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2])
|
|||
bool original;
|
||||
ViewContext vc;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
ob = vc.obact;
|
||||
|
||||
|
@ -5904,7 +5904,7 @@ static void sample_detail(bContext *C, int ss_co[2])
|
|||
float ray_start[3], ray_end[3], ray_normal[3], depth;
|
||||
SculptDetailRaycastData srd;
|
||||
float mouse[2] = {ss_co[0], ss_co[1]};
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
sd = CTX_data_tool_settings(C)->sculpt;
|
||||
ob = vc.obact;
|
||||
|
|
|
@ -4468,7 +4468,7 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
|
|||
/* note; otherwise opengl won't work */
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
view3d_get_transformation(vc.ar, vc.rv3d, NULL, &mats); /* NULL because we don't want it in object space */
|
||||
ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, &mats, &rect);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ float ED_view3d_select_dist_px(void)
|
|||
}
|
||||
|
||||
/* TODO: should return whether there is valid context to continue */
|
||||
void view3d_set_viewcontext(bContext *C, ViewContext *vc)
|
||||
void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc)
|
||||
{
|
||||
memset(vc, 0, sizeof(ViewContext));
|
||||
vc->ar = CTX_wm_region(C);
|
||||
|
@ -884,7 +884,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
|
|||
view3d_operator_needs_opengl(C);
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
extend = RNA_boolean_get(op->ptr, "extend");
|
||||
select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
|
@ -1329,7 +1329,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
|
|||
|
||||
/* setup view context for argument to callbacks */
|
||||
view3d_operator_needs_opengl(C);
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
hits = mixed_bones_object_selectbuffer(&vc, buffer, mval, false, false, &do_nearest);
|
||||
|
||||
|
@ -1378,7 +1378,7 @@ static bool ed_object_select_pick(
|
|||
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
is_obedit = (vc.obedit != NULL);
|
||||
if (object) {
|
||||
|
@ -2081,7 +2081,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
|
|||
view3d_operator_needs_opengl(C);
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
|
||||
select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
@ -2779,7 +2779,7 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
|
|||
static int view3d_circle_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ViewContext vc;
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
ED_view3d_viewcontext_init(C, &vc);
|
||||
Object *obact = vc.obact;
|
||||
Object *obedit = vc.obedit;
|
||||
const int radius = RNA_int_get(op->ptr, "radius");
|
||||
|
|
Loading…
Reference in New Issue