Browse Source

Merge pull request #5162 from feuerste/py_available_formats

[pyassimp] Replace static list of file extensions with the actually supported ones.
Kim Kulling 2 years ago
parent
commit
5770faac10
2 changed files with 13 additions and 41 deletions
  1. 13 0
      port/PyAssimp/pyassimp/core.py
  2. 0 41
      port/PyAssimp/pyassimp/formats.py

+ 13 - 0
port/PyAssimp/pyassimp/core.py

@@ -391,6 +391,19 @@ def export_blob(scene,
         raise AssimpError('Could not export scene to blob!')
     return exportBlobPtr
 
+def available_formats():
+    """
+    Return a list of file format extensions supported to import.
+
+    Returns
+    ---------
+    A list of upper-case file extensions, e.g. [3DS, OBJ]
+    """
+    from ctypes import byref
+    extension_list = structs.String()
+    _assimp_lib.dll.aiGetExtensionList(byref(extension_list))
+    return [e[2:].upper() for e in str(extension_list.data, sys.getfilesystemencoding()).split(";")]
+
 def _finalize_texture(tex, target):
     setattr(target, "achformathint", tex.achFormatHint)
     if numpy:

+ 0 - 41
port/PyAssimp/pyassimp/formats.py

@@ -1,41 +0,0 @@
-FORMATS = ["CSM", 
-            "LWS", 
-            "B3D", 
-            "COB", 
-            "PLY", 
-            "IFC", 
-            "OFF", 
-            "SMD", 
-            "IRRMESH", 
-            "3D", 
-            "DAE", 
-            "MDL", 
-            "HMP", 
-            "TER", 
-            "WRL", 
-            "XML", 
-            "NFF", 
-            "AC", 
-            "OBJ", 
-            "3DS", 
-            "STL", 
-            "IRR", 
-            "Q3O",
-            "Q3D",
-            "MS3D", 
-            "Q3S", 
-            "ZGL", 
-            "MD2", 
-            "X", 
-            "BLEND", 
-            "XGL", 
-            "MD5MESH", 
-            "MAX", 
-            "LXO", 
-            "DXF", 
-            "BVH", 
-            "LWO",
-            "NDO"]
-
-def available_formats():
-    return FORMATS