}
public void buildScene() {
try {
clearConsole();
Timer t = new Timer();
t.start();
switch (sceneType) {
case JAVA:
api = SunflowAPI.compile(editorTextArea.getText());
break;
case SC: {
File tmpFile = File.createTempFile("jwf", ".sc");
try {
String filename = tmpFile.getAbsolutePath();
Tools.writeUTF8Textfile(filename, editorTextArea.getText());
String template = "import org.sunflow.core.*;\nimport org.sunflow.core.accel.*;\nimport org.sunflow.core.camera.*;\nimport org.sunflow.core.primitive.*;\nimport org.sunflow.core.shader.*;\nimport org.sunflow.image.Color;\nimport org.sunflow.math.*;\n\npublic void build() {\n include(\"" + filename.replace("\\", "\\\\") + "\");\n}\n";
api = SunflowAPI.compile(template);
}
finally {
tmpFile.deleteOnExit();
}
}
break;
}
if (currentFile != null) {
String dir = new File(currentFile).getAbsoluteFile().getParent();
api.searchpath("texture", dir);
api.searchpath("include", dir);
}
api.build();
t.end();
UI.printInfo(Module.GUI, "Build time: %s", t.toString());
enableControls();
}
catch (Throwable ex) {
api = null;
errorHandler.handleError(ex);