[Bf-blender-cvs] [8662f58] master: Fix (unreported) broken shapekeys after 'make_local' of datablocks used both directly and directly.
Bastien Montagne
noreply at git.blender.org
Fri Jul 8 19:59:55 CEST 2016
Commit: 8662f583da216b56cf8f4dbe5f68c9da7999a9f1
Author: Bastien Montagne
Date: Fri Jul 8 19:53:57 2016 +0200
Branches: master
https://developer.blender.org/rB8662f583da216b56cf8f4dbe5f68c9da7999a9f1
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.
===================================================================
M source/blender/blenkernel/intern/curve.c
M source/blender/blenkernel/intern/lattice.c
M source/blender/blenkernel/intern/library.c
M source/blender/blenkernel/intern/mesh.c
===================================================================
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 377013b..4850994 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 07e6ba9..53a3973 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 445e841..e83f462 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 69c1cb4..f00e512 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 {
More information about the Bf-blender-cvs
mailing list