Revision: 35383
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35383
Author: campbellbarton
Date: 2011-03-07 08:01:38 +0000 (Mon, 07 Mar 2011)
Log Message:
-----------
PyAPI: allow subclasses of io_utils.ExportHelper to set when the extension is
enforced.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/io_utils.py
Modified: trunk/blender/release/scripts/modules/io_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/io_utils.py 2011-03-07 03:57:04 UTC
(rev 35382)
+++ trunk/blender/release/scripts/modules/io_utils.py 2011-03-07 08:01:38 UTC
(rev 35383)
@@ -25,6 +25,10 @@
class ExportHelper:
filepath = StringProperty(name="File Path", description="Filepath used for
exporting the file", maxlen=1024, default="", subtype='FILE_PATH')
check_existing = BoolProperty(name="Check Existing", description="Check
and warn on overwriting existing files", default=True, options={'HIDDEN'})
+
+ # subclasses can override with decorator
+ # True == use ext, False == no ext, None == do nothing.
+ check_extension = True
def invoke(self, context, event):
import os
@@ -41,14 +45,20 @@
return {'RUNNING_MODAL'}
def check(self, context):
- filepath = bpy.path.ensure_ext(self.filepath, self.filename_ext)
+ check_extension = self.check_extension
+
+ if check_extension is None:
+ return False
+
+ filepath = bpy.path.ensure_ext(self.filepath, self.filename_ext if
check_extension else "")
+
if filepath != self.filepath:
self.filepath = filepath
return True
- else:
- return False
+ return False
+
class ImportHelper:
filepath = StringProperty(name="File Path", description="Filepath used for
importing the file", maxlen=1024, default="", subtype='FILE_PATH')
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs