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>2017-11-09 13:20:17 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-11-09 13:20:17 +0300
commitd325e6f0e845d710abe4847a57be8e30920911a9 (patch)
tree13138d409459bbe7e223833a8f6a5000437585e6 /source/blender/blenkernel/intern
parentc99481b6320a77e4793c812403f7d37dfc2d5ced (diff)
Depsgraph: Make dependency graph to be built from scene layer
This is a final step of having proper ownership. Now selecting different layers in the "top bar" will actually do what this is expected to do. Surely, there are still things to be done under the hood, that will happen in a less intrusive way.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/anim.c13
-rw-r--r--source/blender/blenkernel/intern/pointcache.c4
-rw-r--r--source/blender/blenkernel/intern/scene.c20
-rw-r--r--source/blender/blenkernel/intern/sequencer.c6
-rw-r--r--source/blender/blenkernel/intern/workspace.c2
5 files changed, 31 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 23fbcf583ad..eb63ea5250d 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -276,7 +276,10 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
/* ........ */
/* update scene for current frame */
-static void motionpaths_calc_update_scene(Main *bmain, Scene *scene, struct Depsgraph *depsgraph)
+static void motionpaths_calc_update_scene(Main *bmain,
+ Scene *scene,
+ SceneLayer *scene_layer,
+ struct Depsgraph *depsgraph)
{
/* Do all updates
* - if this is too slow, resort to using a more efficient way
@@ -288,7 +291,7 @@ static void motionpaths_calc_update_scene(Main *bmain, Scene *scene, struct Deps
*
* TODO(sergey): Use evaluation context dedicated to motion paths.
*/
- BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene);
+ BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, scene_layer);
}
/* ........ */
@@ -344,6 +347,8 @@ void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets)
int sfra, efra;
int cfra;
Main *bmain = CTX_data_main(C);
+ /* TODO(sergey): Should we mabe pass scene layer explicitly? */
+ SceneLayer *scene_layer = CTX_data_scene_layer(C);
struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* sanity check */
@@ -367,7 +372,7 @@ void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets)
/* calculate path over requested range */
for (CFRA = sfra; CFRA <= efra; CFRA++) {
/* update relevant data for new frame */
- motionpaths_calc_update_scene(bmain, scene, depsgraph);
+ motionpaths_calc_update_scene(bmain, scene, scene_layer, depsgraph);
/* perform baking for targets */
motionpaths_calc_bake_targets(scene, targets);
@@ -375,7 +380,7 @@ void animviz_calc_motionpaths(bContext *C, Scene *scene, ListBase *targets)
/* reset original environment */
CFRA = cfra;
- motionpaths_calc_update_scene(bmain, scene, depsgraph);
+ motionpaths_calc_update_scene(bmain, scene, scene_layer, depsgraph);
/* clear recalc flags from targets */
for (mpt = targets->first; mpt; mpt = mpt->next) {
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 4d1c2d8454b..abe8c8f8981 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3662,7 +3662,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
stime = ptime = PIL_check_seconds_timer();
for (int fr = CFRA; fr <= endframe; fr += baker->quick_step, CFRA = fr) {
- BKE_scene_graph_update_for_newframe(G.main->eval_ctx, depsgraph, bmain, scene);
+ BKE_scene_graph_update_for_newframe(G.main->eval_ctx, depsgraph, bmain, scene, scene_layer);
if (baker->update_progress) {
float progress = ((float)(CFRA - startframe)/(float)(endframe - startframe));
@@ -3748,7 +3748,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
CFRA = cfrao;
if (bake) { /* already on cfra unless baking */
- BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene);
+ BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, scene_layer);
}
/* TODO: call redraw all windows somehow */
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 95f10cc9846..ccdd785986d 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1537,13 +1537,19 @@ static void prepare_mesh_for_viewport_render(Main *bmain, Scene *scene)
void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
Depsgraph *depsgraph,
Main *bmain,
- Scene *scene)
+ Scene *scene,
+ SceneLayer *scene_layer)
{
+ /* TODO(sergey): Temporary solution for until pipeline.c is ported. */
+ if (scene_layer == NULL) {
+ scene_layer = DEG_get_evaluated_scene_layer(depsgraph);
+ BLI_assert(scene_layer != NULL);
+ }
/* TODO(sergey): Some functions here are changing global state,
* for example, clearing update tags from bmain.
*/
/* (Re-)build dependency graph if needed. */
- DEG_graph_relations_update(depsgraph, bmain, scene);
+ DEG_graph_relations_update(depsgraph, bmain, scene, scene_layer);
/* Uncomment this to check if graph was properly tagged for update. */
// DEG_debug_graph_relations_validate(depsgraph, bmain, scene);
/* Flush editing data if needed. */
@@ -1566,8 +1572,14 @@ void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
Depsgraph *depsgraph,
Main *bmain,
- Scene *scene)
+ Scene *scene,
+ SceneLayer *scene_layer)
{
+ /* TODO(sergey): Temporary solution for until pipeline.c is ported. */
+ if (scene_layer == NULL) {
+ scene_layer = DEG_get_evaluated_scene_layer(depsgraph);
+ BLI_assert(scene_layer != NULL);
+ }
/* TODO(sergey): Some functions here are changing global state,
* for example, clearing update tags from bmain.
*/
@@ -1583,7 +1595,7 @@ void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
*/
BKE_image_update_frame(bmain, scene->r.cfra);
BKE_sound_set_cfra(scene->r.cfra);
- DEG_graph_relations_update(depsgraph, bmain, scene);
+ DEG_graph_relations_update(depsgraph, bmain, scene, scene_layer);
/* Update animated cache files for modifiers.
*
* TODO(sergey): Make this a depsgraph node?
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 11c3a5658e8..3e1ebc2a057 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3315,7 +3315,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
/* opengl offscreen render */
context->eval_ctx->engine = RE_engines_find(scene->view_render.engine_id);
- BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene);
+ BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, scene_layer);
ibuf = sequencer_view3d_cb(
/* set for OpenGL render (NULL when scrubbing) */
context->eval_ctx, scene, scene_layer, camera, width, height, IB_rect,
@@ -3355,7 +3355,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
RE_SetDepsgraph(re, depsgraph);
DEG_graph_id_tag_update(context->bmain, depsgraph, &scene->id, 0);
- BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene);
+ BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, scene_layer);
RE_BlenderFrame(re, context->bmain, scene, NULL, camera, scene->lay, frame, false);
/* restore previous state after it was toggled on & off by RE_BlenderFrame */
@@ -3415,7 +3415,7 @@ finally:
scene->r.subframe = orig_data.subframe;
if (is_frame_update) {
- BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene);
+ BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, scene_layer);
}
#ifdef DURIAN_CAMERA_SWITCH
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 79e1af810a5..fec9d736e09 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -481,5 +481,5 @@ void BKE_workspace_update_tagged(struct EvaluationContext *eval_ctx,
struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene,
scene_layer,
true);
- BKE_scene_graph_update_tagged(eval_ctx, depsgraph, bmain, scene);
+ BKE_scene_graph_update_tagged(eval_ctx, depsgraph, bmain, scene, scene_layer);
}