Cleanup/refactor: handle shapekeys exactly like 'owned' nodetrees in make_local process.
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 14 Jul 2016 13:38:41 +0000 (15:38 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 14 Jul 2016 16:33:12 +0000 (18:33 +0200)
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/mesh.c

index 596890da24dc77e9fc5313529f24bafad16a0e11..693e7eb0c80041e17fdc59a68ab18771f56a1ecd 100644 (file)
@@ -233,9 +233,6 @@ void BKE_curve_make_local(Main *bmain, Curve *cu, const bool force_local)
        if (force_local || is_local) {
                if (!is_lib) {
                        id_clear_lib_data(bmain, &cu->id);
-                       if (cu->key) {
-                               id_clear_lib_data(bmain, &cu->key->id);
-                       }
                        BKE_id_expand_local(&cu->id);
                }
                else {
index 0babe1d317cf4b28f2b756fd11d94e5a02362a68..c2675fabe3b580fe1b286d2e49b7b1122f3f8f3c 100644 (file)
@@ -348,9 +348,6 @@ void BKE_lattice_make_local(Main *bmain, Lattice *lt, const bool force_local)
        if (force_local || is_local) {
                if (!is_lib) {
                        id_clear_lib_data(bmain, &lt->id);
-                       if (lt->key) {
-                               id_clear_lib_data(bmain, &lt->key->id);
-                       }
                        BKE_id_expand_local(&lt->id);
                }
                else {
index f570066ed16d272c371fc1b821f98a8e6498f856..37f64ba148bd67adf708174690373725ec8b359a 100644 (file)
@@ -1470,6 +1470,7 @@ bool new_id(ListBase *lb, ID *id, const char *tname)
 void id_clear_lib_data_ex(Main *bmain, ID *id, bool id_in_mainlist)
 {
        bNodeTree *ntree = NULL;
+       Key *key = NULL;
 
        BKE_id_lib_local_paths(bmain, id->lib, id);
 
@@ -1480,13 +1481,16 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, bool id_in_mainlist)
        if (id_in_mainlist)
                new_id(which_libbase(bmain, GS(id->name)), id, NULL);
 
-       /* internal bNodeTree blocks inside ID types below
-        * also stores id->lib, make sure this stays in sync.
-        */
+       /* Internal bNodeTree blocks inside datablocks also stores id->lib, make sure this stays in sync. */
        if ((ntree = ntreeFromID(id))) {
                id_clear_lib_data_ex(bmain, &ntree->id, id_in_mainlist);
        }
 
+       /* Same goes for shapekeys. */
+       if ((key = BKE_key_from_id(id))) {
+               id_clear_lib_data_ex(bmain, &key->id, id_in_mainlist);
+       }
+
        if (GS(id->name) == ID_OB) {
                Object *object = (Object *)id;
                if (object->proxy_from != NULL) {
index db15dc18da4f81d56e9b4a08c730896ac1c686de..ea9fa57f9055b97325ab9714c59187e29404cf2c 100644 (file)
@@ -573,9 +573,6 @@ void BKE_mesh_make_local(Main *bmain, Mesh *me, const bool force_local)
        if (force_local || is_local) {
                if (!is_lib) {
                        id_clear_lib_data(bmain, &me->id);
-                       if (me->key) {
-                               id_clear_lib_data(bmain, &me->key->id);
-                       }
                        BKE_id_expand_local(&me->id);
                }
                else {