diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java index b4d3a2f56..84cf6761a 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java @@ -390,41 +390,36 @@ public class SceneApplication extends Application implements LookupProvider { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { - - if (request == currentSceneRequest) { - checkSave(); - setCurrentFileNode(null); - setWindowTitle("OpenGL Window"); - setHelpContext(null); - SceneUndoRedoManager manager = Lookup.getDefault().lookup(SceneUndoRedoManager.class); - if (manager != null) { - manager.discardAllEdits(); - } - final SceneRequest currentRequest = currentSceneRequest; - currentSceneRequest = null; - notifyClose(request); - enqueue(new Callable() { - - public Object call() throws Exception { - if (request.getRequester() instanceof SceneApplication) { - camController.disable(); - } - notifyClose(currentRequest); - if (physicsState != null) { - physicsState.getPhysicsSpace().removeAll(rootNode); - getStateManager().detach(physicsState); - physicsState = null; - } - currentRequest.setDisplayed(false); - toolsNode.detachAllChildren(); - rootNode.detachAllChildren(); - // resetCam(); - lastError = ""; - return null; - } - }); + checkSave(); + setCurrentFileNode(null); + setWindowTitle("OpenGL Window"); + setHelpContext(null); + SceneUndoRedoManager manager = Lookup.getDefault().lookup(SceneUndoRedoManager.class); + if (manager != null) { + manager.discardAllEdits(); } - + final SceneRequest currentRequest = currentSceneRequest; + currentSceneRequest = null; + notifyClose(request); + enqueue(new Callable() { + + public Object call() throws Exception { + if (request.getRequester() instanceof SceneApplication) { + camController.disable(); + } + if (physicsState != null) { + physicsState.getPhysicsSpace().removeAll(rootNode); + getStateManager().detach(physicsState); + physicsState = null; + } + toolsNode.detachAllChildren(); + rootNode.detachAllChildren(); + // resetCam(); + lastError = ""; + currentRequest.setDisplayed(false); + return null; + } + }); } }); } diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java index 124d76543..85a6e9840 100644 --- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java +++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java @@ -67,6 +67,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce ComposerCameraController camController; SceneComposerToolController toolController; SceneEditorController editorController; + private SceneRequest sentRequest; private SceneRequest currentRequest; private HelpCtx ctx = new HelpCtx("sdk.scene_composer"); // private ProjectAssetManager.ClassPathChangeListener listener; @@ -791,7 +792,7 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F editorController.cleanup(); } editorController = new SceneEditorController(jmeNode, file); - this.currentRequest = request; + this.sentRequest = request; request.setWindowTitle("SceneComposer - " + manager.getRelativeAssetPath(file.getPrimaryFile().getPath())); request.setToolNode(new Node("SceneComposerToolNode")); SceneApplication.getApplication().openScene(request); @@ -889,7 +890,8 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F * SceneListener */ public void sceneOpened(SceneRequest request) { - if (request.equals(currentRequest)) { + if (request.equals(sentRequest)) { + currentRequest = request; setActivatedNodes(new org.openide.nodes.Node[]{currentRequest.getDataObject().getNodeDelegate()}); setSceneInfo(currentRequest.getJmeNode(), editorController.getCurrentFileObject(), true); if (camController != null) { diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java index 1c062f3ce..ea3eddf51 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java @@ -126,6 +126,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce TerrainToolController toolController; TerrainEditorController editorController; private SceneRequest currentRequest; + private SceneRequest sentRequest; private boolean alreadyChoosing = false; // used for texture table selection private CreateTerrainWizardAction terrainWizard; private SkyboxWizardAction skyboxWizard; @@ -1006,7 +1007,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce editorController.cleanup(); } editorController = new TerrainEditorController(jmeNode, file, this); - this.currentRequest = request; + this.sentRequest = request; request.setWindowTitle("TerrainEditor - " + manager.getRelativeAssetPath(file.getPrimaryFile().getPath())); request.setToolNode(new Node("TerrainEditorToolNode")); SceneApplication.getApplication().openScene(request); @@ -1019,7 +1020,8 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce // runs on AWT thread now public void sceneOpened(SceneRequest request) { - if (request.equals(currentRequest)) { + if (request.equals(sentRequest)) { + currentRequest = request; Logger.getLogger(TerrainEditorTopComponent.class.getName()).finer("Terrain sceneRequested " + request.getWindowTitle()); setSceneInfo(currentRequest.getJmeNode(), true); diff --git a/sdk/jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleCreatorTopComponent.java b/sdk/jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleCreatorTopComponent.java index 343b30db4..486808483 100644 --- a/sdk/jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleCreatorTopComponent.java +++ b/sdk/jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleCreatorTopComponent.java @@ -39,6 +39,7 @@ public final class VehicleCreatorTopComponent extends TopComponent implements Sc private static final String PREFERRED_ID = "VehicleCreatorTopComponent"; private VehicleEditorController editorController; private SceneRequest currentRequest; + private SceneRequest sentRequest; private boolean testing = false; DirectionalLight dirLight = new DirectionalLight(); private HelpCtx ctx = new HelpCtx("sdk.vehicle_creator"); @@ -870,19 +871,20 @@ public final class VehicleCreatorTopComponent extends TopComponent implements Sc JmeNode node = NodeUtility.createNode(spatial, false); editorController = new VehicleEditorController(node, file); SceneApplication.getApplication().addSceneListener(this); - currentRequest = new SceneRequest(this, node, file.getLookup().lookup(ProjectAssetManager.class)); - currentRequest.setWindowTitle("Vehicle Creator"); - currentRequest.setDataObject(file); - currentRequest.setToolNode(editorController.getToolsNode()); - currentRequest.setHelpCtx(ctx); - SceneApplication.getApplication().openScene(currentRequest); + sentRequest = new SceneRequest(this, node, file.getLookup().lookup(ProjectAssetManager.class)); + sentRequest.setWindowTitle("Vehicle Creator"); + sentRequest.setDataObject(file); + sentRequest.setToolNode(editorController.getToolsNode()); + sentRequest.setHelpCtx(ctx); + SceneApplication.getApplication().openScene(sentRequest); } public void previewCreated(PreviewRequest request) { } public void sceneClosed(SceneRequest request) { - if (request == currentRequest) { + if (request == sentRequest) { + currentRequest = request; SceneApplication.getApplication().removeSceneListener(this); editorController.cleanupApplication(); setLoadedScene(null, false);