- make SceneComposer reload scene automatically on ClassPath change

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8632 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent c350e33214
commit 2df43b3baa
  1. 102
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerTopComponent.java

@ -70,7 +70,7 @@ public final class SceneComposerTopComponent extends TopComponent implements Sce
private SceneRequest sentRequest; 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;
public SceneComposerTopComponent() { public SceneComposerTopComponent() {
initComponents(); initComponents();
@ -912,62 +912,62 @@ private void scaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
toolController.refreshNonSpatialMarkers(); toolController.refreshNonSpatialMarkers();
editorController.setTerrainLodCamera(); editorController.setTerrainLodCamera();
// final SpatialAssetDataObject dobj = ((SpatialAssetDataObject) currentRequest.getDataObject()); final SpatialAssetDataObject dobj = ((SpatialAssetDataObject) currentRequest.getDataObject());
// listener = new ProjectAssetManager.ClassPathChangeListener() { listener = new ProjectAssetManager.ClassPathChangeListener() {
//
// public void classPathChanged(final ProjectAssetManager manager) { public void classPathChanged(final ProjectAssetManager manager) {
// if (dobj.isModified()) { if (dobj.isModified()) {
// Confirmation msg = new NotifyDescriptor.Confirmation( Confirmation msg = new NotifyDescriptor.Confirmation(
// "Classes have been changed, reload scene?", "Classes have been changed, reload scene?",
// NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_CANCEL_OPTION,
// NotifyDescriptor.ERROR_MESSAGE); NotifyDescriptor.ERROR_MESSAGE);
// Object result = DialogDisplayer.getDefault().notify(msg); Object result = DialogDisplayer.getDefault().notify(msg);
// if (!NotifyDescriptor.OK_OPTION.equals(result)) { if (!NotifyDescriptor.OK_OPTION.equals(result)) {
// return; return;
// } }
// } }
// Runnable call = new Runnable() { Runnable call = new Runnable() {
//
// public void run() { public void run() {
// ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Opening in SceneComposer"); ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Opening in SceneComposer");
// progressHandle.start(); progressHandle.start();
// try { try {
// manager.clearCache(); manager.clearCache();
// final Spatial asset = dobj.loadAsset(); final Spatial asset = dobj.loadAsset();
// if (asset != null) { if (asset != null) {
// java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
//
// public void run() { public void run() {
// SceneComposerTopComponent composer = SceneComposerTopComponent.findInstance(); SceneComposerTopComponent composer = SceneComposerTopComponent.findInstance();
// composer.openScene(asset, dobj, manager); composer.openScene(asset, dobj, manager);
// } }
// }); });
// } else { } else {
// Confirmation msg = new NotifyDescriptor.Confirmation( Confirmation msg = new NotifyDescriptor.Confirmation(
// "Error opening " + dobj.getPrimaryFile().getNameExt(), "Error opening " + dobj.getPrimaryFile().getNameExt(),
// NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_CANCEL_OPTION,
// NotifyDescriptor.ERROR_MESSAGE); NotifyDescriptor.ERROR_MESSAGE);
// DialogDisplayer.getDefault().notify(msg); DialogDisplayer.getDefault().notify(msg);
// } }
// } finally { } finally {
// progressHandle.finish(); progressHandle.finish();
// } }
// } }
// }; };
// new Thread(call).start(); new Thread(call).start();
// } }
// }; };
// currentRequest.getManager().addClassPathEventListener(listener); currentRequest.getManager().addClassPathEventListener(listener);
} }
} }
public void sceneClosed(SceneRequest request) { public void sceneClosed(SceneRequest request) {
if (request.equals(currentRequest)) { if (request.equals(currentRequest)) {
setActivatedNodes(new org.openide.nodes.Node[]{}); setActivatedNodes(new org.openide.nodes.Node[]{});
// if (currentRequest != null) { if (request != null) {
// currentRequest.getManager().removeClassPathEventListener(listener); request.getManager().removeClassPathEventListener(listener);
// listener = null; listener = null;
// } }
SceneApplication.getApplication().removeSceneListener(this); SceneApplication.getApplication().removeSceneListener(this);
currentRequest = null; currentRequest = null;
setSceneInfo(null, null, false); setSceneInfo(null, null, false);

Loading…
Cancel
Save