- 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() {
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;
}
});
}
});
}

@ -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) {

@ -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);

@ -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);

Loading…
Cancel
Save