Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2020-10-28 13:45:24 +0300
committerSebastian Parborg <darkdefende@gmail.com>2020-10-28 13:45:24 +0300
commitfb88d4eda8a807e79ecb100e82ac930250d871db (patch)
treeb18023b5af1b8c0c728309a97ae53a8dee0d3c35 /source/blender/makesrna/intern/rna_fcurve_api.c
parent2f7c6149fce00993e7c2c45ab071a7e8b5588f92 (diff)
Add a Un-Bake FCurves operator
We already had the ability to bake fcurves but no way to convert the baked result back without using python. This patch adds and operator that is available now next to the bake operator in the drop down menu, Reviewed By: Sybren Differential Revision: http://developer.blender.org/D6379
Diffstat (limited to 'source/blender/makesrna/intern/rna_fcurve_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve_api.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c
index f7be65b4e75..5a720b91f87 100644
--- a/source/blender/makesrna/intern/rna_fcurve_api.c
+++ b/source/blender/makesrna/intern/rna_fcurve_api.c
@@ -76,52 +76,7 @@ static void rna_FCurve_convert_to_keyframes(FCurve *fcu, ReportList *reports, in
BKE_report(reports, RPT_WARNING, "FCurve has no sample points");
}
else {
- BezTriple *bezt;
- FPoint *fpt = fcu->fpt;
- int tot_kf = end - start;
- int tot_sp = fcu->totvert;
-
- bezt = fcu->bezt = MEM_callocN(sizeof(*fcu->bezt) * (size_t)tot_kf, __func__);
- fcu->totvert = tot_kf;
-
- /* Get first sample point to 'copy' as keyframe. */
- for (; tot_sp && (fpt->vec[0] < (float)start); fpt++, tot_sp--) {
- /* pass */
- }
-
- /* Add heading dummy flat points if needed. */
- for (; tot_kf && (fpt->vec[0] > (float)start); start++, bezt++, tot_kf--) {
- /* Linear interpolation, of course. */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_LIN;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- bezt->vec[1][0] = (float)start;
- bezt->vec[1][1] = fpt->vec[1];
- }
-
- /* Copy actual sample points. */
- for (; tot_kf && tot_sp; start++, bezt++, tot_kf--, fpt++, tot_sp--) {
- /* Linear interpolation, of course. */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_LIN;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- copy_v2_v2(bezt->vec[1], fpt->vec);
- }
-
- /* Add leading dummy flat points if needed. */
- for (fpt--; tot_kf; start++, bezt++, tot_kf--) {
- /* Linear interpolation, of course. */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_LIN;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- bezt->vec[1][0] = (float)start;
- bezt->vec[1][1] = fpt->vec[1];
- }
-
- MEM_SAFE_FREE(fcu->fpt);
-
- /* Not strictly needed since we use linear interpolation, but better be consistent here. */
- calchandles_fcurve(fcu);
+ fcurve_samples_to_keyframes(fcu, start, end);
WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
}