Skip to content

Commit 835188f

Browse files
committed
edits / no file opening after saving
1 parent eb0845c commit 835188f

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/net/fexcraft/app/fmt/FMTB.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
public class FMTB implements FMTGLProcess {
6565

6666
public static final String deftitle = "Fexcraft Modelling Toolbox - %s";
67-
public static String version = "1.0.0-test";
67+
public static String version = "1.0.1-test";
6868
//
6969
private static String title;
7070
private boolean close;

src/net/fexcraft/app/fmt/porters/FVTMExporter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public String exportModel(GroupCompound compound, File file){
108108
if(wrapper.pos.xCoord != 0f || wrapper.pos.yCoord != 0f || wrapper.pos.zCoord != 0f ||
109109
wrapper.rot.xCoord != 0f || wrapper.rot.yCoord != 0f || wrapper.rot.zCoord != 0f){
110110
shape.append("\n" + tab3 + format(".setRotationPoint(%s, %s, %s)", wrapper.pos.xCoord, wrapper.pos.yCoord, wrapper.pos.zCoord));
111-
shape.append(format(".setRotationAngle(%s, %s, %s)", wrapper.rot.xCoord, wrapper.rot.yCoord, wrapper.rot.zCoord));
111+
shape.append(format(".setRotationAngle(%s, %s, %s)", Math.toRadians(wrapper.rot.xCoord), Math.toRadians(wrapper.rot.yCoord), Math.toRadians(wrapper.rot.zCoord)));
112112
extended = true;
113113
}
114114
if(wrapper.mirror || wrapper.flip){
@@ -142,6 +142,10 @@ public String exportModel(GroupCompound compound, File file){
142142
return "Success!";
143143
}
144144

145+
private String format(String string, double r0, double r1, double r2){
146+
return format(string, new float[]{ (float)r0, (float)r1, (float)r2});
147+
}
148+
145149
private String format(String string, float... arr){
146150
Object[] strs = new Object[arr.length];
147151
for(int i = 0; i < strs.length; i++){ strs[i] = arr[i] % 1.0f != 0 ? String.format("%s", arr[i]) + "f" : String.format("%.0f", arr[i]); }

src/net/fexcraft/app/fmt/ui/generic/Toolbar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ protected boolean processButtonClick(int x, int y, boolean left){
7575
this.elements.put("save", new Button(this, "save", 100, 26, 2, 58, subhover){
7676
@Override
7777
protected boolean processButtonClick(int x, int y, boolean left){
78-
SaveLoad.saveModel(false); return true;
78+
SaveLoad.saveModel(false, false); return true;
7979
}
8080
}.setText("Save", false));
8181
//
8282
this.elements.put("save_as", new Button(this, "save_as", 100, 26, 2, 86, subhover){
8383
@Override
8484
protected boolean processButtonClick(int x, int y, boolean left){
85-
SaveLoad.saveModel(true); return true;
85+
SaveLoad.saveModel(true, false); return true;
8686
}
8787
}.setText("Save As..", false));
8888
//

src/net/fexcraft/app/fmt/utils/SaveLoad.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void run(){
113113
//TODO add cancel;
114114
}
115115
else{
116-
saveModel(false); if(shouldclose){ FMTB.get().close(true); }
116+
saveModel(false, shouldclose); if(shouldclose){ FMTB.get().close(true); }
117117
}
118118
}
119119
}, new Runnable(){
@@ -201,7 +201,7 @@ public static void openNewModel(){
201201
FMTB.MODEL = new GroupCompound();
202202
}
203203

204-
public static void saveModel(boolean bool){
204+
public static void saveModel(boolean bool, boolean openfile){
205205
if(bool || FMTB.MODEL.file == null){
206206
FMTB.MODEL.file = getFile("Select save location.");
207207
}
@@ -233,7 +233,7 @@ public static void saveModel(boolean bool){
233233
}
234234
zipout.close(); fileout.close();
235235
Print.console("Saved model as FMTB Archive" + (arr.length > 1 ? " with texture." : "."));
236-
if(FMTB.MODEL.file.getParentFile() != null){
236+
if(openfile && FMTB.MODEL.file.getParentFile() != null){
237237
Desktop.getDesktop().open(FMTB.MODEL.file.getParentFile());
238238
}
239239
}

0 commit comments

Comments
 (0)