Commit 565a0a1d authored by legoc's avatar legoc

Saving partial viewer files

parent 258f6e75
......@@ -268,27 +268,31 @@ public class EditorMenuBar extends MenuBar {
saveViewerItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (Nomad3DEditor.getInstance().getModel() != null) {
if (Nomad3DEditor.getInstance().getModel() == null) {
return;
}
String componentName = Nomad3DEditor.getInstance().getModel().getDisplayedRoot().getName();
// Choose a file.
FileChooser chooser = new FileChooser();
chooser.setInitialFileName(componentName + "-viewer.xml");
chooser.setInitialDirectory(new File(Nomad3DEditor.getInstance().getModel().getDirectoryPath()));
chooser.setTitle("Save Current View");
chooser.getExtensionFilters().addAll(new ExtensionFilter("XML files", "*.xml"));
File selectedFile = chooser.showSaveDialog(null);
if (selectedFile != null) {
// Choose a file.
FileChooser chooser = new FileChooser();
chooser.setInitialFileName(Nomad3DEditor.getInstance().getModel().getName() + "-viewer.xml");
chooser.setInitialDirectory(new File(Nomad3DEditor.getInstance().getModel().getDirectoryPath()));
chooser.setTitle("Save Current View");
chooser.getExtensionFilters().addAll(new ExtensionFilter("XML files", "*.xml"));
File selectedFile = chooser.showSaveDialog(null);
System.out.println("Selected file : " + selectedFile);
if (selectedFile != null) {
System.out.println("Selected file : " + selectedFile);
// Reset the mergeable components.
Nomad3DEditor.getInstance().getModel().getRoot().setMergeable();
// Save the viewer file.
Nomad3DExporter exporter = new Nomad3DExporter();
exporter.writeForViewer(Nomad3DEditor.getInstance().getModel(), hideBBDiagonal, selectedFile);
}
// Reset the mergeable components.
Nomad3DEditor.getInstance().getModel().getRoot().setMergeable();
// Save the viewer file.
Nomad3DExporter exporter = new Nomad3DExporter();
exporter.writeForViewer(Nomad3DEditor.getInstance().getModel().getDisplayedRoot(), hideBBDiagonal, selectedFile);
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment