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/collada/collada_utils.cpp
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/collada/collada_utils.cpp')
-rw-r--r--source/blender/collada/collada_utils.cpp25
1 files changed, 9 insertions, 16 deletions
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;
}
}