DacWizard/src/main/java/jme3utilities/minie/wizard/TestMode.java
/**
     * Write the model to a file, along with a configured control.
     */
Write the model to a file, along with a configured control.
Write the model to a file along with a configured control .
private void saveJ3o() {
        Model model = DacWizard.getModel();
        String originalPath = model.filePath();
        File originalFile = new File(originalPath);
        String modelName = originalFile.getName();
        if (modelName.endsWith(".j3o")) {
            modelName = MyString.removeSuffix(modelName, ".j3o");
        }
        String hhmmss = hhmmss();
        String outputFileName = String.format("%s-%s.j3o", modelName, hhmmss);
        String outputFilePath = DacWizard.filePath(outputFileName);
        Spatial modelRoot = model.getRootSpatial();
        modelRoot = Heart.deepCopy(modelRoot);
        List<Spatial> list = MySpatial.listAnimationSpatials(modelRoot, null);
        assert list.size() == 1 : list.size();
        Spatial controlledSpatial = list.get(0);
        DynamicAnimControl dac = model.copyRagdoll();
        controlledSpatial.addControl(dac);
        JmeExporter exporter = BinaryExporter.getInstance();
        File outputFile = new File(outputFilePath);
        TestScreen screen = DacWizard.findAppState(TestScreen.class);
        try {
            exporter.save(modelRoot, outputFile);
        } catch (IOException exception) {
            screen.showInfoDialog("Exception", exception.toString());
            return;
        }
        /*
         * Display a confirmation dialog.
         */
        String message = String.format(
                "The model and configured control have been written to%n%s.",
                MyString.quote(outputFilePath));
        screen.showInfoDialog("Success", message);
    }
private void saveJ3o ( ) { Model model = DacWizard . getModel ( ) ; String originalPath = model . filePath ( ) ; File originalFile = new File ( originalPath ) ; String modelName = originalFile . getName ( ) ; if ( modelName . endsWith ( ".j3o" ) ) { modelName = MyString . removeSuffix ( modelName , ".j3o" ) ; } String hhmmss = hhmmss ( ) ; String outputFileName = String . format ( "%s-%s.j3o" , modelName , hhmmss ) ; String outputFilePath = DacWizard . filePath ( outputFileName ) ; Spatial modelRoot = model . getRootSpatial ( ) ; modelRoot = Heart . deepCopy ( modelRoot ) ; List < Spatial > list = MySpatial . listAnimationSpatials ( modelRoot , null ) ; assert list . size ( ) == 1 : list . size ( ) ; Spatial controlledSpatial = list . get ( 0 ) ; DynamicAnimControl dac = model . copyRagdoll ( ) ; controlledSpatial . addControl ( dac ) ; JmeExporter exporter = BinaryExporter . getInstance ( ) ; File outputFile = new File ( outputFilePath ) ; TestScreen screen = DacWizard . findAppState ( TestScreen . class ) ; try { exporter . save ( modelRoot , outputFile ) ; } catch ( IOException exception ) { screen . showInfoDialog ( "Exception" , exception . toString ( ) ) ; return ; } /*
         * Display a confirmation dialog.
         */ String message = String . format ( "The model and configured control have been written to%n%s." , MyString . quote ( outputFilePath ) ) ; screen . showInfoDialog ( "Success" , message ) ; }
Write the model to a file, along with a configured control.
Write the model to a file along with a configured control .