diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-08 20:53:57 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-08 20:53:57 +0300 |
commit | 8662f583da216b56cf8f4dbe5f68c9da7999a9f1 (patch) | |
tree | d13a385fb3462dd1aecb4d4f69448730a166bdd5 /source/blender | |
parent | 282de867d48fea9cf930e68ef9553ed5d31cc5fd (diff) |
Fix (unreported) broken shapekeys after 'make_local' of datablocks used both directly and directly.
At first thought it was own recent work, but think issue is there since ages actually...
Basically, id_make_local() would always localize mesh/curve/lattice shapekeys, even in case
obdata localization actually made a local copy instead of localizing original datablock.
This was causing shapekeys being localized twice, and other odd nasty effects.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lattice.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 |
4 files changed, 10 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 377013bc9e9..485099427e9 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -242,6 +242,7 @@ void BKE_curve_make_local(Curve *cu) if (cu->id.us == 1) { id_clear_lib_data(bmain, &cu->id); + BKE_key_make_local(cu->key); extern_local_curve(cu); return; } @@ -255,6 +256,7 @@ void BKE_curve_make_local(Curve *cu) if (is_local && is_lib == false) { id_clear_lib_data(bmain, &cu->id); + BKE_key_make_local(cu->key); extern_local_curve(cu); } else if (is_local && is_lib) { diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 07e6ba9062e..53a3973f2c0 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -339,6 +339,7 @@ void BKE_lattice_make_local(Lattice *lt) if (!ID_IS_LINKED_DATABLOCK(lt)) return; if (lt->id.us == 1) { id_clear_lib_data(bmain, <->id); + BKE_key_make_local(lt->key); return; } @@ -351,6 +352,7 @@ void BKE_lattice_make_local(Lattice *lt) if (is_local && is_lib == false) { id_clear_lib_data(bmain, <->id); + BKE_key_make_local(lt->key); } else if (is_local && is_lib) { Lattice *lt_new = BKE_lattice_copy(lt); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 445e841eafc..e83f462ed79 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -142,7 +142,7 @@ void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id) void id_lib_extern(ID *id) { - if (id) { + if (id && ID_IS_LINKED_DATABLOCK(id)) { BLI_assert(BKE_idcode_is_linkable(GS(id->name))); if (id->tag & LIB_TAG_INDIRECT) { id->tag -= LIB_TAG_INDIRECT; @@ -267,16 +267,10 @@ bool id_make_local(Main *bmain, ID *id, bool test) if (!test) BKE_object_make_local(bmain, (Object *)id); return true; case ID_ME: - if (!test) { - BKE_mesh_make_local(bmain, (Mesh *)id); - BKE_key_make_local(((Mesh *)id)->key); - } + if (!test) BKE_mesh_make_local(bmain, (Mesh *)id); return true; case ID_CU: - if (!test) { - BKE_curve_make_local((Curve *)id); - BKE_key_make_local(((Curve *)id)->key); - } + if (!test) BKE_curve_make_local((Curve *)id); return true; case ID_MB: if (!test) BKE_mball_make_local((MetaBall *)id); @@ -291,10 +285,7 @@ bool id_make_local(Main *bmain, ID *id, bool test) if (!test) BKE_image_make_local((Image *)id); return true; case ID_LT: - if (!test) { - BKE_lattice_make_local((Lattice *)id); - BKE_key_make_local(((Lattice *)id)->key); - } + if (!test) BKE_lattice_make_local((Lattice *)id); return true; case ID_LA: if (!test) BKE_lamp_make_local((Lamp *)id); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 69c1cb43185..f00e5123f35 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -585,10 +585,7 @@ static int extern_local_mesh_callback( { /* We only tag usercounted ID usages as extern... Why? */ if ((cd_flag & IDWALK_USER) && *id_pointer) { - /* Exception: skip shapekeys, those are supposed to be made local immediately after anyway. */ - if (GS((*id_pointer)->name) != ID_KE) { - id_lib_extern(*id_pointer); - } + id_lib_extern(*id_pointer); } return IDWALK_NOP; } @@ -645,6 +642,7 @@ void BKE_mesh_make_local(Main *bmain, Mesh *me) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &me->id); + BKE_key_make_local(me->key); expand_local_mesh(me); } else { |