Refactor: Return ViewContext by value
This makes `ED_view3d_viewcontext_init` return the `ViewContext` by value instead of writing to a pointer. No functional changes expected. Pull Request: https://projects.blender.org/blender/blender/pulls/113761
This commit is contained in:
@@ -316,12 +316,11 @@ static void *ed_armature_pick_bone_impl(
|
||||
const bool is_editmode, bContext *C, const int xy[2], bool findunsel, Base **r_base)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
rcti rect;
|
||||
GPUSelectResult buffer[MAXPICKELEMS];
|
||||
short hits;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
BLI_assert((vc.obedit != nullptr) == is_editmode);
|
||||
|
||||
BLI_rcti_init_pt_radius(&rect, xy, 0);
|
||||
@@ -950,8 +949,7 @@ bool ED_armature_edit_deselect_all_visible_multi_ex(Base **bases, uint bases_len
|
||||
bool ED_armature_edit_deselect_all_visible_multi(bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d, &bases_len);
|
||||
@@ -1143,12 +1141,11 @@ bool ED_armature_edit_select_pick(bContext *C, const int mval[2], const SelectPi
|
||||
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
EditBone *nearBone = nullptr;
|
||||
int selmask;
|
||||
Base *basact = nullptr;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
vc.mval[0] = mval[0];
|
||||
vc.mval[1] = mval[1];
|
||||
|
||||
|
||||
@@ -411,8 +411,7 @@ bool ED_pose_deselect_all_multi_ex(Base **bases,
|
||||
bool ED_pose_deselect_all_multi(bContext *C, int select_mode, const bool ignore_visibility)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
|
||||
Base **bases = BKE_object_pose_base_array_get_unique(
|
||||
|
||||
@@ -4792,7 +4792,6 @@ bool ED_curve_editnurb_select_pick(bContext *C,
|
||||
const SelectPick_Params *params)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
Nurb *nu;
|
||||
BezTriple *bezt = nullptr;
|
||||
BPoint *bp = nullptr;
|
||||
@@ -4801,7 +4800,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
|
||||
bool changed = false;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
copy_v2_v2_int(vc.mval, mval);
|
||||
|
||||
const bool use_handle_select = (vc.v3d->overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
@@ -5616,9 +5615,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
if (vc.rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
|
||||
Curve *cu;
|
||||
|
||||
@@ -574,7 +574,7 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
||||
if (is_invoke) {
|
||||
ED_view3d_viewcontext_init(C, &cdd->vc, depsgraph);
|
||||
cdd->vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
if (ELEM(nullptr, cdd->vc.region, 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");
|
||||
|
||||
@@ -1559,10 +1559,9 @@ wmKeyMap *curve_pen_modal_keymap(wmKeyConfig *keyconf)
|
||||
static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
Curve *cu = static_cast<Curve *>(vc.obedit->data);
|
||||
ListBase *nurbs = &cu->editnurb->nurbs;
|
||||
const float threshold_dist_px = ED_view3d_select_dist_px() * SEL_DIST_FACTOR;
|
||||
@@ -1749,8 +1748,8 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
static int curve_pen_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, CTX_data_ensure_evaluated_depsgraph(C));
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
Curve *cu = static_cast<Curve *>(vc.obedit->data);
|
||||
ListBase *nurbs = &cu->editnurb->nurbs;
|
||||
|
||||
|
||||
@@ -256,8 +256,7 @@ bool ED_curve_deselect_all_multi_ex(Base **bases, int bases_len)
|
||||
bool ED_curve_deselect_all_multi(bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d, &bases_len);
|
||||
@@ -702,7 +701,6 @@ void CURVE_OT_select_linked(wmOperatorType *ot)
|
||||
static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
@@ -711,7 +709,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||
Base *basact = nullptr;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
copy_v2_v2_int(vc.mval, event->mval);
|
||||
|
||||
if (!ED_curve_pick_vert(&vc, 1, &nu, &bezt, &bp, nullptr, &basact)) {
|
||||
@@ -2028,7 +2026,6 @@ static void curve_select_shortest_path_surf(Nurb *nu, int vert_src, int vert_dst
|
||||
static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
Nurb *nu_dst;
|
||||
BezTriple *bezt_dst;
|
||||
BPoint *bp_dst;
|
||||
@@ -2037,7 +2034,7 @@ static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
|
||||
Base *basact = nullptr;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
copy_v2_v2_int(vc.mval, event->mval);
|
||||
|
||||
if (!ED_curve_pick_vert(&vc, 1, &nu_dst, &bezt_dst, &bp_dst, nullptr, &basact)) {
|
||||
|
||||
@@ -2386,7 +2386,6 @@ bool ED_curve_editfont_select_pick(
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Curve *cu = static_cast<Curve *>(obedit->data);
|
||||
ViewContext vc;
|
||||
/* bias against the active, in pixels, allows cycling */
|
||||
const float active_bias_px = 4.0f;
|
||||
const float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
@@ -2395,7 +2394,7 @@ bool ED_curve_editfont_select_pick(
|
||||
const float dist = ED_view3d_select_dist_px();
|
||||
float dist_sq_best = dist * dist;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ void EDBM_select_toggle_all(BMEditMesh *em);
|
||||
|
||||
void EDBM_select_swap(BMEditMesh *em); /* exported for UV */
|
||||
bool EDBM_select_interior_faces(BMEditMesh *em);
|
||||
void em_setup_viewcontext(bContext *C, ViewContext *vc); /* rename? */
|
||||
ViewContext em_setup_viewcontext(bContext *C); /* rename? */
|
||||
|
||||
bool EDBM_mesh_deselect_all_multi_ex(Base **bases, uint bases_len);
|
||||
bool EDBM_mesh_deselect_all_multi(bContext *C);
|
||||
|
||||
@@ -944,7 +944,7 @@ int view3d_opengl_select_with_id_filter(ViewContext *vc,
|
||||
/* view3d_select.cc */
|
||||
|
||||
float ED_view3d_select_dist_px();
|
||||
void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc, Depsgraph *depsgraph);
|
||||
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph);
|
||||
|
||||
/**
|
||||
* Re-initialize `vc` with `obact` as if it's active object (with some differences).
|
||||
|
||||
@@ -75,8 +75,7 @@ bool ED_lattice_deselect_all_multi_ex(Base **bases, const uint bases_len)
|
||||
bool ED_lattice_deselect_all_multi(bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d, &bases_len);
|
||||
@@ -620,12 +619,11 @@ static BPoint *findnearestLattvert(ViewContext *vc, bool select, Base **r_base)
|
||||
bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
BPoint *bp = nullptr;
|
||||
Base *basact = nullptr;
|
||||
bool changed = false;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
vc.mval[0] = mval[0];
|
||||
vc.mval[1] = mval[1];
|
||||
|
||||
|
||||
@@ -456,8 +456,7 @@ void paintface_select_loop(bContext *C, Object *ob, const int mval[2], const boo
|
||||
using namespace blender;
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
ED_view3d_select_id_validate(&vc);
|
||||
|
||||
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
|
||||
@@ -703,13 +703,12 @@ void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
|
||||
static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
BMVert *v1;
|
||||
BMIter iter;
|
||||
float center[3];
|
||||
uint verts_len;
|
||||
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
const Object *object_active = vc.obact;
|
||||
|
||||
const bool rot_src = RNA_boolean_get(op->ptr, "rotate_source");
|
||||
|
||||
@@ -4810,10 +4810,9 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
const float angle_snapping_increment = RAD2DEGF(
|
||||
RNA_float_get(op->ptr, "angle_snapping_increment"));
|
||||
|
||||
ViewContext vc;
|
||||
KnifeTool_OpData *kcd;
|
||||
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
|
||||
/* alloc new customdata */
|
||||
kcd = static_cast<KnifeTool_OpData *>(
|
||||
|
||||
@@ -123,8 +123,7 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
ViewContext vc;
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
|
||||
uint objects_len;
|
||||
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
|
||||
|
||||
@@ -282,7 +282,7 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
|
||||
lcd = static_cast<RingSelOpData *>(
|
||||
op->customdata = MEM_callocN(sizeof(RingSelOpData), "ringsel Modal Op Data"));
|
||||
|
||||
em_setup_viewcontext(C, &lcd->vc);
|
||||
lcd->vc = em_setup_viewcontext(C);
|
||||
|
||||
lcd->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
||||
@@ -554,7 +554,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
bool show_cuts = false;
|
||||
const bool has_numinput = hasNumInput(&lcd->num);
|
||||
|
||||
em_setup_viewcontext(C, &lcd->vc);
|
||||
lcd->vc = em_setup_viewcontext(C);
|
||||
lcd->region = lcd->vc.region;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
@@ -713,10 +713,9 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
|
||||
BMEdge *eed = nullptr;
|
||||
BMFace *efa = nullptr;
|
||||
|
||||
ViewContext vc;
|
||||
bool track_active = true;
|
||||
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
copy_v2_v2_int(vc.mval, event->mval);
|
||||
BKE_view_layer_synced_ensure(vc.scene, vc.view_layer);
|
||||
Base *basact = BKE_view_layer_active_base_get(vc.view_layer);
|
||||
|
||||
@@ -104,27 +104,25 @@ static bool edbm_preselect_or_active(bContext *C, const View3D *v3d, Base **r_ba
|
||||
return (*r_ele != nullptr);
|
||||
}
|
||||
|
||||
static bool edbm_preselect_or_active_init_viewcontext(bContext *C,
|
||||
ViewContext *vc,
|
||||
Base **r_base,
|
||||
BMElem **r_ele)
|
||||
static ViewContext edbm_preselect_or_active_init_viewcontext(bContext *C,
|
||||
Base **r_base,
|
||||
BMElem **r_ele)
|
||||
{
|
||||
em_setup_viewcontext(C, vc);
|
||||
bool ok = edbm_preselect_or_active(C, vc->v3d, r_base, r_ele);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
bool ok = edbm_preselect_or_active(C, vc.v3d, r_base, r_ele);
|
||||
if (ok) {
|
||||
ED_view3d_viewcontext_init_object(vc, (*r_base)->object);
|
||||
ED_view3d_viewcontext_init_object(&vc, (*r_base)->object);
|
||||
}
|
||||
return ok;
|
||||
return vc;
|
||||
}
|
||||
|
||||
static int edbm_polybuild_transform_at_cursor_invoke(bContext *C,
|
||||
wmOperator * /*op*/,
|
||||
const wmEvent * /*event*/)
|
||||
{
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
BMElem *ele_act = nullptr;
|
||||
edbm_preselect_or_active_init_viewcontext(C, &vc, &basact, &ele_act);
|
||||
ViewContext vc = edbm_preselect_or_active_init_viewcontext(C, &basact, &ele_act);
|
||||
BMEditMesh *em = vc.em;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -187,11 +185,9 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C,
|
||||
const wmEvent * /*event*/)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
BMElem *ele_act = nullptr;
|
||||
edbm_preselect_or_active_init_viewcontext(C, &vc, &basact, &ele_act);
|
||||
ViewContext vc = edbm_preselect_or_active_init_viewcontext(C, &basact, &ele_act);
|
||||
BMEditMesh *em = vc.em;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -282,10 +278,9 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
|
||||
float center[3];
|
||||
bool changed = false;
|
||||
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
BMElem *ele_act = nullptr;
|
||||
edbm_preselect_or_active_init_viewcontext(C, &vc, &basact, &ele_act);
|
||||
ViewContext vc = edbm_preselect_or_active_init_viewcontext(C, &basact, &ele_act);
|
||||
BMEditMesh *em = vc.em;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -460,10 +455,9 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
|
||||
float center[3];
|
||||
bool changed = false;
|
||||
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
BMElem *ele_act = nullptr;
|
||||
edbm_preselect_or_active_init_viewcontext(C, &vc, &basact, &ele_act);
|
||||
ViewContext vc = edbm_preselect_or_active_init_viewcontext(C, &basact, &ele_act);
|
||||
BMEditMesh *em = vc.em;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
@@ -544,10 +538,9 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C,
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
BMElem *ele_act = nullptr;
|
||||
edbm_preselect_or_active_init_viewcontext(C, &vc, &basact, &ele_act);
|
||||
ViewContext vc = edbm_preselect_or_active_init_viewcontext(C, &basact, &ele_act);
|
||||
BMEditMesh *em = vc.em;
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
|
||||
@@ -1691,14 +1691,13 @@ static bool mouse_mesh_loop(
|
||||
BMEdge *eed = nullptr;
|
||||
BMFace *efa = nullptr;
|
||||
|
||||
ViewContext vc;
|
||||
BMEditMesh *em;
|
||||
bool select = true;
|
||||
bool select_clear = false;
|
||||
bool select_cycle = true;
|
||||
float mvalf[2];
|
||||
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
mvalf[0] = float(vc.mval[0] = mval[0]);
|
||||
mvalf[1] = float(vc.mval[1] = mval[1]);
|
||||
|
||||
@@ -2051,15 +2050,13 @@ void MESH_OT_select_interior_faces(wmOperatorType *ot)
|
||||
|
||||
bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
{
|
||||
ViewContext vc;
|
||||
|
||||
int base_index_active = -1;
|
||||
BMVert *eve = nullptr;
|
||||
BMEdge *eed = nullptr;
|
||||
BMFace *efa = nullptr;
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
vc.mval[0] = mval[0];
|
||||
vc.mval[1] = mval[1];
|
||||
|
||||
@@ -2739,8 +2736,7 @@ bool EDBM_mesh_deselect_all_multi_ex(Base **bases, const uint bases_len)
|
||||
bool EDBM_mesh_deselect_all_multi(bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d, &bases_len);
|
||||
@@ -2774,8 +2770,7 @@ bool EDBM_selectmode_disable_multi(bContext *C,
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, nullptr, &bases_len);
|
||||
@@ -3617,7 +3612,6 @@ static void edbm_select_linked_pick_ex(BMEditMesh *em, BMElem *ele, bool sel, in
|
||||
|
||||
static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
BMVert *eve;
|
||||
BMEdge *eed;
|
||||
@@ -3633,7 +3627,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
|
||||
uint bases_len;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(
|
||||
@@ -4388,14 +4382,15 @@ void MESH_OT_select_nth(wmOperatorType *ot)
|
||||
WM_operator_properties_checker_interval(ot, false);
|
||||
}
|
||||
|
||||
void em_setup_viewcontext(bContext *C, ViewContext *vc)
|
||||
ViewContext em_setup_viewcontext(bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ED_view3d_viewcontext_init(C, vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
if (vc->obedit) {
|
||||
vc->em = BKE_editmesh_from_object(vc->obedit);
|
||||
if (vc.obedit) {
|
||||
vc.em = BKE_editmesh_from_object(vc.obedit);
|
||||
}
|
||||
return vc;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -1164,7 +1164,6 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
|
||||
|
||||
bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index)
|
||||
{
|
||||
ViewContext vc;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BLI_assert(me && GS(me->id.name) == ID_ME);
|
||||
@@ -1174,7 +1173,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px,
|
||||
}
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
ED_view3d_select_id_validate(&vc);
|
||||
|
||||
if (dist_px) {
|
||||
@@ -1336,7 +1335,6 @@ static void ed_mesh_pick_vert__mapFunc(void *user_data,
|
||||
bool ED_mesh_pick_vert(
|
||||
bContext *C, Object *ob, const int mval[2], uint dist_px, bool use_zbuf, uint *r_index)
|
||||
{
|
||||
ViewContext vc;
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BLI_assert(me && GS(me->id.name) == ID_ME);
|
||||
@@ -1346,7 +1344,7 @@ bool ED_mesh_pick_vert(
|
||||
}
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
ED_view3d_select_id_validate(&vc);
|
||||
|
||||
if (use_zbuf) {
|
||||
|
||||
@@ -87,8 +87,7 @@ void ED_mball_editmball_load(Object * /*obedit*/) {}
|
||||
bool ED_mball_deselect_all_multi(bContext *C)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
uint bases_len = 0;
|
||||
Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d, &bases_len);
|
||||
@@ -771,13 +770,12 @@ static bool ed_mball_findnearest_metaelem(bContext *C,
|
||||
uint *r_selmask)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
int a, hits;
|
||||
GPUSelectResult buffer[MAXPICKELEMS];
|
||||
rcti rect;
|
||||
bool found = false;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
BLI_rcti_init_pt_radius(&rect, mval, 12);
|
||||
|
||||
|
||||
@@ -2084,8 +2084,7 @@ static void object_transform_axis_target_cancel(bContext *C, wmOperator *op)
|
||||
static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
if (vc.obact == nullptr || !object_is_target_compat(vc.obact)) {
|
||||
/* Falls back to texture space transform. */
|
||||
|
||||
@@ -512,7 +512,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
|
||||
{
|
||||
PE_set_data(C, data);
|
||||
|
||||
ED_view3d_viewcontext_init(C, &data->vc, data->depsgraph);
|
||||
data->vc = ED_view3d_viewcontext_init(C, data->depsgraph);
|
||||
|
||||
if (!XRAY_ENABLED(data->vc.v3d)) {
|
||||
ED_view3d_depth_override(data->depsgraph,
|
||||
|
||||
@@ -1307,7 +1307,7 @@ static bool paint_cursor_context_init(bContext *C,
|
||||
}
|
||||
pcontext->mode = BKE_paintmode_get_active_from_context(C);
|
||||
|
||||
ED_view3d_viewcontext_init(C, &pcontext->vc, pcontext->depsgraph);
|
||||
pcontext->vc = ED_view3d_viewcontext_init(C, pcontext->depsgraph);
|
||||
|
||||
if (pcontext->brush->flag & BRUSH_CURVE) {
|
||||
pcontext->cursor_type = PAINT_CURSOR_CURVE;
|
||||
|
||||
@@ -289,11 +289,10 @@ static void clip_planes_from_rect(bContext *C,
|
||||
float clip_planes[4][4],
|
||||
const rcti *rect)
|
||||
{
|
||||
ViewContext vc;
|
||||
BoundBox bb;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
ED_view3d_clipping_calc(&bb, clip_planes, vc.region, vc.obact, rect);
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo
|
||||
PaintOperation *pop = MEM_new<PaintOperation>("PaintOperation"); /* caller frees */
|
||||
Brush *brush = BKE_paint_brush(&settings->imapaint.paint);
|
||||
int mode = RNA_enum_get(op->ptr, "mode");
|
||||
ED_view3d_viewcontext_init(C, &pop->vc, depsgraph);
|
||||
pop->vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
copy_v2_v2(pop->prevmouse, mouse);
|
||||
copy_v2_v2(pop->startmouse, mouse);
|
||||
|
||||
@@ -291,7 +291,7 @@ static void sculpt_gesture_context_init_common(bContext *C,
|
||||
SculptGestureContext *sgcontext)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ED_view3d_viewcontext_init(C, &sgcontext->vc, depsgraph);
|
||||
sgcontext->vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
Object *ob = sgcontext->vc.obact;
|
||||
|
||||
/* Operator properties. */
|
||||
|
||||
@@ -916,7 +916,7 @@ PaintStroke *paint_stroke_new(bContext *C,
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
float zoomx, zoomy;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &stroke->vc, depsgraph);
|
||||
stroke->vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
stroke->get_location = get_location;
|
||||
stroke->test_start = test_start;
|
||||
|
||||
@@ -414,13 +414,12 @@ void paint_sample_color(
|
||||
const int *material_indices = (const int *)CustomData_get_layer_named(
|
||||
&me_eval->face_data, CD_PROP_INT32, "material_index");
|
||||
|
||||
ViewContext vc;
|
||||
const int mval[2] = {x, y};
|
||||
uint faceindex;
|
||||
uint faces_num = me->faces_num;
|
||||
|
||||
if (CustomData_has_layer(&me_eval->loop_data, CD_PROP_FLOAT2)) {
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
|
||||
@@ -959,7 +959,7 @@ static VPaintData *vpaint_init_vpaint(bContext *C,
|
||||
vpd->type = type;
|
||||
vpd->domain = domain;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vpd->vc, depsgraph);
|
||||
vpd->vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
vwpaint::view_angle_limits_init(&vpd->normal_angle_precalc,
|
||||
vp->paint.brush->falloff_angle,
|
||||
(vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
|
||||
|
||||
@@ -170,11 +170,10 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
|
||||
static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
Mesh *me;
|
||||
bool changed = false;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
me = BKE_mesh_from_object(vc.obact);
|
||||
const MDeformVert *dvert = BKE_mesh_deform_verts(me);
|
||||
|
||||
@@ -317,8 +316,7 @@ static bool weight_paint_sample_mark_groups(const MDeformVert *dvert,
|
||||
static int weight_sample_group_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
BLI_assert(vc.v3d && vc.rv3d); /* Ensured by poll. */
|
||||
|
||||
Mesh *me = BKE_mesh_from_object(vc.obact);
|
||||
|
||||
@@ -932,7 +932,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
|
||||
/* make mode data storage */
|
||||
wpd = (WPaintData *)MEM_callocN(sizeof(WPaintData), "WPaintData");
|
||||
paint_stroke_set_mode_data(stroke, wpd);
|
||||
ED_view3d_viewcontext_init(C, &wpd->vc, depsgraph);
|
||||
wpd->vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
vwpaint::view_angle_limits_init(&wpd->normal_angle_precalc,
|
||||
vp->paint.brush->falloff_angle,
|
||||
(vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
|
||||
|
||||
@@ -5087,14 +5087,13 @@ bool SCULPT_cursor_geometry_info_update(bContext *C,
|
||||
Sculpt *sd = scene->toolsettings->sculpt;
|
||||
Object *ob;
|
||||
SculptSession *ss;
|
||||
ViewContext vc;
|
||||
const Brush *brush = BKE_paint_brush(BKE_paint_get_active_from_context(C));
|
||||
float ray_start[3], ray_end[3], ray_normal[3], depth, face_normal[3], sampled_normal[3],
|
||||
mat[3][3];
|
||||
float viewDir[3] = {0.0f, 0.0f, 1.0f};
|
||||
bool original = false;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
ob = vc.obact;
|
||||
ss = ob->sculpt;
|
||||
@@ -5227,9 +5226,8 @@ bool SCULPT_stroke_get_location_ex(bContext *C,
|
||||
StrokeCache *cache;
|
||||
float ray_start[3], ray_end[3], ray_normal[3], depth, face_normal[3];
|
||||
bool original;
|
||||
ViewContext vc;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
ob = vc.obact;
|
||||
|
||||
|
||||
@@ -246,8 +246,7 @@ static int sample_detail(bContext *C, const int event_xy[2], int mode)
|
||||
CTX_wm_region_set(C, region);
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
Object *ob = vc.obact;
|
||||
if (ob == nullptr) {
|
||||
|
||||
@@ -148,8 +148,7 @@ void SCULPT_filter_cache_init(bContext *C,
|
||||
invert_m4_m4(ss->filter_cache->obmat_inv, ob->object_to_world);
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
ss->filter_cache->vc = vc;
|
||||
if (vc.rv3d) {
|
||||
|
||||
@@ -315,9 +315,7 @@ void ED_sculpt_update_modal_transform(bContext *C, Object *ob)
|
||||
transform_radius = BKE_brush_unprojected_radius_get(scene, brush);
|
||||
}
|
||||
else {
|
||||
ViewContext vc;
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
transform_radius = paint_calc_object_space_radius(
|
||||
&vc, ss->init_pivot_pos, BKE_brush_size_get(scene, brush));
|
||||
|
||||
@@ -141,8 +141,7 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
|
||||
}
|
||||
}
|
||||
|
||||
ViewContext vc;
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
copy_v2_v2_int(vc.mval, mval);
|
||||
|
||||
{
|
||||
@@ -371,8 +370,7 @@ static int gizmo_preselect_edgering_test_select(bContext *C, wmGizmo *gz, const
|
||||
}
|
||||
}
|
||||
|
||||
ViewContext vc;
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
copy_v2_v2_int(vc.mval, mval);
|
||||
|
||||
uint base_index;
|
||||
|
||||
@@ -113,22 +113,22 @@ float ED_view3d_select_dist_px()
|
||||
return 75.0f * U.pixelsize;
|
||||
}
|
||||
|
||||
void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc, Depsgraph *depsgraph)
|
||||
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
|
||||
{
|
||||
/* TODO: should return whether there is valid context to continue. */
|
||||
|
||||
memset(vc, 0, sizeof(ViewContext));
|
||||
vc->C = C;
|
||||
vc->region = CTX_wm_region(C);
|
||||
vc->bmain = CTX_data_main(C);
|
||||
vc->depsgraph = depsgraph;
|
||||
vc->scene = CTX_data_scene(C);
|
||||
vc->view_layer = CTX_data_view_layer(C);
|
||||
vc->v3d = CTX_wm_view3d(C);
|
||||
vc->win = CTX_wm_window(C);
|
||||
vc->rv3d = CTX_wm_region_view3d(C);
|
||||
vc->obact = CTX_data_active_object(C);
|
||||
vc->obedit = CTX_data_edit_object(C);
|
||||
ViewContext vc = {};
|
||||
vc.C = C;
|
||||
vc.region = CTX_wm_region(C);
|
||||
vc.bmain = CTX_data_main(C);
|
||||
vc.depsgraph = depsgraph;
|
||||
vc.scene = CTX_data_scene(C);
|
||||
vc.view_layer = CTX_data_view_layer(C);
|
||||
vc.v3d = CTX_wm_view3d(C);
|
||||
vc.win = CTX_wm_window(C);
|
||||
vc.rv3d = CTX_wm_region_view3d(C);
|
||||
vc.obact = CTX_data_active_object(C);
|
||||
vc.obedit = CTX_data_edit_object(C);
|
||||
return vc;
|
||||
}
|
||||
|
||||
void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
|
||||
@@ -1461,7 +1461,6 @@ static bool view3d_lasso_select(bContext *C,
|
||||
* with short array we convert */
|
||||
static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ViewContext vc;
|
||||
int mcoords_len;
|
||||
const int(*mcoords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcoords_len);
|
||||
|
||||
@@ -1471,7 +1470,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
|
||||
BKE_object_update_select_id(CTX_data_main(C));
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
eSelectOp sel_op = static_cast<eSelectOp>(RNA_enum_get(op->ptr, "mode"));
|
||||
bool changed_multi = view3d_lasso_select(C, &vc, mcoords, mcoords_len, sel_op);
|
||||
@@ -2411,7 +2410,6 @@ static Base *ed_view3d_give_base_under_cursor_ex(bContext *C,
|
||||
int *r_material_slot)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
Base *basact = nullptr;
|
||||
GPUSelectResult buffer[MAXPICKELEMS];
|
||||
|
||||
@@ -2419,7 +2417,7 @@ static Base *ed_view3d_give_base_under_cursor_ex(bContext *C,
|
||||
view3d_operator_needs_opengl(C);
|
||||
BKE_object_update_select_id(CTX_data_main(C));
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
const bool do_nearest = !XRAY_ACTIVE(vc.v3d);
|
||||
const bool do_material_slot_selection = r_material_slot != nullptr;
|
||||
@@ -2588,9 +2586,8 @@ static bool ed_object_select_pick(bContext *C,
|
||||
const bool object_only)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
/* Setup view context for argument to callbacks. */
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
Scene *scene = vc.scene;
|
||||
View3D *v3d = vc.v3d;
|
||||
@@ -3063,9 +3060,8 @@ static bool ed_curves_select_pick(bContext &C, const int mval[2], const SelectPi
|
||||
{
|
||||
using namespace blender;
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(&C);
|
||||
ViewContext vc;
|
||||
/* Setup view context for argument to callbacks. */
|
||||
ED_view3d_viewcontext_init(&C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(&C, depsgraph);
|
||||
|
||||
uint bases_len;
|
||||
Base **bases_ptr = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
@@ -3164,9 +3160,8 @@ static bool ed_grease_pencil_select_pick(bContext *C,
|
||||
{
|
||||
using namespace blender;
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
/* Setup view context for argument to callbacks. */
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
/* Collect editable drawings. */
|
||||
const Object *ob_eval = DEG_get_evaluated_object(vc.depsgraph, const_cast<Object *>(vc.obedit));
|
||||
@@ -3272,8 +3267,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
SelectPick_Params params{};
|
||||
ED_select_pick_params_from_operator(op->ptr, ¶ms);
|
||||
@@ -4220,7 +4214,6 @@ static int view3d_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
using namespace blender;
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
rcti rect;
|
||||
bool changed_multi = false;
|
||||
|
||||
@@ -4231,7 +4224,7 @@ static int view3d_box_select_exec(bContext *C, wmOperator *op)
|
||||
BKE_object_update_select_id(CTX_data_main(C));
|
||||
|
||||
/* setup view context for argument to callbacks */
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
eSelectOp sel_op = static_cast<eSelectOp>(RNA_enum_get(op->ptr, "mode"));
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
@@ -5186,8 +5179,7 @@ static void view3d_circle_select_recalc(void *user_data)
|
||||
if (obedit_active) {
|
||||
switch (obedit_active->type) {
|
||||
case OB_MESH: {
|
||||
ViewContext vc;
|
||||
em_setup_viewcontext(C, &vc);
|
||||
ViewContext vc = em_setup_viewcontext(C);
|
||||
FOREACH_OBJECT_IN_MODE_BEGIN (
|
||||
vc.scene, vc.view_layer, vc.v3d, vc.obact->type, vc.obact->mode, ob_iter)
|
||||
{
|
||||
@@ -5226,7 +5218,6 @@ static void view3d_circle_select_cancel(bContext *C, wmOperator *op)
|
||||
static int view3d_circle_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
ViewContext vc;
|
||||
const int radius = RNA_int_get(op->ptr, "radius");
|
||||
const int mval[2] = {RNA_int_get(op->ptr, "x"), RNA_int_get(op->ptr, "y")};
|
||||
|
||||
@@ -5238,7 +5229,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
|
||||
const eSelectOp sel_op = ED_select_op_modal(
|
||||
static_cast<eSelectOp>(RNA_enum_get(op->ptr, "mode")), WM_gesture_is_modal_first(gesture));
|
||||
|
||||
ED_view3d_viewcontext_init(C, &vc, depsgraph);
|
||||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
Object *obact = vc.obact;
|
||||
Object *obedit = vc.obedit;
|
||||
|
||||
Reference in New Issue
Block a user