Changeset View
Standalone View
source/blender/depsgraph/intern/depsgraph_eval.cc
| Show All 40 Lines | |||||
| #include "intern/node/deg_node.h" | #include "intern/node/deg_node.h" | ||||
| #include "intern/node/deg_node_operation.h" | #include "intern/node/deg_node_operation.h" | ||||
| #include "intern/node/deg_node_time.h" | #include "intern/node/deg_node_time.h" | ||||
| #include "intern/depsgraph.h" | #include "intern/depsgraph.h" | ||||
| namespace deg = blender::deg; | namespace deg = blender::deg; | ||||
| /* Evaluate all nodes tagged for updating. */ | /* Evaluate the depsgraph in the given frame. The caller is expected to make sure that the time | ||||
sybren: "in the given frame" is a bit weird, because then a frame is seen as something that has a… | |||||
| void DEG_evaluate_on_refresh(Depsgraph *graph) | * source node has been tagged for update when appropriate. */ | ||||
sybrenUnsubmitted Not Done Inline ActionsI don't understand the 2nd sentence. Why would the caller be responsible for this, if this function can also figure out whether tagging is necessary or not? The function seems to do two things:
Probably deg_set_time_and_evaluate would be a better name for the function. sybren: I don't understand the 2nd sentence. Why would the caller be responsible for this, if this… | |||||
| static void deg_evaluate(Depsgraph *graph, float ctime) | |||||
| { | { | ||||
Not Done Inline ActionsComments need an update it seems. sergey: Comments need an update it seems. | |||||
| deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | ||||
| deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene); | deg_graph->ctime = ctime; | ||||
| /* Update time in scene. */ | |||||
| /* Update the time on the cow scene. */ | |||||
| if (deg_graph->scene_cow) { | if (deg_graph->scene_cow) { | ||||
| BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime); | BKE_scene_frame_set(deg_graph->scene_cow, ctime); | ||||
| } | } | ||||
| deg::deg_graph_flush_updates(deg_graph); | deg::deg_graph_flush_updates(deg_graph); | ||||
| deg::deg_evaluate_on_refresh(deg_graph); | deg::deg_evaluate_on_refresh(deg_graph); | ||||
| deg_graph->need_update_time = false; | |||||
| } | } | ||||
| /* Frame-change happened for root scene that graph belongs to. */ | /* Evaluate all nodes tagged for updating. */ | ||||
| void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime) | void DEG_evaluate_on_refresh(Depsgraph *graph) | ||||
sybrenUnsubmitted Not Done Inline ActionsThe naming seems to be a bit weird:
So the "on refresh" label blinks in and out of existence, without a clear indication as to why. Also DEG_evaluate_on_refresh() updates the depsgraph time from the scene time, which to me makes sense in a "the frame changed" scenario. But, for that there is a different function DEG_evaluate_on_framechange() function, which actually only sets the time, regardless of what it is in the current scene. Much confusion. Maybe not for this particular patch to solve, but confusing nonetheless. sybren: The naming seems to be a bit weird:
- `DEG_evaluate_on_refresh()` does not call `deg… | |||||
| { | { | ||||
| deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | const Scene *scene = DEG_get_input_scene(graph); | ||||
| deg_graph->ctime = ctime; | const float ctime = BKE_scene_frame_get(scene); | ||||
| deg_graph->need_update_time = true; | deg_evaluate(graph, ctime); | ||||
| deg::deg_graph_flush_updates(deg_graph); | |||||
| /* Update time in scene. */ | |||||
| if (deg_graph->scene_cow) { | |||||
| BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime); | |||||
| } | |||||
| /* Perform recalculation updates. */ | |||||
| deg::deg_evaluate_on_refresh(deg_graph); | |||||
| deg_graph->need_update_time = false; | |||||
| } | } | ||||
| bool DEG_needs_eval(Depsgraph *graph) | /* Frame-change happened for root scene that graph belongs to. */ | ||||
| void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime) | |||||
| { | { | ||||
| deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | DEG_graph_time_tag_update(graph); | ||||
| return !deg_graph->entry_tags.is_empty() || deg_graph->need_update_time; | deg_evaluate(graph, ctime); | ||||
| } | } | ||||
"in the given frame" is a bit weird, because then a frame is seen as something that has a duration (or something can't be "in" it) rather than a point in time. As it is now, I read it as evaluating the entire interval [frame, frame+1).