aboutsummaryrefslogtreecommitdiff
path: root/Core/Scripts/System/ART_StripFbxNamespace.py
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Scripts/System/ART_StripFbxNamespace.py')
-rw-r--r--Core/Scripts/System/ART_StripFbxNamespace.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/Core/Scripts/System/ART_StripFbxNamespace.py b/Core/Scripts/System/ART_StripFbxNamespace.py
new file mode 100644
index 0000000..f223c58
--- /dev/null
+++ b/Core/Scripts/System/ART_StripFbxNamespace.py
@@ -0,0 +1,40 @@
+import sys
+import maya.standalone as std
+std.initialize(name = 'python')
+import maya.cmds as cmds
+import maya.mel as mel
+filename = sys.argv[1]
+
+def stripNamespace(filename):
+
+ try:
+ #open the file
+ cmds.loadPlugin("fbxmaya.mll")
+ string = "FBXImportMode -v \"add\";"
+ string += "FBXImport -file \"" + filename + "\""
+ string += "FBXImportFillTimeline -v true"
+ mel.eval(string)
+
+
+ #remove the namespace
+ cmds.namespace(setNamespace = "::")
+ currentNamespaces = cmds.namespaceInfo(listOnlyNamespaces = True)
+
+ restricted = ['UI', 'shared']
+
+ for namespace in currentNamespaces:
+ if namespace not in restricted:
+ cmds.namespace(mv = (':' + namespace, ':'), force = True)
+ cmds.namespace(removeNamespace = namespace)
+
+ #re-export the file
+ mel.eval("FBXExport -f \""+ filename +"\"")
+
+ #exit
+ std.uninitialize()
+
+ except Exception, e:
+ sys.stderr.write(str(e))
+ sys.exit(-1)
+
+stripNamespace(filename) \ No newline at end of file