Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/eval/deg_eval_flush.cc
| Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | enum { | ||||
| COMPONENT_STATE_SCHEDULED = 1, | COMPONENT_STATE_SCHEDULED = 1, | ||||
| COMPONENT_STATE_DONE = 2, | COMPONENT_STATE_DONE = 2, | ||||
| }; | }; | ||||
| typedef deque<OperationNode *> FlushQueue; | typedef deque<OperationNode *> FlushQueue; | ||||
| namespace { | namespace { | ||||
| void tag_nodes_if_time_changed(Depsgraph *graph) | |||||
sybren: Which nodes? | |||||
| { | |||||
| TimeSourceNode *time_source = graph->find_time_source(); | |||||
| if (!time_source->tagged_for_update) { | |||||
| return; | |||||
| } | |||||
| for (Relation *rel : time_source->outlinks) { | |||||
| Node *node = rel->to; | |||||
| node->tag_update(graph, DEG_UPDATE_SOURCE_TIME); | |||||
| } | |||||
| } | |||||
Not Done Inline ActionsThis is only accessing properties of the TimeSourceNode, which is an indication that it actually should be a method of that class. sybren: This is only accessing properties of the `TimeSourceNode`, which is an indication that it… | |||||
| void flush_init_id_node_func(void *__restrict data_v, | void flush_init_id_node_func(void *__restrict data_v, | ||||
| const int i, | const int i, | ||||
| const TaskParallelTLS *__restrict /*tls*/) | const TaskParallelTLS *__restrict /*tls*/) | ||||
| { | { | ||||
| Depsgraph *graph = (Depsgraph *)data_v; | Depsgraph *graph = (Depsgraph *)data_v; | ||||
| IDNode *id_node = graph->id_nodes[i]; | IDNode *id_node = graph->id_nodes[i]; | ||||
| id_node->custom_flags = ID_STATE_NONE; | id_node->custom_flags = ID_STATE_NONE; | ||||
| for (ComponentNode *comp_node : id_node->components.values()) { | for (ComponentNode *comp_node : id_node->components.values()) { | ||||
| ▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | |||||
| * are tagged. | * are tagged. | ||||
| */ | */ | ||||
| void deg_graph_flush_updates(Depsgraph *graph) | void deg_graph_flush_updates(Depsgraph *graph) | ||||
| { | { | ||||
| /* Sanity checks. */ | /* Sanity checks. */ | ||||
| BLI_assert(graph != nullptr); | BLI_assert(graph != nullptr); | ||||
| Main *bmain = graph->bmain; | Main *bmain = graph->bmain; | ||||
| tag_nodes_if_time_changed(graph); | |||||
| /* Nothing to update, early out. */ | /* Nothing to update, early out. */ | ||||
| if (graph->need_update_time) { | |||||
| const Scene *scene_orig = graph->scene; | |||||
| const float ctime = BKE_scene_frame_get(scene_orig); | |||||
| TimeSourceNode *time_source = graph->find_time_source(); | |||||
| graph->ctime = ctime; | |||||
| time_source->tag_update(graph, DEG_UPDATE_SOURCE_TIME); | |||||
| } | |||||
| if (graph->entry_tags.is_empty()) { | if (graph->entry_tags.is_empty()) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Reset all flags, get ready for the flush. */ | /* Reset all flags, get ready for the flush. */ | ||||
| flush_prepare(graph); | flush_prepare(graph); | ||||
| /* Starting from the tagged "entry" nodes, flush outwards. */ | /* Starting from the tagged "entry" nodes, flush outwards. */ | ||||
| FlushQueue queue; | FlushQueue queue; | ||||
| flush_schedule_entrypoints(graph, &queue); | flush_schedule_entrypoints(graph, &queue); | ||||
| Show All 31 Lines | |||||
| { | { | ||||
| /* Go over all operation nodes, clearing tags. */ | /* Go over all operation nodes, clearing tags. */ | ||||
| for (OperationNode *node : graph->operations) { | for (OperationNode *node : graph->operations) { | ||||
| node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE | | node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE | | ||||
| DEPSOP_FLAG_USER_MODIFIED); | DEPSOP_FLAG_USER_MODIFIED); | ||||
| } | } | ||||
| /* Clear any entry tags which haven't been flushed. */ | /* Clear any entry tags which haven't been flushed. */ | ||||
| graph->entry_tags.clear(); | graph->entry_tags.clear(); | ||||
| TimeSourceNode *time_source = graph->find_time_source(); | |||||
| time_source->tagged_for_update = false; | |||||
| } | } | ||||
| } // namespace deg | } // namespace deg | ||||
| } // namespace blender | } // namespace blender | ||||
Which nodes?