Commit 030946aa authored by legoc's avatar legoc
Browse files

Starting with operations

parent d570a938
......@@ -13,6 +13,7 @@ import fr.ill.ics.n3d.io.Nomad3DImporter;
import fr.ill.ics.n3d.link.NomadLinker;
import fr.ill.ics.n3d.model.Component;
import fr.ill.ics.n3d.model.Model;
import fr.ill.ics.n3d.operations.OperationsSerializer;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
......@@ -303,10 +304,15 @@ public class Nomad3DEditor extends Application {
n3dImporter.read();
}
n3dImporter.readEdition();
//n3dImporter.readEdition();
if (n3dImporter.getModel().getRoot() != null) {
model = n3dImporter.getModel();
// Read the operations.
OperationsSerializer serializer = new OperationsSerializer();
serializer.read(model);
} else {
// No model loaded
return null;
......
......@@ -18,6 +18,8 @@ import fr.ill.ics.n3d.link.Nomad3DController;
import fr.ill.ics.n3d.link.NomadLinker;
import fr.ill.ics.n3d.model.Axis;
import fr.ill.ics.n3d.model.Axis.Type;
import fr.ill.ics.n3d.operations.Operations;
import fr.ill.ics.n3d.operations.OperationsSerializer;
import fr.ill.ics.n3d.model.Component;
import fr.ill.ics.n3d.model.ConfigParams;
import javafx.application.Platform;
......@@ -155,8 +157,10 @@ public class EditorMenuBar extends MenuBar {
@Override
public void handle(ActionEvent event) {
if (Nomad3DEditor.getInstance().getModel() != null) {
Nomad3DExporter exporter = new Nomad3DExporter();
exporter.writeEdition(Nomad3DEditor.getInstance().getModel());
// Serialize the operations.
OperationsSerializer serializer = new OperationsSerializer();
serializer.write(Nomad3DEditor.getInstance().getModel());
}
}
});
......@@ -822,7 +826,12 @@ public class EditorMenuBar extends MenuBar {
newMaterial.setSpecularPower(Double.parseDouble(shininessField.getText()));
for (Component selectedComp : Nomad3DEditor.getInstance().getModel().getSelection()) {
selectedComp.setMaterial(newMaterial, true);
// Set the new material without setting the children.
selectedComp.setMaterial(newMaterial, false);
// Save the operation.
Operations.getInstance().addMaterialOperation(newMaterial, selectedComp.getName());
}
Nomad3DEditor.getInstance().getModel().clearSelection();
......
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