blend import fixes

This commit is contained in:
luboslenco
2025-08-18 23:02:17 +02:00
parent 663976fadc
commit 857fae2e7d
+4 -8
View File
@@ -25,26 +25,22 @@ function import_blend_mesh_ui() {
}
function import_blend_mesh_run(path: string, replace_existing: bool = true) {
if (config_raw.blender == null || config_raw.blender == "") {
console_error(tr("Blender executable path not set"));
return;
}
let save: string = "tmp.obj";
let bpy_folder: string = "data/";
if (path_is_protected()) {
save = iron_internal_save_path() + "data/" + save;
save = iron_internal_save_path() + save;
bpy_folder = "";
}
///if arm_windows
path = string_replace_all(path, "\\", "\\\\");
save = string_replace_all(save, "\\", "\\\\");
///end
// Have to use ; instead of \n on windows
let py: string = "\
import bpy;\
bpy.ops.wm.obj_export(filepath='data/" + save + "',export_triangulated_mesh=True,export_materials=False,check_existing=False)";
bpy.ops.wm.obj_export(filepath='" + bpy_folder + string_replace_all(save, "\\", "/") + "',export_triangulated_mesh=True,export_materials=False,check_existing=False)";
let bl: string = string_replace_all(config_raw.blender, " ", "\\ ");
iron_sys_command(bl + " \"" + path + "\" -b --python-expr \"" + py + "\"");