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, physbased or acg')
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 elif cmdArgs[0] == 'acg':
22 cmdArgs[0] = 'ambientCGLoaderCmd.py'
23 else:
24 print('Unknown command specified:', cmdArgs[0])
25 return 1
26
27 # Build the command
28 cmd = ' '.join(cmdArgs)
29 packageLocation = os.path.dirname(__file__)
30 cmd = 'python ' + packageLocation + '/' + cmd
31
32 # Run the command
33 return subprocess.call(cmd, shell=True)
34
35if __name__ == '__main__':
36 sys.exit(main())