Hej ! 

I am not sure if this has already been mentioned, but I could not find
it anywhere in the list already, sorry if I'm repeating old news...

But I think this could be solved without this workaround by adding
two lines of Code by someone at Sun:

:) >I managed to solve this one in the end. I had to create a method which recursively 
:performs setCapability(Group.ALLOW_CHILDREN_READ) on all Group objects within the 
:Primitive (see code fragment below). So after calling the constructor for the 
:Cylinder with the ENABLE_APPEARANCE_MODIFY flag set, I call this method with the 
:Cylinder as the starting object. 
:) >
:) >Here's the code:
[creative code for workaround snipped]
:) >It works fine now, but it still seems a bit of a kludge to have to resort to this 
:kind of work-around. Does anyone know of a better way? 
:) >BTW, I noticed that the original problem seems to apply just to Cylinder & Cone 
:Primitives...

After running into the problem with changing e.g. the Appearance of the
subshape of a Cylinder Primitive some days ago I checked out the Source
for this Primitive from the source files delivered by Suns and found
that the problem seems to arise because someone forgot to add the Capability
to read children to the TransformGroups containing the top and bottom
subshapes of the Primitive:

In lines 226-231 of the publisched Cylinder.java, the TransformGroup for the
body is created and gets the ALLOW_CHILDREN_READ capability set, then the
Transform is set, the Shape is added and the whole thing added to the main
Group of the Cylinder:

      // Add body to transform
      TransformGroup objTrans = new TransformGroup();
      objTrans.setCapability(ALLOW_CHILDREN_READ);
      objTrans.setTransform(t);
      objTrans.addChild(shape[BODY]);
      this.addChild(objTrans);

One would expect similar code for the addition of the top and bottom, but
there is a small difference (Cylinder.java, lines 248-251):

      TransformGroup objTrans2 = new TransformGroup();
      objTrans2.setTransform(t2);
      objTrans2.addChild(shape[TOP]);
      objTrans.addChild(objTrans2);

(and similar for bottom), the setCapability Line is missing. And as
objTrans2 and objTrans3 do not allow reading their children, the
Exception is thrown. So it seems to me this special problem could
be solved by just adding the two 'setCapability'-Lines to the code.

Am I right here? If it is indeed that easy, I propose this change to
be adde for the next bugfix release...

-- 
Hej d� !

---------------------------------------------------------------:)---------
Sven Hartmeier - Student of Scientific Computer Sciences
                           (normally of)  University of Bielefeld, Germany
             Currently studying for one year at Uppsala University, Sweden
�����������������������
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to