diff options
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval_flush.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_flush.cc | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index ee543dcf25d..a74ec485d88 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -32,9 +32,11 @@ #include "BLI_task.h" #include "BLI_utildefines.h" +#include "BKE_key.h" #include "BKE_object.h" #include "BKE_scene.h" +#include "DNA_key_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -67,7 +69,8 @@ // catch usage of invalid state. #undef INVALIDATE_ON_FLUSH -namespace DEG { +namespace blender { +namespace deg { enum { ID_STATE_NONE = 0, @@ -96,7 +99,7 @@ void flush_init_id_node_func(void *__restrict data_v, } } -BLI_INLINE void flush_prepare(Depsgraph *graph) +inline void flush_prepare(Depsgraph *graph) { for (OperationNode *node : graph->operations) { node->scheduled = false; @@ -111,7 +114,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph) } } -BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue) +inline void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue) { for (OperationNode *op_node : graph->entry_tags) { queue->push_back(op_node); @@ -123,15 +126,15 @@ BLI_INLINE void flush_schedule_entrypoints(Depsgraph *graph, FlushQueue *queue) } } -BLI_INLINE void flush_handle_id_node(IDNode *id_node) +inline void flush_handle_id_node(IDNode *id_node) { id_node->custom_flags = ID_STATE_MODIFIED; } /* TODO(sergey): We can reduce number of arguments here. */ -BLI_INLINE void flush_handle_component_node(IDNode *id_node, - ComponentNode *comp_node, - FlushQueue *queue) +inline void flush_handle_component_node(IDNode *id_node, + ComponentNode *comp_node, + FlushQueue *queue) { /* We only handle component once. */ if (comp_node->custom_flags == COMPONENT_STATE_DONE) { @@ -166,7 +169,7 @@ BLI_INLINE void flush_handle_component_node(IDNode *id_node, * return value, so it can start being handled right away, without building too * much of a queue. */ -BLI_INLINE OperationNode *flush_schedule_children(OperationNode *op_node, FlushQueue *queue) +inline OperationNode *flush_schedule_children(OperationNode *op_node, FlushQueue *queue) { if (op_node->flag & DEPSOP_FLAG_USER_MODIFIED) { IDNode *id_node = op_node->owner->owner; @@ -227,7 +230,7 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd ID *id_orig = id_node->id_orig; ID *id_cow = id_node->id_cow; /* Gather recalc flags from all changed components. */ - for (DEG::ComponentNode *comp_node : id_node->components.values()) { + for (ComponentNode *comp_node : id_node->components.values()) { if (comp_node->custom_flags != COMPONENT_STATE_DONE) { continue; } @@ -250,10 +253,30 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd if (deg_copy_on_write_is_expanded(id_cow)) { if (graph->is_active && id_node->is_user_modified) { deg_editors_id_update(update_ctx, id_orig); - } - /* ID may need to get its auto-override operations refreshed. */ - if (ID_IS_OVERRIDE_LIBRARY_AUTO(id_orig)) { - id_orig->tag |= LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH; + + /* We only want to tag an ID for lib-override auto-refresh if it was actually tagged as + * changed. CoW IDs indirectly modified because of changes in other IDs should never + * require a lib-override diffing. */ + if (ID_IS_OVERRIDE_LIBRARY_REAL(id_orig)) { + id_orig->tag |= LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH; + } + else if (ID_IS_OVERRIDE_LIBRARY_VIRTUAL(id_orig)) { + switch (GS(id_orig->name)) { + case ID_KE: + ((Key *)id_orig)->from->tag |= LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH; + break; + case ID_GR: + BLI_assert(id_orig->flag & LIB_EMBEDDED_DATA); + /* TODO. */ + break; + case ID_NT: + BLI_assert(id_orig->flag & LIB_EMBEDDED_DATA); + /* TODO. */ + break; + default: + BLI_assert(0); + } + } } /* Inform draw engines that something was changed. */ flush_engine_data_update(id_cow); @@ -337,9 +360,9 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) if (graph->need_update_time) { const Scene *scene_orig = graph->scene; const float ctime = BKE_scene_frame_get(scene_orig); - DEG::TimeSourceNode *time_source = graph->find_time_source(); + TimeSourceNode *time_source = graph->find_time_source(); graph->ctime = ctime; - time_source->tag_update(graph, DEG::DEG_UPDATE_SOURCE_TIME); + time_source->tag_update(graph, DEG_UPDATE_SOURCE_TIME); } if (graph->entry_tags.is_empty()) { return; @@ -390,4 +413,5 @@ void deg_graph_clear_tags(Depsgraph *graph) graph->entry_tags.clear(); } -} // namespace DEG +} // namespace deg +} // namespace blender |