Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-06 13:07:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-16 20:55:33 +0300
commit34ab90f546f097cada951b2c9ca22bf271996980 (patch)
treeebcdb3d37120ac1d8fb16462b9104badd1800329 /source/blender/editors
parent0c495005dd83913864acb510c1d4194a2275dbb0 (diff)
Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing both risks the depsgraph and evaluation context not matching, and it complicates the Python API where we'd have to expose both which is not so easy to understand. This also removes the global evaluation context in main, which assumed there to be a single active scene and view layer. Differential Revision: https://developer.blender.org/D3152
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/armature_select.c24
-rw-r--r--source/blender/editors/armature/armature_skinning.c8
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c8
-rw-r--r--source/blender/editors/armature/pose_edit.c5
-rw-r--r--source/blender/editors/armature/pose_lib.c12
-rw-r--r--source/blender/editors/armature/pose_transform.c12
-rw-r--r--source/blender/editors/armature/pose_utils.c6
-rw-r--r--source/blender/editors/curve/editcurve.c8
-rw-r--r--source/blender/editors/curve/editcurve_paint.c7
-rw-r--r--source/blender/editors/curve/editfont.c6
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c5
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c14
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c5
-rw-r--r--source/blender/editors/include/ED_armature.h4
-rw-r--r--source/blender/editors/include/ED_gpencil.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h22
-rw-r--r--source/blender/editors/include/ED_object.h16
-rw-r--r--source/blender/editors/include/ED_particle.h6
-rw-r--r--source/blender/editors/include/ED_transform_snap_object_context.h4
-rw-r--r--source/blender/editors/include/ED_view3d.h55
-rw-r--r--source/blender/editors/interface/interface_eyedropper_depth.c5
-rw-r--r--source/blender/editors/io/io_collada.c8
-rw-r--r--source/blender/editors/manipulator_library/manipulator_library_presets.c5
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c2
-rw-r--r--source/blender/editors/mesh/editface.c4
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c13
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c6
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c13
-rw-r--r--source/blender/editors/mesh/editmesh_path.c14
-rw-r--r--source/blender/editors/mesh/editmesh_select.c96
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c6
-rw-r--r--source/blender/editors/mesh/meshtools.c38
-rw-r--r--source/blender/editors/metaball/mball_edit.c4
-rw-r--r--source/blender/editors/object/object_add.c34
-rw-r--r--source/blender/editors/object/object_bake_api.c16
-rw-r--r--source/blender/editors/object/object_constraint.c34
-rw-r--r--source/blender/editors/object/object_data_transfer.c21
-rw-r--r--source/blender/editors/object/object_edit.c5
-rw-r--r--source/blender/editors/object/object_hook.c5
-rw-r--r--source/blender/editors/object/object_modes.c12
-rw-r--r--source/blender/editors/object/object_modifier.c58
-rw-r--r--source/blender/editors/object/object_relations.c34
-rw-r--r--source/blender/editors/object/object_transform.c48
-rw-r--r--source/blender/editors/object/object_vgroup.c18
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c10
-rw-r--r--source/blender/editors/physics/particle_edit.c128
-rw-r--r--source/blender/editors/physics/particle_object.c42
-rw-r--r--source/blender/editors/physics/physics_fluid.c17
-rw-r--r--source/blender/editors/physics/physics_intern.h4
-rw-r--r--source/blender/editors/render/render_internal.c10
-rw-r--r--source/blender/editors/render/render_opengl.c12
-rw-r--r--source/blender/editors/scene/scene_edit.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c22
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h4
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c50
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c13
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c75
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c14
-rw-r--r--source/blender/editors/space_clip/tracking_ops_orient.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h1
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c42
-rw-r--r--source/blender/editors/space_view3d/drawobject.c154
-rw-r--r--source/blender/editors/space_view3d/view3d_camera_control.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c89
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c160
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c35
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h37
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c132
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c28
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c11
-rw-r--r--source/blender/editors/transform/transform.c2
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_conversions.c12
-rw-r--r--source/blender/editors/transform/transform_generics.c3
-rw-r--r--source/blender/editors/transform/transform_snap.c6
-rw-r--r--source/blender/editors/transform/transform_snap_object.c37
95 files changed, 870 insertions, 1160 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 63864e75edc..6ad33125a25 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -242,27 +242,25 @@ void *get_nearest_bone(
bContext *C, const int xy[2], bool findunsel,
Base **r_base)
{
- EvaluationContext eval_ctx;
ViewContext vc;
rcti rect;
unsigned int buffer[MAXPICKBUF];
short hits;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
// rect.xmin = ... mouseco!
rect.xmin = rect.xmax = xy[0];
rect.ymin = rect.ymax = xy[1];
- hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
+ hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
*r_base = NULL;
if (hits > 0) {
uint bases_len = 0;
Base **bases = BKE_view_layer_array_from_bases_in_mode(
- eval_ctx.view_layer, &bases_len, {
+ vc.view_layer, &bases_len, {
.object_mode = vc.obedit ? OB_MODE_EDIT : OB_MODE_POSE,
.no_dup_data = true});
@@ -382,7 +380,7 @@ static int selectbuffer_ret_hits_5(unsigned int *buffer, const int hits12, const
/* does bones and points */
/* note that BONE ROOT only gets drawn for root bones (or without IK) */
static EditBone *get_nearest_editbonepoint(
- const EvaluationContext *eval_ctx, ViewContext *vc,
+ ViewContext *vc,
bool findunsel, bool use_cycle,
Base **r_base, int *r_selmask)
{
@@ -436,7 +434,7 @@ static EditBone *get_nearest_editbonepoint(
view3d_opengl_select_cache_begin();
BLI_rcti_init_pt_radius(&rect, vc->mval, 12);
- hits12 = view3d_opengl_select(eval_ctx, vc, buffer, MAXPICKBUF, &rect, select_mode);
+ hits12 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode);
if (hits12 == 1) {
hits = selectbuffer_ret_hits_12(buffer, hits12);
goto cache_end;
@@ -446,7 +444,7 @@ static EditBone *get_nearest_editbonepoint(
offs = 4 * hits12;
BLI_rcti_init_pt_radius(&rect, vc->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, hits12, hits5);
@@ -461,7 +459,7 @@ cache_end:
view3d_opengl_select_cache_end();
uint bases_len;
- Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(eval_ctx->view_layer, &bases_len);
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(vc->view_layer, &bases_len);
/* See if there are any selected bones in this group */
if (hits > 0) {
@@ -595,13 +593,11 @@ static int ebone_select_flag(EditBone *ebone)
/* context: editmode armature in view3d */
bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
- EvaluationContext eval_ctx;
ViewContext vc;
EditBone *nearBone = NULL;
int selmask;
Base *basact = NULL;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
vc.mval[0] = mval[0];
vc.mval[1] = mval[1];
@@ -610,14 +606,14 @@ bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, b
return true;
}
- nearBone = get_nearest_editbonepoint(&eval_ctx, &vc, true, true, &basact, &selmask);
+ nearBone = get_nearest_editbonepoint(&vc, true, true, &basact, &selmask);
if (nearBone) {
ED_view3d_viewcontext_init_object(&vc, basact->object);
bArmature *arm = vc.obedit->data;
if (!extend && !deselect && !toggle) {
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);
ED_armature_edit_deselect_all_multi(objects, objects_len);
MEM_freeN(objects);
}
@@ -698,8 +694,8 @@ bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, b
arm->act_edbone = nearBone;
}
- if (eval_ctx.view_layer->basact != basact) {
- eval_ctx.view_layer->basact = basact;
+ if (vc.view_layer->basact != basact) {
+ vc.view_layer->basact = basact;
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, vc.scene);
}
}
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index e25056a7a4a..c98eb9218cc 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -251,7 +251,7 @@ static void envelope_bone_weighting(
}
static void add_verts_to_dgroups(
- ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
+ ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par,
int heat, const bool mirror)
{
/* This functions implements the automatic computation of vertex group
@@ -377,7 +377,7 @@ static void add_verts_to_dgroups(
if (wpmode) {
/* if in weight paint mode, use final verts from derivedmesh */
- DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
if (dm->foreachMappedVert) {
mesh_get_mapped_verts_coords(dm, verts, mesh->totvert);
@@ -432,7 +432,7 @@ static void add_verts_to_dgroups(
}
void ED_object_vgroup_calc_from_armature(
- ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
+ ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par,
const int mode, const bool mirror)
{
/* Lets try to create some vertex groups
@@ -459,6 +459,6 @@ void ED_object_vgroup_calc_from_armature(
* that are populated with the vertices for which the
* bone is closest.
*/
- add_verts_to_dgroups(reports, eval_ctx, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
+ add_verts_to_dgroups(reports, depsgraph, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
}
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 26f11f8fd60..4c208ef5411 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -998,7 +998,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
* the ideal would be to call this function only at the beginning of the snap operation,
* or at the beginning of the operator itself */
struct SnapObjectContext *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,
CTX_wm_region(C), CTX_wm_view3d(C));
float mvalf[2] = {UNPACK2(dd->mval)};
@@ -1486,7 +1486,7 @@ static int cmpIntersections(const void *i1, const void *i2)
/* returns the maximum number of intersections per stroke */
static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, SK_Stroke *gesture)
{
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ARegion *ar = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
@@ -1925,18 +1925,16 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch)
static bool sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], const bool extend)
{
- EvaluationContext eval_ctx;
ViewContext vc;
rcti rect;
unsigned int buffer[MAXPICKBUF];
short hits;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
BLI_rcti_init_pt_radius(&rect, mval, 5);
- hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
+ hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
if (hits > 0) {
int besthitresult = -1;
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index ea93e024f8e..80eeda1dd0c 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -178,8 +178,7 @@ static bool pose_has_protected_selected(Object *ob, short warn)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
{
struct Main *bmain = CTX_data_main(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
/* set flag to force recalc, then grab the relevant bones to target */
@@ -187,7 +186,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob)
animviz_get_object_motionpaths(ob, &targets);
/* recalculate paths, then free */
- animviz_calc_motionpaths(&eval_ctx, bmain, scene, &targets);
+ animviz_calc_motionpaths(depsgraph, bmain, scene, &targets);
BLI_freelistN(&targets);
}
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 54c40621a14..609281a7bf2 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -1080,9 +1080,6 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData
static void poselib_preview_apply(bContext *C, wmOperator *op)
{
tPoseLib_PreviewData *pld = (tPoseLib_PreviewData *)op->customdata;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* only recalc pose (and its dependencies) if pose has changed */
if (pld->redraw == PL_PREVIEW_REDRAWALL) {
@@ -1107,7 +1104,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
if ((pld->arm->flag & ARM_DELAYDEFORM) == 0)
DEG_id_tag_update(&pld->ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
- BKE_pose_where_is(&eval_ctx, pld->scene, pld->ob);
+ BKE_pose_where_is(CTX_data_depsgraph(C), pld->scene, pld->ob);
}
/* do header print - if interactively previewing */
@@ -1598,9 +1595,6 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
bArmature *arm = pld->arm;
bAction *act = pld->act;
TimeMarker *marker = pld->marker;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* redraw the header so that it doesn't show any of our stuff anymore */
ED_area_headerprint(pld->sa, NULL);
@@ -1618,7 +1612,7 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
if ((arm->flag & ARM_DELAYDEFORM) == 0)
DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(CTX_data_depsgraph(C), scene, ob);
}
else if (pld->state == PL_PREVIEW_CONFIRM) {
/* tag poses as appropriate */
@@ -1636,7 +1630,7 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
//remake_action_ipos(ob->action);
}
else
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(CTX_data_depsgraph(C), scene, ob);
}
/* Request final redraw of the view. */
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 7fc40d00042..a8ba3ad646c 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -73,10 +73,8 @@
/* helper for apply_armature_pose2bones - fixes parenting of objects that are bone-parented to armature */
static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Object *armob)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object workob, *ob;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* go through all objects in database */
for (ob = G.main->object.first; ob; ob = ob->id.next) {
@@ -87,7 +85,7 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
*/
BKE_object_apply_mat4(ob, ob->obmat, false, false);
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
}
@@ -96,16 +94,14 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
/* set the current pose as the restpose */
static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
- EvaluationContext eval_ctx;
bArmature *arm = BKE_armature_from_object(ob);
bPose *pose;
bPoseChannel *pchan;
EditBone *curbone;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* don't check if editmode (should be done by caller) */
if (ob->type != OB_ARMATURE)
return OPERATOR_CANCELLED;
@@ -196,7 +192,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
ED_armature_edit_free(arm);
/* flush positions of posebones */
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
/* fix parenting of objects which are bone-parented */
applyarmature_fix_boneparents(C, scene, ob);
diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c
index acb9363cf10..0dc89aa4716 100644
--- a/source/blender/editors/armature/pose_utils.c
+++ b/source/blender/editors/armature/pose_utils.c
@@ -183,10 +183,8 @@ void poseAnim_mapping_free(ListBase *pfLinks)
/* helper for apply() / reset() - refresh the data */
void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
bArmature *arm = (bArmature *)ob->data;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
/* old optimize trick... this enforces to bypass the depgraph
* - note: code copied from transform_generics.c -> recalcData()
@@ -195,7 +193,7 @@ void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
if ((arm->flag & ARM_DELAYDEFORM) == 0)
DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
else
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 3ea8592ac3e..14571343ac9 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5013,7 +5013,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const float mval[2] = {UNPACK2(event->mval)};
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
- CTX_data_main(C), vc.scene, vc.view_layer, 0, vc.ar, vc.v3d);
+ CTX_data_main(C), vc.scene, 0, vc.ar, vc.v3d);
ED_transform_snap_object_project_view3d_mixed(
snap_context,
@@ -6237,17 +6237,15 @@ static int match_texture_space_poll(bContext *C)
static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *object = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
Curve *curve = (Curve *) object->data;
float min[3], max[3], size[3], loc[3];
int a;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (object->curve_cache == NULL) {
- BKE_displist_make_curveTypes(&eval_ctx, scene, object, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, object, false);
}
INIT_MINMAX(min, max);
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 36eb4c6c5bc..056e8a2668c 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -93,7 +93,7 @@ struct StrokeElem {
};
struct CurveDrawData {
- const Depsgraph *depsgraph;
+ Depsgraph *depsgraph;
short init_event_type;
short curve_type;
@@ -1095,13 +1095,10 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if ((cps->depth_mode == CURVE_PAINT_PROJECT_SURFACE) &&
(v3d->drawtype > OB_WIRE))
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* needed or else the draw matrix can be incorrect */
view3d_operator_needs_opengl(C);
- ED_view3d_autodist_init(&eval_ctx, cdd->vc.depsgraph, cdd->vc.ar, cdd->vc.v3d, 0);
+ ED_view3d_autodist_init(cdd->vc.depsgraph, cdd->vc.ar, cdd->vc.v3d, 0);
if (cdd->vc.rv3d->depths) {
cdd->vc.rv3d->depths->damaged = true;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index b72ac8c63c8..a9a8901acc6 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -422,9 +422,9 @@ void FONT_OT_text_paste_from_file(wmOperatorType *ot)
static void txt_add_object(bContext *C, TextLine *firstline, int totline, const float offset[3])
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- EvaluationContext eval_ctx;
Curve *cu;
Object *obedit;
Base *base;
@@ -434,15 +434,13 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, const
int a;
float rot[3] = {0.f, 0.f, 0.f};
- CTX_data_eval_ctx(C, &eval_ctx);
-
obedit = BKE_object_add(bmain, scene, view_layer, OB_FONT, NULL);
base = view_layer->basact;
/* seems to assume view align ? TODO - look into this, could be an operator option */
ED_object_base_init_transform(C, base, NULL, rot);
- BKE_object_where_is_calc(&eval_ctx, scene, obedit);
+ BKE_object_where_is_calc(depsgraph, scene, obedit);
add_v3_v3(obedit->loc, offset);
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 942aa861cec..50a6e9125a0 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1672,7 +1672,7 @@ void ED_gpencil_draw_view2d(const bContext *C, bool onlyv2d)
void ED_gpencil_draw_view3d(wmWindowManager *wm,
Scene *scene,
ViewLayer *view_layer,
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
View3D *v3d,
ARegion *ar,
bool only3d)
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 1eee774fd3e..4f9abff292a 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2109,12 +2109,9 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
/* init autodist for geometry projection */
if (mode == GP_REPROJECT_SURFACE) {
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
struct Depsgraph *graph = CTX_data_depsgraph(C);
view3d_region_operator_needs_opengl(CTX_wm_window(C), gsc.ar);
- ED_view3d_autodist_init(&eval_ctx, graph, gsc.ar, CTX_wm_view3d(C), 0);
+ ED_view3d_autodist_init(graph, gsc.ar, CTX_wm_view3d(C), 0);
}
// TODO: For deforming geometry workflow, create new frames?
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 77e5dc8fe5d..b74d6ed8d69 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -115,7 +115,6 @@ typedef enum eGPencil_PaintFlags {
* "p" = op->customdata
*/
typedef struct tGPsdata {
- EvaluationContext eval_ctx;
Scene *scene; /* current scene from context */
struct Depsgraph *graph;
@@ -646,7 +645,7 @@ static short gp_stroke_addpoint(
view3d_region_operator_needs_opengl(p->win, p->ar);
ED_view3d_autodist_init(
- &p->eval_ctx, p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+ p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
}
/* convert screen-coordinates to appropriate coordinates (and store them) */
@@ -1247,7 +1246,7 @@ static void gp_stroke_doeraser(tGPsdata *p)
if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) {
View3D *v3d = p->sa->spacedata.first;
view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(&p->eval_ctx, p->graph, p->ar, v3d, 0);
+ ED_view3d_autodist_init(p->graph, p->ar, v3d, 0);
}
}
@@ -1400,7 +1399,6 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
}
/* pass on current scene and window */
- CTX_data_eval_ctx(C, &p->eval_ctx);
p->scene = CTX_data_scene(C);
p->graph = CTX_data_depsgraph(C);
p->win = CTX_wm_window(C);
@@ -1608,7 +1606,7 @@ static void gp_session_cleanup(tGPsdata *p)
}
/* init new stroke */
-static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, const Depsgraph *depsgraph)
+static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Depsgraph *depsgraph)
{
Scene *scene = p->scene;
ToolSettings *ts = scene->toolsettings;
@@ -1815,7 +1813,7 @@ static void gp_paint_strokeend(tGPsdata *p)
/* need to restore the original projection settings before packing up */
view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(&p->eval_ctx, p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+ ED_view3d_autodist_init(p->graph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
}
/* check if doing eraser or not */
@@ -2055,7 +2053,7 @@ static void gpencil_draw_status_indicators(tGPsdata *p)
/* ------------------------------- */
/* create a new stroke point at the point indicated by the painting context */
-static void gpencil_draw_apply(wmOperator *op, tGPsdata *p, const Depsgraph *depsgraph)
+static void gpencil_draw_apply(wmOperator *op, tGPsdata *p, Depsgraph *depsgraph)
{
/* handle drawing/erasing -> test for erasing first */
if (p->paintmode == GP_PAINTMODE_ERASER) {
@@ -2110,7 +2108,7 @@ static void gpencil_draw_apply(wmOperator *op, tGPsdata *p, const Depsgraph *dep
}
/* handle draw event */
-static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, const Depsgraph *depsgraph)
+static void gpencil_draw_apply_event(wmOperator *op, const wmEvent *event, Depsgraph *depsgraph)
{
tGPsdata *p = op->customdata;
PointerRNA itemptr;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 94689fb59fa..d7e5b5a92aa 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -542,14 +542,11 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
View3D *v3d = (View3D *)CTX_wm_space_data(C);
RegionView3D *rv3d = ar->regiondata;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* init 3d depth buffers */
view3d_operator_needs_opengl(C);
view3d_region_operator_needs_opengl(win, ar);
- ED_view3d_autodist_init(&eval_ctx, graph, ar, v3d, 0);
+ ED_view3d_autodist_init(graph, ar, v3d, 0);
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index e6284cb1656..69f71f3df44 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -39,7 +39,7 @@ struct Base;
struct bContext;
struct Bone;
struct bPoseChannel;
-struct EvaluationContext;
+struct Depsgraph;
struct IDProperty;
struct ListBase;
struct MeshDeformModifierData;
@@ -192,7 +192,7 @@ void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do
#define ARM_GROUPS_AUTO 3
void ED_object_vgroup_calc_from_armature(
- struct ReportList *reports, const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, struct Object *par, const int mode, const bool mirror);
/* if bone is already in list, pass it as param to ignore it */
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 3ea754b242c..57ca1f04c0a 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -153,7 +153,7 @@ void ED_gpencil_draw_view2d(const struct bContext *C, bool onlyv2d);
void ED_gpencil_draw_view3d(struct wmWindowManager *wm,
struct Scene *scene,
struct ViewLayer *view_layer,
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
struct View3D *v3d,
struct ARegion *ar,
bool only3d);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index d3f2e1fff85..787cf7f0524 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -126,7 +126,7 @@ void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag);
void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
bool BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e,
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
struct ARegion *ar, struct View3D *v3d, struct Object *obedit);
/* editmesh_undo.c */
@@ -138,36 +138,36 @@ void EDBM_select_mirrored(
int *r_totmirr, int *r_totfail);
void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag);
-bool EDBM_backbuf_border_init(const struct EvaluationContext *eval_ctx, struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
+bool EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
bool EDBM_backbuf_check(unsigned int index);
void EDBM_backbuf_free(void);
bool EDBM_backbuf_border_mask_init(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, const int mcords[][2], short tot,
+ struct ViewContext *vc, const int mcords[][2], short tot,
short xmin, short ymin, short xmax, short ymax);
-bool EDBM_backbuf_circle_init(const struct EvaluationContext *eval_ctx, struct ViewContext *vc, short xs, short ys, short rads);
+bool EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
struct BMVert *EDBM_vert_find_nearest_ex(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist,
+ struct ViewContext *vc, float *r_dist,
const bool use_select_bias, bool use_cycle);
struct BMVert *EDBM_vert_find_nearest(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist);
+ struct ViewContext *vc, float *r_dist);
struct BMEdge *EDBM_edge_find_nearest_ex(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist,
+ struct ViewContext *vc, float *r_dist,
float *r_dist_center,
const bool use_select_bias, const bool use_cycle,
struct BMEdge **r_eed_zbuf);
struct BMEdge *EDBM_edge_find_nearest(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist);
+ struct ViewContext *vc, float *r_dist);
struct BMFace *EDBM_face_find_nearest_ex(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist,
+ struct ViewContext *vc, float *r_dist,
float *r_dist_center,
const bool use_select_bias, const bool use_cycle,
struct BMFace **r_efa_zbuf);
struct BMFace *EDBM_face_find_nearest(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, float *r_dist);
+ struct ViewContext *vc, float *r_dist);
bool EDBM_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
@@ -204,7 +204,7 @@ void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEd
/* editface.c */
void paintface_flush_flags(struct Object *ob, short flag);
bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle);
-int do_paintface_box_select(const struct EvaluationContext *eval_ctx, struct ViewContext *vc, struct rcti *rect, bool select, bool extend);
+int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, bool select, bool extend);
void paintface_deselect_all_visible(struct Object *ob, int action, bool flush_flags);
void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], const bool select);
bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index bfc3325d7eb..1d35401ebd2 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -57,7 +57,7 @@ struct wmWindowManager;
struct PointerRNA;
struct PropertyRNA;
struct EnumPropertyItem;
-struct EvaluationContext;
+struct Depsgraph;
#include "DNA_object_enums.h"
@@ -138,11 +138,11 @@ bool ED_object_editmode_calc_active_center(struct Object *obedit, const bool sel
void ED_object_vpaintmode_enter_ex(
- const struct EvaluationContext *eval_ctx, struct wmWindowManager *wm,
+ struct Depsgraph *depsgraph, struct wmWindowManager *wm,
struct Scene *scene, struct Object *ob);
void ED_object_vpaintmode_enter(struct bContext *C);
void ED_object_wpaintmode_enter_ex(
- const struct EvaluationContext *eval_ctx, struct wmWindowManager *wm,
+ struct Depsgraph *depsgraph, struct wmWindowManager *wm,
struct Scene *scene, struct Object *ob);
void ED_object_wpaintmode_enter(struct bContext *C);
@@ -152,12 +152,12 @@ void ED_object_wpaintmode_exit_ex(struct Object *ob);
void ED_object_wpaintmode_exit(struct bContext *C);
void ED_object_sculptmode_enter_ex(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob,
struct ReportList *reports);
void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);
void ED_object_sculptmode_exit_ex(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob);
void ED_object_sculptmode_exit(struct bContext *C);
@@ -216,10 +216,10 @@ bool ED_object_mode_generic_enter(
struct bContext *C,
eObjectMode object_mode);
void ED_object_mode_generic_exit(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob);
bool ED_object_mode_generic_has_data(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Object *ob);
bool ED_object_mode_generic_exists(
@@ -241,7 +241,7 @@ int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob,
int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md);
-int ED_object_modifier_apply(struct ReportList *reports, const struct EvaluationContext *eval_ctx, struct Scene *scene,
+int ED_object_modifier_apply(struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index b3e274a235a..f84015c53ee 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -47,15 +47,15 @@ int PE_start_edit(struct PTCacheEdit *edit);
/* access */
struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob);
-struct PTCacheEdit *PE_create_current(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob);
-void PE_current_changed(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob);
+struct PTCacheEdit *PE_create_current(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
+void PE_current_changed(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
int PE_minmax(struct Scene *scene, struct ViewLayer *view_layer, float min[3], float max[3]);
struct ParticleEditSettings *PE_settings(struct Scene *scene);
/* update calls */
void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra);
void PE_update_object(
- const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, int useflag);
/* selection tools */
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h
index 26cef2599bd..07411fab12a 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -75,9 +75,9 @@ struct SnapObjectParams {
typedef struct SnapObjectContext SnapObjectContext;
SnapObjectContext *ED_transform_snap_object_context_create(
- struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, int flag);
+ struct Main *bmain, struct Scene *scene, int flag);
SnapObjectContext *ED_transform_snap_object_context_create_view3d(
- struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, int flag,
+ struct Main *bmain, struct Scene *scene, int flag,
/* extra args for view3d */
const struct ARegion *ar, const struct View3D *v3d);
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index c5b99013610..c394060dfba 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -43,7 +43,6 @@ struct BoundBox;
struct Camera;
struct Depsgraph;
struct EditBone;
-struct EvaluationContext;
struct ImBuf;
struct MVert;
struct Main;
@@ -157,20 +156,20 @@ typedef enum {
/* foreach iterators */
void meshobject_foreachScreenVert(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc,
+ struct ViewContext *vc,
void (*func)(void *userData, struct MVert *eve, const float screen_co[2], int index),
void *userData, const eV3DProjTest clip_flag);
void mesh_foreachScreenVert(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc,
+ struct ViewContext *vc,
void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index),
void *userData, const eV3DProjTest clip_flag);
void mesh_foreachScreenEdge(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc,
+ struct ViewContext *vc,
void (*func)(void *userData, struct BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2],
int index),
void *userData, const eV3DProjTest clip_flag);
void mesh_foreachScreenFace(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc,
+ struct ViewContext *vc,
void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index),
void *userData, const eV3DProjTest clip_flag);
void nurbs_foreachScreenVert(
@@ -229,11 +228,11 @@ float ED_view3d_pixel_size(const struct RegionView3D *rv3d, const float co[3]);
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip);
bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]);
bool ED_view3d_win_to_ray(
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
const struct ARegion *ar, const struct View3D *v3d, const float mval[2],
float ray_start[3], float ray_normal[3], const bool do_clip);
bool ED_view3d_win_to_ray_ex(
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
const struct ARegion *ar, const struct View3D *v3d, const float mval[2],
float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip);
void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]);
@@ -248,7 +247,7 @@ void ED_view3d_win_to_3d_int(
void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac);
void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]);
void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
-bool ED_view3d_win_to_segment(const struct Depsgraph *depsgraph,
+bool ED_view3d_win_to_segment(struct Depsgraph *depsgraph,
const struct ARegion *ar, struct View3D *v3d, const float mval[2],
float r_ray_start[3], float r_ray_end[3], const bool do_clip);
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
@@ -264,28 +263,28 @@ void ED_view3d_dist_range_get(
const struct View3D *v3d,
float r_dist_range[2]);
bool ED_view3d_clip_range_get(
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
const struct View3D *v3d, const struct RegionView3D *rv3d,
float *r_clipsta, float *r_clipend, const bool use_ortho_factor);
bool ED_view3d_viewplane_get(
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
const struct View3D *v3d, const struct RegionView3D *rv3d, int winxi, int winyi,
struct rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize);
void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist);
void ED_view3d_calc_camera_border(
- const struct Scene *scene, const struct Depsgraph *depsgraph,
+ const struct Scene *scene, struct Depsgraph *depsgraph,
const struct ARegion *ar,
const struct View3D *v3d, const struct RegionView3D *rv3d,
struct rctf *r_viewborder, const bool no_shift);
void ED_view3d_calc_camera_border_size(
- const struct Scene *scene, const struct Depsgraph *depsgraph,
+ const struct Scene *scene, struct Depsgraph *depsgraph,
const struct ARegion *ar,
const struct View3D *v3d, const struct RegionView3D *rv3d,
float r_size[2]);
bool ED_view3d_calc_render_border(
- const struct Scene *scene, const struct Depsgraph *depsgraph,
+ const struct Scene *scene, struct Depsgraph *depsgraph,
struct View3D *v3d,
struct ARegion *ar, struct rcti *rect);
@@ -308,23 +307,23 @@ float ED_view3d_radius_to_dist(
void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos);
/* backbuffer select and draw support */
-void ED_view3d_backbuf_validate(const struct EvaluationContext *eval_ctx, struct ViewContext *vc);
+void ED_view3d_backbuf_validate(struct ViewContext *vc);
struct ImBuf *ED_view3d_backbuf_read(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax);
+ struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax);
unsigned int ED_view3d_backbuf_sample_rect(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, const int mval[2], int size,
+ struct ViewContext *vc, const int mval[2], int size,
unsigned int min, unsigned int max, float *r_dist);
int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
unsigned int ED_view3d_backbuf_sample(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, int x, int y);
+ struct ViewContext *vc, int x, int y);
bool ED_view3d_autodist(
- const struct EvaluationContext *eval_ctx, struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d,
+ struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d,
const int mval[2], float mouse_worldloc[3],
const bool alphaoverride, const float fallback_depth_pt[3]);
/* only draw so ED_view3d_autodist_simple can be called many times after */
-void ED_view3d_autodist_init(const struct EvaluationContext *eval_ctx, struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d, int mode);
+void ED_view3d_autodist_init(struct Depsgraph *graph, struct ARegion *ar, struct View3D *v3d, int mode);
bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
@@ -346,7 +345,7 @@ void view3d_opengl_select_cache_begin(void);
void view3d_opengl_select_cache_end(void);
int view3d_opengl_select(
- const struct EvaluationContext *eval_ctx, struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input,
+ struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input,
eV3DSelectMode select_mode);
/* view3d_select.c */
@@ -379,22 +378,22 @@ int ED_view3d_view_layer_set(int lay, const int *values, int *active);
struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
-void ED_draw_object_facemap(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, const float col[4], const int facemap);
+void ED_draw_object_facemap(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const float col[4], const int facemap);
bool ED_view3d_context_activate(struct bContext *C);
void ED_view3d_draw_offscreen_init(
- const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct Depsgraph *depsgraph, struct Scene *scene,
struct ViewLayer *view_layer, struct RenderEngineType *engine_type,
struct View3D *v3d);
void ED_view3d_draw_offscreen(
- const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct Depsgraph *depsgraph, struct Scene *scene,
struct ViewLayer *view_layer, struct RenderEngineType *engine_type,
struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4],
float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname,
struct GPUFXSettings *fx_settings,
struct GPUOffScreen *ofs, struct GPUViewport *viewport);
void ED_view3d_draw_setup_view(
- struct wmWindow *win, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
+ struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
float viewmat[4][4], float winmat[4][4], const struct rcti *rect);
enum {
@@ -410,14 +409,14 @@ enum {
};
struct ImBuf *ED_view3d_draw_offscreen_imbuf(
- const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct Depsgraph *depsgraph, struct Scene *scene,
struct ViewLayer *view_layer, struct RenderEngineType *engine_type,
struct View3D *v3d, struct ARegion *ar,
int sizex, int sizey, unsigned int flag, unsigned int draw_flags,
int alpha_mode, int samples, const char *viewname,
struct GPUOffScreen *ofs, char err_out[256]);
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
- const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct Depsgraph *depsgraph, struct Scene *scene,
struct ViewLayer *view_layer, struct RenderEngineType *engine_type,
struct Object *camera, int width, int height,
unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode,
@@ -427,7 +426,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
void ED_view3d_update_viewmat(
- const struct EvaluationContext *eval_ctx, struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
+ struct Depsgraph *depsgraph, struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
float viewmat[4][4], float winmat[4][4], const struct rcti *rect);
bool ED_view3d_quat_from_axis_view(const char view, float quat[4]);
char ED_view3d_quat_to_axis_view(const float quat[4], const float epsilon);
@@ -491,7 +490,7 @@ void ED_view3d_id_remap(struct View3D *v3d, const struct ID *old_id, struct ID *
/* view3d_draw_legacy.c */
/* Try avoid using these more move out of legacy. */
void ED_view3d_draw_bgpic_test(
- struct Scene *scene, const struct Depsgraph *depsgraph,
+ struct Scene *scene, struct Depsgraph *depsgraph,
struct ARegion *ar, struct View3D *v3d,
const bool do_foreground, const bool do_camera_frame);
diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c
index 6e85d091fdb..fd9c5f1869d 100644
--- a/source/blender/editors/interface/interface_eyedropper_depth.c
+++ b/source/blender/editors/interface/interface_eyedropper_depth.c
@@ -179,9 +179,6 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
my - ar->winrct.ymin};
float co[3];
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
@@ -190,7 +187,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
view3d_operator_needs_opengl(C);
- if (ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval, co, true, NULL)) {
+ if (ED_view3d_autodist(graph, ar, v3d, mval, co, true, NULL)) {
const float mval_center_fl[2] = {
(float)ar->winx / 2,
(float)ar->winy / 2};
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 4d0d59ae42c..576b24ed4b4 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -59,8 +59,6 @@
#include "io_collada.h"
-#include "DEG_depsgraph.h"
-
static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
@@ -83,7 +81,6 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *
/* function used for WM_OT_save_mainfile too */
static int wm_collada_export_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
char filepath[FILE_MAX];
int apply_modifiers;
int export_mesh_type;
@@ -113,8 +110,6 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int export_count;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
@@ -173,7 +168,6 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
ED_object_editmode_load(CTX_data_edit_object(C));
Scene *scene = CTX_data_scene(C);
- CTX_data_eval_ctx(C, &eval_ctx);
ExportSettings export_settings;
@@ -205,7 +199,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
if (export_settings.include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE;
- export_count = collada_export(&eval_ctx,
+ export_count = collada_export(CTX_data_depsgraph(C),
scene,
&export_settings
);
diff --git a/source/blender/editors/manipulator_library/manipulator_library_presets.c b/source/blender/editors/manipulator_library/manipulator_library_presets.c
index 7b8d2104992..cccf484f29d 100644
--- a/source/blender/editors/manipulator_library/manipulator_library_presets.c
+++ b/source/blender/editors/manipulator_library/manipulator_library_presets.c
@@ -139,12 +139,9 @@ void ED_manipulator_draw_preset_facemap(
GPU_select_load_id(select_id);
}
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
gpuPushMatrix();
gpuMultMatrix(ob->obmat);
- ED_draw_object_facemap(&eval_ctx, scene, ob, color, facemap);
+ ED_draw_object_facemap(CTX_data_depsgraph(C), scene, ob, color, facemap);
gpuPopMatrix();
if (is_select) {
diff --git a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
index 2991c972f6e..29aff0a1250 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
@@ -191,7 +191,7 @@ static void dial_ghostarc_draw(
}
static void dial_ghostarc_get_angles(
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
const wmManipulator *mpr,
const wmEvent *event,
const ARegion *ar, const View3D *v3d,
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 1b9ee70ccf5..53f21a1e32f 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -393,7 +393,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b
return true;
}
-int do_paintface_box_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend)
+int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
Object *ob = vc->obact;
Mesh *me;
@@ -424,7 +424,7 @@ int do_paintface_box_select(const struct EvaluationContext *eval_ctx, ViewContex
}
}
- 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;
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index ee5c0d20bc7..80fed05a0b5 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -161,7 +161,6 @@ typedef struct KnifePosData {
typedef struct KnifeTool_OpData {
ARegion *ar; /* region that knifetool was activated in */
void *draw_handle; /* for drawing preview loop */
- EvaluationContext eval_ctx;
ViewContext vc; /* note: _don't_ use 'mval', instead use the one we define below */
float mval[2]; /* mouse value with snapping applied */
//bContext *C;
@@ -1562,8 +1561,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
}
/* unproject screen line */
- ED_view3d_win_to_segment(kcd->eval_ctx.depsgraph, kcd->ar, kcd->vc.v3d, s1, v1, v3, true);
- ED_view3d_win_to_segment(kcd->eval_ctx.depsgraph, kcd->ar, kcd->vc.v3d, s2, v2, v4, true);
+ ED_view3d_win_to_segment(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s1, v1, v3, true);
+ ED_view3d_win_to_segment(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s2, v2, v4, true);
mul_m4_v3(kcd->ob->imat, v1);
mul_m4_v3(kcd->ob->imat, v2);
@@ -1838,7 +1837,7 @@ static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd, float co[3], float
if (!f) {
if (kcd->is_interactive) {
/* try to use backbuffer selection method if ray casting failed */
- f = EDBM_face_find_nearest(&kcd->eval_ctx, &kcd->vc, &dist);
+ f = EDBM_face_find_nearest(&kcd->vc, &dist);
/* cheat for now; just put in the origin instead
* of a true coordinate on the face.
@@ -2519,7 +2518,7 @@ static void knife_recalc_projmat(KnifeTool_OpData *kcd)
mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob->imat, kcd->vc.rv3d->viewinv[2]);
normalize_v3(kcd->proj_zaxis);
- kcd->is_ortho = ED_view3d_clip_range_get(kcd->eval_ctx.depsgraph,
+ kcd->is_ortho = ED_view3d_clip_range_get(kcd->vc.depsgraph,
kcd->vc.v3d, kcd->vc.rv3d,
&kcd->clipsta, &kcd->clipend, true);
}
@@ -2591,7 +2590,7 @@ static void knifetool_init_bmbvh(KnifeTool_OpData *kcd)
{
BM_mesh_elem_index_ensure(kcd->em->bm, BM_VERT);
- kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(&kcd->eval_ctx, kcd->em, kcd->scene, NULL);
+ kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(kcd->vc.depsgraph, kcd->em, kcd->scene, NULL);
kcd->bmbvh = BKE_bmbvh_new_from_editmesh(
kcd->em,
@@ -2625,7 +2624,6 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd,
kcd->ob = obedit;
kcd->ar = CTX_wm_region(C);
- CTX_data_eval_ctx(C, &kcd->eval_ctx);
em_setup_viewcontext(C, &kcd->vc);
kcd->em = BKE_editmesh_from_object(kcd->ob);
@@ -2793,7 +2791,6 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
- CTX_data_eval_ctx(C, &kcd->eval_ctx);
em_setup_viewcontext(C, &kcd->vc);
kcd->ar = kcd->vc.ar;
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index c98d22503e1..ba030c42a04 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -60,15 +60,13 @@
static LinkNode *knifeproject_poly_from_object(const bContext *C, Scene *scene, Object *ob, LinkNode *polys)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ARegion *ar = CTX_wm_region(C);
- EvaluationContext eval_ctx;
DerivedMesh *dm;
bool dm_needsFree;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (ob->type == OB_MESH || ob->derivedFinal) {
- dm = ob->derivedFinal ? ob->derivedFinal : mesh_get_derived_final(&eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ dm = ob->derivedFinal ? ob->derivedFinal : mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
dm_needsFree = false;
}
else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 793e5609d31..9817909ba4a 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -555,23 +555,20 @@ static void loopcut_update_edge(RingSelOpData *lcd, BMEdge *e, const int preview
}
}
-static void loopcut_mouse_move(const struct EvaluationContext *eval_ctx, RingSelOpData *lcd, const int previewlines)
+static void loopcut_mouse_move(RingSelOpData *lcd, const int previewlines)
{
float dist = ED_view3d_select_dist_px();
- BMEdge *e = EDBM_edge_find_nearest(eval_ctx, &lcd->vc, &dist);
+ BMEdge *e = EDBM_edge_find_nearest(&lcd->vc, &dist);
loopcut_update_edge(lcd, e, previewlines);
}
/* called by both init() and exec() */
static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
{
- EvaluationContext eval_ctx;
const bool is_interactive = (event != NULL);
Object *obedit = CTX_data_edit_object(C);
RingSelOpData *lcd;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
BKE_report(op->reports, RPT_WARNING, "Loop cut does not work well on deformed edit mesh display");
@@ -599,7 +596,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
if (is_interactive) {
copy_v2_v2_int(lcd->vc.mval, event->mval);
- loopcut_mouse_move(&eval_ctx, lcd, is_interactive ? 1 : 0);
+ loopcut_mouse_move(lcd, is_interactive ? 1 : 0);
}
else {
const int e_index = RNA_int_get(op->ptr, "edge_index");
@@ -672,14 +669,12 @@ static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
- EvaluationContext eval_ctx;
RingSelOpData *lcd = op->customdata;
float cuts = lcd->cuts;
float smoothness = lcd->smoothness;
bool show_cuts = false;
const bool has_numinput = hasNumInput(&lcd->num);
- CTX_data_eval_ctx(C, &eval_ctx);
em_setup_viewcontext(C, &lcd->vc);
lcd->ar = lcd->vc.ar;
@@ -773,7 +768,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
lcd->vc.mval[0] = event->mval[0];
lcd->vc.mval[1] = event->mval[1];
- loopcut_mouse_move(&eval_ctx, lcd, (int)lcd->cuts);
+ loopcut_mouse_move(lcd, (int)lcd->cuts);
ED_region_tag_redraw(lcd->ar);
handled = true;
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c
index 2ae48bee095..4081e3b0302 100644
--- a/source/blender/editors/mesh/editmesh_path.c
+++ b/source/blender/editors/mesh/editmesh_path.c
@@ -578,19 +578,19 @@ static bool edbm_shortest_path_pick_ex(
static int edbm_shortest_path_pick_exec(bContext *C, wmOperator *op);
-static BMElem *edbm_elem_find_nearest(const struct EvaluationContext *eval_ctx, ViewContext *vc, const char htype)
+static BMElem *edbm_elem_find_nearest(ViewContext *vc, const char htype)
{
BMEditMesh *em = vc->em;
float dist = ED_view3d_select_dist_px();
if ((em->selectmode & SCE_SELECT_VERTEX) && (htype == BM_VERT)) {
- return (BMElem *)EDBM_vert_find_nearest(eval_ctx, vc, &dist);
+ return (BMElem *)EDBM_vert_find_nearest(vc, &dist);
}
else if ((em->selectmode & SCE_SELECT_EDGE) && (htype == BM_EDGE)) {
- return (BMElem *)EDBM_edge_find_nearest(eval_ctx, vc, &dist);
+ return (BMElem *)EDBM_edge_find_nearest(vc, &dist);
}
else if ((em->selectmode & SCE_SELECT_FACE) && (htype == BM_FACE)) {
- return (BMElem *)EDBM_face_find_nearest(eval_ctx, vc, &dist);
+ return (BMElem *)EDBM_face_find_nearest(vc, &dist);
}
return NULL;
@@ -613,12 +613,10 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
return edbm_shortest_path_pick_exec(C, op);
}
- EvaluationContext eval_ctx;
ViewContext vc;
BMEditMesh *em;
bool track_active = true;
- CTX_data_eval_ctx(C, &eval_ctx);
em_setup_viewcontext(C, &vc);
copy_v2_v2_int(vc.mval, event->mval);
em = vc.em;
@@ -627,14 +625,14 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
BMElem *ele_src, *ele_dst;
if (!(ele_src = edbm_elem_active_elem_or_face_get(em->bm)) ||
- !(ele_dst = edbm_elem_find_nearest(&eval_ctx, &vc, ele_src->head.htype)))
+ !(ele_dst = edbm_elem_find_nearest(&vc, ele_src->head.htype)))
{
/* special case, toggle edge tags even when we don't have a path */
if (((em->selectmode & SCE_SELECT_EDGE) &&
(vc.scene->toolsettings->edge_mode != EDGE_MODE_SELECT)) &&
/* check if we only have a destination edge */
((ele_src == NULL) &&
- (ele_dst = edbm_elem_find_nearest(&eval_ctx, &vc, BM_EDGE))))
+ (ele_dst = edbm_elem_find_nearest(&vc, BM_EDGE))))
{
ele_src = ele_dst;
track_active = false;
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 33277cdcd9b..b45db94318b 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -213,7 +213,7 @@ static BLI_bitmap *edbm_backbuf_alloc(const int size)
/* reads rect, and builds selection array for quick lookup */
/* returns if all is OK */
bool EDBM_backbuf_border_init(
- const struct EvaluationContext *eval_ctx, ViewContext *vc, short xmin,
+ ViewContext *vc, short xmin,
short ymin, short xmax, short ymax)
{
struct ImBuf *buf;
@@ -224,7 +224,7 @@ bool EDBM_backbuf_border_init(
return false;
}
- buf = ED_view3d_backbuf_read(eval_ctx, vc, xmin, ymin, xmax, ymax);
+ buf = ED_view3d_backbuf_read(vc, xmin, ymin, xmax, ymax);
if ((buf == NULL) || (bm_vertoffs == 0)) {
return false;
}
@@ -287,7 +287,7 @@ static void edbm_mask_lasso_px_cb(int x, int x_end, int y, void *user_data)
* - grab again and compare
* returns 'OK'
*/
-bool EDBM_backbuf_border_mask_init(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
+bool EDBM_backbuf_border_mask_init(ViewContext *vc, const int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
{
unsigned int *dr, *dr_mask, *dr_mask_arr;
struct ImBuf *buf;
@@ -304,7 +304,7 @@ bool EDBM_backbuf_border_mask_init(const struct EvaluationContext *eval_ctx, Vie
return false;
}
- buf = ED_view3d_backbuf_read(eval_ctx, vc, xmin, ymin, xmax, ymax);
+ buf = ED_view3d_backbuf_read(vc, xmin, ymin, xmax, ymax);
if ((buf == NULL) || (bm_vertoffs == 0)) {
return false;
}
@@ -338,7 +338,7 @@ bool EDBM_backbuf_border_mask_init(const struct EvaluationContext *eval_ctx, Vie
/* circle shaped sample area */
bool EDBM_backbuf_circle_init(
- const struct EvaluationContext *eval_ctx, ViewContext *vc,
+ ViewContext *vc,
short xs, short ys, short rads)
{
struct ImBuf *buf;
@@ -358,7 +358,7 @@ bool EDBM_backbuf_circle_init(
xmin = xs - rads; xmax = xs + rads;
ymin = ys - rads; ymax = ys + rads;
- buf = ED_view3d_backbuf_read(eval_ctx, vc, xmin, ymin, xmax, ymax);
+ buf = ED_view3d_backbuf_read(vc, xmin, ymin, xmax, ymax);
if ((buf == NULL) || (bm_vertoffs == 0)) {
return false;
}
@@ -457,7 +457,7 @@ static void findnearestvert__doClosest(void *userData, BMVert *eve, const float
* \param use_cycle Cycle over elements within #FIND_NEAR_CYCLE_THRESHOLD_MIN in order of index.
*/
BMVert *EDBM_vert_find_nearest_ex(
- const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist,
+ ViewContext *vc, float *r_dist,
const bool use_select_bias, bool use_cycle)
{
BMesh *bm = vc->em->bm;
@@ -469,10 +469,10 @@ BMVert *EDBM_vert_find_nearest_ex(
BMVert *eve;
/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
- ED_view3d_backbuf_validate(eval_ctx, vc);
+ ED_view3d_backbuf_validate(vc);
index = ED_view3d_backbuf_sample_rect(
- eval_ctx, vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &dist_test);
+ vc, vc->mval, dist_px, bm_wireoffs, 0xFFFFFF, &dist_test);
eve = index ? BM_vert_at_index_find_or_table(bm, index - 1) : NULL;
if (eve) {
@@ -507,7 +507,7 @@ BMVert *EDBM_vert_find_nearest_ex(
data.cycle_index_prev = prev_select_index;
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- mesh_foreachScreenVert(eval_ctx, vc, findnearestvert__doClosest, &data, clip_flag);
+ mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, clip_flag);
hit = (data.use_cycle && data.hit_cycle.vert) ? &data.hit_cycle : &data.hit;
*r_dist = hit->dist;
@@ -519,9 +519,9 @@ BMVert *EDBM_vert_find_nearest_ex(
}
}
-BMVert *EDBM_vert_find_nearest(const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist)
+BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist)
{
- return EDBM_vert_find_nearest_ex(eval_ctx, vc, r_dist, false, false);
+ return EDBM_vert_find_nearest_ex(vc, r_dist, false, false);
}
/* find the distance to the edge we already have */
@@ -643,7 +643,7 @@ static void find_nearest_edge__doClosest(
}
BMEdge *EDBM_edge_find_nearest_ex(
- const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist,
+ ViewContext *vc, float *r_dist,
float *r_dist_center,
const bool use_select_bias, const bool use_cycle,
BMEdge **r_eed_zbuf)
@@ -662,12 +662,12 @@ BMEdge *EDBM_edge_find_nearest_ex(
vc->scene->toolsettings->selectmode |= SCE_SELECT_EDGE;
/* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */
- ED_view3d_backbuf_validate(eval_ctx, vc);
+ ED_view3d_backbuf_validate(vc);
/* restore `selectmode` */
vc->scene->toolsettings->selectmode = ts_selectmode;
- index = ED_view3d_backbuf_sample_rect(eval_ctx, vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test);
+ index = ED_view3d_backbuf_sample_rect(vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test);
eed = index ? BM_edge_at_index_find_or_table(bm, index - 1) : NULL;
if (r_eed_zbuf) {
@@ -685,7 +685,7 @@ BMEdge *EDBM_edge_find_nearest_ex(
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- mesh_foreachScreenEdge(eval_ctx, vc, find_nearest_edge_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ mesh_foreachScreenEdge(vc, find_nearest_edge_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
*r_dist_center = data.dist;
}
@@ -725,7 +725,7 @@ BMEdge *EDBM_edge_find_nearest_ex(
data.cycle_index_prev = prev_select_index;
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- mesh_foreachScreenEdge(eval_ctx, vc, find_nearest_edge__doClosest, &data, clip_flag);
+ mesh_foreachScreenEdge(vc, find_nearest_edge__doClosest, &data, clip_flag);
hit = (data.use_cycle && data.hit_cycle.edge) ? &data.hit_cycle : &data.hit;
*r_dist = hit->dist;
@@ -741,9 +741,9 @@ BMEdge *EDBM_edge_find_nearest_ex(
}
BMEdge *EDBM_edge_find_nearest(
- const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist)
+ ViewContext *vc, float *r_dist)
{
- return EDBM_edge_find_nearest_ex(eval_ctx, vc, r_dist, NULL, false, false, NULL);
+ return EDBM_edge_find_nearest_ex(vc, r_dist, NULL, false, false, NULL);
}
/* find the distance to the face we already have */
@@ -817,7 +817,7 @@ static void findnearestface__doClosest(void *userData, BMFace *efa, const float
BMFace *EDBM_face_find_nearest_ex(
- const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist,
+ ViewContext *vc, float *r_dist,
float *r_dist_center,
const bool use_select_bias, const bool use_cycle,
BMFace **r_efa_zbuf)
@@ -829,9 +829,9 @@ BMFace *EDBM_face_find_nearest_ex(
unsigned int index;
BMFace *efa;
- ED_view3d_backbuf_validate(eval_ctx, vc);
+ ED_view3d_backbuf_validate(vc);
- index = ED_view3d_backbuf_sample(eval_ctx, vc, vc->mval[0], vc->mval[1]);
+ index = ED_view3d_backbuf_sample(vc, vc->mval[0], vc->mval[1]);
efa = index ? BM_face_at_index_find_or_table(bm, index - 1) : NULL;
if (r_efa_zbuf) {
@@ -849,7 +849,7 @@ BMFace *EDBM_face_find_nearest_ex(
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- mesh_foreachScreenFace(eval_ctx, vc, find_nearest_face_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ mesh_foreachScreenFace(vc, find_nearest_face_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
*r_dist_center = data.dist;
}
@@ -887,7 +887,7 @@ BMFace *EDBM_face_find_nearest_ex(
data.cycle_index_prev = prev_select_index;
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
- mesh_foreachScreenFace(eval_ctx, vc, findnearestface__doClosest, &data, clip_flag);
+ mesh_foreachScreenFace(vc, findnearestface__doClosest, &data, clip_flag);
hit = (data.use_cycle && data.hit_cycle.face) ? &data.hit_cycle : &data.hit;
*r_dist = hit->dist;
@@ -902,9 +902,9 @@ BMFace *EDBM_face_find_nearest_ex(
}
}
-BMFace *EDBM_face_find_nearest(const struct EvaluationContext *eval_ctx, ViewContext *vc, float *r_dist)
+BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist)
{
- return EDBM_face_find_nearest_ex(eval_ctx, vc, r_dist, NULL, false, false, NULL);
+ return EDBM_face_find_nearest_ex(vc, r_dist, NULL, false, false, NULL);
}
#undef FIND_NEAR_SELECT_BIAS
@@ -917,7 +917,7 @@ BMFace *EDBM_face_find_nearest(const struct EvaluationContext *eval_ctx, ViewCon
* return 1 if found one
*/
static int unified_findnearest(
- const struct EvaluationContext *eval_ctx, ViewContext *vc,
+ ViewContext *vc,
Base **r_base, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
{
BMEditMesh *em = vc->em;
@@ -938,7 +938,7 @@ static int unified_findnearest(
/* TODO(campbell): perform selection as one pass
* instead of many smaller passes (which doesn't work for zbuf occlusion). */
uint bases_len = 0;
- Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(eval_ctx->view_layer, &bases_len);
+ Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(vc->view_layer, &bases_len);
/* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */
@@ -950,9 +950,9 @@ static int unified_findnearest(
Base *base_iter = bases[base_index];
Object *obedit = base_iter->object;
ED_view3d_viewcontext_init_object(vc, obedit);
- ED_view3d_backbuf_validate(eval_ctx, vc);
+ ED_view3d_backbuf_validate(vc);
- BMFace *efa_test = EDBM_face_find_nearest_ex(eval_ctx, vc, &dist, dist_center_p, true, use_cycle, &efa_zbuf);
+ BMFace *efa_test = EDBM_face_find_nearest_ex(vc, &dist, dist_center_p, true, use_cycle, &efa_zbuf);
if (efa && dist_center_p) {
dist = min_ff(dist_margin, dist_center);
}
@@ -971,8 +971,8 @@ static int unified_findnearest(
Base *base_iter = bases[base_index];
Object *obedit = base_iter->object;
ED_view3d_viewcontext_init_object(vc, obedit);
- ED_view3d_backbuf_validate(eval_ctx, vc);
- BMEdge *eed_test = EDBM_edge_find_nearest_ex(eval_ctx, vc, &dist, dist_center_p, true, use_cycle, &eed_zbuf);
+ ED_view3d_backbuf_validate(vc);
+ BMEdge *eed_test = EDBM_edge_find_nearest_ex(vc, &dist, dist_center_p, true, use_cycle, &eed_zbuf);
if (eed && dist_center_p) {
dist = min_ff(dist_margin, dist_center);
}
@@ -988,8 +988,8 @@ static int unified_findnearest(
Base *base_iter = bases[base_index];
Object *obedit = base_iter->object;
ED_view3d_viewcontext_init_object(vc, obedit);
- ED_view3d_backbuf_validate(eval_ctx, vc);
- BMVert *eve_test = EDBM_vert_find_nearest_ex(eval_ctx, vc, &dist, true, use_cycle);
+ ED_view3d_backbuf_validate(vc);
+ BMVert *eve_test = EDBM_vert_find_nearest_ex(vc, &dist, true, use_cycle);
if (eve_test) {
*r_base = base_iter;
eve = eve_test;
@@ -1640,7 +1640,6 @@ static void mouse_mesh_loop_edge(BMEditMesh *em, BMEdge *eed, bool select, bool
static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool ring)
{
- EvaluationContext eval_ctx;
ViewContext vc;
BMEditMesh *em;
BMEdge *eed;
@@ -1650,7 +1649,6 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
float dist = ED_view3d_select_dist_px() * 0.6666f;
float mvalf[2];
- CTX_data_eval_ctx(C, &eval_ctx);
em_setup_viewcontext(C, &vc);
mvalf[0] = (float)(vc.mval[0] = mval[0]);
mvalf[1] = (float)(vc.mval[1] = mval[1]);
@@ -1662,12 +1660,12 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
vc.scene->toolsettings->selectmode |= SCE_SELECT_EDGE;
/* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */
- ED_view3d_backbuf_validate(&eval_ctx, &vc);
+ ED_view3d_backbuf_validate(&vc);
/* restore `selectmode` */
vc.scene->toolsettings->selectmode = ts_selectmode;
- eed = EDBM_edge_find_nearest_ex(&eval_ctx, &vc, &dist, NULL, true, true, NULL);
+ eed = EDBM_edge_find_nearest_ex(&vc, &dist, NULL, true, true, NULL);
if (eed == NULL) {
return false;
}
@@ -1949,7 +1947,6 @@ void MESH_OT_select_interior_faces(wmOperatorType *ot)
bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
{
- EvaluationContext eval_ctx;
ViewContext vc;
Base *basact = NULL;
@@ -1958,18 +1955,17 @@ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect
BMFace *efa = NULL;
/* setup view context for argument to callbacks */
- CTX_data_eval_ctx(C, &eval_ctx);
em_setup_viewcontext(C, &vc);
vc.mval[0] = mval[0];
vc.mval[1] = mval[1];
- if (unified_findnearest(&eval_ctx, &vc, &basact, &eve, &eed, &efa)) {
+ if (unified_findnearest(&vc, &basact, &eve, &eed, &efa)) {
ED_view3d_viewcontext_init_object(&vc, basact->object);
/* Deselect everything */
if (extend == false && deselect == false && toggle == false) {
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);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob_iter = objects[ob_index];
@@ -2091,8 +2087,8 @@ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect
/* Changing active object is handy since it allows us to
* switch UV layers, vgroups for eg. */
- if (eval_ctx.view_layer->basact != basact) {
- eval_ctx.view_layer->basact = basact;
+ if (vc.view_layer->basact != basact) {
+ vc.view_layer->basact = basact;
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, vc.scene);
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
@@ -2318,14 +2314,12 @@ bool EDBM_selectmode_toggle(
bContext *C, const short selectmode_new,
const int action, const bool use_extend, const bool use_expand)
{
- EvaluationContext eval_ctx;
+ ViewLayer *view_layer = CTX_data_view_layer(C);
ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = NULL;
bool ret = false;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (obedit && obedit->type == OB_MESH) {
em = BKE_editmesh_from_object(obedit);
}
@@ -2369,7 +2363,7 @@ bool EDBM_selectmode_toggle(
}
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(view_layer, &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob_iter = objects[ob_index];
@@ -3021,7 +3015,6 @@ static void edbm_select_linked_pick_ex(BMEditMesh *em, BMElem *ele, bool sel, in
static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- EvaluationContext eval_ctx;
ViewContext vc;
Base *basact = NULL;
BMVert *eve;
@@ -3038,12 +3031,11 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
view3d_operator_needs_opengl(C);
/* setup view context for argument to callbacks */
- CTX_data_eval_ctx(C, &eval_ctx);
em_setup_viewcontext(C, &vc);
{
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);
bool has_edges = false;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob_iter = objects[ob_index];
@@ -3062,7 +3054,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
vc.mval[1] = event->mval[1];
/* return warning! */
- if (unified_findnearest(&eval_ctx, &vc, &basact, &eve, &eed, &efa) == 0) {
+ if (unified_findnearest(&vc, &basact, &eve, &eed, &efa) == 0) {
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, basact->object->data);
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 5adeffb2e1f..3d12f8ce868 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -336,7 +336,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em)
ED_view3d_init_mats_rv3d(obedit, ar->regiondata);
struct SnapObjectContext *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,
ar, CTX_wm_view3d(C));
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 3382847c8a4..af4ef00bc25 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1481,7 +1481,7 @@ static void scale_point(float c1[3], const float p[3], const float s)
}
bool BMBVH_EdgeVisible(struct BMBVHTree *tree, BMEdge *e,
- const struct Depsgraph *depsgraph,
+ struct Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, Object *obedit)
{
BMFace *f;
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index bd2ad21d51c..c94015de0f6 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -73,22 +73,20 @@ static void createVertsTrisData(bContext *C, LinkNode *obs,
Object *ob;
LinkNode *oblink, *dmlink;
DerivedMesh *dm;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
LinkNodePair dms_pair = {NULL, NULL};
int nverts, ntris, *tris;
float *verts;
- CTX_data_eval_ctx(C, &eval_ctx);
-
nverts = 0;
ntris = 0;
/* calculate number of verts and tris */
for (oblink = obs; oblink; oblink = oblink->next) {
ob = (Object *) oblink->link;
- dm = mesh_create_derived_no_virtual(&eval_ctx, scene, ob, NULL, CD_MASK_MESH);
+ dm = mesh_create_derived_no_virtual(depsgraph, scene, ob, NULL, CD_MASK_MESH);
DM_ensure_tessface(dm);
BLI_linklist_append(&dms_pair, dm);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index dec13273417..83458127820 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -80,7 +80,7 @@
* return 0 if no join is made (error) and 1 if the join is done */
static void join_mesh_single(
- const EvaluationContext *eval_ctx, Main *bmain, Scene *scene,
+ Depsgraph *depsgraph, Main *bmain, Scene *scene,
Object *ob_dst, Object *ob_src, float imat[4][4],
MVert **mvert_pp, MEdge **medge_pp, MLoop **mloop_pp, MPoly **mpoly_pp,
CustomData *vdata, CustomData *edata, CustomData *ldata, CustomData *pdata,
@@ -208,7 +208,7 @@ static void join_mesh_single(
if (ob_src != ob_dst) {
MultiresModifierData *mmd;
- multiresModifier_prepare_join(eval_ctx, scene, ob_src, ob_dst);
+ multiresModifier_prepare_join(depsgraph, scene, ob_src, ob_dst);
if ((mmd = get_multires_modifier(scene, ob_src, true))) {
ED_object_iter_other(bmain, ob_src, true,
@@ -293,8 +293,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* count & check */
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
@@ -490,7 +489,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* active mesh will remain first ones in new result of the merge, in same order for CD layers, etc. See also T50084.
*/
join_mesh_single(
- &eval_ctx, bmain, scene,
+ depsgraph, bmain, scene,
ob, ob, imat,
&mvert, &medge, &mloop, &mpoly,
&vdata, &edata, &ldata, &pdata,
@@ -507,7 +506,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* only join if this is a mesh */
if (base->object->type == OB_MESH) {
join_mesh_single(
- &eval_ctx, bmain, scene,
+ depsgraph, bmain, scene,
ob, base->object, imat,
&mvert, &medge, &mloop, &mpoly,
&vdata, &edata, &ldata, &pdata,
@@ -607,7 +606,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Mesh *me = (Mesh *)ob->data;
Mesh *selme = NULL;
DerivedMesh *dm = NULL;
@@ -615,8 +614,6 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
KeyBlock *kb;
bool ok = false, nonequal_verts = false;
- CTX_data_eval_ctx(C, &eval_ctx);
-
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
if (base->object == ob) continue;
@@ -658,7 +655,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
selme = (Mesh *)base->object->data;
if (selme->totvert == me->totvert) {
- dm = mesh_get_derived_deform(&eval_ctx, scene, base->object, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_deform(depsgraph, scene, base->object, CD_MASK_BAREMESH);
if (!dm) continue;
@@ -1009,7 +1006,6 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, DerivedMesh *dm)
*/
bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size)
{
- EvaluationContext eval_ctx;
ViewContext vc;
Mesh *me = ob->data;
@@ -1018,7 +1014,6 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
if (!me || me->totpoly == 0)
return false;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
if (size) {
@@ -1026,11 +1021,11 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
* on an edge in the backbuf, we can still select a face */
float dummy_dist;
- *index = ED_view3d_backbuf_sample_rect(&eval_ctx, &vc, mval, size, 1, me->totpoly + 1, &dummy_dist);
+ *index = ED_view3d_backbuf_sample_rect(&vc, mval, size, 1, me->totpoly + 1, &dummy_dist);
}
else {
/* sample only on the exact position */
- *index = ED_view3d_backbuf_sample(&eval_ctx, &vc, mval[0], mval[1]);
+ *index = ED_view3d_backbuf_sample(&vc, mval[0], mval[1]);
}
if ((*index) == 0 || (*index) > (unsigned int)me->totpoly)
@@ -1069,12 +1064,10 @@ static void ed_mesh_pick_face_vert__mpoly_find(
*/
bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size)
{
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
unsigned int poly_index;
Mesh *me = ob->data;
- CTX_data_eval_ctx(C, &eval_ctx);
-
BLI_assert(me && GS(me->id.name) == ID_ME);
if (ED_mesh_pick_face(C, ob, mval, &poly_index, size)) {
@@ -1082,7 +1075,7 @@ bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned
struct ARegion *ar = CTX_wm_region(C);
/* derived mesh to find deformed locations */
- DerivedMesh *dm = mesh_get_derived_final(&eval_ctx, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+ DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
int v_idx_best = ORIGINDEX_NONE;
@@ -1179,12 +1172,9 @@ static void ed_mesh_pick_vert__mapFunc(void *userData, int index, const float co
}
bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index, int size, bool use_zbuf)
{
- EvaluationContext eval_ctx;
ViewContext vc;
Mesh *me = ob->data;
- CTX_data_eval_ctx(C, &eval_ctx);
-
BLI_assert(me && GS(me->id.name) == ID_ME);
if (!me || me->totvert == 0)
@@ -1198,11 +1188,11 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
* on an face in the backbuf, we can still select a vert */
float dummy_dist;
- *index = ED_view3d_backbuf_sample_rect(&eval_ctx, &vc, mval, size, 1, me->totvert + 1, &dummy_dist);
+ *index = ED_view3d_backbuf_sample_rect(&vc, mval, size, 1, me->totvert + 1, &dummy_dist);
}
else {
/* sample only on the exact position */
- *index = ED_view3d_backbuf_sample(&eval_ctx, &vc, mval[0], mval[1]);
+ *index = ED_view3d_backbuf_sample(&vc, mval[0], mval[1]);
}
if ((*index) == 0 || (*index) > (unsigned int)me->totvert)
@@ -1212,7 +1202,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
}
else {
/* derived mesh to find deformed locations */
- DerivedMesh *dm = mesh_get_derived_final(&eval_ctx, vc.scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm = mesh_get_derived_final(vc.depsgraph, vc.scene, ob, CD_MASK_BAREMESH);
ARegion *ar = vc.ar;
RegionView3D *rv3d = ar->regiondata;
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 6dd16b52387..0aea5cb5480 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -587,7 +587,6 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
{
static MetaElem *startelem = NULL;
Object *obedit = CTX_data_edit_object(C);
- EvaluationContext eval_ctx;
ViewContext vc;
MetaBall *mb = (MetaBall *)obedit->data;
MetaElem *ml, *ml_act = NULL;
@@ -595,12 +594,11 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
unsigned int buffer[MAXPICKBUF];
rcti rect;
- CTX_data_eval_ctx(C, &eval_ctx);
ED_view3d_viewcontext_init(C, &vc);
BLI_rcti_init_pt_radius(&rect, mval, 12);
- hits = view3d_opengl_select(&eval_ctx, &vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
+ hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, VIEW3D_SELECT_PICK_NEAREST);
/* does startelem exist? */
ml = mb->editelems->first;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index d2c859565a3..4abd80a18e8 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -223,19 +223,17 @@ void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3],
{
Object *ob = base->object;
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
if (!scene) return;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (loc)
copy_v3_v3(ob->loc, loc);
if (rot)
copy_v3_v3(ob->rot, rot);
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(depsgraph, scene, ob);
}
/* Uses context to figure out transform for primitive.
@@ -1431,6 +1429,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
{
Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase *lb_duplis;
DupliObject *dob;
GHash *dupli_gh, *parent_gh = NULL;
@@ -1439,7 +1438,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
return;
}
- lb_duplis = object_duplilist(bmain->eval_ctx, scene, base->object);
+ lb_duplis = object_duplilist(depsgraph, scene, base->object);
dupli_gh = BLI_ghash_ptr_new(__func__);
if (use_hierarchy) {
@@ -1638,24 +1637,24 @@ static const EnumPropertyItem convert_target_items[] = {
{0, NULL, 0, NULL, NULL}
};
-static void convert_ensure_curve_cache(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *ob)
+static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
if (ob->curve_cache == NULL) {
/* Force creation. This is normally not needed but on operator
* redo we might end up with an object which isn't evaluated yet.
*/
if (ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) {
- BKE_displist_make_curveTypes(eval_ctx, scene, ob, false);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, false);
}
else if (ob->type == OB_MBALL) {
- BKE_displist_make_mball(bmain->eval_ctx, scene, ob);
+ BKE_displist_make_mball(depsgraph, scene, ob);
}
}
}
-static void curvetomesh(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *ob)
+static void curvetomesh(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- convert_ensure_curve_cache(eval_ctx, bmain, scene, ob);
+ convert_ensure_curve_cache(depsgraph, scene, ob);
BKE_mesh_from_nurbs(ob); /* also does users */
if (ob->type == OB_MESH) {
@@ -1700,9 +1699,9 @@ static Base *duplibase_for_convert(Main *bmain, Scene *scene, ViewLayer *view_la
static int convert_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- EvaluationContext eval_ctx;
Base *basen = NULL, *basact = NULL;
Object *ob1, *newob, *obact = CTX_data_active_object(C);
DerivedMesh *dm;
@@ -1714,8 +1713,6 @@ static int convert_exec(bContext *C, wmOperator *op)
bool keep_original = RNA_boolean_get(op->ptr, "keep_original");
int a, mballConverted = 0;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* don't forget multiple users! */
{
@@ -1766,7 +1763,6 @@ static int convert_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&base->object->id, OB_RECALC_DATA);
}
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
uint64_t customdata_mask_prev = scene->customdata_mask;
scene->customdata_mask |= CD_MASK_MESH;
BKE_scene_graph_update_tagged(depsgraph, bmain);
@@ -1810,7 +1806,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob = ob;
}
- BKE_mesh_to_curve(&eval_ctx, scene, newob);
+ BKE_mesh_to_curve(depsgraph, scene, newob);
if (newob->type == OB_CURVE) {
BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */
@@ -1840,7 +1836,7 @@ static int convert_exec(bContext *C, wmOperator *op)
/* note: get the mesh from the original, not from the copy in some
* cases this doesnt give correct results (when MDEF is used for eg)
*/
- dm = mesh_get_derived_final(&eval_ctx, scene, newob, CD_MASK_MESH);
+ dm = mesh_get_derived_final(depsgraph, scene, newob, CD_MASK_MESH);
DM_to_mesh(dm, newob->data, newob, CD_MASK_MESH, true);
@@ -1912,7 +1908,7 @@ static int convert_exec(bContext *C, wmOperator *op)
BKE_curve_curve_dimension_update(cu);
if (target == OB_MESH) {
- curvetomesh(&eval_ctx, bmain, scene, newob);
+ curvetomesh(depsgraph, scene, newob);
/* meshes doesn't use displist */
BKE_object_free_curve_cache(newob);
@@ -1936,7 +1932,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob = ob;
}
- curvetomesh(&eval_ctx, bmain, scene, newob);
+ curvetomesh(depsgraph, scene, newob);
/* meshes doesn't use displist */
BKE_object_free_curve_cache(newob);
@@ -1974,7 +1970,7 @@ static int convert_exec(bContext *C, wmOperator *op)
for (a = 0; a < newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
}
- convert_ensure_curve_cache(&eval_ctx, bmain, scene, baseob);
+ convert_ensure_curve_cache(depsgraph, scene, baseob);
BKE_mesh_from_metaball(&baseob->curve_cache->disp, newob->data);
if (obact->type == OB_MBALL) {
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 40a49df1657..60533e382e8 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -623,11 +623,11 @@ static size_t initialize_internal_images(BakeImages *bake_images, ReportList *re
}
/* create new mesh with edit mode changes and modifiers applied */
-static Mesh *bake_mesh_new_from_object(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *ob)
+static Mesh *bake_mesh_new_from_object(Depsgraph *depsgraph, Main *bmain, Scene *scene, Object *ob)
{
ED_object_editmode_load(ob);
- Mesh *me = BKE_mesh_new_from_object(eval_ctx, bmain, scene, ob, 1, 0, 0);
+ Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, 1, 0, 0);
if (me->flag & ME_AUTOSMOOTH) {
BKE_mesh_split_faces(me, true);
}
@@ -645,9 +645,7 @@ static int bake(
const char *custom_cage, const char *filepath, const int width, const int height,
const char *identifier, ScrArea *sa, const char *uv_layer)
{
- EvaluationContext *eval_ctx = DEG_evaluation_context_new(DAG_EVAL_RENDER);
Depsgraph *depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
- DEG_evaluation_context_init_from_view_layer_for_render(eval_ctx, depsgraph, scene, view_layer);
int op_result = OPERATOR_CANCELLED;
bool ok = false;
@@ -795,7 +793,7 @@ static int bake(
BKE_scene_graph_update_tagged(depsgraph, bmain);
/* get the mesh as it arrives in the renderer */
- me_low = bake_mesh_new_from_object(eval_ctx, bmain, scene, ob_low);
+ me_low = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
/* populate the pixel array with the face data */
if ((is_selected_to_active && (ob_cage == NULL) && is_cage) == false)
@@ -810,7 +808,7 @@ static int bake(
/* prepare cage mesh */
if (ob_cage) {
- me_cage = bake_mesh_new_from_object(eval_ctx, bmain, scene, ob_cage);
+ me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_cage);
if ((me_low->totpoly != me_cage->totpoly) || (me_low->totloop != me_cage->totloop)) {
BKE_report(reports, RPT_ERROR,
"Invalid cage object, the cage mesh must have the same number "
@@ -842,7 +840,7 @@ static int bake(
ob_low->modifiers = modifiers_tmp;
/* get the cage mesh as it arrives in the renderer */
- me_cage = bake_mesh_new_from_object(eval_ctx, bmain, scene, ob_low);
+ me_cage = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
RE_bake_pixels_populate(me_cage, pixel_array_low, num_pixels, &bake_images, uv_layer);
}
@@ -868,7 +866,7 @@ static int bake(
tmd->quad_method = MOD_TRIANGULATE_QUAD_FIXED;
tmd->ngon_method = MOD_TRIANGULATE_NGON_EARCLIP;
- highpoly[i].me = bake_mesh_new_from_object(eval_ctx, bmain, scene, highpoly[i].ob);
+ highpoly[i].me = bake_mesh_new_from_object(depsgraph, bmain, scene, highpoly[i].ob);
highpoly[i].ob->restrictflag &= ~OB_RESTRICT_RENDER;
/* lowpoly to highpoly transformation matrix */
@@ -971,7 +969,7 @@ cage_cleanup:
md->mode &= ~eModifierMode_Render;
}
- me_nores = bake_mesh_new_from_object(eval_ctx, bmain, scene, ob_low);
+ me_nores = bake_mesh_new_from_object(depsgraph, bmain, scene, ob_low);
RE_bake_pixels_populate(me_nores, pixel_array_low, num_pixels, &bake_images, uv_layer);
RE_bake_normal_world_to_tangent(pixel_array_low, num_pixels, depth, result, me_nores, normal_swizzle, ob_low->obmat);
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 1a20a8db5b3..ca742222d81 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -684,8 +684,6 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
static int stretchto_reset_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO);
bStretchToConstraint *data = (con) ? (bStretchToConstraint *)con->data : NULL;
@@ -732,8 +730,6 @@ void CONSTRAINT_OT_stretchto_reset(wmOperatorType *ot)
static int limitdistance_reset_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT);
bDistLimitConstraint *data = (con) ? (bDistLimitConstraint *)con->data : NULL;
@@ -781,9 +777,7 @@ void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob, bConstraint *con, float invmat[4][4], const int owner)
{
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* nullify inverse matrix first */
unit_m4(invmat);
@@ -810,7 +804,7 @@ static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob
* to use as baseline ("pmat") to derive delta from. This extra calc saves users
* from having pressing "Clear Inverse" first
*/
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
copy_m4_m4(pmat, pchan->pose_mat);
/* 2. knock out constraints starting from this one */
@@ -827,7 +821,7 @@ static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob
}
/* 3. solve pose without disabled constraints */
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
/* 4. determine effect of constraint by removing the newly calculated
* pchan->pose_mat from the original pchan->pose_mat, thus determining
@@ -850,7 +844,7 @@ static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob
}
/* 6. recalculate pose with new inv-mat applied */
- BKE_pose_where_is(&eval_ctx, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob);
}
}
if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) {
@@ -861,7 +855,7 @@ static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob
BLI_assert(BLI_findindex(&ob->constraints, con) != -1);
/* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(invmat, workob.obmat);
}
}
@@ -870,8 +864,6 @@ static void child_get_inverse_matrix(const bContext *C, Scene *scene, Object *ob
/* ChildOf Constraint - set inverse callback */
static int childof_set_inverse_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
@@ -923,8 +915,6 @@ void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot)
static int childof_clear_inverse_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
@@ -972,8 +962,6 @@ void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot)
static int followpath_path_animate_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_FOLLOWPATH);
bFollowPathConstraint *data = (con) ? (bFollowPathConstraint *)con->data : NULL;
@@ -1098,8 +1086,6 @@ void CONSTRAINT_OT_followpath_path_animate(wmOperatorType *ot)
static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
@@ -1149,8 +1135,6 @@ void CONSTRAINT_OT_objectsolver_set_inverse(wmOperatorType *ot)
static int objectsolver_clear_inverse_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
@@ -1320,8 +1304,6 @@ void CONSTRAINT_OT_delete(wmOperatorType *ot)
static int constraint_move_down_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, 0);
@@ -1371,8 +1353,6 @@ void CONSTRAINT_OT_move_down(wmOperatorType *ot)
static int constraint_move_up_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, 0);
@@ -1593,8 +1573,6 @@ void OBJECT_OT_constraints_copy(wmOperatorType *ot)
/* get the Object and/or PoseChannel to use as target */
static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob, bPoseChannel **tar_pchan, bool add)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *obact = ED_object_active_context(C);
bPoseChannel *pchanact = BKE_pose_channel_active(obact);
bool only_curve = false, only_mesh = false, only_ob = false;
@@ -1673,7 +1651,7 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
/* for armatures in pose mode, look inside the armature for the active bone
* so that we set up cross-armature constraints with less effort
*/
- if ((ob->type == OB_ARMATURE) && (eval_ctx.mode & OB_MODE_POSE) &&
+ if ((ob->type == OB_ARMATURE) && (ob->mode & OB_MODE_POSE) &&
(!only_curve && !only_mesh))
{
/* just use the active bone, and assume that it is visible + usable */
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index 2daa8652335..603f5b1c77f 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -94,7 +94,6 @@ static const EnumPropertyItem DT_layer_items[] = {
static const EnumPropertyItem *dt_layers_select_src_itemf(
bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- EvaluationContext eval_ctx;
EnumPropertyItem *item = NULL, tmp_item = {0};
int totitem = 0;
const int data_type = RNA_enum_get(ptr, "data_type");
@@ -103,7 +102,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
return rna_enum_dt_layers_select_src_items;
}
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ACTIVE_SRC);
RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
@@ -142,7 +141,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
int num_data, i;
/* XXX Is this OK? */
- dm_src = mesh_get_derived_final(&eval_ctx, scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPUV);
+ dm_src = mesh_get_derived_final(depsgraph, scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPUV);
ldata = dm_src->getLoopDataLayout(dm_src);
num_data = CustomData_number_of_layers(ldata, CD_MLOOPUV);
@@ -165,7 +164,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(
int num_data, i;
/* XXX Is this OK? */
- dm_src = mesh_get_derived_final(&eval_ctx, scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL);
+ dm_src = mesh_get_derived_final(depsgraph, scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL);
ldata = dm_src->getLoopDataLayout(dm_src);
num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
@@ -347,9 +346,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob_src = ED_object_active_context(C);
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase ctx_objects;
CollectionPointerLink *ctx_ob_dst;
@@ -418,7 +415,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
}
if (BKE_object_data_transfer_mesh(
- &eval_ctx, scene, ob_src, ob_dst, data_type, use_create,
+ depsgraph, scene, ob_src, ob_dst, data_type, use_create,
map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode,
space_transform, use_auto_transform,
max_distance, ray_radius, islands_precision,
@@ -628,11 +625,9 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob_act = ED_object_active_context(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
DataTransferModifierData *dtmd;
- CTX_data_eval_ctx(C, &eval_ctx);
-
dtmd = (DataTransferModifierData *)edit_modifier_property_get(op, ob_act, eModifierType_DataTransfer);
/* If we have a modifier, we transfer data layout from this modifier's source object to active one.
@@ -647,7 +642,7 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_object_data_transfer_layout(&eval_ctx, scene, ob_src, ob_dst, dtmd->data_types, use_delete,
+ BKE_object_data_transfer_layout(depsgraph, scene, ob_src, ob_dst, dtmd->data_types, use_delete,
dtmd->layers_select_src, dtmd->layers_select_dst);
DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
@@ -677,7 +672,7 @@ static int datalayout_transfer_exec(bContext *C, wmOperator *op)
for (ctx_ob_dst = ctx_objects.first; ctx_ob_dst; ctx_ob_dst = ctx_ob_dst->next) {
Object *ob_dst = ctx_ob_dst->ptr.data;
if (data_transfer_exec_is_object_valid(op, ob_src, ob_dst, false)) {
- BKE_object_data_transfer_layout(&eval_ctx, scene, ob_src, ob_dst, data_type, use_delete,
+ BKE_object_data_transfer_layout(depsgraph, scene, ob_src, ob_dst, data_type, use_delete,
layers_select_src, layers_select_dst);
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index a17b1c122ad..e884989b6b5 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1135,8 +1135,7 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot)
void ED_objects_recalculate_paths(bContext *C, Scene *scene)
{
struct Main *bmain = CTX_data_main(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase targets = {NULL, NULL};
/* loop over objects in scene */
@@ -1149,7 +1148,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
CTX_DATA_END;
/* recalculate paths, then free */
- animviz_calc_motionpaths(&eval_ctx, bmain, scene, &targets);
+ animviz_calc_motionpaths(depsgraph, bmain, scene, &targets);
BLI_freelistN(&targets);
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 3ff794772fa..b5a71bb7a35 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -471,14 +471,11 @@ static int add_hook_object(const bContext *C, Main *bmain, Scene *scene, ViewLay
{
ModifierData *md = NULL;
HookModifierData *hmd = NULL;
- EvaluationContext eval_ctx;
float cent[3];
float pose_mat[4][4];
int tot, ok, *indexar;
char name[MAX_NAME];
- CTX_data_eval_ctx(C, &eval_ctx);
-
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
if (!ok) {
@@ -547,7 +544,7 @@ static int add_hook_object(const bContext *C, Main *bmain, Scene *scene, ViewLay
/* matrix calculus */
/* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
/* (parentinv ) */
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(CTX_data_depsgraph(C), scene, ob);
invert_m4_m4(ob->imat, ob->obmat);
/* apparently this call goes from right to left... */
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index f61e597e69e..3fb0e75a01e 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -197,7 +197,7 @@ bool ED_object_mode_generic_enter(
* Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run.
*/
static bool ed_object_mode_generic_exit_ex(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob,
bool only_test)
{
@@ -230,7 +230,7 @@ static bool ed_object_mode_generic_exit_ex(
if (only_test) {
return true;
}
- ED_object_sculptmode_exit_ex(eval_ctx, scene, ob);
+ ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
}
}
else {
@@ -244,17 +244,17 @@ static bool ed_object_mode_generic_exit_ex(
}
void ED_object_mode_generic_exit(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob)
{
- ed_object_mode_generic_exit_ex(eval_ctx, scene, ob, false);
+ ed_object_mode_generic_exit_ex(depsgraph, scene, ob, false);
}
bool ED_object_mode_generic_has_data(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Object *ob)
{
- return ed_object_mode_generic_exit_ex(eval_ctx, NULL, ob, true);
+ return ed_object_mode_generic_exit_ex(depsgraph, NULL, ob, true);
}
/** \} */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index c79bd3bcb1d..5e12a15b49f 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -76,6 +76,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -522,7 +523,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
return 1;
}
-static int modifier_apply_shape(ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ModifierData *md)
+static int modifier_apply_shape(ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -555,7 +556,7 @@ static int modifier_apply_shape(ReportList *reports, const EvaluationContext *ev
return 0;
}
- dm = mesh_create_derived_for_modifier(eval_ctx, scene, ob, md, 0);
+ dm = mesh_create_derived_for_modifier(depsgraph, scene, ob, md, 0);
if (!dm) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled or returned error, skipping apply");
return 0;
@@ -582,7 +583,7 @@ static int modifier_apply_shape(ReportList *reports, const EvaluationContext *ev
return 1;
}
-static int modifier_apply_obdata(ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ModifierData *md)
+static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scene *scene, Object *ob, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -608,13 +609,13 @@ static int modifier_apply_obdata(ReportList *reports, const EvaluationContext *e
multires_force_update(ob);
if (mmd && mmd->totlvl && mti->type == eModifierTypeType_OnlyDeform) {
- if (!multiresModifier_reshapeFromDeformMod(eval_ctx, scene, mmd, ob, md)) {
+ if (!multiresModifier_reshapeFromDeformMod(depsgraph, scene, mmd, ob, md)) {
BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
return 0;
}
}
else {
- dm = mesh_create_derived_for_modifier(eval_ctx, scene, ob, md, 1);
+ dm = mesh_create_derived_for_modifier(depsgraph, scene, ob, md, 1);
if (!dm) {
BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping apply");
return 0;
@@ -640,7 +641,7 @@ static int modifier_apply_obdata(ReportList *reports, const EvaluationContext *e
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts);
- mti->deformVerts(md, eval_ctx, ob, NULL, vertexCos, numVerts, 0);
+ mti->deformVerts(md, depsgraph, ob, NULL, vertexCos, numVerts, 0);
BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos);
MEM_freeN(vertexCos);
@@ -662,7 +663,7 @@ static int modifier_apply_obdata(ReportList *reports, const EvaluationContext *e
if (psys->part->type != PART_HAIR)
continue;
- psys_apply_hair_lattice(eval_ctx, scene, ob, psys);
+ psys_apply_hair_lattice(depsgraph, scene, ob, psys);
}
}
@@ -670,7 +671,7 @@ static int modifier_apply_obdata(ReportList *reports, const EvaluationContext *e
}
int ED_object_modifier_apply(
- ReportList *reports, const EvaluationContext *eval_ctx,
+ ReportList *reports, Depsgraph *depsgraph,
Scene *scene, Object *ob, ModifierData *md, int mode)
{
int prev_mode;
@@ -699,13 +700,13 @@ int ED_object_modifier_apply(
md->mode |= eModifierMode_Realtime;
if (mode == MODIFIER_APPLY_SHAPE) {
- if (!modifier_apply_shape(reports, eval_ctx, scene, ob, md)) {
+ if (!modifier_apply_shape(reports, depsgraph, scene, ob, md)) {
md->mode = prev_mode;
return 0;
}
}
else {
- if (!modifier_apply_obdata(reports, eval_ctx, scene, ob, md)) {
+ if (!modifier_apply_obdata(reports, depsgraph, scene, ob, md)) {
md->mode = prev_mode;
return 0;
}
@@ -1004,15 +1005,13 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
static int modifier_apply_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int apply_as = RNA_enum_get(op->ptr, "apply_as");
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
- if (!md || !ED_object_modifier_apply(op->reports, &eval_ctx, scene, ob, md, apply_as)) {
+ if (!md || !ED_object_modifier_apply(op->reports, depsgraph, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}
@@ -1237,6 +1236,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
static int multires_reshape_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *ob = ED_object_active_context(C), *secondob = NULL;
Scene *scene = CTX_data_scene(C);
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
@@ -1263,10 +1263,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
- if (!multiresModifier_reshape(&eval_ctx, scene, mmd, ob, secondob)) {
+ if (!multiresModifier_reshape(depsgraph, scene, mmd, ob, secondob)) {
BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices");
return OPERATOR_CANCELLED;
}
@@ -1699,7 +1696,7 @@ static void skin_armature_bone_create(Object *skin_ob,
}
}
-static Object *modifier_skin_armature_create(const EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *skin_ob)
+static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain, Scene *scene, Object *skin_ob)
{
BLI_bitmap *edges_visited;
DerivedMesh *deform_dm;
@@ -1712,7 +1709,7 @@ static Object *modifier_skin_armature_create(const EvaluationContext *eval_ctx,
int *emap_mem;
int v;
- deform_dm = mesh_get_derived_deform(eval_ctx, scene, skin_ob, CD_MASK_BAREMESH);
+ deform_dm = mesh_get_derived_deform(depsgraph, scene, skin_ob, CD_MASK_BAREMESH);
mvert = deform_dm->getVertArray(deform_dm);
/* add vertex weights to original mesh */
@@ -1722,7 +1719,8 @@ static Object *modifier_skin_armature_create(const EvaluationContext *eval_ctx,
NULL,
me->totvert);
- arm_ob = BKE_object_add(bmain, scene, eval_ctx->view_layer, OB_ARMATURE, NULL);
+ ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+ arm_ob = BKE_object_add(bmain, scene, view_layer, OB_ARMATURE, NULL);
BKE_object_transform_copy(arm_ob, skin_ob);
arm = arm_ob->data;
arm->layer = 1;
@@ -1780,6 +1778,7 @@ static Object *modifier_skin_armature_create(const EvaluationContext *eval_ctx,
static int skin_armature_create_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C), *arm_ob;
Mesh *me = ob->data;
@@ -1791,11 +1790,8 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* create new armature */
- arm_ob = modifier_skin_armature_create(&eval_ctx, bmain, scene, ob);
+ arm_ob = modifier_skin_armature_create(depsgraph, bmain, scene, ob);
/* add a modifier to connect the new armature to the mesh */
arm_md = (ArmatureModifierData *)modifier_new(eModifierType_Armature);
@@ -1915,11 +1911,9 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform);
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (!mmd)
return OPERATOR_CANCELLED;
@@ -1957,17 +1951,17 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
mmd->modifier.mode |= eModifierMode_Realtime;
if (ob->type == OB_MESH) {
- dm = mesh_create_derived_view(&eval_ctx, scene, ob, 0);
+ dm = mesh_create_derived_view(depsgraph, scene, ob, 0);
dm->release(dm);
}
else if (ob->type == OB_LATTICE) {
- BKE_lattice_modifiers_calc(&eval_ctx, scene, ob);
+ BKE_lattice_modifiers_calc(depsgraph, scene, ob);
}
else if (ob->type == OB_MBALL) {
- BKE_displist_make_mball(&eval_ctx, scene, ob);
+ BKE_displist_make_mball(depsgraph, scene, ob);
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- BKE_displist_make_curveTypes(&eval_ctx, scene, ob, 0);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, 0);
}
mmd->bindfunc = NULL;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 6297adc6a0c..417c32a71e9 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -129,9 +129,9 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = CTX_data_edit_object(C);
- EvaluationContext eval_ctx;
BMVert *eve;
BMIter iter;
Curve *cu;
@@ -141,8 +141,6 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
Object *par;
int a, v1 = 0, v2 = 0, v3 = 0, v4 = 0, nr = 1;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* we need 1 to 3 selected vertices */
if (obedit->type == OB_MESH) {
@@ -161,7 +159,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* derivedMesh might be needed for solving parenting,
* so re-create it here */
- makeDerivedMesh(&eval_ctx, scene, obedit, em, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX, false);
+ makeDerivedMesh(depsgraph, scene, obedit, em, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX, false);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
@@ -257,7 +255,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
ob->par3 = v3 - 1;
/* inverse parent matrix */
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
@@ -265,7 +263,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
ob->par1 = v1 - 1;
/* inverse parent matrix */
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
}
@@ -619,12 +617,10 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
int partype, const bool xmirror, const bool keep_transform, const int vert_par[3])
{
Main *bmain = CTX_data_main(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
bPoseChannel *pchan = NULL;
const bool pararm = ELEM(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
- CTX_data_eval_ctx(C, &eval_ctx);
-
DEG_id_tag_update(&par->id, OB_RECALC_OB);
/* preconditions */
@@ -636,7 +632,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
- BKE_displist_make_curveTypes(&eval_ctx, scene, par, 0); /* force creation of path data */
+ BKE_displist_make_curveTypes(depsgraph, scene, par, 0); /* force creation of path data */
}
else {
cu->flag |= CU_FOLLOW;
@@ -778,32 +774,32 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
data = con->data;
data->tar = par;
- BKE_constraint_target_matrix_get(&eval_ctx, scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
+ BKE_constraint_target_matrix_get(depsgraph, scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
copy_v3_v3(ob->loc, vec);
}
else if (pararm && (ob->type == OB_MESH) && (par->type == OB_ARMATURE)) {
if (partype == PAR_ARMATURE_NAME) {
- ED_object_vgroup_calc_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_NAME, false);
+ ED_object_vgroup_calc_from_armature(reports, depsgraph, scene, ob, par, ARM_GROUPS_NAME, false);
}
else if (partype == PAR_ARMATURE_ENVELOPE) {
- ED_object_vgroup_calc_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
+ ED_object_vgroup_calc_from_armature(reports, depsgraph, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
}
else if (partype == PAR_ARMATURE_AUTO) {
WM_cursor_wait(1);
- ED_object_vgroup_calc_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
+ ED_object_vgroup_calc_from_armature(reports, depsgraph, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
WM_cursor_wait(0);
}
/* get corrected inverse */
ob->partype = PAROBJECT;
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
/* calculate inverse parent matrix */
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
@@ -1061,17 +1057,15 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
if (ob->parent) {
if (ob->partype & PARSLOW) {
ob->partype -= PARSLOW;
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(depsgraph, scene, ob);
ob->partype |= PARSLOW;
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index d0ebb0cd6fe..df8a1b8b87a 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -408,15 +408,13 @@ static void ignore_parent_tx(const bContext *C, Main *bmain, Scene *scene, Objec
{
Object workob;
Object *ob_child;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* a change was made, adjust the children to compensate */
for (ob_child = bmain->object.first; ob_child; ob_child = ob_child->id.next) {
if (ob_child->parent == ob) {
BKE_object_apply_mat4(ob_child, ob_child->obmat, true, false);
- BKE_object_workob_calc_parent(&eval_ctx, scene, ob_child, &workob);
+ BKE_object_workob_calc_parent(depsgraph, scene, ob_child, &workob);
invert_m4_m4(ob_child->parentinv, workob.obmat);
}
}
@@ -429,12 +427,10 @@ static int apply_objects_internal(
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
float rsmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
bool changed = true;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* first check if we can execute */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
@@ -536,7 +532,7 @@ static int apply_objects_internal(
Mesh *me = ob->data;
if (apply_scale)
- multiresModifier_scale_disp(&eval_ctx, scene, ob);
+ multiresModifier_scale_disp(depsgraph, scene, ob);
/* adjust data */
BKE_mesh_transform(me, mat, true);
@@ -626,9 +622,9 @@ static int apply_objects_internal(
unit_axis_angle(ob->rotAxis, &ob->rotAngle);
}
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(depsgraph, scene, ob);
if (ob->type == OB_ARMATURE) {
- BKE_pose_where_is(&eval_ctx, scene, ob); /* needed for bone parents */
+ BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents */
}
ignore_parent_tx(C, bmain, scene, ob);
@@ -651,16 +647,14 @@ static int apply_objects_internal(
static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
bool changed = false;
-
- CTX_data_eval_ctx(C, &eval_ctx);
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(depsgraph, scene, ob);
BKE_object_apply_mat4(ob, ob->obmat, true, true);
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(depsgraph, scene, ob);
/* update for any children that may get moved */
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
@@ -744,7 +738,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
Object *obedit = CTX_data_edit_object(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *tob;
float cursor[3], cent[3], cent_neg[3], centn[3];
int centermode = RNA_enum_get(op->ptr, "type");
@@ -754,8 +748,6 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
CollectionPointerLink *ctx_ob;
CollectionPointerLink *ctx_ob_act = NULL;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* keep track of what is changed */
int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
@@ -871,7 +863,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
float min[3], max[3];
/* only bounds support */
INIT_MINMAX(min, max);
- BKE_object_minmax_dupli(scene, ob, min, max, true);
+ BKE_object_minmax_dupli(depsgraph, scene, ob, min, max, true);
mid_v3_v3v3(cent, min, max);
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->imat, cent);
@@ -988,8 +980,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
arm->id.tag |= LIB_TAG_DOIT;
/* do_inverse_offset = true; */ /* docenter_armature() handles this */
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
- BKE_pose_where_is(&eval_ctx, scene, ob); /* needed for bone parents */
+ BKE_object_where_is_calc(depsgraph, scene, ob);
+ BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents */
ignore_parent_tx(C, bmain, scene, ob);
@@ -1047,9 +1039,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
add_v3_v3(ob->loc, centn);
- BKE_object_where_is_calc(&eval_ctx, scene, ob);
+ BKE_object_where_is_calc(depsgraph, scene, ob);
if (ob->type == OB_ARMATURE) {
- BKE_pose_where_is(&eval_ctx, scene, ob); /* needed for bone parents */
+ BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents */
}
ignore_parent_tx(C, bmain, scene, ob);
@@ -1076,9 +1068,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
mul_v3_mat3_m4v3(centn, ob_other->obmat, cent); /* omit translation part */
add_v3_v3(ob_other->loc, centn);
- BKE_object_where_is_calc(&eval_ctx, scene, ob_other);
+ BKE_object_where_is_calc(depsgraph, scene, ob_other);
if (ob_other->type == OB_ARMATURE) {
- BKE_pose_where_is(&eval_ctx, scene, ob_other); /* needed for bone parents */
+ BKE_pose_where_is(depsgraph, scene, ob_other); /* needed for bone parents */
}
ignore_parent_tx(C, bmain, scene, ob_other);
}
@@ -1292,11 +1284,7 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons
return OPERATOR_PASS_THROUGH;
}
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
-
- ED_view3d_autodist_init(&eval_ctx, vc.depsgraph, vc.ar, vc.v3d, 0);
+ ED_view3d_autodist_init(vc.depsgraph, vc.ar, vc.v3d, 0);
if (vc.rv3d->depths != NULL) {
vc.rv3d->depths->damaged = true;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 7026e8671ad..ff40aa07cd2 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1273,9 +1273,9 @@ static void dm_deform_clear(DerivedMesh *dm, Object *ob)
}
/* recalculate the deformation */
-static DerivedMesh *dm_deform_recalc(EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+static DerivedMesh *dm_deform_recalc(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- return mesh_get_derived_deform(eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ return mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
}
/* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to
@@ -1288,7 +1288,7 @@ static DerivedMesh *dm_deform_recalc(EvaluationContext *eval_ctx, Scene *scene,
* coord is a point on the plane
*/
static void moveCloserToDistanceFromPlane(
- EvaluationContext *eval_ctx, Scene *scene, Object *ob, Mesh *me, int index, float norm[3],
+ Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *me, int index, float norm[3],
float coord[3], float d, float distToBe, float strength, float cp)
{
DerivedMesh *dm;
@@ -1315,7 +1315,7 @@ static void moveCloserToDistanceFromPlane(
float originalDistToBe = distToBe;
do {
wasChange = false;
- dm = dm_deform_recalc(eval_ctx, scene, ob);
+ dm = dm_deform_recalc(depsgraph, scene, ob);
dm->getVert(dm, index, &m);
copy_v3_v3(oldPos, m.co);
distToStart = dot_v3v3(norm, oldPos) + d;
@@ -1353,7 +1353,7 @@ static void moveCloserToDistanceFromPlane(
if (dw->weight > 1) {
dw->weight = 1;
}
- dm = dm_deform_recalc(eval_ctx, scene, ob);
+ dm = dm_deform_recalc(depsgraph, scene, ob);
dm->getVert(dm, index, &m);
getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
dw->weight = oldw;
@@ -1465,11 +1465,9 @@ static void moveCloserToDistanceFromPlane(
* but it could be used to raise or lower an existing 'bump.' */
static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distToBe, float strength, float cp)
{
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
int i;
- CTX_data_eval_ctx(C, &eval_ctx);
-
Mesh *me = ob->data;
MVert *mvert = me->mvert;
int *verts = NULL;
@@ -1483,7 +1481,7 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo
MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
int k;
- DerivedMesh *dm = mesh_get_derived_deform(&eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
k = count;
while (k--) {
dm->getVert(dm, verts[k], &m);
@@ -1501,7 +1499,7 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo
if (mag) { /* zeros fix */
d = -dot_v3v3(norm, coord);
/* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
- moveCloserToDistanceFromPlane(&eval_ctx, scene, ob, me, i, norm, coord, d, distToBe, strength, cp);
+ moveCloserToDistanceFromPlane(depsgraph, scene, ob, me, i, norm, coord, d, distToBe, strength, cp);
}
}
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 5d928d69da2..6dee6825b31 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -294,8 +294,6 @@ typedef struct DynamicPaintBakeJob {
DynamicPaintSurface *surface;
DynamicPaintCanvasSettings *canvas;
- EvaluationContext *eval_ctx;
-
int success;
double start;
} DynamicPaintBakeJob;
@@ -315,8 +313,6 @@ static void dpaint_bake_endjob(void *customdata)
dynamicPaint_freeSurfaceData(job->surface);
- MEM_freeN(job->eval_ctx);
-
G.is_rendering = false;
BKE_spacedata_draw_locks(false);
@@ -391,7 +387,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job)
/* calculate a frame */
scene->r.cfra = (int)frame;
ED_update_for_newframe(job->bmain, job->depsgraph);
- if (!dynamicPaint_calculateFrame(surface, job->eval_ctx, scene, cObject, frame)) {
+ if (!dynamicPaint_calculateFrame(surface, job->depsgraph, scene, cObject, frame)) {
job->success = 0;
return;
}
@@ -459,9 +455,6 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op)
DynamicPaintCanvasSettings *canvas;
Object *ob = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
- EvaluationContext *eval_ctx = MEM_mallocN(sizeof(*eval_ctx), "EvaluationContext");
-
- CTX_data_eval_ctx(C, eval_ctx);
DynamicPaintSurface *surface;
@@ -493,7 +486,6 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op)
job->ob = ob;
job->canvas = canvas;
job->surface = surface;
- job->eval_ctx = eval_ctx;
wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene,
"Dynamic Paint Bake", WM_JOB_PROGRESS,
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index b4f917abc74..7012046fc31 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -194,7 +194,7 @@ static float pe_brush_size_get(const Scene *UNUSED(scene), ParticleBrushData *br
* note: this function runs on poll, therefor it can runs many times a second
* keep it fast! */
static PTCacheEdit *pe_get_current(
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob, int create)
+ Depsgraph *depsgraph, Scene *scene, Object *ob, int create)
{
ParticleEditSettings *pset= PE_settings(scene);
PTCacheEdit *edit = NULL;
@@ -233,18 +233,18 @@ static PTCacheEdit *pe_get_current(
if (psys->part && psys->part->type == PART_HAIR) {
if (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED) {
if (create && !psys->pointcache->edit)
- PE_create_particle_edit(eval_ctx, scene, ob, pid->cache, NULL);
+ PE_create_particle_edit(depsgraph, scene, ob, pid->cache, NULL);
edit = pid->cache->edit;
}
else {
if (create && !psys->edit && psys->flag & PSYS_HAIR_DONE)
- PE_create_particle_edit(eval_ctx, scene, ob, NULL, psys);
+ PE_create_particle_edit(depsgraph, scene, ob, NULL, psys);
edit = psys->edit;
}
}
else {
if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
- PE_create_particle_edit(eval_ctx, scene, ob, pid->cache, psys);
+ PE_create_particle_edit(depsgraph, scene, ob, pid->cache, psys);
edit = pid->cache->edit;
}
@@ -255,7 +255,7 @@ static PTCacheEdit *pe_get_current(
if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) {
pset->flag |= PE_FADE_TIME;
// NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB;
- PE_create_particle_edit(eval_ctx, scene, ob, pid->cache, NULL);
+ PE_create_particle_edit(depsgraph, scene, ob, pid->cache, NULL);
}
edit = pid->cache->edit;
break;
@@ -264,7 +264,7 @@ static PTCacheEdit *pe_get_current(
if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) {
pset->flag |= PE_FADE_TIME;
// NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB;
- PE_create_particle_edit(eval_ctx, scene, ob, pid->cache, NULL);
+ PE_create_particle_edit(depsgraph, scene, ob, pid->cache, NULL);
}
edit = pid->cache->edit;
break;
@@ -284,15 +284,15 @@ PTCacheEdit *PE_get_current(Scene *scene, Object *ob)
return pe_get_current(NULL, scene, ob, 0);
}
-PTCacheEdit *PE_create_current(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+PTCacheEdit *PE_create_current(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
- return pe_get_current(eval_ctx, scene, ob, 1);
+ return pe_get_current(depsgraph, scene, ob, 1);
}
-void PE_current_changed(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+void PE_current_changed(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
if (ob->mode == OB_MODE_PARTICLE_EDIT) {
- PE_create_current(eval_ctx, scene, ob);
+ PE_create_current(depsgraph, scene, ob);
}
}
@@ -343,7 +343,7 @@ typedef struct PEData {
DerivedMesh *dm;
PTCacheEdit *edit;
BVHTreeFromMesh shape_bvh;
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph;
const int *mval;
rcti *rect;
@@ -376,7 +376,7 @@ static void PE_set_data(bContext *C, PEData *data)
data->scene = CTX_data_scene(C);
data->view_layer = CTX_data_view_layer(C);
data->ob = CTX_data_active_object(C);
- CTX_data_eval_ctx(C, &data->eval_ctx);
+ data->depsgraph = CTX_data_depsgraph(C);
data->edit = PE_get_current(data->scene, data->ob);
}
@@ -391,7 +391,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
/* needed or else the draw matrix can be incorrect */
view3d_operator_needs_opengl(C);
- ED_view3d_backbuf_validate(&data->eval_ctx, &data->vc);
+ ED_view3d_backbuf_validate(&data->vc);
/* we may need to force an update here by setting the rv3d as dirty
* for now it seems ok, but take care!:
* rv3d->depths->dirty = 1; */
@@ -1136,7 +1136,7 @@ void recalc_emitter_field(Object *ob, ParticleSystem *psys)
BLI_kdtree_balance(edit->emitter_field);
}
-static void PE_update_selection(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, int useflag)
+static void PE_update_selection(Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
{
PTCacheEdit *edit = PE_get_current(scene, ob);
HairKey *hkey;
@@ -1157,7 +1157,7 @@ static void PE_update_selection(const EvaluationContext *eval_ctx, Scene *scene,
}
}
- 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);
/* disable update flag */
@@ -1243,7 +1243,7 @@ static void update_velocities(PTCacheEdit *edit)
}
}
-void PE_update_object(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, int useflag)
+void PE_update_object(Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
{
/* use this to do partial particle updates, not usable when adding or
* removing, then a full redo is necessary and calling this may crash */
@@ -1273,7 +1273,7 @@ void PE_update_object(const EvaluationContext *eval_ctx, Scene *scene, Object *o
PE_hide_keys_time(scene, edit, CFRA);
/* regenerate path caches */
- 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);
/* disable update flag */
LOOP_POINTS {
@@ -1385,8 +1385,7 @@ static void select_action_apply(PTCacheEditPoint *point, PTCacheEditKey *key, in
static int pe_select_all_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
@@ -1411,7 +1410,7 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
}
}
- PE_update_selection(&eval_ctx, scene, ob, 1);
+ PE_update_selection(depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, ob);
return OPERATOR_FINISHED;
@@ -1468,7 +1467,7 @@ int PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool deselec
else
for_mouse_hit_keys(&data, toggle_key_select, 1);
- PE_update_selection(&data.eval_ctx, scene, ob, 1);
+ PE_update_selection(data.depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -1509,7 +1508,7 @@ static int select_roots_exec(bContext *C, wmOperator *op)
data.select_action = action;
foreach_point(&data, select_root);
- PE_update_selection(&data.eval_ctx, data.scene, data.ob, 1);
+ PE_update_selection(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -1574,7 +1573,7 @@ static int select_tips_exec(bContext *C, wmOperator *op)
data.select_action = action;
foreach_point(&data, select_tip);
- PE_update_selection(&data.eval_ctx, data.scene, data.ob, 1);
+ PE_update_selection(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -1658,7 +1657,7 @@ static int select_random_exec(bContext *C, wmOperator *op)
BLI_rng_free(rng);
- PE_update_selection(&data.eval_ctx, data.scene, data.ob, 1);
+ PE_update_selection(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -1702,7 +1701,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
data.select= !RNA_boolean_get(op->ptr, "deselect");
for_mouse_hit_keys(&data, select_keys, 1); /* nearest only */
- PE_update_selection(&data.eval_ctx, data.scene, data.ob, 1);
+ PE_update_selection(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -1766,7 +1765,7 @@ int PE_border_select(bContext *C, rcti *rect, bool select, bool extend)
for_mouse_hit_keys(&data, select_key, 0);
- PE_update_selection(&data.eval_ctx, scene, ob, 1);
+ PE_update_selection(data.depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, ob);
return OPERATOR_FINISHED;
@@ -1791,7 +1790,7 @@ int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
for_mouse_hit_keys(&data, select_key, 0);
- PE_update_selection(&data.eval_ctx, scene, ob, 1);
+ PE_update_selection(data.depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, ob);
return OPERATOR_FINISHED;
@@ -1879,7 +1878,7 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, bool
}
}
- PE_update_selection(&data.eval_ctx, scene, ob, 1);
+ PE_update_selection(data.depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, ob);
return OPERATOR_FINISHED;
@@ -1891,8 +1890,7 @@ static int hide_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
Scene *scene= CTX_data_scene(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
POINT_P; KEY_K;
@@ -1917,7 +1915,7 @@ static int hide_exec(bContext *C, wmOperator *op)
}
}
- PE_update_selection(&eval_ctx, scene, ob, 1);
+ PE_update_selection(depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, ob);
return OPERATOR_FINISHED;
@@ -1947,8 +1945,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
Scene *scene= CTX_data_scene(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
PTCacheEdit *edit= PE_get_current(scene, ob);
const bool select = RNA_boolean_get(op->ptr, "select");
POINT_P; KEY_K;
@@ -1964,7 +1961,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
}
}
- PE_update_selection(&eval_ctx, scene, ob, 1);
+ PE_update_selection(depsgraph, scene, ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, ob);
return OPERATOR_FINISHED;
@@ -2026,7 +2023,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
PE_set_data(C, &data);
foreach_point(&data, select_less_keys);
- PE_update_selection(&data.eval_ctx, data.scene, data.ob, 1);
+ PE_update_selection(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -2088,7 +2085,7 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
PE_set_data(C, &data);
foreach_point(&data, select_more_keys);
- PE_update_selection(&data.eval_ctx, data.scene, data.ob, 1);
+ PE_update_selection(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
return OPERATOR_FINISHED;
@@ -2121,12 +2118,10 @@ static void rekey_particle(PEData *data, int pa_index)
ParticleKey state;
HairKey *key, *new_keys, *okey;
PTCacheEditKey *ekey;
- EvaluationContext eval_ctx;
float dval, sta, end;
int k;
- CTX_data_eval_ctx(data->context, &eval_ctx);
- sim.eval_ctx = &eval_ctx;
+ sim.depsgraph = data->depsgraph;
sim.scene = data->scene;
sim.ob = data->ob;
sim.psys = edit->psys;
@@ -2180,9 +2175,6 @@ static int rekey_exec(bContext *C, wmOperator *op)
{
PEData data;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
PE_set_data(C, &data);
data.dval= 1.0f / (float)(data.totrekey-1);
@@ -2191,7 +2183,7 @@ static int rekey_exec(bContext *C, wmOperator *op)
foreach_selected_point(&data, rekey_particle);
recalc_lengths(data.edit);
- PE_update_object(&eval_ctx, data.scene, data.ob, 1);
+ PE_update_object(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, data.ob);
return OPERATOR_FINISHED;
@@ -2225,16 +2217,13 @@ static void rekey_particle_to_time(const bContext *C, Scene *scene, Object *ob,
ParticleKey state;
HairKey *new_keys, *key;
PTCacheEditKey *ekey;
- EvaluationContext eval_ctx;
int k;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (!edit || !edit->psys) return;
psys = edit->psys;
- sim.eval_ctx = &eval_ctx;
+ sim.depsgraph = CTX_data_depsgraph(C);
sim.scene = scene;
sim.ob = ob;
sim.psys = psys;
@@ -2447,14 +2436,12 @@ static void subdivide_particle(PEData *data, int pa_index)
ParticleKey state;
HairKey *key, *nkey, *new_keys;
PTCacheEditKey *ekey, *nekey, *new_ekeys;
- EvaluationContext eval_ctx;
int k;
short totnewkey=0;
float endtime;
- CTX_data_eval_ctx(data->context, &eval_ctx);
- sim.eval_ctx = &eval_ctx;
+ sim.depsgraph = data->depsgraph;
sim.scene = data->scene;
sim.ob = data->ob;
sim.psys = edit->psys;
@@ -2525,14 +2512,11 @@ static int subdivide_exec(bContext *C, wmOperator *UNUSED(op))
{
PEData data;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
PE_set_data(C, &data);
foreach_point(&data, subdivide_particle);
recalc_lengths(data.edit);
- PE_update_object(&eval_ctx, data.scene, data.ob, 1);
+ PE_update_object(data.depsgraph, data.scene, data.ob, 1);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, data.ob);
return OPERATOR_FINISHED;
@@ -3356,21 +3340,19 @@ static int particle_intersect_dm(const bContext *C, Scene *scene, Object *ob, De
float *face_minmax, float *pa_minmax,
float radius, float *ipoint)
{
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
MFace *mface= NULL;
MVert *mvert= NULL;
int i, totface, intersect=0;
float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3], p_max[3];
float cur_ipoint[3];
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (dm == NULL) {
psys_disable_all(ob);
- dm = mesh_get_derived_final(&eval_ctx, scene, ob, 0);
+ dm = mesh_get_derived_final(depsgraph, scene, ob, 0);
if (dm == NULL)
- dm = mesh_get_derived_deform(&eval_ctx, scene, ob, 0);
+ dm = mesh_get_derived_deform(depsgraph, scene, ob, 0);
psys_enable_all(ob);
@@ -3485,8 +3467,7 @@ static int particle_intersect_dm(const bContext *C, Scene *scene, Object *ob, De
static int brush_add(const bContext *C, PEData *data, short number)
{
- EvaluationContext eval_ctx;
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene= data->scene;
Object *ob= data->ob;
DerivedMesh *dm;
@@ -3514,9 +3495,7 @@ static int brush_add(const bContext *C, PEData *data, short number)
rng = BLI_rng_new_srandom(psys->seed+data->mval[0]+data->mval[1]);
- CTX_data_eval_ctx(C, &eval_ctx);
-
- sim.eval_ctx = &eval_ctx;
+ sim.depsgraph = depsgraph;
sim.scene= scene;
sim.ob= ob;
sim.psys= psys;
@@ -3805,8 +3784,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
if (!PE_start_edit(edit))
return;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
RNA_float_get_array(itemptr, "mouse", mousef);
mouse[0] = mousef[0];
@@ -3991,7 +3969,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
- PE_update_object(&eval_ctx, scene, ob, 1);
+ PE_update_object(depsgraph, scene, ob, 1);
}
}
@@ -4254,7 +4232,7 @@ static int shape_cut_exec(bContext *C, wmOperator *UNUSED(op))
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
- PE_update_object(&data.eval_ctx, scene, ob, 1);
+ PE_update_object(data.depsgraph, scene, ob, 1);
}
if (edit->psys) {
@@ -4331,7 +4309,7 @@ int PE_minmax(Scene *scene, ViewLayer *view_layer, float min[3], float max[3])
/* initialize needed data for bake edit */
void PE_create_particle_edit(
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys)
+ Depsgraph *depsgraph, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys)
{
PTCacheEdit *edit;
ParticleSystemModifierData *psmd = (psys) ? psys_get_modifier(ob, psys) : NULL;
@@ -4433,7 +4411,7 @@ void PE_create_particle_edit(
if (psys && !cache)
recalc_emitter_field(ob, psys);
- PE_update_object(eval_ctx, scene, ob, 1);
+ PE_update_object(depsgraph, scene, ob, 1);
}
}
@@ -4455,6 +4433,7 @@ static int particle_edit_toggle_poll(bContext *C)
static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_PARTICLE_EDIT;
@@ -4468,11 +4447,9 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
if (!is_mode_set) {
PTCacheEdit *edit;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
ob->mode |= mode_flag;
- edit= PE_create_current(&eval_ctx, scene, ob);
+ edit= PE_create_current(depsgraph, scene, ob);
/* mesh may have changed since last entering editmode.
* note, this may have run before if the edit data was just created, so could avoid this and speed up a little */
@@ -4642,8 +4619,7 @@ static int unify_length_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
PTCacheEdit *edit = PE_get_current(scene, ob);
float average_length = calculate_average_length(edit);
@@ -4654,7 +4630,7 @@ static int unify_length_exec(bContext *C, wmOperator *UNUSED(op))
scale_points_to_length(edit, average_length);
- PE_update_object(&eval_ctx, scene, ob, 1);
+ PE_update_object(depsgraph, scene, ob, 1);
if (edit->psys) {
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
}
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index e87de1a6875..23a6ba68fc9 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -546,7 +546,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
/************************ connect/disconnect hair operators *********************/
static void disconnect_hair(
- const EvaluationContext *eval_ctx, Scene *scene,
+ Depsgraph *depsgraph, Scene *scene,
Object *ob, ParticleSystem *psys)
{
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
@@ -593,30 +593,28 @@ static void disconnect_hair(
if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
pset->brushtype = PE_BRUSH_NONE;
- PE_update_object(eval_ctx, scene, ob, 0);
+ PE_update_object(depsgraph, scene, ob, 0);
}
static int disconnect_hair_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene= CTX_data_scene(C);
Object *ob= ED_object_context(C);
ParticleSystem *psys= NULL;
const bool all = RNA_boolean_get(op->ptr, "all");
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (!ob)
return OPERATOR_CANCELLED;
if (all) {
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
- disconnect_hair(&eval_ctx, scene, ob, psys);
+ disconnect_hair(depsgraph, scene, ob, psys);
}
}
else {
psys = psys_get_current(ob);
- disconnect_hair(&eval_ctx, scene, ob, psys);
+ disconnect_hair(depsgraph, scene, ob, psys);
}
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -643,7 +641,7 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
* from/to_mat : additional transform for from/to particles (e.g. for using object space copying)
*/
static bool remap_hair_emitter(
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys,
+ Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys,
Object *target_ob, ParticleSystem *target_psys, PTCacheEdit *target_edit,
float from_mat[4][4], float to_mat[4][4], bool from_global, bool to_global)
{
@@ -829,13 +827,13 @@ static bool remap_hair_emitter(
psys_free_path_cache(target_psys, target_edit);
- PE_update_object(eval_ctx, scene, target_ob, 0);
+ PE_update_object(depsgraph, scene, target_ob, 0);
return true;
}
static bool connect_hair(
- const EvaluationContext *eval_ctx, Scene *scene,
+ Depsgraph *depsgraph, Scene *scene,
Object *ob, ParticleSystem *psys)
{
bool ok;
@@ -844,7 +842,7 @@ static bool connect_hair(
return false;
ok = remap_hair_emitter(
- eval_ctx, scene, ob, psys, ob, psys, psys->edit,
+ depsgraph, scene, ob, psys, ob, psys, psys->edit,
ob->obmat, ob->obmat, psys->flag & PSYS_GLOBAL_HAIR, false);
psys->flag &= ~PSYS_GLOBAL_HAIR;
@@ -853,7 +851,7 @@ static bool connect_hair(
static int connect_hair_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene= CTX_data_scene(C);
Object *ob= ED_object_context(C);
ParticleSystem *psys= NULL;
@@ -863,16 +861,14 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
if (!ob)
return OPERATOR_CANCELLED;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (all) {
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
- any_connected |= connect_hair(&eval_ctx, scene, ob, psys);
+ any_connected |= connect_hair(depsgraph, scene, ob, psys);
}
}
else {
psys = psys_get_current(ob);
- any_connected |= connect_hair(&eval_ctx, scene, ob, psys);
+ any_connected |= connect_hair(depsgraph, scene, ob, psys);
}
if (!any_connected) {
@@ -909,7 +905,7 @@ typedef enum eCopyParticlesSpace {
} eCopyParticlesSpace;
static void copy_particle_edit(
- const EvaluationContext *eval_ctx, Scene *scene,
+ Depsgraph *depsgraph, Scene *scene,
Object *ob, ParticleSystem *psys, ParticleSystem *psys_from)
{
PTCacheEdit *edit_from = psys_from->edit, *edit;
@@ -957,7 +953,7 @@ static void copy_particle_edit(
recalc_lengths(edit);
recalc_emitter_field(ob, psys);
- PE_update_object(eval_ctx, scene, ob, true);
+ PE_update_object(depsgraph, scene, ob, true);
}
static void remove_particle_systems_from_object(Object *ob_to)
@@ -994,15 +990,13 @@ static bool copy_particle_systems_to_object(const bContext *C,
bool duplicate_settings)
{
Main *bmain = CTX_data_main(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
ModifierData *md;
ParticleSystem *psys_start = NULL, *psys, *psys_from;
ParticleSystem **tmp_psys;
DerivedMesh *final_dm;
CustomDataMask cdmask;
int i, totpsys;
-
- CTX_data_eval_ctx(C, &eval_ctx);
if (ob_to->type != OB_MESH)
return false;
@@ -1042,7 +1036,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
psys_start = totpsys > 0 ? tmp_psys[0] : NULL;
/* get the DM (psys and their modifiers have not been appended yet) */
- final_dm = mesh_get_derived_final(&eval_ctx, scene, ob_to, cdmask);
+ final_dm = mesh_get_derived_final(depsgraph, scene, ob_to, cdmask);
/* now append psys to the object and make modifiers */
for (i = 0, psys_from = PSYS_FROM_FIRST;
@@ -1071,7 +1065,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
DM_ensure_tessface(psmd->dm_final);
if (psys_from->edit) {
- copy_particle_edit(&eval_ctx, scene, ob_to, psys, psys_from);
+ copy_particle_edit(depsgraph, scene, ob_to, psys, psys_from);
}
if (duplicate_settings) {
@@ -1107,7 +1101,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
}
if (ob_from != ob_to) {
remap_hair_emitter(
- &eval_ctx, scene, ob_from, psys_from, ob_to, psys, psys->edit,
+ depsgraph, scene, ob_from, psys_from, ob_to, psys, psys->edit,
from_mat, to_mat, psys_from->flag & PSYS_GLOBAL_HAIR, psys->flag & PSYS_GLOBAL_HAIR);
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index c0b2ae8ded4..541242fdc09 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -246,7 +246,7 @@ static void set_channel(float *channel, float time, float *value, int i, int siz
}
}
-static void set_vertex_channel(EvaluationContext *eval_ctx, float *channel, float time, struct Scene *scene, struct FluidObject *fobj, int i)
+static void set_vertex_channel(Depsgraph *depsgraph, float *channel, float time, struct Scene *scene, struct FluidObject *fobj, int i)
{
Object *ob = fobj->object;
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
@@ -259,7 +259,7 @@ static void set_vertex_channel(EvaluationContext *eval_ctx, float *channel, floa
if (channel == NULL)
return;
- initElbeemMesh(eval_ctx, scene, ob, &numVerts, &verts, &numTris, &tris, 1, modifierIndex);
+ initElbeemMesh(depsgraph, scene, ob, &numVerts, &verts, &numTris, &tris, 1, modifierIndex);
/* don't allow mesh to change number of verts in anim sequence */
if (numVerts != fobj->numVerts) {
@@ -333,14 +333,11 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
- EvaluationContext eval_ctx;
Base *base;
int i;
int length = channels->length;
float eval_time;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* init time values (assuming that time moves at a constant speed; may be overridden later) */
init_time(domainSettings, channels);
@@ -380,7 +377,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
float *verts=NULL;
int *tris=NULL, modifierIndex = BLI_findindex(&ob->modifiers, (ModifierData *)fluidmd);
- initElbeemMesh(&eval_ctx, scene, ob, &fobj->numVerts, &verts, &fobj->numTris, &tris, 0, modifierIndex);
+ initElbeemMesh(depsgraph, scene, ob, &fobj->numVerts, &verts, &fobj->numTris, &tris, 0, modifierIndex);
fobj->VertexCache = MEM_callocN(length *((fobj->numVerts*CHANNEL_VEC)+1) * sizeof(float), "fluidobject VertexCache");
MEM_freeN(verts);
@@ -468,7 +465,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
}
if (fluid_is_animated_mesh(fluidmd->fss)) {
- set_vertex_channel(&eval_ctx, fobj->VertexCache, timeAtFrame, scene, fobj, i);
+ set_vertex_channel(depsgraph, fobj->VertexCache, timeAtFrame, scene, fobj, i);
}
}
}
@@ -476,10 +473,8 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
static void export_fluid_objects(const bContext *C, ListBase *fobjects, Scene *scene, int length)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
FluidObject *fobj;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
for (fobj=fobjects->first; fobj; fobj=fobj->next) {
Object *ob = fobj->object;
@@ -501,7 +496,7 @@ static void export_fluid_objects(const bContext *C, ListBase *fobjects, Scene *s
fsmesh.type = fluidmd->fss->type;
fsmesh.name = ob->id.name;
- initElbeemMesh(&eval_ctx, scene, ob, &numVerts, &verts, &numTris, &tris, 0, modifierIndex);
+ initElbeemMesh(depsgraph, scene, ob, &numVerts, &verts, &numTris, &tris, 0, modifierIndex);
fsmesh.numVertices = numVerts;
fsmesh.numTriangles = numTris;
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index 246bf79360f..72da417da63 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -33,7 +33,7 @@
#ifndef __PHYSICS_INTERN_H__
#define __PHYSICS_INTERN_H__
-struct EvaluationContext;
+struct Depsgraph;
struct Object;
struct PTCacheEdit;
struct ParticleSystem;
@@ -71,7 +71,7 @@ void PARTICLE_OT_edited_clear(struct wmOperatorType *ot);
void PARTICLE_OT_unify_length(struct wmOperatorType *ot);
void PE_create_particle_edit(
- const struct EvaluationContext *eval_ctx, struct Scene *scene,
+ struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, struct PointCache *cache, struct ParticleSystem *psys);
void recalc_lengths(struct PTCacheEdit *edit);
void recalc_emitter_field(struct Object *ob, struct ParticleSystem *psys);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 51a75e36044..965e213631d 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -1092,7 +1092,6 @@ typedef struct RenderPreview {
wmJob *job;
Scene *scene;
- EvaluationContext *eval_ctx;
Depsgraph *depsgraph;
ScrArea *sa;
ARegion *ar;
@@ -1108,7 +1107,7 @@ typedef struct RenderPreview {
bool has_freestyle;
} RenderPreview;
-static int render_view3d_disprect(Scene *scene, const Depsgraph *depsgraph,
+static int render_view3d_disprect(Scene *scene, Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, RegionView3D *rv3d, rcti *disprect)
{
/* copied code from view3d_draw.c */
@@ -1145,7 +1144,7 @@ static int render_view3d_disprect(Scene *scene, const Depsgraph *depsgraph,
/* returns true if OK */
static bool render_view3d_get_rects(
- const Depsgraph *depsgraph,
+ Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewplane, RenderEngine *engine,
float *r_clipsta, float *r_clipend, float *r_pixsize, bool *r_ortho)
{
@@ -1341,7 +1340,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda
WM_job_main_thread_lock_release(rp->job);
/* do preprocessing like building raytree, shadows, volumes, SSS */
- RE_Database_Preprocess(rp->eval_ctx, re);
+ RE_Database_Preprocess(rp->depsgraph, re);
/* conversion not completed, need to do it again */
if (!rstats->convertdone) {
@@ -1407,7 +1406,6 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda
static void render_view3d_free(void *customdata)
{
RenderPreview *rp = customdata;
- DEG_evaluation_context_free(rp->eval_ctx);
MEM_freeN(rp);
}
@@ -1523,8 +1521,6 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C)
/* customdata for preview thread */
rp->scene = scene;
rp->depsgraph = depsgraph;
- rp->eval_ctx = DEG_evaluation_context_new(DAG_EVAL_PREVIEW);
- CTX_data_eval_ctx(C, rp->eval_ctx);
rp->engine = engine;
rp->sa = CTX_wm_area(C);
rp->ar = CTX_wm_region(C);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index be2b184626d..a334d3abc68 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -268,6 +268,7 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, RenderResult *rr)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = oglrender->scene;
ViewLayer *view_layer = oglrender->view_layer;
ARegion *ar = oglrender->ar;
@@ -282,9 +283,6 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
float *rectf = NULL;
const char *viewname = RE_GetActiveRenderView(oglrender->re);
ImBuf *ibuf_result = NULL;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
if (oglrender->is_sequencer) {
SpaceSeq *sseq = oglrender->sseq;
@@ -362,7 +360,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
draw_flags |= (draw_bgpic) ? V3D_OFSDRAW_USE_BACKGROUND : 0;
ibuf_view = ED_view3d_draw_offscreen_imbuf(
- &eval_ctx, scene, view_layer, engine_type,
+ depsgraph, scene, view_layer, engine_type,
v3d, ar, sizex, sizey,
IB_rectfloat, draw_flags, alpha_mode, oglrender->ofs_samples, viewname,
oglrender->ofs, err_out);
@@ -375,7 +373,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
else {
draw_flags |= (V3D_OFSDRAW_USE_GPENCIL | V3D_OFSDRAW_USE_BACKGROUND);
ibuf_view = ED_view3d_draw_offscreen_imbuf_simple(
- &eval_ctx, scene, view_layer, engine_type,
+ depsgraph, scene, view_layer, engine_type,
scene->camera, oglrender->sizex, oglrender->sizey,
IB_rectfloat, draw_flags, OB_SOLID,
alpha_mode, oglrender->ofs_samples, viewname,
@@ -539,8 +537,8 @@ static void screen_opengl_render_apply(const bContext *C, OGLRender *oglrender)
int chanshown = sseq ? sseq->chanshown : 0;
BKE_sequencer_new_render_data(
- oglrender->bmain->eval_ctx, oglrender->bmain, scene,
- oglrender->sizex, oglrender->sizey, 100.0f,
+ oglrender->bmain, scene,
+ oglrender->sizex, oglrender->sizey, 100.0f, false,
&context);
for (view_id = 0; view_id < oglrender->views_len; view_id++) {
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c
index d16d60ba7b9..58a58ef8172 100644
--- a/source/blender/editors/scene/scene_edit.c
+++ b/source/blender/editors/scene/scene_edit.c
@@ -132,8 +132,6 @@ void ED_scene_change_update(
#if 0
/* mode syncing */
- EvaluationContext eval_ctx_old;
- CTX_data_eval_ctx(C, &eval_ctx_old);
eObjectMode object_mode_old = workspace->object_mode;
ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace);
Object *obact_old = OBACT(layer_old);
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 4d3c8fe4d5c..4dd770d79b9 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -362,7 +362,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Mesh *me = ob->data;
PartialVisAction action;
PartialVisArea area;
@@ -374,8 +374,6 @@ static int hide_show_exec(bContext *C, wmOperator *op)
rcti rect;
int totnode, i;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* read operator properties */
action = RNA_enum_get(op->ptr, "action");
area = RNA_enum_get(op->ptr, "area");
@@ -383,7 +381,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
clip_planes_from_rect(C, clip_planes, &rect);
- dm = mesh_get_derived_final(&eval_ctx, CTX_data_scene(C), ob, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(depsgraph, CTX_data_scene(C), ob, CD_MASK_BAREMESH);
pbvh = dm->getPBVH(ob, dm);
ob->sculpt->pbvh = pbvh;
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index c81a59b045f..ef125da46a7 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -227,7 +227,7 @@ typedef struct ProjPaintState {
View3D *v3d;
RegionView3D *rv3d;
ARegion *ar;
- const Depsgraph *depsgraph;
+ Depsgraph *depsgraph;
Scene *scene;
int source; /* PROJ_SRC_**** */
@@ -3426,13 +3426,12 @@ static void project_paint_bleed_add_face_user(
/* Return true if DM can be painted on, false otherwise */
static bool proj_paint_state_dm_init(const bContext *C, ProjPaintState *ps)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* Workaround for subsurf selection, try the display mesh first */
if (ps->source == PROJ_SRC_IMAGE_CAM) {
/* using render mesh, assume only camera was rendered from */
- ps->dm = mesh_create_derived_render(&eval_ctx, ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE);
+ ps->dm = mesh_create_derived_render(depsgraph, ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE);
ps->dm_release = true;
}
else if (ps->ob->derivedFinal &&
@@ -3444,7 +3443,7 @@ static bool proj_paint_state_dm_init(const bContext *C, ProjPaintState *ps)
}
else {
ps->dm = mesh_get_derived_final(
- &eval_ctx, ps->scene, ps->ob,
+ depsgraph, ps->scene, ps->ob,
ps->scene->customdata_mask | CD_MASK_MTFACE | (ps->do_face_sel ? CD_ORIGINDEX : 0));
ps->dm_release = true;
}
@@ -5030,7 +5029,6 @@ void paint_proj_stroke(
/* clone gets special treatment here to avoid going through image initialization */
if (ps_handle->is_clone_cursor_pick) {
- EvaluationContext eval_ctx;
Scene *scene = ps_handle->scene;
struct Depsgraph *graph = CTX_data_depsgraph(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -5040,9 +5038,7 @@ void paint_proj_stroke(
view3d_operator_needs_opengl(C);
- CTX_data_eval_ctx(C, &eval_ctx);
-
- if (!ED_view3d_autodist(&eval_ctx, graph, ar, v3d, mval_i, cursor, false, NULL)) {
+ if (!ED_view3d_autodist(graph, ar, v3d, mval_i, cursor, false, NULL)) {
return;
}
@@ -5457,18 +5453,16 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
ImBuf *ibuf;
char filename[FILE_MAX];
+ struct RenderEngineType *engine_type = CTX_data_engine_type(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- struct RenderEngineType *engine_type = CTX_data_engine_type(C);
- EvaluationContext eval_ctx;
ToolSettings *settings = scene->toolsettings;
int w = settings->imapaint.screen_grab_size[0];
int h = settings->imapaint.screen_grab_size[1];
int maxsize;
char err_out[256] = "unknown";
- CTX_data_eval_ctx(C, &eval_ctx);
-
RNA_string_get(op->ptr, "filepath", filename);
maxsize = GPU_max_texture_size();
@@ -5477,7 +5471,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
if (h > maxsize) h = maxsize;
ibuf = ED_view3d_draw_offscreen_imbuf(
- &eval_ctx, scene, view_layer, engine_type,
+ depsgraph, scene, view_layer, engine_type,
CTX_wm_view3d(C), CTX_wm_region(C),
w, h, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL,
NULL, err_out);
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index e22b996c6e5..4298fba3b2b 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -157,10 +157,10 @@ void PAINT_OT_weight_sample_group(struct wmOperatorType *ot);
/* paint_vertex_proj.c */
struct VertProjHandle;
struct VertProjHandle *ED_vpaint_proj_handle_create(
- const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob,
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
struct DMCoNo **r_vcosnos);
void ED_vpaint_proj_handle_update(
- const struct EvaluationContext *eval_ctx, struct VertProjHandle *vp_handle,
+ struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle,
/* runtime vars */
struct ARegion *ar, const float mval_fl[2]);
void ED_vpaint_proj_handle_free(
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 162c067166c..f22e6f514e6 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -134,7 +134,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
struct Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
PaintMaskFloodMode mode;
float value;
PBVH *pbvh;
@@ -143,12 +143,10 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
bool multires;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- CTX_data_eval_ctx(C, &eval_ctx);
-
mode = RNA_enum_get(op->ptr, "mode");
value = RNA_float_get(op->ptr, "value");
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, false, true);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, false, true);
pbvh = ob->sculpt->pbvh;
multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS);
@@ -261,7 +259,7 @@ static void mask_box_select_task_cb(
int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *rect, bool select, bool UNUSED(extend))
{
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Sculpt *sd = vc->scene->toolsettings->sculpt;
BoundBox bb;
float clip_planes[4][4];
@@ -277,8 +275,6 @@ int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *r
int totnode, symmpass;
int symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL;
- CTX_data_eval_ctx(C, &eval_ctx);
-
mode = PAINT_MASK_FLOOD_VALUE;
value = select ? 1.0 : 0.0;
@@ -286,7 +282,7 @@ int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *r
ED_view3d_clipping_calc(&bb, clip_planes, vc->ar, vc->obact, rect);
negate_m4(clip_planes);
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, false, true);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, false, true);
pbvh = ob->sculpt->pbvh;
multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS);
@@ -428,7 +424,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
float clip_planes[4][4], clip_planes_final[4][4];
BoundBox bb;
Object *ob;
@@ -444,8 +440,6 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
PaintMaskFloodMode mode = RNA_enum_get(op->ptr, "mode");
float value = RNA_float_get(op->ptr, "value");
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* Calculations of individual vertices are done in 2D screen space to diminish the amount of
* calculations done. Bounding box PBVH collision is not computed against enclosing rectangle
* of lasso */
@@ -468,7 +462,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, &data.rect);
negate_m4(clip_planes);
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, false, true);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, false, true);
pbvh = ob->sculpt->pbvh;
multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 0f22973c45d..82589857ba5 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -274,9 +274,9 @@ static void imapaint_tri_weights(float matrix[4][4], GLint view[4],
}
/* compute uv coordinates of mouse in face */
-static void imapaint_pick_uv(EvaluationContext *eval_ctx, Scene *scene, Object *ob, unsigned int faceindex, const int xy[2], float uv[2])
+static void imapaint_pick_uv(Depsgraph *depsgraph, Scene *scene, Object *ob, unsigned int faceindex, const int xy[2], float uv[2])
{
- DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
const int tottri = dm->getNumLoopTri(dm);
int i, findex;
float p[2], w[3], absw, minabsw;
@@ -353,14 +353,14 @@ static void imapaint_pick_uv(EvaluationContext *eval_ctx, Scene *scene, Object *
/* returns 0 if not found, otherwise 1 */
static int imapaint_pick_face(
- const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mval[2],
+ ViewContext *vc, const int mval[2],
unsigned int *r_index, unsigned int totpoly)
{
if (totpoly == 0)
return 0;
/* sample only on the exact position */
- *r_index = ED_view3d_backbuf_sample(eval_ctx, vc, mval[0], mval[1]);
+ *r_index = ED_view3d_backbuf_sample(vc, mval[0], mval[1]);
if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) {
return 0;
@@ -426,7 +426,7 @@ void flip_qt_qt(float out[4], const float in[4], const char symm)
void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_proj, bool use_palette)
{
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Paint *paint = BKE_paint_get_active_from_context(C);
Palette *palette = BKE_paint_palette(paint);
PaletteColor *color = NULL;
@@ -434,8 +434,6 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
unsigned int col;
const unsigned char *cp;
- CTX_data_eval_ctx(C, &eval_ctx);
-
CLAMP(x, 0, ar->winx);
CLAMP(y, 0, ar->winy);
@@ -460,7 +458,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
if (ob) {
Mesh *me = (Mesh *)ob->data;
- DerivedMesh *dm = mesh_get_derived_final(&eval_ctx, scene, ob, CD_MASK_BAREMESH);
+ DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
ViewContext vc;
const int mval[2] = {x, y};
@@ -472,7 +470,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
view3d_operator_needs_opengl(C);
- if (imapaint_pick_face(&eval_ctx, &vc, mval, &faceindex, totpoly)) {
+ if (imapaint_pick_face(&vc, mval, &faceindex, totpoly)) {
Image *image;
if (use_material)
@@ -485,7 +483,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
if (ibuf && ibuf->rect) {
float uv[2];
float u, v;
- imapaint_pick_uv(&eval_ctx, scene, ob, faceindex, mval, uv);
+ imapaint_pick_uv(depsgraph, scene, ob, faceindex, mval, uv);
sample_success = true;
u = fmodf(uv[0], 1.0f);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 12fe55fb956..0ae6db1f41d 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -940,14 +940,14 @@ static void do_weight_paint_vertex(
/* Toggle operator for turning vertex paint mode on or off (copied from sculpt.c) */
-static void vertex_paint_init_session(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+static void vertex_paint_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
/* Create persistent sculpt mode data */
BKE_sculpt_toolsettings_data_ensure(scene);
if (ob->sculpt == NULL) {
ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session");
- BKE_sculpt_update_mesh_elements(eval_ctx, scene, scene->toolsettings->sculpt, ob, 0, false);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, 0, false);
}
}
@@ -1034,7 +1034,7 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob)
* \{ */
static void ed_vwpaintmode_enter_generic(
- const EvaluationContext *eval_ctx, wmWindowManager *wm, Scene *scene,
+ Depsgraph *depsgraph, wmWindowManager *wm, Scene *scene,
Object *ob, const eObjectMode mode_flag)
{
ob->mode |= mode_flag;
@@ -1080,41 +1080,39 @@ static void ed_vwpaintmode_enter_generic(
BKE_sculptsession_free(ob);
}
- vertex_paint_init_session(eval_ctx, scene, ob);
+ vertex_paint_init_session(depsgraph, scene, ob);
}
void ED_object_vpaintmode_enter_ex(
- const EvaluationContext *eval_ctx, wmWindowManager *wm,
+ Depsgraph *depsgraph, wmWindowManager *wm,
Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(
- eval_ctx, wm, scene, ob, OB_MODE_VERTEX_PAINT);
+ depsgraph, wm, scene, ob, OB_MODE_VERTEX_PAINT);
}
void ED_object_vpaintmode_enter(struct bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- ED_object_vpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
+ ED_object_vpaintmode_enter_ex(depsgraph, wm, scene, ob);
}
void ED_object_wpaintmode_enter_ex(
- const EvaluationContext *eval_ctx, wmWindowManager *wm,
+ Depsgraph *depsgraph, wmWindowManager *wm,
Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(
- eval_ctx, wm, scene, ob, OB_MODE_WEIGHT_PAINT);
+ depsgraph, wm, scene, ob, OB_MODE_WEIGHT_PAINT);
}
void ED_object_wpaintmode_enter(struct bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- ED_object_wpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
+ ED_object_wpaintmode_enter_ex(depsgraph, wm, scene, ob);
}
/** \} */
@@ -1211,10 +1209,9 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
ED_object_wpaintmode_exit_ex(ob);
}
else {
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
wmWindowManager *wm = CTX_wm_manager(C);
- ED_object_wpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
+ ED_object_wpaintmode_enter_ex(depsgraph, wm, scene, ob);
}
/* Weightpaint works by overriding colors in mesh,
@@ -1405,6 +1402,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
bool *defbase_sel;
SculptSession *ss = ob->sculpt;
VPaint *vp = CTX_data_tool_settings(C)->wpaint;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
if (ED_wpaint_ensure_data(C, op->reports, WPAINT_ENSURE_MIRROR, &vgroup_index) == false) {
return false;
@@ -1507,11 +1505,8 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
wpd->precomputed_weight = MEM_mallocN(sizeof(float) * me->totvert, __func__);
}
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* If not previously created, create vertex/weight paint mode session data */
- vertex_paint_init_session(&eval_ctx, scene, ob);
+ vertex_paint_init_session(depsgraph, scene, ob);
vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
vertex_paint_init_session_data(ts, ob);
@@ -2347,10 +2342,9 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
ED_object_vpaintmode_exit_ex(ob);
}
else {
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
wmWindowManager *wm = CTX_wm_manager(C);
- ED_object_vpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
+ ED_object_vpaintmode_enter_ex(depsgraph, wm, scene, ob);
}
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
@@ -2442,9 +2436,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
Object *ob = CTX_data_active_object(C);
Mesh *me;
SculptSession *ss = ob->sculpt;
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* context checks could be a poll() */
me = BKE_mesh_from_object(ob);
@@ -2492,12 +2484,12 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
/* Create projection handle */
if (vpd->is_texbrush) {
ob->sculpt->building_vp_handle = true;
- vpd->vp_handle = ED_vpaint_proj_handle_create(&eval_ctx, scene, ob, &vpd->vertexcosnos);
+ vpd->vp_handle = ED_vpaint_proj_handle_create(depsgraph, scene, ob, &vpd->vertexcosnos);
ob->sculpt->building_vp_handle = false;
}
/* If not previously created, create vertex/weight paint mode session data */
- vertex_paint_init_session(&eval_ctx, scene, ob);
+ vertex_paint_init_session(depsgraph, scene, ob);
vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
vertex_paint_init_session_data(ts, ob);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index 336f851d4c1..c5c9aa48760 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -102,13 +102,13 @@ static void vpaint_proj_dm_map_cosnos_init__map_cb(
}
static void vpaint_proj_dm_map_cosnos_init(
- const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob,
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob,
struct VertProjHandle *vp_handle)
{
Mesh *me = ob->data;
DerivedMesh *dm;
- dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+ dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
if (dm->foreachMappedVert) {
memset(vp_handle->vcosnos, 0, sizeof(DMCoNo) * me->totvert);
@@ -176,7 +176,7 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(
}
static void vpaint_proj_dm_map_cosnos_update(
- const struct EvaluationContext *eval_ctx, struct VertProjHandle *vp_handle,
+ struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle,
ARegion *ar, const float mval_fl[2])
{
struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl};
@@ -189,7 +189,7 @@ static void vpaint_proj_dm_map_cosnos_update(
/* quick sanity check - we shouldn't have to run this if there are no modifiers */
BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false);
- dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+ dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
/* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
if (LIKELY(dm->foreachMappedVert)) {
@@ -206,7 +206,7 @@ static void vpaint_proj_dm_map_cosnos_update(
/* Public Functions */
struct VertProjHandle *ED_vpaint_proj_handle_create(
- const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob,
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob,
DMCoNo **r_vcosnos)
{
struct VertProjHandle *vp_handle = MEM_mallocN(sizeof(struct VertProjHandle), __func__);
@@ -217,7 +217,7 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(
vp_handle->use_update = false;
/* sets 'use_update' if needed */
- vpaint_proj_dm_map_cosnos_init(eval_ctx, scene, ob, vp_handle);
+ vpaint_proj_dm_map_cosnos_init(depsgraph, scene, ob, vp_handle);
if (vp_handle->use_update) {
vp_handle->dists_sq = MEM_mallocN(sizeof(float) * me->totvert, __func__);
@@ -237,11 +237,11 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(
}
void ED_vpaint_proj_handle_update(
- const struct EvaluationContext *eval_ctx, struct VertProjHandle *vp_handle,
+ struct Depsgraph *depsgraph, struct VertProjHandle *vp_handle,
ARegion *ar, const float mval_fl[2])
{
if (vp_handle->use_update) {
- vpaint_proj_dm_map_cosnos_update(eval_ctx, vp_handle, ar, mval_fl);
+ vpaint_proj_dm_map_cosnos_update(depsgraph, vp_handle, ar, mval_fl);
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index a5b9a840c33..3773806e192 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -125,17 +125,14 @@ static int weight_from_bones_poll(bContext *C)
static int weight_from_bones_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
Object *armob = modifiers_isDeformedByArmature(ob);
Mesh *me = ob->data;
int type = RNA_enum_get(op->ptr, "type");
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
-
- ED_object_vgroup_calc_from_armature(op->reports, &eval_ctx, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
+ ED_object_vgroup_calc_from_armature(op->reports, depsgraph, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
DEG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
@@ -726,11 +723,9 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
float sco_end[2] = {x_end, y_end};
const bool is_interactive = (gesture != NULL);
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
- 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);
DMGradient_userData data = {NULL};
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 4a9d2597415..3af789d4ebe 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -4601,12 +4601,11 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob, const B
SculptSession *ss = ob->sculpt;
if (ss->kb || ss->modifiers_active) {
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Sculpt *sd = scene->toolsettings->sculpt;
bool need_pmap = sculpt_any_smooth_mode(brush, ss->cache, 0);
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, need_pmap, false);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, need_pmap, false);
}
}
@@ -4809,18 +4808,16 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession
static bool sculpt_brush_stroke_init(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- EvaluationContext eval_ctx;
SculptSession *ss = CTX_data_active_object(C)->sculpt;
Brush *brush = BKE_paint_brush(&sd->paint);
int mode = RNA_enum_get(op->ptr, "mode");
bool is_smooth;
bool need_mask = false;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (brush->sculpt_tool == SCULPT_TOOL_MASK) {
need_mask = true;
}
@@ -4829,7 +4826,7 @@ static bool sculpt_brush_stroke_init(bContext *C, wmOperator *op)
sculpt_brush_init_tex(scene, sd, ss);
is_smooth = sculpt_any_smooth_mode(brush, NULL, mode);
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, is_smooth, need_mask);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, is_smooth, need_mask);
return 1;
}
@@ -5256,18 +5253,18 @@ void sculpt_dyntopo_node_layers_add(SculptSession *ss)
void sculpt_update_after_dynamic_topology_toggle(
- const EvaluationContext *eval_ctx,
+ Depsgraph *depsgraph,
Scene *scene, Object *ob)
{
Sculpt *sd = scene->toolsettings->sculpt;
/* Create the PBVH */
- BKE_sculpt_update_mesh_elements(eval_ctx, scene, sd, ob, false, false);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, false, false);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
void sculpt_dynamic_topology_enable_ex(
- const EvaluationContext *eval_ctx,
+ Depsgraph *depsgraph,
Scene *scene, Object *ob)
{
SculptSession *ss = ob->sculpt;
@@ -5305,7 +5302,7 @@ void sculpt_dynamic_topology_enable_ex(
ss->bm_log = BM_log_create(ss->bm);
/* Refresh */
- sculpt_update_after_dynamic_topology_toggle(eval_ctx, scene, ob);
+ sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob);
}
/* Free the sculpt BMesh and BMLog
@@ -5313,7 +5310,7 @@ void sculpt_dynamic_topology_enable_ex(
* If 'unode' is given, the BMesh's data is copied out to the unode
* before the BMesh is deleted so that it can be restored from */
void sculpt_dynamic_topology_disable_ex(
- const EvaluationContext *eval_ctx,
+ Depsgraph *depsgraph,
Scene *scene, Object *ob, SculptUndoNode *unode)
{
SculptSession *ss = ob->sculpt;
@@ -5364,38 +5361,37 @@ void sculpt_dynamic_topology_disable_ex(
}
/* Refresh */
- sculpt_update_after_dynamic_topology_toggle(eval_ctx, scene, ob);
+ sculpt_update_after_dynamic_topology_toggle(depsgraph, scene, ob);
}
void sculpt_dynamic_topology_disable(bContext *C, SculptUndoNode *unode)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- sculpt_dynamic_topology_disable_ex(&eval_ctx, scene, ob, unode);
+ sculpt_dynamic_topology_disable_ex(depsgraph, scene, ob, unode);
}
static void sculpt_dynamic_topology_disable_with_undo(
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+ Depsgraph *depsgraph, Scene *scene, Object *ob)
{
SculptSession *ss = ob->sculpt;
if (ss->bm) {
sculpt_undo_push_begin("Dynamic topology disable");
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END);
- sculpt_dynamic_topology_disable_ex(eval_ctx, scene, ob, NULL);
+ sculpt_dynamic_topology_disable_ex(depsgraph, scene, ob, NULL);
sculpt_undo_push_end();
}
}
static void sculpt_dynamic_topology_enable_with_undo(
- const EvaluationContext *eval_ctx,
+ Depsgraph *depsgraph,
Scene *scene, Object *ob)
{
SculptSession *ss = ob->sculpt;
if (ss->bm == NULL) {
sculpt_undo_push_begin("Dynamic topology enable");
- sculpt_dynamic_topology_enable_ex(eval_ctx, scene, ob);
+ sculpt_dynamic_topology_enable_ex(depsgraph, scene, ob);
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
sculpt_undo_push_end();
}
@@ -5403,19 +5399,18 @@ static void sculpt_dynamic_topology_enable_with_undo(
static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
WM_cursor_wait(1);
if (ss->bm) {
- sculpt_dynamic_topology_disable_with_undo(&eval_ctx, scene, ob);
+ sculpt_dynamic_topology_disable_with_undo(depsgraph, scene, ob);
}
else {
- sculpt_dynamic_topology_enable_with_undo(&eval_ctx, scene, ob);
+ sculpt_dynamic_topology_enable_with_undo(depsgraph, scene, ob);
}
WM_cursor_wait(0);
@@ -5626,14 +5621,14 @@ static void SCULPT_OT_symmetrize(wmOperatorType *ot)
/**** Toggle operator for turning sculpt mode on or off ****/
-static void sculpt_init_session(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
+static void sculpt_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
/* Create persistent sculpt mode data */
BKE_sculpt_toolsettings_data_ensure(scene);
ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session");
ob->sculpt->mode_type = OB_MODE_SCULPT;
- BKE_sculpt_update_mesh_elements(eval_ctx, scene, scene->toolsettings->sculpt, ob, 0, false);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, 0, false);
}
static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, MultiresModifierData *mmd)
@@ -5647,7 +5642,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, Mult
}
void ED_object_sculptmode_enter_ex(
- const EvaluationContext *eval_ctx,
+ Depsgraph *depsgraph,
Scene *scene, Object *ob,
ReportList *reports)
{
@@ -5669,7 +5664,7 @@ void ED_object_sculptmode_enter_ex(
BKE_sculptsession_free(ob);
}
- sculpt_init_session(eval_ctx, scene, ob);
+ sculpt_init_session(depsgraph, scene, ob);
/* Mask layer is required */
if (mmd) {
@@ -5727,7 +5722,7 @@ void ED_object_sculptmode_enter_ex(
if (message_unsupported == NULL) {
/* undo push is needed to prevent memory leak */
sculpt_undo_push_begin("Dynamic topology enable");
- sculpt_dynamic_topology_enable_ex(eval_ctx, scene, ob);
+ sculpt_dynamic_topology_enable_ex(depsgraph, scene, ob);
sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
}
else {
@@ -5750,13 +5745,12 @@ void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- ED_object_sculptmode_enter_ex(&eval_ctx, scene, ob, reports);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ ED_object_sculptmode_enter_ex(depsgraph, scene, ob, reports);
}
void ED_object_sculptmode_exit_ex(
- const EvaluationContext *eval_ctx,
+ Depsgraph *depsgraph,
Scene *scene, Object *ob)
{
const int mode_flag = OB_MODE_SCULPT;
@@ -5783,7 +5777,7 @@ void ED_object_sculptmode_exit_ex(
/* Dynamic topology must be disabled before exiting sculpt
* mode to ensure the undo stack stays in a consistent
* state */
- sculpt_dynamic_topology_disable_with_undo(eval_ctx, scene, ob);
+ sculpt_dynamic_topology_disable_with_undo(depsgraph, scene, ob);
/* store so we know to re-enable when entering sculpt mode */
me->flag |= ME_SCULPT_DYNAMIC_TOPOLOGY;
@@ -5806,15 +5800,15 @@ void ED_object_sculptmode_exit_ex(
void ED_object_sculptmode_exit(bContext *C)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- ED_object_sculptmode_exit_ex(&eval_ctx, scene, ob);
+ ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
}
static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
{
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_SCULPT;
@@ -5826,14 +5820,11 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
}
}
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (is_mode_set) {
- ED_object_sculptmode_exit_ex(&eval_ctx, scene, ob);
+ ED_object_sculptmode_exit_ex(depsgraph, scene, ob);
}
else {
- ED_object_sculptmode_enter_ex(&eval_ctx, scene, ob, op->reports);
+ ED_object_sculptmode_enter_ex(depsgraph, scene, ob, op->reports);
}
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index ba39d51700d..bca33ad8014 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -61,15 +61,15 @@ bool sculpt_stroke_get_location(struct bContext *C, float out[3], const float mo
void sculpt_pbvh_clear(Object *ob);
void sculpt_dyntopo_node_layers_add(struct SculptSession *ss);
void sculpt_update_after_dynamic_topology_toggle(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob);
void sculpt_dynamic_topology_enable_ex(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob);
void sculpt_dynamic_topology_enable(bContext *C);
void sculpt_dynamic_topology_disable_ex(
- const struct EvaluationContext *eval_ctx,
+ struct Depsgraph *depsgraph,
struct Scene *scene, struct Object *ob,
struct SculptUndoNode *unode);
void sculpt_dynamic_topology_disable(bContext *C, struct SculptUndoNode *unode);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index e12ef2df4ab..3feb8e105e6 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -142,12 +142,10 @@ static bool sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoN
Scene *scene = CTX_data_scene(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
SculptSession *ss = ob->sculpt;
MVert *mvert;
int *index;
-
- CTX_data_eval_ctx(C, &eval_ctx);
if (unode->maxvert) {
/* regular mesh restore */
@@ -161,7 +159,7 @@ static bool sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoN
if (kb) {
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, 0, false);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, 0, false);
WM_event_add_notifier(C, NC_OBJECT | ND_DATA, ob);
}
else {
@@ -477,7 +475,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb)
Scene *scene = CTX_data_scene(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Object *ob = CTX_data_active_object(C);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
DerivedMesh *dm;
SculptSession *ss = ob->sculpt;
SculptUndoNode *unode;
@@ -485,8 +483,6 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb)
bool need_mask = false;
bool partial_update = true;
- CTX_data_eval_ctx(C, &eval_ctx);
-
for (unode = lb->first; unode; unode = unode->next) {
if (STREQ(unode->idname, ob->id.name)) {
if (unode->type == SCULPT_UNDO_MASK) {
@@ -498,10 +494,10 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb)
}
}
- BKE_sculpt_update_mesh_elements(&eval_ctx, scene, sd, ob, 0, need_mask);
+ BKE_sculpt_update_mesh_elements(depsgraph, scene, sd, ob, 0, need_mask);
/* call _after_ sculpt_update_mesh_elements() which may update 'ob->derivedFinal' */
- dm = mesh_get_derived_final(&eval_ctx, scene, ob, 0);
+ dm = mesh_get_derived_final(depsgraph, scene, ob, 0);
if (lb->first && sculpt_undo_bmesh_restore(C, lb->first, ob, ss))
return;
diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c
index 583beef5001..2c6ef20f1c4 100644
--- a/source/blender/editors/space_clip/tracking_ops_orient.c
+++ b/source/blender/editors/space_clip/tracking_ops_orient.c
@@ -405,7 +405,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
ListBase *tracksbase;
Object *object;
Object *camera = get_camera_with_movieclip(scene, clip);
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
int tot = 0;
float vec[3][3], mat[4][4], obmat[4][4], newmat[4][4], orig[3] = {0.0f, 0.0f, 0.0f};
int plane = RNA_enum_get(op->ptr, "plane");
@@ -430,8 +430,6 @@ static int set_plane_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- CTX_data_eval_ctx(C, &eval_ctx);
-
BKE_tracking_get_camera_object_matrix(scene, camera, mat);
/* Get 3 bundles to use as reference. */
@@ -494,7 +492,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
BKE_object_apply_mat4(object, mat, 0, 0);
}
- BKE_object_where_is_calc(&eval_ctx, scene, object);
+ BKE_object_where_is_calc(depsgraph, scene, object);
set_axis(scene, object, clip, tracking_object, axis_track, 'X');
DEG_id_tag_update(&clip->id, 0);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 7baf9a32482..04602e53697 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1900,8 +1900,6 @@ static void outliner_draw_restrictcols(ARegion *ar)
void draw_outliner(const bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Main *mainvar = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index bedd2f09f3b..6bee26a0cf4 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -51,7 +51,6 @@ struct bPoseChannel;
struct EditBone;
struct wmEvent;
struct wmKeyConfig;
-struct EvaluationContext;
typedef enum TreeElementInsertType {
TE_INSERT_BEFORE,
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 4406c0c5b52..6f88a3481b5 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -919,8 +919,8 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
recty = (render_size * (float)scene->r.ysch) / 100.0f + 0.5f;
BKE_sequencer_new_render_data(
- bmain->eval_ctx, bmain, scene,
- rectx, recty, proxy_size,
+ bmain, scene,
+ rectx, recty, proxy_size, false,
&context);
context.view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9a0578fe220..e200dffa308 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -71,7 +71,6 @@
#include "UI_view2d.h"
#include "UI_interface.h"
-
/* own include */
#include "sequencer_intern.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 7ce2f73cbef..de7c46cc02c 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -36,6 +36,7 @@
/* internal exports only */
+struct Depsgraph;
struct Sequence;
struct bContext;
struct rctf;
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 */
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 8be62626ecb..3752d7f6c26 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2671,7 +2671,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
}
/* get constraint targets if needed */
- BKE_constraint_targets_for_solving_get(&t->eval_ctx, con, &cob, &targets, ctime);
+ BKE_constraint_targets_for_solving_get(t->depsgraph, con, &cob, &targets, ctime);
/* do constraint */
cti->evaluate_constraint(con, &cob, &targets);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index ba496a0c744..f1daa831869 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -510,7 +510,6 @@ typedef struct TransInfo {
bool remove_on_cancel; /* remove elements if operator is canceled */
- EvaluationContext eval_ctx;
void *view;
struct bContext *context; /* Only valid (non null) during an operator called function. */
struct ScrArea *sa;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 1ce820f38ff..91b5be2f81c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2119,7 +2119,7 @@ void flushTransParticles(TransInfo *t)
point->flag |= PEP_EDIT_RECALC;
}
- PE_update_object(&t->eval_ctx, scene, OBACT(view_layer), 1);
+ PE_update_object(t->depsgraph, scene, OBACT(view_layer), 1);
}
}
@@ -2637,7 +2637,7 @@ static void createTransEditVerts(TransInfo *t)
if (modifiers_isCorrectableDeformed(t->scene, tc->obedit)) {
/* check if we can use deform matrices for modifier from the
* start up to stack, they are more accurate than quats */
- totleft = BKE_crazyspace_get_first_deform_matrices_editbmesh(&t->eval_ctx, t->scene, tc->obedit, em, &defmats, &defcos);
+ totleft = BKE_crazyspace_get_first_deform_matrices_editbmesh(t->depsgraph, t->scene, tc->obedit, em, &defmats, &defcos);
}
/* if we still have more modifiers, also do crazyspace
@@ -2650,7 +2650,7 @@ static void createTransEditVerts(TransInfo *t)
if (totleft > 0)
#endif
{
- mappedcos = BKE_crazyspace_get_mapped_editverts(&t->eval_ctx, t->scene, tc->obedit);
+ mappedcos = BKE_crazyspace_get_mapped_editverts(t->depsgraph, t->scene, tc->obedit);
quats = MEM_mallocN(em->bm->totvert * sizeof(*quats), "crazy quats");
BKE_crazyspace_set_quats_editmesh(em, defcos, mappedcos, quats, !prop_mode);
if (mappedcos)
@@ -5628,11 +5628,11 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
if (skip_invert == false && constinv == false) {
ob->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc_time checks this */
- BKE_object_where_is_calc(&t->eval_ctx, t->scene, ob);
+ BKE_object_where_is_calc(t->depsgraph, t->scene, ob);
ob->transflag &= ~OB_NO_CONSTRAINTS;
}
else
- BKE_object_where_is_calc(&t->eval_ctx, t->scene, ob);
+ BKE_object_where_is_calc(t->depsgraph, t->scene, ob);
td->ob = ob;
@@ -6629,7 +6629,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* we need to update the pose otherwise no updates get called during
* transform and the auto-ik is not applied. see [#26164] */
struct Object *pose_ob = tc->poseobj;
- BKE_pose_where_is(&t->eval_ctx, t->scene, pose_ob);
+ BKE_pose_where_is(t->depsgraph, t->scene, pose_ob);
}
/* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 3f30c8c1d8d..8f369aea0c8 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -929,7 +929,7 @@ static void recalcData_objects(TransInfo *t)
BIK_clear_data(ob->pose);
}
else {
- BKE_pose_where_is(&t->eval_ctx, t->scene, ob);
+ BKE_pose_where_is(t->depsgraph, t->scene, ob);
}
}
}
@@ -1193,7 +1193,6 @@ void initTransDataContainers_FromObjectData(TransInfo *t)
*/
void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event)
{
- CTX_data_eval_ctx(C, &t->eval_ctx);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *sce = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 4f05727c108..410564a8daa 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -304,7 +304,7 @@ void applyProject(TransInfo *t)
mul_m4_v3(ob->obmat, iloc);
}
else if (t->flag & T_OBJECT) {
- BKE_object_eval_transform_all(G.main->eval_ctx, t->scene, td->ob);
+ BKE_object_eval_transform_all(t->depsgraph, t->scene, td->ob);
copy_v3_v3(iloc, td->ob->obmat[3]);
}
@@ -398,7 +398,7 @@ void applyGridAbsolute(TransInfo *t)
mul_m4_v3(obmat, iloc);
}
else if (t->flag & T_OBJECT) {
- BKE_object_eval_transform_all(G.main->eval_ctx, t->scene, td->ob);
+ BKE_object_eval_transform_all(t->depsgraph, t->scene, td->ob);
copy_v3_v3(iloc, td->ob->obmat[3]);
}
@@ -593,7 +593,7 @@ static void initSnappingMode(TransInfo *t)
if (t->spacetype == SPACE_VIEW3D) {
if (t->tsnap.object_context == NULL) {
t->tsnap.object_context = ED_transform_snap_object_context_create_view3d(
- G.main, t->scene, t->view_layer, 0, t->ar, t->view);
+ G.main, t->scene, 0, t->ar, t->view);
ED_transform_snap_object_context_set_editmesh_callbacks(
t->tsnap.object_context,
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 2a9b4790eaf..5c46d1d0e59 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -54,6 +54,7 @@
#include "BKE_context.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "ED_transform.h"
#include "ED_transform_snap_object_context.h"
@@ -108,7 +109,7 @@ typedef struct SnapObjectData_EditMesh {
struct SnapObjectContext {
Main *bmain;
Scene *scene;
- EvaluationContext eval_ctx;
+ Depsgraph *depsgraph;
int flag;
@@ -162,8 +163,9 @@ static void iter_snap_objects(
IterSnapObjsCallback sob_callback,
void *data)
{
- Base *base_act = sctx->eval_ctx.view_layer->basact;
- for (Base *base = sctx->eval_ctx.view_layer->object_bases.first; base != NULL; base = base->next) {
+ ViewLayer *view_layer = DEG_get_evaluated_view_layer(sctx->depsgraph);
+ Base *base_act = view_layer->basact;
+ for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) {
if ((BASE_VISIBLE(base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 &&
!((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) ||
(snap_select == SNAP_NOT_ACTIVE && base == base_act)))
@@ -172,7 +174,7 @@ static void iter_snap_objects(
Object *obj = base->object;
if (obj->transflag & OB_DUPLI) {
DupliObject *dupli_ob;
- ListBase *lb = object_duplilist(&sctx->eval_ctx, sctx->scene, obj);
+ ListBase *lb = object_duplilist(sctx->depsgraph, sctx->scene, obj);
for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
use_obedit = obedit && dupli_ob->ob->data == obedit->data;
sob_callback(sctx, use_obedit, use_obedit ? obedit : dupli_ob->ob, dupli_ob->mat, data);
@@ -729,10 +731,10 @@ static bool raycastObj(
DerivedMesh *dm;
em = BKE_editmesh_from_object(ob);
if (em) {
- editbmesh_get_derived_cage_and_final(&sctx->eval_ctx, sctx->scene, ob, em, CD_MASK_BAREMESH, &dm);
+ editbmesh_get_derived_cage_and_final(sctx->depsgraph, sctx->scene, ob, em, CD_MASK_BAREMESH, &dm);
}
else {
- dm = mesh_get_derived_final(&sctx->eval_ctx, sctx->scene, ob, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(sctx->depsgraph, sctx->scene, ob, CD_MASK_BAREMESH);
}
retval = raycastDerivedMesh(
sctx,
@@ -821,7 +823,8 @@ static bool raycastObjects(
Object **r_ob, float r_obmat[4][4],
ListBase *r_hit_list)
{
- Object *obedit = use_object_edit_cage ? OBEDIT_FROM_VIEW_LAYER(sctx->eval_ctx.view_layer) : NULL;
+ ViewLayer *view_layer = DEG_get_evaluated_view_layer(sctx->depsgraph);
+ Object *obedit = use_object_edit_cage ? OBEDIT_FROM_VIEW_LAYER(view_layer) : NULL;
struct RaycastObjUserData data = {
.ray_start = ray_start,
@@ -1936,10 +1939,10 @@ static bool snapObject(
DerivedMesh *dm;
em = BKE_editmesh_from_object(ob);
if (em) {
- editbmesh_get_derived_cage_and_final(&sctx->eval_ctx, sctx->scene, ob, em, CD_MASK_BAREMESH, &dm);
+ editbmesh_get_derived_cage_and_final(sctx->depsgraph, sctx->scene, ob, em, CD_MASK_BAREMESH, &dm);
}
else {
- dm = mesh_get_derived_final(&sctx->eval_ctx, sctx->scene, ob, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(sctx->depsgraph, sctx->scene, ob, CD_MASK_BAREMESH);
}
retval = snapDerivedMesh(
sctx, snapdata, ob, dm, obmat,
@@ -2054,7 +2057,8 @@ static bool snapObjectsRay(
float r_loc[3], float r_no[3],
Object **r_ob, float r_obmat[4][4])
{
- Object *obedit = use_object_edit_cage ? OBEDIT_FROM_VIEW_LAYER(sctx->eval_ctx.view_layer) : NULL;
+ ViewLayer *view_layer = DEG_get_evaluated_view_layer(sctx->depsgraph);
+ Object *obedit = use_object_edit_cage ? OBEDIT_FROM_VIEW_LAYER(view_layer) : NULL;
struct SnapObjUserData data = {
.snapdata = snapdata,
@@ -2079,7 +2083,7 @@ static bool snapObjectsRay(
* \{ */
SnapObjectContext *ED_transform_snap_object_context_create(
- Main *bmain, Scene *scene, ViewLayer *view_layer, int flag)
+ Main *bmain, Scene *scene, int flag)
{
SnapObjectContext *sctx = MEM_callocN(sizeof(*sctx), __func__);
@@ -2088,9 +2092,6 @@ SnapObjectContext *ED_transform_snap_object_context_create(
sctx->bmain = bmain;
sctx->scene = scene;
- DEG_evaluation_context_init_from_scene(
- &sctx->eval_ctx, scene, view_layer, DAG_EVAL_VIEWPORT);
-
sctx->cache.object_map = BLI_ghash_ptr_new(__func__);
sctx->cache.mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
@@ -2098,11 +2099,11 @@ SnapObjectContext *ED_transform_snap_object_context_create(
}
SnapObjectContext *ED_transform_snap_object_context_create_view3d(
- Main *bmain, Scene *scene, ViewLayer *view_layer, int flag,
+ Main *bmain, Scene *scene, int flag,
/* extra args for view3d */
const ARegion *ar, const View3D *v3d)
{
- SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, view_layer, flag);
+ SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, flag);
sctx->use_v3d = true;
sctx->v3d_data.ar = ar;
@@ -2365,7 +2366,7 @@ bool ED_transform_snap_object_project_view3d_ex(
ED_view3d_win_to_vector(ar, mval, ray_normal);
ED_view3d_clip_range_get(
- sctx->eval_ctx.depsgraph,
+ sctx->depsgraph,
sctx->v3d_data.v3d, sctx->v3d_data.ar->regiondata,
&depth_range[0], &depth_range[1], false);
@@ -2432,7 +2433,7 @@ bool ED_transform_snap_object_project_all_view3d_ex(
float ray_start[3], ray_normal[3];
if (!ED_view3d_win_to_ray_ex(
- sctx->eval_ctx.depsgraph,
+ sctx->depsgraph,
sctx->v3d_data.ar, sctx->v3d_data.v3d,
mval, NULL, ray_normal, ray_start, true))
{