Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-12-14 06:20:17 +0300
committerJoshua Leung <aligorith@gmail.com>2009-12-14 06:20:17 +0300
commit2c3eb59f0f76482cec9a65e311704b2e48936364 (patch)
treeba3acacf56a62ba6e8eddf8b1531398e8f7e5336 /source/blender/editors/animation/keyingsets.c
parent921d4b8eb0d511e2fa2c3143142c372a178565f1 (diff)
A few KeyingSet + Transform Tweaks:
Autokeying for transform functions now gets context-info, allowing for bone paths to be recalculated. However, the main purpose of this is to allow KeyingSets to eventually have poll functions.
Diffstat (limited to 'source/blender/editors/animation/keyingsets.c')
-rw-r--r--source/blender/editors/animation/keyingsets.c72
1 files changed, 16 insertions, 56 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index c3606a03d1e..afd693d7981 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -1318,7 +1318,7 @@ int modify_keyframes (Scene *scene, ListBase *dsources, bAction *act, KeyingSet
* provided by the user, and is stored, ready to use, in the KeyingSet paths.
*/
for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
- int arraylen, i;
+ int i;
/* get pointer to name of group to add channels to */
if (ksp->groupmode == KSP_GROUP_NONE)
@@ -1328,36 +1328,14 @@ int modify_keyframes (Scene *scene, ListBase *dsources, bAction *act, KeyingSet
else
groupname= ksp->group;
- /* init arraylen and i - arraylen should be greater than i so that
- * normal non-array entries get keyframed correctly
- */
- i= ksp->array_index;
- arraylen= i;
+ /* passing -1 as the array_index results in the entire array being modified */
+ i= (ksp->flag & KSP_FLAG_WHOLE_ARRAY) ? (-1) : (ksp->array_index);
- /* get length of array if whole array option is enabled */
- if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) {
- PointerRNA id_ptr, ptr;
- PropertyRNA *prop;
-
- RNA_id_pointer_create(ksp->id, &id_ptr);
- if (RNA_path_resolve(&id_ptr, ksp->rna_path, &ptr, &prop) && prop)
- arraylen= RNA_property_array_length(&ptr, prop);
- }
-
- /* we should do at least one step */
- if (arraylen == i)
- arraylen++;
-
- /* for each possible index, perform operation
- * - assume that arraylen is greater than index
- */
- for (; i < arraylen; i++) {
- /* action to take depends on mode */
- if (mode == MODIFYKEY_MODE_INSERT)
- success+= insert_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag);
- else if (mode == MODIFYKEY_MODE_DELETE)
- success+= delete_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag);
- }
+ /* action to take depends on mode */
+ if (mode == MODIFYKEY_MODE_INSERT)
+ success += insert_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag);
+ else if (mode == MODIFYKEY_MODE_DELETE)
+ success += delete_keyframe(ksp->id, act, groupname, ksp->rna_path, i, cfra, kflag);
/* set recalc-flags */
if (ksp->id) {
@@ -1386,7 +1364,7 @@ int modify_keyframes (Scene *scene, ListBase *dsources, bAction *act, KeyingSet
for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
DynStr *pathds= BLI_dynstr_new();
char *path = NULL;
- int arraylen, i;
+ int i;
/* set initial group name */
if (cks->id == NULL) {
@@ -1461,32 +1439,14 @@ int modify_keyframes (Scene *scene, ListBase *dsources, bAction *act, KeyingSet
else if (ksp->groupmode == KSP_GROUP_NAMED)
groupname= ksp->group;
- /* init arraylen and i - arraylen should be greater than i so that
- * normal non-array entries get keyframed correctly
- */
- i= ksp->array_index;
- arraylen= i+1;
+ /* passing -1 as the array_index results in the entire array being modified */
+ i= (ksp->flag & KSP_FLAG_WHOLE_ARRAY) ? (-1) : (ksp->array_index);
- /* get length of array if whole array option is enabled */
- if (ksp->flag & KSP_FLAG_WHOLE_ARRAY) {
- PointerRNA id_ptr, ptr;
- PropertyRNA *prop;
-
- RNA_id_pointer_create(cks->id, &id_ptr);
- if (RNA_path_resolve(&id_ptr, path, &ptr, &prop) && prop)
- arraylen= RNA_property_array_length(&ptr, prop);
- }
-
- /* for each possible index, perform operation
- * - assume that arraylen is greater than index
- */
- for (; i < arraylen; i++) {
- /* action to take depends on mode */
- if (mode == MODIFYKEY_MODE_INSERT)
- success+= insert_keyframe(cks->id, act, groupname, path, i, cfra, kflag);
- else if (mode == MODIFYKEY_MODE_DELETE)
- success+= delete_keyframe(cks->id, act, groupname, path, i, cfra, kflag);
- }
+ /* action to take depends on mode */
+ if (mode == MODIFYKEY_MODE_INSERT)
+ success+= insert_keyframe(cks->id, act, groupname, path, i, cfra, kflag);
+ else if (mode == MODIFYKEY_MODE_DELETE)
+ success+= delete_keyframe(cks->id, act, groupname, path, i, cfra, kflag);
/* free the path */
MEM_freeN(path);