MaterialXMaterials 0.0.1
Utilities for retrieving materials from remote servers
Loading...
Searching...
No Matches
__main__.py
1import sys, os
2import subprocess
3
4def main() -> int:
5 '''
6 Main entry point for running commands in the package.
7 '''
8 argCount = len(sys.argv)
9 if argCount < 2:
10 print('No arguments provided. Use -h or --help for help.')
11 return 1
12 if sys.argv[1] == '-h' or sys.argv[1] == '--help':
13 print('Usage: python -m materialxMaterials <command> [options] where command is gpuopen or physbased')
14
15 # Check if the command is valid
16 cmdArgs = sys.argv[1:]
17 if cmdArgs[0] == 'physbased':
18 cmdArgs[0] = 'physicallyBasedMaterialXCmd.py'
19 elif cmdArgs[0] == 'gpuopen':
20 cmdArgs[0] = 'GPUOpenLoaderCmd.py'
21 else:
22 print('Unknown command specified:', cmdArgs[0])
23 return 1
24
25 # Build the command
26 cmd = ' '.join(cmdArgs)
27 packageLocation = os.path.dirname(__file__)
28 cmd = 'python ' + packageLocation + '/' + cmd
29
30 # Run the command
31 return subprocess.call(cmd, shell=True)
32
33if __name__ == '__main__':
34 sys.exit(main())