diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-13 17:45:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-13 17:46:07 +0300 |
commit | 1c1e3de0156dadd65adb7dda2e5e85650478dffb (patch) | |
tree | e3bc64563f4033de0c9905b1d722104a9e5f4af6 /source/blender/depsgraph/intern | |
parent | 8f71a84496a95528303fbe0bb7c1406060353425 (diff) |
Fix T64387: Crash with driver copy/paste
Was missing copy-on-write tag since lamp itself has no geometry or
transform.
Now tagging for animation, and taking care of special case in the
dependency graph.
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index f682dadee8e..7dcba8b7655 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -245,6 +245,13 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id) deg_editors_id_update(&update_ctx, id); } +void depsgraph_id_tag_copy_on_write(Depsgraph *graph, IDNode *id_node, eUpdateSource update_source) +{ + ComponentNode *cow_comp = id_node->find_component(NodeType::COPY_ON_WRITE); + cow_comp->tag_update(graph, update_source); + id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE; +} + void depsgraph_tag_component(Depsgraph *graph, IDNode *id_node, NodeType component_type, @@ -252,7 +259,13 @@ void depsgraph_tag_component(Depsgraph *graph, eUpdateSource update_source) { ComponentNode *component_node = id_node->find_component(component_type); + /* NOTE: Animation component might not be existing yet (which happens when adding new driver or + * adding a new keyframe), so the required copy-on-write tag needs to be taken care explicitly + * here. */ if (component_node == NULL) { + if (component_type == NodeType::ANIMATION) { + depsgraph_id_tag_copy_on_write(graph, id_node, update_source); + } return; } if (operation_code == OperationCode::OPERATION) { @@ -266,9 +279,7 @@ void depsgraph_tag_component(Depsgraph *graph, } /* If component depends on copy-on-write, tag it as well. */ if (component_node->need_tag_cow_before_update()) { - ComponentNode *cow_comp = id_node->find_component(NodeType::COPY_ON_WRITE); - cow_comp->tag_update(graph, update_source); - id_node->id_orig->recalc |= ID_RECALC_COPY_ON_WRITE; + depsgraph_id_tag_copy_on_write(graph, id_node, update_source); } } @@ -462,7 +473,9 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph) * Need to solve those issues carefully, for until then we evaluate * animation for datablocks which appears in the graph for the first * time. */ - flag |= ID_RECALC_ANIMATION; + if (BKE_animdata_from_id(id_node->id_orig) != NULL) { + flag |= ID_RECALC_ANIMATION; + } } /* We only tag components which needs an update. Tagging everything is * not a good idea because that might reset particles cache (or any |