diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-11-16 20:50:23 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-11-17 13:19:54 +0300 |
commit | a52fbfa828966d19e8db5995d2332c90aa6515f4 (patch) | |
tree | 4893d6f2f1a2417f10bfb11597d91229a8ed88de /source/blender/blenkernel/BKE_key.h | |
parent | b505ecaa4ed86233396f5a2a06970dc747952144 (diff) |
ShapeKey: Refactor a bit `BKE_key_convert_from_...`
Thing is, those functions always reallocate the whole keyblock's data mem,
while in some cases we already have right amount of elements, so we can just
copy over. Further more, `BKE_key_convert_from_offset`, despite its name,
was not making any check nor allocation on keyblock's data elements!
So split 'copy' operation itself in `BKE_key_update_from_...`,
where no mem checks/operations are performed (only an assert).
Only useful in sculpt mode currently, but will be used by fix for T35170 too.
Diffstat (limited to 'source/blender/blenkernel/BKE_key.h')
-rw-r--r-- | source/blender/blenkernel/BKE_key.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index 892c42b4588..c96293f61a1 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -87,15 +87,24 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba float **per_keyblock_weights, const int mode); /* conversion functions */ -void BKE_key_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me); -void BKE_key_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb); -void BKE_key_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt); +/* Note: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */ +void BKE_key_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb); void BKE_key_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb); -void BKE_key_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb); +void BKE_key_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt); + +void BKE_key_update_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb); void BKE_key_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb); -float (*BKE_key_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3]; +void BKE_key_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb); + +void BKE_key_update_from_mesh(struct Mesh *me, struct KeyBlock *kb); +void BKE_key_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb); +void BKE_key_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me); + +void BKE_key_update_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]); void BKE_key_convert_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]); -void BKE_key_convert_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]); +float (*BKE_key_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3]; + +void BKE_key_update_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]); /* other management */ bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index); |