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>2007-10-22 09:32:17 +0400
committerJoshua Leung <aligorith@gmail.com>2007-10-22 09:32:17 +0400
commit2cc41ad890326679b47c9931708d3afc3dae300f (patch)
treed60c5ab96c6c6c50a039b8d8b92a877a164723e6 /source/blender/src/transform.c
parentf721ce13fb529f4fde4668c989c786e4c7d7d708 (diff)
== Action/NLA Transform ==
Added a new auto-snapping mode: snap to nearest marker. This mode can be toggled using the ALTKEY.
Diffstat (limited to 'source/blender/src/transform.c')
-rw-r--r--source/blender/src/transform.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c
index bf63442a2cd..fa87a054293 100644
--- a/source/blender/src/transform.c
+++ b/source/blender/src/transform.c
@@ -3373,6 +3373,8 @@ static short getAnimEdit_SnapMode(TransInfo *t)
autosnap= SACTSNAP_STEP;
else if (G.qual == LR_SHIFTKEY)
autosnap= SACTSNAP_FRAME;
+ else if (G.qual == LR_ALTKEY)
+ autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
break;
@@ -3382,6 +3384,9 @@ static short getAnimEdit_SnapMode(TransInfo *t)
case SACTSNAP_FRAME:
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
break;
+ case SACTSNAP_MARKER:
+ autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
+ break;
}
}
else if (t->spacetype == SPACE_NLA && G.snla) {
@@ -3391,6 +3396,8 @@ static short getAnimEdit_SnapMode(TransInfo *t)
autosnap= SACTSNAP_STEP;
else if (G.qual == LR_SHIFTKEY)
autosnap= SACTSNAP_FRAME;
+ else if (G.qual == LR_ALTKEY)
+ autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
break;
@@ -3400,6 +3407,9 @@ static short getAnimEdit_SnapMode(TransInfo *t)
case SACTSNAP_FRAME:
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
break;
+ case SACTSNAP_MARKER:
+ autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
+ break;
}
}
else {
@@ -3407,6 +3417,8 @@ static short getAnimEdit_SnapMode(TransInfo *t)
autosnap= SACTSNAP_STEP;
else if (G.qual == LR_SHIFTKEY)
autosnap= SACTSNAP_FRAME;
+ else if (G.qual == LR_ALTKEY)
+ autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
}
@@ -3438,7 +3450,7 @@ static short getAnimEdit_DrawTime(TransInfo *t)
/* This function is used by Animation Editor specific transform functions to do
- * the Snap Keyframe to Nearest Keyframe
+ * the Snap Keyframe to Nearest Frame/Marker
*/
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short autosnap)
{
@@ -3466,6 +3478,25 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short
else
*(td->val)= val;
}
+ /* snap key to nearest marker? */
+ else if (autosnap == SACTSNAP_MARKER) {
+ float val;
+
+ /* convert frame to nla-action time (if needed) */
+ if (ob)
+ val= get_action_frame_inv(ob, *(td->val));
+ else
+ val= *(td->val);
+
+ /* snap to nearest marker */
+ val= (float)find_nearest_marker_time(val);
+
+ /* convert frame out of nla-action time */
+ if (ob)
+ *(td->val)= get_action_frame(ob, val);
+ else
+ *(td->val)= val;
+ }
}
/* ----------------- Translation ----------------------- */
@@ -3578,7 +3609,7 @@ static void applyTimeTranslate(TransInfo *t, float sval)
*(td->val) = td->ival + val;
}
- /* apply snap-to-nearest-frame? */
+ /* apply nearest snapping */
doAnimEdit_SnapFrame(t, td, ob, autosnap);
}
}
@@ -3797,7 +3828,7 @@ static void applyTimeScale(TransInfo *t) {
*(td->val) *= fac;
*(td->val) += startx;
- /* apply snap-to-nearest-frame? */
+ /* apply nearest snapping */
doAnimEdit_SnapFrame(t, td, ob, autosnap);
}
}