6 Main entry point for running commands in the package.
8 argCount = len(sys.argv)
10 print(
'No arguments provided. Use -h or --help for help.')
12 if sys.argv[1] ==
'-h' or sys.argv[1] ==
'--help':
13 print(
'Usage: python -m materialxMaterials <command> [options] where command is gpuopen, physbased, acg (AmbientCG), or polyhaven')
17 cmdArgs = sys.argv[1:]
18 if cmdArgs[0] ==
'physbased':
19 cmdArgs[0] =
'physicallyBasedMaterialXCmd.py'
20 elif cmdArgs[0] ==
'gpuopen':
21 cmdArgs[0] =
'GPUOpenLoaderCmd.py'
22 elif cmdArgs[0] ==
'acg':
23 cmdArgs[0] =
'ambientCGLoaderCmd.py'
24 elif cmdArgs[0] ==
'polyhaven':
25 cmdArgs[0] =
'polyHavenLoaderCmd.py'
27 print(
'Unknown command specified:', cmdArgs[0])
30 packageLocation = os.path.dirname(__file__)
31 python_exec = sys.executable
32 script_path = os.path.join(packageLocation, cmdArgs[0])
34 cmd = [python_exec, script_path] + cmdArgs[1:]
35 print(
'Running command:',
' '.join(cmd))
38 return subprocess.call(cmd, shell=
False)
40if __name__ ==
'__main__':