Skip to main content

RestrictedAccessException using PickTool.setCapabilities()

2 replies [Last post]
Clifford Lyon
Joined: 2006-02-17

Hi, I have a BranchGroup representing some data points. I build it and add it to a scenegraph (SimpleUniverse) after the initial scene is rendered. (User opens a file with the positional data for the primitives.) Works fine. Also, I allow the user to detach that branchgroup, and add a different one. Works fine too.

Problem is, when I create a branchgroup I call:

PickTool.setCapabilities(shape, PickTool.INTERSECT_FULL);

for the primitives. This is long before I add it to the scenegraph. It works fine for the initial data, but the second time around throws the restricted access exception "Cannot modify capability bits on a live or compiled object." I don't understand, b/c at that point nothing in the BranchGroup is live or compiled, and there is no reference to the scene in the group yet.

Does PickTool have some sort of static reference in a SimpleUniverse?

I could just rebuild the entire scene from scratch, but it would be nicer not to. Anyone see the problem here?



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Clifford Lyon
Joined: 2006-02-17

The specific problem is that the geometry of the primitive is live. No idea why, just digging.

Specfically, in the SceneGraphObject class for the GeometryArray of the Sphere.

If I do this:

sphere = new Sphere(radius, Primitive.GENERATE_NORMALS, divisions);
if ( sphere.getShape().getGeometry().isLive() ) {
System.out.println(this + ": live");

I get "live" the *second* time I add elements to the scene.

Clifford Lyon
Joined: 2006-02-17

Found the answer to my own problem:


The cached geometry was live.

Hmm, this seems like a good optimization.