diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-31 17:44:34 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-31 19:07:55 +0300 |
commit | df22cd9ce160457bda1a976da4dd6e7079f36865 (patch) | |
tree | 72b4884827f26bf5be9fff0b8ec906e65cfa6763 /source | |
parent | 3352dd3a3f4c3deadd6d66068f983a639896446a (diff) |
Depsgraph: Fixes to prevent object duplicate to jump
This includes:
- Skip OB_RECALC_TIME tag from object duplicate operator
not sure why it is needed: even if original object was
animated, duplicating it will copy evaluated values.
- Don't tag whole ID for update when updating it after
relations rebuilt. Use the same trickery to detect
whether animation is to be re-evaluated or not as is
done for update flag=0.
- Don't tag datablocks which are expanded for update
of copy-on-write.
- Avoid flush along relation from copy-on-write
operation in action. This will not invalidate any
pointers in the copied datablock since we don't
reference anything in the action.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder.cc | 10 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index e2fc1efd455..f1f3da85968 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -35,6 +35,7 @@ #include "intern/depsgraph.h" #include "intern/depsgraph_types.h" +#include "intern/eval/deg_eval_copy_on_write.h" #include "intern/nodes/deg_node.h" #include "intern/nodes/deg_node_id.h" @@ -53,12 +54,11 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) ID *id = id_node->id_orig; id_node->finalize_build(graph); if ((id->recalc & ID_RECALC_ALL)) { - id_node->tag_update(graph); + DEG_id_tag_update_ex(bmain, id_node->id_orig, 0); + } + if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { + DEG_id_tag_update_ex(bmain, id_node->id_orig, DEG_TAG_COPY_ON_WRITE); } - /* TODO(sergey): This is not ideal at all, since this forces - * re-evaluaiton of the whole tree. - */ - DEG_id_tag_update_ex(bmain, id_node->id_orig, DEG_TAG_COPY_ON_WRITE); } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 1833f19d4e5..5d0258ac2fe 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2112,7 +2112,6 @@ void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node) { ID *id_orig = id_node->id_orig; - ID_Type id_type = GS(id_orig->name); TimeSourceKey time_source_key; OperationKey copy_on_write_key(id_orig, @@ -2137,7 +2136,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDDepsNode *id_node continue; } int rel_flag = 0; - if (comp_node->type == DEG_NODE_TYPE_ANIMATION && id_type != ID_AC) { + if (comp_node->type == DEG_NODE_TYPE_ANIMATION) { rel_flag |= DEPSREL_FLAG_NO_FLUSH; } /* All entry operations of each component should wait for a proper diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 958b656d323..d9ba12d1183 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2071,7 +2071,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer } else { obn = ID_NEW_SET(ob, BKE_object_copy(bmain, ob)); - DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA); base = BKE_view_layer_base_find(view_layer, ob); if ((base != NULL) && (base->flag & BASE_VISIBLED)) { |