diff options
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 6d3aed65a14..dcdea87fe1a 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -45,6 +45,8 @@ extern "C" { #include "DEG_depsgraph_debug.h" #include "intern/depsgraph_update.h" +#include "intern/depsgraph_physics.h" +#include "intern/depsgraph_registry.h" #include "intern/eval/deg_eval_copy_on_write.h" @@ -55,8 +57,6 @@ extern "C" { #include "intern/node/deg_node_operation.h" #include "intern/node/deg_node_time.h" -#include "intern/depsgraph_physics.h" - namespace DEG { /* TODO(sergey): Find a better place for this. */ @@ -65,10 +65,11 @@ template<typename T> static void remove_from_vector(vector<T> *vector, const T & vector->erase(std::remove(vector->begin(), vector->end(), value), vector->end()); } -Depsgraph::Depsgraph(Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) +Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) : time_source(NULL), need_update(true), need_update_time(false), + bmain(bmain), scene(scene), view_layer(view_layer), mode(mode), @@ -313,17 +314,23 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const /* Public Graph API */ /* Initialize a new Depsgraph */ -Depsgraph *DEG_graph_new(Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) +Depsgraph *DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) { - DEG::Depsgraph *deg_depsgraph = OBJECT_GUARDED_NEW(DEG::Depsgraph, scene, view_layer, mode); + DEG::Depsgraph *deg_depsgraph = OBJECT_GUARDED_NEW( + DEG::Depsgraph, bmain, scene, view_layer, mode); + DEG::register_graph(deg_depsgraph); return reinterpret_cast<Depsgraph *>(deg_depsgraph); } /* Free graph's contents and graph itself */ void DEG_graph_free(Depsgraph *graph) { + if (graph == NULL) { + return; + } using DEG::Depsgraph; DEG::Depsgraph *deg_depsgraph = reinterpret_cast<DEG::Depsgraph *>(graph); + DEG::unregister_graph(deg_depsgraph); OBJECT_GUARDED_DELETE(deg_depsgraph, Depsgraph); } |