Following exception appears in my Java 3D application:
TransformGroupRetained : Can't find hashKey Exception in thread "J3D-TransformStructureUpdateThread-1" java.lang.ArrayIndexOutOfBoundsException: -1 at javax.media.j3d.TransformGroupRetained.updateChildLocalToVworld(TransformGroupRetained.java:979) at javax.media.j3d.TransformGroupRetained.updateChildLocalToVworld(TransformGroupRetained.java:961) at javax.media.j3d.TransformGroupRetained.processChildLocalToVworld(TransformGroupRetained.java:825) at javax.media.j3d.TransformStructure.processCurrentLocalToVworld(TransformStructure.java:306) at javax.media.j3d.TransformStructure.processMessages(TransformStructure.java:186) at javax.media.j3d.StructureUpdateThread.doWork(StructureUpdateThread.java:83) at javax.media.j3d.J3dThread.run(J3dThread.java:250)
In my case I incorrectly used one of available ways to hide and show part of 3D objects graph. I use javax.media.j3d.Link
and when I wand to show specific subgraph I call:
link.setSharedGroup(mySharedGroup);
and similary I called when I want to hide some object I called:
link.setSharedGroup(null);
I works fine up to the moment when setSharedGroup
was called with same object parameter more than once. It leads to "TransformGroupRetained : Can't find hashKey" Exception. Fix is quite simple:
if(link.getSharedGroup() == null){ link.setSharedGroup(mySharedGroup); }
and
if(link.getSharedGroup() != null){ link.setSharedGroup(null); }
This should help. Hopefully it will save you some time.
regards
No comments:
Post a Comment