ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup

Started by dcfingerprint, October 26, 2016, 08:01:46 PM

Previous topic - Next topic

dcfingerprint

FATAL EXCEPTION in thread: GLThread 248
java.lang.ArrayIndexOutOfBoundsException: length=1640; index=1640
   at com.threed.jpct.Mesh.compress(Mesh.java:286)
   at com.threed.jpct.Mesh.cloneMesh(Mesh.java:382)
   at com.threed.jpct.Object3D.copy(Object3D.java:759)
   at com.threed.jpct.Object3D.<init>(Object3D.java:747)
   at raft.jpct.bones.Animated3D.<init>(Animated3D.java:107)
   at raft.jpct.bones.AnimatedGroup.clone(AnimatedGroup.java:440)

I've seen this exception for a couple of models now when attempting to clone an AnimatedGroup loaded via Bones with reuseMesh = false.  (The model was converted from Blender to Ogre to .bones using jmeOgre2Bones.sh.)    Not a problem in general but has occurred with specific models from completely different sources.  Any ideas?  I can send the .bones file if needed.  Thanks!

EgonOlsen

I'm not sure... Could it be that Bones creates a clone target object that's too small for some reason?

dcfingerprint

Would it be possible to test by trying with this bones file?  It loads and works fine, animates properly, etc.  Cloning while re-using mesh works fine (as long as this is done prior to any animation).  It is only when attempting to clone (using animatedGroup.clone(false) (not reusing mesh), that the JPCT-AE exception occurs.  Exception at same location also occurs with another completely different model.

I am interested in cloning with reuseMesh false so that I can keep one cached in memory (not attached to a World) and then quickly add multiple copies to a world and have them be able to animate independently.   If I clone with reusing mesh then subsequent clones are disfigured after animating (probably expected) - however please let me know if there's another way to do this (resetting animation prior to clone doesn't seem to help). 

https://www.dropbox.com/s/qzzdyhiiencye26/granny-bones.zip?dl=0

Thanks!

EgonOlsen

Looks more like a jPCT related issue than an actual Bones problem then. I'll look into it...


dcfingerprint

Still getting an exception, but in a different location:

java.lang.ArrayIndexOutOfBoundsException: length=44; index=1330
   at com.threed.jpct.Mesh.calcNormalsFast(Mesh.java:939)
   at com.threed.jpct.Mesh.calcNormals(Mesh.java:545)
   at com.threed.jpct.Object3D.calcNormals(Object3D.java:3382)
   at raft.jpct.bones.Animated3D.attachVertexController(Animated3D.java:452)
   at raft.jpct.bones.Animated3D.<init>(Animated3D.java:117)
   at raft.jpct.bones.AnimatedGroup.clone(AnimatedGroup.java:440)

EgonOlsen