diff options
326 files changed, 2049 insertions, 2526 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 8eec7c44928..95582b15d63 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -1282,8 +1282,8 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, else { /* TODO: fix point density to work with new view layer depsgraph */ #if 0 - /* We originally were passing view_layer here but in reality we need a whole EvaluationContext or at the - * very least a dpesgraph to pass to the RE_point_density_minmax() function. + /* We originally were passing view_layer here but in reality we need a + * a depsgraph to pass to the RE_point_density_minmax() function. */ /* TODO(sergey): Check we're indeed in shader node tree. */ PointerRNA ptr; diff --git a/release/datafiles/locale b/release/datafiles/locale -Subproject 469c949d1ca882be19daa128842f813b72a944d +Subproject d3349b42856d00c278f72f2a5909a6c96b9cdb5 diff --git a/release/scripts/addons b/release/scripts/addons -Subproject c88411ff7776a2db5d6ef6117a1b2faa42a9561 +Subproject 8f2fd7e23f0b5ce023440182f51c40e88d66332 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib -Subproject 310578043dec1aae382eb6a447ae1d103792d7e +Subproject 34a27a42d781d80f9f1833bad8cc5b2abcac293 diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc index aa5d77ce4ec..4c91b9a6252 100644 --- a/source/blender/alembic/intern/abc_camera.cc +++ b/source/blender/alembic/intern/abc_camera.cc @@ -49,13 +49,13 @@ using Alembic::AbcGeom::kWrapExisting; /* ************************************************************************** */ -AbcCameraWriter::AbcCameraWriter(EvaluationContext *eval_ctx, +AbcCameraWriter::AbcCameraWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) { OCamera camera(parent->alembicXform(), m_name, m_time_sampling); m_camera_schema = camera.getSchema(); diff --git a/source/blender/alembic/intern/abc_camera.h b/source/blender/alembic/intern/abc_camera.h index 772b7a6aec6..a839ca947ca 100644 --- a/source/blender/alembic/intern/abc_camera.h +++ b/source/blender/alembic/intern/abc_camera.h @@ -35,7 +35,7 @@ class AbcCameraWriter : public AbcObjectWriter { Alembic::AbcGeom::OFloatProperty m_eye_separation; public: - AbcCameraWriter(EvaluationContext *eval_ctx, + AbcCameraWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_curves.cc b/source/blender/alembic/intern/abc_curves.cc index 5328c471093..41c1dacabc0 100644 --- a/source/blender/alembic/intern/abc_curves.cc +++ b/source/blender/alembic/intern/abc_curves.cc @@ -71,13 +71,13 @@ using Alembic::AbcGeom::OV2fGeomParam; /* ************************************************************************** */ -AbcCurveWriter::AbcCurveWriter(EvaluationContext *eval_ctx, +AbcCurveWriter::AbcCurveWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) { OCurves curves(parent->alembicXform(), m_name, m_time_sampling); m_schema = curves.getSchema(); diff --git a/source/blender/alembic/intern/abc_curves.h b/source/blender/alembic/intern/abc_curves.h index 73cc8b35e27..1e7180bbb1f 100644 --- a/source/blender/alembic/intern/abc_curves.h +++ b/source/blender/alembic/intern/abc_curves.h @@ -36,7 +36,7 @@ class AbcCurveWriter : public AbcObjectWriter { Alembic::AbcGeom::OCurvesSchema::Sample m_sample; public: - AbcCurveWriter(EvaluationContext *eval_ctx, + AbcCurveWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index ed5b59d08e2..16c3f7f4e86 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -168,7 +168,7 @@ static bool export_object(const ExportSettings * const settings, const Base * co /* ************************************************************************** */ -AbcExporter::AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene, +AbcExporter::AbcExporter(Main *bmain, Scene *scene, ViewLayer *view_layer, Depsgraph *depsgraph, const char *filename, ExportSettings &settings) : m_bmain(bmain) @@ -176,8 +176,8 @@ AbcExporter::AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene, , m_filename(filename) , m_trans_sampling_index(0) , m_shape_sampling_index(0) - , m_eval_ctx(eval_ctx) , m_scene(scene) + , m_view_layer(view_layer) , m_depsgraph(depsgraph) , m_writer(NULL) {} @@ -253,13 +253,13 @@ void AbcExporter::getFrameSet(unsigned int nr_of_samples, } } -void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled) +void AbcExporter::operator()(float &progress, bool &was_canceled) { std::string scene_name; - if (bmain->name[0] != '\0') { + if (m_bmain->name[0] != '\0') { char scene_file_name[FILE_MAX]; - BLI_strncpy(scene_file_name, bmain->name, FILE_MAX); + BLI_strncpy(scene_file_name, m_bmain->name, FILE_MAX); scene_name = scene_file_name; } else { @@ -298,8 +298,8 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled) OBox3dProperty archive_bounds_prop = Alembic::AbcGeom::CreateOArchiveBounds(m_writer->archive(), m_trans_sampling_index); - createTransformWritersHierarchy(bmain->eval_ctx); - createShapeWriters(bmain->eval_ctx); + createTransformWritersHierarchy(m_depsgraph); + createShapeWriters(m_depsgraph); /* Make a list of frames to export. */ @@ -332,7 +332,7 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled) const double frame = *begin; /* 'frame' is offset by start frame, so need to cancel the offset. */ - setCurrentFrame(bmain, frame); + setCurrentFrame(m_bmain, frame); if (shape_frames.count(frame) != 0) { for (int i = 0, e = m_shapes.size(); i != e; ++i) { @@ -361,7 +361,7 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled) } } -void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx) +void AbcExporter::createTransformWritersHierarchy(Depsgraph *depsgraph) { for (Base *base = static_cast<Base *>(m_settings.view_layer->object_bases.first); base; base = base->next) { Object *ob = base->object; @@ -374,13 +374,13 @@ void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx) /* We do not export transforms for objects of these classes. */ break; default: - exploreTransform(eval_ctx, base, ob->parent, NULL); + exploreTransform(depsgraph, base, ob->parent, NULL); } } } } -void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, Object *parent, Object *dupliObParent) +void AbcExporter::exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *parent, Object *dupliObParent) { Object *ob = ob_base->object; @@ -391,10 +391,10 @@ void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, O } if (object_type_is_exportable(m_scene, ob)) { - createTransformWriter(eval_ctx, ob, parent, dupliObParent); + createTransformWriter(depsgraph, ob, parent, dupliObParent); } - ListBase *lb = object_duplilist(eval_ctx, m_scene, ob); + ListBase *lb = object_duplilist(depsgraph, m_scene, ob); if (lb) { Base fake_base = *ob_base; // copy flags (like selection state) from the real object. @@ -415,7 +415,7 @@ void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, O dupli_parent = (dupli_ob->parent) ? dupli_ob->parent : ob; fake_base.object = dupli_ob; - exploreTransform(eval_ctx, &fake_base, dupli_parent, ob); + exploreTransform(depsgraph, &fake_base, dupli_parent, ob); } } } @@ -423,7 +423,7 @@ void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, O free_object_duplilist(lb); } -AbcTransformWriter * AbcExporter::createTransformWriter(EvaluationContext *eval_ctx, Object *ob, Object *parent, Object *dupliObParent) +AbcTransformWriter * AbcExporter::createTransformWriter(Depsgraph *depsgraph, Object *ob, Object *parent, Object *dupliObParent) { /* An object should not be its own parent, or we'll get infinite loops. */ BLI_assert(ob != parent); @@ -458,29 +458,29 @@ AbcTransformWriter * AbcExporter::createTransformWriter(EvaluationContext *eval_ * return the parent's AbcTransformWriter pointer. */ if (parent->parent) { if (parent == dupliObParent) { - parent_writer = createTransformWriter(eval_ctx, parent, parent->parent, NULL); + parent_writer = createTransformWriter(depsgraph, parent, parent->parent, NULL); } else { - parent_writer = createTransformWriter(eval_ctx, parent, parent->parent, dupliObParent); + parent_writer = createTransformWriter(depsgraph, parent, parent->parent, dupliObParent); } } else if (parent == dupliObParent) { if (dupliObParent->parent == NULL) { - parent_writer = createTransformWriter(eval_ctx, parent, NULL, NULL); + parent_writer = createTransformWriter(depsgraph, parent, NULL, NULL); } else { - parent_writer = createTransformWriter(eval_ctx, parent, dupliObParent->parent, dupliObParent->parent); + parent_writer = createTransformWriter(depsgraph, parent, dupliObParent->parent, dupliObParent->parent); } } else { - parent_writer = createTransformWriter(eval_ctx, parent, dupliObParent, dupliObParent); + parent_writer = createTransformWriter(depsgraph, parent, dupliObParent, dupliObParent); } BLI_assert(parent_writer); alembic_parent = parent_writer->alembicXform(); } - my_writer = new AbcTransformWriter(eval_ctx, ob, alembic_parent, parent_writer, + my_writer = new AbcTransformWriter(depsgraph, ob, alembic_parent, parent_writer, m_trans_sampling_index, m_settings); /* When flattening, the matrix of the dupliobject has to be added. */ @@ -492,14 +492,14 @@ AbcTransformWriter * AbcExporter::createTransformWriter(EvaluationContext *eval_ return my_writer; } -void AbcExporter::createShapeWriters(EvaluationContext *eval_ctx) +void AbcExporter::createShapeWriters(Depsgraph *depsgraph) { for (Base *base = static_cast<Base *>(m_settings.view_layer->object_bases.first); base; base = base->next) { - exploreObject(eval_ctx, base, NULL); + exploreObject(depsgraph, base, NULL); } } -void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Base *ob_base, Object *dupliObParent) +void AbcExporter::exploreObject(Depsgraph *depsgraph, Base *ob_base, Object *dupliObParent) { /* If an object isn't exported itself, its duplilist shouldn't be * exported either. */ @@ -510,7 +510,7 @@ void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Base *ob_base, Obje createShapeWriter(ob_base, dupliObParent); Object *ob = ob_base->object; - ListBase *lb = object_duplilist(eval_ctx, m_scene, ob); + ListBase *lb = object_duplilist(depsgraph, m_scene, ob); if (lb) { Base fake_base = *ob_base; // copy flags (like selection state) from the real object. @@ -525,7 +525,7 @@ void AbcExporter::exploreObject(EvaluationContext *eval_ctx, Base *ob_base, Obje } if (link->type == OB_DUPLIGROUP) { fake_base.object = link->ob; - exploreObject(eval_ctx, &fake_base, ob); + exploreObject(depsgraph, &fake_base, ob); } } } @@ -548,10 +548,10 @@ void AbcExporter::createParticleSystemsWriters(Object *ob, AbcTransformWriter *x if (m_settings.export_hair && psys->part->type == PART_HAIR) { m_settings.export_child_hairs = true; - m_shapes.push_back(new AbcHairWriter(m_eval_ctx, m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); + m_shapes.push_back(new AbcHairWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); } else if (m_settings.export_particles && psys->part->type == PART_EMITTER) { - m_shapes.push_back(new AbcPointsWriter(m_eval_ctx, m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); + m_shapes.push_back(new AbcPointsWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); } } } @@ -591,7 +591,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent) return; } - m_shapes.push_back(new AbcMeshWriter(m_eval_ctx, m_scene, ob, xform, m_shape_sampling_index, m_settings)); + m_shapes.push_back(new AbcMeshWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings)); break; } case OB_SURF: @@ -602,7 +602,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent) return; } - m_shapes.push_back(new AbcNurbsWriter(m_eval_ctx, m_scene, ob, xform, m_shape_sampling_index, m_settings)); + m_shapes.push_back(new AbcNurbsWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings)); break; } case OB_CURVE: @@ -613,7 +613,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent) return; } - m_shapes.push_back(new AbcCurveWriter(m_eval_ctx, m_scene, ob, xform, m_shape_sampling_index, m_settings)); + m_shapes.push_back(new AbcCurveWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings)); break; } case OB_CAMERA: @@ -621,7 +621,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent) Camera *cam = static_cast<Camera *>(ob->data); if (cam->type == CAM_PERSP) { - m_shapes.push_back(new AbcCameraWriter(m_eval_ctx, m_scene, ob, xform, m_shape_sampling_index, m_settings)); + m_shapes.push_back(new AbcCameraWriter(m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings)); } break; @@ -634,7 +634,7 @@ void AbcExporter::createShapeWriter(Base *ob_base, Object *dupliObParent) } m_shapes.push_back(new AbcMBallWriter( - m_bmain, m_eval_ctx, m_scene, ob, xform, + m_bmain, m_depsgraph, m_scene, ob, xform, m_shape_sampling_index, m_settings)); break; } diff --git a/source/blender/alembic/intern/abc_exporter.h b/source/blender/alembic/intern/abc_exporter.h index 9c9c21af12f..0a32a28adca 100644 --- a/source/blender/alembic/intern/abc_exporter.h +++ b/source/blender/alembic/intern/abc_exporter.h @@ -34,7 +34,6 @@ class AbcObjectWriter; class AbcTransformWriter; class ArchiveWriter; -struct EvaluationContext; struct Depsgraph; struct Main; struct Object; @@ -93,8 +92,8 @@ class AbcExporter { unsigned int m_trans_sampling_index, m_shape_sampling_index; - EvaluationContext *m_eval_ctx; Scene *m_scene; + ViewLayer *m_view_layer; Depsgraph *m_depsgraph; ArchiveWriter *m_writer; @@ -106,12 +105,12 @@ class AbcExporter { std::vector<AbcObjectWriter *> m_shapes; public: - AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene, + AbcExporter(Main *bmain, Scene *scene, ViewLayer *view_layer, Depsgraph *depsgraph, const char *filename, ExportSettings &settings); ~AbcExporter(); - void operator()(Main *bmain, float &progress, bool &was_canceled); + void operator()(float &progress, bool &was_canceled); protected: void getShutterSamples(unsigned int nr_of_samples, @@ -122,11 +121,11 @@ protected: private: Alembic::Abc::TimeSamplingPtr createTimeSampling(double step); - void createTransformWritersHierarchy(EvaluationContext *eval_ctx); - AbcTransformWriter * createTransformWriter(EvaluationContext *eval_ctx, Object *ob, Object *parent, Object *dupliObParent); - void exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, Object *parent, Object *dupliObParent); - void exploreObject(EvaluationContext *eval_ctx, Base *ob_base, Object *dupliObParent); - void createShapeWriters(EvaluationContext *eval_ctx); + void createTransformWritersHierarchy(Depsgraph *depsgraph); + AbcTransformWriter * createTransformWriter(Depsgraph *depsgraph, Object *ob, Object *parent, Object *dupliObParent); + void exploreTransform(Depsgraph *depsgraph, Base *ob_base, Object *parent, Object *dupliObParent); + void exploreObject(Depsgraph *depsgraph, Base *ob_base, Object *dupliObParent); + void createShapeWriters(Depsgraph *depsgraph); void createShapeWriter(Base *ob_base, Object *dupliObParent); void createParticleSystemsWriters(Object *ob, AbcTransformWriter *xform); diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc index 53e8dea89cc..70ca7a1a929 100644 --- a/source/blender/alembic/intern/abc_hair.cc +++ b/source/blender/alembic/intern/abc_hair.cc @@ -49,14 +49,14 @@ using Alembic::AbcGeom::OV2fGeomParam; /* ************************************************************************** */ -AbcHairWriter::AbcHairWriter(EvaluationContext *eval_ctx, +AbcHairWriter::AbcHairWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, ParticleSystem *psys) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) , m_uv_warning_shown(false) { m_psys = psys; @@ -77,7 +77,7 @@ void AbcHairWriter::do_write() return; } - DerivedMesh *dm = mesh_create_derived_render(m_eval_ctx, m_scene, m_object, CD_MASK_MESH); + DerivedMesh *dm = mesh_create_derived_render(m_depsgraph, m_scene, m_object, CD_MASK_MESH); DM_ensure_tessface(dm); std::vector<Imath::V3f> verts; diff --git a/source/blender/alembic/intern/abc_hair.h b/source/blender/alembic/intern/abc_hair.h index 8190c449205..5627f7726e6 100644 --- a/source/blender/alembic/intern/abc_hair.h +++ b/source/blender/alembic/intern/abc_hair.h @@ -40,7 +40,7 @@ class AbcHairWriter : public AbcObjectWriter { bool m_uv_warning_shown; public: - AbcHairWriter(EvaluationContext *eval_ctx, + AbcHairWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_mball.cc b/source/blender/alembic/intern/abc_mball.cc index f1aa25c8f70..1df55712abe 100644 --- a/source/blender/alembic/intern/abc_mball.cc +++ b/source/blender/alembic/intern/abc_mball.cc @@ -42,13 +42,13 @@ extern "C" { AbcMBallWriter::AbcMBallWriter( Main *bmain, - EvaluationContext *eval_ctx, + Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) , m_bmain(bmain) { m_is_animated = isAnimated(); @@ -58,7 +58,7 @@ AbcMBallWriter::AbcMBallWriter( sizeof(CurveCache), "CurveCache for AbcMBallWriter"); - m_mesh_writer = new AbcMeshWriter(eval_ctx, scene, m_mesh_ob, parent, + m_mesh_writer = new AbcMeshWriter(depsgraph, scene, m_mesh_ob, parent, time_sampling, settings); m_mesh_writer->setIsAnimated(m_is_animated); } @@ -97,13 +97,11 @@ void AbcMBallWriter::do_write() id_us_min(&tmpmesh->id); ListBase disp = {NULL, NULL}; - /* TODO(sergey): This is gonna to work for until EvaluationContext + /* TODO(sergey): This is gonna to work for until Depsgraph * only contains for_render flag. As soon as CoW is * implemented, this is to be rethinked. */ - EvaluationContext eval_ctx; - DEG_evaluation_context_init(&eval_ctx, DAG_EVAL_RENDER); - BKE_displist_make_mball_forRender(&eval_ctx, m_scene, m_object, &disp); + BKE_displist_make_mball_forRender(m_depsgraph, m_scene, m_object, &disp); BKE_mesh_from_metaball(&disp, tmpmesh); BKE_displist_free(&disp); diff --git a/source/blender/alembic/intern/abc_mball.h b/source/blender/alembic/intern/abc_mball.h index e657711059e..19bf7dc054d 100644 --- a/source/blender/alembic/intern/abc_mball.h +++ b/source/blender/alembic/intern/abc_mball.h @@ -42,7 +42,7 @@ class AbcMBallWriter : public AbcObjectWriter { public: AbcMBallWriter( Main *bmain, - EvaluationContext *eval_ctx, + Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index c2c99e2b11f..52d14f84728 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -286,13 +286,13 @@ static ModifierData *get_liquid_sim_modifier(Scene *scene, Object *ob) /* ************************************************************************** */ -AbcMeshWriter::AbcMeshWriter(EvaluationContext *eval_ctx, +AbcMeshWriter::AbcMeshWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) { m_is_animated = isAnimated(); m_subsurf_mod = NULL; @@ -525,7 +525,7 @@ DerivedMesh *AbcMeshWriter::getFinalMesh() m_subsurf_mod->mode |= eModifierMode_DisableTemporary; } - DerivedMesh *dm = mesh_create_derived_render(m_eval_ctx, m_scene, m_object, CD_MASK_MESH); + DerivedMesh *dm = mesh_create_derived_render(m_depsgraph, m_scene, m_object, CD_MASK_MESH); if (m_subsurf_mod) { m_subsurf_mod->mode &= ~eModifierMode_DisableTemporary; diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h index a08b7352d16..c57123cda4c 100644 --- a/source/blender/alembic/intern/abc_mesh.h +++ b/source/blender/alembic/intern/abc_mesh.h @@ -50,7 +50,7 @@ class AbcMeshWriter : public AbcObjectWriter { bool m_is_subd; public: - AbcMeshWriter(EvaluationContext *eval_ctx, + AbcMeshWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc index 0532191a28d..1f042d0bafc 100644 --- a/source/blender/alembic/intern/abc_nurbs.cc +++ b/source/blender/alembic/intern/abc_nurbs.cc @@ -60,13 +60,13 @@ using Alembic::AbcGeom::ONuPatchSchema; /* ************************************************************************** */ -AbcNurbsWriter::AbcNurbsWriter(EvaluationContext *eval_ctx, +AbcNurbsWriter::AbcNurbsWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) { m_is_animated = isAnimated(); diff --git a/source/blender/alembic/intern/abc_nurbs.h b/source/blender/alembic/intern/abc_nurbs.h index 3d20c5c60bb..d2422345c3f 100644 --- a/source/blender/alembic/intern/abc_nurbs.h +++ b/source/blender/alembic/intern/abc_nurbs.h @@ -32,7 +32,7 @@ class AbcNurbsWriter : public AbcObjectWriter { bool m_is_animated; public: - AbcNurbsWriter(EvaluationContext *eval_ctx, + AbcNurbsWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc index aa4e390fa71..85bda9aa8eb 100644 --- a/source/blender/alembic/intern/abc_object.cc +++ b/source/blender/alembic/intern/abc_object.cc @@ -58,7 +58,7 @@ using Alembic::AbcGeom::OStringProperty; /* ************************************************************************** */ -AbcObjectWriter::AbcObjectWriter(EvaluationContext *eval_ctx, +AbcObjectWriter::AbcObjectWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, uint32_t time_sampling, @@ -66,7 +66,7 @@ AbcObjectWriter::AbcObjectWriter(EvaluationContext *eval_ctx, AbcObjectWriter *parent) : m_object(ob) , m_settings(settings) - , m_eval_ctx(eval_ctx) + , m_depsgraph(depsgraph) , m_scene(scene) , m_time_sampling(time_sampling) , m_first_frame(true) diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h index 6aa6224f8d5..d41088bdcad 100644 --- a/source/blender/alembic/intern/abc_object.h +++ b/source/blender/alembic/intern/abc_object.h @@ -44,7 +44,7 @@ protected: Object *m_object; ExportSettings &m_settings; - EvaluationContext *m_eval_ctx; + Depsgraph *m_depsgraph; Scene *m_scene; uint32_t m_time_sampling; @@ -57,7 +57,7 @@ protected: std::string m_name; public: - AbcObjectWriter(EvaluationContext *eval_ctx, + AbcObjectWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, uint32_t time_sampling, diff --git a/source/blender/alembic/intern/abc_points.cc b/source/blender/alembic/intern/abc_points.cc index feb2eff5b9d..6f52ccec4a7 100644 --- a/source/blender/alembic/intern/abc_points.cc +++ b/source/blender/alembic/intern/abc_points.cc @@ -58,14 +58,14 @@ using Alembic::AbcGeom::OPointsSchema; /* ************************************************************************** */ -AbcPointsWriter::AbcPointsWriter(EvaluationContext *eval_ctx, +AbcPointsWriter::AbcPointsWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, ParticleSystem *psys) - : AbcObjectWriter(eval_ctx, scene, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, scene, ob, time_sampling, settings, parent) { m_psys = psys; @@ -87,7 +87,7 @@ void AbcPointsWriter::do_write() ParticleKey state; ParticleSimulationData sim; - sim.eval_ctx = m_eval_ctx; + sim.depsgraph = m_depsgraph; sim.scene = m_scene; sim.ob = m_object; sim.psys = m_psys; diff --git a/source/blender/alembic/intern/abc_points.h b/source/blender/alembic/intern/abc_points.h index b60f1997aa8..1ac8792ede1 100644 --- a/source/blender/alembic/intern/abc_points.h +++ b/source/blender/alembic/intern/abc_points.h @@ -38,7 +38,7 @@ class AbcPointsWriter : public AbcObjectWriter { ParticleSystem *m_psys; public: - AbcPointsWriter(EvaluationContext *eval_ctx, + AbcPointsWriter(Depsgraph *depsgraph, Scene *scene, Object *ob, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc index 0a1480e62b0..e5da367b9a9 100644 --- a/source/blender/alembic/intern/abc_transform.cc +++ b/source/blender/alembic/intern/abc_transform.cc @@ -57,13 +57,13 @@ static bool has_parent_camera(Object *ob) /* ************************************************************************** */ -AbcTransformWriter::AbcTransformWriter(EvaluationContext *eval_ctx, +AbcTransformWriter::AbcTransformWriter(Depsgraph *depsgraph, Object *ob, const OObject &abc_parent, AbcTransformWriter *parent, unsigned int time_sampling, ExportSettings &settings) - : AbcObjectWriter(eval_ctx, NULL, ob, time_sampling, settings, parent) + : AbcObjectWriter(depsgraph, NULL, ob, time_sampling, settings, parent) , m_proxy_from(NULL) { m_is_animated = hasAnimation(m_object); diff --git a/source/blender/alembic/intern/abc_transform.h b/source/blender/alembic/intern/abc_transform.h index e82765cb169..ce4b28ea236 100644 --- a/source/blender/alembic/intern/abc_transform.h +++ b/source/blender/alembic/intern/abc_transform.h @@ -44,7 +44,7 @@ public: Object *m_proxy_from; public: - AbcTransformWriter(EvaluationContext *eval_ctx, + AbcTransformWriter(Depsgraph *depsgraph, Object *ob, const Alembic::AbcGeom::OObject &abc_parent, AbcTransformWriter *parent, diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index cb01efb2cf4..75b4063f3c4 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -230,7 +230,6 @@ static void find_iobject(const IObject &object, IObject &ret, } struct ExportJobData { - EvaluationContext eval_ctx; Scene *scene; ViewLayer *view_layer; Depsgraph *depsgraph; @@ -265,12 +264,13 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo try { Scene *scene = data->scene; - AbcExporter exporter(data->bmain, &data->eval_ctx, scene, data->depsgraph, data->filename, data->settings); + ViewLayer *view_layer = data->view_layer; + AbcExporter exporter(data->bmain, scene, view_layer, data->depsgraph, data->filename, data->settings); const int orig_frame = CFRA; data->was_canceled = false; - exporter(data->bmain, *data->progress, data->was_canceled); + exporter(*data->progress, data->was_canceled); if (CFRA != orig_frame) { CFRA = orig_frame; @@ -314,8 +314,6 @@ bool ABC_export( { ExportJobData *job = static_cast<ExportJobData *>(MEM_mallocN(sizeof(ExportJobData), "ExportJobData")); - CTX_data_eval_ctx(C, &job->eval_ctx); - job->scene = scene; job->view_layer = CTX_data_view_layer(C); job->depsgraph = CTX_data_depsgraph(C); diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 4ae11b5cca5..d269a2fb63b 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -95,10 +95,10 @@ struct KeyBlock; struct ModifierData; struct MCol; struct ColorBand; +struct Depsgraph; struct GPUVertexAttribs; struct GPUDrawObject; struct PBVH; -struct EvaluationContext; /* number of sub-elements each mesh element has (for interpolation) */ #define SUB_ELEMS_VERT 0 @@ -660,18 +660,18 @@ void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int /* */ DerivedMesh *mesh_get_derived_final( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_get_derived_deform( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_create_derived_for_modifier( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ModifierData *md, int build_shapekey_layers); DerivedMesh *mesh_create_derived_render( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *getEditDerivedBMesh( @@ -679,37 +679,37 @@ DerivedMesh *getEditDerivedBMesh( float (*vertexCos)[3]); DerivedMesh *mesh_create_derived_index_render( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, CustomDataMask dataMask, int index); /* same as above but wont use render settings */ DerivedMesh *mesh_create_derived(struct Mesh *me, float (*vertCos)[3]); DerivedMesh *mesh_create_derived_view( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_create_derived_no_deform( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *mesh_create_derived_no_deform_render( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); /* for gameengine */ DerivedMesh *mesh_create_derived_no_virtual( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *mesh_create_derived_physics( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *editbmesh_get_derived_base( struct Object *ob, struct BMEditMesh *em, CustomDataMask data_mask); DerivedMesh *editbmesh_get_derived_cage( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *, struct BMEditMesh *em, CustomDataMask dataMask); DerivedMesh *editbmesh_get_derived_cage_and_final( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *, struct BMEditMesh *em, CustomDataMask dataMask, DerivedMesh **r_final); @@ -718,7 +718,7 @@ DerivedMesh *object_get_derived_final(struct Object *ob, const bool for_render); float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *r_numVerts))[3]; bool editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm); void makeDerivedMesh( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct BMEditMesh *em, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct BMEditMesh *em, CustomDataMask dataMask, const bool build_shapekey_layers); void weight_to_rgb(float r_rgb[3], const float weight); diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 30a7bdb0a27..0fb83162459 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -32,7 +32,7 @@ * \author nzc * \since March 2001 */ -struct EvaluationContext; +struct Depsgraph; struct Path; struct Object; struct Scene; @@ -54,7 +54,7 @@ void animviz_free_motionpath(struct bMotionPath *mpath); struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); -void animviz_calc_motionpaths(struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *scene, ListBase *targets); +void animviz_calc_motionpaths(struct Depsgraph *depsgraph, struct Main *bmain, struct Scene *scene, ListBase *targets); /* ---------------------------------------------------- */ /* Curve Paths */ @@ -66,8 +66,8 @@ int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], fl /* ---------------------------------------------------- */ /* Dupli-Geometry */ -struct ListBase *object_duplilist_ex(const struct EvaluationContext *eval_ctx, struct Scene *sce, struct Object *ob, bool update); -struct ListBase *object_duplilist(const struct EvaluationContext *eval_ctx, struct Scene *sce, struct Object *ob); +struct ListBase *object_duplilist_ex(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob, bool update); +struct ListBase *object_duplilist(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob); void free_object_duplilist(struct ListBase *lb); int count_duplilist(struct Object *ob); @@ -81,7 +81,7 @@ typedef struct DupliApplyData { DupliExtraData *extra; } DupliApplyData; -DupliApplyData *duplilist_apply(const struct EvaluationContext *eval_ctx, struct Object *ob, struct Scene *scene, struct ListBase *duplilist); +DupliApplyData *duplilist_apply(struct Depsgraph *depsgraph, struct Object *ob, struct Scene *scene, struct ListBase *duplilist); void duplilist_restore(struct ListBase *duplilist, DupliApplyData *apply_data); void duplilist_free_apply_data(DupliApplyData *apply_data); diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index d95b4a838b8..fe4a145b7b3 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -200,10 +200,10 @@ void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act, /* ------------ Evaluation API --------------- */ -struct EvaluationContext; +struct Depsgraph; -void BKE_animsys_eval_animdata(const struct EvaluationContext *eval_ctx, struct ID *id); -void BKE_animsys_eval_driver(const struct EvaluationContext *eval_ctx, struct ID *id, struct FCurve *fcurve); +void BKE_animsys_eval_animdata(struct Depsgraph *depsgraph, struct ID *id); +void BKE_animsys_eval_driver(struct Depsgraph *depsgraph, struct ID *id, struct FCurve *fcurve); /* ************************************* */ diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index bf37224c85f..e286c1248c0 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -35,7 +35,7 @@ struct bPose; struct Bone; -struct EvaluationContext; +struct Depsgraph; struct GHash; struct Main; struct bArmature; @@ -100,8 +100,8 @@ void BKE_armature_where_is(struct bArmature *arm); void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone, const bool use_recursion); void BKE_pose_clear_pointers(struct bPose *pose); void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm); -void BKE_pose_where_is(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void BKE_pose_where_is_bone(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra); +void BKE_pose_where_is(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); +void BKE_pose_where_is_bone(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra); void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan); /* get_objectspace_bone_matrix has to be removed still */ @@ -118,7 +118,7 @@ void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]); void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4]); -void BKE_armature_mat_pose_to_bone_ex(const struct EvaluationContext *eval_ctx, struct Object *ob, struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]); +void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, struct Object *ob, struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]); void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[3][3], bool use_compat); void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[4][4], bool use_comat); @@ -166,46 +166,46 @@ struct bPoseChannel *BKE_armature_splineik_solver_find_root( void BKE_pose_splineik_init_tree(struct Scene *scene, struct Object *ob, float ctime); void BKE_splineik_execute_tree( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); -void BKE_pose_eval_init(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_init(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_init_ik(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_bone(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int pchan_index); -void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx, +void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int pchan_index); -void BKE_pose_bone_done(const struct EvaluationContext *eval_ctx, +void BKE_pose_bone_done(struct Depsgraph *depsgraph, struct Object *ob, int pchan_index); -void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx, +void BKE_pose_iktree_evaluate(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int rootchan_index); -void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx, +void BKE_pose_splineik_evaluate(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int rootchan_index); -void BKE_pose_eval_flush(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_flush(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -void BKE_pose_eval_proxy_copy(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_proxy_copy(struct Depsgraph *depsgraph, struct Object *ob); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index d5bf2177f71..5e79f641c97 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -114,7 +114,7 @@ typedef struct CameraParams { void BKE_camera_params_init(CameraParams *params); void BKE_camera_params_from_object(CameraParams *params, const struct Object *camera); -void BKE_camera_params_from_view3d(CameraParams *params, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d); +void BKE_camera_params_from_view3d(CameraParams *params, struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d); void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy); void BKE_camera_params_compute_matrix(CameraParams *params); @@ -130,6 +130,7 @@ void BKE_camera_view_frame( float r_vec[4][3]); bool BKE_camera_view_frame_fit_to_scene( + struct Depsgraph *depsgraph, struct Scene *scene, struct ViewLayer *view_layer, struct Object *camera_ob, float r_co[3], float *r_scale); bool BKE_camera_view_frame_fit_to_coords( diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 8923edacb07..94daf615054 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -41,7 +41,7 @@ struct MFace; struct DerivedMesh; struct ClothModifierData; struct CollisionModifierData; -struct EvaluationContext; +struct Depsgraph; #define DO_INLINE MALWAYS_INLINE @@ -227,7 +227,7 @@ void cloth_free_contacts(ColliderContacts *collider_contacts, int totcolliders); void cloth_free_modifier_extern (struct ClothModifierData *clmd ); void cloth_free_modifier (struct ClothModifierData *clmd ); void cloth_init (struct ClothModifierData *clmd ); -void clothModifier_do(struct ClothModifierData *clmd, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]); +void clothModifier_do(struct ClothModifierData *clmd, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]); int cloth_uses_vgroup(struct ClothModifierData *clmd); diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index cf7e2908360..54ddb61d922 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -40,7 +40,7 @@ struct ListBase; struct Object; struct Scene; struct bPoseChannel; -struct EvaluationContext; +struct Depsgraph; /* ---------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -103,7 +103,7 @@ typedef struct bConstraintTypeInfo { /* evaluation */ /* set the ct->matrix for the given constraint target (at the given ctime) */ - void (*get_target_matrix)(const struct EvaluationContext *eval_ctx, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime); + void (*get_target_matrix)(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime); /* evaluate the constraint for the given time */ void (*evaluate_constraint)(struct bConstraint *con, struct bConstraintOb *cob, struct ListBase *targets); } bConstraintTypeInfo; @@ -148,10 +148,10 @@ void BKE_constraints_clear_evalob(struct bConstraintOb *cob); void BKE_constraint_mat_convertspace( struct Object *ob, struct bPoseChannel *pchan, float mat[4][4], short from, short to, const bool keep_scale); -void BKE_constraint_target_matrix_get(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct bConstraint *con, +void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, struct Scene *scene, struct bConstraint *con, int n, short ownertype, void *ownerdata, float mat[4][4], float ctime); -void BKE_constraint_targets_for_solving_get(const struct EvaluationContext *eval_ctx, struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime); -void BKE_constraints_solve(const struct EvaluationContext *eval_ctx, struct ListBase *conlist, struct bConstraintOb *cob, float ctime); +void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *ob, struct ListBase *targets, float ctime); +void BKE_constraints_solve(struct Depsgraph *depsgraph, struct ListBase *conlist, struct bConstraintOb *cob, float ctime); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index bccc7addaad..5057168b9f6 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -75,7 +75,6 @@ struct SpaceText; struct SpaceImage; struct SpaceClip; struct ID; -struct EvaluationContext; #include "DNA_object_enums.h" @@ -325,8 +324,6 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list); struct Depsgraph *CTX_data_depsgraph(const bContext *C); -void CTX_data_eval_ctx(const bContext *C, struct EvaluationContext *eval_ctx); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_crazyspace.h b/source/blender/blenkernel/BKE_crazyspace.h index 31542cd6f8a..e9745ed50fa 100644 --- a/source/blender/blenkernel/BKE_crazyspace.h +++ b/source/blender/blenkernel/BKE_crazyspace.h @@ -38,24 +38,24 @@ struct Scene; struct Object; struct BMEditMesh; struct Mesh; -struct EvaluationContext; +struct Depsgraph; /* crazyspace.c */ float (*BKE_crazyspace_get_mapped_editverts( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *obedit))[3]; + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *obedit))[3]; void BKE_crazyspace_set_quats_editmesh( struct BMEditMesh *em, float (*origcos)[3], float (*mappedcos)[3], float (*quats)[4], const bool use_select); void BKE_crazyspace_set_quats_mesh( struct Mesh *me, float (*origcos)[3], float (*mappedcos)[3], float (*quats)[4]); int BKE_crazyspace_get_first_deform_matrices_editbmesh( - const struct EvaluationContext *eval_ctx, struct Scene *, struct Object *, struct BMEditMesh *em, + struct Depsgraph *depsgraph, struct Scene *, struct Object *, struct BMEditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]); int BKE_sculpt_get_first_deform_matrices( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); void BKE_crazyspace_build_sculpt( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index fbd05552255..975cea7364d 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -36,7 +36,7 @@ struct BezTriple; struct Curve; struct EditNurb; -struct EvaluationContext; +struct Depsgraph; struct GHash; struct ListBase; struct Main; @@ -123,13 +123,13 @@ void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex); void BKE_curve_editNurb_free(struct Curve *cu); struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu); -float *BKE_curve_make_orco(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, int *r_numVerts); +float *BKE_curve_make_orco(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int *r_numVerts); float *BKE_curve_surf_make_orco(struct Object *ob); void BKE_curve_bevelList_free(struct ListBase *bev); void BKE_curve_bevelList_make(struct Object *ob, struct ListBase *nurbs, bool for_render); void BKE_curve_bevel_make( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *disp, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *disp, const bool for_render, const bool use_render_resolution); void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); @@ -218,7 +218,7 @@ void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles); /* **** Depsgraph evaluation **** */ void BKE_curve_eval_geometry( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Curve *curve); /* Draw Cache */ diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h index d5f0313ca64..6559f9a954f 100644 --- a/source/blender/blenkernel/BKE_data_transfer.h +++ b/source/blender/blenkernel/BKE_data_transfer.h @@ -38,11 +38,11 @@ extern "C" { #include "BKE_customdata.h" +struct Depsgraph; struct Object; struct Scene; struct SpaceTransform; struct ReportList; -struct EvaluationContext; /* Warning, those def are stored in files (TransferData modifier), *DO NOT* modify those values. */ enum { @@ -130,12 +130,12 @@ enum { }; void BKE_object_data_transfer_layout( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX]); bool BKE_object_data_transfer_mesh( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, struct SpaceTransform *space_transform, const bool auto_transform, @@ -144,7 +144,7 @@ bool BKE_object_data_transfer_mesh( const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup, struct ReportList *reports); bool BKE_object_data_transfer_dm( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct DerivedMesh *dm_dst, const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index c2229976dd9..09e9b667369 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -60,8 +60,8 @@ enum { struct Scene; struct Object; struct ListBase; +struct Depsgraph; struct DerivedMesh; -struct EvaluationContext; /* used for curves, nurbs, mball, importing */ typedef struct DispList { @@ -87,28 +87,28 @@ void BKE_displist_free(struct ListBase *lb); bool BKE_displist_has_faces(struct ListBase *lb); void BKE_displist_make_surf( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **r_dm_final, const bool for_render, const bool for_orco, const bool use_render_resolution); void BKE_displist_make_curveTypes( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, const bool for_orco); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const bool for_orco); void BKE_displist_make_curveTypes_forRender( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase, struct DerivedMesh **r_dm_final, const bool for_orco, const bool use_render_resolution); void BKE_displist_make_curveTypes_forOrco( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); void BKE_displist_make_mball( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_displist_make_mball_forRender( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4); void BKE_displist_fill(struct ListBase *dispbase, struct ListBase *to, const float normal_proj[3], const bool flipnormal); -float BKE_displist_calc_taper(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *taperobj, int cur, int tot); +float BKE_displist_calc_taper(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *taperobj, int cur, int tot); /* add Orco layer to the displist object which has got derived mesh and return orco */ float *BKE_displist_make_orco( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm_final, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm_final, const bool for_render, const bool use_render_resolution); void BKE_displist_minmax(struct ListBase *dispbase, float min[3], float max[3]); diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 21c900a7f0d..8f795bc7535 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -27,9 +27,9 @@ * \ingroup bke */ +struct Depsgraph; struct Scene; struct ViewLayer; -struct EvaluationContext; /* Actual surface point */ typedef struct PaintSurfaceData { @@ -62,7 +62,7 @@ typedef struct PaintWavePoint { short state; } PaintWavePoint; -struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pmd, const struct EvaluationContext *eval_ctx, struct Scene *scene, +struct DerivedMesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pmd, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm); void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd); void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tsmd); @@ -86,7 +86,7 @@ struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings /* image sequence baking */ int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface, float *progress, short *do_update); -int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *cObject, int frame); +int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *cObject, int frame); void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char *filename, short output_layer); /* PaintPoint state */ diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index af1aeff230f..5e456fea64f 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -40,7 +40,7 @@ struct Mesh; struct Scene; struct DerivedMesh; struct MeshStatVis; -struct EvaluationContext; +struct Depsgraph; /** * This structure is used for mesh edit-mode. @@ -100,6 +100,6 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, struct DerivedMesh *dm, const struct MeshStatVis *statvis); float (*BKE_editmesh_vertexCos_get( - const struct EvaluationContext *eval_ctx, struct BMEditMesh *em, struct Scene *scene, int *r_numVerts))[3]; + struct Depsgraph *depsgraph, struct BMEditMesh *em, struct Scene *scene, int *r_numVerts))[3]; #endif /* __BKE_EDITMESH_H__ */ diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 6fa19d4aaf6..914dd650493 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -44,7 +44,7 @@ struct Group; struct ParticleSimulationData; struct ParticleData; struct ParticleKey; -struct EvaluationContext; +struct Depsgraph; struct EffectorWeights *BKE_add_effector_weights(struct Group *group); struct PartDeflect *object_add_collision_fields(int type); @@ -94,7 +94,7 @@ typedef struct EffectorData { typedef struct EffectorCache { struct EffectorCache *next, *prev; - const struct EvaluationContext *eval_ctx; + struct Depsgraph *depsgraph; struct Scene *scene; struct Object *ob; struct ParticleSystem *psys; @@ -113,10 +113,10 @@ typedef struct EffectorCache { void free_partdeflect(struct PartDeflect *pd); struct ListBase *pdInitEffectors( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, struct EffectorWeights *weights, bool for_simulation); void pdEndEffectors(struct ListBase **effectors); -void pdPrecalculateEffectors(const struct EvaluationContext *eval_ctx, struct ListBase *effectors); +void pdPrecalculateEffectors(struct Depsgraph *depsgraph, struct ListBase *effectors); void pdDoEffectors(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *impulse); void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point); diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h index 4ec58b2a0e5..8e04fe2c23a 100644 --- a/source/blender/blenkernel/BKE_fluidsim.h +++ b/source/blender/blenkernel/BKE_fluidsim.h @@ -36,11 +36,11 @@ struct Object; struct Scene; struct FluidsimSettings; struct MVert; -struct EvaluationContext; +struct Depsgraph; /* old interface */ -void initElbeemMesh(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +void initElbeemMesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords, int modifierIndex); diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h index a842bec7609..0195d1f1243 100644 --- a/source/blender/blenkernel/BKE_group.h +++ b/source/blender/blenkernel/BKE_group.h @@ -34,7 +34,7 @@ */ struct Base; -struct EvaluationContext; +struct Depsgraph; struct Group; struct Main; struct Object; @@ -53,11 +53,11 @@ bool BKE_group_object_exists(struct Group *group, struct Object *ob); bool BKE_group_object_cyclic_check(struct Main *bmain, struct Object *object, struct Group *group); bool BKE_group_is_animated(struct Group *group, struct Object *parent); -void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *parent, struct Group *group); +void BKE_group_handle_recalc_and_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *parent, struct Group *group); /* Dependency graph evaluation. */ -void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx, +void BKE_group_eval_view_layers(struct Depsgraph *depsgraph, struct Group *group); /* Helper macros. */ diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 1cdf193f054..1e3921747a5 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -43,7 +43,7 @@ struct Scene; struct DerivedMesh; struct BPoint; struct MDeformVert; -struct EvaluationContext; +struct Depsgraph; void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb); void BKE_lattice_init(struct Lattice *lt); @@ -79,7 +79,7 @@ void armature_deform_verts(struct Object *armOb, struct Object *target, float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3]; void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]); -void BKE_lattice_modifiers_calc(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice); struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt); @@ -101,9 +101,9 @@ void BKE_lattice_bitmap_from_flag(struct Lattice *lt, unsigned int *bitmap, cons /* **** Depsgraph evaluation **** */ -struct EvaluationContext; +struct Depsgraph; -void BKE_lattice_eval_geometry(const struct EvaluationContext *eval_ctx, +void BKE_lattice_eval_geometry(struct Depsgraph *depsgraph, struct Lattice *latt); /* Draw Cache */ diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 75fb4962bef..8d141a2548b 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -42,7 +42,7 @@ extern "C" { #define ROOT_PROP "root" struct Base; -struct EvaluationContext; +struct Depsgraph; struct Group; struct ID; struct IDProperty; @@ -169,11 +169,11 @@ void BKE_collection_engine_property_value_set_bool(struct IDProperty *props, con /* evaluation */ -void BKE_layer_eval_view_layer(const struct EvaluationContext *eval_ctx, +void BKE_layer_eval_view_layer(struct Depsgraph *depsgraph, struct ID *owner_id, struct ViewLayer *view_layer); -void BKE_layer_eval_view_layer_indexed(const struct EvaluationContext *eval_ctx, +void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph, struct ID *owner_id, int view_layer_index); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index aac43768acf..647af88d980 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -48,7 +48,7 @@ extern "C" { #endif -struct EvaluationContext; +struct Depsgraph; struct Library; struct MainLock; struct GHash; @@ -130,9 +130,6 @@ typedef struct Main { char id_tag_update[MAX_LIBARRAY]; - /* Evaluation context used by viewport */ - struct EvaluationContext *eval_ctx; - /* Must be generated, used and freed by same code - never assume this is valid data unless you know * when, who and how it was created. * Used by code doing a lot of remapping etc. at once to speed things up. */ diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 8b9fea071b0..976ee5b2691 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -32,7 +32,7 @@ * \ingroup bke */ -struct EvaluationContext; +struct Depsgraph; struct ImageUser; struct Image; struct ListBase; @@ -236,8 +236,8 @@ float *BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, struct Mas void BKE_mask_layer_evaluate_animation(struct MaskLayer *masklay, const float ctime); void BKE_mask_layer_evaluate_deform(struct MaskLayer *masklay, const float ctime); -void BKE_mask_eval_animation(struct EvaluationContext *eval_ctx, struct Mask *mask); -void BKE_mask_eval_update(struct EvaluationContext *eval_ctx, struct Mask *mask); +void BKE_mask_eval_animation(struct Depsgraph *depsgraph, struct Mask *mask); +void BKE_mask_eval_update(struct Depsgraph *depsgraph, struct Mask *mask); /* mask_rasterize.c */ struct MaskRasterHandle; diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index f4c98fc0aea..d57d0ea1a97 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -118,9 +118,9 @@ void paste_matcopybuf(struct Material *ma); /* Evaluation. */ -struct EvaluationContext; +struct Depsgraph; -void BKE_material_eval(const struct EvaluationContext *eval_ctx, struct Material *material); +void BKE_material_eval(struct Depsgraph *depsgraph, struct Material *material); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index d4776d890d2..b05a35e614f 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -32,6 +32,7 @@ * \since March 2001 * \author nzc */ +struct Depsgraph; struct Main; struct MetaBall; struct Object; @@ -71,9 +72,9 @@ void BKE_mball_select_swap(struct MetaBall *mb); /* **** Depsgraph evaluation **** */ -struct EvaluationContext; +struct Depsgraph; -void BKE_mball_eval_geometry(const struct EvaluationContext *eval_ctx, +void BKE_mball_eval_geometry(struct Depsgraph *depsgraph, struct MetaBall *mball); /* Draw Cache */ diff --git a/source/blender/blenkernel/BKE_mball_tessellate.h b/source/blender/blenkernel/BKE_mball_tessellate.h index 40cdc80e280..df652df177d 100644 --- a/source/blender/blenkernel/BKE_mball_tessellate.h +++ b/source/blender/blenkernel/BKE_mball_tessellate.h @@ -23,12 +23,12 @@ /** \file BKE_mball_tessellate.h * \ingroup bke */ -struct EvaluationContext; +struct Depsgraph; struct Object; struct Scene; void BKE_mball_polygonize( - const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *dispbase); void BKE_mball_cubeTable_free(void); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 79d72206903..e2265ae855e 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -34,8 +34,8 @@ struct ID; struct BMeshCreateParams; struct BoundBox; +struct Depsgraph; struct EdgeHash; -struct EvaluationContext; struct ListBase; struct LinkNode; struct BLI_Stack; @@ -119,7 +119,7 @@ void BKE_mesh_from_nurbs_displist( struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv, const char *obdata_name); void BKE_mesh_from_nurbs(struct Object *ob); void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test); -void BKE_mesh_to_curve(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_mesh_to_curve(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_mesh_material_index_remove(struct Mesh *me, short index); void BKE_mesh_material_index_clear(struct Mesh *me); void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len); @@ -140,7 +140,7 @@ float (*BKE_mesh_vertexCos_get(const struct Mesh *me, int *r_numVerts))[3]; void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals); -struct Mesh *BKE_mesh_new_from_object(const struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *sce, struct Object *ob, +struct Mesh *BKE_mesh_new_from_object(struct Depsgraph *depsgraph, struct Main *bmain, struct Scene *sce, struct Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed); /* vertex level transformations & checks (no derived mesh) */ @@ -442,7 +442,7 @@ void BKE_mesh_calc_edges(struct Mesh *mesh, bool update, const bool select); /* **** Depsgraph evaluation **** */ -void BKE_mesh_eval_geometry(const struct EvaluationContext *eval_ctx, +void BKE_mesh_eval_geometry(struct Depsgraph *depsgraph, struct Mesh *mesh); /* Draw Cache */ diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 329defbc77c..c81c0f7c4c0 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -33,8 +33,8 @@ #include "BKE_customdata.h" struct ID; +struct Depsgraph; struct DerivedMesh; -struct EvaluationContext; struct Object; struct Scene; struct ViewLayer; @@ -163,25 +163,25 @@ typedef struct ModifierTypeInfo { * the object it can obtain it from the derivedData argument if non-NULL, * and otherwise the ob argument. */ - void (*deformVerts)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, + void (*deformVerts)(struct ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag); /* Like deformMatricesEM but called from object mode (for supporting modifiers in sculpt mode) */ - void (*deformMatrices)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, + void (*deformMatrices)(struct ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts); /* Like deformVerts but called during editmode (for supporting modifiers) */ - void (*deformVertsEM)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, + void (*deformVertsEM)(struct ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts); /* Set deform matrix per vertex for crazyspace correction */ - void (*deformMatricesEM)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, + void (*deformMatricesEM)(struct ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts); @@ -207,7 +207,7 @@ typedef struct ModifierTypeInfo { * The modifier may reuse the derivedData argument (i.e. return it in * modified form), but must not release it. */ - struct DerivedMesh *(*applyModifier)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, + struct DerivedMesh *(*applyModifier)(struct ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct DerivedMesh *derivedData, ModifierApplyFlag flag); @@ -218,7 +218,7 @@ typedef struct ModifierTypeInfo { * are expected from editmode objects. The same qualifications regarding * derivedData apply as for applyModifier. */ - struct DerivedMesh *(*applyModifierEM)(struct ModifierData *md, const struct EvaluationContext *eval_ctx, + struct DerivedMesh *(*applyModifierEM)(struct ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct BMEditMesh *editData, struct DerivedMesh *derivedData, ModifierApplyFlag flag); @@ -422,24 +422,24 @@ const char *modifier_path_relbase(struct Object *ob); /* wrappers for modifier callbacks */ struct DerivedMesh *modwrap_applyModifier( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct DerivedMesh *dm, ModifierApplyFlag flag); struct DerivedMesh *modwrap_applyModifierEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, ModifierApplyFlag flag); void modwrap_deformVerts( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag); void modwrap_deformVertsEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, struct Object *ob, + ModifierData *md, struct Depsgraph *depsgraph, struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts); diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index 818f79ad8ac..5b5ebbf035c 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -32,7 +32,7 @@ * \author Sergey Sharybin */ -struct EvaluationContext; +struct Depsgraph; struct ImBuf; struct Main; struct MovieClip; @@ -85,7 +85,7 @@ bool BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser bool BKE_movieclip_put_frame_if_possible(struct MovieClip *clip, struct MovieClipUser *user, struct ImBuf *ibuf); /* Evaluaiton. */ -void BKE_movieclip_eval_update(struct EvaluationContext *eval_ctx, struct MovieClip *clip); +void BKE_movieclip_eval_update(struct Depsgraph *depsgraph, struct MovieClip *clip); /* cacheing flags */ #define MOVIECLIP_CACHE_SKIP (1 << 0) diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 761bb7e8acb..10bc367e909 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -33,8 +33,8 @@ */ enum MultiresModifiedFlags; +struct Depsgraph; struct DerivedMesh; -struct EvaluationContext; struct MDisps; struct Mesh; struct ModifierData; @@ -81,18 +81,18 @@ struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm, struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene, struct ModifierData *lastmd); struct MultiresModifierData *get_multires_modifier(struct Scene *scene, struct Object *ob, bool use_first); -struct DerivedMesh *get_multires_dm(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +struct DerivedMesh *get_multires_dm(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *ob); void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction); void multiresModifier_base_apply(struct MultiresModifierData *mmd, struct Object *ob); void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob, int updateblock, int simple); void multiresModifier_sync_levels_ex( struct Object *ob_dst, struct MultiresModifierData *mmd_src, struct MultiresModifierData *mmd_dst); -int multiresModifier_reshape(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +int multiresModifier_reshape(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *dst, struct Object *src); -int multiresModifier_reshapeFromDM(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +int multiresModifier_reshapeFromDM(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *ob, struct DerivedMesh *srcdm); -int multiresModifier_reshapeFromDeformMod(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct MultiresModifierData *mmd, +int multiresModifier_reshapeFromDeformMod(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd, struct Object *ob, struct ModifierData *md); void multires_stitch_grids(struct Object *); @@ -110,8 +110,8 @@ void multires_free(struct Multires *mr); void multires_load_old(struct Object *ob, struct Mesh *me); void multires_load_old_250(struct Mesh *); -void multiresModifier_scale_disp(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); -void multiresModifier_prepare_join(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *to_ob); +void multiresModifier_scale_disp(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); +void multiresModifier_prepare_join(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *to_ob); int multires_mdisp_corners(struct MDisps *s); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 6427a87a182..aa09e2fd5c3 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1060,12 +1060,12 @@ void free_nodesystem(void); /* -------------------------------------------------------------------- */ /* evaluation support, */ -struct EvaluationContext; +struct Depsgraph; void BKE_nodetree_copy_default_values(struct bNodeTree *ntree_dst, const struct bNodeTree *ntree_src); -void BKE_nodetree_shading_params_eval(const struct EvaluationContext *eval_ctx, +void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph, struct bNodeTree *ntree_dst, const struct bNodeTree *ntree_src); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index c75bbf849a8..d2d90801ade 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -36,7 +36,7 @@ extern "C" { #include "BLI_compiler_attrs.h" struct Base; -struct EvaluationContext; +struct Depsgraph; struct Scene; struct ViewLayer; struct Object; @@ -53,7 +53,7 @@ struct ModifierData; #include "DNA_object_enums.h" void BKE_object_workob_clear(struct Object *workob); -void BKE_object_workob_calc_parent(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *workob); +void BKE_object_workob_calc_parent(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *workob); void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src); struct SoftBody *copy_softbody(const struct SoftBody *sb, const int flag); @@ -146,14 +146,14 @@ void BKE_object_get_parent_matrix( struct Scene *scene, struct Object *ob, struct Object *par, float parentmat[4][4]); void BKE_object_where_is_calc( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_where_is_calc_ex( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct RigidBodyWorld *rbw, + struct Depsgraph *depsgraph, struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float r_originmat[3][3]); void BKE_object_where_is_calc_time( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime); void BKE_object_where_is_calc_time_ex( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime, struct RigidBodyWorld *rbw, float r_originmat[3][3]); void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]); @@ -171,13 +171,15 @@ void BKE_object_empty_draw_type_set(struct Object *ob, const int value); void BKE_object_boundbox_flag(struct Object *ob, int flag, const bool set); void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); bool BKE_object_minmax_dupli( - struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, + float r_min[3], float r_max[3], const bool use_hidden); /* sometimes min-max isn't enough, we need to loop over each point */ void BKE_object_foreach_display_point( struct Object *ob, float obmat[4][4], void (*func_cb)(const float[3], void *), void *user_data); void BKE_scene_foreach_display_point( + struct Depsgraph *depsgraph, struct Scene *scene, struct ViewLayer *view_layer, void (*func_cb)(const float[3], void *), void *user_data); @@ -207,60 +209,60 @@ void BKE_object_tfm_protected_restore( /* Dependency graph evaluation callbacks. */ void BKE_object_eval_local_transform( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Object *ob); void BKE_object_eval_parent( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_eval_constraints( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); -void BKE_object_eval_done(const struct EvaluationContext *eval_ctx, struct Object *ob); +void BKE_object_eval_done(struct Depsgraph *depsgraph, struct Object *ob); bool BKE_object_eval_proxy_copy( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Object *object); void BKE_object_eval_uber_transform( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Object *ob); void BKE_object_eval_uber_data( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_eval_cloth( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object); void BKE_object_eval_transform_all( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object); void BKE_object_eval_update_shading( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Object *object); void BKE_object_data_select_update( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct ID *object_data); void BKE_object_eval_flush_base_flags( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Object *object, int base_index, const bool is_from_set); void BKE_object_handle_data_update( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_handle_update( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_object_handle_update_ex( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct RigidBodyWorld *rbw, const bool do_proxy_update); @@ -316,7 +318,7 @@ struct KDTree *BKE_object_as_kdtree(struct Object *ob, int *r_tot); bool BKE_object_modifier_use_time(struct Object *ob, struct ModifierData *md); bool BKE_object_modifier_update_subframe( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, bool update_mesh, int parent_recursion, float frame, int type); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 849f3f9d11b..717f4c4f6e8 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -58,7 +58,7 @@ struct StrokeCache; struct Tex; struct ImagePool; struct UnifiedPaintSettings; -struct EvaluationContext; +struct Depsgraph; enum eOverlayFlags; @@ -251,7 +251,7 @@ void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss); void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder); void BKE_sculptsession_bm_to_me_for_render(struct Object *object); void BKE_sculpt_update_mesh_elements( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Sculpt *sd, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Sculpt *sd, struct Object *ob, bool need_pmap, bool need_mask); struct MultiresModifierData *BKE_sculpt_multires_active(struct Scene *scene, struct Object *ob); int BKE_sculpt_mask_layers_ensure(struct Object *ob, diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 8cd76097401..05082ed1a70 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -63,7 +63,7 @@ struct RNG; struct BVHTreeRay; struct BVHTreeRayHit; struct EdgeHash; -struct EvaluationContext; +struct Depsgraph; struct ViewLayer; #define PARTICLE_COLLISION_MAX_COLLISIONS 10 @@ -80,7 +80,7 @@ struct ViewLayer; /* common stuff that many particle functions need */ typedef struct ParticleSimulationData { - const struct EvaluationContext *eval_ctx; + struct Depsgraph *depsgraph; struct Scene *scene; struct Object *ob; struct ParticleSystem *psys; @@ -341,9 +341,9 @@ void psys_reset(struct ParticleSystem *psys, int mode); void psys_find_parents(struct ParticleSimulationData *sim, const bool use_render_params); void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, const bool use_render_params); -void psys_cache_edit_paths(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, const bool use_render_params); +void psys_cache_edit_paths(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, const bool use_render_params); void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params); -int do_guides(const struct EvaluationContext *eval_ctx, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int pa_num, float time); +int do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int pa_num, float time); void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors); float psys_get_timestep(struct ParticleSimulationData *sim); float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime); @@ -376,7 +376,7 @@ void psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int end void psys_tasks_free(struct ParticleTask *tasks, int numtasks); void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]); -void psys_apply_hair_lattice(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys); +void psys_apply_hair_lattice(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys); /* particle_system.c */ struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt); @@ -391,7 +391,7 @@ void psys_check_boid_data(struct ParticleSystem *psys); void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra); -void particle_system_update(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); +void particle_system_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, const bool use_render_params); /* Callback format for performing operations on ID-pointers for particle systems */ typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cb_flag); @@ -454,9 +454,9 @@ float psys_get_current_display_percentage(struct ParticleSystem *psys, const boo /* **** Depsgraph evaluation **** */ -struct EvaluationContext; +struct Depsgraph; -void BKE_particle_system_eval_init(const struct EvaluationContext *eval_ctx, +void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index 6aa43665427..016a531db95 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -37,7 +37,7 @@ struct RigidBodyWorld; struct RigidBodyOb; -struct EvaluationContext; +struct Depsgraph; struct Scene; struct Object; @@ -100,19 +100,19 @@ void BKE_rigidbody_aftertrans_update(struct Object *ob, float loc[3], float rot[ void BKE_rigidbody_sync_transforms(struct RigidBodyWorld *rbw, struct Object *ob, float ctime); bool BKE_rigidbody_check_sim_running(struct RigidBodyWorld *rbw, float ctime); void BKE_rigidbody_cache_reset(struct RigidBodyWorld *rbw); -void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, struct Scene *scene, float ctime); -void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, struct Scene *scene, float ctime); +void BKE_rigidbody_rebuild_world(struct Depsgraph *depsgraph, struct Scene *scene, float ctime); +void BKE_rigidbody_do_simulation(struct Depsgraph *depsgraph, struct Scene *scene, float ctime); /* -------------------- */ /* Depsgraph evaluation */ -void BKE_rigidbody_rebuild_sim(const struct EvaluationContext *eval_ctx, +void BKE_rigidbody_rebuild_sim(struct Depsgraph *depsgraph, struct Scene *scene); -void BKE_rigidbody_eval_simulation(const struct EvaluationContext *eval_ctx, +void BKE_rigidbody_eval_simulation(struct Depsgraph *depsgraph, struct Scene *scene); -void BKE_rigidbody_object_sync_transforms(const struct EvaluationContext *eval_ctx, +void BKE_rigidbody_object_sync_transforms(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 4a97cb763dc..8c7c3fb15de 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -39,7 +39,6 @@ extern "C" { struct AviCodecData; struct Depsgraph; -struct EvaluationContext; struct Main; struct Object; struct RenderData; @@ -100,7 +99,7 @@ typedef struct SceneBaseIter { } SceneBaseIter; int BKE_scene_base_iter_next( - const struct EvaluationContext *eval_ctx, struct SceneBaseIter *iter, + struct Depsgraph *depsgraph, struct SceneBaseIter *iter, struct Scene **scene, int val, struct Base **base, struct Object **ob); void BKE_scene_base_flag_to_objects(struct ViewLayer *view_layer); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 21f3f344e64..1a0e61b0dd6 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -31,7 +31,7 @@ */ struct bContext; -struct EvaluationContext; +struct Depsgraph; struct StripColorBalance; struct Editing; struct GSet; @@ -93,12 +93,12 @@ void BKE_sequence_iterator_end(SeqIterator *iter); } typedef struct SeqRenderData { - struct EvaluationContext *eval_ctx; struct Main *bmain; struct Scene *scene; int rectx; int recty; int preview_render_size; + int for_render; int motion_blur_samples; float motion_blur_shutter; bool skip_cache; @@ -113,8 +113,9 @@ typedef struct SeqRenderData { } SeqRenderData; void BKE_sequencer_new_render_data( - struct EvaluationContext *eval_ctx, struct Main *bmain, struct Scene *scene, + struct Main *bmain, struct Scene *scene, int rectx, int recty, int preview_render_size, + int for_render, SeqRenderData *r_context); int BKE_sequencer_cmp_time_startdisp(const void *a, const void *b); @@ -435,7 +436,7 @@ enum { }; typedef struct ImBuf *(*SequencerDrawView)( - 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, diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h index 64d70e8e209..82bfe56b0ab 100644 --- a/source/blender/blenkernel/BKE_smoke.h +++ b/source/blender/blenkernel/BKE_smoke.h @@ -35,7 +35,7 @@ typedef float (*bresenham_callback)(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); -struct DerivedMesh *smokeModifier_do(struct SmokeModifierData *smd, const struct EvaluationContext *eval_ctx, +struct DerivedMesh *smokeModifier_do(struct SmokeModifierData *smd, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm); diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index e2255bdb779..c7bf876a414 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -31,10 +31,10 @@ * \ingroup bke */ +struct Depsgraph; struct Object; struct Scene; struct SoftBody; -struct EvaluationContext; typedef struct BodyPoint { float origS[3], origE[3], origT[3], pos[3], vec[3], force[3]; @@ -60,7 +60,7 @@ extern void sbFree(struct SoftBody *sb); extern void sbFreeSimulation(struct SoftBody *sb); /* do one simul step, reading and writing vertex locs from given array */ -extern void sbObjectStep(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +extern void sbObjectStep(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float framnr, float (*vertexCos)[3], int numVerts); /* makes totally fresh start situation, resets time */ diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 5da87de1cc9..13302caa09d 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -47,7 +47,6 @@ struct MovieDistortion; struct Camera; struct Object; struct Scene; -struct EvaluationContext; struct rcti; /* **** Common functions **** */ diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 32a9bcbec61..c4de9d134b7 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -28,7 +28,6 @@ #include "BLI_compiler_attrs.h" struct bScreen; -struct EvaluationContext; struct Main; struct Scene; struct TransformOrientation; diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index b45d7a7e6ec..fe8aa8694af 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -46,9 +46,9 @@ void BKE_world_make_local(struct Main *bmain, struct World *wrld, const bool lib /* Evaluation. */ -struct EvaluationContext; +struct Depsgraph; -void BKE_world_eval(const struct EvaluationContext *eval_ctx, struct World *world); +void BKE_world_eval(struct Depsgraph *depsgraph, struct World *world); #endif diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 916e11dbd46..132f247f0a1 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1148,7 +1148,7 @@ DerivedMesh *mesh_create_derived(Mesh *me, float (*vertCos)[3]) } DerivedMesh *mesh_create_derived_for_modifier( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, ModifierData *md, int build_shapekey_layers) { Mesh *me = ob->data; @@ -1174,7 +1174,7 @@ DerivedMesh *mesh_create_derived_for_modifier( int numVerts; float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts); - modwrap_deformVerts(md, eval_ctx, ob, NULL, deformedVerts, numVerts, 0); + modwrap_deformVerts(md, depsgraph, ob, NULL, deformedVerts, numVerts, 0); dm = mesh_create_derived(me, deformedVerts); if (build_shapekey_layers) @@ -1188,7 +1188,7 @@ DerivedMesh *mesh_create_derived_for_modifier( if (build_shapekey_layers) add_shapekey_layers(tdm, me, ob); - dm = modwrap_applyModifier(md, eval_ctx, ob, tdm, 0); + dm = modwrap_applyModifier(md, depsgraph, ob, tdm, 0); ASSERT_IS_VALID_DM(dm); if (tdm != dm) tdm->release(tdm); @@ -1753,7 +1753,7 @@ static void dm_ensure_display_normals(DerivedMesh *dm) * - apply deform modifiers and input vertexco */ static void mesh_calc_modifiers( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (*inputVertexCos)[3], + struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*inputVertexCos)[3], const bool useRenderParams, int useDeform, const bool need_mapping, CustomDataMask dataMask, const int index, const bool useCache, const bool build_shapekey_layers, @@ -1864,7 +1864,7 @@ static void mesh_calc_modifiers( if (!deformedVerts) deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts); - modwrap_deformVerts(md, eval_ctx, ob, NULL, deformedVerts, numVerts, deform_app_flags); + modwrap_deformVerts(md, depsgraph, ob, NULL, deformedVerts, numVerts, deform_app_flags); } else { break; @@ -2005,7 +2005,7 @@ static void mesh_calc_modifiers( } } - modwrap_deformVerts(md, eval_ctx, ob, dm, deformedVerts, numVerts, deform_app_flags); + modwrap_deformVerts(md, depsgraph, ob, dm, deformedVerts, numVerts, deform_app_flags); } else { DerivedMesh *ndm; @@ -2080,7 +2080,7 @@ static void mesh_calc_modifiers( } } - ndm = modwrap_applyModifier(md, eval_ctx, ob, dm, app_flags); + ndm = modwrap_applyModifier(md, depsgraph, ob, dm, app_flags); ASSERT_IS_VALID_DM(ndm); if (ndm) { @@ -2107,7 +2107,7 @@ static void mesh_calc_modifiers( (mti->requiredDataMask ? mti->requiredDataMask(ob, md) : 0)); - ndm = modwrap_applyModifier(md, eval_ctx, ob, orcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO); + ndm = modwrap_applyModifier(md, depsgraph, ob, orcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO); ASSERT_IS_VALID_DM(ndm); if (ndm) { @@ -2125,7 +2125,7 @@ static void mesh_calc_modifiers( nextmask &= ~CD_MASK_CLOTH_ORCO; DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX); - ndm = modwrap_applyModifier(md, eval_ctx, ob, clothorcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO); + ndm = modwrap_applyModifier(md, depsgraph, ob, clothorcodm, (app_flags & ~MOD_APPLY_USECACHE) | MOD_APPLY_ORCO); ASSERT_IS_VALID_DM(ndm); if (ndm) { @@ -2308,7 +2308,7 @@ bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh * } static void editbmesh_calc_modifiers( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, BMEditMesh *em, CustomDataMask dataMask, /* return args */ DerivedMesh **r_cage, DerivedMesh **r_final) @@ -2396,9 +2396,9 @@ static void editbmesh_calc_modifiers( } if (mti->deformVertsEM) - modwrap_deformVertsEM(md, eval_ctx, ob, em, dm, deformedVerts, numVerts); + modwrap_deformVertsEM(md, depsgraph, ob, em, dm, deformedVerts, numVerts); else - modwrap_deformVerts(md, eval_ctx, ob, dm, deformedVerts, numVerts, 0); + modwrap_deformVerts(md, depsgraph, ob, dm, deformedVerts, numVerts, 0); } else { DerivedMesh *ndm; @@ -2443,10 +2443,10 @@ static void editbmesh_calc_modifiers( DM_set_only_copy(orcodm, mask | CD_MASK_ORIGINDEX); if (mti->applyModifierEM) { - ndm = modwrap_applyModifierEM(md, eval_ctx, ob, em, orcodm, MOD_APPLY_ORCO); + ndm = modwrap_applyModifierEM(md, depsgraph, ob, em, orcodm, MOD_APPLY_ORCO); } else { - ndm = modwrap_applyModifier(md, eval_ctx, ob, orcodm, MOD_APPLY_ORCO); + ndm = modwrap_applyModifier(md, depsgraph, ob, orcodm, MOD_APPLY_ORCO); } ASSERT_IS_VALID_DM(ndm); @@ -2471,9 +2471,9 @@ static void editbmesh_calc_modifiers( } if (mti->applyModifierEM) - ndm = modwrap_applyModifierEM(md, eval_ctx, ob, em, dm, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU); + ndm = modwrap_applyModifierEM(md, depsgraph, ob, em, dm, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU); else - ndm = modwrap_applyModifier(md, eval_ctx, ob, dm, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU); + ndm = modwrap_applyModifier(md, depsgraph, ob, dm, MOD_APPLY_USECACHE | MOD_APPLY_ALLOW_GPU); ASSERT_IS_VALID_DM(ndm); if (ndm) { @@ -2609,7 +2609,7 @@ static void editbmesh_calc_modifiers( * we'll be using GPU backend of OpenSubdiv. This is so * playback performance is kept as high as possible. */ -static bool calc_modifiers_skip_orco(const EvaluationContext *eval_ctx, +static bool calc_modifiers_skip_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, bool use_render_params) @@ -2626,7 +2626,7 @@ static bool calc_modifiers_skip_orco(const EvaluationContext *eval_ctx, else if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) { return false; } - else if ((DEG_get_eval_flags_for_id(eval_ctx->depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) != 0) { + else if ((DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) != 0) { return false; } SubsurfModifierData *smd = (SubsurfModifierData *)last_md; @@ -2638,7 +2638,7 @@ static bool calc_modifiers_skip_orco(const EvaluationContext *eval_ctx, #endif static void mesh_build_data( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask, const bool build_shapekey_layers, const bool need_mapping) { BLI_assert(ob->type == OB_MESH); @@ -2647,13 +2647,13 @@ static void mesh_build_data( BKE_object_sculpt_modifiers_changed(ob); #ifdef WITH_OPENSUBDIV - if (calc_modifiers_skip_orco(eval_ctx, scene, ob, false)) { + if (calc_modifiers_skip_orco(depsgraph, scene, ob, false)) { dataMask &= ~(CD_MASK_ORCO | CD_MASK_PREVIEW_MCOL); } #endif mesh_calc_modifiers( - eval_ctx, scene, ob, NULL, false, 1, need_mapping, dataMask, -1, true, build_shapekey_layers, + depsgraph, scene, ob, NULL, false, 1, need_mapping, dataMask, -1, true, build_shapekey_layers, true, &ob->derivedDeform, &ob->derivedFinal); @@ -2668,14 +2668,14 @@ static void mesh_build_data( /* create PBVH immediately (would be created on the fly too, * but this avoids waiting on first stroke) */ - BKE_sculpt_update_mesh_elements(eval_ctx, scene, scene->toolsettings->sculpt, ob, false, false); + BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, false, false); } BLI_assert(!(ob->derivedFinal->dirty & DM_DIRTY_NORMALS)); } static void editbmesh_build_data( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask) { BKE_object_free_derived_caches(obedit); @@ -2684,13 +2684,13 @@ static void editbmesh_build_data( BKE_editmesh_free_derivedmesh(em); #ifdef WITH_OPENSUBDIV - if (calc_modifiers_skip_orco(eval_ctx, scene, obedit, false)) { + if (calc_modifiers_skip_orco(depsgraph, scene, obedit, false)) { dataMask &= ~(CD_MASK_ORCO | CD_MASK_PREVIEW_MCOL); } #endif editbmesh_calc_modifiers( - eval_ctx, scene, obedit, em, dataMask, + depsgraph, scene, obedit, em, dataMask, &em->derivedCage, &em->derivedFinal); DM_set_object_boundbox(obedit, em->derivedFinal); @@ -2702,10 +2702,9 @@ static void editbmesh_build_data( BLI_assert(!(em->derivedFinal->dirty & DM_DIRTY_NORMALS)); } -static CustomDataMask object_get_datamask(const Scene *scene, Object *ob, bool *r_need_mapping) +static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob, bool *r_need_mapping) { - /* TODO(sergey): Avoid this linear list lookup. */ - ViewLayer *view_layer = BKE_view_layer_context_active_PLACEHOLDER(scene); + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); Object *actob = view_layer->basact ? view_layer->basact->object : NULL; CustomDataMask mask = ob->customdata_mask; @@ -2743,85 +2742,85 @@ static CustomDataMask object_get_datamask(const Scene *scene, Object *ob, bool * } void makeDerivedMesh( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, BMEditMesh *em, CustomDataMask dataMask, const bool build_shapekey_layers) { bool need_mapping; - dataMask |= object_get_datamask(scene, ob, &need_mapping); + dataMask |= object_get_datamask(depsgraph, ob, &need_mapping); if (em) { - editbmesh_build_data(eval_ctx, scene, ob, em, dataMask); + editbmesh_build_data(depsgraph, scene, ob, em, dataMask); } else { - mesh_build_data(eval_ctx, scene, ob, dataMask, build_shapekey_layers, need_mapping); + mesh_build_data(depsgraph, scene, ob, dataMask, build_shapekey_layers, need_mapping); } } /***/ DerivedMesh *mesh_get_derived_final( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) + struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask) { /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh */ bool need_mapping; - dataMask |= object_get_datamask(scene, ob, &need_mapping); + dataMask |= object_get_datamask(depsgraph, ob, &need_mapping); if (!ob->derivedFinal || ((dataMask & ob->lastDataMask) != dataMask) || (need_mapping != ob->lastNeedMapping)) { - mesh_build_data(eval_ctx, scene, ob, dataMask, false, need_mapping); + mesh_build_data(depsgraph, scene, ob, dataMask, false, need_mapping); } if (ob->derivedFinal) { BLI_assert(!(ob->derivedFinal->dirty & DM_DIRTY_NORMALS)); } return ob->derivedFinal; } -DerivedMesh *mesh_get_derived_deform(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) +DerivedMesh *mesh_get_derived_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask) { /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh */ bool need_mapping; - dataMask |= object_get_datamask(scene, ob, &need_mapping); + dataMask |= object_get_datamask(depsgraph, ob, &need_mapping); if (!ob->derivedDeform || ((dataMask & ob->lastDataMask) != dataMask) || (need_mapping != ob->lastNeedMapping)) { - mesh_build_data(eval_ctx, scene, ob, dataMask, false, need_mapping); + mesh_build_data(depsgraph, scene, ob, dataMask, false, need_mapping); } return ob->derivedDeform; } -DerivedMesh *mesh_create_derived_render(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask) +DerivedMesh *mesh_create_derived_render(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask) { DerivedMesh *final; mesh_calc_modifiers( - eval_ctx, scene, ob, NULL, true, 1, false, dataMask, -1, false, false, false, + depsgraph, scene, ob, NULL, true, 1, false, dataMask, -1, false, false, false, NULL, &final); return final; } -DerivedMesh *mesh_create_derived_index_render(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, CustomDataMask dataMask, int index) +DerivedMesh *mesh_create_derived_index_render(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask, int index) { DerivedMesh *final; mesh_calc_modifiers( - eval_ctx, scene, ob, NULL, true, 1, false, dataMask, index, false, false, false, + depsgraph, scene, ob, NULL, true, 1, false, dataMask, index, false, false, false, NULL, &final); return final; } DerivedMesh *mesh_create_derived_view( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask) { DerivedMesh *final; @@ -2833,7 +2832,7 @@ DerivedMesh *mesh_create_derived_view( ob->transflag |= OB_NO_PSYS_UPDATE; mesh_calc_modifiers( - eval_ctx, scene, ob, NULL, false, 1, false, dataMask, -1, false, false, false, + depsgraph, scene, ob, NULL, false, 1, false, dataMask, -1, false, false, false, NULL, &final); ob->transflag &= ~OB_NO_PSYS_UPDATE; @@ -2842,53 +2841,53 @@ DerivedMesh *mesh_create_derived_view( } DerivedMesh *mesh_create_derived_no_deform( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; mesh_calc_modifiers( - eval_ctx, scene, ob, vertCos, false, 0, false, dataMask, -1, false, false, false, + depsgraph, scene, ob, vertCos, false, 0, false, dataMask, -1, false, false, false, NULL, &final); return final; } DerivedMesh *mesh_create_derived_no_virtual( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; mesh_calc_modifiers( - eval_ctx, scene, ob, vertCos, false, -1, false, dataMask, -1, false, false, false, + depsgraph, scene, ob, vertCos, false, -1, false, dataMask, -1, false, false, false, NULL, &final); return final; } DerivedMesh *mesh_create_derived_physics( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; mesh_calc_modifiers( - eval_ctx, scene, ob, vertCos, false, -1, true, dataMask, -1, false, false, false, + depsgraph, scene, ob, vertCos, false, -1, true, dataMask, -1, false, false, false, NULL, &final); return final; } DerivedMesh *mesh_create_derived_no_deform_render( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; mesh_calc_modifiers( - eval_ctx, scene, ob, vertCos, true, 0, false, dataMask, -1, false, false, false, + depsgraph, scene, ob, vertCos, true, 0, false, dataMask, -1, false, false, false, NULL, &final); return final; @@ -2897,7 +2896,7 @@ DerivedMesh *mesh_create_derived_no_deform_render( /***/ DerivedMesh *editbmesh_get_derived_cage_and_final( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, + struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask, /* return args */ DerivedMesh **r_final) @@ -2905,12 +2904,12 @@ DerivedMesh *editbmesh_get_derived_cage_and_final( /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh */ - dataMask |= object_get_datamask(scene, obedit, NULL); + dataMask |= object_get_datamask(depsgraph, obedit, NULL); if (!em->derivedCage || (em->lastDataMask & dataMask) != dataMask) { - editbmesh_build_data(eval_ctx, scene, obedit, em, dataMask); + editbmesh_build_data(depsgraph, scene, obedit, em, dataMask); } *r_final = em->derivedFinal; @@ -2919,18 +2918,18 @@ DerivedMesh *editbmesh_get_derived_cage_and_final( } DerivedMesh *editbmesh_get_derived_cage( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit, BMEditMesh *em, + struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask) { /* if there's no derived mesh or the last data mask used doesn't include * the data we need, rebuild the derived mesh */ - dataMask |= object_get_datamask(scene, obedit, NULL); + dataMask |= object_get_datamask(depsgraph, obedit, NULL); if (!em->derivedCage || (em->lastDataMask & dataMask) != dataMask) { - editbmesh_build_data(eval_ctx, scene, obedit, em, dataMask); + editbmesh_build_data(depsgraph, scene, obedit, em, dataMask); } return em->derivedCage; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 0b964145c7f..1541d39938d 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -340,7 +340,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) * - recalc: whether we need to */ /* TODO: include reports pointer? */ - void animviz_calc_motionpaths(EvaluationContext *eval_ctx, Main *bmain, Scene *scene, ListBase *targets) + void animviz_calc_motionpaths(Depsgraph *depsgraph, Main *bmain, Scene *scene, ListBase *targets) { MPathTarget *mpt; int sfra, efra; @@ -367,7 +367,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) /* calculate path over requested range */ for (CFRA = sfra; CFRA <= efra; CFRA++) { /* update relevant data for new frame */ - motionpaths_calc_update_scene(bmain, eval_ctx->depsgraph); + motionpaths_calc_update_scene(bmain, depsgraph); /* perform baking for targets */ motionpaths_calc_bake_targets(scene, targets); @@ -375,7 +375,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) /* reset original environment */ CFRA = cfra; - motionpaths_calc_update_scene(bmain, eval_ctx->depsgraph); + motionpaths_calc_update_scene(bmain, depsgraph); /* clear recalc flags from targets */ for (mpt = targets->first; mpt; mpt = mpt->next) { diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index ecdb180d2ed..aa8fd6f3870 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -70,6 +70,7 @@ #include "BKE_texture.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "RNA_access.h" @@ -77,8 +78,6 @@ #include "atomic_ops.h" -#include "DEG_depsgraph.h" - /* ***************************************** */ /* AnimData API */ @@ -2881,14 +2880,15 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) /* ************** */ /* Evaluation API */ -void BKE_animsys_eval_animdata(const EvaluationContext *eval_ctx, ID *id) +void BKE_animsys_eval_animdata(Depsgraph *depsgraph, ID *id) { + float ctime = DEG_get_ctime(depsgraph); AnimData *adt = BKE_animdata_from_id(id); Scene *scene = NULL; /* XXX: this is only needed for flushing RNA updates, * which should get handled as part of the dependency graph instead... */ - DEG_debug_print_eval_time(__func__, id->name, id, eval_ctx->ctime); - BKE_animsys_evaluate_animdata(scene, id, adt, eval_ctx->ctime, ADT_RECALC_ANIM); + DEG_debug_print_eval_time(__func__, id->name, id, ctime); + BKE_animsys_evaluate_animdata(scene, id, adt, ctime, ADT_RECALC_ANIM); } /* TODO(sergey): This is slow lookup of driver from CoW datablock. @@ -2909,7 +2909,7 @@ static FCurve *find_driver_from_evaluated_id(ID *id, FCurve *fcu) return BLI_findlink(&adt_cow->drivers, fcu_index); } -void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, +void BKE_animsys_eval_driver(Depsgraph *depsgraph, ID *id, FCurve *fcu) { @@ -2937,7 +2937,8 @@ void BKE_animsys_eval_driver(const EvaluationContext *eval_ctx, PathResolvedRNA anim_rna; if (animsys_store_rna_setting(&id_ptr, NULL, fcu->rna_path, fcu->array_index, &anim_rna)) { - const float curval = calculate_fcurve(&anim_rna, fcu, eval_ctx->ctime); + const float ctime = DEG_get_ctime(depsgraph); + const float curval = calculate_fcurve(&anim_rna, fcu, ctime); ok = animsys_write_rna_setting(&anim_rna, curval); } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 0a8c97ff175..6daaa10f227 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1462,13 +1462,13 @@ void BKE_armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], fl copy_v3_v3(outloc, nLocMat[3]); } -void BKE_armature_mat_pose_to_bone_ex(const struct EvaluationContext *eval_ctx, Object *ob, bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]) +void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, Object *ob, bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]) { bPoseChannel work_pchan = *pchan; /* recalculate pose matrix with only parent transformations, * bone loc/sca/rot is ignored, scene and frame are not used. */ - BKE_pose_where_is_bone(eval_ctx, NULL, ob, &work_pchan, 0.0f, false); + BKE_pose_where_is_bone(depsgraph, NULL, ob, &work_pchan, 0.0f, false); /* find the matrix, need to remove the bone transforms first so this is * calculated as a matrix to set rather then a difference ontop of whats @@ -2196,7 +2196,7 @@ void BKE_pose_where_is_bone_tail(bPoseChannel *pchan) * 'do_extra': when zero skips loc/size/rot, constraints and strip modifiers. */ void BKE_pose_where_is_bone( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, bool do_extra) { /* This gives a chan_mat with actions (ipos) results. */ @@ -2236,7 +2236,7 @@ void BKE_pose_where_is_bone( cob = BKE_constraints_make_evalob(scene, ob, pchan, CONSTRAINT_OBTYPE_BONE); /* Solve PoseChannel's Constraints */ - BKE_constraints_solve(eval_ctx, &pchan->constraints, cob, ctime); /* ctime doesnt alter objects */ + BKE_constraints_solve(depsgraph, &pchan->constraints, cob, ctime); /* ctime doesnt alter objects */ /* cleanup after Constraint Solving * - applies matrix back to pchan, and frees temporary struct used @@ -2258,7 +2258,7 @@ void BKE_pose_where_is_bone( /* This only reads anim data from channels, and writes to channels */ /* This is the only function adding poses */ -void BKE_pose_where_is(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_pose_where_is(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { bArmature *arm; Bone *bone; @@ -2297,7 +2297,7 @@ void BKE_pose_where_is(const struct EvaluationContext *eval_ctx, Scene *scene, O } /* 2a. construct the IK tree (standard IK) */ - BIK_initialize_tree(eval_ctx, scene, ob, ctime); + BIK_initialize_tree(depsgraph, scene, ob, ctime); /* 2b. construct the Spline IK trees * - this is not integrated as an IK plugin, since it should be able @@ -2309,15 +2309,15 @@ void BKE_pose_where_is(const struct EvaluationContext *eval_ctx, Scene *scene, O for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { /* 4a. if we find an IK root, we handle it separated */ if (pchan->flag & POSE_IKTREE) { - BIK_execute_tree(eval_ctx, scene, ob, pchan, ctime); + BIK_execute_tree(depsgraph, scene, ob, pchan, ctime); } /* 4b. if we find a Spline IK root, we handle it separated too */ else if (pchan->flag & POSE_IKSPLINE) { - BKE_splineik_execute_tree(eval_ctx, scene, ob, pchan, ctime); + BKE_splineik_execute_tree(depsgraph, scene, ob, pchan, ctime); } /* 5. otherwise just call the normal solver */ else if (!(pchan->flag & POSE_DONE)) { - BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob, pchan, ctime, 1); } } /* 6. release the IK tree */ diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 29baaff32ba..e626ed42062 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -116,7 +116,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos #if 0 /* only happens on reload file, but violates depsgraph still... fix! */ if (ELEM(NULL, ikData->tar->curve_cache, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) { - BKE_displist_make_curveTypes(eval_ctx, scene, ikData->tar, 0); + BKE_displist_make_curveTypes(depsgraph, scene, ikData->tar, 0); /* path building may fail in EditMode after removing verts [#33268]*/ if (ELEM(NULL, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) { @@ -266,7 +266,7 @@ static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime)) /* Evaluate spline IK for a given bone */ static void splineik_evaluate_bone( - const struct EvaluationContext *eval_ctx, tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan, + struct Depsgraph *depsgraph, tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan, int index, float ctime) { bSplineIKConstraint *ikData = tree->ikData; @@ -274,7 +274,7 @@ static void splineik_evaluate_bone( float splineVec[3], scaleFac, radius = 1.0f; /* firstly, calculate the bone matrix the standard way, since this is needed for roll control */ - BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob, pchan, ctime, 1); copy_v3_v3(poseHead, pchan->pose_head); copy_v3_v3(poseTail, pchan->pose_tail); @@ -516,7 +516,7 @@ static void splineik_evaluate_bone( } /* Evaluate the chain starting from the nominated bone */ -static void splineik_execute_tree(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +static void splineik_execute_tree(struct Depsgraph *depsgraph, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { tSplineIK_Tree *tree; @@ -530,7 +530,7 @@ static void splineik_execute_tree(const struct EvaluationContext *eval_ctx, Scen */ for (i = tree->chainlen - 1; i >= 0; i--) { bPoseChannel *pchan = tree->chain[i]; - splineik_evaluate_bone(eval_ctx, tree, scene, ob, pchan, i, ctime); + splineik_evaluate_bone(depsgraph, tree, scene, ob, pchan, i, ctime); } /* free the tree info specific to SplineIK trees now */ @@ -550,10 +550,10 @@ void BKE_pose_splineik_init_tree(Scene *scene, Object *ob, float ctime) } void BKE_splineik_execute_tree( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { - splineik_execute_tree(eval_ctx, scene, ob, pchan_root, ctime); + splineik_execute_tree(depsgraph, scene, ob, pchan_root, ctime); } /* *************** Depsgraph evaluation callbacks ************ */ @@ -567,7 +567,7 @@ BLI_INLINE bPoseChannel *pose_pchan_get_indexed(Object *ob, int pchan_index) return pose->chan_array[pchan_index]; } -void BKE_pose_eval_init(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_pose_eval_init(struct Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *ob) { @@ -597,7 +597,7 @@ void BKE_pose_eval_init(const struct EvaluationContext *UNUSED(eval_ctx), } } -void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_init_ik(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { @@ -609,7 +609,7 @@ void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx, return; } /* construct the IK tree (standard IK) */ - BIK_initialize_tree(eval_ctx, scene, ob, ctime); + BIK_initialize_tree(depsgraph, scene, ob, ctime); /* construct the Spline IK trees * - this is not integrated as an IK plugin, since it should be able * to function in conjunction with standard IK @@ -617,7 +617,7 @@ void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx, BKE_pose_splineik_init_tree(scene, ob, ctime); } -void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx, +void BKE_pose_eval_bone(struct Depsgraph *depsgraph, Scene *scene, Object *ob, int pchan_index) @@ -647,14 +647,14 @@ void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx, if ((pchan->flag & POSE_DONE) == 0) { /* TODO(sergey): Use time source node for time. */ float ctime = BKE_scene_frame_get(scene); /* not accurate... */ - BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob, pchan, ctime, 1); } } } } } -void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx, +void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph, Scene *scene, Object *ob, int pchan_index) @@ -672,12 +672,12 @@ void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx, else { if ((pchan->flag & POSE_DONE) == 0) { float ctime = BKE_scene_frame_get(scene); /* not accurate... */ - BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob, pchan, ctime, 1); } } } -void BKE_pose_bone_done(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_pose_bone_done(struct Depsgraph *UNUSED(depsgraph), struct Object *ob, int pchan_index) { @@ -690,7 +690,7 @@ void BKE_pose_bone_done(const struct EvaluationContext *UNUSED(eval_ctx), } } -void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx, +void BKE_pose_iktree_evaluate(struct Depsgraph *depsgraph, Scene *scene, Object *ob, int rootchan_index) @@ -704,10 +704,10 @@ void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx, if (arm->flag & ARM_RESTPOS) { return; } - BIK_execute_tree(eval_ctx, scene, ob, rootchan, ctime); + BIK_execute_tree(depsgraph, scene, ob, rootchan, ctime); } -void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx, +void BKE_pose_splineik_evaluate(struct Depsgraph *depsgraph, Scene *scene, Object *ob, int rootchan_index) @@ -722,10 +722,10 @@ void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx, if (arm->flag & ARM_RESTPOS) { return; } - BKE_splineik_execute_tree(eval_ctx, scene, ob, rootchan, ctime); + BKE_splineik_execute_tree(depsgraph, scene, ob, rootchan, ctime); } -void BKE_pose_eval_flush(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_pose_eval_flush(struct Depsgraph *UNUSED(depsgraph), Scene *scene, Object *ob) { @@ -744,7 +744,7 @@ void BKE_pose_eval_flush(const struct EvaluationContext *UNUSED(eval_ctx), pose->chan_array = NULL; } -void BKE_pose_eval_proxy_copy(const struct EvaluationContext *UNUSED(eval_ctx), Object *ob) +void BKE_pose_eval_proxy_copy(struct Depsgraph *UNUSED(depsgraph), Object *ob) { BLI_assert(ID_IS_LINKED(ob) && ob->proxy_from != NULL); DEG_debug_print_eval(__func__, ob->id.name, ob); diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 4b92715ee7b..eb5cdd02fe5 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -132,7 +132,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, if (eff == NULL && gabr->ob) { memset(&temp_eff, 0, sizeof(EffectorCache)); temp_eff.ob = gabr->ob; - temp_eff.eval_ctx = bbd->sim->eval_ctx; + temp_eff.depsgraph = bbd->sim->depsgraph; temp_eff.scene = bbd->sim->scene; eff = &temp_eff; get_effector_data(eff, &efd, &epoint, 0); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 8c4bced1563..7676baa9dba 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -259,7 +259,7 @@ void BKE_camera_params_from_object(CameraParams *params, const Object *ob) } } -void BKE_camera_params_from_view3d(CameraParams *params, const Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d) +void BKE_camera_params_from_view3d(CameraParams *params, Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d) { /* common */ params->lens = v3d->lens; @@ -664,7 +664,7 @@ static bool camera_frame_fit_calc_from_data( /* don't move the camera, just yield the fit location */ /* r_scale only valid/useful for ortho cameras */ bool BKE_camera_view_frame_fit_to_scene( - Scene *scene, ViewLayer *view_layer, Object *camera_ob, float r_co[3], float *r_scale) + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, Object *camera_ob, float r_co[3], float *r_scale) { CameraParams params; CameraViewFrameData data_cb; @@ -675,7 +675,7 @@ bool BKE_camera_view_frame_fit_to_scene( camera_frame_fit_data_init(scene, camera_ob, ¶ms, &data_cb); /* run callback on all visible points */ - BKE_scene_foreach_display_point(scene, view_layer, camera_to_frame_view_cb, &data_cb); + BKE_scene_foreach_display_point(depsgraph, scene, view_layer, camera_to_frame_view_cb, &data_cb); return camera_frame_fit_calc_from_data(¶ms, &data_cb, r_co, r_scale); } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index e928dfaab37..976b8965fa2 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -347,7 +347,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul return 1; } -static int do_step_cloth(const struct EvaluationContext *eval_ctx, Object *ob, ClothModifierData *clmd, DerivedMesh *result, int framenr) +static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, DerivedMesh *result, int framenr) { ClothVertex *verts = NULL; Cloth *cloth; @@ -372,7 +372,7 @@ static int do_step_cloth(const struct EvaluationContext *eval_ctx, Object *ob, C mul_m4_v3(ob->obmat, verts->xconst); } - effectors = pdInitEffectors(eval_ctx, clmd->scene, ob, NULL, clmd->sim_parms->effector_weights, true); + effectors = pdInitEffectors(depsgraph, clmd->scene, ob, NULL, clmd->sim_parms->effector_weights, true); if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH ) cloth_update_verts ( ob, clmd, result ); @@ -402,7 +402,7 @@ static int do_step_cloth(const struct EvaluationContext *eval_ctx, Object *ob, C /************************************************ * clothModifier_do - main simulation function ************************************************/ -void clothModifier_do(ClothModifierData *clmd, const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm, float (*vertexCos)[3]) +void clothModifier_do(ClothModifierData *clmd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm, float (*vertexCos)[3]) { PointCache *cache; PTCacheID pid; @@ -490,7 +490,7 @@ void clothModifier_do(ClothModifierData *clmd, const struct EvaluationContext *e /* do simulation */ BKE_ptcache_validate(cache, framenr); - if (!do_step_cloth(eval_ctx, ob, clmd, dm, framenr)) { + if (!do_step_cloth(depsgraph, ob, clmd, dm, framenr)) { BKE_ptcache_invalidate(cache); } else diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a759d0fa3f2..eca789b0f87 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -684,7 +684,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { /* This function should be used for the get_target_matrix member of all * constraints that are not picky about what happens to their target matrix. */ -static void default_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) +static void default_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail); @@ -1153,7 +1153,7 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void kinematic_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void kinematic_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bKinematicConstraint *data = con->data; @@ -1240,7 +1240,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy } } -static void followpath_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), +static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) { @@ -2019,7 +2019,7 @@ static void pycon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userd } /* Whether this approach is maintained remains to be seen (aligorith) */ -static void pycon_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), +static void pycon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) { @@ -2135,7 +2135,7 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void actcon_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void actcon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bActionConstraint *data = con->data; @@ -3124,7 +3124,7 @@ static void clampto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void clampto_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), +static void clampto_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *UNUSED(con), bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) { @@ -3461,7 +3461,7 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy } -static void shrinkwrap_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) +static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; @@ -3793,7 +3793,7 @@ static void splineik_flush_tars(bConstraint *con, ListBase *list, bool no_copy) } } -static void splineik_get_tarmat(const struct EvaluationContext *UNUSED(eval_ctx), +static void splineik_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *UNUSED(con), bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) { @@ -4845,7 +4845,7 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan) * None of the actual calculations of the matrices should be done here! Also, this function is * not to be used by any new constraints, particularly any that have multiple targets. */ -void BKE_constraint_target_matrix_get(const struct EvaluationContext *eval_ctx, Scene *scene, bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime) +void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, Scene *scene, bConstraint *con, int index, short ownertype, void *ownerdata, float mat[4][4], float ctime) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; @@ -4896,7 +4896,7 @@ void BKE_constraint_target_matrix_get(const struct EvaluationContext *eval_ctx, if (ct) { if (cti->get_target_matrix) - cti->get_target_matrix(eval_ctx, con, cob, ct, ctime); + cti->get_target_matrix(depsgraph, con, cob, ct, ctime); copy_m4_m4(mat, ct->matrix); } @@ -4912,7 +4912,7 @@ void BKE_constraint_target_matrix_get(const struct EvaluationContext *eval_ctx, } /* Get the list of targets required for solving a constraint */ -void BKE_constraint_targets_for_solving_get(const struct EvaluationContext *eval_ctx, bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime) +void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph, bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); @@ -4930,7 +4930,7 @@ void BKE_constraint_targets_for_solving_get(const struct EvaluationContext *eval */ if (cti->get_target_matrix) { for (ct = targets->first; ct; ct = ct->next) - cti->get_target_matrix(eval_ctx, con, cob, ct, ctime); + cti->get_target_matrix(depsgraph, con, cob, ct, ctime); } else { for (ct = targets->first; ct; ct = ct->next) @@ -4947,7 +4947,7 @@ void BKE_constraint_targets_for_solving_get(const struct EvaluationContext *eval * BKE_constraints_make_evalob and BKE_constraints_clear_evalob should be called before and * after running this function, to sort out cob */ -void BKE_constraints_solve(const struct EvaluationContext *eval_ctx, ListBase *conlist, bConstraintOb *cob, float ctime) +void BKE_constraints_solve(struct Depsgraph *depsgraph, ListBase *conlist, bConstraintOb *cob, float ctime) { bConstraint *con; float oldmat[4][4]; @@ -4982,7 +4982,7 @@ void BKE_constraints_solve(const struct EvaluationContext *eval_ctx, ListBase *c BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace, false); /* prepare targets for constraint solving */ - BKE_constraint_targets_for_solving_get(eval_ctx, con, cob, &targets, ctime); + BKE_constraint_targets_for_solving_get(depsgraph, con, cob, &targets, ctime); /* Solve the constraint and put result in cob->matrix */ cti->evaluate_constraint(con, cob, &targets); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index d550f1945db..2bb12725940 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -1266,15 +1266,3 @@ Depsgraph *CTX_data_depsgraph(const bContext *C) ViewLayer *view_layer = CTX_data_view_layer(C); return BKE_scene_get_depsgraph(scene, view_layer, true); } - -void CTX_data_eval_ctx(const bContext *C, EvaluationContext *eval_ctx) -{ - BLI_assert(C != NULL); - - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - DEG_evaluation_context_init_from_scene( - eval_ctx, - scene, view_layer, - DAG_EVAL_VIEWPORT); -} diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c index d2ffbbcf27b..f5795444b7d 100644 --- a/source/blender/blenkernel/intern/crazyspace.c +++ b/source/blender/blenkernel/intern/crazyspace.c @@ -100,7 +100,7 @@ static int modifiers_disable_subsurf_temporary(Object *ob) /* disable subsurf temporal, get mapped cos, and enable it */ float (*BKE_crazyspace_get_mapped_editverts( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *obedit))[3] + struct Depsgraph *depsgraph, Scene *scene, Object *obedit))[3] { Mesh *me = obedit->data; DerivedMesh *dm; @@ -110,13 +110,13 @@ float (*BKE_crazyspace_get_mapped_editverts( /* disable subsurf temporal, get mapped cos, and enable it */ if (modifiers_disable_subsurf_temporary(obedit)) { /* need to make new derivemesh */ - makeDerivedMesh(eval_ctx, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, false); + makeDerivedMesh(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, false); } /* now get the cage */ vertexcos = MEM_mallocN(sizeof(*vertexcos) * nverts, "vertexcos map"); - dm = editbmesh_get_derived_cage(eval_ctx, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH); + dm = editbmesh_get_derived_cage(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH); mesh_get_mapped_verts_coords(dm, vertexcos, nverts); @@ -252,7 +252,7 @@ void BKE_crazyspace_set_quats_mesh(Mesh *me, float (*origcos)[3], float (*mapped /** returns an array of deform matrices for crazyspace correction, and the * number of modifiers left */ int BKE_crazyspace_get_first_deform_matrices_editbmesh( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BMEditMesh *em, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, BMEditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]) { ModifierData *md; @@ -292,7 +292,7 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh( unit_m3(defmats[a]); } - mti->deformMatricesEM(md, eval_ctx, ob, em, dm, deformedVerts, defmats, + mti->deformMatricesEM(md, depsgraph, ob, em, dm, deformedVerts, defmats, numVerts); } else @@ -313,7 +313,7 @@ int BKE_crazyspace_get_first_deform_matrices_editbmesh( } int BKE_sculpt_get_first_deform_matrices( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) { ModifierData *md; @@ -350,7 +350,7 @@ int BKE_sculpt_get_first_deform_matrices( unit_m3(defmats[a]); } - if (mti->deformMatrices) mti->deformMatrices(md, eval_ctx, ob, dm, deformedVerts, defmats, numVerts); + if (mti->deformMatrices) mti->deformMatrices(md, depsgraph, ob, dm, deformedVerts, defmats, numVerts); else break; } } @@ -373,9 +373,9 @@ int BKE_sculpt_get_first_deform_matrices( return numleft; } -void BKE_crazyspace_build_sculpt(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) +void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) { - int totleft = BKE_sculpt_get_first_deform_matrices(eval_ctx, scene, ob, deformmats, deformcos); + int totleft = BKE_sculpt_get_first_deform_matrices(depsgraph, scene, ob, deformmats, deformcos); if (totleft) { /* there are deformation modifier which doesn't support deformation matrices @@ -400,7 +400,7 @@ void BKE_crazyspace_build_sculpt(const struct EvaluationContext *eval_ctx, Scene if (mti->deformMatrices && !deformed) continue; - mti->deformVerts(md, eval_ctx, ob, NULL, deformedVerts, me->totvert, 0); + mti->deformVerts(md, depsgraph, ob, NULL, deformedVerts, me->totvert, 0); deformed = 1; } } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 0c4dbdf7763..661ffdbcd27 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1624,7 +1624,7 @@ float *BKE_curve_surf_make_orco(Object *ob) /* NOTE: This routine is tied to the order of vertex * built by displist and as passed to the renderer. */ -float *BKE_curve_make_orco(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, int *r_numVerts) +float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int *r_numVerts) { Curve *cu = ob->data; DispList *dl; @@ -1632,7 +1632,7 @@ float *BKE_curve_make_orco(const EvaluationContext *eval_ctx, Scene *scene, Obje float *fp, *coord_array; ListBase disp = {NULL, NULL}; - BKE_displist_make_curveTypes_forOrco(eval_ctx, scene, ob, &disp); + BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp); numVerts = 0; for (dl = disp.first; dl; dl = dl->next) { @@ -1724,7 +1724,7 @@ float *BKE_curve_make_orco(const EvaluationContext *eval_ctx, Scene *scene, Obje /* ***************** BEVEL ****************** */ void BKE_curve_bevel_make( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *disp, + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *disp, const bool for_render, const bool use_render_resolution) { DispList *dl, *dlnew; @@ -1749,7 +1749,7 @@ void BKE_curve_bevel_make( facy = cu->bevobj->size[1]; if (for_render) { - BKE_displist_make_curveTypes_forRender(eval_ctx, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution); + BKE_displist_make_curveTypes_forRender(depsgraph, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution); dl = bevdisp.first; } else if (cu->bevobj->curve_cache) { @@ -5255,7 +5255,7 @@ void BKE_curve_rect_from_textbox(const struct Curve *cu, const struct TextBox *t /* **** Depsgraph evaluation **** */ -void BKE_curve_eval_geometry(const EvaluationContext *UNUSED(eval_ctx), +void BKE_curve_eval_geometry(Depsgraph *UNUSED(depsgraph), Curve *curve) { DEG_debug_print_eval(__func__, curve->id.name, curve); diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index e20c6a35303..0451031c5b8 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -1010,7 +1010,7 @@ static bool data_transfer_layersmapping_generate( * to get (as much as possible) exact copy of source data layout. */ void BKE_object_data_transfer_layout( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, Object *ob_dst, const int data_types, const bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX]) { @@ -1028,7 +1028,7 @@ void BKE_object_data_transfer_layout( /* Get source DM.*/ dm_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types); - dm_src = mesh_get_derived_final(eval_ctx, scene, ob_src, dm_src_mask); + dm_src = mesh_get_derived_final(depsgraph, scene, ob_src, dm_src_mask); if (!dm_src) { return; } @@ -1086,7 +1086,7 @@ void BKE_object_data_transfer_layout( } bool BKE_object_data_transfer_dm( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, DerivedMesh *dm_dst, + struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, Object *ob_dst, DerivedMesh *dm_dst, const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, @@ -1150,7 +1150,7 @@ bool BKE_object_data_transfer_dm( * Also, we need to make a local copy of dm_src, otherwise we may end with concurrent creation * of data in it (multi-threaded evaluation of the modifier stack, see T46672). */ - dm_src = dm_dst ? ob_src->derivedFinal : mesh_get_derived_final(eval_ctx, scene, ob_src, dm_src_mask); + dm_src = dm_dst ? ob_src->derivedFinal : mesh_get_derived_final(depsgraph, scene, ob_src, dm_src_mask); if (!dm_src) { return changed; } @@ -1458,7 +1458,7 @@ bool BKE_object_data_transfer_dm( } bool BKE_object_data_transfer_mesh( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, Object *ob_dst, const int data_types, + struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, Object *ob_dst, const int data_types, const bool use_create, const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode, SpaceTransform *space_transform, const bool auto_transform, const float max_distance, const float ray_radius, const float islands_handling_precision, @@ -1467,7 +1467,7 @@ bool BKE_object_data_transfer_mesh( ReportList *reports) { return BKE_object_data_transfer_dm( - eval_ctx, scene, ob_src, ob_dst, NULL, data_types, use_create, + depsgraph, scene, ob_src, ob_dst, NULL, data_types, use_create, map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode, space_transform, auto_transform, max_distance, ray_radius, islands_handling_precision, diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index ffa4e652056..e74e540fab9 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -681,7 +681,7 @@ static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dis * - first point left, last point right * - based on subdivided points in original curve, not on points in taper curve (still) */ -static float displist_calc_taper(const EvaluationContext *eval_ctx, Scene *scene, Object *taperobj, float fac) +static float displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *taperobj, float fac) { DispList *dl; @@ -690,7 +690,7 @@ static float displist_calc_taper(const EvaluationContext *eval_ctx, Scene *scene dl = taperobj->curve_cache ? taperobj->curve_cache->disp.first : NULL; if (dl == NULL) { - BKE_displist_make_curveTypes(eval_ctx, scene, taperobj, 0); + BKE_displist_make_curveTypes(depsgraph, scene, taperobj, 0); dl = taperobj->curve_cache->disp.first; } if (dl) { @@ -721,14 +721,14 @@ static float displist_calc_taper(const EvaluationContext *eval_ctx, Scene *scene return 1.0; } -float BKE_displist_calc_taper(const EvaluationContext *eval_ctx, Scene *scene, Object *taperobj, int cur, int tot) +float BKE_displist_calc_taper(Depsgraph *depsgraph, Scene *scene, Object *taperobj, int cur, int tot) { float fac = ((float)cur) / (float)(tot - 1); - return displist_calc_taper(eval_ctx, scene, taperobj, fac); + return displist_calc_taper(depsgraph, scene, taperobj, fac); } -void BKE_displist_make_mball(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_displist_make_mball(Depsgraph *depsgraph, Scene *scene, Object *ob) { if (!ob || ob->type != OB_MBALL) return; @@ -741,7 +741,7 @@ void BKE_displist_make_mball(const EvaluationContext *eval_ctx, Scene *scene, Ob ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for MBall"); } - BKE_mball_polygonize(eval_ctx, scene, ob, &ob->curve_cache->disp); + BKE_mball_polygonize(depsgraph, scene, ob, &ob->curve_cache->disp); BKE_mball_texspace_calc(ob); object_deform_mball(ob, &ob->curve_cache->disp); @@ -751,9 +751,9 @@ void BKE_displist_make_mball(const EvaluationContext *eval_ctx, Scene *scene, Ob } } -void BKE_displist_make_mball_forRender(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) +void BKE_displist_make_mball_forRender(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase) { - BKE_mball_polygonize(eval_ctx, scene, ob, dispbase); + BKE_mball_polygonize(depsgraph, scene, ob, dispbase); BKE_mball_texspace_calc(ob); object_deform_mball(ob, dispbase); @@ -802,7 +802,7 @@ static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, } static void curve_calc_modifiers_pre( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *nurb, + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *nurb, const bool for_render, const bool use_render_resolution) { VirtualModifierData virtualModifierData; @@ -860,7 +860,7 @@ static void curve_calc_modifiers_pre( deformedVerts = BKE_curve_nurbs_vertexCos_get(nurb, &numVerts); } - mti->deformVerts(md, eval_ctx, ob, NULL, deformedVerts, numVerts, app_flag); + mti->deformVerts(md, depsgraph, ob, NULL, deformedVerts, numVerts, app_flag); if (md == pretessellatePoint) break; @@ -913,7 +913,7 @@ static void displist_apply_allverts(ListBase *dispbase, float (*allverts)[3]) } static void curve_calc_modifiers_post( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *nurb, + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *nurb, ListBase *dispbase, DerivedMesh **r_dm_final, const bool for_render, const bool use_render_resolution) { @@ -969,14 +969,14 @@ static void curve_calc_modifiers_post( dm->getVertCos(dm, vertCos); } - mti->deformVerts(md, eval_ctx, ob, dm, vertCos, totvert, appf); + mti->deformVerts(md, depsgraph, ob, dm, vertCos, totvert, appf); } else { if (!vertCos) { vertCos = displist_get_allverts(dispbase, &totvert); } - mti->deformVerts(md, eval_ctx, ob, NULL, vertCos, totvert, appf); + mti->deformVerts(md, depsgraph, ob, NULL, vertCos, totvert, appf); } } else { @@ -1018,7 +1018,7 @@ static void curve_calc_modifiers_post( if (useCache) appf |= MOD_APPLY_USECACHE; - ndm = modwrap_applyModifier(md, eval_ctx, ob, dm, appf); + ndm = modwrap_applyModifier(md, depsgraph, ob, dm, appf); if (ndm) { /* Modifier returned a new derived mesh */ @@ -1095,13 +1095,13 @@ static void displist_surf_indices(DispList *dl) } } -static DerivedMesh *create_orco_dm(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) +static DerivedMesh *create_orco_dm(Depsgraph *depsgraph, Scene *scene, Object *ob) { DerivedMesh *dm; ListBase disp = {NULL, NULL}; /* OrcoDM should be created from underformed disp lists */ - BKE_displist_make_curveTypes_forOrco(eval_ctx, scene, ob, &disp); + BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp); dm = CDDM_from_curve_displist(ob, &disp); BKE_displist_free(&disp); @@ -1140,7 +1140,7 @@ static void add_orco_dm(Object *ob, DerivedMesh *dm, DerivedMesh *orcodm) } static void curve_calc_orcodm( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm_final, + Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm_final, const bool for_render, const bool use_render_resolution) { /* this function represents logic of mesh's orcodm calculation @@ -1178,7 +1178,7 @@ static void curve_calc_orcodm( * This means we can create ORCO DM in advance and assume it's * never NULL. */ - orcodm = create_orco_dm(eval_ctx, scene, ob); + orcodm = create_orco_dm(depsgraph, scene, ob); for (; md; md = md->next) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -1190,7 +1190,7 @@ static void curve_calc_orcodm( if (mti->type != eModifierTypeType_Constructive) continue; - ndm = modwrap_applyModifier(md, eval_ctx, ob, orcodm, app_flag); + ndm = modwrap_applyModifier(md, depsgraph, ob, orcodm, app_flag); if (ndm) { /* if the modifier returned a new dm, release the old one */ @@ -1208,7 +1208,7 @@ static void curve_calc_orcodm( } void BKE_displist_make_surf( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase, DerivedMesh **r_dm_final, const bool for_render, const bool for_orco, const bool use_render_resolution) { @@ -1227,7 +1227,7 @@ void BKE_displist_make_surf( } if (!for_orco) - curve_calc_modifiers_pre(eval_ctx, scene, ob, &nubase, for_render, use_render_resolution); + curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render, use_render_resolution); for (nu = nubase.first; nu; nu = nu->next) { if ((for_render || nu->hide == 0) && BKE_nurb_check_valid_uv(nu)) { @@ -1294,7 +1294,7 @@ void BKE_displist_make_surf( if (!for_orco) { BKE_nurbList_duplicate(&ob->curve_cache->deformed_nurbs, &nubase); - curve_calc_modifiers_post(eval_ctx, scene, ob, &nubase, dispbase, r_dm_final, + curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_dm_final, for_render, use_render_resolution); } @@ -1521,7 +1521,7 @@ static void calc_bevfac_mapping(Curve *cu, BevList *bl, Nurb *nu, } static void do_makeDispListCurveTypes( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase, DerivedMesh **r_dm_final, const bool for_render, const bool for_orco, const bool use_render_resolution) { @@ -1531,7 +1531,7 @@ static void do_makeDispListCurveTypes( if (!ELEM(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return; if (ob->type == OB_SURF) { - BKE_displist_make_surf(eval_ctx, scene, ob, dispbase, r_dm_final, for_render, for_orco, use_render_resolution); + BKE_displist_make_surf(depsgraph, scene, ob, dispbase, r_dm_final, for_render, for_orco, use_render_resolution); } else if (ELEM(ob->type, OB_CURVE, OB_FONT)) { ListBase dlbev; @@ -1556,12 +1556,12 @@ static void do_makeDispListCurveTypes( } if (!for_orco) - curve_calc_modifiers_pre(eval_ctx, scene, ob, &nubase, for_render, use_render_resolution); + curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render, use_render_resolution); BKE_curve_bevelList_make(ob, &nubase, for_render != false); /* If curve has no bevel will return nothing */ - BKE_curve_bevel_make(eval_ctx, scene, ob, &dlbev, for_render, use_render_resolution); + BKE_curve_bevel_make(depsgraph, scene, ob, &dlbev, for_render, use_render_resolution); /* no bevel or extrude, and no width correction? */ if (!dlbev.first && cu->width == 1.0f) { @@ -1696,7 +1696,7 @@ static void do_makeDispListCurveTypes( taper_fac -= (1.0f - lastblend) / len; } - fac = displist_calc_taper(eval_ctx, scene, cu->taperobj, taper_fac); + fac = displist_calc_taper(depsgraph, scene, cu->taperobj, taper_fac); } if (bevp->split_tag) { @@ -1749,7 +1749,7 @@ static void do_makeDispListCurveTypes( if (!for_orco) { if ((cu->flag & CU_PATH) || - DEG_get_eval_flags_for_id(eval_ctx->depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) + DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) { calc_curvepath(ob, &nubase); } @@ -1757,7 +1757,7 @@ static void do_makeDispListCurveTypes( if (!for_orco) { BKE_nurbList_duplicate(&ob->curve_cache->deformed_nurbs, &nubase); - curve_calc_modifiers_post(eval_ctx, scene, ob, &nubase, dispbase, r_dm_final, for_render, use_render_resolution); + curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_dm_final, for_render, use_render_resolution); } if (cu->flag & CU_DEFORM_FILL && !ob->derivedFinal) { @@ -1768,7 +1768,7 @@ static void do_makeDispListCurveTypes( } } -void BKE_displist_make_curveTypes(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, const bool for_orco) +void BKE_displist_make_curveTypes(Depsgraph *depsgraph, Scene *scene, Object *ob, const bool for_orco) { ListBase *dispbase; @@ -1786,13 +1786,13 @@ void BKE_displist_make_curveTypes(const EvaluationContext *eval_ctx, Scene *scen dispbase = &(ob->curve_cache->disp); - do_makeDispListCurveTypes(eval_ctx, scene, ob, dispbase, &ob->derivedFinal, 0, for_orco, 0); + do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, &ob->derivedFinal, 0, for_orco, 0); boundbox_displist_object(ob); } void BKE_displist_make_curveTypes_forRender( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase, + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase, DerivedMesh **r_dm_final, const bool for_orco, const bool use_render_resolution) { @@ -1800,22 +1800,22 @@ void BKE_displist_make_curveTypes_forRender( ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); } - do_makeDispListCurveTypes(eval_ctx, scene, ob, dispbase, r_dm_final, true, for_orco, use_render_resolution); + do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, r_dm_final, true, for_orco, use_render_resolution); } void BKE_displist_make_curveTypes_forOrco( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) + Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase) { if (ob->curve_cache == NULL) { ob->curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); } - do_makeDispListCurveTypes(eval_ctx, scene, ob, dispbase, NULL, 1, 1, 1); + do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, NULL, 1, 1, 1); } /* add Orco layer to the displist object which has got derived mesh and return orco */ float *BKE_displist_make_orco( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm_final, + Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm_final, const bool for_render, const bool use_render_resolution) { @@ -1825,7 +1825,7 @@ float *BKE_displist_make_orco( dm_final = ob->derivedFinal; if (!dm_final->getVertDataArray(dm_final, CD_ORCO)) { - curve_calc_orcodm(eval_ctx, scene, ob, dm_final, for_render, use_render_resolution); + curve_calc_orcodm(depsgraph, scene, ob, dm_final, for_render, use_render_resolution); } orco = dm_final->getVertDataArray(dm_final, CD_ORCO); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index ee678dd4c41..6f0135616f0 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -75,6 +75,7 @@ #include "BKE_scene.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" /* for image output */ #include "IMB_imbuf_types.h" @@ -2065,7 +2066,7 @@ static void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMe * Updates derived mesh copy and processes dynamic paint step / caches. */ static void dynamicPaint_frameUpdate( - DynamicPaintModifierData *pmd, const struct EvaluationContext *eval_ctx, Scene *scene, + DynamicPaintModifierData *pmd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm) { if (pmd->canvas) { @@ -2129,7 +2130,7 @@ static void dynamicPaint_frameUpdate( else if (can_simulate) { /* calculate surface frame */ canvas->flags |= MOD_DPAINT_BAKING; - dynamicPaint_calculateFrame(surface, eval_ctx, scene, ob, current_frame); + dynamicPaint_calculateFrame(surface, depsgraph, scene, ob, current_frame); canvas->flags &= ~MOD_DPAINT_BAKING; /* restore canvas derivedmesh if required */ @@ -2149,14 +2150,14 @@ static void dynamicPaint_frameUpdate( /* Modifier call. Processes dynamic paint modifier step. */ DerivedMesh *dynamicPaint_Modifier_do( - DynamicPaintModifierData *pmd, const struct EvaluationContext *eval_ctx, Scene *scene, + DynamicPaintModifierData *pmd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm) { if (pmd->canvas) { DerivedMesh *ret; /* Update canvas data for a new frame */ - dynamicPaint_frameUpdate(pmd, eval_ctx, scene, ob, dm); + dynamicPaint_frameUpdate(pmd, depsgraph, scene, ob, dm); /* Return output mesh */ ret = dynamicPaint_Modifier_apply(pmd, ob, dm); @@ -2165,7 +2166,7 @@ DerivedMesh *dynamicPaint_Modifier_do( } else { /* Update canvas data for a new frame */ - dynamicPaint_frameUpdate(pmd, eval_ctx, scene, ob, dm); + dynamicPaint_frameUpdate(pmd, depsgraph, scene, ob, dm); /* Return output mesh */ return dynamicPaint_Modifier_apply(pmd, ob, dm); @@ -3348,7 +3349,7 @@ typedef struct BrushMaterials { /* Initialize materials for brush object: * Calculates inverse matrices for linked objects, updates * volume caches etc. */ -static void dynamicPaint_updateBrushMaterials(const EvaluationContext *eval_ctx, Object *brushOb, Material *ui_mat, Scene *scene, BrushMaterials *bMats) +static void dynamicPaint_updateBrushMaterials(Depsgraph *depsgraph, Object *brushOb, Material *ui_mat, Scene *scene, BrushMaterials *bMats) { /* Calculate inverse transformation matrix * for this object */ @@ -3363,13 +3364,13 @@ static void dynamicPaint_updateBrushMaterials(const EvaluationContext *eval_ctx, if (tot) { bMats->ob_mats = MEM_callocN(sizeof(Material *) * (tot), "BrushMaterials"); for (i = 0; i < tot; i++) { - bMats->ob_mats[i] = RE_sample_material_init(eval_ctx, give_current_material(brushOb, (i + 1)), scene); + bMats->ob_mats[i] = RE_sample_material_init(depsgraph, give_current_material(brushOb, (i + 1)), scene); } } bMats->tot = tot; } else { - bMats->mat = RE_sample_material_init(eval_ctx, ui_mat, scene); + bMats->mat = RE_sample_material_init(depsgraph, ui_mat, scene); } } @@ -3740,7 +3741,7 @@ static void dynamic_paint_brush_velocity_compute_cb( } static void dynamicPaint_brushMeshCalculateVelocity( - const struct EvaluationContext *eval_ctx, Scene *scene, + struct Depsgraph *depsgraph, Scene *scene, Object *ob, DynamicPaintBrushSettings *brush, Vec3f **brushVel, float timescale) { float prev_obmat[4][4]; @@ -3763,7 +3764,7 @@ static void dynamicPaint_brushMeshCalculateVelocity( scene->r.subframe = prev_sfra; BKE_object_modifier_update_subframe( - eval_ctx, scene, ob, true, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); + depsgraph, scene, ob, true, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); dm_p = CDDM_copy(brush->dm); numOfVerts_p = dm_p->getNumVerts(dm_p); mvert_p = dm_p->getVertArray(dm_p); @@ -3774,7 +3775,7 @@ static void dynamicPaint_brushMeshCalculateVelocity( scene->r.subframe = cur_sfra; BKE_object_modifier_update_subframe( - eval_ctx, scene, ob, true, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); + depsgraph, scene, ob, true, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); dm_c = brush->dm; numOfVerts_c = dm_c->getNumVerts(dm_c); mvert_c = dm_p->getVertArray(dm_c); @@ -3805,7 +3806,7 @@ static void dynamicPaint_brushMeshCalculateVelocity( } /* calculate velocity for object center point */ -static void dynamicPaint_brushObjectCalculateVelocity(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, Vec3f *brushVel, float timescale) +static void dynamicPaint_brushObjectCalculateVelocity(struct Depsgraph *depsgraph, Scene *scene, Object *ob, Vec3f *brushVel, float timescale) { float prev_obmat[4][4]; float cur_loc[3] = {0.0f}, prev_loc[3] = {0.0f}; @@ -3824,14 +3825,14 @@ static void dynamicPaint_brushObjectCalculateVelocity(const struct EvaluationCon scene->r.cfra = prev_fra; scene->r.subframe = prev_sfra; BKE_object_modifier_update_subframe( - eval_ctx, scene, ob, false, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); + depsgraph, scene, ob, false, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); copy_m4_m4(prev_obmat, ob->obmat); /* current frame dm */ scene->r.cfra = cur_fra; scene->r.subframe = cur_sfra; BKE_object_modifier_update_subframe( - eval_ctx, scene, ob, false, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); + depsgraph, scene, ob, false, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); /* calculate speed */ mul_m4_v3(prev_obmat, prev_loc); @@ -4203,7 +4204,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( } } -static int dynamicPaint_paintMesh(const struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, +static int dynamicPaint_paintMesh(struct Depsgraph *depsgraph, DynamicPaintSurface *surface, DynamicPaintBrushSettings *brush, Object *brushOb, BrushMaterials *bMats, @@ -4219,7 +4220,7 @@ static int dynamicPaint_paintMesh(const struct EvaluationContext *eval_ctx, Dyna const MLoop *mloop = NULL; if (brush->flags & MOD_DPAINT_USES_VELOCITY) - dynamicPaint_brushMeshCalculateVelocity(eval_ctx, scene, brushOb, brush, &brushVelocity, timescale); + dynamicPaint_brushMeshCalculateVelocity(depsgraph, scene, brushOb, brush, &brushVelocity, timescale); if (!brush->dm) return 0; @@ -4709,7 +4710,7 @@ static void dynamic_paint_paint_single_point_cb_ex( } static int dynamicPaint_paintSinglePoint( - const struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, + struct Depsgraph *depsgraph, DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale) { PaintSurfaceData *sData = surface->data; @@ -4717,7 +4718,7 @@ static int dynamicPaint_paintSinglePoint( Vec3f brushVel; if (brush->flags & MOD_DPAINT_USES_VELOCITY) - dynamicPaint_brushObjectCalculateVelocity(eval_ctx, scene, brushOb, &brushVel, timescale); + dynamicPaint_brushObjectCalculateVelocity(depsgraph, scene, brushOb, &brushVel, timescale); const MVert *mvert = brush->dm->getVertArray(brush->dm); @@ -5039,7 +5040,7 @@ static void dynamic_paint_prepare_effect_cb( } static int dynamicPaint_prepareEffectStep( - const struct EvaluationContext *eval_ctx, DynamicPaintSurface *surface, Scene *scene, Object *ob, float **force, float timescale) + struct Depsgraph *depsgraph, DynamicPaintSurface *surface, Scene *scene, Object *ob, float **force, float timescale) { double average_force = 0.0f; float shrink_speed = 0.0f, spread_speed = 0.0f; @@ -5050,7 +5051,7 @@ static int dynamicPaint_prepareEffectStep( /* Init force data if required */ if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) { - ListBase *effectors = pdInitEffectors(eval_ctx, scene, ob, NULL, surface->effector_weights, true); + ListBase *effectors = pdInitEffectors(depsgraph, scene, ob, NULL, surface->effector_weights, true); /* allocate memory for force data (dir vector + strength) */ *force = MEM_mallocN(sData->total_points * 4 * sizeof(float), "PaintEffectForces"); @@ -6007,7 +6008,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, const Vie /* * Do Dynamic Paint step. Paints scene brush objects of current state/frame to the surface. */ -static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe) +static int dynamicPaint_doStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe) { PaintSurfaceData *sData = surface->data; PaintBakeData *bData = sData->bData; @@ -6035,7 +6036,7 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene * Base *base = NULL; Object *brushObj = NULL; ModifierData *md = NULL; - ViewLayer *view_layer = eval_ctx->view_layer; + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); /* backup current scene frame */ int scene_frame = scene->r.cfra; @@ -6082,12 +6083,12 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene * /* update object data on this subframe */ if (subframe) { scene_setSubframe(scene, subframe); - BKE_object_modifier_update_subframe(eval_ctx, scene, brushObj, true, SUBFRAME_RECURSION, + BKE_object_modifier_update_subframe(depsgraph, scene, brushObj, true, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); } /* Prepare materials if required */ if (brush_usesMaterial(brush, scene)) - dynamicPaint_updateBrushMaterials(eval_ctx, brushObj, brush->mat, scene, &bMats); + dynamicPaint_updateBrushMaterials(depsgraph, brushObj, brush->mat, scene, &bMats); /* Apply brush on the surface depending on it's collision type */ if (brush->psys && brush->psys->part && @@ -6101,11 +6102,11 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene * } /* Object center distance: */ if (brush->collision == MOD_DPAINT_COL_POINT && brushObj != ob) { - dynamicPaint_paintSinglePoint(eval_ctx, surface, brushObj->loc, brush, brushObj, &bMats, scene, timescale); + dynamicPaint_paintSinglePoint(depsgraph, surface, brushObj->loc, brush, brushObj, &bMats, scene, timescale); } /* Mesh volume/proximity: */ else if (brushObj != ob) { - dynamicPaint_paintMesh(eval_ctx, surface, brush, brushObj, &bMats, scene, timescale); + dynamicPaint_paintMesh(depsgraph, surface, brush, brushObj, &bMats, scene, timescale); } /* free temp material data */ @@ -6115,7 +6116,7 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene * if (subframe) { scene->r.cfra = scene_frame; scene->r.subframe = scene_subframe; - BKE_object_modifier_update_subframe(eval_ctx, scene, brushObj, true, SUBFRAME_RECURSION, + BKE_object_modifier_update_subframe(depsgraph, scene, brushObj, true, SUBFRAME_RECURSION, BKE_scene_frame_get(scene), eModifierType_DynamicPaint); } @@ -6150,7 +6151,7 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene * return setError(canvas, N_("Not enough free memory")); /* Prepare effects and get number of required steps */ - steps = dynamicPaint_prepareEffectStep(eval_ctx, surface, scene, ob, &force, timescale); + steps = dynamicPaint_prepareEffectStep(depsgraph, surface, scene, ob, &force, timescale); for (s = 0; s < steps; s++) { dynamicPaint_doEffectStep(surface, force, prevPoint, timescale, (float)steps); } @@ -6175,7 +6176,7 @@ static int dynamicPaint_doStep(const struct EvaluationContext *eval_ctx, Scene * * Calculate a single frame and included subframes for surface */ int dynamicPaint_calculateFrame( - DynamicPaintSurface *surface, const struct EvaluationContext *eval_ctx, + DynamicPaintSurface *surface, struct Depsgraph *depsgraph, Scene *scene, Object *cObject, int frame) { float timescale = 1.0f; @@ -6185,7 +6186,8 @@ int dynamicPaint_calculateFrame( dynamicPaint_applySurfaceDisplace(surface, surface->canvas->dm); /* update bake data */ - dynamicPaint_generateBakeData(surface, eval_ctx->view_layer, cObject); + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); + dynamicPaint_generateBakeData(surface, view_layer, cObject); /* don't do substeps for first frame */ if (surface->substeps && (frame != surface->start_frame)) { @@ -6194,10 +6196,10 @@ int dynamicPaint_calculateFrame( for (st = 1; st <= surface->substeps; st++) { float subframe = ((float) st) / (surface->substeps + 1); - if (!dynamicPaint_doStep(eval_ctx, scene, cObject, surface, timescale, subframe)) + if (!dynamicPaint_doStep(depsgraph, scene, cObject, surface, timescale, subframe)) return 0; } } - return dynamicPaint_doStep(eval_ctx, scene, cObject, surface, timescale, 0.0f); + return dynamicPaint_doStep(depsgraph, scene, cObject, surface, timescale, 0.0f); } diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 2018962eb62..4281443220d 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -2176,14 +2176,14 @@ static void cage_mapped_verts_callback( } } -float (*BKE_editmesh_vertexCos_get(const struct EvaluationContext *eval_ctx, BMEditMesh *em, Scene *scene, int *r_numVerts))[3] +float (*BKE_editmesh_vertexCos_get(struct Depsgraph *depsgraph, BMEditMesh *em, Scene *scene, int *r_numVerts))[3] { DerivedMesh *cage, *final; BLI_bitmap *visit_bitmap; struct CageUserData data; float (*cos_cage)[3]; - cage = editbmesh_get_derived_cage_and_final(eval_ctx, scene, em->ob, em, CD_MASK_BAREMESH, &final); + cage = editbmesh_get_derived_cage_and_final(depsgraph, scene, em->ob, em, CD_MASK_BAREMESH, &final); cos_cage = MEM_callocN(sizeof(*cos_cage) * em->bm->totvert, "bmbvh cos_cage"); /* when initializing cage verts, we only want the first cage coordinate for each vertex, diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c index 2927354241c..e68f11f6274 100644 --- a/source/blender/blenkernel/intern/editmesh_bvh.c +++ b/source/blender/blenkernel/intern/editmesh_bvh.c @@ -547,4 +547,4 @@ BVHTreeOverlap *BKE_bmbvh_overlap(const BMBVHTree *bmtree_a, const BMBVHTree *bm data.epsilon = max_ff(BLI_bvhtree_get_epsilon(bmtree_a->tree), BLI_bvhtree_get_epsilon(bmtree_b->tree)); return BLI_bvhtree_overlap(bmtree_a->tree, bmtree_b->tree, r_overlap_tot, bmbvh_overlap_cb, &data); -}
\ No newline at end of file +} diff --git a/source/blender/blenkernel/intern/editmesh_tangent.c b/source/blender/blenkernel/intern/editmesh_tangent.c index f725a1793b4..9e8b4fa8782 100644 --- a/source/blender/blenkernel/intern/editmesh_tangent.c +++ b/source/blender/blenkernel/intern/editmesh_tangent.c @@ -428,4 +428,4 @@ void BKE_editmesh_loop_tangent_calc( } /* else tangent has been built from orco */ } -/** \} */
\ No newline at end of file +/** \} */ diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index a919353644d..8bdc74edffd 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -74,6 +74,7 @@ #include "BKE_smoke.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "RE_render_ext.h" #include "RE_shader_ext.h" @@ -148,10 +149,10 @@ void free_partdeflect(PartDeflect *pd) MEM_freeN(pd); } -static EffectorCache *new_effector_cache(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd) +static EffectorCache *new_effector_cache(struct Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd) { EffectorCache *eff = MEM_callocN(sizeof(EffectorCache), "EffectorCache"); - eff->eval_ctx = eval_ctx; + eff->depsgraph = depsgraph; eff->scene = scene; eff->ob = ob; eff->psys = psys; @@ -159,7 +160,7 @@ static EffectorCache *new_effector_cache(const struct EvaluationContext *eval_ct eff->frame = -1; return eff; } -static void add_object_to_effectors(ListBase **effectors, const struct EvaluationContext *eval_ctx, Scene *scene, EffectorWeights *weights, Object *ob, Object *ob_src, bool for_simulation) +static void add_object_to_effectors(ListBase **effectors, struct Depsgraph *depsgraph, Scene *scene, EffectorWeights *weights, Object *ob, Object *ob_src, bool for_simulation) { EffectorCache *eff = NULL; @@ -177,14 +178,14 @@ static void add_object_to_effectors(ListBase **effectors, const struct Evaluatio if (*effectors == NULL) *effectors = MEM_callocN(sizeof(ListBase), "effectors list"); - eff = new_effector_cache(eval_ctx, scene, ob, NULL, ob->pd); + eff = new_effector_cache(depsgraph, scene, ob, NULL, ob->pd); /* make sure imat is up to date */ invert_m4_m4(ob->imat, ob->obmat); BLI_addtail(*effectors, eff); } -static void add_particles_to_effectors(ListBase **effectors, const struct EvaluationContext *eval_ctx, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src, bool for_simulation) +static void add_particles_to_effectors(ListBase **effectors, struct Depsgraph *depsgraph, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src, bool for_simulation) { ParticleSettings *part= psys->part; @@ -198,20 +199,20 @@ static void add_particles_to_effectors(ListBase **effectors, const struct Evalua if (*effectors == NULL) *effectors = MEM_callocN(sizeof(ListBase), "effectors list"); - BLI_addtail(*effectors, new_effector_cache(eval_ctx, scene, ob, psys, part->pd)); + BLI_addtail(*effectors, new_effector_cache(depsgraph, scene, ob, psys, part->pd)); } if (part->pd2 && part->pd2->forcefield && (!for_simulation || weights->weight[part->pd2->forcefield] != 0.0f)) { if (*effectors == NULL) *effectors = MEM_callocN(sizeof(ListBase), "effectors list"); - BLI_addtail(*effectors, new_effector_cache(eval_ctx, scene, ob, psys, part->pd2)); + BLI_addtail(*effectors, new_effector_cache(depsgraph, scene, ob, psys, part->pd2)); } } /* returns ListBase handle with objects taking part in the effecting */ ListBase *pdInitEffectors( - const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob_src, ParticleSystem *psys_src, + struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, ParticleSystem *psys_src, EffectorWeights *weights, bool for_simulation) { ViewLayer *view_layer; @@ -222,11 +223,11 @@ ListBase *pdInitEffectors( view_layer = weights->group->view_layer; } /* TODO(mai): the check for view_layer shouldnt be needed, remove when render engine api is updated for this */ - else if (eval_ctx && eval_ctx->view_layer) { - view_layer = eval_ctx->view_layer; + else if (depsgraph && DEG_get_evaluated_view_layer(depsgraph)) { + view_layer = DEG_get_evaluated_view_layer(depsgraph); } else { - /* eval_ctx is NULL during deg build */ + /* depsgraph is NULL during deg build */ view_layer = BKE_view_layer_context_active_PLACEHOLDER(scene); } @@ -236,20 +237,20 @@ ListBase *pdInitEffectors( } if (base->object->pd && base->object->pd->forcefield) { - add_object_to_effectors(&effectors, eval_ctx, scene, weights, base->object, ob_src, for_simulation); + add_object_to_effectors(&effectors, depsgraph, scene, weights, base->object, ob_src, for_simulation); } if (base->object->particlesystem.first) { ParticleSystem *psys= base->object->particlesystem.first; for (; psys; psys=psys->next) { - add_particles_to_effectors(&effectors, eval_ctx, scene, weights, base->object, psys, psys_src, for_simulation); + add_particles_to_effectors(&effectors, depsgraph, scene, weights, base->object, psys, psys_src, for_simulation); } } } if (for_simulation) { - pdPrecalculateEffectors(eval_ctx, effectors); + pdPrecalculateEffectors(depsgraph, effectors); } return effectors; @@ -271,7 +272,7 @@ void pdEndEffectors(ListBase **effectors) } } -static void precalculate_effector(const struct EvaluationContext *eval_ctx, EffectorCache *eff) +static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *eff) { unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra); if (!eff->pd->rng) @@ -283,7 +284,7 @@ static void precalculate_effector(const struct EvaluationContext *eval_ctx, Effe Curve *cu= eff->ob->data; if (cu->flag & CU_PATH) { if (eff->ob->curve_cache == NULL || eff->ob->curve_cache->path==NULL || eff->ob->curve_cache->path->data==NULL) - BKE_displist_make_curveTypes(eval_ctx, eff->scene, eff->ob, 0); + BKE_displist_make_curveTypes(depsgraph, eff->scene, eff->ob, 0); if (eff->ob->curve_cache->path && eff->ob->curve_cache->path->data) { where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL); @@ -304,19 +305,19 @@ static void precalculate_effector(const struct EvaluationContext *eval_ctx, Effe if (eff->ob) { float old_vel[3]; - BKE_object_where_is_calc_time(eval_ctx, eff->scene, eff->ob, cfra - 1.0f); + BKE_object_where_is_calc_time(depsgraph, eff->scene, eff->ob, cfra - 1.0f); copy_v3_v3(old_vel, eff->ob->obmat[3]); - BKE_object_where_is_calc_time(eval_ctx, eff->scene, eff->ob, cfra); + BKE_object_where_is_calc_time(depsgraph, eff->scene, eff->ob, cfra); sub_v3_v3v3(eff->velocity, eff->ob->obmat[3], old_vel); } } -void pdPrecalculateEffectors(const struct EvaluationContext *eval_ctx, ListBase *effectors) +void pdPrecalculateEffectors(struct Depsgraph *depsgraph, ListBase *effectors) { if (effectors) { EffectorCache *eff = effectors->first; for (; eff; eff=eff->next) - precalculate_effector(eval_ctx, eff); + precalculate_effector(depsgraph, eff); } } @@ -615,7 +616,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin } else { ParticleSimulationData sim= {NULL}; - sim.eval_ctx = eff->eval_ctx; + sim.depsgraph = eff->depsgraph; sim.scene= eff->scene; sim.ob= eff->ob; sim.psys= eff->psys; diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index d0d3317b477..c79b2bb4aee 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -64,7 +64,7 @@ // file handling //------------------------------------------------------------------------------- -void initElbeemMesh(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, +void initElbeemMesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int *numVertices, float **vertices, int *numTriangles, int **triangles, int useGlobalCoords, int modifierIndex) @@ -77,7 +77,7 @@ void initElbeemMesh(const struct EvaluationContext *eval_ctx, struct Scene *scen float *verts; int *tris; - dm = mesh_create_derived_index_render(eval_ctx, scene, ob, CD_MASK_BAREMESH, modifierIndex); + dm = mesh_create_derived_index_render(depsgraph, scene, ob, CD_MASK_BAREMESH, modifierIndex); mvert = dm->getVertArray(dm); mloop = dm->getLoopArray(dm); diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 7566d370c45..ae031d21b88 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -334,7 +334,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode) * you can draw everything, leaves tags in objects to signal it needs further updating */ /* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */ -void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx, Scene *scene, Object *UNUSED(parent), Group *group) +void BKE_group_handle_recalc_and_update(struct Depsgraph *depsgraph, Scene *scene, Object *UNUSED(parent), Group *group) { #if 0 /* warning, isn't clearing the recalc flag on the object which causes it to run all the time, * not just on frame change. @@ -354,7 +354,7 @@ void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx go->ob->recalc = go->recalc; group_replaces_nla(parent, go->ob, 's'); - BKE_object_handle_update(eval_ctx, scene, go->ob); + BKE_object_handle_update(depsgraph, scene, go->ob); group_replaces_nla(parent, go->ob, 'e'); /* leave recalc tags in case group members are in normal scene */ @@ -372,7 +372,7 @@ void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx FOREACH_GROUP_OBJECT_BEGIN(group, object) { if (object->id.recalc & ID_RECALC_ALL) { - BKE_object_handle_update(eval_ctx, scene, object); + BKE_object_handle_update(depsgraph, scene, object); } } FOREACH_GROUP_OBJECT_END; @@ -381,9 +381,9 @@ void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx /* ******** Dependency graph evaluation ******** */ -void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx, +void BKE_group_eval_view_layers(struct Depsgraph *depsgraph, Group *group) { DEG_debug_print_eval(__func__, group->id.name, group); - BKE_layer_eval_view_layer(eval_ctx, &group->id, group->view_layer); + BKE_layer_eval_view_layer(depsgraph, &group->id, group->view_layer); } diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index c41ad78977e..b9e6e0e8fa9 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -1026,7 +1026,7 @@ void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]) } } -void BKE_lattice_modifiers_calc(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { Lattice *lt = ob->data; VirtualModifierData virtualModifierData; @@ -1053,7 +1053,7 @@ void BKE_lattice_modifiers_calc(const struct EvaluationContext *eval_ctx, Scene if (mti->type != eModifierTypeType_OnlyDeform) continue; if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts); - mti->deformVerts(md, eval_ctx, ob, NULL, vertexCos, numVerts, 0); + mti->deformVerts(md, depsgraph, ob, NULL, vertexCos, numVerts, 0); } /* always displist to make this work like derivedmesh */ @@ -1227,7 +1227,7 @@ void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys) /* **** Depsgraph evaluation **** */ -void BKE_lattice_eval_geometry(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_lattice_eval_geometry(struct Depsgraph *UNUSED(depsgraph), Lattice *UNUSED(latt)) { } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 5f24dd481e2..2e4dd1b0d62 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -44,8 +44,6 @@ #include "BKE_workspace.h" #include "BKE_object.h" -#include "DEG_depsgraph.h" - #include "DNA_group_types.h" #include "DNA_ID.h" #include "DNA_layer_types.h" @@ -55,6 +53,9 @@ #include "DNA_windowmanager_types.h" #include "DNA_workspace_types.h" +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + #include "DRW_engine.h" #include "MEM_guardedalloc.h" @@ -2342,13 +2343,13 @@ static const char *collection_type_lookup[] = * \note We can't use layer_collection->flag because of 3 level nesting (where parent is visible, but not grand-parent) * So layer_collection->flag_evaluated is expected to be up to date with layer_collection->flag. */ -static bool layer_collection_visible_get(const EvaluationContext *eval_ctx, LayerCollection *layer_collection) +static bool layer_collection_visible_get(Depsgraph *depsgraph, LayerCollection *layer_collection) { if (layer_collection->flag_evaluated & COLLECTION_DISABLED) { return false; } - if (eval_ctx->mode == DAG_EVAL_VIEWPORT) { + if (DEG_get_mode(depsgraph) == DAG_EVAL_VIEWPORT) { return (layer_collection->flag_evaluated & COLLECTION_VIEWPORT) != 0; } else { @@ -2356,7 +2357,7 @@ static bool layer_collection_visible_get(const EvaluationContext *eval_ctx, Laye } } -static void layer_eval_layer_collection(const EvaluationContext *eval_ctx, +static void layer_eval_layer_collection(Depsgraph *depsgraph, LayerCollection *layer_collection, LayerCollection *parent_layer_collection) { @@ -2377,7 +2378,7 @@ static void layer_eval_layer_collection(const EvaluationContext *eval_ctx, layer_collection->flag_evaluated = layer_collection->flag; if (parent_layer_collection != NULL) { - if (layer_collection_visible_get(eval_ctx, parent_layer_collection) == false) { + if (layer_collection_visible_get(depsgraph, parent_layer_collection) == false) { layer_collection->flag_evaluated |= COLLECTION_DISABLED; } @@ -2388,7 +2389,7 @@ static void layer_eval_layer_collection(const EvaluationContext *eval_ctx, } } - const bool is_visible = layer_collection_visible_get(eval_ctx, layer_collection); + const bool is_visible = layer_collection_visible_get(depsgraph, layer_collection); const bool is_selectable = is_visible && ((layer_collection->flag_evaluated & COLLECTION_SELECTABLE) != 0); /* overrides */ @@ -2435,7 +2436,7 @@ static void layer_eval_layer_collection_post(ViewLayer *view_layer) } } -static void layer_eval_collections_recurse(const EvaluationContext *eval_ctx, +static void layer_eval_collections_recurse(Depsgraph *depsgraph, ListBase *layer_collections, LayerCollection *parent_layer_collection) { @@ -2443,27 +2444,27 @@ static void layer_eval_collections_recurse(const EvaluationContext *eval_ctx, layer_collection != NULL; layer_collection = layer_collection->next) { - layer_eval_layer_collection(eval_ctx, + layer_eval_layer_collection(depsgraph, layer_collection, parent_layer_collection); - layer_eval_collections_recurse(eval_ctx, + layer_eval_collections_recurse(depsgraph, &layer_collection->layer_collections, layer_collection); } } -void BKE_layer_eval_view_layer(const struct EvaluationContext *eval_ctx, +void BKE_layer_eval_view_layer(struct Depsgraph *depsgraph, struct ID *owner_id, ViewLayer *view_layer) { layer_eval_layer_collection_pre(owner_id, view_layer); - layer_eval_collections_recurse(eval_ctx, + layer_eval_collections_recurse(depsgraph, &view_layer->layer_collections, NULL); layer_eval_layer_collection_post(view_layer); } -void BKE_layer_eval_view_layer_indexed(const struct EvaluationContext *eval_ctx, +void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph, struct ID *owner_id, int view_layer_index) { @@ -2472,7 +2473,7 @@ void BKE_layer_eval_view_layer_indexed(const struct EvaluationContext *eval_ctx, Scene *scene = (Scene *)owner_id; ViewLayer *view_layer = BLI_findlink(&scene->view_layers, view_layer_index); BLI_assert(view_layer != NULL); - BKE_layer_eval_view_layer(eval_ctx, owner_id, view_layer); + BKE_layer_eval_view_layer(depsgraph, owner_id, view_layer); } /** diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 6ec2d223e84..c0eb9e77087 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1466,7 +1466,6 @@ void BKE_library_free(Library *lib) Main *BKE_main_new(void) { Main *bmain = MEM_callocN(sizeof(Main), "new main"); - bmain->eval_ctx = DEG_evaluation_context_new(DAG_EVAL_VIEWPORT); bmain->lock = MEM_mallocN(sizeof(SpinLock), "main lock"); BLI_spin_init((SpinLock *)bmain->lock); return bmain; @@ -1541,7 +1540,6 @@ void BKE_main_free(Main *mainvar) BLI_spin_end((SpinLock *)mainvar->lock); MEM_freeN(mainvar->lock); - DEG_evaluation_context_free(mainvar->eval_ctx); MEM_freeN(mainvar); } diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 61c136d2c4f..651bcddc84a 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -40,11 +40,13 @@ #include "BLI_math.h" #include "DNA_mask_types.h" +#include "DNA_object_types.h" #include "BKE_curve.h" #include "BKE_mask.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) { @@ -896,24 +898,26 @@ void BKE_mask_layer_evaluate_deform(MaskLayer *masklay, const float ctime) } } -void BKE_mask_eval_animation(struct EvaluationContext *eval_ctx, Mask *mask) +void BKE_mask_eval_animation(struct Depsgraph *depsgraph, Mask *mask) { + float ctime = DEG_get_ctime(depsgraph); DEG_debug_print_eval(__func__, mask->id.name, mask); for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) { - BKE_mask_layer_evaluate_animation(mask_layer, eval_ctx->ctime); + BKE_mask_layer_evaluate_animation(mask_layer, ctime); } } -void BKE_mask_eval_update(struct EvaluationContext *eval_ctx, Mask *mask) +void BKE_mask_eval_update(struct Depsgraph *depsgraph, Mask *mask) { + float ctime = DEG_get_ctime(depsgraph); DEG_debug_print_eval(__func__, mask->id.name, mask); for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) { - BKE_mask_layer_evaluate_deform(mask_layer, eval_ctx->ctime); + BKE_mask_layer_evaluate_deform(mask_layer, ctime); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 2971f56c775..f80f726607b 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1777,7 +1777,7 @@ bool BKE_object_material_edit_image_set(Object *ob, short mat_nr, Image *image) return false; } -void BKE_material_eval(const struct EvaluationContext *UNUSED(eval_ctx), Material *material) +void BKE_material_eval(struct Depsgraph *UNUSED(depsgraph), Material *material) { DEG_debug_print_eval(__func__, material->id.name, material); if ((BLI_listbase_is_empty(&material->gpumaterial) == false)) { diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index cc801b2d8c3..47f15e99b5f 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -329,12 +329,14 @@ void BKE_mball_properties_copy(Scene *scene, Object *active_object) int basisnr, obnr; char basisname[MAX_ID_NAME], obname[MAX_ID_NAME]; SceneBaseIter iter; - struct EvaluationContext *eval_ctx = G.main->eval_ctx; BLI_split_name_num(basisname, &basisnr, active_object->id.name + 2, '.'); - BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, NULL, NULL); - while (BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 1, &base, &ob)) { + /* Pass depsgraph as NULL, which means we will not expand into + * duplis unlike when we generate the mball. Expanding duplis + * would not be compatible when editing multiple view layers. */ + BKE_scene_base_iter_next(NULL, &iter, &sce_iter, 0, NULL, NULL); + while (BKE_scene_base_iter_next(NULL, &iter, &sce_iter, 1, &base, &ob)) { if (ob->type == OB_MBALL) { if (ob != active_object) { BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); @@ -541,7 +543,7 @@ void BKE_mball_select_swap(struct MetaBall *mb) /* **** Depsgraph evaluation **** */ -void BKE_mball_eval_geometry(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_mball_eval_geometry(struct Depsgraph *UNUSED(depsgraph), MetaBall *UNUSED(mball)) { } diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index 5e63b5c1607..0f13618c76a 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -53,6 +53,7 @@ #include "BKE_mball_tessellate.h" /* own include */ #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "BLI_strict_flags.h" @@ -1056,7 +1057,7 @@ static void polygonize(PROCESS *process) * Iterates over ALL objects in the scene and all of its sets, including * making all duplis(not only metas). Copies metas to mainb array. * Computes bounding boxes for building BVH. */ -static void init_meta(const EvaluationContext *eval_ctx, PROCESS *process, Scene *scene, Object *ob) +static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Object *ob) { Scene *sce_iter = scene; Base *base; @@ -1075,8 +1076,8 @@ static void init_meta(const EvaluationContext *eval_ctx, PROCESS *process, Scene BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); /* make main array */ - BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 0, NULL, NULL); - while (BKE_scene_base_iter_next(eval_ctx, &iter, &sce_iter, 1, &base, &bob)) { + BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, NULL, NULL); + while (BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 1, &base, &bob)) { if (bob->type == OB_MBALL) { zero_size = 0; ml = NULL; @@ -1233,12 +1234,13 @@ static void init_meta(const EvaluationContext *eval_ctx, PROCESS *process, Scene } } -void BKE_mball_polygonize(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ListBase *dispbase) +void BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase) { MetaBall *mb; DispList *dl; unsigned int a; PROCESS process = {0}; + bool is_render = DEG_get_mode(depsgraph) == DAG_EVAL_RENDER; mb = ob->data; @@ -1249,10 +1251,10 @@ void BKE_mball_polygonize(const EvaluationContext *eval_ctx, Scene *scene, Objec else if (process.thresh < 0.1f) process.converge_res = 4; else process.converge_res = 2; - if ((eval_ctx->mode != DAG_EVAL_RENDER) && (mb->flag == MB_UPDATE_NEVER)) return; + if (is_render && (mb->flag == MB_UPDATE_NEVER)) return; if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) return; - if (eval_ctx->mode == DAG_EVAL_RENDER) { + if (is_render) { process.size = mb->rendersize; } else { @@ -1267,7 +1269,7 @@ void BKE_mball_polygonize(const EvaluationContext *eval_ctx, Scene *scene, Objec process.pgn_elements = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "Metaball memarena"); /* initialize all mainb (MetaElems) */ - init_meta(eval_ctx, &process, scene, ob); + init_meta(depsgraph, &process, scene, ob); if (process.totelem > 0) { build_bvh_spatial(&process, &process.metaball_bvh, 0, process.totelem, &process.allbb); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index af92422f4c3..bbe5fd9765e 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1643,10 +1643,10 @@ void BKE_mesh_to_curve_nurblist(DerivedMesh *dm, ListBase *nurblist, const int e } } -void BKE_mesh_to_curve(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_mesh_to_curve(Depsgraph *depsgraph, Scene *scene, Object *ob) { /* make new mesh data from the original copy */ - DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_MESH); + DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_MESH); ListBase nurblist = {NULL, NULL}; bool needsFree = false; @@ -2428,13 +2428,13 @@ void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals) /* settings: 1 - preview, 2 - render */ Mesh *BKE_mesh_new_from_object( - const EvaluationContext *eval_ctx, Main *bmain, Scene *sce, Object *ob, + Depsgraph *depsgraph, Main *bmain, Scene *sce, Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed) { Mesh *tmpmesh; Curve *tmpcu = NULL, *copycu; int i; - const bool render = (DEG_get_mode(eval_ctx->depsgraph) == DAG_EVAL_RENDER); + const bool render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); const bool cage = !apply_modifiers; bool do_mat_id_data_us = true; @@ -2487,7 +2487,7 @@ Mesh *BKE_mesh_new_from_object( copycu->editnurb = tmpcu->editnurb; /* get updated display list, and convert to a mesh */ - BKE_displist_make_curveTypes_forRender(eval_ctx, sce, tmpobj, &dispbase, &derivedFinal, false, render); + BKE_displist_make_curveTypes_forRender(depsgraph, sce, tmpobj, &dispbase, &derivedFinal, false, render); copycu->editfont = NULL; copycu->editnurb = NULL; @@ -2536,7 +2536,7 @@ Mesh *BKE_mesh_new_from_object( if (render) { ListBase disp = {NULL, NULL}; - BKE_displist_make_mball_forRender(eval_ctx, sce, ob, &disp); + BKE_displist_make_mball_forRender(depsgraph, sce, ob, &disp); BKE_mesh_from_metaball(&disp, tmpmesh); BKE_displist_free(&disp); } @@ -2575,9 +2575,9 @@ Mesh *BKE_mesh_new_from_object( /* Write the display mesh into the dummy mesh */ if (render) - dm = mesh_create_derived_render(eval_ctx, sce, ob, mask); + dm = mesh_create_derived_render(depsgraph, sce, ob, mask); else - dm = mesh_create_derived_view(eval_ctx, sce, ob, mask); + dm = mesh_create_derived_view(depsgraph, sce, ob, mask); tmpmesh = BKE_mesh_add(bmain, ((ID *)ob->data)->name + 2); DM_to_mesh(dm, tmpmesh, ob, mask, true); @@ -2668,7 +2668,7 @@ Mesh *BKE_mesh_new_from_object( /* **** Depsgraph evaluation **** */ -void BKE_mesh_eval_geometry(const EvaluationContext *UNUSED(eval_ctx), +void BKE_mesh_eval_geometry(Depsgraph *UNUSED(depsgraph), Mesh *mesh) { DEG_debug_print_eval(__func__, mesh->id.name, mesh); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 5eb5272f3e5..c15ae9e4a7c 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -786,7 +786,7 @@ void modifier_path_init(char *path, int path_maxlen, const char *name) /* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */ struct DerivedMesh *modwrap_applyModifier( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct DerivedMesh *dm, ModifierApplyFlag flag) { @@ -796,11 +796,11 @@ struct DerivedMesh *modwrap_applyModifier( if (mti->dependsOnNormals && mti->dependsOnNormals(md)) { DM_ensure_normals(dm); } - return mti->applyModifier(md, eval_ctx, ob, dm, flag); + return mti->applyModifier(md, depsgraph, ob, dm, flag); } struct DerivedMesh *modwrap_applyModifierEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em, DerivedMesh *dm, ModifierApplyFlag flag) @@ -811,11 +811,11 @@ struct DerivedMesh *modwrap_applyModifierEM( if (mti->dependsOnNormals && mti->dependsOnNormals(md)) { DM_ensure_normals(dm); } - return mti->applyModifierEM(md, eval_ctx, ob, em, dm, flag); + return mti->applyModifierEM(md, depsgraph, ob, em, dm, flag); } void modwrap_deformVerts( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts, ModifierApplyFlag flag) @@ -826,11 +826,11 @@ void modwrap_deformVerts( if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) { DM_ensure_normals(dm); } - mti->deformVerts(md, eval_ctx, ob, dm, vertexCos, numVerts, flag); + mti->deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, flag); } void modwrap_deformVertsEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { @@ -840,6 +840,6 @@ void modwrap_deformVertsEM( if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) { DM_ensure_normals(dm); } - mti->deformVertsEM(md, eval_ctx, ob, em, dm, vertexCos, numVerts); + mti->deformVertsEM(md, depsgraph, ob, em, dm, vertexCos, numVerts); } /* end modifier callback wrappers */ diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 9ed715d7591..36a5a60635a 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1609,7 +1609,7 @@ bool BKE_movieclip_put_frame_if_possible(MovieClip *clip, return result; } -void BKE_movieclip_eval_update(struct EvaluationContext *UNUSED(eval_ctx), MovieClip *clip) +void BKE_movieclip_eval_update(struct Depsgraph *UNUSED(depsgraph), MovieClip *clip) { DEG_debug_print_eval(__func__, clip->id.name, clip); BKE_tracking_dopesheet_tag_update(&clip->tracking); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 55f11604710..edba03dd707 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -277,14 +277,14 @@ static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level) return mdisps; } -DerivedMesh *get_multires_dm(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *ob) +DerivedMesh *get_multires_dm(struct Depsgraph *depsgraph, Scene *scene, MultiresModifierData *mmd, Object *ob) { ModifierData *md = (ModifierData *)mmd; const ModifierTypeInfo *mti = modifierType_getInfo(md->type); - DerivedMesh *tdm = mesh_get_derived_deform(eval_ctx, scene, ob, CD_MASK_BAREMESH); + DerivedMesh *tdm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); DerivedMesh *dm; - dm = mti->applyModifier(md, eval_ctx, ob, tdm, MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY); + dm = mti->applyModifier(md, depsgraph, ob, tdm, MOD_APPLY_USECACHE | MOD_APPLY_IGNORE_SIMPLIFY); if (dm == tdm) { dm = CDDM_copy(tdm); } @@ -398,10 +398,10 @@ void multires_force_render_update(Object *ob) multires_force_update(ob); } -int multiresModifier_reshapeFromDM(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, +int multiresModifier_reshapeFromDM(struct Depsgraph *depsgraph, Scene *scene, MultiresModifierData *mmd, Object *ob, DerivedMesh *srcdm) { - DerivedMesh *mrdm = get_multires_dm(eval_ctx, scene, mmd, ob); + DerivedMesh *mrdm = get_multires_dm(depsgraph, scene, mmd, ob); if (mrdm && srcdm && mrdm->getNumVerts(mrdm) == srcdm->getNumVerts(srcdm)) { multires_mvert_to_ss(mrdm, srcdm->getVertArray(srcdm)); @@ -420,13 +420,13 @@ int multiresModifier_reshapeFromDM(const struct EvaluationContext *eval_ctx, Sce } /* Returns 1 on success, 0 if the src's totvert doesn't match */ -int multiresModifier_reshape(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, Object *dst, Object *src) +int multiresModifier_reshape(struct Depsgraph *depsgraph, Scene *scene, MultiresModifierData *mmd, Object *dst, Object *src) { - DerivedMesh *srcdm = mesh_get_derived_final(eval_ctx, scene, src, CD_MASK_BAREMESH); - return multiresModifier_reshapeFromDM(eval_ctx, scene, mmd, dst, srcdm); + DerivedMesh *srcdm = mesh_get_derived_final(depsgraph, scene, src, CD_MASK_BAREMESH); + return multiresModifier_reshapeFromDM(depsgraph, scene, mmd, dst, srcdm); } -int multiresModifier_reshapeFromDeformMod(const struct EvaluationContext *eval_ctx, Scene *scene, MultiresModifierData *mmd, +int multiresModifier_reshapeFromDeformMod(struct Depsgraph *depsgraph, Scene *scene, MultiresModifierData *mmd, Object *ob, ModifierData *md) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -438,12 +438,12 @@ int multiresModifier_reshapeFromDeformMod(const struct EvaluationContext *eval_c return 0; /* Create DerivedMesh for deformation modifier */ - dm = get_multires_dm(eval_ctx, scene, mmd, ob); + dm = get_multires_dm(depsgraph, scene, mmd, ob); numVerts = dm->getNumVerts(dm); deformedVerts = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "multiresReshape_deformVerts"); dm->getVertCos(dm, deformedVerts); - mti->deformVerts(md, eval_ctx, ob, dm, deformedVerts, numVerts, 0); + mti->deformVerts(md, depsgraph, ob, dm, deformedVerts, numVerts, 0); ndm = CDDM_copy(dm); CDDM_apply_vert_coords(ndm, deformedVerts); @@ -452,7 +452,7 @@ int multiresModifier_reshapeFromDeformMod(const struct EvaluationContext *eval_c dm->release(dm); /* Reshaping */ - result = multiresModifier_reshapeFromDM(eval_ctx, scene, mmd, ob, ndm); + result = multiresModifier_reshapeFromDM(depsgraph, scene, mmd, ob, ndm); /* Cleanup */ ndm->release(ndm); @@ -2275,7 +2275,7 @@ static void multires_apply_smat_cb( } } -static void multires_apply_smat(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float smat[3][3]) +static void multires_apply_smat(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float smat[3][3]) { DerivedMesh *dm = NULL, *cddm = NULL, *subdm = NULL; CCGElem **gridData, **subGridData; @@ -2300,10 +2300,10 @@ static void multires_apply_smat(const struct EvaluationContext *eval_ctx, Scene high_mmd.lvl = high_mmd.totlvl; /* unscaled multires with applied displacement */ - subdm = get_multires_dm(eval_ctx, scene, &high_mmd, ob); + subdm = get_multires_dm(depsgraph, scene, &high_mmd, ob); /* prepare scaled CDDM to create ccgDN */ - cddm = mesh_get_derived_deform(eval_ctx, scene, ob, CD_MASK_BAREMESH); + cddm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH); totvert = cddm->getNumVerts(cddm); vertCos = MEM_malloc_arrayN(totvert, sizeof(*vertCos), "multiresScale vertCos"); @@ -2364,17 +2364,17 @@ int multires_mdisp_corners(MDisps *s) return 0; } -void multiresModifier_scale_disp(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void multiresModifier_scale_disp(struct Depsgraph *depsgraph, Scene *scene, Object *ob) { float smat[3][3]; /* object's scale matrix */ BKE_object_scale_to_mat3(ob, smat); - multires_apply_smat(eval_ctx, scene, ob, smat); + multires_apply_smat(depsgraph, scene, ob, smat); } -void multiresModifier_prepare_join(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *to_ob) +void multiresModifier_prepare_join(struct Depsgraph *depsgraph, Scene *scene, Object *ob, Object *to_ob) { float smat[3][3], tmat[3][3], mat[3][3]; multires_sync_levels(scene, to_ob, ob); @@ -2385,7 +2385,7 @@ void multiresModifier_prepare_join(const struct EvaluationContext *eval_ctx, Sce BKE_object_scale_to_mat3(ob, smat); mul_m3_m3m3(mat, smat, tmat); - multires_apply_smat(eval_ctx, scene, ob, mat); + multires_apply_smat(depsgraph, scene, ob, mat); } /* update multires data after topology changing */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 41b7cd1f48e..845880fb60d 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3869,7 +3869,7 @@ void BKE_nodetree_copy_default_values(bNodeTree *ntree_dst, } } -void BKE_nodetree_shading_params_eval(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_nodetree_shading_params_eval(struct Depsgraph *UNUSED(depsgraph), bNodeTree *ntree_dst, const bNodeTree *ntree_src) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 081f9f15508..f59a942c683 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1826,7 +1826,7 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4]) if (scene == NULL) { return false; } - BKE_displist_make_curveTypes(eval_ctx, scene, par, 0); + BKE_displist_make_curveTypes(depsgraph, scene, par, 0); } #endif @@ -2210,7 +2210,7 @@ static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat /* note, scene is the active scene while actual_scene is the scene the object resides in */ void BKE_object_where_is_calc_time_ex( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime, + Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime, RigidBodyWorld *rbw, float r_originmat[3][3]) { if (ob == NULL) return; @@ -2246,7 +2246,7 @@ void BKE_object_where_is_calc_time_ex( if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) { bConstraintOb *cob; cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - BKE_constraints_solve(eval_ctx, &ob->constraints, cob, ctime); + BKE_constraints_solve(depsgraph, &ob->constraints, cob, ctime); BKE_constraints_clear_evalob(cob); } @@ -2255,9 +2255,9 @@ void BKE_object_where_is_calc_time_ex( else ob->transflag &= ~OB_NEG_SCALE; } -void BKE_object_where_is_calc_time(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) +void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime) { - BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, ctime, NULL, NULL); + BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, NULL, NULL); } /* get object transformation matrix without recalculating dependencies and @@ -2282,17 +2282,17 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) } } -void BKE_object_where_is_calc_ex(const EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3]) +void BKE_object_where_is_calc_ex(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3]) { - BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat); + BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat); } -void BKE_object_where_is_calc(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob) { - BKE_object_where_is_calc_time_ex(eval_ctx, scene, ob, BKE_scene_frame_get(scene), NULL, NULL); + BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, BKE_scene_frame_get(scene), NULL, NULL); } /* for calculation of the inverse parent transform, only used for editor */ -void BKE_object_workob_calc_parent(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *workob) +void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *ob, Object *workob) { BKE_object_workob_clear(workob); @@ -2314,7 +2314,7 @@ void BKE_object_workob_calc_parent(const EvaluationContext *eval_ctx, Scene *sce BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr)); - BKE_object_where_is_calc(eval_ctx, scene, workob); + BKE_object_where_is_calc(depsgraph, scene, workob); } /* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */ @@ -2570,7 +2570,7 @@ void BKE_object_empty_draw_type_set(Object *ob, const int value) } } -bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden) +bool BKE_object_minmax_dupli(Depsgraph *depsgraph, Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden) { bool ok = false; if ((ob->transflag & OB_DUPLI) == 0) { @@ -2579,7 +2579,7 @@ bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_m else { ListBase *lb; DupliObject *dob; - lb = object_duplilist(G.main->eval_ctx, scene, ob); + lb = object_duplilist(depsgraph, scene, ob); for (dob = lb->first; dob; dob = dob->next) { if ((use_hidden == false) && (dob->no_draw != 0)) { /* pass */ @@ -2639,7 +2639,7 @@ void BKE_object_foreach_display_point( } void BKE_scene_foreach_display_point( - Scene *scene, ViewLayer *view_layer, + Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, void (*func_cb)(const float[3], void *), void *user_data) { Base *base; @@ -2656,7 +2656,7 @@ void BKE_scene_foreach_display_point( ListBase *lb; DupliObject *dob; - lb = object_duplilist(G.main->eval_ctx, scene, ob); + lb = object_duplilist(depsgraph, scene, ob); for (dob = lb->first; dob; dob = dob->next) { if (dob->no_draw == 0) { BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data); @@ -2736,7 +2736,7 @@ bool BKE_object_parent_loop_check(const Object *par, const Object *ob) return BKE_object_parent_loop_check(par->parent, ob); } -static void object_handle_update_proxy(const EvaluationContext *eval_ctx, +static void object_handle_update_proxy(Depsgraph *depsgraph, Scene *scene, Object *object, const bool do_proxy_update) @@ -2753,7 +2753,7 @@ static void object_handle_update_proxy(const EvaluationContext *eval_ctx, if (object->proxy_group == NULL) { if (do_proxy_update) { // printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name); - BKE_object_handle_update(eval_ctx, scene, object->proxy); + BKE_object_handle_update(depsgraph, scene, object->proxy); } } } @@ -2766,7 +2766,7 @@ static void object_handle_update_proxy(const EvaluationContext *eval_ctx, /* the main object update call, for object matrix, constraints, keys and displist (modifiers) */ /* requires flags to be set! */ /* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */ -void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx, +void BKE_object_handle_update_ex(Depsgraph *depsgraph, Scene *scene, Object *ob, RigidBodyWorld *rbw, const bool do_proxy_update) @@ -2777,7 +2777,7 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx, (object_data != NULL) ? ((object_data->recalc & ID_RECALC_ALL) != 0) : 0; if (!recalc_object && ! recalc_data) { - object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update); + object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update); return; } /* Speed optimization for animation lookups. */ @@ -2805,18 +2805,18 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx, printf("recalcob %s\n", ob->id.name + 2); } /* Handle proxy copy for target. */ - if (!BKE_object_eval_proxy_copy(eval_ctx, ob)) { - BKE_object_where_is_calc_ex(eval_ctx, scene, rbw, ob, NULL); + if (!BKE_object_eval_proxy_copy(depsgraph, ob)) { + BKE_object_where_is_calc_ex(depsgraph, scene, rbw, ob, NULL); } } if (recalc_data) { - BKE_object_handle_data_update(eval_ctx, scene, ob); + BKE_object_handle_data_update(depsgraph, scene, ob); } ob->id.recalc &= ID_RECALC_ALL; - object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update); + object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update); } /* WARNING: "scene" here may not be the scene object actually resides in. @@ -2824,9 +2824,9 @@ void BKE_object_handle_update_ex(const EvaluationContext *eval_ctx, * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n * rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world */ -void BKE_object_handle_update(const EvaluationContext *eval_ctx, Scene *scene, Object *ob) +void BKE_object_handle_update(Depsgraph *depsgraph, Scene *scene, Object *ob) { - BKE_object_handle_update_ex(eval_ctx, scene, ob, NULL, true); + BKE_object_handle_update_ex(depsgraph, scene, ob, NULL, true); } void BKE_object_sculpt_modifiers_changed(Object *ob) @@ -3744,7 +3744,7 @@ static void object_cacheIgnoreClear(Object *ob, int state) * Avoid calling this in new code unless there is a very good reason for it! */ bool BKE_object_modifier_update_subframe( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update_mesh, + Depsgraph *depsgraph, Scene *scene, Object *ob, bool update_mesh, int parent_recursion, float frame, int type) { ModifierData *md = modifiers_findByType(ob, (ModifierType)type); @@ -3768,8 +3768,8 @@ bool BKE_object_modifier_update_subframe( if (parent_recursion) { int recursion = parent_recursion - 1; bool no_update = false; - if (ob->parent) no_update |= BKE_object_modifier_update_subframe(eval_ctx, scene, ob->parent, 0, recursion, frame, type); - if (ob->track) no_update |= BKE_object_modifier_update_subframe(eval_ctx, scene, ob->track, 0, recursion, frame, type); + if (ob->parent) no_update |= BKE_object_modifier_update_subframe(depsgraph, scene, ob->parent, 0, recursion, frame, type); + if (ob->track) no_update |= BKE_object_modifier_update_subframe(depsgraph, scene, ob->track, 0, recursion, frame, type); /* skip subframe if object is parented * to vertex of a dynamic paint canvas */ @@ -3786,7 +3786,7 @@ bool BKE_object_modifier_update_subframe( cti->get_constraint_targets(con, &targets); for (ct = targets.first; ct; ct = ct->next) { if (ct->tar) - BKE_object_modifier_update_subframe(eval_ctx, scene, ct->tar, 0, recursion, frame, type); + BKE_object_modifier_update_subframe(depsgraph, scene, ct->tar, 0, recursion, frame, type); } /* free temp targets */ if (cti->flush_constraint_targets) @@ -3803,11 +3803,11 @@ bool BKE_object_modifier_update_subframe( /* ignore cache clear during subframe updates * to not mess up cache validity */ object_cacheIgnoreClear(ob, 1); - BKE_object_handle_update(G.main->eval_ctx, scene, ob); + BKE_object_handle_update(depsgraph, scene, ob); object_cacheIgnoreClear(ob, 0); } else - BKE_object_where_is_calc_time(eval_ctx, scene, ob, frame); + BKE_object_where_is_calc_time(depsgraph, scene, ob, frame); /* for curve following objects, parented curve has to be updated too */ if (ob->type == OB_CURVE) { @@ -3818,7 +3818,7 @@ bool BKE_object_modifier_update_subframe( if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; BKE_animsys_evaluate_animdata(scene, &arm->id, arm->adt, frame, ADT_RECALC_ANIM); - BKE_pose_where_is(eval_ctx, scene, ob); + BKE_pose_where_is(depsgraph, scene, ob); } return false; diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 1b976fef166..35f86cd0c81 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -63,6 +63,7 @@ #include "BKE_anim.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "BLI_strict_flags.h" #include "BLI_hash.h" @@ -70,7 +71,7 @@ /* Dupli-Geometry */ typedef struct DupliContext { - const EvaluationContext *eval_ctx; + Depsgraph *depsgraph; bool do_update; bool animated; Group *group; /* XXX child objects are selected from this group if set, could be nicer */ @@ -98,13 +99,13 @@ typedef struct DupliGenerator { static const DupliGenerator *get_dupli_generator(const DupliContext *ctx); /* create initial context for root object */ -static void init_context(DupliContext *r_ctx, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, float space_mat[4][4], bool update) +static void init_context(DupliContext *r_ctx, Depsgraph *depsgraph, Scene *scene, Object *ob, float space_mat[4][4], bool update) { - r_ctx->eval_ctx = eval_ctx; + r_ctx->depsgraph = depsgraph; r_ctx->scene = scene; - r_ctx->view_layer = eval_ctx->view_layer; + r_ctx->view_layer = DEG_get_evaluated_view_layer(depsgraph); /* don't allow BKE_object_handle_update for viewport during render, can crash */ - r_ctx->do_update = update && !(G.is_rendering && eval_ctx->mode != DAG_EVAL_RENDER); + r_ctx->do_update = update && !(G.is_rendering && DEG_get_mode(depsgraph) != DAG_EVAL_RENDER); r_ctx->animated = false; r_ctx->group = NULL; @@ -310,7 +311,7 @@ static void make_duplis_group(const DupliContext *ctx) if (ctx->do_update) { /* note: update is optional because we don't always need object * transformations to be correct. Also fixes bug [#29616]. */ - BKE_group_handle_recalc_and_update(ctx->eval_ctx, ctx->scene, ob, group); + BKE_group_handle_recalc_and_update(ctx->depsgraph, ctx->scene, ob, group); } animated = BKE_group_is_animated(group, ob); @@ -383,7 +384,7 @@ static void make_duplis_frames(const DupliContext *ctx) * However, this has always been the way that this worked (i.e. pre 2.5), so I guess that it'll be fine! */ BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */ - BKE_object_where_is_calc_time(ctx->eval_ctx, scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(ctx->depsgraph, scene, ob, (float)scene->r.cfra); make_dupli(ctx, ob, ob->obmat, scene->r.cfra, false, false, NULL); } @@ -397,7 +398,7 @@ static void make_duplis_frames(const DupliContext *ctx) scene->r.cfra = cfrao; BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */ - BKE_object_where_is_calc_time(ctx->eval_ctx, scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(ctx->depsgraph, scene, ob, (float)scene->r.cfra); /* but, to make sure unkeyed object transforms are still sane, * let's copy object's original data back over @@ -519,7 +520,7 @@ static void make_duplis_verts(const DupliContext *ctx) { Scene *scene = ctx->scene; Object *parent = ctx->object; - bool use_texcoords = ELEM(ctx->eval_ctx->mode, DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); + bool use_texcoords = ELEM(DEG_get_mode(ctx->depsgraph), DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); VertexDupliData vdd; vdd.ctx = ctx; @@ -531,14 +532,14 @@ static void make_duplis_verts(const DupliContext *ctx) BMEditMesh *em = BKE_editmesh_from_object(parent); CustomDataMask dm_mask = (use_texcoords ? CD_MASK_BAREMESH | CD_MASK_ORCO : CD_MASK_BAREMESH); - if (ctx->eval_ctx->mode == DAG_EVAL_RENDER) { - vdd.dm = mesh_create_derived_render(ctx->eval_ctx, scene, parent, dm_mask); + if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER) { + vdd.dm = mesh_create_derived_render(ctx->depsgraph, scene, parent, dm_mask); } else if (em) { - vdd.dm = editbmesh_get_derived_cage(ctx->eval_ctx, scene, parent, em, dm_mask); + vdd.dm = editbmesh_get_derived_cage(ctx->depsgraph, scene, parent, em, dm_mask); } else { - vdd.dm = mesh_get_derived_final(ctx->eval_ctx, scene, parent, dm_mask); + vdd.dm = mesh_get_derived_final(ctx->depsgraph, scene, parent, dm_mask); } vdd.edit_btmesh = me->edit_btmesh; @@ -723,7 +724,7 @@ static void make_child_duplis_faces(const DupliContext *ctx, void *userdata, Obj float (*orco)[3] = fdd->orco; MLoopUV *mloopuv = fdd->mloopuv; int a, totface = fdd->totface; - bool use_texcoords = ELEM(ctx->eval_ctx->mode, DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); + bool use_texcoords = ELEM(DEG_get_mode(ctx->depsgraph), DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); float child_imat[4][4]; DupliObject *dob; @@ -789,7 +790,7 @@ static void make_duplis_faces(const DupliContext *ctx) { Scene *scene = ctx->scene; Object *parent = ctx->object; - bool use_texcoords = ELEM(ctx->eval_ctx->mode, DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); + bool use_texcoords = ELEM(DEG_get_mode(ctx->depsgraph), DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); FaceDupliData fdd; fdd.use_scale = ((parent->transflag & OB_DUPLIFACES_SCALE) != 0); @@ -799,14 +800,14 @@ static void make_duplis_faces(const DupliContext *ctx) BMEditMesh *em = BKE_editmesh_from_object(parent); CustomDataMask dm_mask = (use_texcoords ? CD_MASK_BAREMESH | CD_MASK_ORCO | CD_MASK_MLOOPUV : CD_MASK_BAREMESH); - if (ctx->eval_ctx->mode == DAG_EVAL_RENDER) { - fdd.dm = mesh_create_derived_render(ctx->eval_ctx, scene, parent, dm_mask); + if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER) { + fdd.dm = mesh_create_derived_render(ctx->depsgraph, scene, parent, dm_mask); } else if (em) { - fdd.dm = editbmesh_get_derived_cage(ctx->eval_ctx, scene, parent, em, dm_mask); + fdd.dm = editbmesh_get_derived_cage(ctx->depsgraph, scene, parent, em, dm_mask); } else { - fdd.dm = mesh_get_derived_final(ctx->eval_ctx, scene, parent, dm_mask); + fdd.dm = mesh_get_derived_final(ctx->depsgraph, scene, parent, dm_mask); } if (use_texcoords) { @@ -841,8 +842,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem { Scene *scene = ctx->scene; Object *par = ctx->object; - bool for_render = ctx->eval_ctx->mode == DAG_EVAL_RENDER; - bool use_texcoords = ELEM(ctx->eval_ctx->mode, DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); + bool for_render = DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER; + bool use_texcoords = ELEM(DEG_get_mode(ctx->depsgraph), DAG_EVAL_RENDER, DAG_EVAL_PREVIEW); Object *ob = NULL, **oblist = NULL, obcopy, *obcopylist = NULL; DupliObject *dob; @@ -868,7 +869,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem if (part == NULL) return; - if (!psys_check_enabled(par, psys, (ctx->eval_ctx->mode == DAG_EVAL_RENDER))) + if (!psys_check_enabled(par, psys, (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER))) return; if (!for_render) @@ -883,7 +884,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem if ((for_render || part->draw_as == PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { ParticleSimulationData sim = {NULL}; - sim.eval_ctx = ctx->eval_ctx; + sim.depsgraph = ctx->depsgraph; sim.scene = scene; sim.ob = par; sim.psys = psys; @@ -924,7 +925,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem /* gather list of objects or single object */ if (part->ren_as == PART_DRAW_GR) { if (ctx->do_update) { - BKE_group_handle_recalc_and_update(ctx->eval_ctx, scene, par, part->dup_group); + BKE_group_handle_recalc_and_update(ctx->depsgraph, scene, par, part->dup_group); } if (part->draw & PART_DRAW_COUNT_GR) { @@ -1086,7 +1087,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem } else { /* to give ipos in object correct offset */ - BKE_object_where_is_calc_time(ctx->eval_ctx, scene, ob, ctime - pa_time); + BKE_object_where_is_calc_time(ctx->depsgraph, scene, ob, ctime - pa_time); copy_v3_v3(vec, obmat[3]); obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f; @@ -1190,7 +1191,7 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx) return NULL; /* Should the dupli's be generated for this object? - Respect restrict flags */ - if (ctx->eval_ctx->mode == DAG_EVAL_RENDER ? (restrictflag & OB_RESTRICT_RENDER) : (restrictflag & OB_RESTRICT_VIEW)) + if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER ? (restrictflag & OB_RESTRICT_RENDER) : (restrictflag & OB_RESTRICT_VIEW)) return NULL; if (transflag & OB_DUPLIPARTS) { @@ -1222,11 +1223,11 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx) /* ---- ListBase dupli container implementation ---- */ /* Returns a list of DupliObject */ -ListBase *object_duplilist_ex(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, bool update) +ListBase *object_duplilist_ex(Depsgraph *depsgraph, Scene *scene, Object *ob, bool update) { ListBase *duplilist = MEM_callocN(sizeof(ListBase), "duplilist"); DupliContext ctx; - init_context(&ctx, eval_ctx, scene, ob, NULL, update); + init_context(&ctx, depsgraph, scene, ob, NULL, update); if (ctx.gen) { ctx.duplilist = duplilist; ctx.gen->make_duplis(&ctx); @@ -1237,9 +1238,9 @@ ListBase *object_duplilist_ex(const EvaluationContext *eval_ctx, Scene *scene, O /* note: previously updating was always done, this is why it defaults to be on * but there are likely places it can be called without updating */ -ListBase *object_duplilist(const EvaluationContext *eval_ctx, Scene *sce, Object *ob) +ListBase *object_duplilist(Depsgraph *depsgraph, Scene *sce, Object *ob) { - return object_duplilist_ex(eval_ctx, sce, ob, true); + return object_duplilist_ex(depsgraph, sce, ob, true); } void free_object_duplilist(ListBase *lb) @@ -1286,7 +1287,7 @@ int count_duplilist(Object *ob) return 1; } -DupliApplyData *duplilist_apply(const EvaluationContext *eval_ctx, Object *ob, Scene *scene, ListBase *duplilist) +DupliApplyData *duplilist_apply(Depsgraph *depsgraph, Object *ob, Scene *scene, ListBase *duplilist) { DupliApplyData *apply_data = NULL; int num_objects = BLI_listbase_count(duplilist); @@ -1302,7 +1303,7 @@ DupliApplyData *duplilist_apply(const EvaluationContext *eval_ctx, Object *ob, S for (dob = duplilist->first, i = 0; dob; dob = dob->next, ++i) { /* make sure derivedmesh is calculated once, before drawing */ if (scene && !(dob->ob->transflag & OB_DUPLICALCDERIVED) && dob->ob->type == OB_MESH) { - mesh_get_derived_final(eval_ctx, scene, dob->ob, scene->customdata_mask); + mesh_get_derived_final(depsgraph, scene, dob->ob, scene->customdata_mask); dob->ob->transflag |= OB_DUPLICALCDERIVED; } } diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 35ab4024f62..81f15d265a2 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -63,10 +63,12 @@ #include "BKE_image.h" #include "MEM_guardedalloc.h" + #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" -void BKE_object_eval_local_transform(const EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_local_transform(Depsgraph *UNUSED(depsgraph), Object *ob) { DEG_debug_print_eval(__func__, ob->id.name, ob); @@ -77,7 +79,7 @@ void BKE_object_eval_local_transform(const EvaluationContext *UNUSED(eval_ctx), /* Evaluate parent */ /* NOTE: based on solve_parenting(), but with the cruft stripped out */ -void BKE_object_eval_parent(const EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_parent(Depsgraph *UNUSED(depsgraph), Scene *scene, Object *ob) { @@ -109,7 +111,7 @@ void BKE_object_eval_parent(const EvaluationContext *UNUSED(eval_ctx), } } -void BKE_object_eval_constraints(const EvaluationContext *eval_ctx, +void BKE_object_eval_constraints(Depsgraph *depsgraph, Scene *scene, Object *ob) { @@ -128,11 +130,11 @@ void BKE_object_eval_constraints(const EvaluationContext *eval_ctx, * */ cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - BKE_constraints_solve(eval_ctx, &ob->constraints, cob, ctime); + BKE_constraints_solve(depsgraph, &ob->constraints, cob, ctime); BKE_constraints_clear_evalob(cob); } -void BKE_object_eval_done(const EvaluationContext *UNUSED(eval_ctx), Object *ob) +void BKE_object_eval_done(Depsgraph *UNUSED(depsgraph), Object *ob) { DEG_debug_print_eval(__func__, ob->id.name, ob); @@ -142,7 +144,7 @@ void BKE_object_eval_done(const EvaluationContext *UNUSED(eval_ctx), Object *ob) } void BKE_object_handle_data_update( - const EvaluationContext *eval_ctx, + Depsgraph *depsgraph, Scene *scene, Object *ob) { @@ -184,15 +186,15 @@ void BKE_object_handle_data_update( uint64_t data_mask = scene->customdata_mask | CD_MASK_BAREMESH; #ifdef WITH_FREESTYLE /* make sure Freestyle edge/face marks appear in DM for render (see T40315) */ - if (eval_ctx->mode != DAG_EVAL_VIEWPORT) { + if (DEG_get_mode(depsgraph) != DAG_EVAL_VIEWPORT) { data_mask |= CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE; } #endif if (em) { - makeDerivedMesh(eval_ctx, scene, ob, em, data_mask, false); /* was CD_MASK_BAREMESH */ + makeDerivedMesh(depsgraph, scene, ob, em, data_mask, false); /* was CD_MASK_BAREMESH */ } else { - makeDerivedMesh(eval_ctx, scene, ob, NULL, data_mask, false); + makeDerivedMesh(depsgraph, scene, ob, NULL, data_mask, false); } break; } @@ -204,22 +206,22 @@ void BKE_object_handle_data_update( } } else { - BKE_pose_where_is(eval_ctx, scene, ob); + BKE_pose_where_is(depsgraph, scene, ob); } break; case OB_MBALL: - BKE_displist_make_mball(eval_ctx, scene, ob); + BKE_displist_make_mball(depsgraph, scene, ob); break; case OB_CURVE: case OB_SURF: case OB_FONT: - BKE_displist_make_curveTypes(eval_ctx, scene, ob, 0); + BKE_displist_make_curveTypes(depsgraph, scene, ob, 0); break; case OB_LATTICE: - BKE_lattice_modifiers_calc(eval_ctx, scene, ob); + BKE_lattice_modifiers_calc(depsgraph, scene, ob); break; case OB_EMPTY: @@ -231,6 +233,7 @@ void BKE_object_handle_data_update( /* particles */ if (!(ob->mode & OB_MODE_EDIT) && ob->particlesystem.first) { + const bool use_render_params = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); ParticleSystem *tpsys, *psys; DerivedMesh *dm; ob->transflag &= ~OB_DUPLIPARTS; @@ -241,16 +244,16 @@ void BKE_object_handle_data_update( psys_changed_type(ob, psys); } - if (psys_check_enabled(ob, psys, eval_ctx->mode == DAG_EVAL_RENDER)) { + if (psys_check_enabled(ob, psys, use_render_params)) { /* check use of dupli objects here */ - if (psys->part && (psys->part->draw_as == PART_DRAW_REND || eval_ctx->mode == DAG_EVAL_RENDER) && + if (psys->part && (psys->part->draw_as == PART_DRAW_REND || use_render_params) && ((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) || (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group))) { ob->transflag |= OB_DUPLIPARTS; } - particle_system_update(eval_ctx, scene, ob, psys, (eval_ctx->mode == DAG_EVAL_RENDER)); + particle_system_update(depsgraph, scene, ob, psys, use_render_params); psys = psys->next; } else if (psys->flag & PSYS_DELETE) { @@ -263,12 +266,12 @@ void BKE_object_handle_data_update( psys = psys->next; } - if (eval_ctx->mode == DAG_EVAL_RENDER && ob->transflag & OB_DUPLIPARTS) { + if (use_render_params && ob->transflag & OB_DUPLIPARTS) { /* this is to make sure we get render level duplis in groups: * the derivedmesh must be created before init_render_mesh, * since object_duplilist does dupliparticles before that */ CustomDataMask data_mask = CD_MASK_BAREMESH | CD_MASK_MFACE | CD_MASK_MTFACE | CD_MASK_MCOL; - dm = mesh_create_derived_render(eval_ctx, scene, ob, data_mask); + dm = mesh_create_derived_render(depsgraph, scene, ob, data_mask); dm->release(dm); for (psys = ob->particlesystem.first; psys; psys = psys->next) @@ -279,7 +282,7 @@ void BKE_object_handle_data_update( /* quick cache removed */ } -bool BKE_object_eval_proxy_copy(const EvaluationContext *UNUSED(eval_ctx), +bool BKE_object_eval_proxy_copy(Depsgraph *UNUSED(depsgraph), Object *object) { /* Handle proxy copy for target, */ @@ -303,18 +306,18 @@ bool BKE_object_eval_proxy_copy(const EvaluationContext *UNUSED(eval_ctx), return false; } -void BKE_object_eval_uber_transform(const EvaluationContext *eval_ctx, Object *object) +void BKE_object_eval_uber_transform(Depsgraph *depsgraph, Object *object) { - BKE_object_eval_proxy_copy(eval_ctx, object); + BKE_object_eval_proxy_copy(depsgraph, object); } -void BKE_object_eval_uber_data(const EvaluationContext *eval_ctx, +void BKE_object_eval_uber_data(Depsgraph *depsgraph, Scene *scene, Object *ob) { DEG_debug_print_eval(__func__, ob->id.name, ob); BLI_assert(ob->type != OB_ARMATURE); - BKE_object_handle_data_update(eval_ctx, scene, ob); + BKE_object_handle_data_update(depsgraph, scene, ob); switch (ob->type) { case OB_MESH: @@ -386,7 +389,7 @@ void BKE_object_eval_uber_data(const EvaluationContext *eval_ctx, } } -void BKE_object_eval_cloth(const EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_cloth(Depsgraph *UNUSED(depsgraph), Scene *scene, Object *object) { @@ -394,23 +397,23 @@ void BKE_object_eval_cloth(const EvaluationContext *UNUSED(eval_ctx), BKE_ptcache_object_reset(scene, object, PTCACHE_RESET_DEPSGRAPH); } -void BKE_object_eval_transform_all(const EvaluationContext *eval_ctx, +void BKE_object_eval_transform_all(Depsgraph *depsgraph, Scene *scene, Object *object) { /* This mimics full transform update chain from new depsgraph. */ - BKE_object_eval_local_transform(eval_ctx, object); + BKE_object_eval_local_transform(depsgraph, object); if (object->parent != NULL) { - BKE_object_eval_parent(eval_ctx, scene, object); + BKE_object_eval_parent(depsgraph, scene, object); } if (!BLI_listbase_is_empty(&object->constraints)) { - BKE_object_eval_constraints(eval_ctx, scene, object); + BKE_object_eval_constraints(depsgraph, scene, object); } - BKE_object_eval_uber_transform(eval_ctx, object); - BKE_object_eval_done(eval_ctx, object); + BKE_object_eval_uber_transform(depsgraph, object); + BKE_object_eval_done(depsgraph, object); } -void BKE_object_eval_update_shading(const EvaluationContext *UNUSED(eval_ctx), +void BKE_object_eval_update_shading(Depsgraph *UNUSED(depsgraph), Object *object) { DEG_debug_print_eval(__func__, object->id.name, object); @@ -419,7 +422,7 @@ void BKE_object_eval_update_shading(const EvaluationContext *UNUSED(eval_ctx), } } -void BKE_object_data_select_update(const EvaluationContext *UNUSED(eval_ctx), +void BKE_object_data_select_update(Depsgraph *UNUSED(depsgraph), struct ID *object_data) { DEG_debug_print_eval(__func__, object_data->name, object_data); @@ -441,10 +444,10 @@ void BKE_object_data_select_update(const EvaluationContext *UNUSED(eval_ctx), } } -void BKE_object_eval_flush_base_flags(const EvaluationContext *eval_ctx, +void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph, Object *object, int base_index, bool is_from_set) { - ViewLayer *view_layer = eval_ctx->view_layer; + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); BLI_assert(view_layer->object_bases_array != NULL); BLI_assert(base_index >= 0); BLI_assert(base_index < MEM_allocN_len(view_layer->object_bases_array) / sizeof(Base *)); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 20375fe6953..ed1d9519046 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -881,7 +881,7 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) * \param need_mask So the DerivedMesh thats returned has mask data */ void BKE_sculpt_update_mesh_elements( - const EvaluationContext *eval_ctx, Scene *scene, Sculpt *sd, Object *ob, + Depsgraph *depsgraph, Scene *scene, Sculpt *sd, Object *ob, bool need_pmap, bool need_mask) { DerivedMesh *dm; @@ -921,7 +921,7 @@ void BKE_sculpt_update_mesh_elements( ss->kb = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL; - dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH); + dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH); /* VWPaint require mesh info for loop lookup, so require sculpt mode here */ if (mmd && ob->mode & OB_MODE_SCULPT) { @@ -956,7 +956,7 @@ void BKE_sculpt_update_mesh_elements( ss->orig_cos = (ss->kb) ? BKE_keyblock_convert_to_vertcos(ob, ss->kb) : BKE_mesh_vertexCos_get(me, NULL); - BKE_crazyspace_build_sculpt(eval_ctx, scene, ob, &ss->deform_imats, &ss->deform_cos); + BKE_crazyspace_build_sculpt(depsgraph, scene, ob, &ss->deform_imats, &ss->deform_cos); BKE_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos); for (a = 0; a < me->totvert; ++a) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 1917e370aa9..cbc3b17a5c2 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -252,7 +252,7 @@ struct LatticeDeformData *psys_create_lattice_deform_data(ParticleSimulationData { struct LatticeDeformData *lattice_deform_data = NULL; - if (psys_in_edit_mode(sim->eval_ctx->depsgraph, sim->psys) == 0) { + if (psys_in_edit_mode(sim->depsgraph, sim->psys) == 0) { Object *lattice = NULL; ModifierData *md = (ModifierData *)psys_get_modifier(sim->ob, sim->psys); int mode = G.is_rendering ? eModifierMode_Render : eModifierMode_Realtime; @@ -291,7 +291,7 @@ void psys_enable_all(Object *ob) bool psys_in_edit_mode(Depsgraph *depsgraph, ParticleSystem *psys) { - ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); const bool use_render_params = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); return (view_layer->basact && @@ -1654,7 +1654,7 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors) } } -int do_guides(const EvaluationContext *eval_ctx, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time) +int do_guides(Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time) { CurveMapping *clumpcurve = (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) ? part->clumpcurve : NULL; CurveMapping *roughcurve = (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) ? part->roughcurve : NULL; @@ -1717,7 +1717,7 @@ int do_guides(const EvaluationContext *eval_ctx, ParticleSettings *part, ListBas /* curve taper */ if (cu->taperobj) - mul_v3_fl(vec_to_point, BKE_displist_calc_taper(eval_ctx, eff->scene, cu->taperobj, (int)(data->strength * guidetime * 100.0f), 100)); + mul_v3_fl(vec_to_point, BKE_displist_calc_taper(depsgraph, eff->scene, cu->taperobj, (int)(data->strength * guidetime * 100.0f), 100)); else { /* curve size*/ if (cu->flag & CU_PATH_RADIUS) { @@ -1900,7 +1900,7 @@ static bool psys_thread_context_init_path( psys_thread_context_init(ctx, sim); /*---start figuring out what is actually wanted---*/ - if (psys_in_edit_mode(sim->eval_ctx->depsgraph, psys)) { + if (psys_in_edit_mode(sim->depsgraph, psys)) { ParticleEditSettings *pset = &scene->toolsettings->particle; if ((use_render_params == 0) && (psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0) @@ -1997,7 +1997,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp ParticleSystem *psys = ctx->sim.psys; ParticleSettings *part = psys->part; ParticleCacheKey **cache = psys->childcache; - ParticleCacheKey **pcache = psys_in_edit_mode(ctx->sim.eval_ctx->depsgraph, psys) && psys->edit ? psys->edit->pathcache : psys->pathcache; + ParticleCacheKey **pcache = psys_in_edit_mode(ctx->sim.depsgraph, psys) && psys->edit ? psys->edit->pathcache : psys->pathcache; ParticleCacheKey *child, *key[4]; ParticleTexture ptex; float *cpa_fuv = 0, *par_rot = 0, rot[4]; @@ -2421,7 +2421,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re return; #if 0 /* TODO(mai): something is very wrong with these conditionals, they dont make sense and the cache isnt updating */ - if (psys_in_edit_mode(sim->eval_ctx->depsgraph, psys)) + if (psys_in_edit_mode(sim->depsgraph, psys)) if ((psys->edit == NULL || pset->flag & PE_DRAW_PART) == 0) return; #endif @@ -2542,7 +2542,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re if (sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT) == 0) { for (k = 0, ca = cache[p]; k <= segments; k++, ca++) /* ca is safe to cast, since only co and vel are used */ - do_guides(sim->eval_ctx, sim->psys->part, sim->psys->effectors, (ParticleKey *)ca, p, (float)k / (float)segments); + do_guides(sim->depsgraph, sim->psys->part, sim->psys->effectors, (ParticleKey *)ca, p, (float)k / (float)segments); } /* lattices have to be calculated separately to avoid mixups between effector calculations */ @@ -2590,7 +2590,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re if (vg_length) MEM_freeN(vg_length); } -void psys_cache_edit_paths(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params) +void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params) { ParticleCacheKey *ca, **cache = edit->pathcache; ParticleEditSettings *pset = &scene->toolsettings->particle; @@ -2791,7 +2791,7 @@ void psys_cache_edit_paths(const EvaluationContext *eval_ctx, Scene *scene, Obje if (psys) { ParticleSimulationData sim = {0}; - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = ob; sim.psys = psys; @@ -3631,7 +3631,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * pind.bspline = (psys->part->flag & PART_HAIR_BSPLINE); /* pind.dm disabled in editmode means we don't get effectors taken into * account when subdividing for instance */ - pind.dm = psys_in_edit_mode(sim->eval_ctx->depsgraph, psys) ? NULL : psys->hair_out_dm; + pind.dm = psys_in_edit_mode(sim->depsgraph, psys) ? NULL : psys->hair_out_dm; init_particle_interpolation(sim->ob, psys, pa, &pind); do_particle_interpolation(psys, p, pa, t, &pind, state); @@ -3646,7 +3646,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * mul_mat3_m4_v3(hairmat, state->vel); if (sim->psys->effectors && (part->flag & PART_CHILD_GUIDE) == 0) { - do_guides(sim->eval_ctx, sim->psys->part, sim->psys->effectors, state, p, state->time); + do_guides(sim->depsgraph, sim->psys->part, sim->psys->effectors, state, p, state->time); /* TODO: proper velocity handling */ } @@ -4196,10 +4196,10 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] madd_v3_v3fl(center, yvec, bb->offset[1]); } -void psys_apply_hair_lattice(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys) +void psys_apply_hair_lattice(Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys) { ParticleSimulationData sim = {0}; - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = ob; sim.psys = psys; diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index c2640e9b9e2..8d42f2a9b84 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -816,7 +816,7 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, if (part->flag & PART_CHILD_EFFECT) /* state is safe to cast, since only co and vel are used */ - guided = do_guides(sim->eval_ctx, sim->psys->part, sim->psys->effectors, (ParticleKey *)state, cpa->parent, t); + guided = do_guides(sim->depsgraph, sim->psys->part, sim->psys->effectors, (ParticleKey *)state, cpa->parent, t); if (guided == 0) { float orco_offset[3]; diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 452972c0ab2..87fa86977e6 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -774,7 +774,7 @@ static void distribute_invalid(ParticleSimulationData *sim, int from) { Scene *scene = sim->scene; ParticleSystem *psys = sim->psys; - const bool use_render_params = (DEG_get_mode(sim->eval_ctx->depsgraph) == DAG_EVAL_RENDER); + const bool use_render_params = (DEG_get_mode(sim->depsgraph) == DAG_EVAL_RENDER); if (from == PART_FROM_CHILD) { ChildParticle *cpa; @@ -842,7 +842,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti psys_thread_context_init(ctx, sim); - const bool use_render_params = (DEG_get_mode(sim->eval_ctx->depsgraph) == DAG_EVAL_RENDER); + const bool use_render_params = (DEG_get_mode(sim->depsgraph) == DAG_EVAL_RENDER); /* First handle special cases */ if (from == PART_FROM_CHILD) { diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index c48d581f82c..b9361f3499b 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -988,14 +988,14 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic } /* recursively evaluate emitter parent anim at cfra */ -static void evaluate_emitter_anim(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float cfra) +static void evaluate_emitter_anim(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra) { if (ob->parent) - evaluate_emitter_anim(eval_ctx, scene, ob->parent, cfra); + evaluate_emitter_anim(depsgraph, scene, ob->parent, cfra); /* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */ BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM); - BKE_object_where_is_calc_time(eval_ctx, scene, ob, cfra); + BKE_object_where_is_calc_time(depsgraph, scene, ob, cfra); } /* sets particle to the emitter surface with initial velocity & rotation */ @@ -1009,7 +1009,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, /* get precise emitter matrix if particle is born */ if (part->type != PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) { - evaluate_emitter_anim(sim->eval_ctx, sim->scene, sim->ob, pa->time); + evaluate_emitter_anim(sim->depsgraph, sim->scene, sim->ob, pa->time); psys->flag |= PSYS_OB_ANIM_RESTORE; } @@ -1143,7 +1143,7 @@ static void set_keyed_keys(ParticleSimulationData *sim) int totpart = psys->totpart, k, totkeys = psys->totkeyed; int keyed_flag = 0; - ksim.eval_ctx = sim->eval_ctx; + ksim.depsgraph = sim->depsgraph; ksim.scene = sim->scene; /* no proper targets so let's clear and bail out */ @@ -1305,7 +1305,7 @@ void psys_update_particle_tree(ParticleSystem *psys, float cfra) static void psys_update_effectors(ParticleSimulationData *sim) { pdEndEffectors(&sim->psys->effectors); - sim->psys->effectors = pdInitEffectors(sim->eval_ctx, sim->scene, sim->ob, sim->psys, + sim->psys->effectors = pdInitEffectors(sim->depsgraph, sim->scene, sim->ob, sim->psys, sim->psys->part->effector_weights, true); precalc_guides(sim, sim->psys->effectors); } @@ -2126,7 +2126,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa tkey.time=pa->state.time; if (part->type != PART_HAIR) { - if (do_guides(sim->eval_ctx, sim->psys->part, sim->psys->effectors, &tkey, p, time)) { + if (do_guides(sim->depsgraph, sim->psys->part, sim->psys->effectors, &tkey, p, time)) { copy_v3_v3(pa->state.co,tkey.co); /* guides don't produce valid velocity */ sub_v3_v3v3(pa->state.vel, tkey.co, pa->prev_state.co); @@ -2945,7 +2945,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, cons skip = 1; /* no need to cache paths while baking dynamics */ #if 0 /* TODO(mai): something is very wrong with these conditionals, they dont make sense and the cache isnt updating */ - else if (psys_in_edit_mode(sim->eval_ctx->depsgraph, psys)) { + else if (psys_in_edit_mode(sim->depsgraph, psys)) { if ((pset->flag & PE_DRAW_PART)==0) skip = 1; else if (part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0) @@ -3213,7 +3213,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) psys->hair_out_dm = CDDM_copy(psys->hair_in_dm); psys->hair_out_dm->getVertCos(psys->hair_out_dm, deformedVerts); - clothModifier_do(psys->clmd, sim->eval_ctx, sim->scene, sim->ob, psys->hair_in_dm, deformedVerts); + clothModifier_do(psys->clmd, sim->depsgraph, sim->scene, sim->ob, psys->hair_in_dm, deformedVerts); CDDM_apply_vert_coords(psys->hair_out_dm, deformedVerts); @@ -4213,7 +4213,7 @@ static int hair_needs_recalc(ParticleSystem *psys) /* main particle update call, checks that things are ok on the large scale and * then advances in to actual particle calculations depending on particle type */ -void particle_system_update(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params) +void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params) { ParticleSimulationData sim= {0}; ParticleSettings *part = psys->part; @@ -4227,7 +4227,7 @@ void particle_system_update(const struct EvaluationContext *eval_ctx, Scene *sce cfra= BKE_scene_frame_get(scene); - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = ob; sim.psys = psys; @@ -4374,7 +4374,7 @@ void particle_system_update(const struct EvaluationContext *eval_ctx, Scene *sce /* make sure emitter is left at correct time (particle emission can change this) */ if (psys->flag & PSYS_OB_ANIM_RESTORE) { - evaluate_emitter_anim(eval_ctx, scene, ob, cfra); + evaluate_emitter_anim(depsgraph, scene, ob, cfra); psys->flag &= ~PSYS_OB_ANIM_RESTORE; } @@ -4415,7 +4415,7 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, /* **** Depsgraph evaluation **** */ -void BKE_particle_system_eval_init(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_particle_system_eval_init(struct Depsgraph *UNUSED(depsgraph), Scene *scene, Object *ob) { diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index ff521260993..ab8f9dcb2e4 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1237,7 +1237,7 @@ static void rigidbody_update_sim_world(Scene *scene, RigidBodyWorld *rbw) rigidbody_update_ob_array(rbw); } -static void rigidbody_update_sim_ob(const struct EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, Object *ob, RigidBodyOb *rbo) +static void rigidbody_update_sim_ob(struct Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, RigidBodyOb *rbo) { float loc[3]; float rot[4]; @@ -1285,7 +1285,7 @@ static void rigidbody_update_sim_ob(const struct EvaluationContext *eval_ctx, Sc ListBase *effectors; /* get effectors present in the group specified by effector_weights */ - effectors = pdInitEffectors(eval_ctx, scene, ob, NULL, effector_weights, true); + effectors = pdInitEffectors(depsgraph, scene, ob, NULL, effector_weights, true); if (effectors) { float eff_force[3] = {0.0f, 0.0f, 0.0f}; float eff_loc[3], eff_vel[3]; @@ -1326,7 +1326,7 @@ static void rigidbody_update_sim_ob(const struct EvaluationContext *eval_ctx, Sc * * \param rebuild Rebuild entire simulation */ -static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx, Scene *scene, RigidBodyWorld *rbw, bool rebuild) +static void rigidbody_update_simulation(struct Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, bool rebuild) { /* update world */ if (rebuild) @@ -1359,7 +1359,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx /* validate that we've got valid object set up here... */ RigidBodyOb *rbo = ob->rigidbody_object; /* update transformation matrix of the object so we don't get a frame of lag for simple animations */ - BKE_object_where_is_calc(eval_ctx, scene, ob); + BKE_object_where_is_calc(depsgraph, scene, ob); if (rbo == NULL) { /* Since this object is included in the sim group but doesn't have @@ -1393,7 +1393,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx } /* update simulation object... */ - rigidbody_update_sim_ob(eval_ctx, scene, rbw, ob, rbo); + rigidbody_update_sim_ob(depsgraph, scene, rbw, ob, rbo); } } FOREACH_GROUP_OBJECT_END; @@ -1407,7 +1407,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx /* validate that we've got valid object set up here... */ RigidBodyCon *rbc = ob->rigidbody_constraint; /* update transformation matrix of the object so we don't get a frame of lag for simple animations */ - BKE_object_where_is_calc(eval_ctx, scene, ob); + BKE_object_where_is_calc(depsgraph, scene, ob); if (rbc == NULL) { /* Since this object is included in the group but doesn't have @@ -1563,7 +1563,7 @@ void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) /* Rebuild rigid body world */ /* NOTE: this needs to be called before frame update to work correctly */ -void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) +void BKE_rigidbody_rebuild_world(struct Depsgraph *depsgraph, Scene *scene, float ctime) { RigidBodyWorld *rbw = scene->rigidbody_world; PointCache *cache; @@ -1582,7 +1582,7 @@ void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, Scene if (ctime == startframe + 1 && rbw->ltime == startframe) { if (cache->flag & PTCACHE_OUTDATED) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); - rigidbody_update_simulation(eval_ctx, scene, rbw, true); + rigidbody_update_simulation(depsgraph, scene, rbw, true); BKE_ptcache_validate(cache, (int)ctime); cache->last_exact = 0; cache->flag &= ~PTCACHE_REDO_NEEDED; @@ -1591,7 +1591,7 @@ void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, Scene } /* Run RigidBody simulation for the specified physics world */ -void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) +void BKE_rigidbody_do_simulation(struct Depsgraph *depsgraph, Scene *scene, float ctime) { float timestep; RigidBodyWorld *rbw = scene->rigidbody_world; @@ -1636,7 +1636,7 @@ void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene } /* update and validate simulation */ - rigidbody_update_simulation(eval_ctx, scene, rbw, false); + rigidbody_update_simulation(depsgraph, scene, rbw, false); /* calculate how much time elapsed since last step in seconds */ timestep = 1.0f / (float)FPS * (ctime - rbw->ltime) * rbw->time_scale; @@ -1680,8 +1680,8 @@ void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle) {} bool BKE_rigidbody_check_sim_running(RigidBodyWorld *rbw, float ctime) { return false; } void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw) {} -void BKE_rigidbody_rebuild_world(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) {} -void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene *scene, float ctime) {} +void BKE_rigidbody_rebuild_world(struct Depsgraph *depsgraph, Scene *scene, float ctime) {} +void BKE_rigidbody_do_simulation(struct Depsgraph *depsgraph, Scene *scene, float ctime) {} #ifdef __GNUC__ # pragma GCC diagnostic pop @@ -1692,29 +1692,29 @@ void BKE_rigidbody_do_simulation(const struct EvaluationContext *eval_ctx, Scene /* -------------------- */ /* Depsgraph evaluation */ -void BKE_rigidbody_rebuild_sim(const struct EvaluationContext *eval_ctx, +void BKE_rigidbody_rebuild_sim(struct Depsgraph *depsgraph, Scene *scene) { float ctime = BKE_scene_frame_get(scene); DEG_debug_print_eval_time(__func__, scene->id.name, scene, ctime); /* rebuild sim data (i.e. after resetting to start of timeline) */ if (BKE_scene_check_rigidbody_active(scene)) { - BKE_rigidbody_rebuild_world(eval_ctx, scene, ctime); + BKE_rigidbody_rebuild_world(depsgraph, scene, ctime); } } -void BKE_rigidbody_eval_simulation(const struct EvaluationContext *eval_ctx, +void BKE_rigidbody_eval_simulation(struct Depsgraph *depsgraph, Scene *scene) { float ctime = BKE_scene_frame_get(scene); DEG_debug_print_eval_time(__func__, scene->id.name, scene, ctime); /* evaluate rigidbody sim */ if (BKE_scene_check_rigidbody_active(scene)) { - BKE_rigidbody_do_simulation(eval_ctx, scene, ctime); + BKE_rigidbody_do_simulation(depsgraph, scene, ctime); } } -void BKE_rigidbody_object_sync_transforms(const struct EvaluationContext *UNUSED(eval_ctx), +void BKE_rigidbody_object_sync_transforms(struct Depsgraph *UNUSED(depsgraph), Scene *scene, Object *ob) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9a7c10d31de..50b90a073f9 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -995,7 +995,7 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name) /* Used by metaballs, return *all* objects (including duplis) existing in the scene (including scene's sets) */ int BKE_scene_base_iter_next( - const EvaluationContext *eval_ctx, SceneBaseIter *iter, + Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob) { bool run_again = true; @@ -1014,7 +1014,9 @@ int BKE_scene_base_iter_next( /* the first base */ if (iter->phase == F_START) { - ViewLayer *view_layer = eval_ctx->view_layer; + ViewLayer *view_layer = (depsgraph) ? + DEG_get_evaluated_view_layer(depsgraph) : + BKE_view_layer_from_scene_get(*scene); *base = view_layer->object_bases.first; if (*base) { *ob = (*base)->object; @@ -1062,12 +1064,12 @@ int BKE_scene_base_iter_next( } else { if (iter->phase != F_DUPLI) { - if ( (*base)->object->transflag & OB_DUPLI) { + if (depsgraph && (*base)->object->transflag & OB_DUPLI) { /* groups cannot be duplicated for mballs yet, * this enters eternal loop because of * makeDispListMBall getting called inside of group_duplilist */ if ((*base)->object->dup_group == NULL) { - iter->duplilist = object_duplilist_ex(eval_ctx, (*scene), (*base)->object, false); + iter->duplilist = object_duplilist_ex(depsgraph, (*scene), (*base)->object, false); iter->dupob = iter->duplilist->first; @@ -1350,7 +1352,7 @@ static bool check_rendered_viewport_visible(Main *bmain) return false; } -/* TODO(campbell): shouldn't we be able to use 'eval_ctx->view_layer' here? +/* TODO(campbell): shouldn't we be able to use 'DEG_get_view_layer' here? * Currently this is NULL on load, so don't. */ static void prepare_mesh_for_viewport_render( Main *bmain, const ViewLayer *view_layer) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 58b83a754d8..4f8e4b0b842 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -76,6 +76,7 @@ #include "BKE_idprop.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "RNA_access.h" @@ -592,17 +593,16 @@ void BKE_sequencer_pixel_from_sequencer_space_v4(struct Scene *scene, float pixe /*********************** sequencer pipeline functions *************************/ void BKE_sequencer_new_render_data( - EvaluationContext *eval_ctx, Main *bmain, Scene *scene, int rectx, int recty, - int preview_render_size, + int preview_render_size, int for_render, SeqRenderData *r_context) { - r_context->eval_ctx = eval_ctx; r_context->bmain = bmain; r_context->scene = scene; r_context->rectx = rectx; r_context->recty = recty; r_context->preview_render_size = preview_render_size; + r_context->for_render = for_render; r_context->motion_blur_samples = 0; r_context->motion_blur_shutter = 0; r_context->skip_cache = false; @@ -2035,9 +2035,10 @@ void BKE_sequencer_proxy_rebuild(SeqIndexBuildContext *context, short *stop, sho /* fail safe code */ BKE_sequencer_new_render_data( - bmain->eval_ctx, bmain, context->scene, + bmain, context->scene, (scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f, (scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f, 100, + false, &render_context); render_context.skip_cache = true; @@ -3337,7 +3338,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq BKE_scene_graph_update_for_newframe(depsgraph, context->bmain); ibuf = sequencer_view3d_cb( /* set for OpenGL render (NULL when scrubbing) */ - context->eval_ctx, scene, view_layer, engine_type, + depsgraph, scene, view_layer, engine_type, camera, width, height, IB_rect, draw_flags, context->scene->r.seq_prev_type, scene->r.alphamode, context->gpu_samples, viewname, @@ -3362,7 +3363,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq * When rendering from command line renderer is called from main thread, in this * case it's always safe to render scene here */ - if (!is_thread_main || is_rendering == false || is_background || context->eval_ctx->mode == DAG_EVAL_RENDER) { + if (!is_thread_main || is_rendering == false || is_background || context->for_render) { if (re == NULL) re = RE_NewSceneRender(scene); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index e60075f4c0a..f99bd773ebc 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -83,6 +83,7 @@ #include "BKE_texture.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "RE_shader_ext.h" @@ -127,7 +128,7 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli), float *UNUSED(burning_rate), float *UNUSED(flame_smoke), float *UNUSED(flame_smoke_color), float *UNUSED(flame_vorticity), float *UNUSED(flame_ignition_temp), float *UNUSED(flame_max_temp)) {} -struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), const struct EvaluationContext *UNUSED(eval_ctx), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) { return NULL; } +struct DerivedMesh *smokeModifier_do(SmokeModifierData *UNUSED(smd), struct Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) { return NULL; } float smoke_get_velocity_at(struct Object *UNUSED(ob), float UNUSED(position[3]), float UNUSED(velocity[3])) { return 0.0f; } #endif /* WITH_SMOKE */ @@ -2106,7 +2107,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value } } -static void update_flowsfluids(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt) +static void update_flowsfluids(struct Depsgraph *depsgraph, Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt) { Object **flowobjs = NULL; EmissionMap *emaps = NULL; @@ -2213,7 +2214,7 @@ static void update_flowsfluids(const struct EvaluationContext *eval_ctx, Scene * else { /* MOD_SMOKE_FLOW_SOURCE_MESH */ /* update flow object frame */ BLI_mutex_lock(&object_update_lock); - BKE_object_modifier_update_subframe(eval_ctx, scene, collob, true, 5, BKE_scene_frame_get(scene), eModifierType_Smoke); + BKE_object_modifier_update_subframe(depsgraph, scene, collob, true, 5, BKE_scene_frame_get(scene), eModifierType_Smoke); BLI_mutex_unlock(&object_update_lock); /* apply flow */ @@ -2525,12 +2526,12 @@ static void update_effectors_task_cb( } } -static void update_effectors(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeDomainSettings *sds, float UNUSED(dt)) +static void update_effectors(struct Depsgraph *depsgraph, Scene *scene, Object *ob, SmokeDomainSettings *sds, float UNUSED(dt)) { ListBase *effectors; /* make sure smoke flow influence is 0.0f */ sds->effector_weights->weight[PFIELD_SMOKEFLOW] = 0.0f; - effectors = pdInitEffectors(eval_ctx, scene, ob, NULL, sds->effector_weights, true); + effectors = pdInitEffectors(depsgraph, scene, ob, NULL, sds->effector_weights, true); if (effectors) { // precalculate wind forces @@ -2560,7 +2561,7 @@ static void update_effectors(const struct EvaluationContext *eval_ctx, Scene *sc pdEndEffectors(&effectors); } -static void step(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps) +static void step(struct Depsgraph *depsgraph, Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *domain_dm, float fps) { SmokeDomainSettings *sds = smd->domain; /* stability values copied from wturbulence.cpp */ @@ -2630,11 +2631,11 @@ static void step(const struct EvaluationContext *eval_ctx, Scene *scene, Object for (substep = 0; substep < totalSubsteps; substep++) { // calc animated obstacle velocities - update_flowsfluids(eval_ctx, scene, ob, sds, dtSubdiv); + update_flowsfluids(depsgraph, scene, ob, sds, dtSubdiv); update_obstacles(scene, ob, sds, dtSubdiv, substep, totalSubsteps); if (sds->total_cells > 1) { - update_effectors(eval_ctx, scene, ob, sds, dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt + update_effectors(depsgraph, scene, ob, sds, dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt smoke_step(sds->fluid, gravity, dtSubdiv); } } @@ -2728,7 +2729,7 @@ static DerivedMesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob) } static void smokeModifier_process( - SmokeModifierData *smd, const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) + SmokeModifierData *smd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm) { if ((smd->type & MOD_SMOKE_TYPE_FLOW)) { @@ -2849,11 +2850,11 @@ static void smokeModifier_process( } - step(eval_ctx, scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base); + step(depsgraph, scene, ob, smd, dm, scene->r.frs_sec / scene->r.frs_sec_base); } // create shadows before writing cache so they get stored - smoke_calc_transparency(sds, eval_ctx->view_layer); + smoke_calc_transparency(sds, DEG_get_evaluated_view_layer(depsgraph)); if (sds->wt && sds->total_cells > 1) { smoke_turbulence_step(sds->wt, sds->fluid); @@ -2871,13 +2872,13 @@ static void smokeModifier_process( } struct DerivedMesh *smokeModifier_do( - SmokeModifierData *smd, const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, DerivedMesh *dm) + SmokeModifierData *smd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *dm) { /* lock so preview render does not read smoke data while it gets modified */ if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) BLI_rw_mutex_lock(smd->domain->fluid_mutex, THREAD_LOCK_WRITE); - smokeModifier_process(smd, eval_ctx, scene, ob, dm); + smokeModifier_process(smd, depsgraph, scene, ob, dm); if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) BLI_rw_mutex_unlock(smd->domain->fluid_mutex); diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 82efe66d8da..0af400796a4 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -83,6 +83,7 @@ variables on the UI for now #include "BKE_scene.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "PIL_time.h" @@ -1524,12 +1525,12 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow, } -static void scan_for_ext_spring_forces(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float timenow) +static void scan_for_ext_spring_forces(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float timenow) { SoftBody *sb = ob->soft; ListBase *do_effector = NULL; - do_effector = pdInitEffectors(eval_ctx, scene, ob, NULL, sb->effector_weights, true); + do_effector = pdInitEffectors(depsgraph, scene, ob, NULL, sb->effector_weights, true); _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, do_effector); pdEndEffectors(&do_effector); } @@ -1541,7 +1542,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) return NULL; } -static void sb_sfesf_threads_run(const struct EvaluationContext *eval_ctx, Scene *scene, struct Object *ob, float timenow, int totsprings, int *UNUSED(ptr_to_break_func(void))) +static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, Scene *scene, struct Object *ob, float timenow, int totsprings, int *UNUSED(ptr_to_break_func(void))) { ListBase *do_effector = NULL; ListBase threads; @@ -1549,7 +1550,7 @@ static void sb_sfesf_threads_run(const struct EvaluationContext *eval_ctx, Scene int i, totthread, left, dec; int lowsprings =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */ - do_effector= pdInitEffectors(eval_ctx, scene, ob, NULL, ob->soft->effector_weights, true); + do_effector= pdInitEffectors(depsgraph, scene, ob, NULL, ob->soft->effector_weights, true); /* figure the number of threads while preventing pretty pointless threading overhead */ totthread= BKE_scene_num_threads(scene); @@ -2207,7 +2208,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t MEM_freeN(sb_threads); } -static void softbody_calc_forcesEx(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float forcetime, float timenow) +static void softbody_calc_forcesEx(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float forcetime, float timenow) { /* rule we never alter free variables :bp->vec bp->pos in here ! * this will ruin adaptive stepsize AKA heun! (BM) @@ -2223,7 +2224,7 @@ static void softbody_calc_forcesEx(const struct EvaluationContext *eval_ctx, Sce /* gravity = sb->grav * sb_grav_force_scale(ob); */ /* UNUSED */ /* check conditions for various options */ - do_deflector= query_external_colliders(eval_ctx->view_layer, sb->collision_group); + do_deflector= query_external_colliders(DEG_get_evaluated_view_layer(depsgraph), sb->collision_group); /* do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); */ /* UNUSED */ do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL); do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES)); @@ -2232,10 +2233,10 @@ static void softbody_calc_forcesEx(const struct EvaluationContext *eval_ctx, Sce /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */ if (do_springcollision || do_aero) - sb_sfesf_threads_run(eval_ctx, scene, ob, timenow, sb->totspring, NULL); + sb_sfesf_threads_run(depsgraph, scene, ob, timenow, sb->totspring, NULL); /* after spring scan because it uses Effoctors too */ - do_effector= pdInitEffectors(eval_ctx, scene, ob, NULL, sb->effector_weights, true); + do_effector= pdInitEffectors(depsgraph, scene, ob, NULL, sb->effector_weights, true); if (do_deflector) { float defforce[3]; @@ -2252,11 +2253,11 @@ static void softbody_calc_forcesEx(const struct EvaluationContext *eval_ctx, Sce } -static void softbody_calc_forces(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float forcetime, float timenow) +static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float forcetime, float timenow) { /* redirection to the new threaded Version */ if (!(G.debug_value & 0x10)) { // 16 - softbody_calc_forcesEx(eval_ctx, scene, ob, forcetime, timenow); + softbody_calc_forcesEx(depsgraph, scene, ob, forcetime, timenow); return; } else { @@ -2287,7 +2288,7 @@ static void softbody_calc_forces(const struct EvaluationContext *eval_ctx, Scene } /* check conditions for various options */ - do_deflector= query_external_colliders(eval_ctx->view_layer, sb->collision_group); + do_deflector= query_external_colliders(DEG_get_evaluated_view_layer(depsgraph), sb->collision_group); do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL); do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES)); @@ -2295,9 +2296,9 @@ static void softbody_calc_forces(const struct EvaluationContext *eval_ctx, Scene iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */ /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */ - if (do_springcollision || do_aero) scan_for_ext_spring_forces(eval_ctx, scene, ob, timenow); + if (do_springcollision || do_aero) scan_for_ext_spring_forces(depsgraph, scene, ob, timenow); /* after spring scan because it uses Effoctors too */ - do_effector= pdInitEffectors(eval_ctx, scene, ob, NULL, ob->soft->effector_weights, true); + do_effector= pdInitEffectors(depsgraph, scene, ob, NULL, ob->soft->effector_weights, true); if (do_deflector) { float defforce[3]; @@ -3484,7 +3485,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int } } -static void softbody_step(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, SoftBody *sb, float dtime) +static void softbody_step(struct Depsgraph *depsgraph, Scene *scene, Object *ob, SoftBody *sb, float dtime) { /* the simulator */ float forcetime; @@ -3498,11 +3499,13 @@ static void softbody_step(const struct EvaluationContext *eval_ctx, Scene *scene */ if (dtime < 0 || dtime > 10.5f) return; - ccd_update_deflector_hash(eval_ctx->view_layer, sb->collision_group, ob, sb->scratch->colliderhash); + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); + + ccd_update_deflector_hash(view_layer, sb->collision_group, ob, sb->scratch->colliderhash); if (sb->scratch->needstobuildcollider) { - if (query_external_colliders(eval_ctx->view_layer, sb->collision_group)) { - ccd_build_deflector_hash(eval_ctx->view_layer, sb->collision_group, ob, sb->scratch->colliderhash); + if (query_external_colliders(view_layer, sb->collision_group)) { + ccd_build_deflector_hash(view_layer, sb->collision_group, ob, sb->scratch->colliderhash); } sb->scratch->needstobuildcollider=0; } @@ -3532,12 +3535,12 @@ static void softbody_step(const struct EvaluationContext *eval_ctx, Scene *scene sb->scratch->flag &= ~SBF_DOFUZZY; /* do predictive euler step */ - softbody_calc_forces(eval_ctx, scene, ob, forcetime, timedone/dtime); + softbody_calc_forces(depsgraph, scene, ob, forcetime, timedone/dtime); softbody_apply_forces(ob, forcetime, 1, NULL, mid_flags); /* crop new slope values to do averaged slope step */ - softbody_calc_forces(eval_ctx, scene, ob, forcetime, timedone/dtime); + softbody_calc_forces(depsgraph, scene, ob, forcetime, timedone/dtime); softbody_apply_forces(ob, forcetime, 2, &err, mid_flags); softbody_apply_goalsnap(ob); @@ -3618,7 +3621,7 @@ static void softbody_step(const struct EvaluationContext *eval_ctx, Scene *scene } /* simulates one step. framenr is in frames */ -void sbObjectStep(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], int numVerts) +void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], int numVerts) { SoftBody *sb= ob->soft; PointCache *cache; @@ -3734,7 +3737,7 @@ void sbObjectStep(const struct EvaluationContext *eval_ctx, Scene *scene, Object dtime = framedelta*timescale; /* do simulation */ - softbody_step(eval_ctx, scene, ob, sb, dtime); + softbody_step(depsgraph, scene, ob, sb, dtime); softbody_to_object(ob, vertexCos, numVerts, 0); diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index e87e84736c8..167ee6b4018 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -195,7 +195,7 @@ void BKE_world_make_local(Main *bmain, World *wrld, const bool lib_local) BKE_id_make_local_generic(bmain, &wrld->id, true, lib_local); } -void BKE_world_eval(const struct EvaluationContext *UNUSED(eval_ctx), World *world) +void BKE_world_eval(struct Depsgraph *UNUSED(depsgraph), World *world) { if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) { printf("%s on %s (%p)\n", __func__, world->id.name, world); diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 2f692cb0f33..439f48897f6 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -38,7 +38,7 @@ bool AnimationExporter::exportAnimations(Scene *sce) { bool has_animations = hasAnimations(sce); if (has_animations) { - this->eval_ctx = eval_ctx; + this->depsgraph = depsgraph; this->scene = sce; openLibrary(); @@ -215,7 +215,7 @@ void AnimationExporter::export_sampled_matrix_animation(Object *ob, std::vector< for (std::vector<float>::iterator ctime = ctimes.begin(); ctime != ctimes.end(); ++ctime) { float fmat[4][4]; - bc_update_scene(eval_ctx, scene, *ctime); + bc_update_scene(depsgraph, scene, *ctime); BKE_object_matrix_local_get(ob, fmat); if (this->export_settings->limit_precision) bc_sanitize_mat(fmat, 6); @@ -247,7 +247,7 @@ void AnimationExporter::export_sampled_transrotloc_animation(Object *ob, std::ve float fsize[3]; float feul[3]; - bc_update_scene(eval_ctx, scene, *ctime); + bc_update_scene(depsgraph, scene, *ctime); BKE_object_matrix_local_get(ob, fmat); mat4_decompose(floc, fquat, fsize, fmat); quat_to_eul(feul, fquat); @@ -722,7 +722,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B if (flag & ARM_RESTPOS) { arm->flag &= ~ARM_RESTPOS; - BKE_pose_where_is(eval_ctx, scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } if (fra.size()) { @@ -731,7 +731,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B if (flag & ARM_RESTPOS) arm->flag = flag; - BKE_pose_where_is(eval_ctx, scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone) @@ -1022,7 +1022,7 @@ void AnimationExporter::evaluate_anim_with_constraints(Object *ob, float ctime) if (obtar) { BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM); - BKE_object_where_is_calc_time(this->eval_ctx, scene, obtar, ctime); + BKE_object_where_is_calc_time(this->depsgraph, scene, obtar, ctime); } } @@ -1030,7 +1030,7 @@ void AnimationExporter::evaluate_anim_with_constraints(Object *ob, float ctime) cti->flush_constraint_targets(con, &targets, 1); } } - BKE_object_where_is_calc_time(this->eval_ctx, scene, ob, ctime); + BKE_object_where_is_calc_time(this->depsgraph, scene, ob, ctime); } /* @@ -1316,16 +1316,16 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj float frame = *it; float ctime = BKE_scene_frame_get_from_ctime(scene, frame); - bc_update_scene(eval_ctx, scene, ctime); + bc_update_scene(depsgraph, scene, ctime); if (is_bone_animation) { if (pchan->flag & POSE_CHAIN) { enable_fcurves(ob->adt->action, NULL); BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL); - BKE_pose_where_is(eval_ctx, scene, ob); + BKE_pose_where_is(depsgraph, scene, ob); } else { - BKE_pose_where_is_bone(eval_ctx, scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob, pchan, ctime, 1); } // compute bone local mat @@ -1843,7 +1843,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo // exit rest position if (flag & ARM_RESTPOS) { arm->flag &= ~ARM_RESTPOS; - BKE_pose_where_is(eval_ctx, scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } //v array will hold all values which will be exported. if (fra.size()) { @@ -1873,7 +1873,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo // restore restpos if (flag & ARM_RESTPOS) arm->flag = flag; - BKE_pose_where_is(eval_ctx, scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) @@ -1898,7 +1898,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - BKE_pose_where_is_bone(eval_ctx, scene, ob_arm, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob_arm, pchan, ctime, 1); // compute bone local mat if (bone->parent) { diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index d2216c04ee5..bbd7fdb9a63 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -79,19 +79,19 @@ extern "C" #include <vector> #include <algorithm> // std::find -struct EvaluationContext; +struct Depsgraph; class AnimationExporter: COLLADASW::LibraryAnimations { private: Scene *scene; - EvaluationContext *eval_ctx; + Depsgraph *depsgraph; COLLADASW::StreamWriter *sw; public: - AnimationExporter(EvaluationContext *eval_ctx, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): - eval_ctx(eval_ctx), + AnimationExporter(Depsgraph *depsgraph, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): + depsgraph(depsgraph), COLLADASW::LibraryAnimations(sw), export_settings(export_settings) { diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index fbceb6e077f..5e349535610 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -62,7 +62,7 @@ ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSett } // write bone nodes -void ArmatureExporter::add_armature_bones(const EvaluationContext *eval_ctx, Object *ob_arm, +void ArmatureExporter::add_armature_bones(Depsgraph *depsgraph, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects) { @@ -77,7 +77,7 @@ void ArmatureExporter::add_armature_bones(const EvaluationContext *eval_ctx, Obj for (Bone *bone = (Bone *)armature->bonebase.first; bone; bone = bone->next) { // start from root bones if (!bone->parent) - add_bone_node(eval_ctx, bone, ob_arm, sce, se, child_objects); + add_bone_node(depsgraph, bone, ob_arm, sce, se, child_objects); } if (!is_edited) { @@ -157,7 +157,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O #endif // parent_mat is armature-space -void ArmatureExporter::add_bone_node(const EvaluationContext *eval_ctx, Bone *bone, Object *ob_arm, Scene *sce, +void ArmatureExporter::add_bone_node(Depsgraph *depsgraph, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects) { @@ -231,7 +231,7 @@ void ArmatureExporter::add_bone_node(const EvaluationContext *eval_ctx, Bone *bo mul_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv); } - se->writeNodes(eval_ctx, *i, sce); + se->writeNodes(depsgraph, *i, sce); copy_m4_m4((*i)->parentinv, backup_parinv); child_objects.erase(i++); @@ -240,13 +240,13 @@ void ArmatureExporter::add_bone_node(const EvaluationContext *eval_ctx, Bone *bo } for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - add_bone_node(eval_ctx, child, ob_arm, sce, se, child_objects); + add_bone_node(depsgraph, child, ob_arm, sce, se, child_objects); } node.end(); } else { for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { - add_bone_node(eval_ctx, child, ob_arm, sce, se, child_objects); + add_bone_node(depsgraph, child, ob_arm, sce, se, child_objects); } } } diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h index a3ed97c3a43..17c02d637e8 100644 --- a/source/blender/collada/ArmatureExporter.h +++ b/source/blender/collada/ArmatureExporter.h @@ -60,7 +60,7 @@ public: ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings); // write bone nodes - void add_armature_bones(const struct EvaluationContext *eval_ctx, Object *ob_arm, Scene *sce, SceneExporter *se, + void add_armature_bones(struct Depsgraph *depsgraph, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects); bool add_instance_controller(Object *ob); @@ -85,7 +85,7 @@ private: // Scene, SceneExporter and the list of child_objects // are required for writing bone parented objects - void add_bone_node(const struct EvaluationContext *eval_ctx, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, + void add_bone_node(struct Depsgraph *depsgraph, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se, std::list<Object *>& child_objects); void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node); diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index f32cb624f78..f6dbc965b42 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -104,9 +104,9 @@ bool ControllerExporter::add_instance_controller(Object *ob) return true; } -void ControllerExporter::export_controllers(const struct EvaluationContext *eval_ctx, Scene *sce) +void ControllerExporter::export_controllers(struct Depsgraph *depsgraph, Scene *sce) { - this->eval_ctx = eval_ctx; + this->depsgraph = depsgraph; scene = sce; openLibrary(); @@ -198,7 +198,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) bool use_instantiation = this->export_settings->use_object_instantiation; Mesh *me; - me = bc_get_mesh_copy(eval_ctx, scene, + me = bc_get_mesh_copy(depsgraph, scene, ob, this->export_settings->export_mesh_type, this->export_settings->apply_modifiers, @@ -300,7 +300,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key) bool use_instantiation = this->export_settings->use_object_instantiation; Mesh *me; - me = bc_get_mesh_copy(eval_ctx, scene, + me = bc_get_mesh_copy(depsgraph, scene, ob, this->export_settings->export_mesh_type, this->export_settings->apply_modifiers, @@ -495,7 +495,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas // put armature in rest position if (!(arm->flag & ARM_RESTPOS)) { arm->flag |= ARM_RESTPOS; - BKE_pose_where_is(eval_ctx, scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } for (bDeformGroup *def = (bDeformGroup *)defbase->first; def; def = def->next) { @@ -543,7 +543,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas // back from rest positon if (!(flag & ARM_RESTPOS)) { arm->flag = flag; - BKE_pose_where_is(eval_ctx, scene, ob_arm); + BKE_pose_where_is(depsgraph, scene, ob_arm); } source.finish(); diff --git a/source/blender/collada/ControllerExporter.h b/source/blender/collada/ControllerExporter.h index a1d46c5aafb..e13d7c7ebea 100644 --- a/source/blender/collada/ControllerExporter.h +++ b/source/blender/collada/ControllerExporter.h @@ -54,7 +54,7 @@ #include "BKE_key.h" -struct EvaluationContext; +struct Depsgraph; class SceneExporter; class ControllerExporter : public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter @@ -66,12 +66,12 @@ public: bool add_instance_controller(Object *ob); - void export_controllers(const struct EvaluationContext *eval_ctx, Scene *sce); + void export_controllers(struct Depsgraph *depsgraph, Scene *sce); void operator()(Object *ob); private: - const struct EvaluationContext *eval_ctx; + struct Depsgraph *depsgraph; Scene *scene; UnitConverter converter; const ExportSettings *export_settings; diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 04af73f2406..0b70b73887f 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -152,8 +152,8 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) return data->layers[layer_index].name; } -DocumentExporter::DocumentExporter(EvaluationContext *eval_ctx, const ExportSettings *export_settings) : - eval_ctx(eval_ctx), +DocumentExporter::DocumentExporter(Depsgraph *depsgraph, const ExportSettings *export_settings) : + depsgraph(depsgraph), export_settings(export_settings) { } @@ -288,7 +288,7 @@ int DocumentExporter::exportCurrentScene(Scene *sce) // <library_geometries> if (bc_has_object_type(export_set, OB_MESH)) { GeometryExporter ge(writer, this->export_settings); - ge.exportGeom(eval_ctx, sce); + ge.exportGeom(depsgraph, sce); } // <library_controllers> @@ -296,7 +296,7 @@ int DocumentExporter::exportCurrentScene(Scene *sce) ControllerExporter controller_exporter(writer, this->export_settings); if (bc_has_object_type(export_set, OB_ARMATURE) || this->export_settings->include_shapekeys) { - controller_exporter.export_controllers(eval_ctx, sce); + controller_exporter.export_controllers(depsgraph, sce); } // <library_visual_scenes> @@ -305,10 +305,10 @@ int DocumentExporter::exportCurrentScene(Scene *sce) if (this->export_settings->include_animations) { // <library_animations> - AnimationExporter ae(eval_ctx, writer, this->export_settings); + AnimationExporter ae(depsgraph, writer, this->export_settings); ae.exportAnimations(sce); } - se.exportScene(eval_ctx, sce); + se.exportScene(depsgraph, sce); // <scene> std::string scene_name(translate_id(id_name(sce))); diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h index 68e1523fbee..b420140c3bf 100644 --- a/source/blender/collada/DocumentExporter.h +++ b/source/blender/collada/DocumentExporter.h @@ -39,13 +39,13 @@ struct Scene; class DocumentExporter { public: - DocumentExporter(EvaluationContext *eval_ctx, const ExportSettings *export_settings); + DocumentExporter(Depsgraph *depsgraph, const ExportSettings *export_settings); int exportCurrentScene(Scene *sce); void exportScenes(const char *filename); private: const ExportSettings *export_settings; - EvaluationContext *eval_ctx; + Depsgraph *depsgraph; }; #endif diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 8dbee607b01..87b47353596 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -57,11 +57,11 @@ GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSett { } -void GeometryExporter::exportGeom(const struct EvaluationContext *eval_ctx, Scene *sce) +void GeometryExporter::exportGeom(struct Depsgraph *depsgraph, Scene *sce) { openLibrary(); - mEvalCtx = eval_ctx; + mDepsgraph = depsgraph; mScene = sce; GeometryFunctor gf; gf.forEachMeshObjectInExportSet<GeometryExporter>(sce, *this, this->export_settings->export_set); @@ -77,7 +77,7 @@ void GeometryExporter::operator()(Object *ob) #endif bool use_instantiation = this->export_settings->use_object_instantiation; - Mesh *me = bc_get_mesh_copy(mEvalCtx, mScene, + Mesh *me = bc_get_mesh_copy(mDepsgraph, mScene, ob, this->export_settings->export_mesh_type, this->export_settings->apply_modifiers, diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h index 7527195fdd8..88420b4ad2f 100644 --- a/source/blender/collada/GeometryExporter.h +++ b/source/blender/collada/GeometryExporter.h @@ -46,7 +46,7 @@ #include "BKE_key.h" -struct EvaluationContext; +struct Depsgraph; extern Object *bc_get_highest_selected_ancestor_or_self(Object *ob); @@ -74,13 +74,13 @@ class GeometryExporter : COLLADASW::LibraryGeometries Normal n; - const struct EvaluationContext *mEvalCtx; + struct Depsgraph *mDepsgraph; Scene *mScene; public: GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings); - void exportGeom(const struct EvaluationContext *eval_ctx, Scene *sce); + void exportGeom(struct Depsgraph *depsgraph, Scene *sce); void operator()(Object *ob); diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index f24c104892d..a1d542daa14 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -39,17 +39,17 @@ SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, { } -void SceneExporter::exportScene(const EvaluationContext *eval_ctx, Scene *sce) +void SceneExporter::exportScene(Depsgraph *depsgraph, Scene *sce) { // <library_visual_scenes> <visual_scene> std::string id_naming = id_name(sce); openVisualScene(translate_id(id_naming), id_naming); - exportHierarchy(eval_ctx, sce); + exportHierarchy(depsgraph, sce); closeVisualScene(); closeLibrary(); } -void SceneExporter::exportHierarchy(const EvaluationContext *eval_ctx, Scene *sce) +void SceneExporter::exportHierarchy(Depsgraph *depsgraph, Scene *sce) { LinkNode *node; std::vector<Object *> base_objects; @@ -81,13 +81,13 @@ void SceneExporter::exportHierarchy(const EvaluationContext *eval_ctx, Scene *sc Object *ob = base_objects[index]; if (bc_is_marked(ob)) { bc_remove_mark(ob); - writeNodes(eval_ctx, ob, sce); + writeNodes(depsgraph, ob, sce); } } } -void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Scene *sce) +void SceneExporter::writeNodes(Depsgraph *depsgraph, Object *ob, Scene *sce) { // Add associated armature first if available bool armature_exported = false; @@ -96,7 +96,7 @@ void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Sc armature_exported = bc_is_in_Export_set(this->export_settings->export_set, ob_arm); if (armature_exported && bc_is_marked(ob_arm)) { bc_remove_mark(ob_arm); - writeNodes(eval_ctx, ob_arm, sce); + writeNodes(depsgraph, ob_arm, sce); armature_exported = true; } } @@ -155,7 +155,7 @@ void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Sc // <instance_controller> else if (ob->type == OB_ARMATURE) { - arm_exporter->add_armature_bones(eval_ctx, ob, sce, this, child_objects); + arm_exporter->add_armature_bones(depsgraph, ob, sce, this, child_objects); } // <instance_camera> @@ -234,7 +234,7 @@ void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Sc for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) { if (bc_is_marked(*i)) { bc_remove_mark(*i); - writeNodes(eval_ctx, *i, sce); + writeNodes(depsgraph, *i, sce); } } diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h index 3e3c15b836f..c330aa81e91 100644 --- a/source/blender/collada/SceneExporter.h +++ b/source/blender/collada/SceneExporter.h @@ -96,12 +96,12 @@ class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter, { public: SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings); - void exportScene(const EvaluationContext *eval_ctx, Scene *sce); + void exportScene(Depsgraph *depsgraph, Scene *sce); private: friend class ArmatureExporter; - void exportHierarchy(const struct EvaluationContext *eval_ctx, Scene *sce); - void writeNodes(const struct EvaluationContext *eval_ctx, Object *ob, Scene *sce); + void exportHierarchy(struct Depsgraph *depsgraph, Scene *sce); + void writeNodes(struct Depsgraph *depsgraph, Object *ob, Scene *sce); ArmatureExporter *arm_exporter; const ExportSettings *export_settings; diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 64e3a4c36ce..5def6638df6 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -39,6 +39,7 @@ extern "C" #include "BKE_scene.h" #include "BKE_context.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" /* make dummy file */ #include "BLI_fileops.h" @@ -50,11 +51,11 @@ int collada_import(bContext *C, ImportSettings *import_settings) return (imp.import())? 1:0; } -int collada_export(EvaluationContext *eval_ctx, +int collada_export(Depsgraph *depsgraph, Scene *sce, ExportSettings *export_settings) { - ViewLayer *view_layer = eval_ctx->view_layer; + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); int includeFilter = OB_REL_NONE; if (export_settings->include_armatures) includeFilter |= OB_REL_MOD_ARMATURE; @@ -78,7 +79,7 @@ int collada_export(EvaluationContext *eval_ctx, bc_bubble_sort_by_Object_name(export_settings->export_set); } - DocumentExporter exporter(eval_ctx, export_settings); + DocumentExporter exporter(depsgraph, export_settings); int status = exporter.exportCurrentScene(sce); BLI_linklist_free(export_settings->export_set, NULL); diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h index f95fca03b65..5cf526af1f2 100644 --- a/source/blender/collada/collada.h +++ b/source/blender/collada/collada.h @@ -41,9 +41,9 @@ extern "C" { #include "RNA_types.h" struct bContext; +struct Depsgraph; struct Scene; struct ViewLayer; -struct EvaluationContext; /* * both return 1 on success, 0 on error @@ -52,7 +52,7 @@ int collada_import(struct bContext *C, ImportSettings *import_settings); -int collada_export(struct EvaluationContext *eval_ctx, +int collada_export(struct Depsgraph *depsgraph, struct Scene *sce, ExportSettings *export_settings); diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 95897e32759..670dcba0a24 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -65,6 +65,7 @@ extern "C" { } #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "collada_utils.h" #include "ExportSettings.h" @@ -96,11 +97,9 @@ int bc_test_parent_loop(Object *par, Object *ob) int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) { Object workob; + Depsgraph *depsgraph = CTX_data_depsgraph(C); Scene *sce = CTX_data_scene(C); - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); - if (!par || bc_test_parent_loop(par, ob)) return false; @@ -112,7 +111,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) if (is_parent_space) { float mat[4][4]; // calc par->obmat - BKE_object_where_is_calc(&eval_ctx, sce, par); + BKE_object_where_is_calc(depsgraph, sce, par); // move child obmat into world space mul_m4_m4m4(mat, par->obmat, ob->obmat); @@ -123,7 +122,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) BKE_object_apply_mat4(ob, ob->obmat, 0, 0); // compute parentinv - BKE_object_workob_calc_parent(&eval_ctx, sce, ob, &workob); + BKE_object_workob_calc_parent(depsgraph, sce, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); @@ -148,18 +147,12 @@ Main *bc_get_main() return G.main; } -EvaluationContext *bc_get_evaluation_context() -{ - Main *bmain = G.main; - return bmain->eval_ctx; -} - -void bc_update_scene(EvaluationContext *eval_ctx, Scene *scene, float ctime) +void bc_update_scene(Depsgraph *depsgraph, Scene *scene, float ctime) { BKE_scene_frame_set(scene, ctime); Main *bmain = bc_get_main(); - BKE_scene_graph_update_for_newframe(eval_ctx->depsgraph, bmain); + BKE_scene_graph_update_for_newframe(depsgraph, bmain); } Object *bc_add_object(Scene *scene, ViewLayer *view_layer, int type, const char *name) @@ -179,7 +172,7 @@ Object *bc_add_object(Scene *scene, ViewLayer *view_layer, int type, const char return ob; } -Mesh *bc_get_mesh_copy(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate) +Mesh *bc_get_mesh_copy(struct Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate) { Mesh *tmpmesh; CustomDataMask mask = CD_MASK_MESH; @@ -189,12 +182,12 @@ Mesh *bc_get_mesh_copy(const struct EvaluationContext *eval_ctx, Scene *scene, O switch (export_mesh_type) { case BC_MESH_TYPE_VIEW: { - dm = mesh_create_derived_view(eval_ctx, scene, ob, mask); + dm = mesh_create_derived_view(depsgraph, scene, ob, mask); break; } case BC_MESH_TYPE_RENDER: { - dm = mesh_create_derived_render(eval_ctx, scene, ob, mask); + dm = mesh_create_derived_render(depsgraph, scene, ob, mask); break; } } diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index 52767557397..89765375afb 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -60,20 +60,20 @@ extern "C" { #include "ExportSettings.h" #include "collada_internal.h" -struct EvaluationContext; +struct Depsgraph; typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex *> > TexIndexTextureArrayMap; extern Scene *bc_get_scene(bContext *C); extern Main *bc_get_main(); -extern EvaluationContext *bc_get_evaluation_context(); -extern void bc_update_scene(EvaluationContext *eval_ctx, Scene *scene, float ctime); +extern Depsgraph *bc_get_depsgraph(); +extern void bc_update_scene(Depsgraph *depsgraph, Scene *scene, float ctime); extern float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index); extern int bc_test_parent_loop(Object *par, Object *ob); extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true); extern Object *bc_add_object(Scene *scene, ViewLayer *view_layer, int type, const char *name); -extern Mesh *bc_get_mesh_copy(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate); +extern Mesh *bc_get_mesh_copy(struct Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate); extern Object *bc_get_assigned_armature(Object *ob); extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob); diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 4760c88cdbd..b30c99cbc0e 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -60,7 +60,6 @@ typedef struct Depsgraph Depsgraph; /* ------------------------------------------------ */ -struct EvaluationContext; struct Main; struct PointerRNA; @@ -75,19 +74,6 @@ typedef enum eEvaluationMode { DAG_EVAL_RENDER = 2, /* evaluate for render purposes */ } eEvaluationMode; -/* Dependency graph evaluation context - * - * This structure stores all the local dependency graph data, - * which is needed for it's evaluation, - */ -typedef struct EvaluationContext { - eEvaluationMode mode; - float ctime; - - struct Depsgraph *depsgraph; - struct ViewLayer *view_layer; -} EvaluationContext; - /* DagNode->eval_flags */ enum { /* Regardless to curve->path animation flag path is to be evaluated anyway, @@ -203,37 +189,6 @@ void DEG_ids_check_recalc(struct Main *bmain, /* ************************************************ */ /* Evaluation Engine API */ -/* Evaluation Context ---------------------------- */ - -/* Create new evaluation context. */ -struct EvaluationContext *DEG_evaluation_context_new(eEvaluationMode mode); - -/* Initialize evaluation context. - * Used by the areas which currently overrides the context or doesn't have - * access to a proper one. - */ -void DEG_evaluation_context_init(struct EvaluationContext *eval_ctx, - eEvaluationMode mode); -void DEG_evaluation_context_init_from_scene( - struct EvaluationContext *eval_ctx, - struct Scene *scene, - struct ViewLayer *view_layer, - eEvaluationMode mode); - -void DEG_evaluation_context_init_from_view_layer_for_render( - struct EvaluationContext *eval_ctx, - struct Depsgraph *depsgraph, - struct Scene *scene, - struct ViewLayer *view_layer); - -void DEG_evaluation_context_init_from_depsgraph( - struct EvaluationContext *eval_ctx, - struct Depsgraph *depsgraph, - eEvaluationMode mode); - -/* Free evaluation context. */ -void DEG_evaluation_context_free(struct EvaluationContext *eval_ctx); - /* Graph Evaluation ----------------------------- */ /* Frame changed recalculation entry point diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h index 334b15cc638..3460cbf7c91 100644 --- a/source/blender/depsgraph/DEG_depsgraph_build.h +++ b/source/blender/depsgraph/DEG_depsgraph_build.h @@ -42,7 +42,6 @@ struct Depsgraph; struct CacheFile; struct EffectorWeights; -struct EvaluationContext; struct Group; struct Main; struct ModifierData; diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index ceba87338a0..902a2ea3981 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -106,7 +106,6 @@ typedef struct DEGObjectIterData { int flag; struct Scene *scene; - struct EvaluationContext eval_ctx; int visibility_check; /* eObjectVisibilityCheck. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 92af811dab4..ca31c1c15a1 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -170,7 +170,7 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id) ComponentDepsNode *comp_cow = id_node->add_component(DEG_NODE_TYPE_COPY_ON_WRITE); OperationDepsNode *op_cow = comp_cow->add_operation( - function_bind(deg_evaluate_copy_on_write, _1, graph_, id_node), + function_bind(deg_evaluate_copy_on_write, _1, id_node), DEG_OPCODE_COPY_ON_WRITE, "", -1); graph_->operations.push_back(op_cow); diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index ac92d440bbe..edb6600f3e0 100644 --- a/source/blender/depsgraph/intern/depsgraph_eval.cc +++ b/source/blender/depsgraph/intern/depsgraph_eval.cc @@ -55,76 +55,6 @@ extern "C" { #include "intern/depsgraph.h" -/* ****************** */ -/* Evaluation Context */ - -/* Create new evaluation context. */ -EvaluationContext *DEG_evaluation_context_new(eEvaluationMode mode) -{ - EvaluationContext *eval_ctx = - (EvaluationContext *)MEM_callocN(sizeof(EvaluationContext), - "EvaluationContext"); - DEG_evaluation_context_init(eval_ctx, mode); - return eval_ctx; -} - -/** - * Initialize evaluation context. - * Used by the areas which currently overrides the context or doesn't have - * access to a proper one. - */ -void DEG_evaluation_context_init(EvaluationContext *eval_ctx, - eEvaluationMode mode) -{ - eval_ctx->mode = mode; -} - -void DEG_evaluation_context_init_from_scene( - EvaluationContext *eval_ctx, - Scene *scene, - ViewLayer *view_layer, - eEvaluationMode mode) -{ - DEG_evaluation_context_init(eval_ctx, mode); - eval_ctx->depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); - eval_ctx->view_layer = view_layer; - eval_ctx->ctime = BKE_scene_frame_get(scene); -} - -void DEG_evaluation_context_init_from_view_layer_for_render( - EvaluationContext *eval_ctx, - Depsgraph *depsgraph, - Scene *scene, - ViewLayer *view_layer) -{ - /* ViewLayer may come from a copy of scene.viewlayers, we need to find the original though. */ - ViewLayer *view_layer_original = (ViewLayer *)BLI_findstring(&scene->view_layers, view_layer->name, offsetof(ViewLayer, name)); - BLI_assert(view_layer_original != NULL); - - DEG_evaluation_context_init(eval_ctx, DAG_EVAL_RENDER); - eval_ctx->ctime = BKE_scene_frame_get(scene); - eval_ctx->depsgraph = depsgraph; - eval_ctx->view_layer = view_layer_original; -} - -void DEG_evaluation_context_init_from_depsgraph( - EvaluationContext *eval_ctx, - Depsgraph *depsgraph, - eEvaluationMode mode) -{ - Scene *scene = DEG_get_evaluated_scene(depsgraph); - DEG_evaluation_context_init(eval_ctx, mode); - eval_ctx->ctime = (float)scene->r.cfra + scene->r.subframe; - eval_ctx->depsgraph = depsgraph; - eval_ctx->view_layer = DEG_get_evaluated_view_layer(depsgraph); -} - -/* Free evaluation context. */ -void DEG_evaluation_context_free(EvaluationContext *eval_ctx) -{ - MEM_freeN(eval_ctx); -} - /* Evaluate all nodes tagged for updating. */ void DEG_evaluate_on_refresh(Depsgraph *graph) { diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index 61f1ccdd2a0..c610e7fc500 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -187,7 +187,7 @@ static void DEG_iterator_objects_step(BLI_Iterator *iter, DEG::IDDepsNode *id_no (object->transflag & OB_DUPLI)) { data->dupli_parent = object; - data->dupli_list = object_duplilist(&data->eval_ctx, data->scene, object); + data->dupli_list = object_duplilist(data->graph, data->scene, object); data->dupli_object_next = (DupliObject *)data->dupli_list->first; if (BKE_object_is_visible(object, (eObjectVisibilityCheck)data->visibility_check) == false) { return; @@ -209,13 +209,10 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data) return; } - /* TODO(sergey): What evaluation type we want here? */ - /* TODO(dfelinto): Get rid of evaluation context here, it's only used to do - * direct dupli-objects update in group.c. Which is terribly bad, and all - * objects are expected to be evaluated already. */ - DEG_evaluation_context_init(&data->eval_ctx, DAG_EVAL_VIEWPORT); - data->eval_ctx.depsgraph = depsgraph; - data->eval_ctx.view_layer = DEG_get_evaluated_view_layer(depsgraph); + /* TODO: Calling this forces the scene datablock to be expanded, + * otherwise we get crashes on load with copy-on-write. There may + * be a better solution for this. */ + DEG_get_evaluated_view_layer(depsgraph); iter->data = data; data->dupli_parent = NULL; diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h index d6c410347f6..6d328b399e0 100644 --- a/source/blender/depsgraph/intern/depsgraph_types.h +++ b/source/blender/depsgraph/intern/depsgraph_types.h @@ -49,8 +49,8 @@ struct bAction; struct ChannelDriver; struct ModifierData; struct PointerRNA; -struct EvaluationContext; struct FCurve; +struct Depsgraph; namespace DEG { @@ -61,7 +61,7 @@ using std::max; /* Evaluation Operation for atomic operation */ // XXX: move this to another header that can be exposed? -typedef function<void(struct EvaluationContext *)> DepsEvalOperationCb; +typedef function<void(struct ::Depsgraph *)> DepsEvalOperationCb; /* Metatype of Nodes - The general "level" in the graph structure * the node serves. diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index d40e3e85979..4dd3842070e 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -69,7 +69,6 @@ static void schedule_children(TaskPool *pool, const int thread_id); struct DepsgraphEvalState { - EvaluationContext *eval_ctx; Depsgraph *graph; bool do_stats; }; @@ -86,11 +85,11 @@ static void deg_task_run_func(TaskPool *pool, /* Perform operation. */ if (state->do_stats) { const double start_time = PIL_check_seconds_timer(); - node->evaluate(state->eval_ctx); + node->evaluate((::Depsgraph*)state->graph); node->stats.current_time += PIL_check_seconds_timer() - start_time; } else { - node->evaluate(state->eval_ctx); + node->evaluate((::Depsgraph*)state->graph); } /* Schedule children. */ BLI_task_pool_delayed_push_begin(pool, thread_id); @@ -229,21 +228,20 @@ static void schedule_children(TaskPool *pool, */ void deg_evaluate_on_refresh(Depsgraph *graph) { - /* Set time for the current graph evaluation context. */ - TimeSourceDepsNode *time_src = graph->find_time_source(); /* Nothing to update, early out. */ if (BLI_gset_len(graph->entry_tags) == 0) { return; } const bool do_time_debug = ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0); const double start_time = do_time_debug ? PIL_check_seconds_timer() : 0; - /* Set up evaluation context. */ - EvaluationContext eval_ctx; - DEG_evaluation_context_init_from_depsgraph(&eval_ctx, (::Depsgraph*)graph, graph->mode); - eval_ctx.ctime = time_src->cfra; + + /* TODO: Calling this forces the scene datablock to be expanded, + * otherwise we get crashes on load with copy-on-write. There may + * be a better solution for this. */ + DEG_get_evaluated_view_layer((const ::Depsgraph*)graph); + /* Set up evaluation state. */ DepsgraphEvalState state; - state.eval_ctx = &eval_ctx; state.graph = graph; state.do_stats = do_time_debug; /* Set up task scheduler and pull for threaded evaluation. */ diff --git a/source/blender/depsgraph/intern/eval/deg_eval.h b/source/blender/depsgraph/intern/eval/deg_eval.h index 0fb60e8f779..a8f5f7c145f 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.h +++ b/source/blender/depsgraph/intern/eval/deg_eval.h @@ -32,8 +32,6 @@ #pragma once -struct EvaluationContext; - namespace DEG { struct Depsgraph; diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 1d2169f5ec4..91790522590 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -781,10 +781,10 @@ void deg_free_copy_on_write_datablock(ID *id_cow) id_cow->name[0] = '\0'; } -void deg_evaluate_copy_on_write(const EvaluationContext * /*eval_ctx*/, - const Depsgraph *depsgraph, +void deg_evaluate_copy_on_write(struct ::Depsgraph *graph, const IDDepsNode *id_node) { + const DEG::Depsgraph *depsgraph = reinterpret_cast<const DEG::Depsgraph *>(graph); DEBUG_PRINT("%s on %s\n", __func__, id_node->id_orig->name); if (id_node->id_orig == &depsgraph->scene->id) { /* NOTE: This is handled by eval_ctx setup routines, which diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h index a2b57cb7198..8fca90e9f5b 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.h @@ -32,7 +32,6 @@ #include <stddef.h> -struct EvaluationContext; struct ID; /* Unkomment this to have verbose log about original and CoW pointers @@ -47,6 +46,8 @@ struct ID; # define DEG_COW_PRINT(format, ...) #endif +struct Depsgraph; + namespace DEG { struct Depsgraph; @@ -79,8 +80,7 @@ void deg_free_copy_on_write_datablock(struct ID *id_cow); /* Callback function for depsgraph operation node which ensures copy-on-write * datablock is ready for use by further evaluation routines. */ -void deg_evaluate_copy_on_write(const struct EvaluationContext *eval_ctx, - const struct Depsgraph *depsgraph, +void deg_evaluate_copy_on_write(struct ::Depsgraph *depsgraph, const struct IDDepsNode *id_node); /* Check that given ID is propely expanded and does not have any shallow diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h index b8009cc0a7f..5b6461f950e 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node_component.h +++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h @@ -39,8 +39,6 @@ struct ID; struct bPoseChannel; struct GHash; -struct EvaluationContext; - namespace DEG { struct Depsgraph; diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index 9b19163c8d7..4bac8ba2ebd 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -68,16 +68,13 @@ static void eevee_motion_blur_camera_get_matrix_at_time( cam_cpy.data = &camdata_cpy; const DRWContextState *draw_ctx = DRW_context_state_get(); - /* We will be modifying time, so we create copy of eval_ctx. */ - EvaluationContext eval_ctx = draw_ctx->eval_ctx; - eval_ctx.ctime = time; /* Past matrix */ /* FIXME : This is a temporal solution that does not take care of parent animations */ /* Recalc Anim manualy */ BKE_animsys_evaluate_animdata(scene, &cam_cpy.id, cam_cpy.adt, time, ADT_RECALC_ALL); BKE_animsys_evaluate_animdata(scene, &camdata_cpy.id, camdata_cpy.adt, time, ADT_RECALC_ALL); - BKE_object_where_is_calc_time(&eval_ctx, scene, &cam_cpy, time); + BKE_object_where_is_calc_time(draw_ctx->depsgraph, scene, &cam_cpy, time); /* Compute winmat */ CameraParams params; diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 5e00005edb6..27f2d891cc0 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -507,7 +507,6 @@ typedef struct DRWContextState { struct RenderEngineType *engine_type; - EvaluationContext eval_ctx; struct Depsgraph *depsgraph; eObjectMode object_mode; diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 0530d05c199..d7e8a6b71df 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -46,6 +46,8 @@ #include "GPU_batch.h" +#include "DEG_depsgraph_query.h" + #include "draw_cache_impl.h" /* own include */ static void particle_batch_cache_clear(ParticleSystem *psys); @@ -466,7 +468,7 @@ static void particle_batch_cache_ensure_pos(Object *object, ParticleSystem *psys ParticleSimulationData sim = {NULL}; const DRWContextState *draw_ctx = DRW_context_state_get(); - sim.eval_ctx = &draw_ctx->eval_ctx; + sim.depsgraph = draw_ctx->depsgraph; sim.scene = draw_ctx->scene; sim.ob = object; sim.psys = psys; @@ -494,7 +496,7 @@ static void particle_batch_cache_ensure_pos(Object *object, ParticleSystem *psys GWN_vertbuf_data_alloc(cache->pos, psys->totpart); for (curr_point = 0, i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { - state.time = draw_ctx->eval_ctx.ctime; + state.time = DEG_get_ctime(draw_ctx->depsgraph); if (!psys_get_particle_state(&sim, curr_point, &state, 0)) { continue; } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 420841e2efa..b77218ec6ff 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -350,16 +350,6 @@ static void drw_viewport_cache_resize(void) DRW_instance_data_list_resize(DST.idatalist); } -static void drw_state_eval_ctx_init(DRWManager *dst) -{ - DRWContextState *draw_ctx = &dst->draw_ctx; - DEG_evaluation_context_init_from_scene( - &draw_ctx->eval_ctx, - draw_ctx->scene, - draw_ctx->view_layer, - DST.options.is_scene_render ? DAG_EVAL_RENDER : DAG_EVAL_VIEWPORT); -} - /* Not a viewport variable, we could split this out. */ static void drw_context_state_init(void) { @@ -388,8 +378,6 @@ static void drw_context_state_init(void) else { DST.draw_ctx.object_pose = NULL; } - - drw_state_eval_ctx_init(&DST); } /* It also stores viewport variable to an immutable place: DST @@ -1122,15 +1110,14 @@ void DRW_notify_id_update(const DRWUpdateContext *update_ctx, ID *id) * for each relevant engine / mode engine. */ void DRW_draw_view(const bContext *C) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); + Depsgraph *depsgraph = CTX_data_depsgraph(C); RenderEngineType *engine_type = CTX_data_engine_type(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); - DRW_draw_render_loop_ex(eval_ctx.depsgraph, engine_type, ar, v3d, C); + DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, C); } /** diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c index 65f4653591f..4fb4464df06 100644 --- a/source/blender/draw/modes/sculpt_mode.c +++ b/source/blender/draw/modes/sculpt_mode.c @@ -202,7 +202,7 @@ static void SCULPT_cache_populate(void *vedata, Object *ob) * but this avoids waiting on first stroke) */ Scene *scene = draw_ctx->scene; - BKE_sculpt_update_mesh_elements(&draw_ctx->eval_ctx, scene, scene->toolsettings->sculpt, ob, false, false); + BKE_sculpt_update_mesh_elements(draw_ctx->depsgraph, scene, scene->toolsettings->sculpt, ob, false, false); } PBVH *pbvh = ob->sculpt->pbvh; 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)) { diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index c1fa86d4653..29d14442a47 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -80,16 +80,8 @@ NodeGroup *BlenderFileLoader::Load() } ViewLayer *view_layer = (ViewLayer*)BLI_findstring(&_re->scene->view_layers, _view_layer->name, offsetof(ViewLayer, name)); - - EvaluationContext *eval_ctx = DEG_evaluation_context_new(DAG_EVAL_RENDER); Depsgraph *depsgraph = DEG_graph_new(_re->scene, view_layer, DAG_EVAL_RENDER); - DEG_evaluation_context_init_from_view_layer_for_render( - eval_ctx, - depsgraph, - _re->scene, - view_layer); - BKE_scene_graph_update_tagged(depsgraph, _re->main); #if 0 @@ -116,7 +108,7 @@ NodeGroup *BlenderFileLoader::Load() bool apply_modifiers = true; bool calc_undeformed = false; bool calc_tessface = false; - Mesh *mesh = BKE_mesh_new_from_object(eval_ctx, + Mesh *mesh = BKE_mesh_new_from_object(depsgraph, _re->main, _re->scene, ob, @@ -132,7 +124,6 @@ NodeGroup *BlenderFileLoader::Load() DEG_OBJECT_ITER_END; DEG_graph_free(depsgraph); - DEG_evaluation_context_free(eval_ctx); // Return the built scene. return _Scene; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index a408a41513a..98d8eea6036 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1384,8 +1384,10 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr) shade_one_light(shi, shr, lamp); } + /* TODO: won't fix because will be removed. */ +#if 0 if (ob->transflag & OB_DUPLI) { - ListBase *lb = object_duplilist(G.main->eval_ctx, shi->gpumat->scene, ob); + ListBase *lb = object_duplilist(G.main->depsgraph, shi->gpumat->scene, ob); for (DupliObject *dob = lb->first; dob; dob = dob->next) { Object *ob_iter = dob->ob; @@ -1405,6 +1407,7 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr) free_object_duplilist(lb); } +#endif } /* prevent only shadow lamps from producing negative colors.*/ diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h index ad842029941..2a7a473db51 100644 --- a/source/blender/ikplugin/BIK_api.h +++ b/source/blender/ikplugin/BIK_api.h @@ -43,7 +43,7 @@ struct bPoseChannel; struct bPose; struct Scene; struct bConstraint; -struct EvaluationContext; +struct Depsgraph; enum BIK_ParamType { BIK_PARAM_TYPE_FLOAT = 0, @@ -62,8 +62,8 @@ struct BIK_ParamValue { }; typedef struct BIK_ParamValue BIK_ParamValue; -void BIK_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); -void BIK_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); +void BIK_initialize_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime); +void BIK_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); void BIK_release_tree(struct Scene *scene, struct Object *ob, float ctime); void BIK_clear_data(struct bPose *pose); void BIK_clear_cache(struct bPose *pose); diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c index 0ee26ff45f1..9330f969ae7 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.c +++ b/source/blender/ikplugin/intern/ikplugin_api.c @@ -89,20 +89,20 @@ static IKPlugin *get_plugin(bPose *pose) /*----------------------------------------*/ /* Plugin API */ -void BIK_initialize_tree(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) +void BIK_initialize_tree(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime) { IKPlugin *plugin = get_plugin(ob->pose); if (plugin && plugin->initialize_tree_func) - plugin->initialize_tree_func(eval_ctx, scene, ob, ctime); + plugin->initialize_tree_func(depsgraph, scene, ob, ctime); } -void BIK_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan, float ctime) +void BIK_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, Object *ob, bPoseChannel *pchan, float ctime) { IKPlugin *plugin = get_plugin(ob->pose); if (plugin && plugin->execute_tree_func) - plugin->execute_tree_func(eval_ctx, scene, ob, pchan, ctime); + plugin->execute_tree_func(depsgraph, scene, ob, pchan, ctime); } void BIK_release_tree(struct Scene *scene, Object *ob, float ctime) diff --git a/source/blender/ikplugin/intern/ikplugin_api.h b/source/blender/ikplugin/intern/ikplugin_api.h index 9a71463ede4..1c55639c33b 100644 --- a/source/blender/ikplugin/intern/ikplugin_api.h +++ b/source/blender/ikplugin/intern/ikplugin_api.h @@ -38,15 +38,15 @@ extern "C" { #endif +struct Depsgraph; struct Object; -struct bPoseChannel; struct Scene; -struct EvaluationContext; +struct bPoseChannel; struct IKPlugin { - void (*initialize_tree_func)(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); - void (*execute_tree_func)(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); + void (*initialize_tree_func)(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime); + void (*execute_tree_func)(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime); void (*release_tree_func)(struct Scene *scene, struct Object *ob, float ctime); void (*remove_armature_func)(struct bPose *pose); void (*clear_cache)(struct bPose *pose); diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 5169b72590c..8ad07d85639 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -252,7 +252,7 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[3][3]) // nr = /* called from within the core BKE_pose_where_is loop, all animsystems and constraints * were executed & assigned. Now as last we do an IK pass */ -static void execute_posetree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, PoseTree *tree) +static void execute_posetree(struct Depsgraph *depsgraph, struct Scene *scene, Object *ob, PoseTree *tree) { float R_parmat[3][3], identity[3][3]; float iR_parmat[3][3]; @@ -394,7 +394,7 @@ static void execute_posetree(const struct EvaluationContext *eval_ctx, struct Sc /* 1.0=ctime, we pass on object for auto-ik (owner-type here is object, even though * strictly speaking, it is a posechannel) */ - BKE_constraint_target_matrix_get(eval_ctx, scene, target->con, 0, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0); + BKE_constraint_target_matrix_get(depsgraph, scene, target->con, 0, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0); /* and set and transform goal */ mul_m4_m4m4(goal, goalinv, rootmat); @@ -405,7 +405,7 @@ static void execute_posetree(const struct EvaluationContext *eval_ctx, struct Sc /* same for pole vector target */ if (data->poletar) { - BKE_constraint_target_matrix_get(eval_ctx, scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0); + BKE_constraint_target_matrix_get(depsgraph, scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0); if (data->flag & CONSTRAINT_IK_SETANGLE) { /* don't solve IK when we are setting the pole angle */ @@ -534,7 +534,7 @@ static void free_posetree(PoseTree *tree) ///---------------------------------------- /// Plugin API for legacy iksolver -void iksolver_initialize_tree(const struct EvaluationContext *UNUSED(eval_ctx), struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime)) +void iksolver_initialize_tree(struct Depsgraph *UNUSED(depsgraph), struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime)) { bPoseChannel *pchan; @@ -545,7 +545,7 @@ void iksolver_initialize_tree(const struct EvaluationContext *UNUSED(eval_ctx), ob->pose->flag &= ~POSE_WAS_REBUILT; } -void iksolver_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +void iksolver_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { while (pchan_root->iktree.first) { PoseTree *tree = pchan_root->iktree.first; @@ -558,13 +558,13 @@ void iksolver_execute_tree(const struct EvaluationContext *eval_ctx, struct Scen /* 4. walk over the tree for regular solving */ for (a = 0; a < tree->totchannel; a++) { if (!(tree->pchan[a]->flag & POSE_DONE)) // successive trees can set the flag - BKE_pose_where_is_bone(eval_ctx, scene, ob, tree->pchan[a], ctime, 1); + BKE_pose_where_is_bone(depsgraph, scene, ob, tree->pchan[a], ctime, 1); /* tell blender that this channel was controlled by IK, it's cleared on each BKE_pose_where_is() */ tree->pchan[a]->flag |= POSE_CHAIN; } /* 5. execute the IK solver */ - execute_posetree(eval_ctx, scene, ob, tree); + execute_posetree(depsgraph, scene, ob, tree); /* 6. apply the differences to the channels, * we need to calculate the original differences first */ diff --git a/source/blender/ikplugin/intern/iksolver_plugin.h b/source/blender/ikplugin/intern/iksolver_plugin.h index f1ca91ebb49..9925d3c45d4 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.h +++ b/source/blender/ikplugin/intern/iksolver_plugin.h @@ -41,9 +41,9 @@ extern "C" { #endif void iksolver_initialize_tree( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime); void iksolver_execute_tree( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); #ifdef __cplusplus diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index c74cbb252ff..dc2d081f835 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -90,7 +90,7 @@ typedef void (*ErrorCallback)(const iTaSC::ConstraintValues *values, unsigned in // one structure for each target in the scene struct IK_Target { - const struct EvaluationContext *eval_ctx; + struct Depsgraph *bldepsgraph; struct Scene *blscene; iTaSC::MovingFrame* target; iTaSC::ConstraintSet* constraint; @@ -108,7 +108,7 @@ struct IK_Target { float eeRest[4][4]; //end effector initial pose relative to armature IK_Target() { - eval_ctx = NULL; + bldepsgraph = NULL; blscene = NULL; target = NULL; constraint = NULL; @@ -159,7 +159,7 @@ struct IK_Channel { }; struct IK_Scene { - const struct EvaluationContext *eval_ctx; + struct Depsgraph *bldepsgraph; struct Scene *blscene; IK_Scene* next; int numchan; // number of channel in pchan @@ -180,7 +180,7 @@ struct IK_Scene { std::vector<IK_Target*> targets; IK_Scene() { - eval_ctx = NULL; + bldepsgraph = NULL; blscene = NULL; next = NULL; channels = NULL; @@ -554,7 +554,7 @@ static bool target_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Fram bConstraint *constraint = (bConstraint *)target->blenderConstraint; float tarmat[4][4]; - BKE_constraint_target_matrix_get(target->eval_ctx, target->blscene, constraint, 0, CONSTRAINT_OBTYPE_OBJECT, target->owner, tarmat, 1.0); + BKE_constraint_target_matrix_get(target->bldepsgraph, target->blscene, constraint, 0, CONSTRAINT_OBTYPE_OBJECT, target->owner, tarmat, 1.0); // rootmat contains the target pose in world coordinate // if enforce is != 1.0, blend the target position with the end effector position @@ -623,7 +623,7 @@ static bool base_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Frame& IK_Channel &rootchan = ikscene->channels[0]; // get polar target matrix in world space - BKE_constraint_target_matrix_get(ikscene->eval_ctx, ikscene->blscene, ikscene->polarConstraint, 1, CONSTRAINT_OBTYPE_OBJECT, ikscene->blArmature, mat, 1.0); + BKE_constraint_target_matrix_get(ikscene->bldepsgraph, ikscene->blscene, ikscene->polarConstraint, 1, CONSTRAINT_OBTYPE_OBJECT, ikscene->blArmature, mat, 1.0); // convert to armature space mul_m4_m4m4(polemat, imat, mat); // get the target in world space (was computed before as target object are defined before base object) @@ -867,7 +867,7 @@ static bool joint_callback(const iTaSC::Timestamp& timestamp, iTaSC::ConstraintV } // build array of joint corresponding to IK chain -static int convert_channels(const struct EvaluationContext *eval_ctx, IK_Scene *ikscene, PoseTree *tree, float ctime) +static int convert_channels(struct Depsgraph *depsgraph, IK_Scene *ikscene, PoseTree *tree, float ctime) { IK_Channel *ikchan; bPoseChannel *pchan; @@ -884,7 +884,7 @@ static int convert_channels(const struct EvaluationContext *eval_ctx, IK_Scene * // this is because some of the pose data (e.g. pose head) don't have corresponding // joint angles and can't be applied to the iTaSC armature dynamically if (!(pchan->flag & POSE_DONE)) - BKE_pose_where_is_bone(eval_ctx, ikscene->blscene, ikscene->blArmature, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, 1); // tell blender that this channel was controlled by IK, it's cleared on each BKE_pose_where_is() pchan->flag |= (POSE_DONE | POSE_CHAIN); @@ -1060,7 +1060,7 @@ static void BKE_pose_rest(IK_Scene *ikscene) } } -static IK_Scene *convert_tree(const struct EvaluationContext *eval_ctx, Scene *blscene, Object *ob, bPoseChannel *pchan, float ctime) +static IK_Scene *convert_tree(struct Depsgraph *depsgraph, Scene *blscene, Object *ob, bPoseChannel *pchan, float ctime) { PoseTree *tree = (PoseTree *)pchan->iktree.first; PoseTarget *target; @@ -1086,7 +1086,7 @@ static IK_Scene *convert_tree(const struct EvaluationContext *eval_ctx, Scene *b ikscene = new IK_Scene; ikscene->blscene = blscene; - ikscene->eval_ctx = eval_ctx; + ikscene->bldepsgraph = depsgraph; arm = new iTaSC::Armature(); scene = new iTaSC::Scene(); ikscene->channels = new IK_Channel[tree->totchannel]; @@ -1139,7 +1139,7 @@ static IK_Scene *convert_tree(const struct EvaluationContext *eval_ctx, Scene *b std::vector<double> weights; double weight[3]; // build the array of joints corresponding to the IK chain - convert_channels(eval_ctx, ikscene, tree, ctime); + convert_channels(depsgraph, ikscene, tree, ctime); if (ingame) { // in the GE, set the initial joint angle to match the current pose // this will update the jointArray in ikscene @@ -1444,7 +1444,7 @@ static IK_Scene *convert_tree(const struct EvaluationContext *eval_ctx, Scene *b for (t = 0; t < ikscene->targets.size(); t++) { IK_Target *iktarget = ikscene->targets[t]; iktarget->blscene = blscene; - iktarget->eval_ctx = eval_ctx; + iktarget->bldepsgraph = depsgraph; condata = (bKinematicConstraint *)iktarget->blenderConstraint->data; pchan = tree->pchan[iktarget->channel]; unsigned int controltype, bonecnt; @@ -1532,7 +1532,7 @@ static IK_Scene *convert_tree(const struct EvaluationContext *eval_ctx, Scene *b return ikscene; } -static void create_scene(const struct EvaluationContext *eval_ctx, Scene *scene, Object *ob, float ctime) +static void create_scene(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime) { bPoseChannel *pchan; @@ -1543,7 +1543,7 @@ static void create_scene(const struct EvaluationContext *eval_ctx, Scene *scene, if (tree) { IK_Data *ikdata = get_ikdata(ob->pose); // convert tree in iTaSC::Scene - IK_Scene *ikscene = convert_tree(eval_ctx, scene, ob, pchan, ctime); + IK_Scene *ikscene = convert_tree(depsgraph, scene, ob, pchan, ctime); if (ikscene) { ikscene->next = ikdata->first; ikdata->first = ikscene; @@ -1582,7 +1582,7 @@ static int init_scene(Object *ob) return 0; } -static void execute_scene(const struct EvaluationContext *eval_ctx, Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, float ctime, float frtime) +static void execute_scene(struct Depsgraph *depsgraph, Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, float ctime, float frtime) { int i; IK_Channel *ikchan; @@ -1598,7 +1598,7 @@ static void execute_scene(const struct EvaluationContext *eval_ctx, Scene *blsce // in animation mode, we must get the bone position from action and constraints for (i = 0, ikchan = ikscene->channels; i < ikscene->numchan; i++, ++ikchan) { if (!(ikchan->pchan->flag & POSE_DONE)) - BKE_pose_where_is_bone(eval_ctx, blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); // tell blender that this channel was controlled by IK, it's cleared on each BKE_pose_where_is() ikchan->pchan->flag |= (POSE_DONE | POSE_CHAIN); ikchan->jointValid = 0; @@ -1750,7 +1750,7 @@ static void execute_scene(const struct EvaluationContext *eval_ctx, Scene *blsce //--------------------------------------------------- // plugin interface // -void itasc_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, float ctime) +void itasc_initialize_tree(struct Depsgraph *depsgraph, struct Scene *scene, Object *ob, float ctime) { bPoseChannel *pchan; int count = 0; @@ -1770,13 +1770,13 @@ void itasc_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scen // if at least one tree, create the scenes from the PoseTree stored in the channels // postpone until execute_tree: this way the pose constraint are included if (count) - create_scene(eval_ctx, scene, ob, ctime); + create_scene(depsgraph, scene, ob, ctime); itasc_update_param(ob->pose); // make sure we don't rebuilt until the user changes something important ob->pose->flag &= ~POSE_WAS_REBUILT; } -void itasc_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) +void itasc_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime) { if (ob->pose->ikdata) { IK_Data *ikdata = (IK_Data *)ob->pose->ikdata; @@ -1793,7 +1793,7 @@ void itasc_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene * if (timestep > 0.2f) timestep = 0.2f; } - execute_scene(eval_ctx, scene, ikscene, ikparam, ctime, timestep); + execute_scene(depsgraph, scene, ikscene, ikparam, ctime, timestep); break; } } diff --git a/source/blender/ikplugin/intern/itasc_plugin.h b/source/blender/ikplugin/intern/itasc_plugin.h index 2f4e4036d76..0ab9a67dce4 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.h +++ b/source/blender/ikplugin/intern/itasc_plugin.h @@ -40,8 +40,8 @@ extern "C" { #endif -void itasc_initialize_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, float ctime); -void itasc_execute_tree(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); +void itasc_initialize_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime); +void itasc_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime); void itasc_release_tree(struct Scene *scene, struct Object *ob, float ctime); void itasc_clear_data(struct bPose *pose); void itasc_clear_cache(struct bPose *pose); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 077dac262b6..41970a69c6c 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -302,14 +302,8 @@ Mesh *rna_Main_meshes_new_from_object( Main *bmain, ReportList *reports, Depsgraph *depsgraph, Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed) { - EvaluationContext eval_ctx; Scene *sce = DEG_get_evaluated_scene(depsgraph); - DEG_evaluation_context_init(&eval_ctx, DEG_get_mode(depsgraph)); - eval_ctx.ctime = DEG_get_ctime(depsgraph); - eval_ctx.view_layer = DEG_get_evaluated_view_layer(depsgraph); - eval_ctx.depsgraph = depsgraph; - switch (ob->type) { case OB_FONT: case OB_CURVE: @@ -322,7 +316,7 @@ Mesh *rna_Main_meshes_new_from_object( return NULL; } - return BKE_mesh_new_from_object(&eval_ctx, bmain, sce, ob, apply_modifiers, calc_tessface, calc_undeformed); + return BKE_mesh_new_from_object(depsgraph, bmain, sce, ob, apply_modifiers, calc_tessface, calc_undeformed); } static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type) diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 8589d819360..124f3a2fbe2 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -48,6 +48,7 @@ #include "BKE_mball.h" #include "BKE_main.h" +#include "BKE_scene.h" #include "DEG_depsgraph.h" diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 012545cb5d2..0caffb4867c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3144,11 +3144,6 @@ void rna_ShaderNodePointDensity_density_cache(bNode *self, return; } - EvaluationContext eval_ctx; - DEG_evaluation_context_init_from_depsgraph(&eval_ctx, - depsgraph, - DEG_get_mode(depsgraph)); - /* Make sure there's no cached data. */ BKE_texture_pointdensity_free_data(pd); RE_point_density_free(pd); @@ -3177,8 +3172,7 @@ void rna_ShaderNodePointDensity_density_cache(bNode *self, shader_point_density->cached_resolution = shader_point_density->resolution; /* Single-threaded sampling of the voxel domain. */ - RE_point_density_cache(&eval_ctx, - pd); + RE_point_density_cache(depsgraph, pd); } void rna_ShaderNodePointDensity_density_calc(bNode *self, @@ -3195,11 +3189,6 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self, return; } - EvaluationContext eval_ctx; - DEG_evaluation_context_init_from_depsgraph(&eval_ctx, - depsgraph, - DEG_get_mode(depsgraph)); - /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */ *length = 4 * resolution * resolution * resolution; @@ -3208,10 +3197,7 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self, } /* Single-threaded sampling of the voxel domain. */ - RE_point_density_sample(&eval_ctx, - pd, - resolution, - *values); + RE_point_density_sample(depsgraph, pd, resolution, *values); /* We're done, time to clean up. */ BKE_texture_pointdensity_free_data(pd); @@ -3233,12 +3219,7 @@ void rna_ShaderNodePointDensity_density_minmax(bNode *self, return; } - EvaluationContext eval_ctx; - DEG_evaluation_context_init_from_depsgraph(&eval_ctx, - depsgraph, - DEG_get_mode(depsgraph)); - - RE_point_density_minmax(&eval_ctx, pd, r_min, r_max); + RE_point_density_minmax(depsgraph, pd, r_min, r_max); } #else diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index d2afb43d65e..7887ea49f19 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -163,7 +163,7 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int previe } static void rna_Scene_ray_cast( - Scene *scene, ViewLayer *view_layer, + Scene *scene, ViewLayer *UNUSED(view_layer), float origin[3], float direction[3], float ray_dist, int *r_success, float r_location[3], float r_normal[3], int *r_index, Object **r_ob, float r_obmat[16]) @@ -171,7 +171,7 @@ static void rna_Scene_ray_cast( normalize_v3(direction); SnapObjectContext *sctx = ED_transform_snap_object_context_create( - G.main, scene, view_layer, 0); + G.main, scene, 0); bool ret = ED_transform_snap_object_project_ray_ex( sctx, diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c index 822f5cbb4b6..f1206b7130f 100644 --- a/source/blender/makesrna/intern/rna_space_api.c +++ b/source/blender/makesrna/intern/rna_space_api.c @@ -39,20 +39,27 @@ static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d, bContext *C) { bScreen *sc = (bScreen *)id; - EvaluationContext eval_ctx; ScrArea *sa; ARegion *ar; - CTX_data_eval_ctx(C, &eval_ctx); - area_region_from_regiondata(sc, rv3d, &sa, &ar); if (sa && ar && sa->spacetype == SPACE_VIEW3D) { View3D *v3d = sa->spacedata.first; - Scene *scene = ED_screen_scene_find(sc, G.main->wm.first); - - ED_view3d_update_viewmat(&eval_ctx, scene, v3d, ar, NULL, NULL, NULL); + wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win; + + for (win = wm->windows.first; win; win = win->next) { + if (WM_window_get_active_screen(win) == sc) { + Scene *scene = WM_window_get_active_scene(win); + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + + ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL); + break; + } + } } } diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index f6640704a83..37578664c4e 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -106,7 +106,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte } } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -127,7 +127,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *em, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData *) md; @@ -150,7 +150,7 @@ static void deformVertsEM( } static void deformMatricesEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *em, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { @@ -165,7 +165,7 @@ static void deformMatricesEM( if (!derivedData) dm->release(dm); } -static void deformMatrices(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformMatrices(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index f598667f96d..42e3cf94d00 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -754,7 +754,7 @@ static DerivedMesh *arrayModifier_doArray( } -static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 35b8a3fd9cb..48de3507cfd 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -86,7 +86,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) /* * This calls the new bevel code (added since 2.64) */ -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), struct Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index c9d762a7fbe..16d456d1314 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -166,7 +166,7 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data)) } static DerivedMesh *applyModifier( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 2e0b13b0603..f99fef130f8 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -75,7 +75,7 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) return true; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index bf86377960a..9037e5b6d54 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -429,7 +429,7 @@ static void cuboid_do( } } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -452,7 +452,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 0c55d8f8beb..fd5bf1af312 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -69,7 +69,7 @@ static void initData(ModifierData *md) cloth_init(clmd); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], +static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm; @@ -109,7 +109,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_c CDDM_apply_vert_coords(dm, vertexCos); - clothModifier_do(clmd, eval_ctx, md->scene, ob, dm, vertexCos); + clothModifier_do(clmd, depsgraph, md->scene, ob, dm, vertexCos); dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index d2ecbaeaafe..cc14e6a0528 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -98,7 +98,7 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) return true; } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index d95f0ae9286..23a78312871 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -713,7 +713,7 @@ error: static void deformVerts( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); @@ -727,7 +727,7 @@ static void deformVerts( static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index acb69de1e85..2152717319f 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -111,7 +111,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Curve Modifier"); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -126,14 +126,14 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; if (!derivedData) dm = CDDM_from_editbmesh(em, false, false); - deformVerts(md, eval_ctx, ob, dm, vertexCos, numVerts, 0); + deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0); if (!derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index a804a35954c..5b98c84422b 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -148,7 +148,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) DT_TYPE_SHARP_FACE \ ) -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { DataTransferModifierData *dtmd = (DataTransferModifierData *) md; @@ -180,7 +180,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte BKE_reports_init(&reports, RPT_STORE); /* Note: no islands precision for now here. */ - BKE_object_data_transfer_dm(eval_ctx, md->scene, dtmd->ob_source, ob, dm, dtmd->data_types, false, + BKE_object_data_transfer_dm(depsgraph, md->scene, dtmd->ob_source, ob, dm, dtmd->data_types, false, dtmd->vmap_mode, dtmd->emap_mode, dtmd->lmap_mode, dtmd->pmap_mode, space_transform, false, max_dist, dtmd->map_ray_radius, 0.0f, dtmd->layers_select_src, dtmd->layers_select_dst, diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 83dcd7b9b89..ff124ef607d 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -86,7 +86,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 7ec89b23f25..a28c0fb8379 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -368,7 +368,7 @@ static void displaceModifier_do( } } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -384,7 +384,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos, dependsOnNormals(md)); diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index 914b4101760..4335d488656 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -114,7 +114,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { @@ -122,7 +122,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte /* dont apply dynamic paint on orco dm stack */ if (!(flag & MOD_APPLY_ORCO)) { - return dynamicPaint_Modifier_do(pmd, eval_ctx, md->scene, ob, dm); + return dynamicPaint_Modifier_do(pmd, depsgraph, md->scene, ob, dm); } return dm; } diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 0e344a851f2..655284930b7 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -121,7 +121,7 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 8483da60576..041289bf70a 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -787,7 +787,7 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) } static DerivedMesh *explodeMesh( ExplodeModifierData *emd, - ParticleSystemModifierData *psmd, const struct EvaluationContext *eval_ctx, Scene *scene, + ParticleSystemModifierData *psmd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, DerivedMesh *to_explode) { DerivedMesh *explode, *dm = to_explode; @@ -813,7 +813,7 @@ static DerivedMesh *explodeMesh( mface = dm->getTessFaceArray(dm); totpart = psmd->psys->totpart; - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = ob; sim.psys = psmd->psys; @@ -995,7 +995,7 @@ static ParticleSystemModifierData *findPrecedingParticlesystem(Object *ob, Modif } return psmd; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { @@ -1030,7 +1030,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte if (emd->flag & eExplodeFlag_EdgeCut) { int *facepa = emd->facepa; DerivedMesh *splitdm = cutEdges(emd, dm); - DerivedMesh *explode = explodeMesh(emd, psmd, eval_ctx, md->scene, ob, splitdm); + DerivedMesh *explode = explodeMesh(emd, psmd, depsgraph, md->scene, ob, splitdm); MEM_freeN(emd->facepa); emd->facepa = facepa; @@ -1038,7 +1038,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte return explode; } else - return explodeMesh(emd, psmd, eval_ctx, md->scene, ob, derivedData); + return explodeMesh(emd, psmd, depsgraph, md->scene, ob, derivedData); } return derivedData; } diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 403a8706295..4b84fa00415 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -82,7 +82,7 @@ static void copyData(ModifierData *md, ModifierData *target) -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 00abcc1c65c..c7c1f92edb1 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -352,7 +352,7 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, } } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { @@ -368,7 +368,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED dm->release(dm); } -static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, +static void deformVertsEM(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { HookModifierData *hmd = (HookModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 72db3f1c132..c3a7e63173c 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -724,7 +724,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); @@ -736,7 +736,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 977b8b41cc3..5d3cfd830a0 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -506,7 +506,7 @@ static CustomDataMask required_data_mask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm; @@ -524,7 +524,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 4bf52f552ce..cff07dd1584 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -99,7 +99,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier"); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -115,14 +115,14 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; if (!derivedData) dm = CDDM_from_editbmesh(em, false, false); - deformVerts(md, eval_ctx, ob, dm, vertexCos, numVerts, 0); + deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0); if (!derivedData) dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 080dc371508..eb9f1f39f56 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -90,7 +90,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte } } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 5dfa1d874b2..43c7a044434 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -272,7 +272,7 @@ static void meshcache_do( } } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -284,7 +284,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *UNUSED(editData), + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index d7f4af8df63..27a2f94255b 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -273,7 +273,7 @@ static void meshdeform_vert_task( } static void meshdeformModifier_do( - ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *dm, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { MeshDeformModifierData *mmd = (MeshDeformModifierData *) md; @@ -300,7 +300,7 @@ static void meshdeformModifier_do( */ if (mmd->object->mode & OB_MODE_EDIT) { BMEditMesh *em = BKE_editmesh_from_object(mmd->object); - tmpdm = editbmesh_get_derived_cage_and_final(eval_ctx, md->scene, mmd->object, em, 0, &cagedm); + tmpdm = editbmesh_get_derived_cage_and_final(depsgraph, md->scene, mmd->object, em, 0, &cagedm); if (tmpdm) tmpdm->release(tmpdm); } @@ -409,7 +409,7 @@ static void meshdeformModifier_do( cagedm->release(cagedm); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, +static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -419,13 +419,13 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_c modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ - meshdeformModifier_do(md, eval_ctx, ob, dm, vertexCos, numVerts); + meshdeformModifier_do(md, depsgraph, ob, dm, vertexCos, numVerts); if (dm && dm != derivedData) dm->release(dm); } -static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, +static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, float (*vertexCos)[3], @@ -433,7 +433,7 @@ static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); - meshdeformModifier_do(md, eval_ctx, ob, dm, vertexCos, numVerts); + meshdeformModifier_do(md, depsgraph, ob, dm, vertexCos, numVerts); if (dm && dm != derivedData) dm->release(dm); diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index 10e1cdea4ca..a1ab20a6612 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -90,7 +90,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0'); } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 62de2711b3d..1f51d5dba11 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -319,7 +319,7 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd, return result; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 2b675d36140..3145bef5ac0 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -67,7 +67,7 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { MultiresModifierData *mmd = (MultiresModifierData *)md; diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 4fc49234468..9be23dbade6 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -517,7 +517,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte } } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { return normalEditModifier_do((NormalEditModifierData *)md, ob, dm); diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index b3a7ecaa138..f495e96f635 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -555,7 +555,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob), } #endif /* WITH_OCEANSIM */ -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 7979751395a..e38c7ea715f 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -161,7 +161,7 @@ static int particle_skip(ParticleInstanceModifierData *pimd, ParticleSystem *psy return 0; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { @@ -207,7 +207,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte if (totpart == 0) return derivedData; - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = md->scene; sim.ob = pimd->ob; sim.psys = psys; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 9cc6e5f56b5..4dbd7ef7849 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -97,7 +97,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) } /* saves the current emitter state for a particle system and calculates particles */ -static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, +static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), @@ -186,7 +186,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_c if (!(ob->transflag & OB_NO_PSYS_UPDATE)) { psmd->flag &= ~eParticleSystemFlag_psys_updated; - particle_system_update(eval_ctx, md->scene, ob, psys, (flag & MOD_APPLY_RENDER) != 0); + particle_system_update(depsgraph, md->scene, ob, psys, (flag & MOD_APPLY_RENDER) != 0); psmd->flag |= eParticleSystemFlag_psys_updated; } } diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index c9070cced7e..67a4865f9db 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -143,7 +143,7 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4]) } static DerivedMesh *applyModifier(ModifierData *md, - const struct EvaluationContext *UNUSED(eval_ctx), + struct Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) @@ -205,7 +205,7 @@ static DerivedMesh *applyModifier(ModifierData *md, #else /* !WITH_MOD_REMESH */ static DerivedMesh *applyModifier(ModifierData *UNUSED(md), - const struct EvaluationContext *UNUSED(eval_ctx), + struct Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 5f30b762275..69ac3dbfefd 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -184,7 +184,7 @@ static void copyData(ModifierData *md, ModifierData *target) modifier_copyData_generic(md, target); } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag flag) { diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 822decea423..dc93474a420 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -44,7 +44,7 @@ #include "MOD_modifiertypes.h" -static void deformVerts(ModifierData *UNUSED(md), const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *UNUSED(md), struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts, @@ -61,7 +61,7 @@ static void deformVerts(ModifierData *UNUSED(md), const struct EvaluationContext } } -static void deformMatrices(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, DerivedMesh *derivedData, +static void deformMatrices(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { Key *key = BKE_key_from_object(ob); @@ -80,10 +80,10 @@ static void deformMatrices(ModifierData *md, const struct EvaluationContext *eva copy_m3_m3(defMats[a], scale); } - deformVerts(md, eval_ctx, ob, derivedData, vertexCos, numVerts, 0); + deformVerts(md, depsgraph, ob, derivedData, vertexCos, numVerts, 0); } -static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, +static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, float (*vertexCos)[3], @@ -92,10 +92,10 @@ static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval Key *key = BKE_key_from_object(ob); if (key && key->type == KEY_RELATIVE) - deformVerts(md, eval_ctx, ob, derivedData, vertexCos, numVerts, 0); + deformVerts(md, depsgraph, ob, derivedData, vertexCos, numVerts, 0); } -static void deformMatricesEM(ModifierData *UNUSED(md), const struct EvaluationContext *UNUSED(eval_ctx), +static void deformMatricesEM(ModifierData *UNUSED(md), struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index cbb96b31db1..877429c4a0b 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -103,7 +103,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, &smd->auxTarget, IDWALK_CB_NOP); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -124,7 +124,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED dm->release(dm); } -static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static void deformVertsEM(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 8590deb508a..5cbb602113a 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -383,7 +383,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte } } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -403,7 +403,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED dm->release(dm); } -static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVertsEM(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 4afe6ca33e2..ebf7fe9f640 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -1917,7 +1917,7 @@ static void copyData(ModifierData *md, ModifierData *target) } static DerivedMesh *applyModifier(ModifierData *md, - const struct EvaluationContext *UNUSED(eval_ctx), + struct Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index e610ef5f78d..330e0b05cdb 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -102,7 +102,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph, Object *ob, DerivedMesh *dm, ModifierApplyFlag flag) { @@ -111,7 +111,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eva if (flag & MOD_APPLY_ORCO) return dm; - return smokeModifier_do(smd, eval_ctx, md->scene, ob, dm); + return smokeModifier_do(smd, depsgraph, md->scene, ob, dm); } static bool dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 91c724cd1c9..346a973fa77 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -215,7 +215,7 @@ static void smoothModifier_do( MEM_freeN(uctmp); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); @@ -228,7 +228,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, struct BMEditMesh *editData, + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 8d5217391af..876f56f4192 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -49,13 +49,13 @@ #include "MOD_modifiertypes.h" -static void deformVerts(ModifierData *md, const EvaluationContext *eval_ctx, Object *ob, +static void deformVerts(ModifierData *md, Depsgraph *depsgraph, Object *ob, DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { - sbObjectStep(eval_ctx, md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts); + sbObjectStep(depsgraph, md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts); } static bool dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 5635d37f100..68cd34b348c 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -205,7 +205,7 @@ BLI_INLINE void madd_v3v3short_fl(float r[3], const short a[3], const float f) } static DerivedMesh *applyModifier( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index a09923d6dfe..d620fec8ede 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -98,7 +98,7 @@ static bool isDisabled(ModifierData *md, int useRenderParams) return get_render_subsurf_level(&md->scene->r, levels, useRenderParams != 0) == 0; } -static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eval_ctx, +static DerivedMesh *applyModifier(ModifierData *md, Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, ModifierApplyFlag flag) { @@ -135,7 +135,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eva else if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) != 0) { modifier_setError(md, "OpenSubdiv is not supported in paint modes"); } - else if ((DEG_get_eval_flags_for_id(eval_ctx->depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) == 0) { + else if ((DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CPU) == 0) { subsurf_flags |= SUBSURF_USE_GPU_BACKEND; do_cddm_convert = false; } @@ -156,14 +156,14 @@ static DerivedMesh *applyModifier(ModifierData *md, const EvaluationContext *eva #ifndef WITH_OPESUBDIV (void) do_cddm_convert; - UNUSED_VARS(eval_ctx); + UNUSED_VARS(depsgraph); #endif return result; } static DerivedMesh *applyModifierEM( - ModifierData *md, const EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), struct BMEditMesh *UNUSED(editData), DerivedMesh *derivedData, ModifierApplyFlag flag) diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index bef35ccf1fe..5115572168b 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -85,7 +85,7 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) return true; } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 30b569207db..0d50cb40937 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -1181,7 +1181,7 @@ static void surfacedeformModifier_do( } static void deformVerts( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) @@ -1190,7 +1190,7 @@ static void deformVerts( } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), + ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, struct BMEditMesh *UNUSED(editData), DerivedMesh *UNUSED(derivedData), float (*vertexCos)[3], int numVerts) diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c index 5dd7e3dfda4..69e6578a280 100644 --- a/source/blender/modifiers/intern/MOD_triangulate.c +++ b/source/blender/modifiers/intern/MOD_triangulate.c @@ -85,7 +85,7 @@ static void copyData(ModifierData *md, ModifierData *target) } static DerivedMesh *applyModifier(ModifierData *md, - const struct EvaluationContext *UNUSED(eval_ctx), + struct Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 02f799fecb9..386417e092a 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -331,7 +331,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, return dm; } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index 8af9fd6cde4..53e7d9f8e17 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -146,7 +146,7 @@ static void uv_warp_compute( } } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 204e344b8e1..06167bea3ab 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -309,7 +309,7 @@ static int warp_needs_dm(WarpModifierData *wmd) return wmd->texture || wmd->defgrp_name[0]; } -static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, DerivedMesh *derivedData, +static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *dm = NULL; @@ -326,7 +326,7 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED } } -static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval_ctx, Object *ob, struct BMEditMesh *em, +static void deformVertsEM(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; @@ -337,7 +337,7 @@ static void deformVertsEM(ModifierData *md, const struct EvaluationContext *eval dm = CDDM_from_editbmesh(em, false, false); } - deformVerts(md, eval_ctx, ob, dm, vertexCos, numVerts, 0); + deformVerts(md, depsgraph, ob, dm, vertexCos, numVerts, 0); if (use_dm) { if (!derivedData) dm->release(dm); diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 7921ea662a7..3126ea0139e 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -56,6 +56,7 @@ #include "MOD_util.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" static void initData(ModifierData *md) { @@ -148,7 +149,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) } static void waveModifier_do(WaveModifierData *md, - const EvaluationContext *eval_ctx, + Depsgraph *depsgraph, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { @@ -156,7 +157,7 @@ static void waveModifier_do(WaveModifierData *md, MVert *mvert = NULL; MDeformVert *dvert; int defgrp_index; - float ctime = eval_ctx->ctime; + float ctime = DEG_get_ctime(depsgraph); float minfac = (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow)); float lifefac = wmd->height; float (*tex_co)[3] = NULL; @@ -301,7 +302,7 @@ static void waveModifier_do(WaveModifierData *md, if (wmd->texture) MEM_freeN(tex_co); } -static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_ctx, +static void deformVerts(ModifierData *md, struct Depsgraph *depsgraph, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, @@ -315,14 +316,14 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_c else if (wmd->texture || wmd->defgrp_name[0]) dm = get_dm(ob, NULL, dm, NULL, false, false); - waveModifier_do(wmd, eval_ctx, ob, dm, vertexCos, numVerts); + waveModifier_do(wmd, depsgraph, ob, dm, vertexCos, numVerts); if (dm != derivedData) dm->release(dm); } static void deformVertsEM( - ModifierData *md, const struct EvaluationContext *eval_ctx, + ModifierData *md, struct Depsgraph *depsgraph, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { @@ -334,7 +335,7 @@ static void deformVertsEM( else if (wmd->texture || wmd->defgrp_name[0]) dm = get_dm(ob, editData, dm, NULL, false, false); - waveModifier_do(wmd, eval_ctx, ob, dm, vertexCos, numVerts); + waveModifier_do(wmd, depsgraph, ob, dm, vertexCos, numVerts); if (dm != derivedData) dm->release(dm); diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 6fdfe215c37..ba5422b929d 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -155,7 +155,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) } static DerivedMesh *applyModifier(ModifierData *md, - const struct EvaluationContext *UNUSED(eval_ctx), + struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 45c41498792..28f6be5d588 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -201,7 +201,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) return (wmd->defgrp_name_a[0] == '\0'); } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 84c5207830e..f0641365d3e 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -368,7 +368,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) return (wmd->proximity_ob_target == NULL); } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *derivedData, ModifierApplyFlag UNUSED(flag)) { WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md; diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c index 3cb35286114..e9b9a66cd73 100644 --- a/source/blender/modifiers/intern/MOD_wireframe.c +++ b/source/blender/modifiers/intern/MOD_wireframe.c @@ -102,7 +102,7 @@ static DerivedMesh *WireframeModifier_do(WireframeModifierData *wmd, Object *ob, } -static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *UNUSED(depsgraph), Object *ob, DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { return WireframeModifier_do((WireframeModifierData *)md, ob, dm); diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index ec787768a57..a6ed92d139c 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -933,7 +933,7 @@ PyDoc_STRVAR(bpy_bmesh_from_object_doc, ); static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw) { - /* TODO: This doesn't work currently because of eval_ctx. */ + /* TODO: This doesn't work currently because of missing depsgraph. */ #if 0 static const char *kwlist[] = {"object", "scene", "deform", "render", "cage", "face_normals", NULL}; PyObject *py_object; diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c index 72d338bd5db..cbfc712b331 100644 --- a/source/blender/python/intern/gpu_offscreen.c +++ b/source/blender/python/intern/gpu_offscreen.c @@ -163,7 +163,7 @@ PyDoc_STRVAR(pygpu_offscreen_draw_view3d_doc, ); static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *args, PyObject *kwds) { - /* TODO: This doesn't work currently because of eval_ctx. */ + /* TODO: This doesn't work currently because of missing depsgraph. */ #if 0 static const char *kwlist[] = {"scene", "view_layer", "view3d", "region", "projection_matrix", "modelview_matrix", NULL}; diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index 88195700a50..4119917a33f 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -1049,7 +1049,7 @@ static DerivedMesh *bvh_get_derived_mesh( const char *funcname, struct Scene *scene, Object *ob, bool use_deform, bool use_render, bool use_cage) { - /* TODO: This doesn't work currently because of eval_ctx. */ + /* TODO: This doesn't work currently because of missing depsgraph. */ #if 0 /* we only need minimum mesh data for topology and vertex locations */ CustomDataMask mask = CD_MASK_BAREMESH; diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index d5230f74316..8e9d005df9c 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -42,7 +42,7 @@ struct bNodeTree; struct BakePixel; struct Depsgraph; struct Depsgraph; -struct EvaluationContext; +struct Depsgraph; struct IDProperty; struct Main; struct Object; diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index c5e8443374a..802413f3580 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -39,7 +39,6 @@ struct bMovieHandle; struct bNodeTree; struct Depsgraph; -struct EvaluationContext; struct Image; struct ImageFormatData; struct Main; @@ -123,8 +122,6 @@ typedef struct RenderLayer { /* optional saved endresult on disk */ void *exrhandle; - struct EvaluationContext eval_ctx; - ListBase passes; } RenderLayer; @@ -274,7 +271,7 @@ void RE_Database_FromScene( void RE_Database_CameraOnly( struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int use_camera_view); -void RE_Database_Preprocess(struct EvaluationContext *eavl_ctx, struct Render *re); +void RE_Database_Preprocess(struct Depsgraph *depsgraph, struct Render *re); void RE_Database_Free(struct Render *re); /* project dbase again, when viewplane/perspective changed */ diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h index 0021687efbd..cf0ff009190 100644 --- a/source/blender/render/extern/include/RE_render_ext.h +++ b/source/blender/render/extern/include/RE_render_ext.h @@ -38,7 +38,7 @@ /* called by meshtools */ struct DerivedMesh; -struct EvaluationContext; +struct Depsgraph; struct ImagePool; struct MTex; struct Scene; @@ -56,7 +56,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen void RE_texture_rng_init(void); void RE_texture_rng_exit(void); -struct Material *RE_sample_material_init(const struct EvaluationContext *eval_ctx, struct Material *orig_mat, struct Scene *scene); +struct Material *RE_sample_material_init(struct Depsgraph *depsgraph, struct Material *orig_mat, struct Scene *scene); void RE_sample_material_free(struct Material *mat); void RE_sample_material_color( struct Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3], @@ -69,16 +69,16 @@ void ibuf_sample(struct ImBuf *ibuf, float fx, float fy, float dx, float dy, flo struct PointDensity; void RE_point_density_cache( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct PointDensity *pd); void RE_point_density_minmax( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct PointDensity *pd, float r_min[3], float r_max[3]); void RE_point_density_sample( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct PointDensity *pd, const int resolution, float *values); diff --git a/source/blender/render/intern/include/pointdensity.h b/source/blender/render/intern/include/pointdensity.h index f122b3dc4c1..263fa44f9c4 100644 --- a/source/blender/render/intern/include/pointdensity.h +++ b/source/blender/render/intern/include/pointdensity.h @@ -37,14 +37,14 @@ * Make point density kd-trees for all point density textures in the scene */ -struct EvaluationContext; +struct Depsgraph; struct PointDensity; struct Render; struct TexResult; void free_pointdensity(struct PointDensity *pd); -void cache_pointdensity(const struct EvaluationContext *eval_ctx, struct Render *re, struct PointDensity *pd); -void make_pointdensities(const struct EvaluationContext *eval_ctx, struct Render *re); +void cache_pointdensity(struct Depsgraph *depsgraph, struct Render *re, struct PointDensity *pd); +void make_pointdensities(struct Depsgraph *depsgraph, struct Render *re); void free_pointdensities(struct Render *re); int pointdensitytex(struct Tex *tex, const float texvec[3], struct TexResult *texres); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 2c46138c7ea..9b0206fd05d 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -52,7 +52,7 @@ #include "BLI_sys_types.h" // for intptr_t support -struct EvaluationContext; +struct Depsgraph; struct Object; struct MemArena; struct VertTableNode; diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index 1d1af7092c8..6b2deea57d8 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -40,7 +40,7 @@ extern "C" { struct Object; struct VlakRen; struct VertRen; -struct EvaluationContext; +struct Depsgraph; struct HaloRen; struct Main; struct Material; @@ -165,7 +165,7 @@ void area_lamp_vectors(struct LampRen *lar); /* convertblender.c */ void init_render_world(Render *re); -void RE_Database_FromScene_Vectors(struct EvaluationContext *eval_ctx, Render *re, struct Main *bmain, struct Scene *sce, unsigned int lay); +void RE_Database_FromScene_Vectors(struct Depsgraph *depsgraph, Render *re, struct Main *bmain, struct Scene *sce, unsigned int lay); #ifdef __cplusplus } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c358f0388a4..67869ec541d 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1292,7 +1292,7 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int } } } -static int render_new_particle_system(const EvaluationContext *eval_ctx, Render *re, +static int render_new_particle_system(Depsgraph *depsgraph, Render *re, ObjectRen *obr, ParticleSystem *psys, int timeoffset) { Object *ob= obr->ob; @@ -1354,7 +1354,7 @@ static int render_new_particle_system(const EvaluationContext *eval_ctx, Render if (!(psmd->modifier.mode & eModifierMode_Render)) return 0; - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = re->scene; sim.ob = ob; sim.psys = psys; @@ -2171,7 +2171,7 @@ static void displace(Render *re, ObjectRen *obr) /* Metaball */ /* ------------------------------------------------------------------------- */ -static void init_render_mball(const EvaluationContext *eval_ctx, Render *re, ObjectRen *obr) +static void init_render_mball(Depsgraph *depsgraph, Render *re, ObjectRen *obr) { Object *ob= obr->ob; DispList *dl; @@ -2197,7 +2197,7 @@ static void init_render_mball(const EvaluationContext *eval_ctx, Render *re, Obj need_orco= 1; } - BKE_displist_make_mball_forRender(eval_ctx, re->scene, ob, &dispbase); + BKE_displist_make_mball_forRender(depsgraph, re->scene, ob, &dispbase); dl= dispbase.first; if (dl == NULL) return; @@ -2564,7 +2564,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, } -static void init_render_surf(const EvaluationContext *eval_ctx, Render *re, ObjectRen *obr, int timeoffset) +static void init_render_surf(Depsgraph *depsgraph, Render *re, ObjectRen *obr, int timeoffset) { Object *ob= obr->ob; Nurb *nu = NULL; @@ -2597,13 +2597,13 @@ static void init_render_surf(const EvaluationContext *eval_ctx, Render *re, Obje if (ob->parent && (ob->parent->type==OB_LATTICE)) need_orco= 1; - BKE_displist_make_surf(eval_ctx, re->scene, ob, &displist, &dm, 1, 0, 1); + BKE_displist_make_surf(depsgraph, re->scene, ob, &displist, &dm, 1, 0, 1); if (dm) { if (need_orco) { orco = get_object_orco(re, ob); if (!orco) { - orco= BKE_displist_make_orco(eval_ctx, re->scene, ob, dm, true, true); + orco= BKE_displist_make_orco(depsgraph, re->scene, ob, dm, true, true); if (orco) { set_object_orco(re, ob, orco); } @@ -2635,7 +2635,7 @@ static void init_render_surf(const EvaluationContext *eval_ctx, Render *re, Obje MEM_freeN(matar); } -static void init_render_curve(const EvaluationContext *eval_ctx, Render *re, ObjectRen *obr, int timeoffset) +static void init_render_curve(Depsgraph *depsgraph, Render *re, ObjectRen *obr, int timeoffset) { Object *ob= obr->ob; Curve *cu; @@ -2655,7 +2655,7 @@ static void init_render_curve(const EvaluationContext *eval_ctx, Render *re, Obj if (ob->type==OB_FONT && cu->str==NULL) return; else if (ob->type==OB_CURVE && cu->nurb.first==NULL) return; - BKE_displist_make_curveTypes_forRender(eval_ctx, re->scene, ob, &disp, &dm, false, true); + BKE_displist_make_curveTypes_forRender(depsgraph, re->scene, ob, &disp, &dm, false, true); dl= disp.first; if (dl==NULL) return; @@ -2682,7 +2682,7 @@ static void init_render_curve(const EvaluationContext *eval_ctx, Render *re, Obj if (need_orco) { orco = get_object_orco(re, ob); if (!orco) { - orco = BKE_displist_make_orco(eval_ctx, re->scene, ob, dm, true, true); + orco = BKE_displist_make_orco(depsgraph, re->scene, ob, dm, true, true); if (orco) { set_object_orco(re, ob, orco); } @@ -2696,7 +2696,7 @@ static void init_render_curve(const EvaluationContext *eval_ctx, Render *re, Obj if (need_orco) { orco = get_object_orco(re, ob); if (!orco) { - orco = BKE_curve_make_orco(eval_ctx, re->scene, ob, NULL); + orco = BKE_curve_make_orco(depsgraph, re->scene, ob, NULL); set_object_orco(re, ob, orco); } } @@ -3107,7 +3107,7 @@ static bool has_freestyle_edge_mark(EdgeHash *edge_hash, int v1, int v2) } #endif -static void init_render_mesh(const EvaluationContext *eval_ctx, Render *re, ObjectRen *obr, int timeoffset) +static void init_render_mesh(Depsgraph *depsgraph, Render *re, ObjectRen *obr, int timeoffset) { Object *ob= obr->ob; Mesh *me; @@ -3196,9 +3196,9 @@ static void init_render_mesh(const EvaluationContext *eval_ctx, Render *re, Obje #endif if (re->r.scemode & R_VIEWPORT_PREVIEW) - dm= mesh_create_derived_view(eval_ctx, re->scene, ob, mask); + dm= mesh_create_derived_view(depsgraph, re->scene, ob, mask); else - dm= mesh_create_derived_render(eval_ctx, re->scene, ob, mask); + dm= mesh_create_derived_render(depsgraph, re->scene, ob, mask); if (dm==NULL) return; /* in case duplicated object fails? */ mvert= dm->getVertArray(dm); @@ -4601,7 +4601,7 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d copy_v2_v2(obi->dupliuv, dob->uv); } -static void init_render_object_data(const EvaluationContext *eval_ctx, Render *re, ObjectRen *obr, int timeoffset) +static void init_render_object_data(Depsgraph *depsgraph, Render *re, ObjectRen *obr, int timeoffset) { Object *ob= obr->ob; ParticleSystem *psys; @@ -4615,26 +4615,26 @@ static void init_render_object_data(const EvaluationContext *eval_ctx, Render *r const CustomDataMask mask = CD_MASK_RENDER_INTERNAL; if (re->r.scemode & R_VIEWPORT_PREVIEW) - dm = mesh_create_derived_view(eval_ctx, re->scene, ob, mask); + dm = mesh_create_derived_view(depsgraph, re->scene, ob, mask); else - dm = mesh_create_derived_render(eval_ctx, re->scene, ob, mask); + dm = mesh_create_derived_render(depsgraph, re->scene, ob, mask); dm->release(dm); } for (psys=ob->particlesystem.first, i=0; i<obr->psysindex-1; i++) psys= psys->next; - render_new_particle_system(eval_ctx, re, obr, psys, timeoffset); + render_new_particle_system(depsgraph, re, obr, psys, timeoffset); } else { if (ELEM(ob->type, OB_FONT, OB_CURVE)) - init_render_curve(eval_ctx, re, obr, timeoffset); + init_render_curve(depsgraph, re, obr, timeoffset); else if (ob->type==OB_SURF) - init_render_surf(eval_ctx, re, obr, timeoffset); + init_render_surf(depsgraph, re, obr, timeoffset); else if (ob->type==OB_MESH) - init_render_mesh(eval_ctx, re, obr, timeoffset); + init_render_mesh(depsgraph, re, obr, timeoffset); else if (ob->type==OB_MBALL) - init_render_mball(eval_ctx, re, obr); + init_render_mball(depsgraph, re, obr); } finalize_render_object(re, obr, timeoffset); @@ -4645,7 +4645,7 @@ static void init_render_object_data(const EvaluationContext *eval_ctx, Render *r re->totstrand += obr->totstrand; } -static void add_render_object(const EvaluationContext *eval_ctx, Render *re, Object *ob, Object *par, DupliObject *dob, +static void add_render_object(Depsgraph *depsgraph, Render *re, Object *ob, Object *par, DupliObject *dob, float omat[4][4], int timeoffset) { ObjectRen *obr; @@ -4672,7 +4672,7 @@ static void add_render_object(const EvaluationContext *eval_ctx, Render *re, Obj obr->flag |= R_INSTANCEABLE; copy_m4_m4(obr->obmat, ob->obmat); } - init_render_object_data(eval_ctx, re, obr, timeoffset); + init_render_object_data(depsgraph, re, obr, timeoffset); /* only add instance for objects that have not been used for dupli */ if (!(ob->transflag & OB_RENDER_DUPLI)) { @@ -4703,7 +4703,7 @@ static void add_render_object(const EvaluationContext *eval_ctx, Render *re, Obj } if (dob) psys->flag |= PSYS_USE_IMAT; - init_render_object_data(eval_ctx, re, obr, timeoffset); + init_render_object_data(depsgraph, re, obr, timeoffset); psys->flag &= ~PSYS_USE_IMAT; /* only add instance for objects that have not been used for dupli */ @@ -4719,7 +4719,7 @@ static void add_render_object(const EvaluationContext *eval_ctx, Render *re, Obj /* par = pointer to duplicator parent, needed for object lookup table */ /* index = when duplicater copies same object (particle), the counter */ -static void init_render_object(const EvaluationContext *eval_ctx, Render *re, Object *ob, Object *par, DupliObject *dob, +static void init_render_object(Depsgraph *depsgraph, Render *re, Object *ob, Object *par, DupliObject *dob, float omat[4][4], int timeoffset) { static double lasttime= 0.0; @@ -4729,7 +4729,7 @@ static void init_render_object(const EvaluationContext *eval_ctx, Render *re, Ob if (ob->type==OB_LAMP) add_render_lamp(re, ob); else if (render_object_type(ob->type)) - add_render_object(eval_ctx, re, ob, par, dob, omat, timeoffset); + add_render_object(depsgraph, re, ob, par, dob, omat, timeoffset); else { mul_m4_m4m4(mat, re->viewmat, ob->obmat); invert_m4_m4(ob->imat, mat); @@ -4890,7 +4890,7 @@ static int get_vector_viewlayers(Scene *UNUSED(sce)) return 0; } -static void add_group_render_dupli_obs(const EvaluationContext *eval_ctx, Render *re, Group *group, int nolamps, +static void add_group_render_dupli_obs(Depsgraph *depsgraph, Render *re, Group *group, int nolamps, int onlyselected, Object *actob, int timeoffset, int level) { /* Simple preventing of too deep nested groups. */ @@ -4903,11 +4903,11 @@ static void add_group_render_dupli_obs(const EvaluationContext *eval_ctx, Render if (ob->flag & OB_DONE) { if (ob->transflag & OB_RENDER_DUPLI) { if (allow_render_object(re, ob, nolamps, onlyselected, actob)) { - init_render_object(eval_ctx, re, ob, NULL, NULL, NULL, timeoffset); + init_render_object(depsgraph, re, ob, NULL, NULL, NULL, timeoffset); ob->transflag &= ~OB_RENDER_DUPLI; if (ob->dup_group) { - add_group_render_dupli_obs(eval_ctx, re, ob->dup_group, nolamps, onlyselected, actob, timeoffset, level+1); + add_group_render_dupli_obs(depsgraph, re, ob->dup_group, nolamps, onlyselected, actob, timeoffset, level+1); } } } @@ -4916,7 +4916,7 @@ static void add_group_render_dupli_obs(const EvaluationContext *eval_ctx, Render FOREACH_GROUP_OBJECT_END; } -static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, unsigned int UNUSED(renderlay), +static void database_init_objects(Depsgraph *depsgraph, Render *re, unsigned int UNUSED(renderlay), int nolamps, int onlyselected, Object *actob, int timeoffset) { Base *base; @@ -4970,7 +4970,7 @@ static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, * it still needs to create the ObjectRen containing the data */ if (ob->transflag & OB_RENDER_DUPLI) { if (allow_render_object(re, ob, nolamps, onlyselected, actob)) { - init_render_object(eval_ctx, re, ob, NULL, NULL, NULL, timeoffset); + init_render_object(depsgraph, re, ob, NULL, NULL, NULL, timeoffset); ob->transflag &= ~OB_RENDER_DUPLI; } } @@ -4984,8 +4984,8 @@ static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, /* create list of duplis generated by this object, particle * system need to have render settings set for dupli particles */ - duplilist = object_duplilist(eval_ctx, re->scene, ob); - duplilist_apply_data = duplilist_apply(eval_ctx, ob, NULL, duplilist); + duplilist = object_duplilist(depsgraph, re->scene, ob); + duplilist_apply_data = duplilist_apply(depsgraph, ob, NULL, duplilist); for (dob= duplilist->first, i = 0; dob; dob= dob->next, ++i) { DupliExtraData *dob_extra = &duplilist_apply_data->extra[i]; @@ -5065,7 +5065,7 @@ static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, if (obi==NULL) /* can't instance, just create the object */ - init_render_object(eval_ctx, re, obd, ob, dob, dob_extra->obmat, timeoffset); + init_render_object(depsgraph, re, obd, ob, dob, dob_extra->obmat, timeoffset); if (dob->type != OB_DUPLIGROUP) { obd->flag |= OB_DONE; @@ -5073,7 +5073,7 @@ static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, } } else - init_render_object(eval_ctx, re, obd, ob, dob, dob_extra->obmat, timeoffset); + init_render_object(depsgraph, re, obd, ob, dob, dob_extra->obmat, timeoffset); if (re->test_break(re->tbh)) break; } @@ -5085,10 +5085,10 @@ static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, free_object_duplilist(duplilist); if (allow_render_object(re, ob, nolamps, onlyselected, actob)) - init_render_object(eval_ctx, re, ob, NULL, NULL, NULL, timeoffset); + init_render_object(depsgraph, re, ob, NULL, NULL, NULL, timeoffset); } else if (allow_render_object(re, ob, nolamps, onlyselected, actob)) - init_render_object(eval_ctx, re, ob, NULL, NULL, NULL, timeoffset); + init_render_object(depsgraph, re, ob, NULL, NULL, NULL, timeoffset); } if (re->test_break(re->tbh)) break; @@ -5097,7 +5097,7 @@ static void database_init_objects(const EvaluationContext *eval_ctx, Render *re, /* objects in groups with OB_RENDER_DUPLI set still need to be created, * since they may not be part of the scene */ for (group= re->main->group.first; group; group=group->id.next) - add_group_render_dupli_obs(eval_ctx, re, group, nolamps, onlyselected, actob, timeoffset, 0); + add_group_render_dupli_obs(depsgraph, re, group, nolamps, onlyselected, actob, timeoffset, 0); if (!re->test_break(re->tbh)) RE_makeRenderInstances(re); @@ -5204,12 +5204,12 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l set_node_shader_lamp_loop(shade_material_loop); /* MAKE RENDER DATA */ - EvaluationContext *eval_ctx = NULL; - BLI_assert(eval_ctx); + Depsgraph *depsgraph = NULL; + BLI_assert(depsgraph); /* This will break things, and it should because honestly this function is deprecated and no one uses it. * maybe freestyle? But even so, this need to change. Even freestyle need to get data from depsgraph * so we can't create the database only once. */ - database_init_objects(eval_ctx, re, lay, 0, 0, NULL, 0); + database_init_objects(depsgraph, re, lay, 0, 0, NULL, 0); if (!re->test_break(re->tbh)) { set_material_lightgroups(re); @@ -5224,7 +5224,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l } } -void RE_Database_Preprocess(EvaluationContext *eval_ctx, Render *re) +void RE_Database_Preprocess(Depsgraph *depsgraph, Render *re) { if (!re->test_break(re->tbh)) { int tothalo; @@ -5254,7 +5254,7 @@ void RE_Database_Preprocess(EvaluationContext *eval_ctx, Render *re) /* point density texture */ if (!re->test_break(re->tbh)) - make_pointdensities(eval_ctx, re); + make_pointdensities(depsgraph, re); /* voxel data texture */ if (!re->test_break(re->tbh)) make_voxeldata(re); @@ -5325,7 +5325,7 @@ void RE_DataBase_GetView(Render *re, float mat[4][4]) /* Speed Vectors */ /* ------------------------------------------------------------------------- */ -static void database_fromscene_vectors(EvaluationContext *eval_ctx, +static void database_fromscene_vectors(Depsgraph *depsgraph, Render *re, Scene *scene, unsigned int lay, @@ -5346,7 +5346,7 @@ static void database_fromscene_vectors(EvaluationContext *eval_ctx, /* applies changes fully */ scene->r.cfra += timeoffset; - BKE_scene_graph_update_for_newframe(eval_ctx->depsgraph, re->main); + BKE_scene_graph_update_for_newframe(depsgraph, re->main); /* if no camera, viewmat should have been set! */ if (camera) { @@ -5357,7 +5357,7 @@ static void database_fromscene_vectors(EvaluationContext *eval_ctx, } /* MAKE RENDER DATA */ - database_init_objects(eval_ctx, re, lay, 0, 0, NULL, timeoffset); + database_init_objects(depsgraph, re, lay, 0, 0, NULL, timeoffset); if (!re->test_break(re->tbh)) project_renderdata(re, projectverto, (re->r.mode & R_PANORAMA) != 0, 0, 1); @@ -5714,7 +5714,7 @@ static void free_dbase_object_vectors(ListBase *lb) BLI_freelistN(lb); } -void RE_Database_FromScene_Vectors(EvaluationContext *eval_ctx, Render *re, Main *bmain, Scene *sce, unsigned int lay) +void RE_Database_FromScene_Vectors(Depsgraph *depsgraph, Render *re, Main *bmain, Scene *sce, unsigned int lay) { ObjectInstanceRen *obi, *oldobi; StrandSurface *mesh; @@ -5729,7 +5729,7 @@ void RE_Database_FromScene_Vectors(EvaluationContext *eval_ctx, Render *re, Main speedvector_project(re, NULL, NULL, NULL); /* initializes projection code */ /* creates entire dbase */ - database_fromscene_vectors(eval_ctx, re, sce, lay, -1); + database_fromscene_vectors(depsgraph, re, sce, lay, -1); /* copy away vertex info */ copy_dbase_object_vectors(re, &oldtable); @@ -5745,7 +5745,7 @@ void RE_Database_FromScene_Vectors(EvaluationContext *eval_ctx, Render *re, Main /* creates entire dbase */ re->i.infostr = IFACE_("Calculating next frame vectors"); - database_fromscene_vectors(eval_ctx, re, sce, lay, +1); + database_fromscene_vectors(depsgraph, re, sce, lay, +1); } /* copy away vertex info */ copy_dbase_object_vectors(re, &newtable); @@ -5759,7 +5759,7 @@ void RE_Database_FromScene_Vectors(EvaluationContext *eval_ctx, Render *re, Main if (!re->test_break(re->tbh)) { RE_Database_FromScene(re, bmain, sce, lay, 1); - RE_Database_Preprocess(eval_ctx, re); + RE_Database_Preprocess(depsgraph, re); } if (!re->test_break(re->tbh)) { @@ -5872,9 +5872,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, ViewLayer *view_l RE_init_threadcount(re); - 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); DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer); BKE_scene_graph_update_tagged(depsgraph, bmain); @@ -5948,7 +5946,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, ViewLayer *view_l set_node_shader_lamp_loop(shade_material_loop); /* MAKE RENDER DATA */ - database_init_objects(eval_ctx, re, lay, nolamps, onlyselected, actob, 0); + database_init_objects(depsgraph, re, lay, nolamps, onlyselected, actob, 0); set_material_lightgroups(re); @@ -5964,7 +5962,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, ViewLayer *view_l /* point density texture */ if (!re->test_break(re->tbh)) - make_pointdensities(eval_ctx, re); + make_pointdensities(depsgraph, re); /* voxel data texture */ if (!re->test_break(re->tbh)) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 9ad9c653e54..c42f85ef017 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -867,7 +867,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, } eEvaluationMode mode = (re->r.scemode & R_VIEWPORT_PREVIEW) ? DAG_EVAL_PREVIEW : DAG_EVAL_RENDER; - /* If we had a consistent EvaluationContext now would be the time to update it. */ + /* This mode should have been set in the Depsgraph immediately when it was created. */ (void)mode; /* ensure renderdatabase can use part settings correct */ @@ -2733,11 +2733,10 @@ static void do_render_seq(Render *re) tot_views = BKE_scene_multiview_num_views_get(&re->r); ibuf_arr = MEM_mallocN(sizeof(ImBuf *) * tot_views, "Sequencer Views ImBufs"); - EvaluationContext *eval_ctx = DEG_evaluation_context_new(DAG_EVAL_RENDER); BKE_sequencer_new_render_data( - eval_ctx, re->main, re->scene, - re_x, re_y, 100, + re->main, re->scene, + re_x, re_y, 100, true, &context); /* the renderresult gets destroyed during the rendering, so we first collect all ibufs @@ -2758,8 +2757,6 @@ static void do_render_seq(Render *re) } } - DEG_evaluation_context_free(eval_ctx); - rr = re->result; BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index bba422345e0..6d0cd52544b 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -170,7 +170,7 @@ static void alloc_point_data(PointDensity *pd) } } -static void pointdensity_cache_psys(const EvaluationContext *eval_ctx, Scene *scene, +static void pointdensity_cache_psys(Depsgraph *depsgraph, Scene *scene, PointDensity *pd, Object *ob, ParticleSystem *psys, @@ -196,12 +196,12 @@ static void pointdensity_cache_psys(const EvaluationContext *eval_ctx, Scene *sc data_used = point_data_used(pd); if (use_render_params) { - dm = mesh_create_derived_render(eval_ctx, scene, + dm = mesh_create_derived_render(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL); } else { - dm = mesh_get_derived_final(eval_ctx, scene, + dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL); } @@ -210,7 +210,7 @@ static void pointdensity_cache_psys(const EvaluationContext *eval_ctx, Scene *sc return; } - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = ob; sim.psys = psys; @@ -391,7 +391,7 @@ static void pointdensity_cache_vertex_normal(PointDensity *pd, Object *UNUSED(ob } } -static void pointdensity_cache_object(const EvaluationContext *eval_ctx, Scene *scene, +static void pointdensity_cache_object(Depsgraph *depsgraph, Scene *scene, PointDensity *pd, Object *ob, const bool use_render_params) @@ -412,10 +412,10 @@ static void pointdensity_cache_object(const EvaluationContext *eval_ctx, Scene * } if (use_render_params) { - dm = mesh_create_derived_render(eval_ctx, scene, ob, mask); + dm = mesh_create_derived_render(depsgraph, scene, ob, mask); } else { - dm = mesh_get_derived_final(eval_ctx, scene, ob, mask); + dm = mesh_get_derived_final(depsgraph, scene, ob, mask); } mvert = dm->getVertArray(dm); /* local object space */ @@ -466,7 +466,7 @@ static void pointdensity_cache_object(const EvaluationContext *eval_ctx, Scene * } -static void cache_pointdensity_ex(const EvaluationContext *eval_ctx, +static void cache_pointdensity_ex(Depsgraph *depsgraph, Scene *scene, PointDensity *pd, const bool use_render_params) @@ -493,7 +493,7 @@ static void cache_pointdensity_ex(const EvaluationContext *eval_ctx, return; } - pointdensity_cache_psys(eval_ctx, + pointdensity_cache_psys(depsgraph, scene, pd, ob, @@ -503,13 +503,13 @@ static void cache_pointdensity_ex(const EvaluationContext *eval_ctx, else if (pd->source == TEX_PD_OBJECT) { Object *ob = pd->object; if (ob && ob->type == OB_MESH) - pointdensity_cache_object(eval_ctx, scene, pd, ob, use_render_params); + pointdensity_cache_object(depsgraph, scene, pd, ob, use_render_params); } } -void cache_pointdensity(const EvaluationContext *eval_ctx, Render *re, PointDensity *pd) +void cache_pointdensity(Depsgraph *depsgraph, Render *re, PointDensity *pd) { - cache_pointdensity_ex(eval_ctx, + cache_pointdensity_ex(depsgraph, re->scene, pd, true); @@ -533,7 +533,7 @@ void free_pointdensity(PointDensity *pd) pd->totpoints = 0; } -void make_pointdensities(const EvaluationContext *eval_ctx, Render *re) +void make_pointdensities(Depsgraph *depsgraph, Render *re) { Tex *tex; @@ -546,7 +546,7 @@ void make_pointdensities(const EvaluationContext *eval_ctx, Render *re) for (tex = re->main->tex.first; tex != NULL; tex = tex->id.next) { if (tex->id.us && tex->type == TEX_POINTDENSITY) { - cache_pointdensity(eval_ctx, re, tex->pd); + cache_pointdensity(depsgraph, re, tex->pd); } } @@ -863,7 +863,7 @@ static void sample_dummy_point_density(int resolution, float *values) memset(values, 0, sizeof(float) * 4 * resolution * resolution * resolution); } -static void particle_system_minmax(const EvaluationContext *eval_ctx, +static void particle_system_minmax(Depsgraph *depsgraph, Scene *scene, Object *object, ParticleSystem *psys, @@ -887,7 +887,7 @@ static void particle_system_minmax(const EvaluationContext *eval_ctx, unit_m4(mat); - sim.eval_ctx = eval_ctx; + sim.depsgraph = depsgraph; sim.scene = scene; sim.ob = object; sim.psys = psys; @@ -918,26 +918,24 @@ static void particle_system_minmax(const EvaluationContext *eval_ctx, } void RE_point_density_cache( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, PointDensity *pd) { - const bool use_render_params = (eval_ctx->mode == DAG_EVAL_RENDER); + const bool use_render_params = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); - Depsgraph *depsgraph = eval_ctx->depsgraph; Scene *scene = DEG_get_evaluated_scene(depsgraph); /* Same matricies/resolution as dupli_render_particle_set(). */ BLI_mutex_lock(&sample_mutex); - cache_pointdensity_ex(eval_ctx, scene, pd, use_render_params); + cache_pointdensity_ex(depsgraph, scene, pd, use_render_params); BLI_mutex_unlock(&sample_mutex); } void RE_point_density_minmax( - const struct EvaluationContext *eval_ctx, + struct Depsgraph *depsgraph, struct PointDensity *pd, float r_min[3], float r_max[3]) { - Depsgraph *depsgraph = eval_ctx->depsgraph; Scene *scene = DEG_get_evaluated_scene(depsgraph); Object *object = pd->object; if (object == NULL) { @@ -960,7 +958,7 @@ void RE_point_density_minmax( return; } - particle_system_minmax(eval_ctx, + particle_system_minmax(depsgraph, scene, object, psys, @@ -1032,7 +1030,7 @@ static void point_density_sample_func( * NOTE 2: Frees point density structure after sampling. */ void RE_point_density_sample( - const EvaluationContext *eval_ctx, + Depsgraph *depsgraph, PointDensity *pd, const int resolution, float *values) @@ -1050,7 +1048,7 @@ void RE_point_density_sample( } BLI_mutex_lock(&sample_mutex); - RE_point_density_minmax(eval_ctx, + RE_point_density_minmax(depsgraph, pd, min, max); diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index cefa739a796..929fc3cc9c3 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -3745,7 +3745,7 @@ static void textured_face_generate_uv( } /* Generate an updated copy of material to use for color sampling. */ -Material *RE_sample_material_init(const EvaluationContext *eval_ctx, Material *orig_mat, Scene *scene) +Material *RE_sample_material_init(Depsgraph *depsgraph, Material *orig_mat, Scene *scene) { Tex *tex = NULL; Material *mat; @@ -3821,7 +3821,7 @@ Material *RE_sample_material_init(const EvaluationContext *eval_ctx, Material *o unit_m4(dummy_re.viewmat); unit_m4(dummy_re.winmat); dummy_re.winx = dummy_re.winy = 128; - cache_pointdensity(eval_ctx, &dummy_re, tex->pd); + cache_pointdensity(depsgraph, &dummy_re, tex->pd); } /* update image sequences and movies */ diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index ed276aa690d..c650bfe08c9 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -135,7 +135,7 @@ static bool wm_area_test_invalid_backbuf(ScrArea *sa) return true; } -static void wm_region_test_render_do_draw(const Scene *scene, const struct Depsgraph *depsgraph, +static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *depsgraph, ScrArea *sa, ARegion *ar) { /* tag region for redraw from render engine preview running inside of it */ diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 6591a8c9f59..9dcb83244ca 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1025,10 +1025,6 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, ViewLayer *view_ ARegion *ar = NULL; View3D *v3d = NULL; - EvaluationContext eval_ctx; - - CTX_data_eval_ctx(C, &eval_ctx); - /* In case we are given a valid thumbnail data, just generate image from it. */ if (*thumb_pt) { thumb = *thumb_pt; @@ -1052,18 +1048,19 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, ViewLayer *view_ } /* gets scaled to BLEN_THUMB_SIZE */ + Depsgraph *depsgraph = CTX_data_depsgraph(C); RenderEngineType *engine_type = CTX_data_engine_type(C); if (scene->camera) { ibuf = ED_view3d_draw_offscreen_imbuf_simple( - &eval_ctx, scene, view_layer, engine_type, scene->camera, + depsgraph, scene, view_layer, engine_type, scene->camera, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, V3D_OFSDRAW_NONE, OB_SOLID, R_ALPHAPREMUL, 0, NULL, NULL, err_out); } else { ibuf = ED_view3d_draw_offscreen_imbuf( - &eval_ctx, scene, view_layer, engine_type, v3d, ar, + depsgraph, scene, view_layer, engine_type, v3d, ar, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL, NULL, err_out); diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c index d774c4e4a2e..d032cb79edc 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c @@ -487,7 +487,6 @@ static int manipulator_find_intersected_3d_intern( ListBase *visible_manipulators, const bContext *C, const int co[2], const int hotspot) { - EvaluationContext eval_ctx; ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = sa->spacedata.first; @@ -499,9 +498,7 @@ static int manipulator_find_intersected_3d_intern( BLI_rcti_init_pt_radius(&rect, co, hotspot); - CTX_data_eval_ctx(C, &eval_ctx); - - ED_view3d_draw_setup_view(CTX_wm_window(C), &eval_ctx, CTX_data_scene(C), ar, v3d, NULL, NULL, &rect); + ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph(C), CTX_data_scene(C), ar, v3d, NULL, NULL, &rect); if (do_passes) GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0); @@ -518,7 +515,7 @@ static int manipulator_find_intersected_3d_intern( GPU_select_end(); } - ED_view3d_draw_setup_view(CTX_wm_window(C), &eval_ctx, CTX_data_scene(C), ar, v3d, NULL, NULL, NULL); + ED_view3d_draw_setup_view(CTX_wm_window(C), CTX_data_depsgraph(C), CTX_data_scene(C), ar, v3d, NULL, NULL, NULL); const GLuint *hit_near = GPU_select_buffer_near(buffer, hits); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 78d895e3779..b35fb30af66 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -278,7 +278,7 @@ int multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], i int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image) RET_ZERO int multitex_nodes(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex, struct ImagePool *pool) RET_ZERO -struct Material *RE_sample_material_init(const struct EvaluationContext *eval_ctx, struct Material *orig_mat, struct Scene *scene) RET_NULL +struct Material *RE_sample_material_init(struct Depsgraph *depsgraph, struct Material *orig_mat, struct Scene *scene) RET_NULL void RE_sample_material_free(struct Material *mat) RET_NONE void RE_sample_material_color( struct Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3], @@ -483,7 +483,7 @@ char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry) RET_NULL void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name) RET_NONE struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob) RET_NULL -void PE_current_changed(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob) RET_NONE +void PE_current_changed(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob) RET_NONE /* rna keymap */ struct wmKeyMap *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap) RET_NULL @@ -547,7 +547,7 @@ void ED_node_tree_pop(struct SpaceNode *snode) RET_NONE int ED_view3d_view_layer_set(int lay, const int *values, int *active) RET_ZERO void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip) RET_NONE void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist) RET_NONE -void ED_view3d_update_viewmat(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4], const struct rcti *rect) RET_NONE +void ED_view3d_update_viewmat(struct Depsgraph *depsgraph, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4], const struct rcti *rect) RET_NONE float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit) RET_ZERO void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa) RET_NONE void ED_node_shader_default(const struct bContext *C, struct ID *id) RET_NONE @@ -617,9 +617,9 @@ bool ED_texture_context_check_others(const struct bContext *C) RET_ZERO bool ED_text_region_location_from_cursor(SpaceText *st, ARegion *ar, const int cursor_co[2], int r_pixel_co[2]) RET_ZERO SnapObjectContext *ED_transform_snap_object_context_create( - struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, int flag) RET_NULL + struct Main *bmain, struct Scene *scene, int flag) RET_NULL 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, const struct ARegion *ar, const struct View3D *v3d) RET_NULL void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx) RET_NONE bool ED_transform_snap_object_project_ray_ex( @@ -765,9 +765,9 @@ void RE_engine_update_memory_stats(struct RenderEngine *engine, float mem_used, struct RenderEngine *RE_engine_create(struct RenderEngineType *type) RET_NULL void RE_engine_frame_set(struct RenderEngine *engine, int frame, float subframe) RET_NONE void RE_FreePersistentData(void) RET_NONE -void RE_point_density_cache(const struct EvaluationContext *eval_ctx, struct PointDensity *pd) RET_NONE -void RE_point_density_minmax(const struct EvaluationContext *eval_ctx, struct PointDensity *pd, float r_min[3], float r_max[3]) RET_NONE -void RE_point_density_sample(const struct EvaluationContext *eval_ctx, struct PointDensity *pd, const int resolution, float *values) RET_NONE +void RE_point_density_cache(struct Depsgraph *depsgraph, struct PointDensity *pd) RET_NONE +void RE_point_density_minmax(struct Depsgraph *depsgraph, struct PointDensity *pd, float r_min[3], float r_max[3]) RET_NONE +void RE_point_density_sample(struct Depsgraph *depsgraph, struct PointDensity *pd, const int resolution, float *values) RET_NONE void RE_point_density_free(struct PointDensity *pd) RET_NONE void RE_instance_get_particle_info(struct ObjectInstanceRen *obi, float *index, float *random, float *age, float *lifetime, float co[3], float *size, float vel[3], float angvel[3]) RET_NONE void RE_FreeAllPersistentData(void) RET_NONE diff --git a/source/tools b/source/tools -Subproject 7695e14cfc5820ac66546e0e515914d85ab81af +Subproject f35d8e55afffb9da50cc13b14615ed280f9e558 diff --git a/tests/gtests/alembic/abc_export_test.cc b/tests/gtests/alembic/abc_export_test.cc index 3277e84fe42..cbf4ed43fe8 100644 --- a/tests/gtests/alembic/abc_export_test.cc +++ b/tests/gtests/alembic/abc_export_test.cc @@ -15,10 +15,10 @@ extern "C" { class TestableAbcExporter : public AbcExporter { public: - TestableAbcExporter(Main *bmain, EvaluationContext *eval_ctx, + TestableAbcExporter(Main *bmain, Scene *scene, ViewLayer *view_layer, Depsgraph *depsgraph, const char *filename, ExportSettings &settings) - : AbcExporter(bmain, eval_ctx, scene, depsgraph, filename, settings) + : AbcExporter(bmain, scene, view_layer, depsgraph, filename, settings) { } @@ -40,7 +40,6 @@ class AlembicExportTest : public testing::Test protected: ExportSettings settings; Scene scene; - EvaluationContext eval_ctx; Depsgraph *depsgraph; TestableAbcExporter *exporter; Main *bmain; @@ -58,7 +57,6 @@ protected: /* TODO(sergey): Pass scene layer somehow? */ ViewLayer *view_layer = (ViewLayer *)scene.view_layers.first; - DEG_evaluation_context_init(&eval_ctx, DAG_EVAL_VIEWPORT); depsgraph = DEG_graph_new(&scene, view_layer, DAG_EVAL_VIEWPORT); exporter = NULL; @@ -75,7 +73,7 @@ protected: void createExporter() { ViewLayer *view_layer = (ViewLayer *)scene.view_layers.first; - exporter = new TestableAbcExporter(bmain, &eval_ctx, &scene, view_layer, depsgraph, "somefile.abc", settings); + exporter = new TestableAbcExporter(bmain, &scene, view_layer, depsgraph, "somefile.abc", settings); } }; |