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:
authorJoshua Leung <aligorith@gmail.com>2009-12-22 13:14:13 +0300
committerJoshua Leung <aligorith@gmail.com>2009-12-22 13:14:13 +0300
commit5a3ac3ceeb0d3550c14987f5cfd607e1ad126e64 (patch)
treea8745cb5bf1ad23a1702993f964a96ddf64092a3 /source/blender/editors/animation/keyframes_edit.c
parente207d045322db4656f42f68ae9fa092ac1478635 (diff)
Assorted F-Curve/Keyframe API stuff (for use with some Sequencer editing):
* Added function for F-Curves to find the F-Curves in a given list which affect some named data, such as bones, nodes, or sequence strips. * Added a BezTriple offsetting callback to be used with the F-Curve+Keyframe loopers in use for many of the keyframe editing tools.
Diffstat (limited to 'source/blender/editors/animation/keyframes_edit.c')
-rw-r--r--source/blender/editors/animation/keyframes_edit.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 83acfbee940..9476aa479a7 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -559,6 +559,22 @@ short bezt_to_cfraelem(BeztEditData *bed, BezTriple *bezt)
return 0;
}
+/* used to remap times from one range to another
+ * requires: bed->data = BeztEditCD_Remap
+ */
+short bezt_remap_times(BeztEditData *bed, BezTriple *bezt)
+{
+ BeztEditCD_Remap *rmap= (BeztEditCD_Remap*)bed->data;
+ const float scale = (rmap->newMax - rmap->newMin) / (rmap->oldMax - rmap->oldMin);
+
+ /* perform transform on all three handles unless indicated otherwise */
+ // TODO: need to include some checks for that
+
+ bezt->vec[0][0]= scale*(bezt->vec[0][0] - rmap->oldMin) + rmap->newMin;
+ bezt->vec[1][0]= scale*(bezt->vec[1][0] - rmap->oldMin) + rmap->newMin;
+ bezt->vec[2][0]= scale*(bezt->vec[2][0] - rmap->oldMin) + rmap->newMin;
+}
+
/* ******************************************* */
/* Transform */