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. */ | static void deg_flush_updates_and_refresh(deg::Depsgraph *deg_graph) | ||||
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) | |||||
| { | { | ||||
Not Done Inline ActionsComments need an update it seems. sergey: Comments need an update it seems. | |||||
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… | |||||
| deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | /* Update the time on the cow scene. */ | ||||
| deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene); | |||||
| /* Update time in 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, deg_graph->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) | ||||
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); | deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | ||||
| const Scene *scene = DEG_get_input_scene(graph); | |||||
| const float ctime = BKE_scene_frame_get(scene); | |||||
| if (ctime != deg_graph->ctime) { | |||||
| deg_graph->tag_time_source(); | |||||
| deg_graph->ctime = ctime; | deg_graph->ctime = ctime; | ||||
| deg_graph->need_update_time = true; | |||||
| 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_flush_updates_and_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::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph); | ||||
| return !deg_graph->entry_tags.is_empty() || deg_graph->need_update_time; | deg_graph->tag_time_source(); | ||||
| deg_graph->ctime = ctime; | |||||
| deg_flush_updates_and_refresh(deg_graph); | |||||
| } | } | ||||
"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).