Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_action/action_edit.c
| Show First 20 Lines • Show All 718 Lines • ▼ Show 20 Lines | static void insert_action_keys(bAnimContext *ac, short mode) | ||||
| } | } | ||||
| ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); | ||||
| /* Init keyframing flag. */ | /* Init keyframing flag. */ | ||||
| flag = ANIM_get_keyframing_flags(scene, true); | flag = ANIM_get_keyframing_flags(scene, true); | ||||
| /* insert keyframes */ | /* insert keyframes */ | ||||
| const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context(ac->depsgraph, | |||||
| (float)CFRA); | |||||
| for (ale = anim_data.first; ale; ale = ale->next) { | for (ale = anim_data.first; ale; ale = ale->next) { | ||||
| FCurve *fcu = (FCurve *)ale->key_data; | FCurve *fcu = (FCurve *)ale->key_data; | ||||
| float cfra = (float)CFRA; | |||||
| /* Read value from property the F-Curve represents, or from the curve only? | /* Read value from property the F-Curve represents, or from the curve only? | ||||
| * - ale->id != NULL: | * - ale->id != NULL: | ||||
| * Typically, this means that we have enough info to try resolving the path. | * Typically, this means that we have enough info to try resolving the path. | ||||
| * | * | ||||
| * - ale->owner != NULL: | * - ale->owner != NULL: | ||||
| * If this is set, then the path may not be resolvable from the ID alone, | * 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. | * so it's easier for now to just read the F-Curve directly. | ||||
| * (TODO: add the full-blown PointerRNA relative parsing case here...) | * (TODO: add the full-blown PointerRNA relative parsing case here...) | ||||
| */ | */ | ||||
| if (ale->id && !ale->owner) { | if (ale->id && !ale->owner) { | ||||
| insert_keyframe(ac->bmain, | insert_keyframe(ac->bmain, | ||||
| reports, | reports, | ||||
| ale->id, | ale->id, | ||||
| NULL, | NULL, | ||||
| ((fcu->grp) ? (fcu->grp->name) : (NULL)), | ((fcu->grp) ? (fcu->grp->name) : (NULL)), | ||||
| fcu->rna_path, | fcu->rna_path, | ||||
| fcu->array_index, | fcu->array_index, | ||||
| cfra, | &anim_eval_context, | ||||
| ts->keyframe_type, | ts->keyframe_type, | ||||
| &nla_cache, | &nla_cache, | ||||
| flag); | flag); | ||||
| } | } | ||||
| else { | else { | ||||
| AnimData *adt = ANIM_nla_mapping_get(ac, ale); | AnimData *adt = ANIM_nla_mapping_get(ac, ale); | ||||
| /* adjust current frame for NLA-scaling */ | /* adjust current frame for NLA-scaling */ | ||||
| float cfra = anim_eval_context.eval_time; | |||||
| if (adt) { | if (adt) { | ||||
| cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); | cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); | ||||
| } | } | ||||
| const float curval = evaluate_fcurve(fcu, cfra); | const float curval = evaluate_fcurve(fcu, cfra); | ||||
| insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0); | insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0); | ||||
| } | } | ||||
| ale->update |= ANIM_UPDATE_DEFAULT; | ale->update |= ANIM_UPDATE_DEFAULT; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,180 Lines • Show Last 20 Lines | |||||