diff options
Diffstat (limited to 'source/blender/editors/space_view3d')
17 files changed, 353 insertions, 400 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 77cd64be7c1..9a82bce4b4b 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1611,7 +1611,7 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag } static void draw_custom_bone( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Object *ob, const short dt, int armflag, int boneflag, unsigned int id, float length) { @@ -1628,7 +1628,7 @@ static void draw_custom_bone( GPU_select_load_id((GLuint) id | BONESEL_BONE); } - draw_object_instance(eval_ctx, scene, view_layer, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE, fcolor); + draw_object_instance(depsgraph, scene, view_layer, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE, fcolor); } @@ -1933,7 +1933,7 @@ static void bone_matrix_translate_y(float mat[4][4], float y) /* assumes object is Armature with pose */ static void draw_pose_bones( - const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, + struct Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, const short dt, const unsigned char ob_wire_col[4], const bool do_const_color, const bool is_outline) { @@ -2060,7 +2060,7 @@ static void draw_pose_bones( glDisable(GL_CULL_FACE); } - draw_custom_bone(eval_ctx, scene, view_layer, v3d, rv3d, pchan->custom, + draw_custom_bone(depsgraph, scene, view_layer, v3d, rv3d, pchan->custom, OB_SOLID, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan)); } } @@ -2156,7 +2156,7 @@ static void draw_pose_bones( if (bone == arm->act_bone) flag |= BONE_DRAW_ACTIVE; - draw_custom_bone(eval_ctx, scene, view_layer, v3d, rv3d, pchan->custom, + draw_custom_bone(depsgraph, scene, view_layer, v3d, rv3d, pchan->custom, OB_WIRE, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan)); gpuPopMatrix(); @@ -2667,7 +2667,7 @@ static void ghost_poses_tag_unselected(Object *ob, short unset) * note: object should be in posemode */ static void draw_ghost_poses_range( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base) + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base) { Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); @@ -2711,8 +2711,8 @@ static void draw_ghost_poses_range( UI_GetThemeColorShadeAlpha4ubv(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)), col); BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(eval_ctx, scene, ob); - draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(depsgraph, scene, ob); + draw_pose_bones(depsgraph, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2735,7 +2735,7 @@ static void draw_ghost_poses_range( * - object should be in posemode */ static void draw_ghost_poses_keys( - const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, + struct Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base) { Object *ob = base->object; @@ -2794,8 +2794,8 @@ static void draw_ghost_poses_keys( CFRA = (int)ak->cfra; BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(eval_ctx, scene, ob); - draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(depsgraph, scene, ob); + draw_pose_bones(depsgraph, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2819,7 +2819,7 @@ static void draw_ghost_poses_keys( * - object is supposed to be armature in posemode */ static void draw_ghost_poses( - const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, + struct Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base) { Object *ob = base->object; @@ -2874,8 +2874,8 @@ static void draw_ghost_poses( if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(eval_ctx, scene, ob); - draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(depsgraph, scene, ob); + draw_pose_bones(depsgraph, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); } } @@ -2889,8 +2889,8 @@ static void draw_ghost_poses( if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(eval_ctx, scene, ob); - draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(depsgraph, scene, ob); + draw_pose_bones(depsgraph, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false); } } } @@ -2916,7 +2916,7 @@ static void draw_ghost_poses( /* called from drawobject.c, return true if nothing was drawn * (ob_wire_col == NULL) when drawing ghost */ bool draw_armature( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, const short dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_outline) { @@ -2976,14 +2976,14 @@ bool draw_armature( } else if (ob->mode & OB_MODE_POSE) { if (arm->ghosttype == ARM_GHOST_RANGE) { - draw_ghost_poses_range(eval_ctx, scene, view_layer, v3d, ar, base); + draw_ghost_poses_range(depsgraph, scene, view_layer, v3d, ar, base); } else if (arm->ghosttype == ARM_GHOST_KEYS) { - draw_ghost_poses_keys(eval_ctx, scene, view_layer, v3d, ar, base); + draw_ghost_poses_keys(depsgraph, scene, view_layer, v3d, ar, base); } else if (arm->ghosttype == ARM_GHOST_CUR) { if (arm->ghostep) - draw_ghost_poses(eval_ctx, scene, view_layer, v3d, ar, base); + draw_ghost_poses(depsgraph, scene, view_layer, v3d, ar, base); } if ((dflag & DRAW_SCENESET) == 0) { if (ob == OBACT(view_layer)) @@ -2996,7 +2996,7 @@ bool draw_armature( } } } - draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); + draw_pose_bones(depsgraph, scene, view_layer, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); arm->flag &= ~ARM_POSEMODE; } else { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 93bcbc3ea0c..287613c847b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -83,6 +83,7 @@ #include "BKE_editmesh.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -2394,7 +2395,7 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i #ifdef SEQUENCER_DAG_WORKAROUND static void ensure_curve_cache( - const EvaluationContext *eval_ctx, Scene *scene, Object *object) + Depsgraph *depsgraph, Scene *scene, Object *object) { bool need_recalc = object->curve_cache == NULL; /* Render thread might have freed the curve cache if the @@ -2423,13 +2424,13 @@ static void ensure_curve_cache( case OB_CURVE: case OB_SURF: case OB_FONT: - BKE_displist_make_curveTypes(eval_ctx, scene, object, false); + BKE_displist_make_curveTypes(depsgraph, scene, object, false); break; case OB_MBALL: - BKE_displist_make_mball(eval_ctx, scene, object); + BKE_displist_make_mball(depsgraph, scene, object); break; case OB_LATTICE: - BKE_lattice_modifiers_calc(eval_ctx, scene, object); + BKE_lattice_modifiers_calc(depsgraph, scene, object); break; } } @@ -4296,7 +4297,7 @@ static bool object_is_halo(Scene *scene, Object *ob) } static void draw_mesh_fancy( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const unsigned char ob_wire_col[4], const short dflag) { #ifdef WITH_GAMEENGINE @@ -4307,7 +4308,7 @@ static void draw_mesh_fancy( Mesh *me = ob->data; eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; bool /* no_verts,*/ no_edges, no_faces; - DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask); + DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, scene->customdata_mask); const bool is_obact = (ob == OBACT(view_layer)); int draw_flags = (is_obact && BKE_paint_select_face_test(ob)) ? DRAW_FACE_SELECT : 0; @@ -4561,7 +4562,7 @@ static void draw_mesh_fancy( /* returns true if nothing was drawn, for detecting to draw an object center */ static bool draw_mesh_object( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const unsigned char ob_wire_col[4], const short dflag) { Object *ob = base->object; @@ -4602,7 +4603,7 @@ static bool draw_mesh_object( } else { cageDM = editbmesh_get_derived_cage_and_final( - eval_ctx, scene, ob, em, scene->customdata_mask, + depsgraph, scene, ob, em, scene->customdata_mask, &finalDM); } @@ -4643,7 +4644,7 @@ static bool draw_mesh_object( } } - draw_mesh_fancy(eval_ctx, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); + draw_mesh_fancy(depsgraph, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); GPU_end_object_materials(); @@ -4706,14 +4707,14 @@ static void make_color_variations(const unsigned char base_ubyte[4], float low[4 } static void draw_mesh_fancy_new( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const unsigned char ob_wire_col[4], const short dflag, const bool other_obedit) { if (dflag & (DRAW_PICKING | DRAW_CONSTCOLOR)) { /* too complicated! use existing methods */ /* TODO: move this into a separate depth pre-pass */ - draw_mesh_fancy(eval_ctx, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); + draw_mesh_fancy(depsgraph, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); return; } @@ -4725,7 +4726,7 @@ static void draw_mesh_fancy_new( Mesh *me = ob->data; eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; /* could be bool draw_wire_overlay */ bool no_edges, no_faces; - DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask); + DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, scene->customdata_mask); const bool is_obact = (ob == OBACT(view_layer)); int draw_flags = (is_obact && BKE_paint_select_face_test(ob)) ? DRAW_FACE_SELECT : 0; @@ -5026,9 +5027,10 @@ static void draw_mesh_fancy_new( } static bool UNUSED_FUNCTION(draw_mesh_object_new)( - const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const unsigned char ob_wire_col[4], const short dflag) { + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); Object *ob = base->object; Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; @@ -5038,7 +5040,7 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)( /* TODO: handle shadow pass separately */ return true; } - Object *obedit = OBEDIT_FROM_VIEW_LAYER(eval_ctx->view_layer); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); if (obedit && ob != obedit && ob->data == obedit->data) { if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {} @@ -5064,7 +5066,7 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)( } else { cageDM = editbmesh_get_derived_cage_and_final( - eval_ctx, scene, ob, em, scene->customdata_mask, + depsgraph, scene, ob, em, scene->customdata_mask, &finalDM); } @@ -5083,9 +5085,9 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)( DM_update_materials(cageDM, ob); } - const bool glsl = draw_glsl_material(scene, eval_ctx->view_layer, ob, v3d, dt); + const bool glsl = draw_glsl_material(scene, view_layer, ob, v3d, dt); - GPU_begin_object_materials(v3d, rv3d, scene, eval_ctx->view_layer, ob, glsl, NULL); + GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, NULL); } draw_em_fancy_new(scene, ar, v3d, ob, me, em, cageDM, finalDM, dt); @@ -5101,18 +5103,18 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)( /* ob->bb was set by derived mesh system, do NULL check just to be sure */ if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->bb))) { if (solid) { - const bool glsl = draw_glsl_material(scene, eval_ctx->view_layer, ob, v3d, dt); + const bool glsl = draw_glsl_material(scene, view_layer, ob, v3d, dt); if (dt == OB_SOLID || glsl) { const bool check_alpha = check_alpha_pass(base); - GPU_begin_object_materials(v3d, rv3d, scene, eval_ctx->view_layer, ob, glsl, + GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, (check_alpha) ? &do_alpha_after : NULL); } } const bool other_obedit = obedit && (obedit != ob); - draw_mesh_fancy_new(eval_ctx, scene, eval_ctx->view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag, other_obedit); + draw_mesh_fancy_new(depsgraph, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag, other_obedit); GPU_end_object_materials(); @@ -5581,7 +5583,7 @@ static bool drawDispList_nobackface(Scene *scene, ViewLayer *view_layer, View3D return false; } static bool drawDispList( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const short dflag, const unsigned char ob_wire_col[4]) { bool retval; @@ -5594,7 +5596,7 @@ static bool drawDispList( } #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(eval_ctx, scene, base->object); + ensure_curve_cache(depsgraph, scene, base->object); #endif if (drawCurveDerivedMesh(scene, view_layer, v3d, rv3d, base, dt) == false) { @@ -5904,7 +5906,7 @@ static void draw_particle_data(ParticleSystem *psys, RegionView3D *rv3d, * 7. clean up */ static void draw_new_particle_system( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, ParticleSystem *psys, const char ob_dt, const short dflag) { @@ -5937,7 +5939,7 @@ static void draw_new_particle_system( if (pars == NULL) return; /* don't draw normal paths in edit mode */ - if (psys_in_edit_mode(eval_ctx->depsgraph, psys) && (pset->flag & PE_DRAW_PART) == 0) + if (psys_in_edit_mode(depsgraph, psys) && (pset->flag & PE_DRAW_PART) == 0) return; if (part->draw_as == PART_DRAW_REND) @@ -5957,7 +5959,7 @@ static void draw_new_particle_system( curvemapping_changed_all(psys->part->twistcurve); /* 2. */ - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = ob; sim.psys = psys; @@ -6594,14 +6596,14 @@ static void draw_new_particle_system( } static void draw_update_ptcache_edit( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, PTCacheEdit *edit) + Depsgraph *depsgraph, Scene *scene, Object *ob, PTCacheEdit *edit) { if (edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED) - PE_update_object(eval_ctx, scene, ob, 0); + PE_update_object(depsgraph, scene, ob, 0); /* create path and child path cache if it doesn't exist already */ if (edit->pathcache == NULL) { - psys_cache_edit_paths(eval_ctx, scene, ob, edit, CFRA, G.is_rendering); + psys_cache_edit_paths(depsgraph, scene, ob, edit, CFRA, G.is_rendering); } } @@ -7336,7 +7338,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) } static void draw_editnurb( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, const char dt, const short dflag, const unsigned char UNUSED(ob_wire_col[4])) { @@ -7351,7 +7353,7 @@ static void draw_editnurb( /* DispList */ UI_GetThemeColor3ubv(TH_WIRE_EDIT, wire_col); - drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, wire_col); + drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, wire_col); /* for shadows only show solid faces */ if (v3d->flag2 & V3D_RENDER_SHADOW) @@ -7477,7 +7479,7 @@ static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2]) } static void draw_editfont( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; @@ -7490,11 +7492,11 @@ static void draw_editfont( if (cu->flag & CU_FAST) { imm_cpack(0xFFFFFF); set_inverted_drawing(1); - drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, OB_WIRE, dflag, ob_wire_col); + drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, OB_WIRE, dflag, ob_wire_col); set_inverted_drawing(0); } else { - drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); } if (cu->linewidth != 0.0f) { @@ -7797,7 +7799,7 @@ static void imm_drawcone(const float vec[3], float radius, float height, float t /* return true if nothing was drawn */ static bool drawmball( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; @@ -7811,13 +7813,13 @@ static bool drawmball( if ((G.f & G_PICKSEL) == 0) { unsigned char wire_col[4]; UI_GetThemeColor4ubv(TH_WIRE_EDIT, wire_col); - drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, wire_col); + drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, wire_col); } ml = mb->editelems->first; } else { if ((base->flag_legacy & OB_FROMDUPLI) == 0) { - drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); } ml = mb->elems.first; } @@ -8266,7 +8268,7 @@ static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3]) /* draws wire outline */ static void draw_object_selected_outline( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, const unsigned char ob_wire_col[4]) { RegionView3D *rv3d = ar->regiondata; @@ -8278,7 +8280,7 @@ static void draw_object_selected_outline( bool has_faces = false; #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(eval_ctx, scene, ob); + ensure_curve_cache(depsgraph, scene, ob); #endif DerivedMesh *dm = ob->derivedFinal; @@ -8315,7 +8317,7 @@ static void draw_object_selected_outline( else if (ob->type == OB_ARMATURE) { if (!(ob->mode & OB_MODE_POSE && base == view_layer->basact)) { glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f); - draw_armature(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); + draw_armature(depsgraph, scene, view_layer, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true); } } @@ -8569,7 +8571,7 @@ void draw_rigidbody_shape(Object *ob, const unsigned char ob_wire_col[4]) * \param dflag (draw flag) can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET */ void draw_object( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base, const short dflag) { ModifierData *md = NULL; @@ -8755,7 +8757,7 @@ void draw_object( if ((v3d->flag & V3D_SELECT_OUTLINE) && !render_override && ob->type != OB_MESH) { if (dt > OB_WIRE && (ob->mode & OB_MODE_EDIT) == 0 && (dflag & DRAW_SCENESET) == 0) { if (!(ob->dtx & OB_DRAWWIRE) && (base->flag & BASE_SELECTED) && !(dflag & (DRAW_PICKING | DRAW_CONSTCOLOR))) { - draw_object_selected_outline(eval_ctx, scene, view_layer, v3d, ar, base, ob_wire_col); + draw_object_selected_outline(depsgraph, scene, view_layer, v3d, ar, base, ob_wire_col); } } } @@ -8769,7 +8771,7 @@ void draw_object( switch (ob->type) { case OB_MESH: - empty_object = draw_mesh_object(eval_ctx, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); + empty_object = draw_mesh_object(depsgraph, scene, view_layer, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); if ((dflag & DRAW_CONSTCOLOR) == 0) { /* mesh draws wire itself */ dtx &= ~OB_DRAWWIRE; @@ -8779,18 +8781,18 @@ void draw_object( case OB_FONT: cu = ob->data; if (cu->editfont) { - draw_editfont(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + draw_editfont(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); } else if (dt == OB_BOUNDBOX) { if ((render_override && v3d->drawtype >= OB_WIRE) == 0) { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(eval_ctx, scene, base->object); + ensure_curve_cache(depsgraph, scene, base->object); #endif draw_bounding_volume(ob, ob->boundtype, ob_wire_col); } } else if (ED_view3d_boundbox_clip(rv3d, ob->bb)) { - empty_object = drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + empty_object = drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); } break; @@ -8800,18 +8802,18 @@ void draw_object( if (cu->editnurb) { ListBase *nurbs = BKE_curve_editNurbs_get(cu); - draw_editnurb(eval_ctx, scene, view_layer, v3d, rv3d, base, nurbs->first, dt, dflag, ob_wire_col); + draw_editnurb(depsgraph, scene, view_layer, v3d, rv3d, base, nurbs->first, dt, dflag, ob_wire_col); } else if (dt == OB_BOUNDBOX) { if ((render_override && (v3d->drawtype >= OB_WIRE)) == 0) { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(eval_ctx, scene, base->object); + ensure_curve_cache(depsgraph, scene, base->object); #endif draw_bounding_volume(ob, ob->boundtype, ob_wire_col); } } else if (ED_view3d_boundbox_clip(rv3d, ob->bb)) { - empty_object = drawDispList(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + empty_object = drawDispList(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); } break; case OB_MBALL: @@ -8819,17 +8821,17 @@ void draw_object( MetaBall *mb = ob->data; if (mb->editelems) - drawmball(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + drawmball(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); else if (dt == OB_BOUNDBOX) { if ((render_override && (v3d->drawtype >= OB_WIRE)) == 0) { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(eval_ctx, scene, base->object); + ensure_curve_cache(depsgraph, scene, base->object); #endif draw_bounding_volume(ob, ob->boundtype, ob_wire_col); } } else - empty_object = drawmball(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); + empty_object = drawmball(depsgraph, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col); break; } case OB_EMPTY: @@ -8868,7 +8870,7 @@ void draw_object( } else { #ifdef SEQUENCER_DAG_WORKAROUND - ensure_curve_cache(eval_ctx, scene, ob); + ensure_curve_cache(depsgraph, scene, ob); #endif drawlattice(v3d, ob, dflag, ob_wire_col); } @@ -8893,7 +8895,7 @@ void draw_object( else copy_v4_v4_uchar(arm_col, ob_wire_col); - empty_object = draw_armature(eval_ctx, scene, view_layer, v3d, ar, base, dt, dflag, arm_col, false); + empty_object = draw_armature(depsgraph, scene, view_layer, v3d, ar, base, dt, dflag, arm_col, false); } } break; @@ -8946,12 +8948,12 @@ afterdraw: for (psys = ob->particlesystem.first; psys; psys = psys->next) { /* run this so that possible child particles get cached */ if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) { - PTCacheEdit *edit = PE_create_current(eval_ctx, scene, ob); + PTCacheEdit *edit = PE_create_current(depsgraph, scene, ob); if (edit && edit->psys == psys) - draw_update_ptcache_edit(eval_ctx, scene, ob, edit); + draw_update_ptcache_edit(depsgraph, scene, ob, edit); } - draw_new_particle_system(eval_ctx, scene, v3d, rv3d, base, psys, dt, dflag); + draw_new_particle_system(depsgraph, scene, v3d, rv3d, base, psys, dt, dflag); } invert_m4_m4(ob->imat, ob->obmat); view3d_cached_text_draw_end(v3d, ar, 0); @@ -8967,10 +8969,10 @@ afterdraw: { if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) { - PTCacheEdit *edit = PE_create_current(eval_ctx, scene, ob); + PTCacheEdit *edit = PE_create_current(depsgraph, scene, ob); if (edit) { gpuLoadMatrix(rv3d->viewmat); - draw_update_ptcache_edit(eval_ctx, scene, ob, edit); + draw_update_ptcache_edit(depsgraph, scene, ob, edit); draw_ptcache_edit(scene, v3d, edit); gpuMultMatrix(ob->obmat); } @@ -9221,7 +9223,7 @@ afterdraw: /* help lines and so */ if ((is_obedit == false) && ob->parent) { - const eObjectVisibilityCheck mode = eval_ctx->mode != DAG_EVAL_VIEWPORT ? + const eObjectVisibilityCheck mode = DEG_get_mode(depsgraph) != DAG_EVAL_VIEWPORT ? OB_VISIBILITY_CHECK_FOR_RENDER : OB_VISIBILITY_CHECK_FOR_VIEWPORT; if (BKE_object_is_visible(ob->parent, mode)) { @@ -9288,7 +9290,7 @@ afterdraw: for (ct = targets.first; ct; ct = ct->next) { /* calculate target's matrix */ if (cti->get_target_matrix) - cti->get_target_matrix(eval_ctx, curcon, cob, ct, BKE_scene_frame_get(scene)); + cti->get_target_matrix(depsgraph, curcon, cob, ct, BKE_scene_frame_get(scene)); else unit_m4(ct->matrix); @@ -9338,11 +9340,11 @@ afterdraw: * caller must have called 'GPU_select_load_id(base->selcode)' first. */ void draw_object_select( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base, const short dflag) { BLI_assert(dflag & DRAW_PICKING && dflag & DRAW_CONSTCOLOR); - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, dflag); /* we draw duplicators for selection too */ if ((base->object->transflag & OB_DUPLI)) { @@ -9351,7 +9353,7 @@ void draw_object_select( Base tbase; tbase.flag_legacy = OB_FROMDUPLI; - lb = object_duplilist(eval_ctx, scene, base->object); + lb = object_duplilist(depsgraph, scene, base->object); for (dob = lb->first; dob; dob = dob->next) { float omat[4][4]; @@ -9365,7 +9367,7 @@ void draw_object_select( char dt = tbase.object->dt; tbase.object->dt = MIN2(tbase.object->dt, base->object->dt); short dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx; - draw_object(eval_ctx, scene, view_layer, ar, v3d, &tbase, dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, &tbase, dflag); tbase.object->dt = dt; tbase.object->dtx = dtx; @@ -9691,10 +9693,10 @@ static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index) } } -static void bbs_mesh_solid_verts(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) +static void bbs_mesh_solid_verts(Depsgraph *depsgraph, Scene *scene, Object *ob) { Mesh *me = ob->data; - DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask); + DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, scene->customdata_mask); DM_update_materials(dm, ob); @@ -9711,7 +9713,7 @@ static void bbs_mesh_solid_verts(const EvaluationContext *eval_ctx, Scene *scene dm->release(dm); } #else -static void bbs_mesh_solid_verts(const EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *ob) +static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob) { Mesh *me = ob->data; @@ -9752,7 +9754,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob) } void draw_object_backbufsel( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) + Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) { ToolSettings *ts = scene->toolsettings; @@ -9767,7 +9769,7 @@ void draw_object_backbufsel( Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; - DerivedMesh *dm = editbmesh_get_derived_cage(eval_ctx, scene, ob, em, CD_MASK_BAREMESH); + DerivedMesh *dm = editbmesh_get_derived_cage(depsgraph, scene, ob, em, CD_MASK_BAREMESH); BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE); @@ -9811,7 +9813,7 @@ void draw_object_backbufsel( /* currently vertex select supports weight paint and vertex paint*/ ((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT))) { - bbs_mesh_solid_verts(eval_ctx, scene, ob); + bbs_mesh_solid_verts(depsgraph, scene, ob); } else { bbs_mesh_solid_faces(scene, ob); @@ -9832,7 +9834,7 @@ void draw_object_backbufsel( /* helper function for drawing object instances - meshes */ static void draw_object_mesh_instance( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Object *ob, const short dt, int outline, const unsigned char ob_wire_col[4]) { Mesh *me = ob->data; @@ -9843,7 +9845,7 @@ static void draw_object_mesh_instance( DM_update_materials(edm, ob); } else { - dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH); + dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH); DM_update_materials(dm, ob); } @@ -9879,7 +9881,7 @@ static void draw_object_mesh_instance( if (dm) dm->release(dm); } -void draw_object_instance(const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline, const float wire_col[4]) +void draw_object_instance(Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline, const float wire_col[4]) { if (ob == NULL) return; @@ -9889,7 +9891,7 @@ void draw_object_instance(const EvaluationContext *eval_ctx, Scene *scene, ViewL switch (ob->type) { case OB_MESH: - draw_object_mesh_instance(eval_ctx, scene, view_layer, v3d, rv3d, ob, dt, outline, bcol); + draw_object_mesh_instance(depsgraph, scene, view_layer, v3d, rv3d, ob, dt, outline, bcol); break; case OB_EMPTY: if (ob->empty_drawtype == OB_EMPTY_IMAGE) { @@ -9903,7 +9905,7 @@ void draw_object_instance(const EvaluationContext *eval_ctx, Scene *scene, ViewL } void ED_draw_object_facemap( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, const float col[4], const int facemap) + Depsgraph *depsgraph, Scene *scene, Object *ob, const float col[4], const int facemap) { DerivedMesh *dm = NULL; @@ -9916,7 +9918,7 @@ void ED_draw_object_facemap( return; } - dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH); + dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH); if (!dm || !CustomData_has_layer(&dm->polyData, CD_FACEMAP)) return; diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c index 5962f1ed2ff..d0475684262 100644 --- a/source/blender/editors/space_view3d/view3d_camera_control.c +++ b/source/blender/editors/space_view3d/view3d_camera_control.c @@ -138,7 +138,7 @@ Object *ED_view3d_cameracontrol_object_get(View3DCameraControl *vctrl) * the view for first-person style navigation. */ struct View3DCameraControl *ED_view3d_cameracontrol_acquire( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, const bool use_parent_root) { View3DCameraControl *vctrl; @@ -178,7 +178,7 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire( /* store the original camera loc and rot */ vctrl->obtfm = BKE_object_tfm_backup(ob_back); - BKE_object_where_is_calc(eval_ctx, scene, v3d->camera); + BKE_object_where_is_calc(depsgraph, scene, v3d->camera); negate_v3_v3(rv3d->ofs, v3d->camera->obmat[3]); rv3d->dist = 0.0; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 4a0ee31a2b7..b2115aa2b75 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -119,10 +119,9 @@ static bool use_depth_doit(View3D *v3d, Object *obedit) * \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore */ void ED_view3d_update_viewmat( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4], const rcti *rect) { - const Depsgraph *depsgraph = eval_ctx->depsgraph; RegionView3D *rv3d = ar->regiondata; /* setup window matrices */ @@ -142,7 +141,7 @@ void ED_view3d_update_viewmat( rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)ar->winy; } /* note: calls BKE_object_where_is_calc for camera... */ - view3d_viewmatrix_set(eval_ctx, scene, v3d, rv3d, rect ? rect_scale : NULL); + view3d_viewmatrix_set(depsgraph, scene, v3d, rv3d, rect ? rect_scale : NULL); } /* update utility matrices */ mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); @@ -154,7 +153,7 @@ void ED_view3d_update_viewmat( /* store window coordinates scaling/offset */ if (rv3d->persp == RV3D_CAMOB && v3d->camera) { rctf cameraborder; - ED_view3d_calc_camera_border(scene, eval_ctx->depsgraph, ar, v3d, rv3d, &cameraborder, false); + ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &cameraborder, false); rv3d->viewcamtexcofac[0] = (float)ar->winx / BLI_rctf_size_x(&cameraborder); rv3d->viewcamtexcofac[1] = (float)ar->winy / BLI_rctf_size_y(&cameraborder); @@ -189,12 +188,12 @@ void ED_view3d_update_viewmat( } static void view3d_main_region_setup_view( - const EvaluationContext *eval_ctx, Scene *scene, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = ar->regiondata; - ED_view3d_update_viewmat(eval_ctx, scene, v3d, ar, viewmat, winmat, rect); + ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, viewmat, winmat, rect); /* set for opengl */ gpuLoadProjectionMatrix(rv3d->winmat); @@ -245,7 +244,7 @@ static bool view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, Reg * view3d)main_region_setup_view() code to account for that. */ static void view3d_stereo3d_setup( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const rcti *rect) + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, const rcti *rect) { bool is_left; const char *names[2] = { STEREO_LEFT_NAME, STEREO_RIGHT_NAME }; @@ -271,7 +270,7 @@ static void view3d_stereo3d_setup( data->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname); BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat); - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, NULL, rect); + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, NULL, rect); data->shiftx = shiftx; BLI_thread_unlock(LOCK_VIEW3D); @@ -285,7 +284,7 @@ static void view3d_stereo3d_setup( v3d->camera = camera; BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat); - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, NULL, rect); + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, NULL, rect); v3d->camera = view_ob; BLI_thread_unlock(LOCK_VIEW3D); @@ -296,24 +295,24 @@ static void view3d_stereo3d_setup( * Set the correct matrices */ void ED_view3d_draw_setup_view( - wmWindow *win, const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d, + wmWindow *win, Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d, float viewmat[4][4], float winmat[4][4], const rcti *rect) { RegionView3D *rv3d = ar->regiondata; /* Setup the view matrix. */ if (view3d_stereo3d_active(win, scene, v3d, rv3d)) { - view3d_stereo3d_setup(eval_ctx, scene, v3d, ar, rect); + view3d_stereo3d_setup(depsgraph, scene, v3d, ar, rect); } else { - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, rect); + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, winmat, rect); } } /* ******************** view border ***************** */ static void view3d_camera_border( - const Scene *scene, const struct Depsgraph *depsgraph, + const Scene *scene, struct Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const RegionView3D *rv3d, rctf *r_viewborder, const bool no_shift, const bool no_zoom) { @@ -349,7 +348,7 @@ static void view3d_camera_border( } void ED_view3d_calc_camera_border_size( - const Scene *scene, const Depsgraph *depsgraph, + const Scene *scene, Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const RegionView3D *rv3d, float r_size[2]) { @@ -361,7 +360,7 @@ void ED_view3d_calc_camera_border_size( } void ED_view3d_calc_camera_border( - const Scene *scene, const Depsgraph *depsgraph, + const Scene *scene, Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const RegionView3D *rv3d, rctf *r_viewborder, const bool no_shift) { @@ -444,7 +443,7 @@ static void drawviewborder_triangle( immEnd(); } -static void drawviewborder(Scene *scene, const Depsgraph *depsgraph, ARegion *ar, View3D *v3d) +static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View3D *v3d) { float x1, x2, y1, y2; float x1i, x2i, y1i, y2i; @@ -709,11 +708,11 @@ static void drawrenderborder(ARegion *ar, View3D *v3d) } void ED_view3d_draw_depth( - const EvaluationContext *eval_ctx, struct Depsgraph *graph, + Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool alphaoverride) { struct bThemeState theme_state; - Scene *scene = DEG_get_evaluated_scene(graph); + Scene *scene = DEG_get_evaluated_scene(depsgraph); RegionView3D *rv3d = ar->regiondata; short zbuf = v3d->zbuf; @@ -730,7 +729,7 @@ void ED_view3d_draw_depth( UI_Theme_Store(&theme_state); UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); - ED_view3d_draw_setup_view(NULL, eval_ctx, scene, ar, v3d, NULL, NULL, NULL); + ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL); glClear(GL_DEPTH_BUFFER_BIT); @@ -751,7 +750,7 @@ void ED_view3d_draw_depth( else #endif /* WITH_OPENGL_LEGACY */ { - DRW_draw_depth_loop(graph, ar, v3d); + DRW_draw_depth_loop(depsgraph, ar, v3d); } if (rv3d->rflag & RV3D_CLIPPING) { @@ -1888,10 +1887,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset) static void view3d_draw_view(const bContext *C, ARegion *ar) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); - - ED_view3d_draw_setup_view(CTX_wm_window(C), &eval_ctx, CTX_data_scene(C), ar, CTX_wm_view3d(C), NULL, NULL, NULL); + ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph(C), CTX_data_scene(C), ar, CTX_wm_view3d(C), NULL, NULL, NULL); /* Only 100% compliant on new spec goes bellow */ DRW_draw_view(C); @@ -1937,7 +1933,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar) * \{ */ static void view3d_stereo3d_setup_offscreen( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, float winmat[4][4], const char *viewname) { /* update the viewport matrices with the new camera */ @@ -1946,18 +1942,18 @@ static void view3d_stereo3d_setup_offscreen( const bool is_left = STREQ(viewname, STEREO_LEFT_NAME); BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat); - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, winmat, NULL); } else { /* SCE_VIEWS_FORMAT_MULTIVIEW */ float viewmat[4][4]; Object *camera = BKE_camera_multiview_render(scene, v3d->camera, viewname); BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat); - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, winmat, NULL); } } -void ED_view3d_draw_offscreen_init(const EvaluationContext *eval_ctx, +void ED_view3d_draw_offscreen_init(Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, RenderEngineType *engine_type, @@ -1966,7 +1962,7 @@ void ED_view3d_draw_offscreen_init(const EvaluationContext *eval_ctx, if (engine_type->flag & RE_USE_LEGACY_PIPELINE) { /* shadow buffers, before we setup matrices */ if (draw_glsl_material(scene, view_layer, NULL, v3d, v3d->drawtype)) { - VP_deprecated_gpu_update_lamps_shadows_world(eval_ctx, scene, v3d); + VP_deprecated_gpu_update_lamps_shadows_world(depsgraph, scene, v3d); } } } @@ -1990,7 +1986,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar) * stuff like shadow buffers */ void ED_view3d_draw_offscreen( - const EvaluationContext *eval_ctx, Scene *scene, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, RenderEngineType *engine_type, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], @@ -2031,15 +2027,13 @@ void ED_view3d_draw_offscreen( gpuLoadIdentity(); if ((viewname != NULL && viewname[0] != '\0') && (viewmat == NULL) && rv3d->persp == RV3D_CAMOB && v3d->camera) - view3d_stereo3d_setup_offscreen(eval_ctx, scene, v3d, ar, winmat, viewname); + view3d_stereo3d_setup_offscreen(depsgraph, scene, v3d, ar, winmat, viewname); else - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); - - Depsgraph *depsgraph = eval_ctx->depsgraph; + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, winmat, NULL); /* main drawing call */ if (engine_type->flag & RE_USE_LEGACY_PIPELINE) { - VP_deprecated_view3d_draw_objects(NULL, eval_ctx, scene, v3d, ar, NULL, do_bgpic, true); + VP_deprecated_view3d_draw_objects(NULL, depsgraph, scene, v3d, ar, NULL, do_bgpic, true); if ((v3d->flag2 & V3D_RENDER_SHADOW) == 0) { /* draw grease-pencil stuff */ @@ -2080,7 +2074,7 @@ void ED_view3d_draw_offscreen( * (avoids re-creating when doing multiple GL renders). */ ImBuf *ED_view3d_draw_offscreen_imbuf( - const EvaluationContext *eval_ctx, Scene *scene, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, RenderEngineType *engine_type, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, unsigned int draw_flags, @@ -2088,7 +2082,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( /* output vars */ GPUOffScreen *ofs, char err_out[256]) { - const Depsgraph *depsgraph = eval_ctx->depsgraph; RegionView3D *rv3d = ar->regiondata; const bool draw_sky = (alpha_mode == R_ADDSKY); const bool draw_background = (draw_flags & V3D_OFSDRAW_USE_BACKGROUND); @@ -2116,7 +2109,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( } } - ED_view3d_draw_offscreen_init(eval_ctx, scene, view_layer, engine_type, v3d); + ED_view3d_draw_offscreen_init(depsgraph, scene, view_layer, engine_type, v3d); GPU_offscreen_bind(ofs, true); @@ -2158,7 +2151,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( if ((samples && use_full_sample) == 0) { /* Single-pass render, common case */ ED_view3d_draw_offscreen( - eval_ctx, scene, view_layer, engine_type, + depsgraph, scene, view_layer, engine_type, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, &fx_settings, ofs, NULL); @@ -2183,7 +2176,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen( - eval_ctx, scene, view_layer, engine_type, + depsgraph, scene, view_layer, engine_type, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, &fx_settings, ofs, viewport); @@ -2198,7 +2191,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( (jit_ofs[j][1] * 2.0f) / sizey); ED_view3d_draw_offscreen( - eval_ctx, scene, view_layer, engine_type, + depsgraph, scene, view_layer, engine_type, v3d, ar, sizex, sizey, NULL, winmat_jitter, draw_background, draw_sky, !is_ortho, viewname, &fx_settings, ofs, viewport); @@ -2262,7 +2255,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( * \note used by the sequencer */ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - const EvaluationContext *eval_ctx, Scene *scene, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, RenderEngineType *engine_type, Object *camera, int width, int height, unsigned int flag, unsigned int draw_flags, int drawtype, @@ -2325,7 +2318,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( invert_m4_m4(rv3d.persinv, rv3d.viewinv); return ED_view3d_draw_offscreen_imbuf( - eval_ctx, scene, view_layer, engine_type, + depsgraph, scene, view_layer, engine_type, &v3d, &ar, width, height, flag, draw_flags, alpha_mode, samples, viewname, ofs, err_out); } @@ -2375,10 +2368,10 @@ void VP_legacy_drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool } void VP_legacy_view3d_main_region_setup_view( - const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]) { - view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); + view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, winmat, NULL); } bool VP_legacy_view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d) @@ -2386,9 +2379,9 @@ bool VP_legacy_view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, return view3d_stereo3d_active(win, scene, v3d, rv3d); } -void VP_legacy_view3d_stereo3d_setup(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar) +void VP_legacy_view3d_stereo3d_setup(Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar) { - view3d_stereo3d_setup(eval_ctx, scene, v3d, ar, NULL); + view3d_stereo3d_setup(depsgraph, scene, v3d, ar, NULL); } bool VP_legacy_use_depth(View3D *v3d, Object *obedit) @@ -2396,7 +2389,7 @@ bool VP_legacy_use_depth(View3D *v3d, Object *obedit) return use_depth_doit(v3d, obedit); } -void VP_drawviewborder(Scene *scene, const struct Depsgraph *depsgraph, ARegion *ar, View3D *v3d) +void VP_drawviewborder(Scene *scene, struct Depsgraph *depsgraph, ARegion *ar, View3D *v3d) { drawviewborder(scene, depsgraph, ar, v3d); } diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 7272fc6b408..dcdcf95bf86 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -71,6 +71,7 @@ #include "BKE_movieclip.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -211,7 +212,7 @@ static void draw_view_icon(RegionView3D *rv3d, rcti *rect) /* *********************** backdraw for selection *************** */ static void backdrawview3d( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d, Object *obact, Object *obedit) { @@ -311,7 +312,7 @@ static void backdrawview3d( G.f |= G_BACKBUFSEL; if (obact && ((obact->base_flag & BASE_VISIBLED) != 0)) { - draw_object_backbufsel(eval_ctx, scene, v3d, rv3d, obact); + draw_object_backbufsel(depsgraph, scene, v3d, rv3d, obact); } if (rv3d->gpuoffscreen) @@ -351,10 +352,10 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data); } -void ED_view3d_backbuf_validate(const struct EvaluationContext *eval_ctx, ViewContext *vc) +void ED_view3d_backbuf_validate(ViewContext *vc) { if (vc->v3d->flag & V3D_INVALID_BACKBUF) { - backdrawview3d(eval_ctx, vc->scene, vc->ar, vc->v3d, vc->obact, vc->obedit); + backdrawview3d(vc->depsgraph, vc->scene, vc->ar, vc->v3d, vc->obact, vc->obedit); } } @@ -369,13 +370,13 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist) /* samples a single pixel (copied from vpaint) */ unsigned int ED_view3d_backbuf_sample( - const EvaluationContext *eval_ctx, ViewContext *vc, int x, int y) + ViewContext *vc, int x, int y) { if (x >= vc->ar->winx || y >= vc->ar->winy) { return 0; } - ED_view3d_backbuf_validate(eval_ctx, vc); + ED_view3d_backbuf_validate(vc); unsigned int col; view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); @@ -390,7 +391,7 @@ unsigned int ED_view3d_backbuf_sample( /* reads full rect, converts indices */ ImBuf *ED_view3d_backbuf_read( - const EvaluationContext *eval_ctx, ViewContext *vc, int xmin, int ymin, int xmax, int ymax) + ViewContext *vc, int xmin, int ymin, int xmax, int ymax) { /* clip */ const rcti clip = { @@ -408,7 +409,7 @@ ImBuf *ED_view3d_backbuf_read( ImBuf *ibuf_clip = IMB_allocImBuf(size_clip[0], size_clip[1], 32, IB_rect); - ED_view3d_backbuf_validate(eval_ctx, vc); + ED_view3d_backbuf_validate(vc); view3d_opengl_read_pixels(vc->ar, clip.xmin, clip.ymin, size_clip[0], size_clip[1], GL_RGBA, GL_UNSIGNED_BYTE, ibuf_clip->rect); @@ -447,7 +448,7 @@ ImBuf *ED_view3d_backbuf_read( /* smart function to sample a rect spiralling outside, nice for backbuf selection */ unsigned int ED_view3d_backbuf_sample_rect( - const EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2], int size, + ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, float *r_dist) { int dirvec[4][2]; @@ -456,7 +457,7 @@ unsigned int ED_view3d_backbuf_sample_rect( const int minx = mval[0] - (amount + 1); const int miny = mval[1] - (amount + 1); - ImBuf *buf = ED_view3d_backbuf_read(eval_ctx, vc, minx, miny, minx + size - 1, miny + size - 1); + ImBuf *buf = ED_view3d_backbuf_read(vc, minx, miny, minx + size - 1, miny + size - 1); if (!buf) return 0; unsigned index = 0; @@ -528,7 +529,7 @@ static void view3d_stereo_bgpic_setup(Scene *scene, View3D *v3d, Image *ima, Ima } } -static void view3d_draw_bgpic(Scene *scene, const Depsgraph *depsgraph, +static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const bool do_foreground, const bool do_camera_frame) { @@ -773,7 +774,7 @@ static void view3d_draw_bgpic(Scene *scene, const Depsgraph *depsgraph, } void ED_view3d_draw_bgpic_test( - Scene *scene, const Depsgraph *depsgraph, + Scene *scene, Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const bool do_foreground, const bool do_camera_frame) { @@ -826,7 +827,7 @@ void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag) /* disables write in zbuffer and draws it over */ static void view3d_draw_transp( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d) + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d) { View3DAfter *v3da; @@ -834,7 +835,7 @@ static void view3d_draw_transp( v3d->transp = true; while ((v3da = BLI_pophead(&v3d->afterdraw_transp))) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } v3d->transp = false; @@ -845,7 +846,7 @@ static void view3d_draw_transp( /* clears zbuffer and draws it over */ static void view3d_draw_xray( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, bool *clear) + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, bool *clear) { if (*clear && v3d->zbuf) { glClear(GL_DEPTH_BUFFER_BIT); @@ -855,7 +856,7 @@ static void view3d_draw_xray( v3d->xray = true; View3DAfter *v3da; while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } v3d->xray = false; @@ -864,7 +865,7 @@ static void view3d_draw_xray( /* clears zbuffer and draws it over */ static void view3d_draw_xraytransp( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, const bool clear) + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, const bool clear) { if (clear && v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT); @@ -876,7 +877,7 @@ static void view3d_draw_xraytransp( View3DAfter *v3da; while ((v3da = BLI_pophead(&v3d->afterdraw_xraytransp))) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); MEM_freeN(v3da); } @@ -889,7 +890,7 @@ static void view3d_draw_xraytransp( /* clears zbuffer and draws it over, * note that in the select version we don't care about transparent flag as with regular drawing */ static void view3d_draw_xray_select( - const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, bool *clear) + struct Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, bool *clear) { /* Not ideal, but we need to read from the previous depths before clearing * otherwise we could have a function to load the depths after drawing. @@ -909,7 +910,7 @@ static void view3d_draw_xray_select( v3d->xray = true; while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) { if (GPU_select_load_id(v3da->base->object->select_color)) { - draw_object_select(eval_ctx, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); + draw_object_select(depsgraph, scene, view_layer, ar, v3d, v3da->base, v3da->dflag); } MEM_freeN(v3da); } @@ -945,7 +946,7 @@ static DupliObject *dupli_step(DupliObject *dob) } static void draw_dupli_objects_color( - const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base, const short dflag, const int color) { RegionView3D *rv3d = ar->regiondata; @@ -972,10 +973,10 @@ static void draw_dupli_objects_color( tbase.flag_legacy = OB_FROMDUPLI | base->flag_legacy; tbase.flag = base->flag; - lb = object_duplilist(eval_ctx, scene, base->object); + lb = object_duplilist(depsgraph, scene, base->object); // BLI_listbase_sort(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */ - apply_data = duplilist_apply(eval_ctx, base->object, scene, lb); + apply_data = duplilist_apply(depsgraph, base->object, scene, lb); DupliObject *dob_next = NULL; DupliObject *dob = dupli_step(lb->first); @@ -1028,7 +1029,7 @@ static void draw_dupli_objects_color( if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { copy_m4_m4(dob->ob->obmat, dob->mat); GPU_begin_dupli_object(dob); - draw_object(eval_ctx, scene, view_layer, ar, v3d, &tbase, dflag_dupli); + draw_object(depsgraph, scene, view_layer, ar, v3d, &tbase, dflag_dupli); GPU_end_dupli_object(); } @@ -1046,7 +1047,7 @@ static void draw_dupli_objects_color( free_object_duplilist(lb); } -void draw_dupli_objects(const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base) +void draw_dupli_objects(Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base) { /* define the color here so draw_dupli_objects_color can be called * from the set loop */ @@ -1056,7 +1057,7 @@ void draw_dupli_objects(const EvaluationContext *eval_ctx, Scene *scene, ViewLay if (base->object->dup_group && base->object->dup_group->id.us < 1) color = TH_REDALERT; - draw_dupli_objects_color(eval_ctx, scene, view_layer, ar, v3d, base, 0, color); + draw_dupli_objects_color(depsgraph, scene, view_layer, ar, v3d, base, 0, color); } /* XXX warning, not using gpu offscreen here */ @@ -1170,12 +1171,13 @@ float view3d_depth_near(ViewDepths *d) } void ED_view3d_draw_depth_gpencil( - const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d) + Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d) { + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); bool zbuf = v3d->zbuf; /* Setup view matrix. */ - ED_view3d_draw_setup_view(NULL, eval_ctx, scene, ar, v3d, NULL, NULL, NULL); + ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL); glClear(GL_DEPTH_BUFFER_BIT); @@ -1183,17 +1185,17 @@ void ED_view3d_draw_depth_gpencil( glEnable(GL_DEPTH_TEST); if (v3d->flag2 & V3D_SHOW_GPENCIL) { - ED_gpencil_draw_view3d(NULL, scene, eval_ctx->view_layer, eval_ctx->depsgraph, v3d, ar, true); + ED_gpencil_draw_view3d(NULL, scene, view_layer, depsgraph, v3d, ar, true); } v3d->zbuf = zbuf; if (!zbuf) glDisable(GL_DEPTH_TEST); } -void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d) +void ED_view3d_draw_depth_loop(Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d) { Base *base; - ViewLayer *view_layer = eval_ctx->view_layer; + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); /* no need for color when drawing depth buffer */ const short dflag_depth = DRAW_CONSTCOLOR; @@ -1202,9 +1204,9 @@ void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, Scene *sce_iter; for (SETLOOPER(scene->set, sce_iter, base)) { if ((base->flag & BASE_VISIBLED) != 0) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, 0); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, 0); if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects_color(eval_ctx, scene, view_layer, ar, v3d, base, dflag_depth, TH_UNDEFINED); + draw_dupli_objects_color(depsgraph, scene, view_layer, ar, v3d, base, dflag_depth, TH_UNDEFINED); } } } @@ -1214,9 +1216,9 @@ void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, if ((base->flag & BASE_VISIBLED) != 0) { /* dupli drawing */ if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects_color(eval_ctx, scene, view_layer, ar, v3d, base, dflag_depth, TH_UNDEFINED); + draw_dupli_objects_color(depsgraph, scene, view_layer, ar, v3d, base, dflag_depth, TH_UNDEFINED); } - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, dflag_depth); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, dflag_depth); } } @@ -1237,7 +1239,7 @@ void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, if (v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) { glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */ for (v3da = v3d->afterdraw_xray.first; v3da; v3da = v3da->next) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, dflag_depth); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, dflag_depth); } glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */ } @@ -1246,21 +1248,21 @@ void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, v3d->xray = false; v3d->transp = true; while ((v3da = BLI_pophead(&v3d->afterdraw_transp))) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, dflag_depth); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, dflag_depth); MEM_freeN(v3da); } v3d->xray = true; v3d->transp = false; while ((v3da = BLI_pophead(&v3d->afterdraw_xray))) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, dflag_depth); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, dflag_depth); MEM_freeN(v3da); } v3d->xray = true; v3d->transp = true; while ((v3da = BLI_pophead(&v3d->afterdraw_xraytransp))) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, v3da->base, dflag_depth); + draw_object(depsgraph, scene, view_layer, ar, v3d, v3da->base, dflag_depth); MEM_freeN(v3da); } @@ -1273,7 +1275,7 @@ void ED_view3d_draw_depth_loop(const EvaluationContext *eval_ctx, Scene *scene, } void ED_view3d_draw_select_loop( - const struct EvaluationContext *eval_ctx, ViewContext *vc, Scene *scene, ViewLayer *view_layer, + struct Depsgraph *depsgraph, ViewContext *vc, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, bool use_obedit_skip, bool use_nearest) { struct bThemeState theme_state; @@ -1286,12 +1288,12 @@ void ED_view3d_draw_select_loop( UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW); if (vc->obedit && vc->obedit->type == OB_MBALL) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, BASACT(view_layer), dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, BASACT(view_layer), dflag); } else if ((vc->obedit && vc->obedit->type == OB_ARMATURE)) { /* if not drawing sketch, draw bones */ if (!BDR_drawSketchNames(vc)) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, BASACT(view_layer), dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, BASACT(view_layer), dflag); } } else { @@ -1312,7 +1314,7 @@ void ED_view3d_draw_select_loop( } else { if (GPU_select_load_id(code)) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, dflag); } } code++; @@ -1323,7 +1325,7 @@ void ED_view3d_draw_select_loop( if (use_nearest) { bool xrayclear = true; if (v3d->afterdraw_xray.first) { - view3d_draw_xray_select(eval_ctx, scene, view_layer, ar, v3d, &xrayclear); + view3d_draw_xray_select(depsgraph, scene, view_layer, ar, v3d, &xrayclear); } } } @@ -1363,8 +1365,9 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, } } -static void gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) +static void gpu_update_lamps_shadows_world(Depsgraph *depsgraph, Scene *scene, View3D *v3d) { + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); ListBase shadows; Scene *sce_iter; Base *base; @@ -1381,7 +1384,7 @@ static void gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Sc if (ob->transflag & OB_DUPLI) { DupliObject *dob; - ListBase *lb = object_duplilist(G.main->eval_ctx, scene, ob); + ListBase *lb = object_duplilist(depsgraph, scene, ob); for (dob = lb->first; dob; dob = dob->next) if (dob->ob->type == OB_LAMP) @@ -1424,7 +1427,7 @@ static void gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Sc /* no need to call ED_view3d_draw_offscreen_init since shadow buffers were already updated */ ED_view3d_draw_offscreen( - eval_ctx, scene, eval_ctx->view_layer, engine_type, + depsgraph, scene, view_layer, engine_type, v3d, &ar, winsize, winsize, viewmat, winmat, false, false, true, NULL, NULL, NULL, NULL); @@ -1498,13 +1501,12 @@ CustomDataMask ED_view3d_screen_datamask(const Scene *scene, const bScreen *scre */ static void view3d_draw_objects( const bContext *C, - const EvaluationContext *eval_ctx, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, const bool do_bgpic, const bool draw_offscreen) { ViewLayer *view_layer = C ? CTX_data_view_layer(C) : BKE_view_layer_from_scene_get(scene); - Depsgraph *depsgraph = CTX_data_depsgraph(C); RegionView3D *rv3d = ar->regiondata; Base *base; Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); @@ -1563,10 +1565,10 @@ static void view3d_draw_objects( for (SETLOOPER(scene->set, sce_iter, base)) { if ((base->flag & BASE_VISIBLED) != 0) { UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f); - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, dflag); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, dflag); if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects_color(eval_ctx, scene, view_layer, ar, v3d, base, dflag, TH_UNDEFINED); + draw_dupli_objects_color(depsgraph, scene, view_layer, ar, v3d, base, dflag, TH_UNDEFINED); } } } @@ -1579,10 +1581,10 @@ static void view3d_draw_objects( if ((base->flag & BASE_VISIBLED) != 0) { /* dupli drawing */ if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects(eval_ctx, scene, view_layer, ar, v3d, base); + draw_dupli_objects(depsgraph, scene, view_layer, ar, v3d, base); } - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, 0); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, 0); } } } @@ -1597,11 +1599,11 @@ static void view3d_draw_objects( /* dupli drawing */ if (base->object->transflag & OB_DUPLI) { - draw_dupli_objects(eval_ctx, scene, view_layer, ar, v3d, base); + draw_dupli_objects(depsgraph, scene, view_layer, ar, v3d, base); } if ((base->flag & BASE_SELECTED) == 0) { if (base->object != obedit) - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, 0); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, 0); } } } @@ -1613,7 +1615,7 @@ static void view3d_draw_objects( for (base = view_layer->object_bases.first; base; base = base->next) { if ((base->flag & BASE_VISIBLED) != 0) { if (base->object == obedit || (base->flag & BASE_SELECTED)) { - draw_object(eval_ctx, scene, view_layer, ar, v3d, base, 0); + draw_object(depsgraph, scene, view_layer, ar, v3d, base, 0); } } } @@ -1635,10 +1637,10 @@ static void view3d_draw_objects( } /* transp and X-ray afterdraw stuff */ - if (v3d->afterdraw_transp.first) view3d_draw_transp(eval_ctx, scene, view_layer, ar, v3d); + if (v3d->afterdraw_transp.first) view3d_draw_transp(depsgraph, scene, view_layer, ar, v3d); - if (v3d->afterdraw_xray.first) view3d_draw_xray(eval_ctx, scene, view_layer, ar, v3d, &xrayclear); - if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(eval_ctx, scene, view_layer, ar, v3d, xrayclear); + if (v3d->afterdraw_xray.first) view3d_draw_xray(depsgraph, scene, view_layer, ar, v3d, &xrayclear); + if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(depsgraph, scene, view_layer, ar, v3d, xrayclear); if (!draw_offscreen) { ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); @@ -1768,7 +1770,7 @@ static bool view3d_main_region_do_render_draw(const Scene *scene) return (type && type->view_update && type->render_to_view); } -bool ED_view3d_calc_render_border(const Scene *scene, const Depsgraph *depsgraph, View3D *v3d, ARegion *ar, rcti *rect) +bool ED_view3d_calc_render_border(const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *ar, rcti *rect) { RegionView3D *rv3d = ar->regiondata; bool use_border; @@ -1814,11 +1816,10 @@ bool ED_view3d_calc_render_border(const Scene *scene, const Depsgraph *depsgraph * be mirrored in view3d_draw_render_draw() in view3d_draw.c */ static bool view3d_main_region_draw_engine( - const bContext *C, const EvaluationContext *eval_ctx, Scene *scene, + const bContext *C, Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d, bool clip_border, const rcti *border_rect) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); RegionView3D *rv3d = ar->regiondata; RenderEngineType *type; GLint scissor[4]; @@ -1842,7 +1843,7 @@ static bool view3d_main_region_draw_engine( } /* setup view matrices */ - VP_legacy_view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, NULL, NULL); + VP_legacy_view3d_main_region_setup_view(depsgraph, scene, v3d, ar, NULL, NULL); /* background draw */ ED_region_pixelspace(ar); @@ -1941,15 +1942,13 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie ARegion *ar, const char **grid_unit) { wmWindow *win = CTX_wm_window(C); - EvaluationContext eval_ctx; + Depsgraph *depsgraph = CTX_data_depsgraph(C); RegionView3D *rv3d = ar->regiondata; unsigned int lay_used = v3d->lay_used; - CTX_data_eval_ctx(C, &eval_ctx); - /* shadow buffers, before we setup matrices */ if (draw_glsl_material(scene, view_layer, NULL, v3d, v3d->drawtype)) - gpu_update_lamps_shadows_world(&eval_ctx, scene, v3d); + gpu_update_lamps_shadows_world(depsgraph, scene, v3d); /* reset default OpenGL lights if needed (i.e. after preferences have been altered) */ if (rv3d->rflag & RV3D_GPULIGHT_UPDATE) { @@ -1959,10 +1958,10 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie /* setup the view matrix */ if (VP_legacy_view3d_stereo3d_active(win, scene, v3d, rv3d)) { - VP_legacy_view3d_stereo3d_setup(&eval_ctx, scene, v3d, ar); + VP_legacy_view3d_stereo3d_setup(depsgraph, scene, v3d, ar); } else { - VP_legacy_view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, NULL, NULL); + VP_legacy_view3d_main_region_setup_view(depsgraph, scene, v3d, ar, NULL, NULL); } rv3d->rflag &= ~RV3D_IS_GAME_ENGINE; @@ -1976,7 +1975,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie #endif /* main drawing call */ - view3d_draw_objects(C, &eval_ctx, scene, v3d, ar, grid_unit, true, false); + view3d_draw_objects(C, depsgraph, scene, v3d, ar, grid_unit, true, false); if (v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */ /* find header and force tag redraw */ @@ -1994,7 +1993,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene, ARegion *ar, View3D *v3d, const char *grid_unit, bool render_border) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); ViewLayer *view_layer = CTX_data_view_layer(C); wmWindowManager *wm = CTX_wm_manager(C); RegionView3D *rv3d = ar->regiondata; @@ -2004,7 +2003,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene, ED_region_visible_rect(ar, &rect); if (rv3d->persp == RV3D_CAMOB) { - VP_drawviewborder(scene, CTX_data_depsgraph(C), ar, v3d); + VP_drawviewborder(scene, depsgraph, ar, v3d); } else if (v3d->flag2 & V3D_RENDER_BORDER) { VP_drawrenderborder(ar, v3d); @@ -2059,8 +2058,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene, void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); - EvaluationContext eval_ctx; + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); @@ -2077,8 +2075,6 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) gpuPushMatrix(); gpuLoadIdentity(); - CTX_data_eval_ctx(C, &eval_ctx); - /* draw viewport using opengl */ if (v3d->drawtype != OB_RENDER || !view3d_main_region_do_render_draw(scene) || clip_border) { VP_view3d_main_region_clear(scene, v3d, ar); /* background */ @@ -2093,10 +2089,10 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) /* draw viewport using external renderer */ if (v3d->drawtype == OB_RENDER) { - view3d_main_region_draw_engine(C, &eval_ctx, scene, ar, v3d, clip_border, &border_rect); + view3d_main_region_draw_engine(C, depsgraph, scene, ar, v3d, clip_border, &border_rect); } - VP_legacy_view3d_main_region_setup_view(&eval_ctx, scene, v3d, ar, NULL, NULL); + VP_legacy_view3d_main_region_setup_view(depsgraph, scene, v3d, ar, NULL, NULL); glClear(GL_DEPTH_BUFFER_BIT); WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_3D); @@ -2130,17 +2126,17 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) void VP_deprecated_view3d_draw_objects( const bContext *C, - const EvaluationContext *eval_ctx, + Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, const bool do_bgpic, const bool draw_offscreen) { - view3d_draw_objects(C, eval_ctx, scene, v3d, ar, grid_unit, do_bgpic, draw_offscreen); + view3d_draw_objects(C, depsgraph, scene, v3d, ar, grid_unit, do_bgpic, draw_offscreen); } -void VP_deprecated_gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) +void VP_deprecated_gpu_update_lamps_shadows_world(Depsgraph *depsgraph, Scene *scene, View3D *v3d) { - gpu_update_lamps_shadows_world(eval_ctx, scene, v3d); + gpu_update_lamps_shadows_world(depsgraph, scene, v3d); } /** \} */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 4a50cbcd12a..a2066ee51c7 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -377,18 +377,15 @@ static void viewops_data_create( /* we need the depth info before changing any viewport options */ if (viewops_flag & VIEWOPS_FLAG_DEPTH_NAVIGATE) { - EvaluationContext eval_ctx; struct Depsgraph *graph = CTX_data_depsgraph(C); float fallback_depth_pt[3]; - CTX_data_eval_ctx(C, &eval_ctx); - view3d_operator_needs_opengl(C); /* needed for zbuf drawing */ negate_v3_v3(fallback_depth_pt, rv3d->ofs); vod->use_dyn_ofs = ED_view3d_autodist( - &eval_ctx, graph, vod->ar, vod->v3d, + graph, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true, fallback_depth_pt); } else { @@ -1800,7 +1797,7 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf) * \param zoom_xy: Optionally zoom to window location (coords compatible w/ #wmEvent.x, y). Use when not NULL. */ static void view_zoom_to_window_xy_camera( - Scene *scene, const Depsgraph *depsgraph, View3D *v3d, + Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *ar, float dfac, const int zoom_xy[2]) { RegionView3D *rv3d = ar->regiondata; @@ -2117,7 +2114,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event) static int viewzoom_exec(bContext *C, wmOperator *op) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); View3D *v3d; RegionView3D *rv3d; @@ -2795,6 +2792,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); ViewLayer *view_layer = CTX_data_view_layer(C); bGPdata *gpd = CTX_data_gpencil_data(C); const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)); @@ -2873,7 +2871,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) } /* account for duplis */ - if (BKE_object_minmax_dupli(scene, base->object, min, max, false) == 0) + if (BKE_object_minmax_dupli(depsgraph, scene, base->object, min, max, false) == 0) BKE_object_minmax(base->object, min, max, false); /* use if duplis not found */ ok = 1; @@ -3066,18 +3064,15 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev ARegion *ar = CTX_wm_region(C); if (rv3d) { - EvaluationContext eval_ctx; struct Depsgraph *graph = CTX_data_depsgraph(C); float new_ofs[3]; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); - CTX_data_eval_ctx(C, &eval_ctx); - ED_view3d_smooth_view_force_finish(C, v3d, ar); view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, event->mval, new_ofs, false, NULL)) { + if (ED_view3d_autodist(graph, ar, v3d, event->mval, new_ofs, false, NULL)) { /* pass */ } else { @@ -3117,7 +3112,7 @@ void VIEW3D_OT_view_center_pick(wmOperatorType *ot) static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); float xfac, yfac; float size[2]; @@ -3201,7 +3196,7 @@ void VIEW3D_OT_view_center_lock(wmOperatorType *ot) static int render_border_exec(bContext *C, wmOperator *op) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); View3D *v3d = CTX_wm_view3d(C); ARegion *ar = CTX_wm_region(C); RegionView3D *rv3d = ED_view3d_context_rv3d(C); @@ -3356,7 +3351,6 @@ void VIEW3D_OT_clear_render_border(wmOperatorType *ot) static int view3d_zoom_border_exec(bContext *C, wmOperator *op) { - EvaluationContext eval_ctx; ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); @@ -3378,8 +3372,6 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* note; otherwise opengl won't work */ view3d_operator_needs_opengl(C); - CTX_data_eval_ctx(C, &eval_ctx); - /* get border select values using rna */ WM_operator_properties_border_to_rcti(op, &rect); @@ -3389,7 +3381,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ED_view3d_dist_range_get(v3d, dist_range); /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(&eval_ctx, CTX_data_depsgraph(C), ar, v3d, true); + ED_view3d_draw_depth(CTX_data_depsgraph(C), ar, v3d, true); { /* avoid allocating the whole depth buffer */ @@ -3529,7 +3521,7 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) * Sets the view to 1:1 camera/render-pixel. * \{ */ -static void view3d_set_1_to_1_viewborder(Scene *scene, const Depsgraph *depsgraph, ARegion *ar, View3D *v3d) +static void view3d_set_1_to_1_viewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View3D *v3d) { RegionView3D *rv3d = ar->regiondata; float size[2]; @@ -3543,7 +3535,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, const Depsgraph *depsgrap static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op)) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); View3D *v3d; @@ -4548,13 +4540,10 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2]) } if (U.uiflag & USER_DEPTH_CURSOR) { /* maybe this should be accessed some other way */ - EvaluationContext eval_ctx; struct Depsgraph *graph = CTX_data_depsgraph(C); - CTX_data_eval_ctx(C, &eval_ctx); - view3d_operator_needs_opengl(C); - if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval, fp, true, NULL)) { + if (ED_view3d_autodist(graph, ar, v3d, mval, fp, true, NULL)) { depth_used = true; } } diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index d2aa19509d7..3715f4672d7 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -195,7 +195,7 @@ typedef struct FlyInfo { RegionView3D *rv3d; View3D *v3d; ARegion *ar; - const struct Depsgraph *depsgraph; + struct Depsgraph *depsgraph; Scene *scene; wmTimer *timer; /* needed for redraws */ @@ -346,9 +346,6 @@ enum { static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); rctf viewborder; @@ -425,7 +422,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent } fly->v3d_camera_control = ED_view3d_cameracontrol_acquire( - &eval_ctx, fly->scene, fly->v3d, fly->rv3d, + CTX_data_depsgraph(C), fly->scene, fly->v3d, fly->rv3d, (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0); /* calculate center */ diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 0f56f1265bc..4b005185638 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -40,6 +40,7 @@ struct ARegionType; struct Base; struct BoundBox; struct Gwn_Batch; +struct Depsgraph; struct DerivedMesh; struct Object; struct SmokeDomainSettings; @@ -148,17 +149,17 @@ void draw_motion_paths_cleanup(View3D *v3d); /* drawobject.c */ void draw_object( - const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, struct ARegion *ar, View3D *v3d, + struct Depsgraph *depsgraph, Scene *scene, struct ViewLayer *view_layer, struct ARegion *ar, View3D *v3d, struct Base *base, const short dflag); void draw_object_select( - const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, struct ARegion *ar, View3D *v3d, + struct Depsgraph *depsgraph, Scene *scene, struct ViewLayer *view_layer, struct ARegion *ar, View3D *v3d, Base *base, const short dflag); void draw_mesh_object_outline(View3D *v3d, struct Object *ob, struct DerivedMesh *dm, const unsigned char ob_wire_col[4]); bool draw_glsl_material(Scene *scene, struct ViewLayer *view_layer, struct Object *ob, View3D *v3d, const char dt); -void draw_object_instance(const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline, const float wire_col[4]); -void draw_object_backbufsel(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); +void draw_object_instance(struct Depsgraph *depsgraph, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline, const float wire_col[4]); +void draw_object_backbufsel(struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); void draw_object_wire_color(struct ViewLayer *, Base *base, unsigned char r_ob_wire_col[4]); void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const unsigned char color[4]); @@ -191,7 +192,7 @@ int view3d_effective_drawtype(const struct View3D *v3d); /* drawarmature.c */ bool draw_armature( - const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, + struct Depsgraph *depsgraph, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base, const short dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_outline); @@ -220,19 +221,19 @@ void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar); void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar, const int offset); void ED_view3d_draw_depth( - const struct EvaluationContext *eval_ctx, struct Depsgraph *graph, + struct Depsgraph *depsgraph, struct ARegion *ar, View3D *v3d, bool alphaoverride); /* view3d_draw_legacy.c */ void view3d_main_region_draw_legacy(const struct bContext *C, struct ARegion *ar); -void ED_view3d_draw_depth_gpencil(const struct EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d); +void ED_view3d_draw_depth_gpencil(struct Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d); void ED_view3d_draw_select_loop( - const struct EvaluationContext *eval_ctx, ViewContext *vc, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, ARegion *ar, + struct Depsgraph *depsgraph, ViewContext *vc, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, ARegion *ar, bool use_obedit_skip, bool use_nearest); void ED_view3d_draw_depth_loop( - const struct EvaluationContext *eval_ctx, Scene *scene, ARegion *ar, View3D *v3d); + struct Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d); void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag); @@ -278,10 +279,10 @@ void ED_view3d_smooth_view_force_finish( struct View3D *v3d, struct ARegion *ar); void view3d_winmatrix_set( - const struct Depsgraph *depsgraph, + struct Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, const rcti *rect); void view3d_viewmatrix_set( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2]); void fly_modal_keymap(struct wmKeyConfig *keyconf); @@ -297,7 +298,7 @@ void view3d_buttons_register(struct ARegionType *art); /* view3d_camera_control.c */ struct View3DCameraControl *ED_view3d_cameracontrol_acquire( - const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, + struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d, const bool use_parent_root); void ED_view3d_cameracontrol_update( struct View3DCameraControl *vctrl, @@ -373,22 +374,22 @@ void VP_legacy_draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect); void VP_legacy_draw_selected_name(Scene *scene, struct Object *ob, rcti *rect); void VP_legacy_drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit); void VP_legacy_drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool write_depth); -void VP_legacy_view3d_main_region_setup_view(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]); +void VP_legacy_view3d_main_region_setup_view(struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]); bool VP_legacy_view3d_stereo3d_active(struct wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d); -void VP_legacy_view3d_stereo3d_setup(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar); -void draw_dupli_objects(const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base); +void VP_legacy_view3d_stereo3d_setup(struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar); +void draw_dupli_objects(struct Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Base *base); bool VP_legacy_use_depth(View3D *v3d, struct Object *obedit); -void VP_drawviewborder(Scene *scene, const struct Depsgraph *depsgraph, ARegion *ar, View3D *v3d); +void VP_drawviewborder(Scene *scene, struct Depsgraph *depsgraph, ARegion *ar, View3D *v3d); void VP_drawrenderborder(ARegion *ar, View3D *v3d); void VP_view3d_draw_background_none(void); void VP_view3d_draw_background_world(Scene *scene, RegionView3D *rv3d); void VP_view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar); /* temporary legacy calls, only when there is a switch between new/old draw calls */ -void VP_deprecated_gpu_update_lamps_shadows_world(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d); +void VP_deprecated_gpu_update_lamps_shadows_world(struct Depsgraph *depsgraph, Scene *scene, View3D *v3d); void VP_deprecated_view3d_draw_objects( const struct bContext *C, - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, const bool do_bgpic, const bool draw_offscreen); diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 4f80270e1e7..35127c7c8c6 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -107,14 +107,14 @@ static void meshobject_foreachScreenVert__mapFunc(void *userData, int index, con } void meshobject_foreachScreenVert( - const EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, void (*func)(void *userData, MVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag) { foreachScreenObjectVert_userData data; DerivedMesh *dm; - dm = mesh_get_derived_deform(eval_ctx, vc->scene, vc->obact, CD_MASK_BAREMESH); + dm = mesh_get_derived_deform(vc->depsgraph, vc->scene, vc->obact, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); @@ -150,14 +150,14 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenVert( - const EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, void (*func)(void *userData, BMVert *eve, const float screen_co[2], int index), void *userData, eV3DProjTest clip_flag) { foreachScreenVert_userData data; DerivedMesh *dm; - dm = editbmesh_get_derived_cage(eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); @@ -206,14 +206,14 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenEdge( - const EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, void (*func)(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index), void *userData, eV3DProjTest clip_flag) { foreachScreenEdge_userData data; DerivedMesh *dm; - dm = editbmesh_get_derived_cage(eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); @@ -254,14 +254,14 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const flo } void mesh_foreachScreenFace( - const EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, void (*func)(void *userData, BMFace *efa, const float screen_co_b[2], int index), void *userData, const eV3DProjTest clip_flag) { foreachScreenFace_userData data; DerivedMesh *dm; - dm = editbmesh_get_derived_cage(eval_ctx, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH); ED_view3d_check_mats_rv3d(vc->rv3d); diff --git a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c index 2e289770f13..cdbb867321e 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c @@ -277,7 +277,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state) } else if (state == RULER_STATE_DRAG) { ruler_info->snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), CTX_data_scene(C), CTX_data_view_layer(C), 0, + CTX_data_main(C), CTX_data_scene(C), 0, ruler_info->ar, CTX_wm_view3d(C)); } else { diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index ba3e78b25b9..8a52542b2fb 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -309,7 +309,7 @@ float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_f } static void view3d_win_to_ray_segment( - const struct Depsgraph *depsgraph, + struct Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_dir[3], float r_ray_start[3], float r_ray_end[3]) { @@ -366,7 +366,7 @@ bool ED_view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float * \return success, false if the ray is totally clipped. */ bool ED_view3d_win_to_ray_ex( - const struct Depsgraph *depsgraph, + struct Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip) { @@ -396,7 +396,7 @@ bool ED_view3d_win_to_ray_ex( * \return success, false if the ray is totally clipped. */ bool ED_view3d_win_to_ray( - const struct Depsgraph *depsgraph, + struct Depsgraph *depsgraph, const ARegion *ar, const View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_normal[3], const bool do_clip) { @@ -630,7 +630,7 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3 * \param do_clip Optionally clip the ray by the view clipping planes. * \return success, false if the segment is totally clipped. */ -bool ED_view3d_win_to_segment(const struct Depsgraph *depsgraph, +bool ED_view3d_win_to_segment(struct Depsgraph *depsgraph, const ARegion *ar, View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_end[3], const bool do_clip) { diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index f61aad2806e..36b626bbd97 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -282,7 +282,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state) } else if (state == RULER_STATE_DRAG) { ruler_info->snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), CTX_data_scene(C), CTX_data_view_layer(C), 0, + CTX_data_main(C), CTX_data_scene(C), 0, ruler_info->ar, CTX_wm_view3d(C)); } else { diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 56f69394765..adf41fcf5af 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -487,7 +487,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, cons } static void do_lasso_select_mesh( - const struct EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) { LassoSelectUserData data; @@ -509,24 +509,24 @@ static void do_lasso_select_mesh( ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); gpuLoadMatrix(vc->rv3d->viewmat); - bbsel = EDBM_backbuf_border_mask_init(eval_ctx, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + bbsel = EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); if (ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { edbm_backbuf_check_and_select_verts(vc->em, select); } else { - mesh_foreachScreenVert(eval_ctx, vc, do_lasso_select_mesh__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } if (ts->selectmode & SCE_SELECT_EDGE) { /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; - mesh_foreachScreenEdge(eval_ctx, vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); if (data.is_done == false) { data.pass = 1; - mesh_foreachScreenEdge(eval_ctx, vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); } } @@ -535,7 +535,7 @@ static void do_lasso_select_mesh( edbm_backbuf_check_and_select_faces(vc->em, select); } else { - mesh_foreachScreenFace(eval_ctx, vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -734,7 +734,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv, SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT); } } -static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) +static void do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) { const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0; Object *ob = vc->obact; @@ -752,7 +752,7 @@ static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, if (use_zbuf) { bm_vertoffs = me->totvert + 1; /* max index array */ - EDBM_backbuf_border_mask_init(eval_ctx, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); edbm_backbuf_check_and_select_verts_obmode(me, select); @@ -765,7 +765,7 @@ static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); - meshobject_foreachScreenVert(eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + meshobject_foreachScreenVert(vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } @@ -774,7 +774,7 @@ static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, } paintvert_flush_flags(ob); } -static void do_lasso_select_paintface(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) +static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select) { Object *ob = vc->obact; Mesh *me = ob->data; @@ -789,7 +789,7 @@ static void do_lasso_select_paintface(const struct EvaluationContext *eval_ctx, bm_vertoffs = me->totpoly + 1; /* max index array */ BLI_lasso_boundbox(&rect, mcords, moves); - EDBM_backbuf_border_mask_init(eval_ctx, vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); + EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); edbm_backbuf_check_and_select_tfaces(me, select); @@ -836,15 +836,12 @@ static void view3d_lasso_select( { Object *ob = CTX_data_active_object(C); - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); - if (vc->obedit == NULL) { /* Object Mode */ if (BKE_paint_select_face_test(ob)) { - do_lasso_select_paintface(&eval_ctx, vc, mcords, moves, extend, select); + do_lasso_select_paintface(vc, mcords, moves, extend, select); } else if (BKE_paint_select_vert_test(ob)) { - do_lasso_select_paintvert(&eval_ctx, vc, mcords, moves, extend, select); + do_lasso_select_paintvert(vc, mcords, moves, extend, select); } else if (ob && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) { /* pass */ @@ -859,12 +856,12 @@ static void view3d_lasso_select( } else { /* Edit Mode */ - FOREACH_OBJECT_IN_MODE_BEGIN (eval_ctx.view_layer, ob->mode, ob_iter) { + FOREACH_OBJECT_IN_MODE_BEGIN (vc->view_layer, ob->mode, ob_iter) { ED_view3d_viewcontext_init_object(vc, ob_iter); switch (vc->obedit->type) { case OB_MESH: - do_lasso_select_mesh(&eval_ctx, vc, mcords, moves, extend, select); + do_lasso_select_mesh(vc, mcords, moves, extend, select); break; case OB_CURVE: case OB_SURF: @@ -1168,7 +1165,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits15, const /* we want a select buffer with bones, if there are... */ /* so check three selection levels and compare */ static int mixed_bones_object_selectbuffer( - const EvaluationContext *eval_ctx, ViewContext *vc, unsigned int *buffer, const int mval[2], + ViewContext *vc, unsigned int *buffer, const int mval[2], bool use_cycle, bool enumerate, bool *r_do_nearest) { @@ -1208,7 +1205,7 @@ static int mixed_bones_object_selectbuffer( view3d_opengl_select_cache_begin(); BLI_rcti_init_pt_radius(&rect, mval, 14); - hits15 = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, &rect, select_mode); + hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode); if (hits15 == 1) { hits = selectbuffer_ret_hits_15(buffer, hits15); goto finally; @@ -1219,7 +1216,7 @@ static int mixed_bones_object_selectbuffer( offs = 4 * hits15; BLI_rcti_init_pt_radius(&rect, mval, 9); - hits9 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); + hits9 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); if (hits9 == 1) { hits = selectbuffer_ret_hits_9(buffer, hits15, hits9); goto finally; @@ -1229,7 +1226,7 @@ static int mixed_bones_object_selectbuffer( offs += 4 * hits9; BLI_rcti_init_pt_radius(&rect, mval, 5); - hits5 = view3d_opengl_select(eval_ctx, vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); + hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect, select_mode); if (hits5 == 1) { hits = selectbuffer_ret_hits_5(buffer, hits15, hits9, hits5); goto finally; @@ -1342,7 +1339,6 @@ static Base *mouse_select_eval_buffer( /* mval comes from event->mval, only use within region handlers */ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) { - EvaluationContext eval_ctx; ViewContext vc; Base *basact = NULL; unsigned int buffer[MAXPICKBUF]; @@ -1352,10 +1348,9 @@ 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); - CTX_data_eval_ctx(C, &eval_ctx); ED_view3d_viewcontext_init(C, &vc); - hits = mixed_bones_object_selectbuffer(&eval_ctx, &vc, buffer, mval, false, false, &do_nearest); + hits = mixed_bones_object_selectbuffer(&vc, buffer, mval, false, false, &do_nearest); if (hits > 0) { const bool has_bones = selectbuffer_has_bones(buffer, hits); @@ -1389,7 +1384,6 @@ static bool ed_object_select_pick( bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool obcenter, bool enumerate, bool object) { - EvaluationContext eval_ctx; ViewContext vc; ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); @@ -1403,7 +1397,6 @@ static bool ed_object_select_pick( /* setup view context for argument to callbacks */ - CTX_data_eval_ctx(C, &eval_ctx); ED_view3d_viewcontext_init(C, &vc); is_obedit = (vc.obedit != NULL); @@ -1458,7 +1451,7 @@ static bool ed_object_select_pick( // TIMEIT_START(select_time); /* if objects have posemode set, the bones are in the same selection buffer */ - hits = mixed_bones_object_selectbuffer(&eval_ctx, &vc, buffer, mval, true, enumerate, &do_nearest); + hits = mixed_bones_object_selectbuffer(&vc, buffer, mval, true, enumerate, &do_nearest); // TIMEIT_END(select_time); @@ -1658,7 +1651,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con } } static int do_paintvert_box_select( - const EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend) + ViewContext *vc, rcti *rect, bool select, bool extend) { const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0; Mesh *me; @@ -1682,7 +1675,7 @@ static int do_paintvert_box_select( if (use_zbuf) { selar = MEM_callocN(me->totvert + 1, "selar"); - ED_view3d_backbuf_validate(eval_ctx, vc); + ED_view3d_backbuf_validate(vc); ibuf = IMB_allocImBuf(size[0], size[1], 32, IB_rect); rt = ibuf->rect; @@ -1730,7 +1723,7 @@ static int do_paintvert_box_select( ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); - meshobject_foreachScreenVert(eval_ctx, vc, do_paintvert_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + meshobject_foreachScreenVert(vc, do_paintvert_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } if (select == false) { @@ -1848,7 +1841,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const } } static int do_mesh_box_select( - const struct EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend) + ViewContext *vc, rcti *rect, bool select, bool extend) { BoxSelectUserData data; ToolSettings *ts = vc->scene->toolsettings; @@ -1863,25 +1856,25 @@ static int do_mesh_box_select( ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); gpuLoadMatrix(vc->rv3d->viewmat); - bbsel = EDBM_backbuf_border_init(eval_ctx, vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); + bbsel = EDBM_backbuf_border_init(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); if (ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { edbm_backbuf_check_and_select_verts(vc->em, select); } else { - mesh_foreachScreenVert(eval_ctx, vc, do_mesh_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } if (ts->selectmode & SCE_SELECT_EDGE) { /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; - mesh_foreachScreenEdge(eval_ctx, vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); if (data.is_done == 0) { data.pass = 1; - mesh_foreachScreenEdge(eval_ctx, vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); } } @@ -1890,7 +1883,7 @@ static int do_mesh_box_select( edbm_backbuf_check_and_select_faces(vc->em, select); } else { - mesh_foreachScreenFace(eval_ctx, vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -1902,7 +1895,7 @@ static int do_mesh_box_select( } static int do_meta_box_select( - const struct EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, const rcti *rect, bool select, bool extend) { MetaBall *mb = (MetaBall *)vc->obedit->data; @@ -1912,7 +1905,7 @@ static int do_meta_box_select( unsigned int buffer[MAXPICKBUF]; int hits; - hits = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); + hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); if (extend == false && select) BKE_mball_deselect_all(mb); @@ -1938,7 +1931,7 @@ static int do_meta_box_select( } static int do_armature_box_select( - const struct EvaluationContext *eval_ctx, ViewContext *vc, + ViewContext *vc, const rcti *rect, bool select, bool extend) { int a; @@ -1946,10 +1939,10 @@ static int do_armature_box_select( unsigned int buffer[MAXPICKBUF]; int hits; - hits = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); + hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL); uint objects_len = 0; - Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(eval_ctx->view_layer, &objects_len); + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(vc->view_layer, &objects_len); /* clear flag we use to detect point was affected */ for (uint ob_index = 0; ob_index < objects_len; ob_index++) { @@ -2063,14 +2056,11 @@ static int opengl_bone_select_buffer_cmp(const void *sel_a_p, const void *sel_b_ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) { - EvaluationContext eval_ctx; unsigned int *vbuffer = NULL; /* selection buffer */ int bone_only; int totobj = MAXPICKBUF; /* XXX solve later */ int hits; - CTX_data_eval_ctx(C, &eval_ctx); - if (vc->obact && (vc->obact->mode & OB_MODE_POSE)) bone_only = 1; else @@ -2078,7 +2068,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b if (extend == false && select) { if (bone_only) { - FOREACH_OBJECT_IN_MODE_BEGIN (eval_ctx.view_layer, OB_MODE_POSE, ob_iter) { + FOREACH_OBJECT_IN_MODE_BEGIN (vc->view_layer, OB_MODE_POSE, ob_iter) { bArmature *arm = ob_iter->data; for (bPoseChannel *pchan = ob_iter->pose->chanbase.first; pchan; pchan = pchan->next) { if (PBONE_VISIBLE(arm, pchan->bone)) { @@ -2097,7 +2087,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b /* selection buffer now has bones potentially too, so we add MAXPICKBUF */ vbuffer = MEM_mallocN(4 * (totobj + MAXPICKELEMS) * sizeof(unsigned int), "selection buffer"); - hits = view3d_opengl_select(&eval_ctx, vc, vbuffer, 4 * (totobj + MAXPICKELEMS), rect, VIEW3D_SELECT_ALL); + hits = view3d_opengl_select(vc, vbuffer, 4 * (totobj + MAXPICKELEMS), rect, VIEW3D_SELECT_ALL); /* * LOGIC NOTES (theeth): * The buffer and ListBase have the same relative order, which makes the selection @@ -2194,7 +2184,6 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b static int view3d_borderselect_exec(bContext *C, wmOperator *op) { - EvaluationContext eval_ctx; ViewContext vc; rcti rect; bool extend; @@ -2205,7 +2194,6 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) view3d_operator_needs_opengl(C); /* setup view context for argument to callbacks */ - CTX_data_eval_ctx(C, &eval_ctx); ED_view3d_viewcontext_init(C, &vc); select = !RNA_boolean_get(op->ptr, "deselect"); @@ -2214,13 +2202,13 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) if (vc.obedit) { - FOREACH_OBJECT_IN_MODE_BEGIN (eval_ctx.view_layer, vc.obedit->mode, ob_iter) { + FOREACH_OBJECT_IN_MODE_BEGIN (vc.view_layer, vc.obedit->mode, ob_iter) { ED_view3d_viewcontext_init_object(&vc, ob_iter); switch (vc.obedit->type) { case OB_MESH: vc.em = BKE_editmesh_from_object(vc.obedit); - ret |= do_mesh_box_select(&eval_ctx, &vc, &rect, select, extend); + ret |= do_mesh_box_select(&vc, &rect, select, extend); if (ret & OPERATOR_FINISHED) { WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data); } @@ -2233,13 +2221,13 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) } break; case OB_MBALL: - ret |= do_meta_box_select(&eval_ctx, &vc, &rect, select, extend); + ret |= do_meta_box_select(&vc, &rect, select, extend); if (ret & OPERATOR_FINISHED) { WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data); } break; case OB_ARMATURE: - ret |= do_armature_box_select(&eval_ctx, &vc, &rect, select, extend); + ret |= do_armature_box_select(&vc, &rect, select, extend); if (ret & OPERATOR_FINISHED) { WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, vc.obedit); } @@ -2262,10 +2250,10 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) ret |= ED_sculpt_mask_box_select(C, &vc, &rect, select, extend); } else if (vc.obact && BKE_paint_select_face_test(vc.obact)) { - ret |= do_paintface_box_select(&eval_ctx, &vc, &rect, select, extend); + ret |= do_paintface_box_select(&vc, &rect, select, extend); } else if (vc.obact && BKE_paint_select_vert_test(vc.obact)) { - ret |= do_paintvert_box_select(&eval_ctx, &vc, &rect, select, extend); + ret |= do_paintvert_box_select(&vc, &rect, select, extend); } else if (vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) { ret |= PE_border_select(C, &rect, select, extend); @@ -2518,13 +2506,13 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float sc } } -static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) +static void mesh_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad) { ToolSettings *ts = vc->scene->toolsettings; int bbsel; CircleSelectUserData data; - bbsel = EDBM_backbuf_circle_init(eval_ctx, vc, mval[0], mval[1], (short)(rad + 1.0f)); + bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ vc->em = BKE_editmesh_from_object(vc->obedit); @@ -2536,7 +2524,7 @@ static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewCon edbm_backbuf_check_and_select_verts(vc->em, select); } else { - mesh_foreachScreenVert(eval_ctx, vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -2545,7 +2533,7 @@ static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewCon edbm_backbuf_check_and_select_edges(vc->em, select); } else { - mesh_foreachScreenEdge(eval_ctx, vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); + mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR); } } @@ -2554,7 +2542,7 @@ static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewCon edbm_backbuf_check_and_select_faces(vc->em, select); } else { - mesh_foreachScreenFace(eval_ctx, vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } } @@ -2562,7 +2550,7 @@ static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewCon EDBM_selectmode_flush(vc->em); } -static void paint_facesel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) +static void paint_facesel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad) { Object *ob = vc->obact; Mesh *me = ob->data; @@ -2570,7 +2558,7 @@ static void paint_facesel_circle_select(const struct EvaluationContext *eval_ctx bm_vertoffs = me->totpoly + 1; /* max index array */ - bbsel = EDBM_backbuf_circle_init(eval_ctx, vc, mval[0], mval[1], (short)(rad + 1.0f)); + bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); if (bbsel) { edbm_backbuf_check_and_select_tfaces(me, select); EDBM_backbuf_free(); @@ -2586,7 +2574,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT); } } -static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) +static void paint_vertsel_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad) { const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0; Object *ob = vc->obact; @@ -2597,7 +2585,7 @@ static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx if (use_zbuf) { bm_vertoffs = me->totvert + 1; /* max index array */ - bbsel = EDBM_backbuf_circle_init(eval_ctx, vc, mval[0], mval[1], (short)(rad + 1.0f)); + bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); if (bbsel) { edbm_backbuf_check_and_select_verts_obmode(me, select); EDBM_backbuf_free(); @@ -2609,7 +2597,7 @@ static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */ view3d_userdata_circleselect_init(&data, vc, select, mval, rad); - meshobject_foreachScreenVert(eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + meshobject_foreachScreenVert(vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT); } if (select != LEFTMOUSE) { @@ -2867,11 +2855,11 @@ static void mball_circle_select(ViewContext *vc, const bool select, const int mv /** Callbacks for circle selection in Editmode */ static void obedit_circle_select( - const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad) + ViewContext *vc, const bool select, const int mval[2], float rad) { switch (vc->obedit->type) { case OB_MESH: - mesh_circle_select(eval_ctx, vc, select, mval, rad); + mesh_circle_select(vc, select, mval, rad); break; case OB_CURVE: case OB_SURF: @@ -2923,8 +2911,6 @@ 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; - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); const int radius = RNA_int_get(op->ptr, "radius"); const bool select = !RNA_boolean_get(op->ptr, "deselect"); const int mval[2] = {RNA_int_get(op->ptr, "x"), @@ -2941,22 +2927,22 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) { view3d_operator_needs_opengl(C); - FOREACH_OBJECT_IN_MODE_BEGIN (eval_ctx.view_layer, obact->mode, ob_iter) { + FOREACH_OBJECT_IN_MODE_BEGIN (vc.view_layer, obact->mode, ob_iter) { ED_view3d_viewcontext_init_object(&vc, ob_iter); obact = vc.obact; obedit = vc.obedit; if (CTX_data_edit_object(C)) { - obedit_circle_select(&eval_ctx, &vc, select, mval, (float)radius); + obedit_circle_select(&vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } else if (BKE_paint_select_face_test(obact)) { - paint_facesel_circle_select(&eval_ctx, &vc, select, mval, (float)radius); + paint_facesel_circle_select(&vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } else if (BKE_paint_select_vert_test(obact)) { - paint_vertsel_circle_select(&eval_ctx, &vc, select, mval, (float)radius); + paint_vertsel_circle_select(&vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } else if (obact->mode & OB_MODE_POSE) { diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 1df29201bf6..970fb5f5b9d 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -69,17 +69,15 @@ static bool snap_calc_active_center(bContext *C, const bool select_only, float r static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) { + Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); RegionView3D *rv3d = CTX_wm_region_data(C); TransVertStore tvs = {NULL}; TransVert *tv; - EvaluationContext eval_ctx; float gridf, imat[3][3], bmat[3][3], vec[3]; int a; - CTX_data_eval_ctx(C, &eval_ctx); - gridf = rv3d->gridview; if (obedit) { @@ -166,7 +164,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->parent) { float originmat[3][3]; - BKE_object_where_is_calc_ex(&eval_ctx, scene, NULL, ob, originmat); + BKE_object_where_is_calc_ex(depsgraph, scene, NULL, ob, originmat); invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); @@ -211,20 +209,18 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_selected_to_location(bContext *C, const float snap_target_global[3], const bool use_offset) { + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Object *obact = CTX_data_active_object(C); View3D *v3d = CTX_wm_view3d(C); TransVertStore tvs = {NULL}; TransVert *tv; - EvaluationContext eval_ctx; float imat[3][3], bmat[3][3]; float center_global[3]; float offset_global[3]; int a; - CTX_data_eval_ctx(C, &eval_ctx); - if (use_offset) { if ((v3d && v3d->around == V3D_AROUND_ACTIVE) && snap_calc_active_center(C, true, center_global)) @@ -377,7 +373,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global if (ob->parent) { float originmat[3][3]; - BKE_object_where_is_calc_ex(&eval_ctx, scene, NULL, ob, originmat); + BKE_object_where_is_calc_ex(depsgraph, scene, NULL, ob, originmat); invert_m3_m3(imat, originmat); mul_m3_v3(imat, cursor_parent); diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index 92b3ec19acb..09a3202c85e 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -100,7 +100,7 @@ void ED_view3d_dist_range_get( * \note copies logic of #ED_view3d_viewplane_get(), keep in sync. */ bool ED_view3d_clip_range_get( - const Depsgraph *depsgraph, + Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, float *r_clipsta, float *r_clipend, const bool use_ortho_factor) @@ -123,7 +123,7 @@ bool ED_view3d_clip_range_get( } bool ED_view3d_viewplane_get( - const Depsgraph *depsgraph, + Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, int winx, int winy, rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize) { @@ -878,7 +878,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg * \param fallback_depth_pt: Use this points depth when no depth can be found. */ bool ED_view3d_autodist( - const EvaluationContext *eval_ctx, struct Depsgraph *graph, ARegion *ar, View3D *v3d, + struct Depsgraph *graph, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3], const bool alphaoverride, const float fallback_depth_pt[3]) { @@ -888,7 +888,7 @@ bool ED_view3d_autodist( bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_draw_depth(eval_ctx, graph, ar, v3d, alphaoverride); + ED_view3d_draw_depth(graph, ar, v3d, alphaoverride); /* Attempt with low margin's first */ i = 0; @@ -916,18 +916,18 @@ bool ED_view3d_autodist( } void ED_view3d_autodist_init( - const EvaluationContext *eval_ctx, struct Depsgraph *graph, + struct Depsgraph *graph, ARegion *ar, View3D *v3d, int mode) { /* Get Z Depths, needed for perspective, nice for ortho */ switch (mode) { case 0: - ED_view3d_draw_depth(eval_ctx, graph, ar, v3d, true); + ED_view3d_draw_depth(graph, ar, v3d, true); break; case 1: { Scene *scene = DEG_get_evaluated_scene(graph); - ED_view3d_draw_depth_gpencil(eval_ctx, scene, ar, v3d); + ED_view3d_draw_depth_gpencil(graph, scene, ar, v3d); break; } } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 1a547d07b80..1d44f3d3fd5 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -403,9 +403,6 @@ void ED_view3d_smooth_view_force_finish( View3D *v3d, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); if (rv3d && rv3d->sms) { rv3d->sms->time_allowed = 0.0; /* force finishing */ @@ -413,8 +410,9 @@ void ED_view3d_smooth_view_force_finish( /* force update of view matrix so tools that run immediately after * can use them without redrawing first */ + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); - ED_view3d_update_viewmat(&eval_ctx, scene, v3d, ar, NULL, NULL, NULL); + ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL); } } @@ -512,6 +510,7 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot) * meant to take into account vertex/bone selection for eg. */ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op) { + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); /* can be NULL */ @@ -526,7 +525,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op) } /* this function does all the important stuff */ - if (BKE_camera_view_frame_fit_to_scene(scene, view_layer, camera_ob, r_co, &r_scale)) { + if (BKE_camera_view_frame_fit_to_scene(depsgraph, scene, view_layer, camera_ob, r_co, &r_scale)) { ObjectTfmProtectedChannels obtfm; float obmat_new[4][4]; @@ -698,7 +697,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) /** * \param rect optional for picking (can be NULL). */ -void view3d_winmatrix_set(const Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, const rcti *rect) +void view3d_winmatrix_set(Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, const rcti *rect) { RegionView3D *rv3d = ar->regiondata; rctf viewplane; @@ -750,7 +749,7 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob) /** * Sets #RegionView3D.viewmat * - * \param eval_ctx: Context. + * \param depsgraph: Depsgraph. * \param scene: Scene for camera and cursor location. * \param v3d: View 3D space data. * \param rv3d: 3D region which stores the final matrices. @@ -760,14 +759,13 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob) * \note don't set windows active in here, is used by renderwin too. */ void view3d_viewmatrix_set( - const EvaluationContext *eval_ctx, Scene *scene, + Depsgraph *depsgraph, Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2]) { if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */ if (v3d->camera) { - const Depsgraph *depsgraph = eval_ctx->depsgraph; Object *camera_object = DEG_get_evaluated_object(depsgraph, v3d->camera); - BKE_object_where_is_calc(eval_ctx, scene, camera_object); + BKE_object_where_is_calc(depsgraph, scene, camera_object); obmat_to_viewmat(rv3d, camera_object); } else { @@ -908,7 +906,7 @@ static bool drw_select_loop_pass(eDRWSelectStage stage, void *user_data) * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. */ int view3d_opengl_select( - const EvaluationContext *eval_ctx, ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, + ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const rcti *input, eV3DSelectMode select_mode) { struct bThemeState theme_state; @@ -979,7 +977,7 @@ int view3d_opengl_select( /* Important we use the 'viewmat' and don't re-calculate since * the object & bone view locking takes 'rect' into account, see: T51629. */ - ED_view3d_draw_setup_view(vc->win, eval_ctx, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect); + ED_view3d_draw_setup_view(vc->win, graph, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect); if (v3d->drawtype > OB_WIRE) { v3d->zbuf = true; @@ -1024,7 +1022,7 @@ int view3d_opengl_select( #endif /* WITH_OPENGL_LEGACY */ G.f &= ~G_PICKSEL; - ED_view3d_draw_setup_view(vc->win, eval_ctx, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); + ED_view3d_draw_setup_view(vc->win, graph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); if (v3d->drawtype > OB_WIRE) { v3d->zbuf = 0; @@ -1234,7 +1232,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) && (startscene->gm.stereoflag != STEREO_DOME)) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); /* Letterbox */ rctf cam_framef; ED_view3d_calc_camera_border(startscene, depsgraph, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false); @@ -1276,7 +1274,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) //XXX restore_all_scene_cfra(scene_cfra_store); BKE_scene_set_background(CTX_data_main(C), startscene); - //XXX BKE_scene_graph_update_for_newframe(bmain->eval_ctx, bmain, scene, depsgraph); + //XXX BKE_scene_graph_update_for_newframe(depsgraph, bmain); BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 3bf0e579bb3..ef63f647ec8 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -249,9 +249,8 @@ typedef struct WalkInfo { RegionView3D *rv3d; View3D *v3d; ARegion *ar; - const struct Depsgraph *depsgraph; + struct Depsgraph *depsgraph; Scene *scene; - ViewLayer *view_layer; wmTimer *timer; /* needed for redraws */ @@ -509,16 +508,12 @@ static float userdef_speed = -1.f; static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) { wmWindow *win = CTX_wm_window(C); - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); walk->rv3d = CTX_wm_region_view3d(C); walk->v3d = CTX_wm_view3d(C); walk->ar = CTX_wm_region(C); walk->depsgraph = CTX_data_depsgraph(C); walk->scene = CTX_data_scene(C); - walk->view_layer = CTX_data_view_layer(C); #ifdef NDOF_WALK_DEBUG puts("\n-- walk begin --"); @@ -607,11 +602,11 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->rv3d->rflag |= RV3D_NAVIGATING; walk->snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), walk->scene, walk->view_layer, 0, + CTX_data_main(C), walk->scene, 0, walk->ar, walk->v3d); walk->v3d_camera_control = ED_view3d_cameracontrol_acquire( - &eval_ctx, walk->scene, walk->v3d, walk->rv3d, + walk->depsgraph, walk->scene, walk->v3d, walk->rv3d, (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0); /* center the mouse */ |