|
|
@ -644,53 +644,53 @@ public class SceneEditorController implements PropertyChangeListener, NodeListen |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void addModel(final Spatial file) { |
|
|
|
// public void addModel(final Spatial file) {
|
|
|
|
addModel(file, null); |
|
|
|
// addModel(file, null);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void addModel(final Spatial file, final Vector3f location) { |
|
|
|
// public void addModel(final Spatial file, final Vector3f location) {
|
|
|
|
if (selectedSpat == null) { |
|
|
|
// if (selectedSpat == null) {
|
|
|
|
return; |
|
|
|
// return;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
final Node selected = selectedSpat.getLookup().lookup(Node.class); |
|
|
|
// final Node selected = selectedSpat.getLookup().lookup(Node.class);
|
|
|
|
if (selected != null) { |
|
|
|
// if (selected != null) {
|
|
|
|
setNeedsSave(true); |
|
|
|
// setNeedsSave(true);
|
|
|
|
SceneApplication.getApplication().enqueue(new Callable<Object>() { |
|
|
|
// SceneApplication.getApplication().enqueue(new Callable<Object>() {
|
|
|
|
|
|
|
|
//
|
|
|
|
public Object call() throws Exception { |
|
|
|
// public Object call() throws Exception {
|
|
|
|
doAddModel(file, selected, location); |
|
|
|
// doAddModel(file, selected, location);
|
|
|
|
return null; |
|
|
|
// return null;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
displayInfo("Please select a Node to attach to\nin the SceneExplorer."); |
|
|
|
// displayInfo("Please select a Node to attach to\nin the SceneExplorer.");
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
public void doAddModel(Spatial file, Node selected, Vector3f location) { |
|
|
|
// public void doAddModel(Spatial file, Node selected, Vector3f location) {
|
|
|
|
ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Adding Model.."); |
|
|
|
// ProgressHandle progressHandle = ProgressHandleFactory.createHandle("Adding Model..");
|
|
|
|
progressHandle.start(); |
|
|
|
// progressHandle.start();
|
|
|
|
try { |
|
|
|
// try {
|
|
|
|
if (file != null) { |
|
|
|
// if (file != null) {
|
|
|
|
selected.attachChild(file); |
|
|
|
// selected.attachChild(file);
|
|
|
|
if (location != null) { |
|
|
|
// if (location != null) {
|
|
|
|
Vector3f localVec = new Vector3f(); |
|
|
|
// Vector3f localVec = new Vector3f();
|
|
|
|
selected.worldToLocal(location, localVec); |
|
|
|
// selected.worldToLocal(location, localVec);
|
|
|
|
file.setLocalTranslation(localVec); |
|
|
|
// file.setLocalTranslation(localVec);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
refreshSelected(); |
|
|
|
// refreshSelected();
|
|
|
|
addSpatialUndo(selected, file, null, jmeRootNode); |
|
|
|
// addSpatialUndo(selected, file, null, jmeRootNode);
|
|
|
|
} catch (Exception ex) { |
|
|
|
// } catch (Exception ex) {
|
|
|
|
Confirmation msg = new NotifyDescriptor.Confirmation( |
|
|
|
// Confirmation msg = new NotifyDescriptor.Confirmation(
|
|
|
|
"Error importing " + file.getName() + "\n" + ex.toString(), |
|
|
|
// "Error importing " + file.getName() + "\n" + ex.toString(),
|
|
|
|
NotifyDescriptor.OK_CANCEL_OPTION, |
|
|
|
// NotifyDescriptor.OK_CANCEL_OPTION,
|
|
|
|
NotifyDescriptor.ERROR_MESSAGE); |
|
|
|
// NotifyDescriptor.ERROR_MESSAGE);
|
|
|
|
DialogDisplayer.getDefault().notifyLater(msg); |
|
|
|
// DialogDisplayer.getDefault().notifyLater(msg);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
progressHandle.finish(); |
|
|
|
// progressHandle.finish();
|
|
|
|
|
|
|
|
//
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public void setNeedsSave(boolean state) { |
|
|
|
public void setNeedsSave(boolean state) { |
|
|
|
currentFileObject.setModified(state); |
|
|
|
currentFileObject.setModified(state); |
|
|
|