== AutoKeying - Tidy Up ==

This commit restores the "big red button". When Auto-Keying is enabled (record button toggled on), a menu appears beside it to choose which behaviour for auto-keying should be used. This should be more efficient for quickly turning Auto-Keying on/off.

I've also added the relevant version-patches to fix up old files so that sensible default options are in use.
This commit is contained in:
Joshua Leung
2008-01-12 11:06:51 +00:00
parent 60722bfb1d
commit 4830f12680
5 changed files with 54 additions and 27 deletions

View File

@@ -262,9 +262,11 @@ extern UserDef U; /* from usiblender.c !!!! */
#define USER_SHOW_FPS (1 << 21)
/* Auto-Keying mode */
#define AUTOKEY_MODE_OFF 0
#define AUTOKEY_MODE_NORMAL 1
#define AUTOKEY_MODE_EDITKEYS 2
/* AUTOKEY_ON is a bitflag */
#define AUTOKEY_ON 1
/* AUTOKEY_ON + 2**n... (i.e. AUTOKEY_MODE_NORMAL = AUTOKEY_ON + 2) to preserve setting, even when autokey turned off */
#define AUTOKEY_MODE_NORMAL 3
#define AUTOKEY_MODE_EDITKEYS 5
/* Auto-Keying flag */
#define AUTOKEY_FLAG_INSERTAVAIL (1<<0)
@@ -272,6 +274,7 @@ extern UserDef U; /* from usiblender.c !!!! */
#define AUTOKEY_FLAG_AUTOMATKEY (1<<2)
/* Auto-Keying macros */
#define IS_AUTOKEY_ON (U.autokey_mode & AUTOKEY_ON)
#define IS_AUTOKEY_MODE(mode) (U.autokey_mode == AUTOKEY_MODE_##mode)
#define IS_AUTOKEY_FLAG(flag) (U.autokey_flag == AUTOKEY_FLAG_##flag)

View File

