diff --git a/engine/src/core/com/jme3/animation/AnimControl.java b/engine/src/core/com/jme3/animation/AnimControl.java index ad56f3096..718866345 100644 --- a/engine/src/core/com/jme3/animation/AnimControl.java +++ b/engine/src/core/com/jme3/animation/AnimControl.java @@ -120,6 +120,7 @@ public final class AnimControl extends AbstractControl implements Cloneable { AnimControl clone = (AnimControl) super.clone(); clone.spatial = spatial; clone.channels = new ArrayList(); + clone.listeners = new ArrayList(); if (skeleton != null){ clone.skeleton = new Skeleton(skeleton); diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java index db5eba180..016c30c44 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -110,6 +110,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { private Geometry geom; private ByteBuffer indicesData; private FloatBuffer weightsFloatData; + private boolean actuallyHasWeights = false; private int vertCount; private boolean usesSharedVerts; private boolean usesBigIndices; @@ -147,6 +148,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { animData = null; + actuallyHasWeights = false; indicesData = null; weightsFloatData = null; } @@ -278,6 +280,18 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { return; } + if (!actuallyHasWeights){ + // No weights were actually written (the tag didn't have any entries) + // remove those buffers + mesh.clearBuffer(Type.BoneIndex); + mesh.clearBuffer(Type.BoneWeight); + + weightsFloatData = null; + indicesData = null; + + return; + } + //int vertCount = mesh.getVertexCount(); int maxWeightsPerVert = 0; weightsFloatData.rewind(); @@ -310,6 +324,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { } weightsFloatData.rewind(); + actuallyHasWeights = false; weightsFloatData = null; indicesData = null; @@ -531,6 +546,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { weightsFloatData.put(i, w); indicesData.put(i, bone); + actuallyHasWeights = true; } private void startSkeleton(String name) {