Main entry point for running commands in the package.
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 gltf_materialx_converter <command> [options] where command is mtlx2gltf or gltf2mtlx')
14
15
16
17 cmdArgs = sys.argv[1:]
18 if cmdArgs[0] == 'gltf':
19 cmdArgs[0] = 'materialx_to_gltf.py'
20 elif cmdArgs[0] == 'mtlx':
21 cmdArgs[0] = 'gltf_to_materialx.py'
22 else:
23 print('Unknown command specified:', cmdArgs[0])
24 return 1
25
26
27 cmd = ' '.join(cmdArgs)
28 packageLocation = os.path.dirname(__file__)
29 cmd = 'python ' + packageLocation + '/' + cmd
30
31
32 return subprocess.call(cmd, shell=True)
33