From ecab7bef6989752ff1a8c5fd1eab7b5ab159ed46 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Mar 2018 17:30:24 +1100 Subject: Cleanup: Rename view3d context set function Use common prefix so adding related functions share the prefix. --- source/blender/editors/armature/armature_select.c | 4 ++-- source/blender/editors/armature/editarmature_sketch.c | 2 +- source/blender/editors/curve/editcurve.c | 4 ++-- source/blender/editors/curve/editcurve_paint.c | 2 +- source/blender/editors/curve/editcurve_select.c | 4 ++-- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/include/ED_view3d.h | 2 +- source/blender/editors/mesh/editmesh_select.c | 2 +- source/blender/editors/mesh/meshtools.c | 4 ++-- source/blender/editors/metaball/mball_edit.c | 2 +- source/blender/editors/object/object_lattice.c | 2 +- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/sculpt_paint/paint_cursor.c | 2 +- source/blender/editors/sculpt_paint/paint_hide.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_mask.c | 2 +- source/blender/editors/sculpt_paint/paint_stroke.c | 2 +- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 4 ++-- .../blender/editors/sculpt_paint/paint_vertex_weight_ops.c | 6 +++--- source/blender/editors/sculpt_paint/sculpt.c | 4 ++-- source/blender/editors/space_view3d/view3d_edit.c | 2 +- source/blender/editors/space_view3d/view3d_select.c | 12 ++++++------ 23 files changed, 36 insertions(+), 36 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index fc295647ed5..2e2c184e43d 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -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; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 86d5f75888d..79b538b4f4a 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -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); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 6e059342a6b..86a7c58972e 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -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; diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 5bba21f6252..0d7cb089c4f 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -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"); diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index 4a4b13d0d1b..673faa37f2a 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -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; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 4c5642493fa..d651f673a7f 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -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); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 86de619323c..2767e041627 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -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); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 1e2c93389ed..f0ad491e148 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -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); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index fa1c935e2ff..b66821c4e37 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -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) { diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 5b4078b98b7..e948de02f40 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -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); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 57053ddc020..008ad62b39e 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -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); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 1cbc6aa39fa..3c7cb90eba4 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index e8778eea3b9..e6219b4fae1 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -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; diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index a49fe9c929a..e2b318710a8 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 3ecece580ee..34eaab68379 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 8e091bdf59c..76b629395e2 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -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 */ diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 2ce047e33ec..e6a9fd9adf8 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -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; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 7473808012d..70fd57830c0 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 824f870f3c5..4b2eb0fdd30 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.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); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 2afbecbc6fb..21435ef153a 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -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; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7de3792a222..ede1269e220 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -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; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 35e8046313a..199800df539 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -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); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index e6b93f634dd..1cdbd4da1c4 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -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"); -- cgit v1.2.3