diff --git a/io_anim_camera.py b/io_anim_camera.py index d50fce1fa81f60739e8e60d485ccfe643dfc6a2a..1f1b51ab1a37b8c2a453086d0573848d8c934054 100644 --- a/io_anim_camera.py +++ b/io_anim_camera.py @@ -146,7 +146,8 @@ class CameraExporter(bpy.types.Operator): def menu_export(self, context): - default_path = bpy.data.filepath.replace(".blend", ".py") + import os + default_path = os.path.splitext(bpy.data.filepath)[0] + ".py" self.layout.operator(CameraExporter.bl_idname, text="Cameras & Markers (.py)").filepath = default_path diff --git a/io_export_directx_x.py b/io_export_directx_x.py index 8b41f01cdf20008910dafb834a076c9f41fe8e0f..40c1c931b67d1b511adfeb51cddcd77961220f95 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -1038,9 +1038,7 @@ class DirectXExporter(bpy.types.Operator): def menu_func(self, context): - DefaultPath = bpy.data.filepath - if DefaultPath.endswith(".blend"): - DefaultPath = DefaultPath[:-6] + ".x" + DefaultPath = os.path.splitext(bpy.data.filepath)[0] + ".x" self.layout.operator(DirectXExporter.bl_idname, text="DirectX (.x)").filepath = DefaultPath diff --git a/io_export_unreal_psk_psa.py b/io_export_unreal_psk_psa.py index 81cdcf02878f5342a24551050695160e535b4065..a49ad5216e7388c0238cb9883a7536a240198927 100644 --- a/io_export_unreal_psk_psa.py +++ b/io_export_unreal_psk_psa.py @@ -1510,7 +1510,7 @@ class ExportUDKAnimData(bpy.types.Operator): def menu_func(self, context): bpy.context.scene.unrealexportpsk = True bpy.context.scene.unrealexportpsa = True - default_path = bpy.data.filepath.replace(".blend", ".psk") + default_path = os.path.splitext(bpy.data.filepath)[0] + ".psk" self.layout.operator("export.udk_anim_data", text="Skeleton Mesh / Animation Data (.psk/.psa)").filepath = default_path @@ -1521,7 +1521,7 @@ class VIEW3D_PT_unrealtools_objectmode(bpy.types.Panel): def poll(self, context): return context.active_object - + def draw(self, context): layout = self.layout #layout.label(text="Unreal Tools") @@ -1575,8 +1575,8 @@ class OBJECT_OT_UnrealExport(bpy.types.Operator): bpy.context.scene.unrealexportpsk = True bpy.context.scene.unrealexportpsa = True print("Exporting ALL...") - default_path = bpy.data.filepath.replace(".blend", ".psk") - print(dir(bpy.data.filepath)) + + default_path = os.path.splitext(bpy.data.filepath)[0] + ".psk" fs_callback(default_path, bpy.context, False) #self.report({'WARNING', 'INFO'}, exportmessage) @@ -1590,7 +1590,7 @@ def register(): bpy.types.register(VIEW3D_PT_unrealtools_objectmode) bpy.types.register(ExportUDKAnimData) bpy.types.INFO_MT_file_export.append(menu_func) - + def unregister(): global MENUPANELBOOL if MENUPANELBOOL: diff --git a/io_mesh_raw/__init__.py b/io_mesh_raw/__init__.py index 8a1569bca7ffadf85f58282fb05c344f854f8fdd..1af09c9fe015b90018cfa3ba51ebe90c211a2cc2 100644 --- a/io_mesh_raw/__init__.py +++ b/io_mesh_raw/__init__.py @@ -40,7 +40,8 @@ def menu_import(self, context): def menu_export(self, context): from io_mesh_raw import export_raw - default_path = bpy.data.filepath.replace(".blend", ".raw") + import os + default_path = os.path.splitext(bpy.data.filepath)[0] + ".raw" self.layout.operator(export_raw.RawExporter.bl_idname, text="Raw Faces (.raw)").filepath = default_path diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py index b671dd9ec13c37018173c1a2f3a86002e2f04e57..1858c17bcb7e7b51c2f6c31502a6f9932fe183bb 100644 --- a/io_mesh_stl/__init__.py +++ b/io_mesh_stl/__init__.py @@ -128,7 +128,8 @@ def menu_import(self, context): def menu_export(self, context): - default_path = bpy.data.filepath.replace(".blend", ".stl") + import os + default_path = os.path.splitext(bpy.data.filepath)[0] + ".stl" self.layout.operator(StlExporter.bl_idname, text="Stl (.stl)").filepath = default_path