@@ -631,9 +631,38 @@ protected Object doInBackground() throws Exception {
631
631
632
632
// ---------------
633
633
634
+ // add bitmap slices exporter
635
+ FieldSet slicesExporter = new FieldSet ("slices_format" , "Sliced model (png/gif)" );
636
+ // add information for the exporter
637
+ LabelModule slicesInfo = new LabelModule ("Info: Generates series of bitmap images. Each image corresponds to "
638
+ + "cross-section of visible voxels at each coordinate of selected axis.\n Important: Can generate a large "
639
+ + "number of files!" );
640
+ slicesExporter .addComponent (slicesInfo );
641
+ slicesExporter .addComponent (new SeparatorModule ("Slice Along" ));
642
+ slicesExporter .addComponent (new SeparatorModule ("Slice Along" ));
643
+ ComboBoxModule sliceAxis = new ComboBoxModule ("axis" , new String [][]{
644
+ new String []{"x" , "x-axis" },
645
+ new String []{"y" , "y-axis" },
646
+ new String []{"z" , "z-axis" }
647
+ }, 0 );
648
+ slicesExporter .addComponent (sliceAxis );
649
+
650
+ slicesExporter .addComponent (new SeparatorModule ("Output Format" ));
651
+ ComboBoxModule formatSelect = new ComboBoxModule ("export_format" , new String [][]{
652
+ new String []{"png" , "*.png" },
653
+ new String []{"gif" , "*.gif" },
654
+ }, 0 );
655
+ slicesExporter .addComponent (formatSelect );
656
+ slicesExporter .addComponent (new SeparatorModule ("Misc" ));
657
+ slicesExporter .addComponent (new CheckBoxModule ("invert" , "Invert direction" , false ));
658
+ LabelModule invertInfo = new LabelModule ("This option effectively inverts order of the numbers in file names." );
659
+ slicesExporter .addComponent (invertInfo );
660
+
661
+ // ---------------
662
+
634
663
// add all formats
635
664
dialog .addComboBox ("export_type" , new FieldSet [] {
636
- collada , magicaVoxelExporter , voxVoxLapExporter , kv6Exporter , pnxExporter , qbExporter , imageRenderer
665
+ collada , magicaVoxelExporter , voxVoxLapExporter , kv6Exporter , pnxExporter , qbExporter , slicesExporter , imageRenderer
637
666
}, 0 );
638
667
639
668
// ---------------
@@ -1112,6 +1141,49 @@ protected Object doInBackground() throws Exception {
1112
1141
1113
1142
// ===========
1114
1143
}
1144
+ else if (dialog .is ("export_type=slices_format" )) {
1145
+
1146
+ // ===========
1147
+ // -- handle sliced file format
1148
+
1149
+ // create progress dialog
1150
+ final ProgressDialog progressDialog = new ProgressDialog (frame );
1151
+
1152
+ // do the exporting
1153
+ progressDialog .start (new ProgressWorker () {
1154
+ @ Override
1155
+ protected Object doInBackground () {
1156
+
1157
+ final File exportTo = new File (baseName );
1158
+
1159
+ // export sliced files format
1160
+ boolean success ;
1161
+ long time = System .currentTimeMillis ();
1162
+ try {
1163
+ SlicesExporter exporter = new SlicesExporter (exportTo , data , progressDialog , console );
1164
+ exporter .setSliceDirection (dialog .getValue ("slices_format.axis" ));
1165
+ exporter .setExportFormat (dialog .getValue ("slices_format.export_format" ));
1166
+ exporter .setInvertOrder (dialog .is ("slices_format.invert=true" ));
1167
+
1168
+ success = exporter .generateImages ();
1169
+ } catch (IOException ignored ) {
1170
+ success = false ;
1171
+ }
1172
+ if (success ) {
1173
+ console .addLine (
1174
+ String .format (langSelector .getString ("export_file_successful" ),
1175
+ System .currentTimeMillis () - time )
1176
+ );
1177
+ } else {
1178
+ console .addLine (langSelector .getString ("export_file_error" ));
1179
+ }
1180
+
1181
+ return null ;
1182
+ }
1183
+ });
1184
+
1185
+ // ===========
1186
+ }
1115
1187
// -----
1116
1188
// store serialization
1117
1189
preferences .storeObject ("export_dialog_serialization" , dialog .getSerialization ());
0 commit comments