@ -40,16 +40,23 @@ public class Ipo {
private Track calculatedTrack ;
private Track calculatedTrack ;
/** This variable indicates if the Y asxis is the UP axis or not. */
/** This variable indicates if the Y asxis is the UP axis or not. */
protected boolean fixUpAxis ;
protected boolean fixUpAxis ;
/** Depending on the blender version rotations are stored in degrees or radians so we need to know the version that is used. */
protected final int blenderVersion ;
/ * *
/ * *
* Constructor . Stores the bezier curves .
* Constructor . Stores the bezier curves .
*
*
* @param bezierCurves
* @param bezierCurves
* a table of bezier curves
* a table of bezier curves
* @param fixUpAxis
* indicates if the Y is the up axis or not
* @param blenderVersion
* the blender version that is currently used
* /
* /
public Ipo ( BezierCurve [ ] bezierCurves , boolean fixUpAxis ) {
public Ipo ( BezierCurve [ ] bezierCurves , boolean fixUpAxis , int blenderVersion ) {
this . bezierCurves = bezierCurves ;
this . bezierCurves = bezierCurves ;
this . fixUpAxis = fixUpAxis ;
this . fixUpAxis = fixUpAxis ;
this . blenderVersion = blenderVersion ;
}
}
/ * *
/ * *
@ -141,7 +148,10 @@ public class Ipo {
float [ ] objectRotation = new float [ 3 ] ;
float [ ] objectRotation = new float [ 3 ] ;
Vector3f [ ] scales = new Vector3f [ framesAmount + 1 ] ;
Vector3f [ ] scales = new Vector3f [ framesAmount + 1 ] ;
float [ ] scale = new float [ ] { 1 . 0f , 1 . 0f , 1 . 0f } ;
float [ ] scale = new float [ ] { 1 . 0f , 1 . 0f , 1 . 0f } ;
float degreeToRadiansFactor = FastMath . DEG_TO_RAD * 10 ; // the values in blender are divided by 10, so we need to mult it here
float degreeToRadiansFactor = 1 ;
if ( blenderVersion < 250 ) { //in blender earlier than 2.50 the values are stored in degrees
degreeToRadiansFactor * = FastMath . DEG_TO_RAD * 10 ; // the values in blender are divided by 10, so we need to mult it here
}
// calculating track data
// calculating track data
for ( int frame = startFrame ; frame < = stopFrame ; + + frame ) {
for ( int frame = startFrame ; frame < = stopFrame ; + + frame ) {