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-07-07 10:21:38 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-07 10:21:38 +0400
commit6a320f327700e5ef6774d29b0b7a4d4b1a45fa27 (patch)
treec7f582b281406538bf74b96f7719bb4cb4e9e7f9 /source/blender/editors/transform
parent5fc61f03c12e291fa72fb3e60e5730300165aa3c (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')
-rw-r--r--source/blender/editors/transform/transform_conversions.c19
-rw-r--r--source/blender/editors/transform/transform_generics.c14
2 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index fafdfcc7602..53c8e08ee74 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -101,16 +101,13 @@
#include "BKE_context.h"
#include "BKE_report.h"
-//#include "BIF_editaction.h"
//#include "BIF_editview.h"
//#include "BIF_editlattice.h"
//#include "BIF_editconstraint.h"
//#include "BIF_editmesh.h"
-//#include "BIF_editnla.h"
//#include "BIF_editsima.h"
//#include "BIF_editparticle.h"
#include "BIF_gl.h"
-//#include "BIF_keyframing.h"
//#include "BIF_poseobject.h"
//#include "BIF_meshtools.h"
//#include "BIF_mywindow.h"
@@ -127,6 +124,7 @@
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_object.h"
+#include "ED_markers.h"
#include "ED_mesh.h"
#include "ED_types.h"
#include "ED_uvedit.h"
@@ -134,13 +132,7 @@
#include "UI_view2d.h"
-//#include "BSE_drawipo.h"
//#include "BSE_edit.h"
-//#include "BSE_editipo.h"
-//#include "BSE_editipo_types.h"
-//#include "BSE_editaction_types.h"
-
-//#include "BDR_drawaction.h" // list of keyframes in action
//#include "BDR_editobject.h" // reset_slowparents()
//#include "BDR_gpencil.h"
@@ -3671,6 +3663,8 @@ void flushTransGraphData(TransInfo *t)
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
TransData *td;
TransData2D *td2d;
+ Scene *scene= t->scene;
+ double secf= FPS;
int a;
/* flush to 2d vector from internally used 3d vector */
@@ -3683,8 +3677,11 @@ void flushTransGraphData(TransInfo *t)
*/
if ((td->flag & TD_NOTIMESNAP)==0) {
switch (sipo->autosnap) {
- case SACTSNAP_FRAME: /* snap to nearest frame */
- td2d->loc[0]= (float)( floor(td2d->loc[0]+0.5f) );
+ case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */
+ if (sipo->flag & SIPO_DRAWTIME)
+ td2d->loc[0]= (float)( floor((td2d->loc[0]/secf) + 0.5f) * secf );
+ else
+ td2d->loc[0]= (float)( floor(td2d->loc[0]+0.5f) );
break;
case SACTSNAP_MARKER: /* snap to nearest marker */
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 */