|
@@ -78,75 +78,65 @@ function args_run() {
|
|
|
}
|
|
|
|
|
|
if (args_export_textures) {
|
|
|
- if (args_export_textures_type == "png" ||
|
|
|
- args_export_textures_type == "jpg" ||
|
|
|
- args_export_textures_type == "exr16" ||
|
|
|
- args_export_textures_type == "exr32") {
|
|
|
- if (path_is_folder(args_export_textures_path)) {
|
|
|
- // Applying the correct format type from args
|
|
|
- if (args_export_textures_type == "png") {
|
|
|
- base_bits_handle.position = texture_bits_t.BITS8;
|
|
|
- context_raw.format_type = texture_ldr_format_t.PNG;
|
|
|
- }
|
|
|
- else if (args_export_textures_type == "jpg") {
|
|
|
- base_bits_handle.position = texture_bits_t.BITS8;
|
|
|
- context_raw.format_type = texture_ldr_format_t.JPG;
|
|
|
- }
|
|
|
- else if (args_export_textures_type == "exr16") {
|
|
|
- base_bits_handle.position = texture_bits_t.BITS16;
|
|
|
- }
|
|
|
- else if (args_export_textures_type == "exr32") {
|
|
|
- base_bits_handle.position = texture_bits_t.BITS32;
|
|
|
- }
|
|
|
-
|
|
|
- context_raw.layers_export = export_mode_t.VISIBLE;
|
|
|
-
|
|
|
- // Get export preset and apply the correct one from args
|
|
|
- box_export_files = file_read_directory(path_data() + path_sep + "export_presets");
|
|
|
- for (let i: i32 = 0; i < box_export_files.length; ++i) {
|
|
|
- let s: string = box_export_files[i];
|
|
|
- box_export_files[i] = substring(s, 0, s.length - 5); // Strip .json
|
|
|
- }
|
|
|
-
|
|
|
- let file: string = "export_presets/" + box_export_files[0] + ".json";
|
|
|
- for (let i: i32 = 0; i < box_export_files.length; ++i) {
|
|
|
- let f: string = box_export_files[i];
|
|
|
- if (f == args_export_textures_preset) {
|
|
|
- file = "export_presets/" + box_export_files[array_index_of(box_export_files, f)] + ".json";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- let blob: buffer_t = data_get_blob(file);
|
|
|
- box_export_preset = json_parse(sys_buffer_to_string(blob));
|
|
|
- data_delete_blob("export_presets/" + file);
|
|
|
+ if (!path_is_folder(args_export_textures_path)) {
|
|
|
+ iron_log(tr("Invalid export directory"));
|
|
|
+ }
|
|
|
|
|
|
- // Export queue
|
|
|
- sys_notify_on_next_frame(function () {
|
|
|
- export_texture_run(args_export_textures_path);
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- iron_log(tr("Invalid export directory"));
|
|
|
- }
|
|
|
+ if (args_export_textures_type == "png") {
|
|
|
+ base_bits_handle.position = texture_bits_t.BITS8;
|
|
|
+ context_raw.format_type = texture_ldr_format_t.PNG;
|
|
|
+ }
|
|
|
+ else if (args_export_textures_type == "jpg") {
|
|
|
+ base_bits_handle.position = texture_bits_t.BITS8;
|
|
|
+ context_raw.format_type = texture_ldr_format_t.JPG;
|
|
|
+ }
|
|
|
+ else if (args_export_textures_type == "exr16") {
|
|
|
+ base_bits_handle.position = texture_bits_t.BITS16;
|
|
|
+ }
|
|
|
+ else if (args_export_textures_type == "exr32") {
|
|
|
+ base_bits_handle.position = texture_bits_t.BITS32;
|
|
|
}
|
|
|
else {
|
|
|
iron_log(tr("Invalid texture type"));
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- else if (args_export_mesh) {
|
|
|
- if (path_is_folder(args_export_mesh_path)) {
|
|
|
- let f: string = ui_files_filename;
|
|
|
- if (f == "") {
|
|
|
- f = tr("untitled");
|
|
|
+ context_raw.layers_export = export_mode_t.VISIBLE;
|
|
|
+
|
|
|
+ // Get export preset and apply the correct one from args
|
|
|
+ box_export_files = file_read_directory(path_data() + path_sep + "export_presets");
|
|
|
+ for (let i: i32 = 0; i < box_export_files.length; ++i) {
|
|
|
+ let s: string = box_export_files[i];
|
|
|
+ box_export_files[i] = substring(s, 0, s.length - 5); // Strip .json
|
|
|
+ }
|
|
|
+
|
|
|
+ let file: string = "export_presets/" + box_export_files[0] + ".json";
|
|
|
+ for (let i: i32 = 0; i < box_export_files.length; ++i) {
|
|
|
+ let f: string = box_export_files[i];
|
|
|
+ if (f == args_export_textures_preset) {
|
|
|
+ file = "export_presets/" + box_export_files[array_index_of(box_export_files, f)] + ".json";
|
|
|
}
|
|
|
- export_mesh_run(args_export_mesh_path + path_sep + f, null, false);
|
|
|
}
|
|
|
- else {
|
|
|
+
|
|
|
+ let blob: buffer_t = data_get_blob(file);
|
|
|
+ box_export_preset = json_parse(sys_buffer_to_string(blob));
|
|
|
+ data_delete_blob("export_presets/" + file);
|
|
|
+
|
|
|
+ // Export queue
|
|
|
+ sys_notify_on_next_frame(function () {
|
|
|
+ export_texture_run(args_export_textures_path);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if (args_export_mesh) {
|
|
|
+ if (!path_is_folder(args_export_mesh_path)) {
|
|
|
iron_log(tr("Invalid export directory"));
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ let f: string = ui_files_filename;
|
|
|
+ if (f == "") {
|
|
|
+ f = tr("untitled");
|
|
|
+ }
|
|
|
+ export_mesh_run(args_export_mesh_path + path_sep + f, null, false);
|
|
|
+ }
|
|
|
else if (args_export_material) {
|
|
|
context_raw.write_icon_on_export = true;
|
|
|
export_arm_run_material(args_export_material_path);
|