diff options
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 15 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 42 | ||||
-rw-r--r-- | source/blender/editors/armature/poselib.c | 16 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 13 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframing.h | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 39 |
7 files changed, 36 insertions, 96 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index e229de42006..a6981764afa 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -155,6 +155,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int case ANIMTYPE_DSMESH: { /* need to verify that this data is valid for now */ + // XXX: ale may be null! if (ale->adt) ale->adt->flag |= ADT_UI_ACTIVE; } @@ -462,7 +463,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA break; /* store this level as the 'old' level now */ - prevLevel= level; + prevLevel= level; // XXX: prevLevel is unused } } } @@ -1899,7 +1900,6 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent * return OPERATOR_CANCELLED; /* get useful pointers from animation context data */ - scene= ac.scene; ar= ac.ar; v2d= &ar->v2d; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index d80ccf2cd29..77e0c84d2f3 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -676,6 +676,21 @@ int ANIM_scene_get_keyingset_index (Scene *scene, KeyingSet *ks) return 0; } +/* Get Keying Set to use for Auto-Keyframing some transforms */ +KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformKSName) +{ + /* get KeyingSet to use + * - use the active KeyingSet if defined (and user wants to use it for all autokeying), + * or otherwise key transforms only + */ + if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) + return ANIM_scene_get_active_keyingset(scene); + else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) + return ANIM_builtin_keyingset_get_named(NULL, "Available"); + else + return ANIM_builtin_keyingset_get_named(NULL, tranformKSName); +} + /* Menu of All Keying Sets ----------------------------- */ /* Create (and show) a menu containing all the Keying Sets which can be used in the current context */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index f5396b7b173..ead5d44d393 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4948,18 +4948,8 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op) /* perform autokeying on the bones if needed */ if (autokey) { - KeyingSet *ks; - - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "Scaling"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Scaling"); /* insert keyframes */ ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); @@ -5027,18 +5017,8 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op) /* perform autokeying on the bones if needed */ if (autokey) { - KeyingSet *ks; - - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "Location"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location"); /* insert keyframes */ ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); @@ -5190,18 +5170,8 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) /* perform autokeying on the bones if needed */ if (autokey) { - KeyingSet *ks; - - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "Rotation"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Rotation"); /* insert keyframes */ ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 5ead0d42cd2..6083616044e 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -773,21 +773,9 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData if (pchan) { if (autokeyframe_cfra_can_key(scene, &pld->ob->id)) { ListBase dsources = {NULL, NULL}; - KeyingSet *ks = NULL; - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (poselib_ks_locrotscale == NULL) - poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); - - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale"); /* now insert the keyframe(s) using the Keying Set * 1) add datasource override for the PoseChannel diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index e2cf5876b51..b94b3e68318 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1012,18 +1012,9 @@ static int pose_paste_exec (bContext *C, wmOperator *op) /* keyframing tagging */ if (autokeyframe_cfra_can_key(scene, &ob->id)) { ListBase dsources = {NULL, NULL}; - KeyingSet *ks = NULL; - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "LocRotScale"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "LocRotScale"); /* now insert the keyframe(s) using the Keying Set * 1) add datasource override for the PoseChannel diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index fc5e3a43a62..8718d39dd18 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -193,6 +193,9 @@ struct KeyingSet *ANIM_scene_get_active_keyingset(struct Scene *scene); /* Get the index of the Keying Set provided, for the given Scene */ int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks); +/* Get Keying Set to use for Auto-Keyframing some transforms */ +struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const char *tranformKSName); + /* Create (and show) a menu containing all the Keying Sets which can be used in the current context */ void ANIM_keying_sets_menu_setup(struct bContext *C, char title[], char op_name[]); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index aa19ae2a9e2..d4644847a5c 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -68,18 +68,9 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - KeyingSet *ks; - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "Location"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Location"); /* clear location of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -138,18 +129,9 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - KeyingSet *ks; - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "Rotation"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Rotation"); /* clear rotation of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -292,18 +274,9 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - KeyingSet *ks; - /* get KeyingSet to use - * - use the active KeyingSet if defined (and user wants to use it for all autokeying), - * or otherwise key transforms only - */ - if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset)) - ks = ANIM_scene_get_active_keyingset(scene); - else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) - ks = ANIM_builtin_keyingset_get_named(NULL, "Available"); - else - ks = ANIM_builtin_keyingset_get_named(NULL, "Scaling"); + /* get KeyingSet to use */ + KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, "Scaling"); /* clear scales of selected objects if not in weight-paint mode */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { |