@@ -1245,6 +1245,13 @@ def export_object(obj, file_path, scene_props, export_scale=1.0):
1245
1245
f"Exporting { os .path .basename (export_filepath )} ({ fmt } ) - { mesh_size :,} polygons..."
1246
1246
)
1247
1247
1248
+ # Convert axis values for OBJ and STL export
1249
+ def convert_axis_for_export (axis_value ):
1250
+ """Convert axis values like '-Z' to 'NEGATIVE_Z' for OBJ/STL export."""
1251
+ if axis_value .startswith ('-' ):
1252
+ return f"NEGATIVE_{ axis_value [1 ]} "
1253
+ return axis_value
1254
+
1248
1255
with temp_selection_context (bpy .context , active_object = obj ,
1249
1256
selected_objects = [obj ]):
1250
1257
try :
@@ -1269,8 +1276,8 @@ def export_object(obj, file_path, scene_props, export_scale=1.0):
1269
1276
filepath = export_filepath ,
1270
1277
export_selected_objects = True ,
1271
1278
global_scale = export_scale , # Pass scale to exporter instead of applying to mesh
1272
- forward_axis = scene_props .mesh_export_coord_forward ,
1273
- up_axis = scene_props .mesh_export_coord_up ,
1279
+ forward_axis = convert_axis_for_export ( scene_props .mesh_export_coord_forward ) ,
1280
+ up_axis = convert_axis_for_export ( scene_props .mesh_export_coord_up ) ,
1274
1281
export_materials = True ,
1275
1282
path_mode = "STRIP" , # OBJ doesn't embed textures
1276
1283
export_normals = True ,
@@ -1323,9 +1330,9 @@ def export_object(obj, file_path, scene_props, export_scale=1.0):
1323
1330
filepath = export_filepath ,
1324
1331
selected_objects_only = True ,
1325
1332
export_global_forward_selection = (
1326
- scene_props .mesh_export_coord_forward ),
1333
+ convert_axis_for_export ( scene_props .mesh_export_coord_forward ) ),
1327
1334
export_global_up_selection = (
1328
- scene_props .mesh_export_coord_up ),
1335
+ convert_axis_for_export ( scene_props .mesh_export_coord_up ) ),
1329
1336
export_meshes = True ,
1330
1337
export_materials = True ,
1331
1338
export_normals = True ,
@@ -1344,8 +1351,8 @@ def export_object(obj, file_path, scene_props, export_scale=1.0):
1344
1351
filepath = export_filepath ,
1345
1352
export_selected_objects = True ,
1346
1353
global_scale = export_scale , # Pass scale to exporter instead of applying to mesh
1347
- forward_axis = scene_props .mesh_export_coord_forward ,
1348
- up_axis = scene_props .mesh_export_coord_up ,
1354
+ forward_axis = convert_axis_for_export ( scene_props .mesh_export_coord_forward ) ,
1355
+ up_axis = convert_axis_for_export ( scene_props .mesh_export_coord_up ) ,
1349
1356
apply_modifiers = False , # Handled by apply_mesh_modifiers
1350
1357
)
1351
1358
else :
0 commit comments