|
26 | 26 | import net.fexcraft.app.fmt.ui.general.DialogBox; |
27 | 27 | import net.fexcraft.app.fmt.ui.general.NFC.AfterTask; |
28 | 28 | import net.fexcraft.app.fmt.ui.general.NFC.ChooserMode; |
| 29 | +import net.fexcraft.app.fmt.utils.Animator.Animation; |
29 | 30 | import net.fexcraft.app.fmt.utils.Settings.Setting; |
30 | 31 | import net.fexcraft.app.fmt.wrappers.GroupCompound; |
31 | 32 | import net.fexcraft.app.fmt.wrappers.PolygonWrapper; |
@@ -229,6 +230,24 @@ public static JsonObject modelToJTMT(GroupCompound root, boolean export){ |
229 | 230 | group.addProperty("texture_size_y", list.textureY); |
230 | 231 | group.addProperty("texture_scale", list.textureS); |
231 | 232 | } |
| 233 | + if(!list.animations.isEmpty()){ |
| 234 | + JsonArray animations = new JsonArray(); |
| 235 | + for(Animation ani : list.animations){ |
| 236 | + JsonObject jsn = new JsonObject(); |
| 237 | + jsn.addProperty("id", ani.id); |
| 238 | + JsonArray settings = new JsonArray(); |
| 239 | + for(Setting setting : ani.settings){ |
| 240 | + JsonObject sett = new JsonObject(); |
| 241 | + sett.addProperty("id", setting.getId()); |
| 242 | + sett.addProperty("type", setting.getType().name().toLowerCase()); |
| 243 | + sett.add("value", setting.save()); |
| 244 | + settings.add(sett); |
| 245 | + } |
| 246 | + jsn.add("settings", settings); |
| 247 | + animations.add(jsn); |
| 248 | + } |
| 249 | + group.add("animations", animations); |
| 250 | + } |
232 | 251 | } |
233 | 252 | group.addProperty("name", list.id); |
234 | 253 | for(PolygonWrapper wrapper : list){ |
@@ -320,6 +339,24 @@ public static GroupCompound getModel(File from, JsonObject obj, boolean ggr){ |
320 | 339 | JsonArray polygons = group.get("polygons").getAsJsonArray(); |
321 | 340 | for(JsonElement elm : polygons){ list.add(JsonToTMT.parseWrapper(compound, elm.getAsJsonObject())); } |
322 | 341 | compound.getCompound().put(entry.getKey(), list); |
| 342 | + if(group.has("animations")){ |
| 343 | + JsonArray arr = group.get("animations").getAsJsonArray(); |
| 344 | + for(JsonElement elm : arr){ |
| 345 | + JsonObject animjsn = elm.getAsJsonObject(); |
| 346 | + Animation anim = Animator.get(animjsn.get("id").getAsString()); |
| 347 | + JsonArray settin = animjsn.get("settings").getAsJsonArray(); |
| 348 | + for(JsonElement elm0 : settin){ |
| 349 | + JsonObject sett = elm0.getAsJsonObject(); |
| 350 | + Setting setting = new Setting(sett.get("type").getAsString(), sett.get("id").getAsString(), sett.get("value")); |
| 351 | + for(Setting satt : anim.settings){ |
| 352 | + if(satt.getId().equals(setting.getId()) && satt.getType() == setting.getType()){ |
| 353 | + satt.setValue(setting.getValue()); |
| 354 | + } |
| 355 | + } |
| 356 | + } |
| 357 | + list.animations.add(anim); |
| 358 | + } |
| 359 | + } |
323 | 360 | } |
324 | 361 | catch(Exception e){ |
325 | 362 | e.printStackTrace(); |
|
0 commit comments