Problem with actualizing Scene when importing Custom models

Hi!



I have a little Swing application.

By pressing a button I want to import a custom Model into the scene. To that point everything works as expected the model is loaded

and attached to the accordant node but the scene is not actualized automatically.

Only when I’m pressing a mouse button or move the Camera the new model is showing up in the viewport.



It must have been something to to that I interrupt the main thread.

How can I fix this!?



Thanks!





regards



-René

How are we supposed to know? As it sounds you pretty much messed up your application and threading and theres lots of ways to do that.

Okay!

Another question…

What’s the best way to import models via a JFileDialog and add this model to my scene

in a way that I don’t intterrupt the main thread?

  1. i am sure normen will come out and say : (Best way)



    [java]

    Future fut = application.enqueue(new Callable() {

    public Object call() throws Exception {

    //this is where you modify your object, you can return a result value

    return modifyObject();

    }

    });

    //to retrieve return value (waits for call to finish, fire&forget otherwise):

    fut.get();[/java]


  2. i dont know if the following is a good way to implement it :

    in main class (Scene) :

    boolean loadFile ; String filename ;

    simpleUpdate()

    {

    if (loadFile)

    {//do stuff

    }

    }



    In JFilechooser : filename = “something”; loadFile=true;



    what is faster ?

You would probably want to create a new thread to handle it and then send the results (e.g. which file was chosen) via application.enqueue