NLA Strip Keyframes: Insert keyframe tools in Anim Editors work now

* Insert Keyframe tool for Dopesheet/Graph Editors needed to be modified to
  not try to resolve the paths for NLA Control Curves
* For now, the poll callback to get the "Active FCurve" also works when given
  a NLA control curve. They're really the same in most cases, and this should
  be fine until one of the channels does something funky.
This commit is contained in:
Joshua Leung 2015-03-29 02:20:57 +13:00
parent 0ffd7f721e
commit 0c5d0422b4
3 changed files with 25 additions and 10 deletions

View File

@ -1082,8 +1082,13 @@ static void insert_action_keys(bAnimContext *ac, short mode)
else
cfra = (float)CFRA;
/* if there's an id */
if (ale->id)
/* read value from property the F-Curve represents, or from the curve only?
* - ale->id != NULL: Typically, this means that we have enough info to try resolving the path
* - ale->owner != NULL: If this is set, then the path may not be resolvable from the ID alone,
* so it's easier for now to just read the F-Curve directly.
* (TODO: add the full-blown PointerRNA relative parsing case here...)
*/
if (ale->id && !ale->owner)
insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
else
insert_vert_fcurve(fcu, cfra, fcu->curval, 0);

View File

@ -498,12 +498,17 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
else
cfra = (float)CFRA;
/* if there's an id */
if (ale->id)
/* read value from property the F-Curve represents, or from the curve only?
* - ale->id != NULL: Typically, this means that we have enough info to try resolving the path
* - ale->owner != NULL: If this is set, then the path may not be resolvable from the ID alone,
* so it's easier for now to just read the F-Curve directly.
* (TODO: add the full-blown PointerRNA relative parsing case here...)
*/
if (ale->id && !ale->owner)
insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
else
insert_vert_fcurve(fcu, cfra, fcu->curval, 0);
ale->update |= ANIM_UPDATE_DEFAULT;
}
@ -596,12 +601,12 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
/* insert keyframe on the specified frame + value */
insert_vert_fcurve(fcu, frame, val, 0);
ale->update |= ANIM_UPDATE_DEPS;
BLI_listbase_clear(&anim_data);
BLI_addtail(&anim_data, ale);
ANIM_animdata_update(&ac, &anim_data);
}
else {

View File

@ -210,13 +210,18 @@ int graphop_active_fcurve_poll(bContext *C)
if (ale == NULL)
return 0;
/* free temp data... */
has_fcurve = ((ale->data) && (ale->type == ANIMTYPE_FCURVE));
/* do we have a suitable F-Curves?
* - For most cases, NLA Control Curves are sufficiently similar to NLA curves to serve this role too.
* Under the hood, they are F-Curves too. The only problems which will arise here are if these need to be
* in an Action too (but drivers would then also be affected!)
*/
has_fcurve = ((ale->data) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE));
if (has_fcurve) {
FCurve *fcu = (FCurve *)ale->data;
has_fcurve = (fcu->flag & FCURVE_VISIBLE) != 0;
}
/* free temp data... */
MEM_freeN(ale);
/* return success */