Inserting keyframes for properties that don't already have F-Curves shouldn't occur if auto keyframing is set to 'replace' only (i.e. see timeline -> frame -> autokey mode menu for details).
This commit is contained in:
Joshua Leung 2010-02-12 01:06:18 +00:00
parent 6b01ab5e23
commit 61d7e4a51e
3 changed files with 19 additions and 30 deletions

@ -130,7 +130,6 @@ class TIME_MT_frame(bpy.types.Menu):
layout.separator()
sub = layout.row()
#sub.active = tools.enable_auto_key
sub.menu("TIME_MT_autokey")
@ -165,8 +164,6 @@ class TIME_MT_autokey(bpy.types.Menu):
layout = self.layout
tools = context.tool_settings
layout.active = tools.enable_auto_key
layout.prop_enum(tools, "autokey_mode", 'ADD_REPLACE_KEYS')
layout.prop_enum(tools, "autokey_mode", 'REPLACE_KEYS')

@ -222,10 +222,12 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
{
int i= 0;
/* are there already keyframes? */
if (fcu->bezt) {
short replace = -1;
i = binarysearch_bezt_index(fcu->bezt, bezt->vec[1][0], fcu->totvert, &replace);
/* replace an existing keyframe? */
if (replace) {
/* sanity check: 'i' may in rare cases exceed arraylen */
if ((i >= 0) && (i < fcu->totvert)) {
@ -252,6 +254,7 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
}
}
}
/* keyframing modes allow to not replace keyframe */
else if ((flag & INSERTKEY_REPLACE) == 0) {
/* insert new - if we're not restricted to replacing keyframes only */
BezTriple *newb= MEM_callocN((fcu->totvert+1)*sizeof(BezTriple), "beztriple");
@ -270,16 +273,27 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
/* replace (+ free) old with new, only if necessary to do so */
MEM_freeN(fcu->bezt);
fcu->bezt= newb;
fcu->totvert++;
}
}
else {
// TODO: need to check for old sample-data now...
/* no keyframes already, but can only add if...
* 1) keyframing modes say that keyframes can only be replaced, so adding new ones won't know
* 2) there are no samples on the curve
* // NOTE: maybe we may want to allow this later when doing samples -> bezt conversions,
* // but for now, having both is asking for trouble
*/
else if ((flag & INSERTKEY_REPLACE)==0 && (fcu->fpt==NULL)) {
/* create new keyframes array */
fcu->bezt= MEM_callocN(sizeof(BezTriple), "beztriple");
*(fcu->bezt)= *bezt;
fcu->totvert= 1;
}
/* cannot add anything */
else {
/* return error code -1 to prevent any misunderstandings */
return -1;
}
/* we need to return the index, so that some tools which do post-processing can

@ -791,34 +791,12 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
static Sequence *dupli_seq(struct Scene *scene, Sequence *seq)
{
Sequence *seqn = MEM_dupallocN(seq);
// XXX animato: ID *id;
seq->tmp = seqn;
seqn->strip= MEM_dupallocN(seq->strip);
// XXX animato
#if 0
if (seqn->ipo) {
if (U.dupflag & USER_DUP_IPO) {
id= (ID *)seqn->ipo;
seqn->ipo= copy_ipo(seqn->ipo);
/* we don't need to decrease the number
* of the ipo because we never increase it,
* for example, adduplicate need decrease
* the number but only because copy_object
* call id_us_plus for the ipo block and
* single_ipo_users only work if id->us > 1.
*
* need call ipo_idnew here, for drivers ??
* - Diego
*/
}
else
seqn->ipo->id.us++;
}
#endif
// XXX: add F-Curve duplication stuff?
seqn->strip->tstripdata = 0;
seqn->strip->tstripdata_startstill = 0;
seqn->strip->tstripdata_endstill = 0;