diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-08 12:49:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-08 12:52:04 +0300 |
commit | 87629b2a7443f1b2bf41062aec5054ab1123ca83 (patch) | |
tree | a69fa356413a4c7d0e94496f36887b1da8758c1e /source/blender/blenkernel/intern/key.c | |
parent | 546a0e2d967ffa1a4cdf60c29fa57b2b5d4c9bbc (diff) |
RNA: Object.shape_key_remove method
Python had no ability to remove shape keys
Original D1169 from @lichtwerk, with edits
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 4f4c5bf8643..8427b17c01a 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1392,25 +1392,37 @@ float *BKE_key_evaluate_object(Object *ob, int *r_totelem) return BKE_key_evaluate_object_ex(ob, r_totelem, NULL, 0); } -Key *BKE_key_from_object(Object *ob) +Key **BKE_key_from_object_p(Object *ob) { - if (ob == NULL) return NULL; - + if (ob == NULL) + return NULL; + if (ob->type == OB_MESH) { Mesh *me = ob->data; - return me->key; + return &me->key; } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; - return cu->key; + return &cu->key; } else if (ob->type == OB_LATTICE) { Lattice *lt = ob->data; - return lt->key; + return <->key; } return NULL; } +Key *BKE_key_from_object(Object *ob) +{ + Key **key_p; + key_p = BKE_key_from_object_p(ob); + if (key_p) { + return *key_p; + } + + return NULL; +} + KeyBlock *BKE_keyblock_add(Key *key, const char *name) { KeyBlock *kb; |