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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user