Depsgraph: don't pass evaluation context to update functions.
The depsgraph now contains all the state needed to evaluate it. Differential Revision: https://developer.blender.org/D3147
This commit is contained in:
parent
eec5d3a8a8
commit
a1e2415ed5
|
@ -168,7 +168,7 @@ static bool export_object(const ExportSettings * const settings, const Base * co
|
|||
|
||||
/* ************************************************************************** */
|
||||
|
||||
AbcExporter::AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer,
|
||||
AbcExporter::AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene,
|
||||
Depsgraph *depsgraph,
|
||||
const char *filename, ExportSettings &settings)
|
||||
: m_bmain(bmain)
|
||||
|
@ -178,7 +178,6 @@ AbcExporter::AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene,
|
|||
, m_shape_sampling_index(0)
|
||||
, m_eval_ctx(eval_ctx)
|
||||
, m_scene(scene)
|
||||
, m_view_layer(view_layer)
|
||||
, m_depsgraph(depsgraph)
|
||||
, m_writer(NULL)
|
||||
{}
|
||||
|
@ -657,5 +656,5 @@ void AbcExporter::setCurrentFrame(Main *bmain, double t)
|
|||
{
|
||||
m_scene->r.cfra = static_cast<int>(t);
|
||||
m_scene->r.subframe = static_cast<float>(t) - m_scene->r.cfra;
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, m_depsgraph, bmain, m_scene, m_view_layer);
|
||||
BKE_scene_graph_update_for_newframe(m_depsgraph, bmain);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ class AbcExporter {
|
|||
|
||||
EvaluationContext *m_eval_ctx;
|
||||
Scene *m_scene;
|
||||
ViewLayer *m_view_layer;
|
||||
Depsgraph *m_depsgraph;
|
||||
|
||||
ArchiveWriter *m_writer;
|
||||
|
@ -107,7 +106,7 @@ class AbcExporter {
|
|||
std::vector<AbcObjectWriter *> m_shapes;
|
||||
|
||||
public:
|
||||
AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer,
|
||||
AbcExporter(Main *bmain, EvaluationContext *eval_ctx, Scene *scene,
|
||||
Depsgraph *depsgraph,
|
||||
const char *filename, ExportSettings &settings);
|
||||
~AbcExporter();
|
||||
|
|
|
@ -265,8 +265,7 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
|
||||
try {
|
||||
Scene *scene = data->scene;
|
||||
ViewLayer *view_layer = data->view_layer;
|
||||
AbcExporter exporter(data->bmain, &data->eval_ctx, scene, view_layer, data->depsgraph, data->filename, data->settings);
|
||||
AbcExporter exporter(data->bmain, &data->eval_ctx, scene, data->depsgraph, data->filename, data->settings);
|
||||
|
||||
const int orig_frame = CFRA;
|
||||
|
||||
|
@ -276,7 +275,7 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
if (CFRA != orig_frame) {
|
||||
CFRA = orig_frame;
|
||||
|
||||
BKE_scene_graph_update_for_newframe(data->bmain->eval_ctx, data->depsgraph, data->bmain, scene, data->view_layer);
|
||||
BKE_scene_graph_update_for_newframe(data->depsgraph, data->bmain);
|
||||
}
|
||||
|
||||
data->export_ok = !data->was_canceled;
|
||||
|
|
|
@ -139,17 +139,11 @@ void BKE_scene_frame_set(struct Scene *scene, double cfra);
|
|||
|
||||
/* ** Scene evaluation ** */
|
||||
|
||||
void BKE_scene_graph_update_tagged(struct EvaluationContext *eval_ctx,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct Main *bmain,
|
||||
struct Scene *scene,
|
||||
struct ViewLayer *view_layer);
|
||||
void BKE_scene_graph_update_tagged(struct Depsgraph *depsgraph,
|
||||
struct Main *bmain);
|
||||
|
||||
void BKE_scene_graph_update_for_newframe(struct EvaluationContext *eval_ctx,
|
||||
struct Depsgraph *depsgraph,
|
||||
struct Main *bmain,
|
||||
struct Scene *scene,
|
||||
struct ViewLayer *view_layer);
|
||||
void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph,
|
||||
struct Main *bmain);
|
||||
|
||||
struct SceneRenderView *BKE_scene_add_render_view(struct Scene *sce, const char *name);
|
||||
bool BKE_scene_remove_render_view(struct Scene *scene, struct SceneRenderView *srv);
|
||||
|
|
|
@ -125,8 +125,7 @@ bool BKE_workspace_use_scene_settings_get(const struct WorkSpace *workspace) GET
|
|||
void BKE_workspace_use_scene_settings_set(struct WorkSpace *workspace, bool value) SETTER_ATTRS;
|
||||
|
||||
/* Update / evaluate */
|
||||
void BKE_workspace_update_tagged(struct EvaluationContext *eval_ctx,
|
||||
struct Main *bmain,
|
||||
void BKE_workspace_update_tagged(struct Main *bmain,
|
||||
struct WorkSpace *workspace,
|
||||
struct Scene *scene);
|
||||
|
||||
|
|
|
@ -278,8 +278,6 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
|
|||
|
||||
/* update scene for current frame */
|
||||
static void motionpaths_calc_update_scene(Main *bmain,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
struct Depsgraph *depsgraph)
|
||||
{
|
||||
/* Do all updates
|
||||
|
@ -292,7 +290,7 @@ static void motionpaths_calc_update_scene(Main *bmain,
|
|||
*
|
||||
* TODO(sergey): Use evaluation context dedicated to motion paths.
|
||||
*/
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
}
|
||||
|
||||
/* ........ */
|
||||
|
@ -369,7 +367,7 @@ static void motionpaths_calc_bake_targets(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, eval_ctx->view_layer, eval_ctx->depsgraph);
|
||||
motionpaths_calc_update_scene(bmain, eval_ctx->depsgraph);
|
||||
|
||||
/* perform baking for targets */
|
||||
motionpaths_calc_bake_targets(scene, targets);
|
||||
|
@ -377,7 +375,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
|
|||
|
||||
/* reset original environment */
|
||||
CFRA = cfra;
|
||||
motionpaths_calc_update_scene(bmain, scene, eval_ctx->view_layer, eval_ctx->depsgraph);
|
||||
motionpaths_calc_update_scene(bmain, eval_ctx->depsgraph);
|
||||
|
||||
/* clear recalc flags from targets */
|
||||
for (mpt = targets->first; mpt; mpt = mpt->next) {
|
||||
|
|
|
@ -3679,7 +3679,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, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
|
||||
if (baker->update_progress) {
|
||||
float progress = ((float)(CFRA - startframe)/(float)(endframe - startframe));
|
||||
|
@ -3765,7 +3765,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, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
}
|
||||
|
||||
/* TODO: call redraw all windows somehow */
|
||||
|
|
|
@ -1387,17 +1387,12 @@ static void prepare_mesh_for_viewport_render(
|
|||
/* TODO(sergey): This actually should become view_layer_graph or so.
|
||||
* Same applies to update_for_newframe.
|
||||
*/
|
||||
void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
|
||||
Depsgraph *depsgraph,
|
||||
Main *bmain,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer)
|
||||
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph,
|
||||
Main *bmain)
|
||||
{
|
||||
/* TODO(sergey): Temporary solution for until pipeline.c is ported. */
|
||||
if (view_layer == NULL) {
|
||||
view_layer = DEG_get_evaluated_view_layer(depsgraph);
|
||||
BLI_assert(view_layer != NULL);
|
||||
}
|
||||
Scene *scene = DEG_get_input_scene(depsgraph);
|
||||
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
||||
|
||||
/* TODO(sergey): Some functions here are changing global state,
|
||||
* for example, clearing update tags from bmain.
|
||||
*/
|
||||
|
@ -1412,7 +1407,7 @@ void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
|
|||
/* Update all objects: drivers, matrices, displists, etc. flags set
|
||||
* by depgraph or manual, no layer check here, gets correct flushed.
|
||||
*/
|
||||
DEG_evaluate_on_refresh(eval_ctx, depsgraph);
|
||||
DEG_evaluate_on_refresh(depsgraph);
|
||||
/* Update sound system animation (TODO, move to depsgraph). */
|
||||
BKE_sound_update_scene(bmain, scene);
|
||||
/* Inform editors about possible changes. */
|
||||
|
@ -1422,12 +1417,12 @@ void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
|
|||
}
|
||||
|
||||
/* applies changes right away, does all sets too */
|
||||
void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
|
||||
Depsgraph *depsgraph,
|
||||
Main *bmain,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer)
|
||||
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph,
|
||||
Main *bmain)
|
||||
{
|
||||
Scene *scene = DEG_get_input_scene(depsgraph);
|
||||
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
|
||||
|
||||
/* TODO(sergey): Some functions here are changing global state,
|
||||
* for example, clearing update tags from bmain.
|
||||
*/
|
||||
|
@ -1452,7 +1447,7 @@ void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
|
|||
/* Update all objects: drivers, matrices, displists, etc. flags set
|
||||
* by depgraph or manual, no layer check here, gets correct flushed.
|
||||
*/
|
||||
DEG_evaluate_on_framechange(eval_ctx, bmain, depsgraph, ctime);
|
||||
DEG_evaluate_on_framechange(bmain, depsgraph, ctime);
|
||||
/* Update sound system animation (TODO, move to depsgraph). */
|
||||
BKE_sound_update_scene(bmain, scene);
|
||||
/* Notify editors and python about recalc. */
|
||||
|
|
|
@ -3334,7 +3334,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
|
|||
/* opengl offscreen render */
|
||||
RenderEngineType *engine_type = RE_engines_find(scene->view_render.engine_id);
|
||||
depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
|
||||
BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, context->bmain);
|
||||
ibuf = sequencer_view3d_cb(
|
||||
/* set for OpenGL render (NULL when scrubbing) */
|
||||
context->eval_ctx, scene, view_layer, engine_type,
|
||||
|
@ -3425,7 +3425,7 @@ finally:
|
|||
scene->r.subframe = orig_data.subframe;
|
||||
|
||||
if (is_frame_update && (depsgraph != NULL)) {
|
||||
BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, context->bmain);
|
||||
}
|
||||
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
|
|
|
@ -499,8 +499,7 @@ void BKE_workspace_use_scene_settings_set(WorkSpace *workspace, bool value)
|
|||
|
||||
/* Update / evaluate */
|
||||
|
||||
void BKE_workspace_update_tagged(struct EvaluationContext *eval_ctx,
|
||||
Main *bmain,
|
||||
void BKE_workspace_update_tagged(Main *bmain,
|
||||
WorkSpace *workspace,
|
||||
Scene *scene)
|
||||
{
|
||||
|
@ -508,7 +507,7 @@ void BKE_workspace_update_tagged(struct EvaluationContext *eval_ctx,
|
|||
struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene,
|
||||
view_layer,
|
||||
true);
|
||||
BKE_scene_graph_update_tagged(eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -240,16 +240,14 @@ void DEG_evaluation_context_free(struct EvaluationContext *eval_ctx);
|
|||
* < context_type: context to perform evaluation for
|
||||
* < ctime: (frame) new frame to evaluate values on
|
||||
*/
|
||||
void DEG_evaluate_on_framechange(struct EvaluationContext *eval_ctx,
|
||||
struct Main *bmain,
|
||||
void DEG_evaluate_on_framechange(struct Main *bmain,
|
||||
Depsgraph *graph,
|
||||
float ctime);
|
||||
|
||||
/* Data changed recalculation entry point.
|
||||
* < context_type: context to perform evaluation for
|
||||
*/
|
||||
void DEG_evaluate_on_refresh(struct EvaluationContext *eval_ctx,
|
||||
Depsgraph *graph);
|
||||
void DEG_evaluate_on_refresh(Depsgraph *graph);
|
||||
|
||||
bool DEG_needs_eval(Depsgraph *graph);
|
||||
|
||||
|
|
|
@ -126,20 +126,18 @@ void DEG_evaluation_context_free(EvaluationContext *eval_ctx)
|
|||
}
|
||||
|
||||
/* Evaluate all nodes tagged for updating. */
|
||||
void DEG_evaluate_on_refresh(EvaluationContext *eval_ctx,
|
||||
Depsgraph *graph)
|
||||
void DEG_evaluate_on_refresh(Depsgraph *graph)
|
||||
{
|
||||
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
|
||||
deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene);
|
||||
/* Update time on primary timesource. */
|
||||
DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source();
|
||||
tsrc->cfra = deg_graph->ctime;
|
||||
DEG::deg_evaluate_on_refresh(eval_ctx, deg_graph);
|
||||
DEG::deg_evaluate_on_refresh(deg_graph);
|
||||
}
|
||||
|
||||
/* Frame-change happened for root scene that graph belongs to. */
|
||||
void DEG_evaluate_on_framechange(EvaluationContext *eval_ctx,
|
||||
Main *bmain,
|
||||
void DEG_evaluate_on_framechange(Main *bmain,
|
||||
Depsgraph *graph,
|
||||
float ctime)
|
||||
{
|
||||
|
@ -151,7 +149,7 @@ void DEG_evaluate_on_framechange(EvaluationContext *eval_ctx,
|
|||
tsrc->tag_update(deg_graph);
|
||||
DEG::deg_graph_flush_updates(bmain, deg_graph);
|
||||
/* Perform recalculation updates. */
|
||||
DEG::deg_evaluate_on_refresh(eval_ctx, deg_graph);
|
||||
DEG::deg_evaluate_on_refresh(deg_graph);
|
||||
}
|
||||
|
||||
bool DEG_needs_eval(Depsgraph *graph)
|
||||
|
|
|
@ -227,23 +227,23 @@ static void schedule_children(TaskPool *pool,
|
|||
*
|
||||
* \note Time sources should be all valid!
|
||||
*/
|
||||
void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
|
||||
Depsgraph *graph)
|
||||
void deg_evaluate_on_refresh(Depsgraph *graph)
|
||||
{
|
||||
/* Set time for the current graph evaluation context. */
|
||||
TimeSourceDepsNode *time_src = graph->find_time_source();
|
||||
eval_ctx->ctime = time_src->cfra;
|
||||
eval_ctx->depsgraph = (::Depsgraph *)graph;
|
||||
eval_ctx->view_layer = DEG_get_evaluated_view_layer((::Depsgraph *)graph);
|
||||
/* Nothing to update, early out. */
|
||||
if (BLI_gset_len(graph->entry_tags) == 0) {
|
||||
return;
|
||||
}
|
||||
const bool do_time_debug = ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0);
|
||||
const double start_time = do_time_debug ? PIL_check_seconds_timer() : 0;
|
||||
/* Set up evaluation context for depsgraph itself. */
|
||||
/* Set up evaluation context. */
|
||||
EvaluationContext eval_ctx;
|
||||
DEG_evaluation_context_init_from_depsgraph(&eval_ctx, (::Depsgraph*)graph, graph->mode);
|
||||
eval_ctx.ctime = time_src->cfra;
|
||||
/* Set up evaluation state. */
|
||||
DepsgraphEvalState state;
|
||||
state.eval_ctx = eval_ctx;
|
||||
state.eval_ctx = &eval_ctx;
|
||||
state.graph = graph;
|
||||
state.do_stats = do_time_debug;
|
||||
/* Set up task scheduler and pull for threaded evaluation. */
|
||||
|
|
|
@ -45,7 +45,6 @@ struct Depsgraph;
|
|||
*
|
||||
* \note Time sources should be all valid!
|
||||
*/
|
||||
void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
|
||||
Depsgraph *graph);
|
||||
void deg_evaluate_on_refresh(Depsgraph *graph);
|
||||
|
||||
} // namespace DEG
|
||||
|
|
|
@ -195,7 +195,7 @@ void ED_workspace_object_mode_sync_from_scene(
|
|||
struct wmWindowManager *wm, WorkSpace *workspace, struct Scene *scene);
|
||||
|
||||
/* anim */
|
||||
void ED_update_for_newframe(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Depsgraph *depsgraph);
|
||||
void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph);
|
||||
|
||||
void ED_refresh_viewport_fps(struct bContext *C);
|
||||
int ED_screen_animation_play(struct bContext *C, int sync, int mode);
|
||||
|
|
|
@ -1769,7 +1769,7 @@ static int convert_exec(bContext *C, wmOperator *op)
|
|||
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
|
||||
uint64_t customdata_mask_prev = scene->customdata_mask;
|
||||
scene->customdata_mask |= CD_MASK_MESH;
|
||||
BKE_scene_graph_update_tagged(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
||||
scene->customdata_mask = customdata_mask_prev;
|
||||
}
|
||||
|
||||
|
|
|
@ -792,11 +792,7 @@ static int bake(
|
|||
|
||||
/* Make sure depsgraph is up to date. */
|
||||
DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_tagged(eval_ctx,
|
||||
depsgraph,
|
||||
bmain,
|
||||
scene,
|
||||
view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
||||
|
||||
/* get the mesh as it arrives in the renderer */
|
||||
me_low = bake_mesh_new_from_object(eval_ctx, bmain, scene, ob_low);
|
||||
|
|
|
@ -288,7 +288,6 @@ typedef struct DynamicPaintBakeJob {
|
|||
|
||||
struct Main *bmain;
|
||||
Scene *scene;
|
||||
ViewLayer *view_layer;
|
||||
Depsgraph *depsgraph;
|
||||
Object *ob;
|
||||
|
||||
|
@ -365,7 +364,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job)
|
|||
frame = surface->start_frame;
|
||||
orig_frame = scene->r.cfra;
|
||||
scene->r.cfra = (int)frame;
|
||||
ED_update_for_newframe(job->bmain, scene, job->view_layer, job->depsgraph);
|
||||
ED_update_for_newframe(job->bmain, job->depsgraph);
|
||||
|
||||
/* Init surface */
|
||||
if (!dynamicPaint_createUVSurface(scene, surface, job->progress, job->do_update)) {
|
||||
|
@ -391,7 +390,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job)
|
|||
|
||||
/* calculate a frame */
|
||||
scene->r.cfra = (int)frame;
|
||||
ED_update_for_newframe(job->bmain, scene, job->view_layer, job->depsgraph);
|
||||
ED_update_for_newframe(job->bmain, job->depsgraph);
|
||||
if (!dynamicPaint_calculateFrame(surface, job->eval_ctx, scene, cObject, frame)) {
|
||||
job->success = 0;
|
||||
return;
|
||||
|
@ -460,7 +459,6 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op)
|
|||
DynamicPaintCanvasSettings *canvas;
|
||||
Object *ob = ED_object_context(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
EvaluationContext *eval_ctx = MEM_mallocN(sizeof(*eval_ctx), "EvaluationContext");
|
||||
|
||||
CTX_data_eval_ctx(C, eval_ctx);
|
||||
|
@ -491,7 +489,6 @@ static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op)
|
|||
DynamicPaintBakeJob *job = MEM_mallocN(sizeof(DynamicPaintBakeJob), "DynamicPaintBakeJob");
|
||||
job->bmain = CTX_data_main(C);
|
||||
job->scene = scene;
|
||||
job->view_layer = view_layer;
|
||||
job->depsgraph = CTX_data_depsgraph(C);
|
||||
job->ob = ob;
|
||||
job->canvas = canvas;
|
||||
|
|
|
@ -409,7 +409,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
|
|||
/* Modifying the global scene isn't nice, but we can do it in
|
||||
* this part of the process before a threaded job is created */
|
||||
scene->r.cfra = (int)eval_time;
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, view_layer, depsgraph);
|
||||
ED_update_for_newframe(CTX_data_main(C), depsgraph);
|
||||
|
||||
/* now scene data should be current according to animation system, so we fill the channels */
|
||||
|
||||
|
@ -959,7 +959,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
|||
|
||||
/* reset to original current frame */
|
||||
scene->r.cfra = origFrame;
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, view_layer, depsgraph);
|
||||
ED_update_for_newframe(CTX_data_main(C), depsgraph);
|
||||
|
||||
/* ******** init domain object's matrix ******** */
|
||||
copy_m4_m4(domainMat, fsDomain->obmat);
|
||||
|
|
|
@ -350,7 +350,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
|
|||
RE_SetReports(re, NULL);
|
||||
|
||||
// no redraw needed, we leave state as we entered it
|
||||
ED_update_for_newframe(mainp, scene, view_layer, CTX_data_depsgraph(C));
|
||||
ED_update_for_newframe(mainp, CTX_data_depsgraph(C));
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
|
||||
|
||||
|
@ -676,7 +676,7 @@ static void render_endjob(void *rjv)
|
|||
if (rj->anim && !(rj->scene->r.scemode & R_NO_FRAME_UPDATE)) {
|
||||
/* possible this fails of loading new file while rendering */
|
||||
if (G.main->wm.first) {
|
||||
ED_update_for_newframe(G.main, rj->scene, rj->view_layer, rj->depsgraph);
|
||||
ED_update_for_newframe(G.main, rj->depsgraph);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -820,9 +820,8 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
|
|||
|
||||
if (oglrender->timer) { /* exec will not have a timer */
|
||||
Depsgraph *depsgraph = oglrender->depsgraph;
|
||||
ViewLayer *view_layer = oglrender->view_layer;
|
||||
scene->r.cfra = oglrender->cfrao;
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
|
||||
WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer);
|
||||
}
|
||||
|
@ -1021,7 +1020,6 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
|||
Main *bmain = CTX_data_main(C);
|
||||
OGLRender *oglrender = op->customdata;
|
||||
Scene *scene = oglrender->scene;
|
||||
ViewLayer *view_layer = oglrender->view_layer;
|
||||
Depsgraph *depsgraph = oglrender->depsgraph;
|
||||
char name[FILE_MAX];
|
||||
bool ok = false;
|
||||
|
@ -1033,7 +1031,7 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
|||
if (CFRA < oglrender->nfra)
|
||||
CFRA++;
|
||||
while (CFRA < oglrender->nfra) {
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
CFRA++;
|
||||
}
|
||||
|
||||
|
@ -1055,7 +1053,7 @@ static bool screen_opengl_render_anim_step(bContext *C, wmOperator *op)
|
|||
|
||||
WM_cursor_time(oglrender->win, scene->r.cfra);
|
||||
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
|
||||
if (view_context) {
|
||||
if (oglrender->rv3d->persp == RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
|
||||
|
|
|
@ -620,7 +620,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
|
|||
/* TODO(sergey): Use proper flag for tagging here. */
|
||||
DEG_graph_id_tag_update(pr_main, depsgraph, &sce->id, 0);
|
||||
DEG_relations_tag_update(pr_main);
|
||||
BKE_scene_graph_update_tagged(pr_main->eval_ctx, depsgraph, pr_main, sce, view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, pr_main);
|
||||
|
||||
return sce;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ void ED_scene_change_update(
|
|||
|
||||
ED_screen_update_after_scene_change(screen, scene_new, layer_new);
|
||||
ED_render_engine_changed(bmain);
|
||||
ED_update_for_newframe(bmain, scene_new, layer_new, depsgraph);
|
||||
ED_update_for_newframe(bmain, depsgraph);
|
||||
|
||||
/* complete redraw */
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
@ -68,6 +69,8 @@
|
|||
|
||||
#include "WM_message.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "screen_intern.h" /* own module include */
|
||||
|
||||
|
||||
|
@ -1707,8 +1710,10 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
|
|||
}
|
||||
|
||||
/* results in fully updated anim system */
|
||||
void ED_update_for_newframe(Main *bmain, Scene *scene, ViewLayer *view_layer, struct Depsgraph *depsgraph)
|
||||
void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
|
||||
{
|
||||
Scene *scene = DEG_get_input_scene(depsgraph);
|
||||
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
void *camera = BKE_scene_camera_switch_find(scene);
|
||||
if (camera && scene->camera != camera) {
|
||||
|
@ -1724,7 +1729,7 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, ViewLayer *view_layer, st
|
|||
ED_clip_update_frame(bmain, scene->r.cfra);
|
||||
|
||||
/* this function applies the changes too */
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
|
||||
/* composite */
|
||||
if (scene->use_nodes && scene->nodetree)
|
||||
|
|
|
@ -3564,7 +3564,6 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
|
|||
if (screen->animtimer && screen->animtimer == event->customdata) {
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
wmTimer *wt = screen->animtimer;
|
||||
ScreenAnimData *sad = wt->customdata;
|
||||
|
@ -3676,7 +3675,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
|
|||
}
|
||||
|
||||
/* since we follow drawflags, we can't send notifier but tag regions ourselves */
|
||||
ED_update_for_newframe(bmain, scene, view_layer, depsgraph);
|
||||
ED_update_for_newframe(bmain, depsgraph);
|
||||
|
||||
for (window = wm->windows.first; window; window = window->next) {
|
||||
const bScreen *win_screen = WM_window_get_active_screen(window);
|
||||
|
|
|
@ -311,7 +311,6 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
int oldfra = scene->r.cfra;
|
||||
int cfra;
|
||||
|
@ -320,11 +319,11 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
for (cfra = (scene->r.sfra > 0) ? (scene->r.sfra - 1) : 0; cfra <= scene->r.efra + 1; cfra++) {
|
||||
scene->r.cfra = cfra;
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
}
|
||||
|
||||
scene->r.cfra = oldfra;
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
|
|
@ -90,12 +90,7 @@ NodeGroup *BlenderFileLoader::Load()
|
|||
_re->scene,
|
||||
view_layer);
|
||||
|
||||
BKE_scene_graph_update_tagged(
|
||||
eval_ctx,
|
||||
depsgraph,
|
||||
_re->main,
|
||||
_re->scene,
|
||||
view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, _re->main);
|
||||
|
||||
#if 0
|
||||
if (G.debug & G_DEBUG_FREESTYLE) {
|
||||
|
|
|
@ -90,11 +90,7 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf
|
|||
view_layer = view_layer->next)
|
||||
{
|
||||
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx,
|
||||
depsgraph,
|
||||
bmain,
|
||||
scene,
|
||||
view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
}
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
|
@ -140,11 +136,7 @@ static void rna_Scene_update_tagged(Scene *scene, Main *bmain)
|
|||
view_layer = view_layer->next)
|
||||
{
|
||||
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
|
||||
BKE_scene_graph_update_tagged(bmain->eval_ctx,
|
||||
depsgraph,
|
||||
bmain,
|
||||
scene,
|
||||
view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
||||
}
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
|
|
|
@ -137,9 +137,7 @@ typedef struct RenderEngine {
|
|||
struct ReportList *reports;
|
||||
|
||||
/* Depsgraph */
|
||||
struct EvaluationContext *eval_ctx;
|
||||
struct Depsgraph *depsgraph;
|
||||
struct ViewLayer *view_layer;
|
||||
|
||||
/* for blender internal only */
|
||||
int update_flag;
|
||||
|
|
|
@ -5421,7 +5421,7 @@ static void database_fromscene_vectors(EvaluationContext *eval_ctx,
|
|||
|
||||
/* applies changes fully */
|
||||
scene->r.cfra += timeoffset;
|
||||
BKE_scene_graph_update_for_newframe(eval_ctx, eval_ctx->depsgraph, re->main, re->scene, NULL);
|
||||
BKE_scene_graph_update_for_newframe(eval_ctx->depsgraph, re->main);
|
||||
|
||||
/* if no camera, viewmat should have been set! */
|
||||
if (camera) {
|
||||
|
@ -5951,11 +5951,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, ViewLayer *view_l
|
|||
Depsgraph *depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
|
||||
DEG_evaluation_context_init_from_view_layer_for_render(eval_ctx, depsgraph, scene, view_layer);
|
||||
DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_tagged(eval_ctx,
|
||||
depsgraph,
|
||||
bmain,
|
||||
scene,
|
||||
view_layer);
|
||||
BKE_scene_graph_update_tagged(depsgraph, bmain);
|
||||
|
||||
re->flag |= R_BAKING;
|
||||
re->excludeob= actob;
|
||||
|
|
|
@ -533,32 +533,16 @@ static void engine_depsgraph_init(RenderEngine *engine, ViewLayer *view_layer)
|
|||
Main *bmain = engine->re->main;
|
||||
Scene *scene = engine->re->scene;
|
||||
|
||||
engine->eval_ctx = DEG_evaluation_context_new(DAG_EVAL_RENDER);
|
||||
engine->depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
|
||||
engine->view_layer = view_layer;
|
||||
|
||||
DEG_evaluation_context_init_from_view_layer_for_render(
|
||||
engine->eval_ctx,
|
||||
engine->depsgraph,
|
||||
scene,
|
||||
view_layer);
|
||||
|
||||
BKE_scene_graph_update_tagged(
|
||||
engine->eval_ctx,
|
||||
engine->depsgraph,
|
||||
bmain,
|
||||
scene,
|
||||
view_layer);
|
||||
BKE_scene_graph_update_tagged(engine->depsgraph, bmain);
|
||||
}
|
||||
|
||||
static void engine_depsgraph_free(RenderEngine *engine)
|
||||
{
|
||||
DEG_graph_free(engine->depsgraph);
|
||||
DEG_evaluation_context_free(engine->eval_ctx);
|
||||
|
||||
engine->eval_ctx = NULL;
|
||||
engine->depsgraph = NULL;
|
||||
engine->view_layer = NULL;
|
||||
}
|
||||
|
||||
void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
|
||||
|
@ -572,11 +556,7 @@ void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
|
|||
|
||||
CLAMP(cfra, MINAFRAME, MAXFRAME);
|
||||
BKE_scene_frame_set(re->scene, cfra);
|
||||
BKE_scene_graph_update_for_newframe(engine->eval_ctx,
|
||||
engine->depsgraph,
|
||||
re->main,
|
||||
re->scene,
|
||||
engine->view_layer);
|
||||
BKE_scene_graph_update_for_newframe(engine->depsgraph, re->main);
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
BPy_BEGIN_ALLOW_THREADS;
|
||||
|
|
|
@ -338,7 +338,7 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
|
|||
|
||||
WorkSpace *workspace = WM_window_get_active_workspace(win);
|
||||
|
||||
BKE_workspace_update_tagged(bmain->eval_ctx, bmain, workspace, scene);
|
||||
BKE_workspace_update_tagged(bmain, workspace, scene);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,9 +429,8 @@ void wm_event_do_notifiers(bContext *C)
|
|||
* twice which can depgraph update the same object at once */
|
||||
if (G.is_rendering == false) {
|
||||
/* depsgraph gets called, might send more notifiers */
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, view_layer, depsgraph);
|
||||
ED_update_for_newframe(CTX_data_main(C), depsgraph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2663,9 +2662,8 @@ void wm_event_do_handlers(bContext *C)
|
|||
int ncfra = time * (float)FPS + 0.5f;
|
||||
if (ncfra != scene->r.cfra) {
|
||||
scene->r.cfra = ncfra;
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
ED_update_for_newframe(CTX_data_main(C), scene, view_layer, depsgraph);
|
||||
ED_update_for_newframe(CTX_data_main(C), depsgraph);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3307,7 +3307,7 @@ static const EnumPropertyItem redraw_timer_type_items[] = {
|
|||
|
||||
|
||||
static void redraw_timer_step(
|
||||
bContext *C, Main *bmain, Scene *scene, ViewLayer *view_layer,
|
||||
bContext *C, Main *bmain, Scene *scene,
|
||||
struct Depsgraph *depsgraph,
|
||||
wmWindow *win, ScrArea *sa, ARegion *ar,
|
||||
const int type, const int cfra)
|
||||
|
@ -3355,7 +3355,7 @@ static void redraw_timer_step(
|
|||
}
|
||||
else if (type == eRTAnimationStep) {
|
||||
scene->r.cfra += (cfra == scene->r.cfra) ? 1 : -1;
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
}
|
||||
else if (type == eRTAnimationPlay) {
|
||||
/* play anim, return on same frame as started with */
|
||||
|
@ -3367,7 +3367,7 @@ static void redraw_timer_step(
|
|||
if (scene->r.cfra > scene->r.efra)
|
||||
scene->r.cfra = scene->r.sfra;
|
||||
|
||||
BKE_scene_graph_update_for_newframe(bmain->eval_ctx, depsgraph, bmain, scene, view_layer);
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
redraw_timer_window_swap(C);
|
||||
}
|
||||
}
|
||||
|
@ -3381,7 +3381,6 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
@ -3399,7 +3398,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
|
|||
time_start = PIL_check_seconds_timer();
|
||||
|
||||
for (a = 0; a < iter; a++) {
|
||||
redraw_timer_step(C, bmain, scene, view_layer, depsgraph, win, sa, ar, type, cfra);
|
||||
redraw_timer_step(C, bmain, scene, depsgraph, win, sa, ar, type, cfra);
|
||||
iter_steps += 1;
|
||||
|
||||
if (time_limit != 0.0) {
|
||||
|
|
Loading…
Reference in New Issue