コード例 #1
0
ファイル: M2Exporter.java プロジェクト: merfed/mcapps
  /** Display a dialog which allows the user to export a scene to an OBJ file. */
  public static void exportFile(BFrame parent, Scene theScene) {
    // Display a dialog box with options on how to export the scene.

    // ValueField errorField = new ValueField(0.05, ValueField.POSITIVE);
    // final ValueField widthField = new ValueField(200.0, ValueField.INTEGER+ValueField.POSITIVE);
    // final ValueField heightField = new ValueField(200.0, ValueField.INTEGER+ValueField.POSITIVE);
    // final ValueSlider qualitySlider = new ValueSlider(0.0, 1.0, 100, 0.5);
    // final BCheckBox smoothBox = new BCheckBox(Translate.text("subdivideSmoothMeshes"), true);
    final BCheckBox injectChoice = new BCheckBox(Translate.text("Inject"), true);
    // final BCheckBox UVChoice = new BCheckBox(Translate.text("Export UV"), true);

    /*BComboBox exportChoice = new BComboBox(new String [] {
      Translate.text("exportWholeScene"),
      Translate.text("selectedObjectsOnly")
    });*/

    ComponentsDialog dlg;
    if (theScene.getSelection().length > 0)
      dlg =
          new ComponentsDialog(
              parent,
              Translate.text("InjectToM2"),
              new Widget[] {injectChoice},
              new String[] {null, null, null, null, null});
    else
      dlg =
          new ComponentsDialog(
              parent,
              Translate.text("exportToM2"),
              new Widget[] {injectChoice},
              new String[] {null, null, null, null});
    if (!dlg.clickedOk()) return;

    // Ask the user to select the output file.

    BFileChooser fc = new BFileChooser(BFileChooser.SAVE_FILE, Translate.text("exportToWMO"));
    fc.setSelectedFile(new File("Untitled.m2"));
    if (ArtOfIllusion.getCurrentDirectory() != null)
      fc.setDirectory(new File(ArtOfIllusion.getCurrentDirectory()));
    if (!fc.showDialog(parent)) return;
    File dir = fc.getDirectory();
    f = fc.getSelectedFile();
    String name = f.getName();
    String baseName = (name.endsWith(".m2") ? name.substring(0, name.length() - 3) : name);
    ArtOfIllusion.setCurrentDirectory(dir.getAbsolutePath());

    m2 obj = null;
    try {
      obj = new m2(fileLoader.openBuffer(f.getAbsolutePath()));
    } catch (InvalidClassException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    writeScene(theScene, obj, false, 0.05, false, injectChoice.getState());
  }
コード例 #2
0
ファイル: PageableScene.java プロジェクト: corewall/coretools
 public Selection getSelection() {
   return scene.getSelection();
 }