Moved Auto-Keying "Insert for KeyingSet only" option from UserPrefs to
Scene (Toolsettings, i.e. alongside "layered" option for using NLA while doing auto-keying) This option makes all Auto-Keying operations use the active Keying Set to carry out keyframing operations instead of picking and choosing their own Keying Sets to use, thus cutting down on the number of unwanted keys. Warning: if the older userpref option was enabled in an old startup.blend, it may be difficult to turn this option off.
This commit is contained in:
@@ -80,6 +80,7 @@ class TIME_HT_header(bpy.types.Header):
|
|||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True)
|
row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True)
|
||||||
|
row.prop(tools, "use_keyframe_insert_keyingset", text="", toggle=True)
|
||||||
if screen.is_animation_playing and tools.use_keyframe_insert_auto:
|
if screen.is_animation_playing and tools.use_keyframe_insert_auto:
|
||||||
subsub = row.row()
|
subsub = row.row()
|
||||||
subsub.prop(tools, "use_record_with_nla", toggle=True)
|
subsub.prop(tools, "use_record_with_nla", toggle=True)
|
||||||
|
|||||||
@@ -88,15 +88,15 @@ short ANIM_get_keyframing_flags (Scene *scene, short incl_mode)
|
|||||||
/* standard flags */
|
/* standard flags */
|
||||||
{
|
{
|
||||||
/* visual keying */
|
/* visual keying */
|
||||||
if (IS_AUTOKEY_FLAG(AUTOMATKEY))
|
if (IS_AUTOKEY_FLAG(scene, AUTOMATKEY))
|
||||||
flag |= INSERTKEY_MATRIX;
|
flag |= INSERTKEY_MATRIX;
|
||||||
|
|
||||||
/* only needed */
|
/* only needed */
|
||||||
if (IS_AUTOKEY_FLAG(INSERTNEEDED))
|
if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED))
|
||||||
flag |= INSERTKEY_NEEDED;
|
flag |= INSERTKEY_NEEDED;
|
||||||
|
|
||||||
/* default F-Curve color mode - RGB from XYZ indices */
|
/* default F-Curve color mode - RGB from XYZ indices */
|
||||||
if (IS_AUTOKEY_FLAG(XYZ2RGB))
|
if (IS_AUTOKEY_FLAG(scene, XYZ2RGB))
|
||||||
flag |= INSERTKEY_XYZ2RGB;
|
flag |= INSERTKEY_XYZ2RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
keyingflag |= ANIM_get_keyframing_flags(scene, 0);
|
keyingflag |= ANIM_get_keyframing_flags(scene, 0);
|
||||||
|
|
||||||
if (IS_AUTOKEY_FLAG(XYZ2RGB))
|
if (IS_AUTOKEY_FLAG(scene, XYZ2RGB))
|
||||||
keyingflag |= INSERTKEY_XYZ2RGB;
|
keyingflag |= INSERTKEY_XYZ2RGB;
|
||||||
|
|
||||||
/* call the API func, and set the active keyingset index */
|
/* call the API func, and set the active keyingset index */
|
||||||
@@ -680,9 +680,9 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
|
|||||||
* - use the active KeyingSet if defined (and user wants to use it for all autokeying),
|
* - use the active KeyingSet if defined (and user wants to use it for all autokeying),
|
||||||
* or otherwise key transforms only
|
* or otherwise key transforms only
|
||||||
*/
|
*/
|
||||||
if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (scene->active_keyingset))
|
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (scene->active_keyingset))
|
||||||
return ANIM_scene_get_active_keyingset(scene);
|
return ANIM_scene_get_active_keyingset(scene);
|
||||||
else if (IS_AUTOKEY_FLAG(INSERTAVAIL))
|
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL))
|
||||||
return ANIM_builtin_keyingset_get_named(NULL, "Available");
|
return ANIM_builtin_keyingset_get_named(NULL, "Available");
|
||||||
else
|
else
|
||||||
return ANIM_builtin_keyingset_get_named(NULL, tranformKSName);
|
return ANIM_builtin_keyingset_get_named(NULL, tranformKSName);
|
||||||
|
|||||||
@@ -259,8 +259,12 @@ short ANIM_paste_driver(struct ReportList *reports, struct ID *id, const char rn
|
|||||||
#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
|
#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
|
||||||
/* check the mode for auto-keyframing (per scene takes presidence) */
|
/* check the mode for auto-keyframing (per scene takes presidence) */
|
||||||
#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
|
#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
|
||||||
/* check if a flag is set for auto-keyframing (as userprefs only!) */
|
/* check if a flag is set for auto-keyframing (per scene takes presidence) */
|
||||||
#define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag)
|
#define IS_AUTOKEY_FLAG(scene, flag) \
|
||||||
|
((scene)? \
|
||||||
|
((scene->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || (U.autokey_flag & AUTOKEY_FLAG_##flag)) \
|
||||||
|
: \
|
||||||
|
(U.autokey_flag & AUTOKEY_FLAG_##flag))
|
||||||
|
|
||||||
/* auto-keyframing feature - checks for whether anything should be done for the current frame */
|
/* auto-keyframing feature - checks for whether anything should be done for the current frame */
|
||||||
int autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id);
|
int autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id);
|
||||||
|
|||||||
@@ -1511,6 +1511,11 @@ void init_userdef_do_versions(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bmain->versionfile < 257) {
|
||||||
|
/* clear "AUTOKEY_FLAG_ONLYKEYINGSET" flag from userprefs, so that it doesn't linger around from old configs like a ghost */
|
||||||
|
U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
|
||||||
|
}
|
||||||
|
|
||||||
/* GL Texture Garbage Collection (variable abused above!) */
|
/* GL Texture Garbage Collection (variable abused above!) */
|
||||||
if (U.textimeout == 0) {
|
if (U.textimeout == 0) {
|
||||||
U.texcollectrate = 60;
|
U.texcollectrate = 60;
|
||||||
|
|||||||
@@ -4586,13 +4586,13 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
|
|||||||
/* add datasource override for the camera object */
|
/* add datasource override for the camera object */
|
||||||
ANIM_relative_keyingset_add_source(&dsources, id, NULL, NULL);
|
ANIM_relative_keyingset_add_source(&dsources, id, NULL, NULL);
|
||||||
|
|
||||||
if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (active_ks)) {
|
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) {
|
||||||
/* only insert into active keyingset
|
/* only insert into active keyingset
|
||||||
* NOTE: we assume here that the active Keying Set does not need to have its iterator overridden spe
|
* NOTE: we assume here that the active Keying Set does not need to have its iterator overridden spe
|
||||||
*/
|
*/
|
||||||
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
||||||
}
|
}
|
||||||
else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
|
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
|
||||||
AnimData *adt= ob->adt;
|
AnimData *adt= ob->adt;
|
||||||
|
|
||||||
/* only key on available channels */
|
/* only key on available channels */
|
||||||
@@ -4603,7 +4603,7 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IS_AUTOKEY_FLAG(INSERTNEEDED)) {
|
else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) {
|
||||||
short doLoc=0, doRot=0, doScale=0;
|
short doLoc=0, doRot=0, doScale=0;
|
||||||
|
|
||||||
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
|
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
|
||||||
@@ -4700,12 +4700,12 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
|
|||||||
ANIM_relative_keyingset_add_source(&dsources, id, &RNA_PoseBone, pchan);
|
ANIM_relative_keyingset_add_source(&dsources, id, &RNA_PoseBone, pchan);
|
||||||
|
|
||||||
/* only insert into active keyingset? */
|
/* only insert into active keyingset? */
|
||||||
if (IS_AUTOKEY_FLAG(ONLYKEYINGSET) && (active_ks)) {
|
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) {
|
||||||
/* run the active Keying Set on the current datasource */
|
/* run the active Keying Set on the current datasource */
|
||||||
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
||||||
}
|
}
|
||||||
/* only insert into available channels? */
|
/* only insert into available channels? */
|
||||||
else if (IS_AUTOKEY_FLAG(INSERTAVAIL)) {
|
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
|
||||||
if (act) {
|
if (act) {
|
||||||
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
|
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
|
||||||
/* only insert keyframes for this F-Curve if it affects the current bone */
|
/* only insert keyframes for this F-Curve if it affects the current bone */
|
||||||
@@ -4724,7 +4724,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* only insert keyframe if needed? */
|
/* only insert keyframe if needed? */
|
||||||
else if (IS_AUTOKEY_FLAG(INSERTNEEDED)) {
|
else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) {
|
||||||
short doLoc=0, doRot=0, doScale=0;
|
short doLoc=0, doRot=0, doScale=0;
|
||||||
|
|
||||||
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
|
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
|
|||||||
* - we're not only keying for available channels
|
* - we're not only keying for available channels
|
||||||
* - the option to add new actions for each round is not enabled
|
* - the option to add new actions for each round is not enabled
|
||||||
*/
|
*/
|
||||||
if (IS_AUTOKEY_FLAG(INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
|
if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)==0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
|
||||||
/* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
|
/* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
|
||||||
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
|
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
|
||||||
AnimData *adt= BKE_animdata_from_id(id);
|
AnimData *adt= BKE_animdata_from_id(id);
|
||||||
|
|||||||
@@ -492,9 +492,9 @@ extern UserDef U; /* from blenkernel blender.c */
|
|||||||
#define AUTOKEY_FLAG_INSERTNEEDED (1<<1)
|
#define AUTOKEY_FLAG_INSERTNEEDED (1<<1)
|
||||||
#define AUTOKEY_FLAG_AUTOMATKEY (1<<2)
|
#define AUTOKEY_FLAG_AUTOMATKEY (1<<2)
|
||||||
#define AUTOKEY_FLAG_XYZ2RGB (1<<3)
|
#define AUTOKEY_FLAG_XYZ2RGB (1<<3)
|
||||||
/* U.autokey_flag (strictly autokeying only) */
|
|
||||||
|
/* toolsettings->autokey_flag */
|
||||||
#define AUTOKEY_FLAG_ONLYKEYINGSET (1<<6)
|
#define AUTOKEY_FLAG_ONLYKEYINGSET (1<<6)
|
||||||
/* toolsettings->autokey_flag */
|
|
||||||
#define ANIMRECORD_FLAG_WITHNLA (1<<10)
|
#define ANIMRECORD_FLAG_WITHNLA (1<<10)
|
||||||
|
|
||||||
/* transopts */
|
/* transopts */
|
||||||
|
|||||||
@@ -1159,7 +1159,12 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||||||
prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
|
prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
|
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
|
||||||
RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking");
|
RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking");
|
||||||
|
|
||||||
|
prop= RNA_def_property(srna, "use_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 only");
|
||||||
|
RNA_def_property_ui_icon(prop, ICON_KEY_HLT, 0); // XXX: we need a dedicated icon
|
||||||
|
|
||||||
/* UV */
|
/* UV */
|
||||||
prop= RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
|
prop= RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
|
||||||
RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
|
RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
|
||||||
|
|||||||
@@ -2185,10 +2185,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
|
|||||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL);
|
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");
|
RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available", "Automatic keyframe insertion in available curves");
|
||||||
|
|
||||||
prop= RNA_def_property(srna, "use_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");
|
|
||||||
|
|
||||||
/* keyframing settings */
|
/* keyframing settings */
|
||||||
prop= RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
|
prop= RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
|
RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
|
||||||
|
|||||||
Reference in New Issue
Block a user