Skip to content
Snippets Groups Projects
Commit 41614333 authored by Chris Foster's avatar Chris Foster
Browse files

- Punctuation characters are now stripped from symbol names and replaced with underscores.

parent 1d5be62e
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment