Hello,

I'm developing a SceneGraph inspector. This is a Swing Jtree which
views the actual SceneGraph for debug and development.

This JTree listens to a tree model called InspectorLocal (a Locale
implementing interface TreeModel). So you can use InspectorLocale
instead of Locale for debugging.

To get access to all live Nodes and NodeComponets in InspectorLocale, I
have to detach all BranchGroups, perform all necessary access to the
SceneGraph references and after this reattach all BranchGroups. I
perform this detaching/reattach in a Thread, so the Jtree is fast and
has a smart usability without "hanging" . The Thread will wait some
milliseconds before reattaching, because the JTree will call the methods
implemented by TreeModel several times for every view update.

This works fine for SceneGraphs without Behaviours. When using
InspectorLocale on SceneGraphs with Behaviours, the application will
hang. I assume this is because of the J3D Behavior Scheduler is not
synchronized with my Thread. So I stop the Scheduler before detaching
Branchgroups. Here is the run() method in InspectorLocale:

    public void run () {

                [...]

        //stop rendering and behaviour scheduler
        View v = this.viewer.getView();
        v.stopView();
        long[] milis = v.stopBehaviorScheduler();

        while (v.isBehaviorSchedulerRunning() || v.isViewRunning()) {
                try {
                    thread.sleep(this.THREAD_MAX_SLEEP);
                    System.out.println("waiting for view to stop ...
Scheduler:"+v.isBehaviorSchedulerRunning()+" begin:"+milis[0]+"
end:"+milis[1]+" View running:"+v.isViewRunning());
                } catch (InterruptedException e){
                    System.out.println("interrupted while waiting for
view stop !");
                }
        }

        Iterator iter = rootBG.iterator();
        while (iter.hasNext()) {
            try {
                super.addBranchGraph((BranchGroup)iter.next());
            } catch (CapabilityNotSetException e) {
                System.out.println("Could not reattach BranchGroup !");
            }
        }

        v.startView();
          v.startBehaviorScheduler();

        detached = false;
    }


Now my problem:
The method isBehaviorSchedulerRunning() ALLWAYS returns true, also I
stopped the schedular process. My Thread hangs in a continuous loop.

Anyone else having a similiar problem ?

Cheers,
Andreas

===========================================================================
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