forked from bartvdbraak/blender
Fix T45864: Wrong NLA Control Curves keyed when using the Graph Editor sliders
This commit simplifies the logic for finding the control curves for NLA strips, thus eliminating a whole bunch of weird errors that were happening here. It should also fix a number of other related issues here.
This commit is contained in:
parent
09b7ec1864
commit
b617dec065
@ -332,10 +332,23 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *pro
|
|||||||
|
|
||||||
if (action) *action = NULL;
|
if (action) *action = NULL;
|
||||||
|
|
||||||
|
/* Special case for NLA Control Curves... */
|
||||||
|
if (ptr->type == &RNA_NlaStrip) {
|
||||||
|
NlaStrip *strip = (NlaStrip *)ptr->data;
|
||||||
|
|
||||||
|
/* Set the special flag, since it cannot be a normal action/driver
|
||||||
|
* if we've been told to start looking here...
|
||||||
|
*/
|
||||||
|
*r_special = true;
|
||||||
|
|
||||||
|
/* The F-Curve either exists or it doesn't here... */
|
||||||
|
fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), rnaindex);
|
||||||
|
return fcu;
|
||||||
|
}
|
||||||
|
|
||||||
/* there must be some RNA-pointer + property combon */
|
/* there must be some RNA-pointer + property combon */
|
||||||
if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) {
|
if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) {
|
||||||
AnimData *adt = BKE_animdata_from_id(tptr.id.data);
|
AnimData *adt = BKE_animdata_from_id(tptr.id.data);
|
||||||
AnimData *adt_initial = adt;
|
|
||||||
int step = C ? 2 : 1; /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */
|
int step = C ? 2 : 1; /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
|
||||||
@ -345,6 +358,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *pro
|
|||||||
step--;
|
step--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Standard F-Curve - Animation (Action) or Drivers */
|
||||||
while (adt && step--) {
|
while (adt && step--) {
|
||||||
if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
|
if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
|
||||||
/* XXX this function call can become a performance bottleneck */
|
/* XXX this function call can become a performance bottleneck */
|
||||||
@ -390,36 +404,6 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *pro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we still haven't found anything, check whether it's a "special" property */
|
|
||||||
/* NOTE: Need to go back to the original AnimData (vs one further up the chain,
|
|
||||||
* that we'd get after the loop above failed), or else this check will not
|
|
||||||
* work for Materials
|
|
||||||
*/
|
|
||||||
if ((fcu == NULL) && (adt_initial && adt_initial->nla_tracks.first)) {
|
|
||||||
NlaTrack *nlt;
|
|
||||||
const char *propname = RNA_property_identifier(prop);
|
|
||||||
|
|
||||||
for (nlt = adt_initial->nla_tracks.first; nlt; nlt = nlt->next) {
|
|
||||||
NlaStrip *strip;
|
|
||||||
|
|
||||||
if (fcu)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* FIXME: need to do recursive search here for correctness,
|
|
||||||
* but this will do for most use cases (i.e. interactive editing),
|
|
||||||
* where nested strips can't be easily edited
|
|
||||||
*/
|
|
||||||
for (strip = nlt->strips.first; strip; strip = strip->next) {
|
|
||||||
fcu = list_find_fcurve(&strip->fcurves, propname, rnaindex);
|
|
||||||
|
|
||||||
if (fcu) {
|
|
||||||
*r_special = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
MEM_SAFE_FREE(path);
|
MEM_SAFE_FREE(path);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user