Title: How to use OrderedGroup?
I figured out how to do morphing.....  Cool.
 
But now I get an error whenever I change the Appearance transparency (but not color) of a Shape3D which shares the
Appearance I use in the Morph().
 
--------------------------------
 
Exception occurred during event dispatching:
java.lang.IndexOutOfBoundsException: Index: -1, Size: 0
 at java.util.ArrayList.RangeCheck(ArrayList.java, Compiled Code)
 at java.util.ArrayList.remove(ArrayList.java:372)
 at javax.media.j3d.NodeComponentRetained.removeUser(NodeComponentRetained.java:60)
 at javax.media.j3d.AppearanceRetained.setTransparencyAttributes(AppearanceRetained.java:386)
 at javax.media.j3d.Appearance.setTransparencyAttributes(Appearance.java:323)
 at PMenu.changeOption(PMenu.java, Compiled Code)
 at PMenu.actionPerformed(PMenu.java:594)
 at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1066)
 at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1101)
 at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
 at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
 at javax.swing.AbstractButton.doClick(AbstractButton.java:226)
 at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:754)
 at java.awt.Component.processMouseEvent(Component.java:3160)
 at java.awt.Component.processEvent(Component.java, Compiled Code)
 at java.awt.Container.processEvent(Container.java, Compiled Code)
 at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code)
 at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
 at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java, Compiled Code)
 at java.awt.LightweightDispatcher.processMouseEvent(Container.java, Compiled Code)
 at java.awt.LightweightDispatcher.dispatchEvent(Container.java, Compiled Code)
 at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
 at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code)
 at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java, Compiled Code)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
--------------------------------
 
Can anyone tell me why I am getting this error on a change of transparency?
The code I use to change the transparency of the Appearance is:

      Appearance PA = theApp.the120Poly.getAppearance();
      Material theMaterial = PA.getMaterial();
 
      TransparencyAttributes TA = new TransparencyAttributes(TransparencyAttributes.FASTEST, theApp.transPoly120);
      TA.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE); 
      PA.setTransparencyAttributes(TA);
 
The Morph is set up as:
 
   morph120 = new Morph(myGeometryArray, AP_120);
   morph120.setCapability(Morph.ALLOW_WEIGHTS_WRITE);
   morph120.setCapability(Morph.ALLOW_APPEARANCE_WRITE);
And the other Shape3D that shares the Appearance is
 
     the120Poly = new Shape3D();
     the120Poly.setGeometry(Poly120.Solid(theApp));
     the120Poly.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
     the120Poly.setAppearance(AP_120);
     the120Poly.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
     the120Poly.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
 
Before I added the morph code I never got this error.  I could change the transparency of the Shape3D
without a problem.
 
Is there a problem sharing an Appearance between a Shape3D and a Morph??
(But I can change the color, which is another Appearance change, and I don't get the error.)
 
Bob Gray
 
 

Reply via email to