diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinition.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinition.java index 9db5bf75f..df5e0901b 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinition.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinition.java @@ -215,9 +215,13 @@ public abstract class ConstraintDefinition { } } - public void write(JmeExporter ex) throws IOException { } + public void write(JmeExporter ex) throws IOException { + //no need to implement this one (the TrackWrapper is used internally and never serialized) + } - public void read(JmeImporter im) throws IOException { } + public void read(JmeImporter im) throws IOException { + //no need to implement this one (the TrackWrapper is used internally and never serialized) + } public void setTime(float time, float weight, AnimControl control, AnimChannel channel, TempVars vars) { diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionLocLimit.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionLocLimit.java index 1fce62de2..db93ef994 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionLocLimit.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionLocLimit.java @@ -53,35 +53,23 @@ import com.jme3.scene.plugins.blender.file.Structure; public void bake(Transform ownerTransform, Transform targetTransform, float influence) { Vector3f translation = ownerTransform.getTranslation(); - if ((flag & LIMIT_XMIN) != 0) { - if (translation.x < limits[0][0]) { - translation.x -= (translation.x - limits[0][0]) * influence; - } + if ((flag & LIMIT_XMIN) != 0 && translation.x < limits[0][0]) { + translation.x -= (translation.x - limits[0][0]) * influence; } - if ((flag & LIMIT_XMAX) != 0) { - if (translation.x > limits[0][1]) { - translation.x -= (translation.x - limits[0][1]) * influence; - } + if ((flag & LIMIT_XMAX) != 0 && translation.x > limits[0][1]) { + translation.x -= (translation.x - limits[0][1]) * influence; } - if ((flag & LIMIT_YMIN) != 0) { - if (translation.y < limits[1][0]) { - translation.y -= (translation.y - limits[1][0]) * influence; - } + if ((flag & LIMIT_YMIN) != 0 && translation.y < limits[1][0]) { + translation.y -= (translation.y - limits[1][0]) * influence; } - if ((flag & LIMIT_YMAX) != 0) { - if (translation.y > limits[1][1]) { - translation.y -= (translation.y - limits[1][1]) * influence; - } + if ((flag & LIMIT_YMAX) != 0 && translation.y > limits[1][1]) { + translation.y -= (translation.y - limits[1][1]) * influence; } - if ((flag & LIMIT_ZMIN) != 0) { - if (translation.z < limits[2][0]) { - translation.z -= (translation.z - limits[2][0]) * influence; - } + if ((flag & LIMIT_ZMIN) != 0 && translation.z < limits[2][0]) { + translation.z -= (translation.z - limits[2][0]) * influence; } - if ((flag & LIMIT_ZMAX) != 0) { - if (translation.z > limits[2][1]) { - translation.z -= (translation.z - limits[2][1]) * influence; - } + if ((flag & LIMIT_ZMAX) != 0 && translation.z > limits[2][1]) { + translation.z -= (translation.z - limits[2][1]) * influence; } } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionNull.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionNull.java index a1a5d507e..bbecd9c52 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionNull.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionNull.java @@ -15,5 +15,7 @@ import com.jme3.scene.plugins.blender.file.Structure; } @Override - public void bake(Transform ownerTransform, Transform targetTransform, float influence) { } + public void bake(Transform ownerTransform, Transform targetTransform, float influence) { + //null constraint does nothing so no need to implement this one + } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionRotLimit.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionRotLimit.java index 1d5af33bb..96028f277 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionRotLimit.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionRotLimit.java @@ -15,7 +15,7 @@ import com.jme3.scene.plugins.blender.file.Structure; private static final int LIMIT_YROT = 0x02; private static final int LIMIT_ZROT = 0x04; - private float[][] limits = new float[3][2]; + private transient float[][] limits = new float[3][2]; private transient float[] angles = new float[3]; public ConstraintDefinitionRotLimit(Structure constraintData, BlenderContext blenderContext) { diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSizeLimit.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSizeLimit.java index 32803fe5d..f8db11219 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSizeLimit.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSizeLimit.java @@ -17,7 +17,7 @@ import com.jme3.scene.plugins.blender.file.Structure; private static final int LIMIT_ZMIN = 0x10; private static final int LIMIT_ZMAX = 0x20; - protected float[][] limits = new float[3][2]; + protected transient float[][] limits = new float[3][2]; public ConstraintDefinitionSizeLimit(Structure constraintData, BlenderContext blenderContext) { super(constraintData, blenderContext); diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java index 332f83acb..63998fa62 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java @@ -461,6 +461,7 @@ public class CurvesHelper extends AbstractBlenderHelper { protected List applyBevelAndTaper(Curve curve, List bevelObject, Spline taperObject, boolean smooth, BlenderContext blenderContext) { Vector3f[] curvePoints = BufferUtils.getVector3Array(curve.getFloatBuffer(Type.Position)); + Vector3f subtractResult = new Vector3f(); float curveLength = curve.getLength(); FloatBuffer[] vertexBuffers = new FloatBuffer[bevelObject.size()]; @@ -488,7 +489,6 @@ public class CurvesHelper extends AbstractBlenderHelper { //equal to the distance between the points on curve that define the bevel position //so instead doing complicated rotations on each point we will simply properly translate each of them - Vector3f subtractResult = new Vector3f(); int[][] pointIndexes = new int[][] { { 0, 1 }, { curvePoints.length - 1, curvePoints.length - 2 } }; for(int[] indexes : pointIndexes) { float distance = curvePoints[indexes[1]].subtract(curvePoints[indexes[0]], subtractResult).length(); @@ -506,7 +506,7 @@ public class CurvesHelper extends AbstractBlenderHelper { float lengthAlongCurve = 0; for(int i=0;i 0) { - lengthAlongCurve += curvePoints[i].subtract(curvePoints[i - 1]).length(); + lengthAlongCurve += curvePoints[i].subtract(curvePoints[i - 1], subtractResult).length(); } float taperScale = this.getTaperScale(taperObject, i == 0 ? 0 : lengthAlongCurve / curveLength); this.applyScale(bevels.get(i), curvePoints[i], taperScale); diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/exceptions/BlenderFileException.java b/engine/src/blender/com/jme3/scene/plugins/blender/exceptions/BlenderFileException.java index 62a87f9c8..f9b668447 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/exceptions/BlenderFileException.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/exceptions/BlenderFileException.java @@ -43,6 +43,7 @@ public class BlenderFileException extends Exception { * Constructor. Creates an exception with no description. */ public BlenderFileException() { + //this constructor has no message } /** diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/file/BlenderInputStream.java b/engine/src/blender/com/jme3/scene/plugins/blender/file/BlenderInputStream.java index 86a11e8e2..19d665b6b 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/file/BlenderInputStream.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/file/BlenderInputStream.java @@ -379,7 +379,12 @@ public class BlenderInputStream extends InputStream { } @Override - public void close() throws IOException { } + public void close() throws IOException { + //this method is unimplemented because some loaders (ie. TGALoader) have flaws that close the stream given from the outside + //because the images can be stored directly in the blender file then this stream is properly positioned and given to the loader + //to read the image file, that is why we do not want it to be closed before the reading is done + //to properly close the stream use forceClose() method + } /** * This method should be used to close the stream because some loaders may close the stream while reading resources from it.