diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-09 16:33:34 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-09 18:56:05 +0300 |
commit | 7b1c406b5431ce65d84ddb5f2c53977c25c18373 (patch) | |
tree | d10874f81e0ca717dc288ae2071bc127c6da990a /source/blender/editors/object/object_relations.c | |
parent | 78b629a98f0c7c5c2c8f3b6b6d1081646cbe6fde (diff) |
Implement T77959: Never duplicate linked data during deep-copy.
Note that this behavior is enforced on user level for now, but on code
side it is controlled with a flag, which should make it easy to refine
that behavior if needed.
Only exception is when we duplicate a linked ID directly (then we assume
user wants a local deep-copy of that linked data, and we always also
duplicate linked sub-data-blocks).
Note that this commit also slightly refactor the handling of actions of
animdata, by simplifying `BKE_animdata_copy_id_action()` and adding an
explicit new `BKE_animdata_duplicate_id_action()` to be used during ID
duplication (deep copy).
This also allows us to get rid of the special case for liboverrides.
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index d37f03b7f55..ac41028089c 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1878,7 +1878,7 @@ static void single_obdata_users( /* Needed to remap texcomesh below. */ me = ob->data = ID_NEW_SET(ob->data, BKE_mesh_copy(bmain, ob->data)); if (me->key) { /* We do not need to set me->key->id.newid here... */ - BKE_animdata_copy_id_action(bmain, (ID *)me->key, false); + BKE_animdata_copy_id_action(bmain, (ID *)me->key); } break; case OB_MBALL: @@ -1891,13 +1891,13 @@ static void single_obdata_users( ID_NEW_REMAP(cu->bevobj); ID_NEW_REMAP(cu->taperobj); if (cu->key) { /* We do not need to set cu->key->id.newid here... */ - BKE_animdata_copy_id_action(bmain, (ID *)cu->key, false); + BKE_animdata_copy_id_action(bmain, (ID *)cu->key); } break; case OB_LATTICE: ob->data = lat = ID_NEW_SET(ob->data, BKE_lattice_copy(bmain, ob->data)); if (lat->key) { /* We do not need to set lat->key->id.newid here... */ - BKE_animdata_copy_id_action(bmain, (ID *)lat->key, false); + BKE_animdata_copy_id_action(bmain, (ID *)lat->key); } break; case OB_ARMATURE: @@ -1937,7 +1937,7 @@ static void single_obdata_users( * AnimData structure, which is not what we want. * (sergey) */ - BKE_animdata_copy_id_action(bmain, (ID *)ob->data, false); + BKE_animdata_copy_id_action(bmain, (ID *)ob->data); id_us_min(id); } @@ -1958,7 +1958,7 @@ static void single_object_action_users( FOREACH_OBJECT_FLAG_BEGIN (scene, view_layer, v3d, flag, ob) { if (!ID_IS_LINKED(ob)) { DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); - BKE_animdata_copy_id_action(bmain, &ob->id, false); + BKE_animdata_copy_id_action(bmain, &ob->id); } } FOREACH_OBJECT_FLAG_END; @@ -1980,7 +1980,7 @@ static void single_mat_users( if (ma->id.us > 1) { man = BKE_material_copy(bmain, ma); - BKE_animdata_copy_id_action(bmain, &man->id, false); + BKE_animdata_copy_id_action(bmain, &man->id); man->id.us = 0; BKE_object_material_assign(bmain, ob, man, a, BKE_MAT_ASSIGN_USERPREF); |