Blender  V3.3
depsgraph_eval.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
10 #include "MEM_guardedalloc.h"
11 
12 #include "BLI_listbase.h"
13 #include "BLI_utildefines.h"
14 
15 #include "BKE_scene.h"
16 
17 #include "DNA_object_types.h"
18 #include "DNA_scene_types.h"
19 
20 #include "DEG_depsgraph.h"
21 #include "DEG_depsgraph_query.h"
22 
23 #include "intern/eval/deg_eval.h"
25 
26 #include "intern/node/deg_node.h"
29 
30 #include "intern/depsgraph.h"
31 #include "intern/depsgraph_tag.h"
32 
33 namespace deg = blender::deg;
34 
36 {
37  /* Update the time on the cow scene. */
38  if (deg_graph->scene_cow) {
39  BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->frame);
40  }
41 
45 }
46 
48 {
49  deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
51  const float frame = BKE_scene_frame_get(scene);
52  const float ctime = BKE_scene_ctime_get(scene);
53 
54  if (deg_graph->frame != frame || ctime != deg_graph->ctime) {
55  deg_graph->tag_time_source();
56  deg_graph->frame = frame;
57  deg_graph->ctime = ctime;
58  }
59  else if (scene->id.recalc & ID_RECALC_FRAME_CHANGE) {
60  /* Comparing depsgraph & scene frame fails in the case of undo,
61  * since the undo state is stored before updates from the frame change have been applied.
62  * In this case reading back the undo state will behave as if no updates on frame change
63  * is needed as the #Depsgraph.ctime & frame will match the values in the input scene.
64  * Use #ID_RECALC_FRAME_CHANGE to detect that recalculation is necessary. see: T66913. */
65  deg_graph->tag_time_source();
66  }
67 
69 }
70 
72 {
73  deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
75 
76  deg_graph->tag_time_source();
77  deg_graph->frame = frame;
78  deg_graph->ctime = BKE_scene_frame_to_ctime(scene, frame);
80 }
float BKE_scene_frame_get(const struct Scene *scene)
float BKE_scene_ctime_get(const struct Scene *scene)
void BKE_scene_frame_set(struct Scene *scene, float frame)
Definition: scene.cc:2420
float BKE_scene_frame_to_ctime(const struct Scene *scene, int frame)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
@ ID_RECALC_FRAME_CHANGE
Definition: DNA_ID.h:841
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
Depsgraph * graph
Scene scene
static void deg_flush_updates_and_refresh(deg::Depsgraph *deg_graph)
void DEG_evaluate_on_refresh(Depsgraph *graph)
void DEG_evaluate_on_framechange(Depsgraph *graph, float frame)
void graph_tag_ids_for_visible_update(Depsgraph *graph)
void deg_graph_flush_updates(Depsgraph *graph)
void deg_evaluate_on_refresh(Depsgraph *graph)
Definition: deg_eval.cc:394
int recalc
Definition: DNA_ID.h:390