Fix for animation rotations computation (in blender earlier than 2.50 the rotations were stored in degrees and later in radians). Thanks to @rectalogic for finding this :).
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9717 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
d2b97fb422
commit
e83b15028b
@ -199,7 +199,7 @@ public class ArmatureHelper extends AbstractBlenderHelper {
|
||||
bezierCurves[channelCounter++] = new BezierCurve(type, bezTriples, 2);
|
||||
}
|
||||
|
||||
Ipo ipo = new Ipo(bezierCurves, fixUpAxis);
|
||||
Ipo ipo = new Ipo(bezierCurves, fixUpAxis, blenderContext.getBlenderVersion());
|
||||
tracks.add((BoneTrack) ipo.calculateTrack(boneIndex, 0, ipo.getLastFrame(), fps, false));
|
||||
}
|
||||
}
|
||||
|
@ -40,16 +40,23 @@ public class Ipo {
|
||||
private Track calculatedTrack;
|
||||
/** This variable indicates if the Y asxis is the UP axis or not. */
|
||||
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.
|
||||
*
|
||||
* @param bezierCurves
|
||||
* 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.fixUpAxis = fixUpAxis;
|
||||
this.blenderVersion = blenderVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,7 +148,10 @@ public class Ipo {
|
||||
float[] objectRotation = new float[3];
|
||||
Vector3f[] scales = new Vector3f[framesAmount + 1];
|
||||
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
|
||||
for (int frame = startFrame; frame <= stopFrame; ++frame) {
|
||||
@ -150,7 +160,7 @@ public class Ipo {
|
||||
for (int j = 0; j < bezierCurves.length; ++j) {
|
||||
double value = bezierCurves[j].evaluate(frame, BezierCurve.Y_VALUE);
|
||||
switch (bezierCurves[j].getType()) {
|
||||
// LOCATION
|
||||
// LOCATION
|
||||
case AC_LOC_X:
|
||||
translation[0] = (float) value;
|
||||
break;
|
||||
|
@ -63,7 +63,7 @@ public class IpoHelper extends AbstractBlenderHelper {
|
||||
bezierCurves[frame++] = new BezierCurve(type, bezTriples, 2);
|
||||
}
|
||||
curves.clear();
|
||||
result = new Ipo(bezierCurves, fixUpAxis);
|
||||
result = new Ipo(bezierCurves, fixUpAxis, blenderContext.getBlenderVersion());
|
||||
blenderContext.addLoadedFeatures(ipoStructure.getOldMemoryAddress(), ipoStructure.getName(), ipoStructure, result);
|
||||
}
|
||||
return result;
|
||||
@ -95,7 +95,7 @@ public class IpoHelper extends AbstractBlenderHelper {
|
||||
bezierCurves[frame++] = new BezierCurve(type, bezTriples, 2);
|
||||
}
|
||||
curves.clear();
|
||||
result = new Ipo(bezierCurves, fixUpAxis);
|
||||
result = new Ipo(bezierCurves, fixUpAxis, blenderContext.getBlenderVersion());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -174,7 +174,7 @@ public class IpoHelper extends AbstractBlenderHelper {
|
||||
* the constant value of this ipo
|
||||
*/
|
||||
public ConstIpo(float constValue) {
|
||||
super(null, false);
|
||||
super(null, false, 0);//the version is not important here
|
||||
this.constValue = constValue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user