* Fixed crash that happens when an Ogre3D mesh.xml model has an empty boneassignments tag

* Fixed issue with AnimControl clones sharing references to the list of AnimEventListeners

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8590 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 13 years ago
parent 74c636a464
commit d8682c94c3
  1. 1
      engine/src/core/com/jme3/animation/AnimControl.java
  2. 16
      engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.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<AnimChannel>();
clone.listeners = new ArrayList<AnimEventListener>();
if (skeleton != null){
clone.skeleton = new Skeleton(skeleton);

@ -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) {

Loading…
Cancel
Save