[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21396] branches/soc-2009-aligorith/source /blender/editors/transform: NLA SoC: Fixes for bugs in transform code from previous commit
Joshua Leung
aligorith at gmail.com
Tue Jul 7 08:16:06 CEST 2009
Revision: 21396
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21396
Author: aligorith
Date: 2009-07-07 08:16:06 +0200 (Tue, 07 Jul 2009)
Log Message:
-----------
NLA SoC: Fixes for bugs in transform code from previous commit
* The code to move strips between tracks now works (though it can still be a bit too eager to change tracks half-way through some transforms).
Strips are moved up/down one strip at a time, depending on whether there is any space in the next-track in the direction you direct it to move in.
* Auto-snapping works again. Also enabled snap-to-marker option for Graph Editor here.
Modified Paths:
--------------
branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
branches/soc-2009-aligorith/source/blender/editors/transform/transform_generics.c
Modified: branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c 2009-07-07 05:41:59 UTC (rev 21395)
+++ branches/soc-2009-aligorith/source/blender/editors/transform/transform_conversions.c 2009-07-07 06:16:06 UTC (rev 21396)
@@ -2677,7 +2677,7 @@
tdn->strip= strip;
tdn->trackIndex= BLI_findindex(&nlt->strips, strip);
- yval= (float)(tdn->trackIndex * NLACHANNEL_SKIP);
+ yval= (float)(tdn->trackIndex * NLACHANNEL_STEP);
tdn->h1[0]= strip->start;
tdn->h1[1]= yval;
@@ -3688,7 +3688,7 @@
break;
case SACTSNAP_MARKER: /* snap to nearest marker */
- //td2d->loc[0]= (float)find_nearest_marker_time(td2d->loc[0]);
+ td2d->loc[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, td2d->loc[0]);
break;
}
}
Modified: branches/soc-2009-aligorith/source/blender/editors/transform/transform_generics.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/transform/transform_generics.c 2009-07-07 05:41:59 UTC (rev 21395)
+++ branches/soc-2009-aligorith/source/blender/editors/transform/transform_generics.c 2009-07-07 06:16:06 UTC (rev 21396)
@@ -59,9 +59,7 @@
//#include "BIF_screen.h"
//#include "BIF_mywindow.h"
#include "BIF_gl.h"
-//#include "BIF_editaction.h"
//#include "BIF_editmesh.h"
-//#include "BIF_editnla.h"
//#include "BIF_editsima.h"
//#include "BIF_editparticle.h"
//#include "BIF_meshtools.h"
@@ -91,6 +89,7 @@
#include "ED_armature.h"
#include "ED_image.h"
#include "ED_keyframing.h"
+#include "ED_markers.h"
#include "ED_mesh.h"
#include "ED_space_api.h"
#include "ED_uvedit.h"
@@ -341,6 +340,7 @@
}
else if (t->spacetype == SPACE_NLA) {
TransDataNla *tdn= (TransDataNla *)t->customData;
+ SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
int i;
/* for each strip we've got, perform some additional validation of the values that got set before
@@ -375,6 +375,9 @@
if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
strip->next->start= tdn->h2[0];
+ /* flush transforms to child strips (since this should be a meta) */
+ BKE_nlameta_flush_transforms(strip);
+
/* restore to original track (if needed) */
if (tdn->oldTrack != tdn->nlt) {
/* just append to end of list for now, since strips get sorted in special_aftertrans_update() */
@@ -426,6 +429,19 @@
break;
}
+ /* 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) );
+ break;
+
+ case SACTSNAP_MARKER: /* snap to nearest marker */
+ tdn->h1[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]);
+ tdn->h2[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]);
+ break;
+ }
+
/* use RNA to write the values... */
// TODO: do we need to write in 2 passes to make sure that no truncation goes on?
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
@@ -440,9 +456,8 @@
/* now, check if we need to try and move track
* - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
*/
- // FIXME: the conversion from vertical distance to track index needs work!
- delta_y1= ((int)tdn->h1[0] / NLACHANNEL_SKIP - tdn->trackIndex);
- delta_y2= ((int)tdn->h2[0] / NLACHANNEL_SKIP - tdn->trackIndex);
+ delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP - tdn->trackIndex);
+ delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP - tdn->trackIndex);
if (delta_y1 || delta_y2) {
NlaTrack *track;
More information about the Bf-blender-cvs
mailing list