diff options
author | Chris Foster <cdbfoster@gmail.com> | 2011-05-03 13:26:37 +0400 |
---|---|---|
committer | Chris Foster <cdbfoster@gmail.com> | 2011-05-03 13:26:37 +0400 |
commit | 41614333968a199aabc270bc760bc8a9a9ae8b04 (patch) | |
tree | 138b76a1cf66593b92a844082f69d5cfd86225aa /io_export_directx_x.py | |
parent | 1d5be62ef22d9615d86c6baa34166abef59e3637 (diff) |
- Punctuation characters are now stripped from symbol names and replaced with underscores.
Diffstat (limited to 'io_export_directx_x.py')
-rw-r--r-- | io_export_directx_x.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/io_export_directx_x.py b/io_export_directx_x.py index c1e52f7e..64c25990 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -66,8 +66,15 @@ class DirectXExporterSettings: def LegalName(Name): - NewName = Name.replace(".", "_") - NewName = NewName.replace(" ", "_") + + def ReplaceSet(String, OldSet, NewChar): + for OldChar in OldSet: + String = String.replace(OldChar, NewChar) + return String + + import string + + NewName = ReplaceSet(Name, string.punctuation, "_") if NewName[0].isdigit() or NewName in ["ARRAY", "DWORD", "UCHAR", @@ -1199,10 +1206,8 @@ class DirectXExporter(bpy.types.Operator): Verbose = BoolProperty(name="Verbose", description="Run the exporter in debug mode. Check the console for output.", default=False) def execute(self, context): - #Append .x if needed - FilePath = self.filepath - if not FilePath.lower().endswith(".x"): - FilePath += ".x" + #Append .x + FilePath = os.path.splitext(self.filepath)[0] + ".x" Config = DirectXExporterSettings(context, FilePath, @@ -1243,4 +1248,4 @@ def unregister(): if __name__ == "__main__": - register() + register()
\ No newline at end of file |