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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-06 13:07:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-16 20:55:33 +0300
commit34ab90f546f097cada951b2c9ca22bf271996980 (patch)
treeebcdb3d37120ac1d8fb16462b9104badd1800329 /source/blender/blenkernel/intern/layer.c
parent0c495005dd83913864acb510c1d4194a2275dbb0 (diff)
Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing both risks the depsgraph and evaluation context not matching, and it complicates the Python API where we'd have to expose both which is not so easy to understand. This also removes the global evaluation context in main, which assumed there to be a single active scene and view layer. Differential Revision: https://developer.blender.org/D3152
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c29
1 files changed, 15 insertions, 14 deletions
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);
}
/**