@@ -524,13 +524,18 @@ void time_buttons(ScrArea *sa)
xco, 0, XIC, YIC, 0, 0, 0, 0, 0, "Skip to End frame (Shift UpArrow)");
xco+= XIC+8;
// FIXME: give this icons (and maybe make it XIC wide again) - it used to use the "ICON_REC" (red dot)
uiDefButS(block, MENU, REDRAWINFO,
"Auto-Keying Mode %t|No Auto-Keying %x0|Add/Replace Keys%x1|Replace Keys %x2",
xco, 0, 4*XIC, YIC, &(U.autokey_mode), 0, 1, 0, 0,
"Automatic keyframe insertion for Objects and Bones");
uiDefIconButBitS(block, TOG, AUTOKEY_ON, REDRAWINFO, ICON_REC,
xco, 0, XIC, YIC, &(U.autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
xco+= XIC;
if (IS_AUTOKEY_ON) {
uiDefButS(block, MENU, REDRAWINFO,
"Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5",
xco, 0, 3*XIC, YIC, &(U.autokey_mode), 0, 1, 0, 0,
"Mode of automatic keyframe insertion for Objects and Bones");
xco+= (4*XIC);
}
xco+= (4*XIC)+16;
xco+= 16;
uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER,
xco, 0, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor");

View File

@@ -3668,26 +3668,35 @@ void drawinfospace(ScrArea *sa, void *spacedata)
uiDefBut(block, LABEL,0,"Auto Keyframe",
(xpos+(2*edgsp)+(2*mpref)+midsp),y5label,mpref,buth,
(xpos+(2*edgsp)+(2*mpref)+midsp),y6label,mpref,buth,
0, 0, 0, 0, 0, "");
uiDefButS(block, MENU, REDRAWTIME,
"Auto-Keying Mode %t|No Auto-Keying %x0|Add/Replace Keys%x1|Replace Keys %x2",
(xpos+edgsp+(2*mpref)+(2*midsp)),y4,mpref, buth,
&(U.autokey_mode), 0, 1, 0, 0,
"Automatic keyframe insertion for Objects and Bones");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, AUTOKEY_ON, REDRAWTIME, "Auto-Keying Enabled",
(xpos+edgsp+(2*mpref)+(2*midsp)),y5,mpref, buth,
&(U.autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones");
if (IS_AUTOKEY_ON) {
uiDefButS(block, MENU, REDRAWTIME,
"Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5",
(xpos+edgsp+(2*mpref)+(2*midsp)),y4,mpref, buth,
&(U.autokey_mode), 0, 1, 0, 0,
"Mode of automatic keyframe insertion for Objects and Bones");
}
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, AUTOKEY_FLAG_INSERTAVAIL, REDRAWTIME, "Available",
(xpos+edgsp+(2*mpref)+(2*midsp)),y3,mpref, buth,
&(U.autokey_flag), 0, 0, 0, 0, "Automatic keyframe insertion in available curves");
uiDefButBitS(block, TOG, AUTOKEY_FLAG_INSERTNEEDED, REDRAWTIME, "Needed",
(xpos+edgsp+(2*mpref)+(2*midsp)),y2,mpref, buth,
&(U.autokey_flag), 0, 0, 0, 0, "Automatic keyframe insertion only when keyframe needed");
uiDefButBitS(block, TOG, AUTOKEY_FLAG_AUTOMATKEY, REDRAWTIME, "Use Visual Keying",
(xpos+edgsp+(2*mpref)+(2*midsp)),y1,mpref, buth,
&(U.autokey_flag), 0, 0, 0, 0, "Use Visual keying automatically for constrained objects");
uiDefButBitS(block, TOG, AUTOKEY_FLAG_INSERTAVAIL, REDRAWTIME, "Available",
(xpos+edgsp+(2*mpref)+(2*midsp)),y3,mpref, buth,
&(U.autokey_flag), 0, 0, 0, 0, "Automatic keyframe insertion in available curves");
uiDefButBitS(block, TOG, AUTOKEY_FLAG_INSERTNEEDED, REDRAWTIME, "Needed",
(xpos+edgsp+(2*mpref)+(2*midsp)),y2,mpref, buth,
&(U.autokey_flag), 0, 0, 0, 0, "Automatic keyframe insertion only when keyframe needed");
uiDefButBitS(block, TOG, AUTOKEY_FLAG_AUTOMATKEY, REDRAWTIME, "Use Visual Keying",
(xpos+edgsp+(2*mpref)+(2*midsp)),y1,mpref, buth,
&(U.autokey_flag), 0, 0, 0, 0, "Use Visual keying automatically for constrained objects");
uiBlockEndAlign(block);

View File

@@ -2967,7 +2967,7 @@ short autokeyframe_cfra_can_key(Object *ob)
short found= 0;
/* only filter if auto-key mode requires this */
if (IS_AUTOKEY_MODE(OFF))
if (IS_AUTOKEY_ON == 0)
return 0;
else if (IS_AUTOKEY_MODE(NORMAL))
return 1;

View File

@@ -197,6 +197,16 @@ static void init_userdef_file(void)
if(U.flag & USER_CUSTOM_RANGE)
vDM_ColorBand_store(&U.coba_weight); /* signal for derivedmesh to use colorband */
/* Auto-keyframing settings */
if(U.autokey_mode == 0) {
/* AUTOKEY_MODE_NORMAL - AUTOKEY_ON = x <==> 3 - 1 = 2 */
U.autokey_mode |= 2;
if(U.flag & (1<<15)) U.autokey_flag |= AUTOKEY_FLAG_INSERTAVAIL;
if(U.flag & (1<<19)) U.autokey_flag |= AUTOKEY_FLAG_INSERTNEEDED;
if(G.flags & (1<<30)) U.autokey_flag |= AUTOKEY_FLAG_AUTOMATKEY;
}
if (G.main->versionfile <= 191) {
strcpy(U.plugtexdir, U.textudir);
strcpy(U.sounddir, "/");