[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31308] trunk/blender/release/scripts/io: exporters now set the filepath in the invoke() method rather then the menu drawing function.
Campbell Barton
ideasman42 at gmail.com
Fri Aug 13 08:45:34 CEST 2010
Revision: 31308
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31308
Author: campbellbarton
Date: 2010-08-13 08:45:33 +0200 (Fri, 13 Aug 2010)
Log Message:
-----------
exporters now set the filepath in the invoke() method rather then the menu drawing function.
Modified Paths:
--------------
trunk/blender/release/scripts/io/export_3ds.py
trunk/blender/release/scripts/io/export_fbx.py
trunk/blender/release/scripts/io/export_mdd.py
trunk/blender/release/scripts/io/export_obj.py
trunk/blender/release/scripts/io/export_ply.py
trunk/blender/release/scripts/io/export_x3d.py
trunk/blender/release/scripts/io/import_scene_obj.py
Modified: trunk/blender/release/scripts/io/export_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/export_3ds.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/export_3ds.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -1114,13 +1114,13 @@
bl_idname = "export.autodesk_3ds"
bl_label = 'Export 3DS'
- # List of operator properties, the attributes will be assigned
- # to the class instance from the operator settings before calling.
-
-
filepath = StringProperty(name="File Path", description="Filepath used for exporting the 3DS file", maxlen= 1024, default= "")
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
+ @classmethod
+ def poll(cls, context): # Poll isnt working yet
+ return context.active_object != None
+
def execute(self, context):
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".3ds")
@@ -1129,23 +1129,23 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
- @classmethod
- def poll(cls, context): # Poll isnt working yet
- return context.active_object != None
# Add to a menu
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".3ds"
- self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)").filepath = default_path
+ self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
def register():
bpy.types.INFO_MT_file_export.append(menu_func)
+
def unregister():
bpy.types.INFO_MT_file_export.remove(menu_func)
Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/export_fbx.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -3404,8 +3404,11 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
@@ -3439,8 +3442,7 @@
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".fbx"
- self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)").filepath = default_path
+ self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)")
def register():
Modified: trunk/blender/release/scripts/io/export_mdd.py
===================================================================
--- trunk/blender/release/scripts/io/export_mdd.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/export_mdd.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -185,15 +185,16 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".mdd"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- import os
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".mdd"
- self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)").filepath = default_path
+ self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)")
def register():
Modified: trunk/blender/release/scripts/io/export_obj.py
===================================================================
--- trunk/blender/release/scripts/io/export_obj.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/export_obj.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -960,14 +960,16 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".obj"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".obj"
- self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)").filepath = default_path
+ self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)")
def register():
Modified: trunk/blender/release/scripts/io/export_ply.py
===================================================================
--- trunk/blender/release/scripts/io/export_ply.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/export_ply.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -293,8 +293,11 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".ply"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def draw(self, context):
@@ -310,9 +313,7 @@
def menu_func(self, context):
- import os
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".ply"
- self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)").filepath = default_path
+ self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)")
def register():
Modified: trunk/blender/release/scripts/io/export_x3d.py
===================================================================
--- trunk/blender/release/scripts/io/export_x3d.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/export_x3d.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -1205,14 +1205,16 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ import os
+ if not self.properties.is_property_set("filepath"):
+ self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
+
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- default_path = os.path.splitext(bpy.data.filepath)[0] + ".x3d"
- self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)").filepath = default_path
+ self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)")
def register():
Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_obj.py 2010-08-13 06:30:04 UTC (rev 31307)
+++ trunk/blender/release/scripts/io/import_scene_obj.py 2010-08-13 06:45:33 UTC (rev 31308)
@@ -1596,8 +1596,7 @@
return {'FINISHED'}
def invoke(self, context, event):
- wm = context.manager
- wm.add_fileselect(self)
+ context.manager.add_fileselect(self)
return {'RUNNING_MODAL'}
More information about the Bf-blender-cvs
mailing list