Fix T36385: Animated Strip-Time doesnt update

This commit implements proper evaluation + keyframing support for animating influence
and time on NLA Strips (among other properties) by resolving a few long standing issues
which prevented the original design for this from working.

The original design for animating these properties (and/or some of the other settings
on NLA Strips) is that NLA Strips actually have some of their own F-Curves that are
used for animating settings which will affect how they are evaluated. As seen in this
bug report, the alternative of having these animated as part of the stack (which the
strips work above/outside/on-top of) means that glitches can occur.

Although one of the original considerations for why this wasn't implemented earlier
was that introducing keyframes there isn't so clean cut, and causes UI design issues
for how we expose these via the animation editors for editing (NOTE: support for that
is still to come). Another concern is that this sets a precedent for how FModifiers
might get evaluated.
This commit is contained in:
Joshua Leung 2014-01-24 15:48:36 +13:00
parent 1a5c5ac742
commit 2b4ff142ab
Notes: blender-bot 2023-02-14 11:57:27 +01:00
Referenced by issue #37551, NLA Editor RNA Path Bug
Referenced by issue #36385, Animated Strip-Time doesnt update
2 changed files with 32 additions and 23 deletions

View File

@ -1496,8 +1496,11 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_ind
/* get property to write to */
if (RNA_path_resolve_property(ptr, path, &new_ptr, &prop)) {
/* set value - only for animatable numerical values */
if (RNA_property_animateable(&new_ptr, prop)) {
/* set value for animatable numerical values only
* HACK: some local F-Curves (e.g. those on NLA Strips) are evaluated
* without an ID provided, which causes the animateable test to fail!
*/
if (RNA_property_animateable(&new_ptr, prop) || (ptr->id.data == NULL)) {
int array_len = RNA_property_array_length(&new_ptr, prop);
bool written = false;

View File

@ -1707,33 +1707,39 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) {
path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
if (all) {
length = RNA_property_array_length(&ptr, prop);
if (length) index = 0;
else length = 1;
}
else
length = 1;
for (a = 0; a < length; a++)
success += insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, cfra, flag);
MEM_freeN(path);
}
else if (ptr.type == &RNA_NlaStrip) {
/* handle special vars for NLA-strips */
if (ptr.type == &RNA_NlaStrip) {
/* Handle special properties for NLA Strips, whose F-Curves are stored on the
* strips themselves. These are stored separately or else the properties will
* not have any effect.
*/
NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), flag);
success += insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0);
}
else {
BKE_report(op->reports, RPT_WARNING,
"Failed to resolve path to property, try manually specifying this using a Keying Set instead");
/* standard properties */
path = RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
if (all) {
length = RNA_property_array_length(&ptr, prop);
if (length) index = 0;
else length = 1;
}
else
length = 1;
for (a = 0; a < length; a++)
success += insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, cfra, flag);
MEM_freeN(path);
}
else {
BKE_report(op->reports, RPT_WARNING,
"Failed to resolve path to property, try manually specifying this using a Keying Set instead");
}
}
}
else {