Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/anim_sys.c
| Show First 20 Lines • Show All 2,959 Lines • ▼ Show 20 Lines | |||||
| /* evaluate action-clip strip */ | /* evaluate action-clip strip */ | ||||
| static void nlastrip_evaluate_actionclip(PointerRNA *ptr, | static void nlastrip_evaluate_actionclip(PointerRNA *ptr, | ||||
| NlaEvalData *channels, | NlaEvalData *channels, | ||||
| ListBase *modifiers, | ListBase *modifiers, | ||||
| NlaEvalStrip *nes, | NlaEvalStrip *nes, | ||||
| NlaEvalSnapshot *snapshot) | NlaEvalSnapshot *snapshot) | ||||
| { | { | ||||
| FModifierStackStorage *storage; | |||||
| ListBase tmp_modifiers = {NULL, NULL}; | ListBase tmp_modifiers = {NULL, NULL}; | ||||
| NlaStrip *strip = nes->strip; | NlaStrip *strip = nes->strip; | ||||
| FCurve *fcu; | FCurve *fcu; | ||||
| float evaltime; | float evaltime; | ||||
| /* sanity checks for action */ | /* sanity checks for action */ | ||||
| if (strip == NULL) | if (strip == NULL) | ||||
| return; | return; | ||||
| if (strip->act == NULL) { | if (strip->act == NULL) { | ||||
| CLOG_ERROR(&LOG, "NLA-Strip Eval Error: Strip '%s' has no Action", strip->name); | CLOG_ERROR(&LOG, "NLA-Strip Eval Error: Strip '%s' has no Action", strip->name); | ||||
| return; | return; | ||||
| } | } | ||||
| action_idcode_patch_check(ptr->id.data, strip->act); | action_idcode_patch_check(ptr->id.data, strip->act); | ||||
| /* join this strip's modifiers to the parent's modifiers (own modifiers first) */ | /* join this strip's modifiers to the parent's modifiers (own modifiers first) */ | ||||
| nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers); | nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers); | ||||
| /* evaluate strip's modifiers which modify time to evaluate the base curves at */ | /* evaluate strip's modifiers which modify time to evaluate the base curves at */ | ||||
| storage = evaluate_fmodifiers_storage_new(&tmp_modifiers); | FModifiersStackStorage storage; | ||||
| evaltime = evaluate_time_fmodifiers(storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time); | storage.modifier_count = BLI_listbase_count(&tmp_modifiers); | ||||
| storage.size_per_modifier = evaluate_fmodifiers_storage_size_per_modifier(&tmp_modifiers); | |||||
| storage.buffer = alloca(storage.modifier_count * storage.size_per_modifier); | |||||
angavrilov: <add blank line here> | |||||
| evaltime = evaluate_time_fmodifiers(&storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time); | |||||
| NlaBlendData blend = { | NlaBlendData blend = { | ||||
| .snapshot = snapshot, | .snapshot = snapshot, | ||||
| .mode = strip->blendmode, | .mode = strip->blendmode, | ||||
| .influence = strip->influence, | .influence = strip->influence, | ||||
| }; | }; | ||||
| /* evaluate all the F-Curves in the action, saving the relevant pointers to data that will need to be used */ | /* evaluate all the F-Curves in the action, saving the relevant pointers to data that will need to be used */ | ||||
| Show All 9 Lines | for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) { | ||||
| /* evaluate the F-Curve's value for the time given in the strip | /* evaluate the F-Curve's value for the time given in the strip | ||||
| * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this | * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this | ||||
| */ | */ | ||||
| value = evaluate_fcurve(fcu, evaltime); | value = evaluate_fcurve(fcu, evaltime); | ||||
| /* apply strip's F-Curve Modifiers on this value | /* apply strip's F-Curve Modifiers on this value | ||||
| * NOTE: we apply the strip's original evaluation time not the modified one (as per standard F-Curve eval) | * NOTE: we apply the strip's original evaluation time not the modified one (as per standard F-Curve eval) | ||||
| */ | */ | ||||
| evaluate_value_fmodifiers(storage, &tmp_modifiers, fcu, &value, strip->strip_time); | evaluate_value_fmodifiers(&storage, &tmp_modifiers, fcu, &value, strip->strip_time); | ||||
| /* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s) | /* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s) | ||||
| * stored in this channel if it has been used already | * stored in this channel if it has been used already | ||||
| */ | */ | ||||
| NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path); | NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path); | ||||
| nlaeval_blend_value(&blend, nec, fcu->array_index, value); | nlaeval_blend_value(&blend, nec, fcu->array_index, value); | ||||
| } | } | ||||
| nlaeval_blend_flush(&blend); | nlaeval_blend_flush(&blend); | ||||
| /* free temporary storage */ | |||||
| evaluate_fmodifiers_storage_free(storage); | |||||
| /* unlink this strip's modifiers from the parent's modifiers again */ | /* unlink this strip's modifiers from the parent's modifiers again */ | ||||
| nlaeval_fmodifiers_split_stacks(&strip->modifiers, modifiers); | nlaeval_fmodifiers_split_stacks(&strip->modifiers, modifiers); | ||||
| } | } | ||||
| /* evaluate transition strip */ | /* evaluate transition strip */ | ||||
| static void nlastrip_evaluate_transition(Depsgraph *depsgraph, | static void nlastrip_evaluate_transition(Depsgraph *depsgraph, | ||||
| PointerRNA *ptr, | PointerRNA *ptr, | ||||
| NlaEvalData *channels, | NlaEvalData *channels, | ||||
| ▲ Show 20 Lines • Show All 970 Lines • Show Last 20 Lines | |||||
<add blank line here>