Keying Sets - Bugfixes + Auto-Keyframing
* Added a new option for Auto-Keyframing which makes it only insert keyframes for the items included in the active Keying Set. This only works for Transform Auto-Keyframing so far (other tools will get it added later). The option is disabled by default. * Fixed bug where adding an 'entire' array to some KeyingSet would only start from the index of the button that the mouse was over at the time * Made some UI tweaks for Keying Sets buttons (still heaps of missing options there).
This commit is contained in:
parent
6e43a69a8d
commit
da698657ce
@ -473,6 +473,9 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
|
||||
|
||||
scene = context.scene
|
||||
|
||||
row = layout.row()
|
||||
row.itemL(text="Keying Sets")
|
||||
|
||||
row = layout.row()
|
||||
|
||||
col = row.column()
|
||||
@ -508,6 +511,9 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel):
|
||||
scene = context.scene
|
||||
ks = scene.active_keying_set
|
||||
|
||||
row = layout.row()
|
||||
row.itemL(text="Paths")
|
||||
|
||||
row = layout.row()
|
||||
|
||||
col = row.column()
|
||||
|
@ -199,13 +199,16 @@ class USERPREF_PT_edit(bpy.types.Panel):
|
||||
sub1 = sub.column()
|
||||
sub1.itemL(text="Keyframing:")
|
||||
sub1.itemR(edit, "use_visual_keying")
|
||||
sub1.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available")
|
||||
sub1.itemR(edit, "auto_keyframe_insert_needed", text="Only Insert Needed")
|
||||
sub1.itemR(edit, "keyframe_insert_needed", text="Only Insert Needed")
|
||||
sub1.itemS()
|
||||
sub1.itemL(text="New F-Curve Defaults:")
|
||||
sub1.itemR(edit, "new_interpolation_type", text="Interpolation")
|
||||
sub1.itemS()
|
||||
sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing")
|
||||
sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing:")
|
||||
sub2 = sub1.column()
|
||||
sub2.active = edit.auto_keying_enable
|
||||
sub2.itemR(edit, "auto_keyframe_insert_keyingset", text="Only Insert for Keying Set")
|
||||
sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available")
|
||||
|
||||
sub1.itemS()
|
||||
sub1.itemS()
|
||||
|
@ -337,9 +337,16 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
|
||||
|
||||
if (path) {
|
||||
/* set flags */
|
||||
if (all)
|
||||
if (all) {
|
||||
pflag |= KSP_FLAG_WHOLE_ARRAY;
|
||||
|
||||
/* we need to set the index for this to 0, even though it may break in some cases, this is
|
||||
* necessary if we want the entire array for most cases to get included without the user
|
||||
* having to worry about where they clicked
|
||||
*/
|
||||
index= 0;
|
||||
}
|
||||
|
||||
/* add path to this setting */
|
||||
BKE_keyingset_add_destination(ks, ptr.id.data, NULL, path, index, pflag, KSP_GROUP_KSNAME);
|
||||
success= 1;
|
||||
@ -1109,6 +1116,24 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, char name[])
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Get the active Keying Set for the Scene provided */
|
||||
KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
|
||||
{
|
||||
if (ELEM(NULL, scene, scene->keyingsets.first))
|
||||
return NULL;
|
||||
|
||||
/* currently, there are several possibilities here:
|
||||
* - 0: no active keying set
|
||||
* - > 0: one of the user-defined Keying Sets, but indices start from 0 (hence the -1)
|
||||
* - < 0: a builtin keying set (XXX this isn't enabled yet so that we don't get errors on reading back files)
|
||||
*/
|
||||
if (scene->active_keyingset > 0)
|
||||
return BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
|
||||
else // for now...
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ******************************************* */
|
||||
/* KEYFRAME MODIFICATION */
|
||||
|
||||
|
@ -135,6 +135,12 @@ struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, cha
|
||||
/* Initialise builtin KeyingSets on startup */
|
||||
void init_builtin_keyingsets(void);
|
||||
|
||||
|
||||
/* -------- */
|
||||
|
||||
/* Get the active KeyingSet for the given scene */
|
||||
struct KeyingSet *ANIM_scene_get_active_keyingset(struct Scene *scene);
|
||||
|
||||
/* ************ Drivers ********************** */
|
||||
|
||||
/* Returns whether there is a driver in the copy/paste buffer to paste */
|
||||
|
@ -216,7 +216,7 @@ typedef struct TransData {
|
||||
void *extra; /* extra data (mirrored element pointer, in editmode mesh to EditVert) (editbone for roll fixing) (...) */
|
||||
short flag; /* Various flags */
|
||||
short protectflag; /* If set, copy of Object or PoseChannel protection */
|
||||
int rotOrder; /* rotation order (for eulers), as defined in BLI_arithb.h */
|
||||
int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */
|
||||
} TransData;
|
||||
|
||||
typedef struct MouseInput {
|
||||
|
@ -4242,6 +4242,7 @@ void autokeyframe_ob_cb_func(Scene *scene, View3D *v3d, Object *ob, int tmode)
|
||||
|
||||
// TODO: this should probably be done per channel instead...
|
||||
if (autokeyframe_cfra_can_key(scene, id)) {
|
||||
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
|
||||
bCommonKeySrc cks;
|
||||
ListBase dsources = {&cks, &cks};
|
||||
float cfra= (float)CFRA; // xxx this will do for now
|
||||
@ -4258,7 +4259,12 @@ void autokeyframe_ob_cb_func(Scene *scene, View3D *v3d, Object *ob, int tmode)
|
||||
if (IS_AUTOKEY_MODE(scene, EDITKEYS))
|
||||
flag |= INSERTKEY_REPLACE;
|
||||
|
||||
if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
|
||||
|
||||
if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (active_ks)) {
|
||||
/* only insert into active keyingset */
|
||||
modify_keyframes(scene, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
||||
}
|
||||
else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
|
||||
AnimData *adt= ob->adt;
|
||||
|
||||
/* only key on available channels */
|
||||
@ -4337,6 +4343,7 @@ void autokeyframe_pose_cb_func(Scene *scene, View3D *v3d, Object *ob, int tmode,
|
||||
|
||||
// TODO: this should probably be done per channel instead...
|
||||
if (autokeyframe_cfra_can_key(scene, id)) {
|
||||
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
|
||||
bCommonKeySrc cks;
|
||||
ListBase dsources = {&cks, &cks};
|
||||
float cfra= (float)CFRA;
|
||||
@ -4363,8 +4370,14 @@ void autokeyframe_pose_cb_func(Scene *scene, View3D *v3d, Object *ob, int tmode,
|
||||
/* clear any 'unkeyed' flag it may have */
|
||||
pchan->bone->flag &= ~BONE_UNKEYED;
|
||||
|
||||
/* only insert into active keyingset? */
|
||||
if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (active_ks)) {
|
||||
/* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */
|
||||
cks.pchan= pchan;
|
||||
modify_keyframes(scene, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
||||
}
|
||||
/* only insert into available channels? */
|
||||
if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
|
||||
else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
|
||||
if (act) {
|
||||
for (fcu= act->curves.first; fcu; fcu= fcu->next)
|
||||
insert_keyframe(id, act, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
|
||||
|
@ -412,10 +412,12 @@ extern UserDef U; /* from blenkernel blender.c */
|
||||
#define AUTOKEY_MODE_EDITKEYS 5
|
||||
|
||||
/* Auto-Keying flag */
|
||||
/* U.autokey_flag */
|
||||
/* U.autokey_flag (not strictly used when autokeying only - is also used when keyframing these days) */
|
||||
#define AUTOKEY_FLAG_INSERTAVAIL (1<<0)
|
||||
#define AUTOKEY_FLAG_INSERTNEEDED (1<<1)
|
||||
#define AUTOKEY_FLAG_AUTOMATKEY (1<<2)
|
||||
/* U.autokey_flag (strictly autokeying only) */
|
||||
#define AUTOKEY_FLAG_ONLYKEYINGSET (1<<6)
|
||||
/* toolsettings->autokey_flag */
|
||||
#define ANIMRECORD_FLAG_WITHNLA (1<<10)
|
||||
|
||||
|
@ -1881,10 +1881,14 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "auto_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL);
|
||||
RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available", "Automatic keyframe insertion in available curves.");
|
||||
|
||||
prop= RNA_def_property(srna, "auto_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
|
||||
|
||||
prop= RNA_def_property(srna, "auto_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
|
||||
RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set.");
|
||||
|
||||
prop= RNA_def_property(srna, "keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
|
||||
RNA_def_property_ui_text(prop, "Auto Keyframe Insert Needed", "Automatic keyframe insertion only when keyframe needed.");
|
||||
RNA_def_property_ui_text(prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed.");
|
||||
|
||||
prop= RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_AUTOMATKEY);
|
||||
|
Loading…
Reference in New Issue
Block a user