diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-07-07 10:21:38 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-07-07 10:21:38 +0400 |
commit | 6a320f327700e5ef6774d29b0b7a4d4b1a45fa27 (patch) | |
tree | c7f582b281406538bf74b96f7719bb4cb4e9e7f9 /source/blender/editors/transform/transform_generics.c | |
parent | 5fc61f03c12e291fa72fb3e60e5730300165aa3c (diff) |
NLA SoC: Auto-Snapping Fixes (Transform)
Snap to nearest-second works again for NLA and Graph Editors
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 2ff3cd807cd..9d111f39b6d 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -341,6 +341,8 @@ void recalcData(TransInfo *t) else if (t->spacetype == SPACE_NLA) { TransDataNla *tdn= (TransDataNla *)t->customData; SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first; + Scene *scene= t->scene; + double secf= FPS; int i; /* for each strip we've got, perform some additional validation of the values that got set before @@ -431,9 +433,15 @@ void recalcData(TransInfo *t) /* handle auto-snapping */ switch (snla->autosnap) { - case SACTSNAP_FRAME: /* snap to nearest frame */ - tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) ); - tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) ); + case SACTSNAP_FRAME: /* snap to nearest frame/time */ + if (snla->flag & SNLA_DRAWTIME) { + tdn->h1[0]= (float)( floor((tdn->h1[0]/secf) + 0.5f) * secf ); + tdn->h2[0]= (float)( floor((tdn->h2[0]/secf) + 0.5f) * secf ); + } + else { + tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) ); + tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) ); + } break; case SACTSNAP_MARKER: /* snap to nearest marker */ |