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>2015-10-26 10:13:29 +0300
committerJoshua Leung <aligorith@gmail.com>2015-10-26 10:18:12 +0300
commit1b286352a31c5a1320c5b481a2edc694b9b80338 (patch)
treef3554727d15131673e57703487cfb398f1ecbc39 /source/blender/editors/animation/keyframes_edit.c
parentb3edd7bdcdbb67abef6436244bb23ec3ef890869 (diff)
Graph Editor: Snap and Mirror keyframes now respect Cursor X in Drivers mode
When using the "Current Frame" options for these operators, the Cursor X value will now be used instead of the current frame. Perhaps the labels could be changed too, but for now, I guess this will be good enough.
Diffstat (limited to 'source/blender/editors/animation/keyframes_edit.c')
-rw-r--r--source/blender/editors/animation/keyframes_edit.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index bd34f32dda8..dd01e53d099 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -714,6 +714,14 @@ static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *be
return 0;
}
+/* frame to snap to is stored in the custom data -> first float value slot */
+static short snap_bezier_time(KeyframeEditData *ked, BezTriple *bezt)
+{
+ if (bezt->f2 & SELECT)
+ bezt->vec[1][0] = ked->f1;
+ return 0;
+}
+
/* value to snap to is stored in the custom data -> first float value slot */
static short snap_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
{
@@ -736,6 +744,8 @@ KeyframeEditFunc ANIM_editkeyframes_snap(short type)
return snap_bezier_nearestsec;
case SNAP_KEYS_HORIZONTAL: /* snap handles to same value */
return snap_bezier_horizontal;
+ case SNAP_KEYS_TIME: /* snap to given frame/time */
+ return snap_bezier_time;
case SNAP_KEYS_VALUE: /* snap to given value */
return snap_bezier_value;
default: /* just in case */
@@ -812,6 +822,16 @@ static short mirror_bezier_marker(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
+static short mirror_bezier_time(KeyframeEditData *ked, BezTriple *bezt)
+{
+ /* value to mirror over is strored in f1 */
+ if (bezt->f2 & SELECT) {
+ mirror_bezier_xaxis_ex(bezt, ked->f1);
+ }
+
+ return 0;
+}
+
static short mirror_bezier_value(KeyframeEditData *ked, BezTriple *bezt)
{
/* value to mirror over is stored in the custom data -> first float value slot */
@@ -835,6 +855,8 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
return mirror_bezier_xaxis;
case MIRROR_KEYS_MARKER: /* mirror over marker */
return mirror_bezier_marker;
+ case MIRROR_KEYS_TIME: /* mirror over frame/time */
+ return mirror_bezier_time;
case MIRROR_KEYS_VALUE: /* mirror over given value */
return mirror_bezier_value;
default: /* just in case */