- fix some bugs related to scene opening

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8623 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 818a8bdaab
commit 122d438e9d
  1. 63
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
  2. 6
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java
  3. 6
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java
  4. 16
      sdk/jme3-vehicle-creator/src/com/jme3/gde/vehiclecreator/VehicleCreatorTopComponent.java

@ -390,41 +390,36 @@ public class SceneApplication extends Application implements LookupProvider {
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
checkSave();
if (request == currentSceneRequest) { setCurrentFileNode(null);
checkSave(); setWindowTitle("OpenGL Window");
setCurrentFileNode(null); setHelpContext(null);
setWindowTitle("OpenGL Window"); SceneUndoRedoManager manager = Lookup.getDefault().lookup(SceneUndoRedoManager.class);
setHelpContext(null); if (manager != null) {
SceneUndoRedoManager manager = Lookup.getDefault().lookup(SceneUndoRedoManager.class); manager.discardAllEdits();
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;
}
});
} }
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;
}
});
} }
}); });
} }

@ -67,6 +67,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
ComposerCameraController camController; ComposerCameraController camController;
SceneComposerToolController toolController; SceneComposerToolController toolController;
SceneEditorController editorController; SceneEditorController editorController;
private SceneRequest sentRequest;
private SceneRequest currentRequest; private SceneRequest currentRequest;
private HelpCtx ctx = new HelpCtx("sdk.scene_composer"); private HelpCtx ctx = new HelpCtx("sdk.scene_composer");
// private ProjectAssetManager.ClassPathChangeListener listener; // private ProjectAssetManager.ClassPathChangeListener listener;
@ -791,7 +792,7 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
editorController.cleanup(); editorController.cleanup();
} }
editorController = new SceneEditorController(jmeNode, file); editorController = new SceneEditorController(jmeNode, file);
this.currentRequest = request; this.sentRequest = request;
request.setWindowTitle("SceneComposer - " + manager.getRelativeAssetPath(file.getPrimaryFile().getPath())); request.setWindowTitle("SceneComposer - " + manager.getRelativeAssetPath(file.getPrimaryFile().getPath()));
request.setToolNode(new Node("SceneComposerToolNode")); request.setToolNode(new Node("SceneComposerToolNode"));
SceneApplication.getApplication().openScene(request); SceneApplication.getApplication().openScene(request);
@ -889,7 +890,8 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
* SceneListener * SceneListener
*/ */
public void sceneOpened(SceneRequest request) { public void sceneOpened(SceneRequest request) {
if (request.equals(currentRequest)) { if (request.equals(sentRequest)) {
currentRequest = request;
setActivatedNodes(new org.openide.nodes.Node[]{currentRequest.getDataObject().getNodeDelegate()}); setActivatedNodes(new org.openide.nodes.Node[]{currentRequest.getDataObject().getNodeDelegate()});
setSceneInfo(currentRequest.getJmeNode(), editorController.getCurrentFileObject(), true); setSceneInfo(currentRequest.getJmeNode(), editorController.getCurrentFileObject(), true);
if (camController != null) { if (camController != null) {

@ -126,6 +126,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
TerrainToolController toolController; TerrainToolController toolController;
TerrainEditorController editorController; TerrainEditorController editorController;
private SceneRequest currentRequest; private SceneRequest currentRequest;
private SceneRequest sentRequest;
private boolean alreadyChoosing = false; // used for texture table selection private boolean alreadyChoosing = false; // used for texture table selection
private CreateTerrainWizardAction terrainWizard; private CreateTerrainWizardAction terrainWizard;
private SkyboxWizardAction skyboxWizard; private SkyboxWizardAction skyboxWizard;
@ -1006,7 +1007,7 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
editorController.cleanup(); editorController.cleanup();
} }
editorController = new TerrainEditorController(jmeNode, file, this); editorController = new TerrainEditorController(jmeNode, file, this);
this.currentRequest = request; this.sentRequest = request;
request.setWindowTitle("TerrainEditor - " + manager.getRelativeAssetPath(file.getPrimaryFile().getPath())); request.setWindowTitle("TerrainEditor - " + manager.getRelativeAssetPath(file.getPrimaryFile().getPath()));
request.setToolNode(new Node("TerrainEditorToolNode")); request.setToolNode(new Node("TerrainEditorToolNode"));
SceneApplication.getApplication().openScene(request); SceneApplication.getApplication().openScene(request);
@ -1019,7 +1020,8 @@ public final class TerrainEditorTopComponent extends TopComponent implements Sce
// runs on AWT thread now // runs on AWT thread now
public void sceneOpened(SceneRequest request) { 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()); Logger.getLogger(TerrainEditorTopComponent.class.getName()).finer("Terrain sceneRequested " + request.getWindowTitle());
setSceneInfo(currentRequest.getJmeNode(), true); setSceneInfo(currentRequest.getJmeNode(), true);

@ -39,6 +39,7 @@ public final class VehicleCreatorTopComponent extends TopComponent implements Sc
private static final String PREFERRED_ID = "VehicleCreatorTopComponent"; private static final String PREFERRED_ID = "VehicleCreatorTopComponent";
private VehicleEditorController editorController; private VehicleEditorController editorController;
private SceneRequest currentRequest; private SceneRequest currentRequest;
private SceneRequest sentRequest;
private boolean testing = false; private boolean testing = false;
DirectionalLight dirLight = new DirectionalLight(); DirectionalLight dirLight = new DirectionalLight();
private HelpCtx ctx = new HelpCtx("sdk.vehicle_creator"); 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); JmeNode node = NodeUtility.createNode(spatial, false);
editorController = new VehicleEditorController(node, file); editorController = new VehicleEditorController(node, file);
SceneApplication.getApplication().addSceneListener(this); SceneApplication.getApplication().addSceneListener(this);
currentRequest = new SceneRequest(this, node, file.getLookup().lookup(ProjectAssetManager.class)); sentRequest = new SceneRequest(this, node, file.getLookup().lookup(ProjectAssetManager.class));
currentRequest.setWindowTitle("Vehicle Creator"); sentRequest.setWindowTitle("Vehicle Creator");
currentRequest.setDataObject(file); sentRequest.setDataObject(file);
currentRequest.setToolNode(editorController.getToolsNode()); sentRequest.setToolNode(editorController.getToolsNode());
currentRequest.setHelpCtx(ctx); sentRequest.setHelpCtx(ctx);
SceneApplication.getApplication().openScene(currentRequest); SceneApplication.getApplication().openScene(sentRequest);
} }
public void previewCreated(PreviewRequest request) { public void previewCreated(PreviewRequest request) {
} }
public void sceneClosed(SceneRequest request) { public void sceneClosed(SceneRequest request) {
if (request == currentRequest) { if (request == sentRequest) {
currentRequest = request;
SceneApplication.getApplication().removeSceneListener(this); SceneApplication.getApplication().removeSceneListener(this);
editorController.cleanupApplication(); editorController.cleanupApplication();
setLoadedScene(null, false); setLoadedScene(null, false);

Loading…
Cancel
Save