Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

49 wiersze
1.5 KiB

  1. #!/usr/bin/env python
  2. #-*- coding: UTF-8 -*-
  3. """
  4. This module uses the sample.py script to load all test models it finds.
  5. Note: this is not an exhaustive test suite, it does not check the
  6. data structures in detail. It just verifies whether basic
  7. loading and querying of 3d models using pyassimp works.
  8. """
  9. import sys,os
  10. import sample
  11. from pyassimp import errors
  12. # paths to be walkd recursively
  13. basepaths = [os.path.join('..','..','..','test','models'), os.path.join('..','..','..','test','models-nonbsd')]
  14. # file extensions to be considered
  15. extensions = ['.3ds','.x','.lwo','.obj','.md5mesh','.dxf','.ply','.stl','.dae','.md5anim','.lws','.irrmesh','.nff','.off','.blend']
  16. def run_tests():
  17. ok,err = 0,0
  18. for path in basepaths:
  19. print("Looking for models in %s..." % path)
  20. for root, dirs, files in os.walk(path):
  21. for afile in files:
  22. base,ext = os.path.splitext(afile)
  23. if ext in extensions:
  24. try:
  25. sample.main(os.path.join(root,afile))
  26. ok += 1
  27. except errors.AssimpError as error:
  28. # assimp error is fine, this is a controlled case
  29. print error
  30. err += 1
  31. except Exception:
  32. print("Error encountered while loading <%s>"%os.path.join(root,afile))
  33. print('** Loaded %s models, got controlled errors for %s files' % (ok,err))
  34. if __name__ == '__main__':
  35. run_tests()