Sorry simple mistake should have been:

shape3Ds.add(root);

-Ewan

----- Original Message -----
From: "nagehan pala" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 21, 2003 8:50 AM
Subject: Re: [JAVA3D] I want to move loaded shapes!!


> Thanks Ewan, but I don't understand which "shapes" did you mean by writing
:
>
>
>     // If the current root node is a Shape3D then add it to the list of
> Shape3Ds
>     if (root instanceof Shape3D)
>         shapes.add(root);
>
> I didn't see any variable with the name "shapes", could you explain it?
> Nagehan
>
> >From: Ewan Borland <[EMAIL PROTECTED]>
> >Reply-To: Discussion list for Java 3D API <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: [JAVA3D] I want to move loaded shapes!!
> >Date: Sun, 20 Jul 2003 14:32:51 +0100
> >
> >Whenever you laod a model using a loader you didn't create it can be
useful
> >to find all the nodes of a certain type and perform some action on them.
> >
> >Here's some code that traverses the full graph from any Scene and
recovers
> >all of the Shape3D nodes. Obviouslly it's very easy to modify this to
find
> >whatever kind of node you are looking for. Think I got it from a previous
> >post on the list. Remember to call this before making your scene live.
> >Hope it helps,
> >
> >-Ewan
> >
> >private  Vector    shape3Ds                      = null;
> >private  HashSet visitedSharedGroups    = null;
> >
> >private void setCapabilities(Scene scene)
> >{
> >     shape3Ds = new Vector();
> >     visitedSharedGroups = new HashSet();
> >     retrieveShape3Ds(scene.getSceneGroup());
> >
> >     Enumeration e = shape3Ds.elements();
> >     while (e.hasMoreElements())
> >     {
> >         Shape3D shape = (Shape3D)e.nextElement();
> >         shape.setCapability(...);
> >     }
> >
> >// Retrieve all the Shape3D nodes contained in the scene graph starting
at
> >root
> >private void retrieveShape3Ds(Node root) throws CapabilityNotSetException
> >{
> >     // If this is a null tree then return
> >     if (root == null)
> >         return;
> >
> >     // If the root is a shared group then make sure it hasn't already
been
> >considered
> >     if (root instanceof SharedGroup)
> >     {
> >         // If it has been visited previously then return
> >         if (visitedSharedGroups.contains(root))
> >             return;
> >
> >        // If not then add it to the list of visited shared groups
> >        else
> >            visitedSharedGroups.add(root);
> >     }
> >
> >     // If the current root node is a Shape3D then add it to the list of
> >Shape3Ds
> >     if (root instanceof Shape3D)
> >         shapes.add(root);
> >
> >     // If root is a group then traverse all of its children
> >     else if (root instanceof Group)
> >     {
> >         Enumeration e = ((Group)root).getAllChildren();
> >         while(e.hasMoreElements())
> >             retrieveShape3Ds((Node)e.nextElement());
> >     }
> >
> >     // If root is a link then traverse its shared group
> >     else if (root instanceof Link)
> >         retrieveShape3Ds(((Link)root).getSharedGroup());
> >
> >}
> >
> >----- Original Message -----
> >From: "Alessandro Borges" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Sunday, July 20, 2003 1:20 PM
> >Subject: Re: [JAVA3D] I want to move loaded shapes!!
> >
> >
> > > Hi
> > > I guess the nodes of a loaded .obj are Shapes3D. And the nodes of a
> > > loaded vrml are TGs...
> > > I think you can get  all nodes BEFORE inserting it in the scene graph,
> > > and set your capabilities:
> > >
> > > something like:
> > >
> > > Hashtable hash = scene.getNamedObjects();
> > > for (Enumeration e = hash.keys() ; e.hasMoreElements() ;)
> > >    {
> > >         Object obj = hash.getElement(e);
> > >          if (obj instanceOf Shape3D)
> > >          {
> > >           Shape3D shape = (Shape3D)obj;
> > >           shape.setCabapilities ( Shape3D.ALLOW...);
> > >           ...
> > >          }
> > >      }
> > >
> > > (...)
> > > /* add loaded object to scene graph*/
> > > objRoot.addChild(scene);
> > >
> > >
> > >
> > > This is just a ideia. I am not sure if it will fix you problem.
> > >
> > > Alessandro
> > >
> > > nagehan pala escreveu:
> > >
> > > > Hi all
> > > >
> > > > My program loads two .obj files and they are added to a live scene
> > > > graph(Scene.getSceneGroup()) . They are pickable and they can be
moved
> >by
> > > > the user. And i want to draw a line between them during runtime. But
a
> > > > runtime error given:
> > > >
> > > >
> > > > javax.media.j3d.CapabilityNotSetException: Shape3D: no capability to
> >get
> > > > geometry
> > > >
> > > > Before I tried it with ColorCubes and set this capability:
> > > > PickTool.setCapabilities(node, PickTool.INTERSECT_FULL)
> > > >
> > > > And it was run. But I can't set this capability for loaded files,
> >because
> > > > node can only be Shape3D, Morph or Geometry nodes.
> > > >
> > > > i need help, please...
> > > >
> > > > Nagehan Pala
> > > >
> > > > _________________________________________________________________
> > > > MSN 8 with e-mail virus protection service: 2 months FREE*
> > > > http://join.msn.com/?page=features/virus
> > > >
> > > >
>
>===========================================================================
> > > >
> > > > To unsubscribe, send email to [EMAIL PROTECTED] and include in
the
> > > > body
> > > > of the message "signoff JAVA3D-INTEREST".  For general help, send
> > > > email to
> > > > [EMAIL PROTECTED] and include in the body of the message "help".
> > > >
> > >
> > >
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to