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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-09-09 15:49:05 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-09-11 11:43:27 +0300
commit73a199e96a68a5b9521ba7d3e8cca85697095c03 (patch)
tree53ddc33ae7e0ccfabc1d1566551f9ecfec2d9e75 /source/blender/depsgraph
parent559df2fed9ad8e47b661aa79d033ab463ec3301e (diff)
Depsgraph: Pass bmain to depsgraph object creation
Currently unused, but will allow to keep of an owner of the depsgraph. Could also simplify other APIs in the future by avoiding to pass bmain explicitly to relation update functions and things like that.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h5
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc8
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h5
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_debug.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc6
6 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index d4518729d99..e44dddbcf54 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -87,7 +87,10 @@ extern "C" {
/* Create new Depsgraph instance */
// TODO: what args are needed here? What's the building-graph entry point?
-Depsgraph *DEG_graph_new(struct Scene *scene, struct ViewLayer *view_layer, eEvaluationMode mode);
+Depsgraph *DEG_graph_new(struct Main *bmain,
+ struct Scene *scene,
+ struct ViewLayer *view_layer,
+ eEvaluationMode mode);
/* Free Depsgraph itself and all its data */
void DEG_graph_free(Depsgraph *graph);
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 6d3aed65a14..6e98907597b 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -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,9 +314,10 @@ 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);
return reinterpret_cast<Depsgraph *>(deg_depsgraph);
}
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 96b1a2a1f8a..30ae4edde34 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -100,7 +100,7 @@ struct Depsgraph {
typedef vector<OperationNode *> OperationNodes;
typedef vector<IDNode *> IDDepsNodes;
- Depsgraph(Scene *scene, ViewLayer *view_layer, eEvaluationMode mode);
+ Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode);
~Depsgraph();
TimeSourceNode *add_time_source();
@@ -172,7 +172,8 @@ struct Depsgraph {
* Mainly used by graph evaluation. */
SpinLock lock;
- /* Scene, layer, mode this dependency graph is built for. */
+ /* Main, scene, layer, mode this dependency graph is built for. */
+ Main *bmain;
Scene *scene;
ViewLayer *view_layer;
eEvaluationMode mode;
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index dd2d7f70ed5..968ed8ef403 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -358,7 +358,7 @@ void DEG_relations_tag_update(Main *bmain)
DEG_GLOBAL_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
- Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(scene, view_layer, false);
+ Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false);
if (depsgraph != NULL) {
DEG_graph_tag_relations_update(depsgraph);
}
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index c5a756102ca..d079c958e04 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -91,7 +91,7 @@ bool DEG_debug_graph_relations_validate(Depsgraph *graph,
Scene *scene,
ViewLayer *view_layer)
{
- Depsgraph *temp_depsgraph = DEG_graph_new(scene, view_layer, DEG_get_mode(graph));
+ Depsgraph *temp_depsgraph = DEG_graph_new(bmain, scene, view_layer, DEG_get_mode(graph));
bool valid = true;
DEG_graph_build_from_view_layer(temp_depsgraph, bmain, scene, view_layer);
if (!DEG_debug_compare(temp_depsgraph, graph)) {
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 647837bd758..fd74529a30d 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -607,7 +607,7 @@ void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source)
graph_id_tag_update(bmain, NULL, id, flag, update_source);
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
- Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(scene, view_layer, false);
+ Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false);
if (depsgraph != NULL) {
graph_id_tag_update(bmain, depsgraph, id, flag, update_source);
}
@@ -771,7 +771,7 @@ void DEG_id_type_tag(Main *bmain, short id_type)
{
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
- Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(scene, view_layer, false);
+ Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false);
if (depsgraph != NULL) {
DEG_graph_id_type_tag(depsgraph, id_type);
}
@@ -790,7 +790,7 @@ void DEG_on_visible_update(Main *bmain, const bool do_time)
{
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
- Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(scene, view_layer, false);
+ Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(bmain, scene, view_layer, false);
if (depsgraph != NULL) {
DEG_graph_on_visible_update(bmain, depsgraph, do_time);
}