Author Topic: ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup  (Read 14858 times)

Offline dcfingerprint

  • byte
  • *
  • Posts: 7
    • View Profile
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!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup
« Reply #1 on: October 26, 2016, 08:28:14 pm »
I'm not sure... Could it be that Bones creates a clone target object that's too small for some reason?

Offline dcfingerprint

  • byte
  • *
  • Posts: 7
    • View Profile
Re: ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup
« Reply #2 on: October 26, 2016, 10:23:48 pm »
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!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup
« Reply #3 on: October 27, 2016, 10:14:22 am »
Looks more like a jPCT related issue than an actual Bones problem then. I'll look into it...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net

Offline dcfingerprint

  • byte
  • *
  • Posts: 7
    • View Profile
Re: ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup
« Reply #5 on: November 10, 2016, 09:17:38 pm »
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)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: ArrayIndexOutOfBoundsException when cloning Object3D from AnimatedGroup
« Reply #6 on: November 11, 2016, 08:12:25 am »
Just...why...? I'll look into it...