@ -209,7 +209,7 @@ public class SceneApplication extends Application implements LookupProvider {
guiViewPort . setClearFlags ( false , false , false ) ;
}
getProgressHandle ( ) . progress ( "Setup Camera Controller" , 2 ) ;
//create camera controler
//create camera controll er
camController = new SceneCameraController ( cam , inputManager ) ;
//create preview view
getProgressHandle ( ) . progress ( "Setup Preview Scene" , 3 ) ;
@ -305,10 +305,10 @@ public class SceneApplication extends Application implements LookupProvider {
listeners . remove ( listener ) ;
}
private void notifyOpen ( ) {
private void notifyOpen ( final SceneRequest opened ) {
for ( Iterator < SceneListener > it = listeners . iterator ( ) ; it . hasNext ( ) ; ) {
SceneListener sceneViewerListener = it . next ( ) ;
sceneViewerListener . sceneOpened ( currentSceneRequest ) ;
sceneViewerListener . sceneOpened ( opened ) ;
}
}
@ -337,13 +337,16 @@ public class SceneApplication extends Application implements LookupProvider {
/ * *
* method to display the node tree of a plugin ( threadsafe )
* @param t ree
* @param requ est
* /
public void openScene ( final SceneRequest request ) {
closeScene ( currentSceneRequest ) ;
closeScene ( currentSceneRequest , request ) ;
java . awt . EventQueue . invokeLater ( new Runnable ( ) {
public void run ( ) {
if ( request = = null ) {
return ;
}
currentSceneRequest = request ;
if ( request . getDataObject ( ) ! = null ) {
setCurrentFileNode ( request . getDataObject ( ) . getNodeDelegate ( ) ) ;
@ -352,7 +355,6 @@ public class SceneApplication extends Application implements LookupProvider {
}
setHelpContext ( request . getHelpCtx ( ) ) ;
setWindowTitle ( request . getWindowTitle ( ) ) ;
notifyOpen ( ) ;
enqueue ( new Callable ( ) {
public Object call ( ) throws Exception {
@ -373,38 +375,45 @@ public class SceneApplication extends Application implements LookupProvider {
if ( request . getToolNode ( ) ! = null ) {
toolsNode . attachChild ( request . getToolNode ( ) ) ;
}
getCur rentSceneRe quest( ) . setDisplayed ( true ) ;
request . setDisplayed ( true ) ;
return null ;
}
} ) ;
notifyOpen ( request ) ;
}
} ) ;
}
/ * *
* method to close a scene displayed by a scene request ( threadsafe )
* @param t ree
* @param requ est
* /
public void closeScene ( final SceneRequest request ) {
if ( request ! = null ) {
closeScene ( request , null ) ;
}
private void closeScene ( final SceneRequest oldRequest , final SceneRequest newRequest ) {
java . awt . EventQueue . invokeLater ( new Runnable ( ) {
public void run ( ) {
checkSave ( ) ;
setCurrentFileNode ( null ) ;
setWindowTitle ( "OpenGL Window" ) ;
setHelpContext ( null ) ;
if ( oldRequest = = null ) {
return ;
}
if ( newRequest = = null | | newRequest . getRootNode ( ) ! = oldRequest . getRootNode ( ) ) {
checkSave ( oldRequest ) ;
SceneUndoRedoManager manager = Lookup . getDefault ( ) . lookup ( SceneUndoRedoManager . class ) ;
if ( manager ! = null ) {
manager . discardAllEdits ( ) ;
}
final SceneRequest currentRequest = currentSceneRequest ;
currentSceneRequest = null ;
notifyClose ( request ) ;
}
setCurrentFileNode ( null ) ;
setWindowTitle ( "OpenGL Window" ) ;
setHelpContext ( null ) ;
notifyClose ( oldRequest ) ;
enqueue ( new Callable ( ) {
public Object call ( ) throws Exception {
if ( r equest. getRequester ( ) instanceof SceneApplication ) {
if ( oldR equest. getRequester ( ) instanceof SceneApplication ) {
camController . disable ( ) ;
}
if ( physicsState ! = null ) {
@ -416,19 +425,18 @@ public class SceneApplication extends Application implements LookupProvider {
rootNode . detachAllChildren ( ) ;
// resetCam();
lastError = "" ;
current Request . setDisplayed ( false ) ;
old Request. setDisplayed ( false ) ;
return null ;
}
} ) ;
}
} ) ;
}
}
private void checkSave ( ) {
if ( ( cu rrentSceneR equest ! = null )
& & cu rrentSceneR equest. getDataObject ( ) . isModified ( ) ) {
final DataObject req = cu rrentSceneR equest. getDataObject ( ) ;
private void checkSave ( SceneRequest request ) {
if ( ( request ! = null )
& & request . getDataObject ( ) . isModified ( ) ) {
final DataObject req = request . getDataObject ( ) ;
Confirmation mesg = new NotifyDescriptor . Confirmation ( "Scene has not been saved,\ndo you want to save it?" ,
"Not Saved" ,
NotifyDescriptor . YES_NO_OPTION ) ;