1
1

2.5 - Assorted Bugfixes for Animation Editing

* Inserting keyframes now takes into account whether the F-Curve was editable or not.

* Editing keyframes in animation editors now sends proper depsgraph updates instead of just tagging the relevant objects. 

Thanks JiriH for reporting these bugs.
This commit is contained in:
2009-08-25 00:12:11 +00:00
parent 8ed64f7854
commit 4a78b9e904
3 changed files with 26 additions and 10 deletions

View File

@@ -740,6 +740,12 @@ short insert_keyframe_direct (PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, fl
printf("ERROR: no F-Curve to add keyframes to \n");
return 0;
}
/* F-Curve not editable? */
if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ) {
if (G.f & G_DEBUG)
printf("WARNING: not inserting keyframe for locked F-Curve \n");
return 0;
}
/* if no property given yet, try to validate from F-Curve info */
if ((ptr.id.data == NULL) && (ptr.data==NULL)) {
@@ -911,8 +917,19 @@ short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_
/* we don't check the validity of the path here yet, but it should be ok... */
fcu= verify_fcurve(act, group, rna_path, array_index, 0);
/* only continue if we have an F-Curve to remove keyframes from */
if (act && fcu) {
/* check if F-Curve exists and/or whether it can be edited */
if ELEM(NULL, act, fcu) {
printf("ERROR: no F-Curve and/or Action to delete keyframe from \n");
return 0;
}
if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ) {
if (G.f & G_DEBUG)
printf("WARNING: not inserting keyframe for locked F-Curve \n");
return 0;
}
/* it should be fine to continue now... */
{
short found = -1;
int i;

View File

@@ -404,13 +404,13 @@ void action_header_buttons(const bContext *C, ARegion *ar)
if (saction->flag & SACTION_DRAWTIME) {
uiDefButC(block, MENU, B_REDR,
"Auto-Snap Keyframes %t|No Snap %x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3",
xco,yco,70,YIC, &(saction->autosnap), 0, 1, 0, 0,
xco,yco,90,YIC, &(saction->autosnap), 0, 1, 0, 0,
"Auto-snapping mode for keyframes when transforming");
}
else {
uiDefButC(block, MENU, B_REDR,
"Auto-Snap Keyframes %t|No Snap %x0|Frame Step %x1|Nearest Frame %x2|Nearest Marker %x3",
xco,yco,70,YIC, &(saction->autosnap), 0, 1, 0, 0,
xco,yco,90,YIC, &(saction->autosnap), 0, 1, 0, 0,
"Auto-snapping mode for keyframes when transforming");
}

View File

@@ -269,7 +269,7 @@ static void editmesh_apply_to_mirror(TransInfo *t)
/* tags the given ID block for refreshes (if applicable) due to
* Animation Editor editing
*/
static void animedit_refresh_id_tags (ID *id)
static void animedit_refresh_id_tags (Scene *scene, ID *id)
{
if (id) {
AnimData *adt= BKE_animdata_from_id(id);
@@ -279,12 +279,11 @@ static void animedit_refresh_id_tags (ID *id)
adt->recalc |= ADT_RECALC_ANIM;
/* if ID-block is Object, set recalc flags */
// TODO: this should probably go through the depsgraph instead... but for now, let's be lazy
switch (GS(id->name)) {
case ID_OB:
{
Object *ob= (Object *)id;
ob->recalc |= OB_RECALC;
DAG_object_flush_update(scene, ob, OB_RECALC_DATA); /* sets recalc flags */
}
break;
}
@@ -384,7 +383,7 @@ void recalcData(TransInfo *t)
/* just tag these animdata-blocks to recalc, assuming that some data there changed */
for (ale= anim_data.first; ale; ale= ale->next) {
/* set refresh tags for objects using this animation */
animedit_refresh_id_tags(ale->id);
animedit_refresh_id_tags(t->scene, ale->id);
}
/* now free temp channels */
@@ -432,7 +431,7 @@ void recalcData(TransInfo *t)
calchandles_fcurve(fcu);
/* set refresh tags for objects using this animation */
animedit_refresh_id_tags(ale->id);
animedit_refresh_id_tags(t->scene, ale->id);
}
/* do resort and other updates? */
@@ -463,7 +462,7 @@ void recalcData(TransInfo *t)
continue;
/* set refresh tags for objects using this animation */
animedit_refresh_id_tags(tdn->id);
animedit_refresh_id_tags(t->scene, tdn->id);
/* if cancelling transform, just write the values without validating, then move on */
if (t->state == TRANS_CANCEL) {