Commit: 5f364216acd5bf0f8098b1da1cdb2e75d42d59b3 Author: Bastien Montagne Date: Thu Oct 8 16:24:38 2020 +0200 Branches: master https://developer.blender.org/rB5f364216acd5bf0f8098b1da1cdb2e75d42d59b3
Cleanup/Refactor: Shapekey: Get rid of `BKE_key_copy_nolib()` Once again, no behavioral change expected here. =================================================================== M source/blender/blenkernel/BKE_key.h M source/blender/blenkernel/intern/key.c M source/blender/editors/mesh/editmesh_undo.c =================================================================== diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index e3d69166b62..c969ce07d74 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -39,7 +39,6 @@ extern "C" { void BKE_key_free(struct Key *key); void BKE_key_free_nolib(struct Key *key); struct Key *BKE_key_add(struct Main *bmain, struct ID *id); -struct Key *BKE_key_copy_nolib(struct Key *key); void BKE_key_sort(struct Key *key); void key_curve_position_weights(float t, float data[4], int type); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 5496da2d6f4..8d0413f64c5 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -296,36 +296,6 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */ return key; } -/* XXX TODO get rid of this! */ -Key *BKE_key_copy_nolib(Key *key) -{ - Key *keyn; - KeyBlock *kbn, *kb; - - keyn = MEM_dupallocN(key); - - keyn->adt = NULL; - - BLI_duplicatelist(&keyn->block, &key->block); - - kb = key->block.first; - kbn = keyn->block.first; - while (kbn) { - - if (kbn->data) { - kbn->data = MEM_dupallocN(kbn->data); - } - if (kb == key->refkey) { - keyn->refkey = kbn; - } - - kbn = kbn->next; - kb = kb->next; - } - - return keyn; -} - /* Sort shape keys and Ipo curves after a change. This assumes that at most * one key was moved, which is a valid assumption for the places it's * currently being called. diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c index 9f625fd0515..41d840c4a2d 100644 --- a/source/blender/editors/mesh/editmesh_undo.c +++ b/source/blender/editors/mesh/editmesh_undo.c @@ -35,6 +35,7 @@ #include "BKE_editmesh.h" #include "BKE_key.h" #include "BKE_layer.h" +#include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_undo_system.h" @@ -508,7 +509,13 @@ static void *undomesh_from_editmesh(UndoMesh *um, BMEditMesh *em, Key *key) } #endif /* make sure shape keys work */ - um->me.key = key ? BKE_key_copy_nolib(key) : NULL; + if (key != NULL) { + um->me.key = (Key *)BKE_id_copy_ex( + NULL, &key->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA); + } + else { + um->me.key = NULL; + } /* BM_mesh_validate(em->bm); */ /* for troubleshooting */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs