Exemple #1
0
  /** export vertices */
  public static void exportModel(Model model, File file) {
    if (model == null) {
      Logger.get().log(Level.WARNING, "Tried to export a null model");
      return;
    }

    if (file == null) {
      Logger.get().log(Level.WARNING, "Tried to export a model on a null file");
      return;
    }

    JSONObject json = new JSONObject();
    json.put("Name", model.getName());
    json.put("ModelParts", modelPartsToJSONArray(model.getParts()));
    JSONHelper.writeJSONObjectToFile(file, json);
  }
Exemple #2
0
  /** export blocks */
  public static void saveModelBuilder(ModelBuilder model, String filepath) {
    if (model == null) {
      Logger.get().log(Level.WARNING, "Tried to export a null model");
      return;
    }

    JSONObject json = new JSONObject();
    json.put("Name", model.getName());
    json.put("ModelParts", modelPartsBuilderToJSONArray(model.getParts()));
    JSONHelper.writeJSONObjectToFile(new File(filepath), json);
  }