diff options
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 26 | ||||
-rw-r--r-- | source/blender/collada/AnimationExporter.h | 8 | ||||
-rw-r--r-- | source/blender/collada/ArmatureExporter.cpp | 12 | ||||
-rw-r--r-- | source/blender/collada/ArmatureExporter.h | 4 | ||||
-rw-r--r-- | source/blender/collada/ControllerExporter.cpp | 12 | ||||
-rw-r--r-- | source/blender/collada/ControllerExporter.h | 6 | ||||
-rw-r--r-- | source/blender/collada/DocumentExporter.cpp | 12 | ||||
-rw-r--r-- | source/blender/collada/DocumentExporter.h | 4 | ||||
-rw-r--r-- | source/blender/collada/GeometryExporter.cpp | 6 | ||||
-rw-r--r-- | source/blender/collada/GeometryExporter.h | 6 | ||||
-rw-r--r-- | source/blender/collada/SceneExporter.cpp | 16 | ||||
-rw-r--r-- | source/blender/collada/SceneExporter.h | 6 | ||||
-rw-r--r-- | source/blender/collada/collada.cpp | 7 | ||||
-rw-r--r-- | source/blender/collada/collada.h | 4 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 25 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.h | 8 |
16 files changed, 78 insertions, 84 deletions
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); |