MaterialXUSD
0.0.1
Utilities for using MaterialX with USD
Loading...
Searching...
No Matches
__main__.py
1
import
sys, os
2
import
subprocess
3
4
def
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 materialxusd <command> [options] where command is m2u or pmtlx'
)
14
15
# Check if the command is valid
16
cmdArgs = sys.argv[1:]
17
if
cmdArgs[0] ==
'm2u'
:
18
cmdArgs[0] =
'mtlx2usd.py'
19
elif
cmdArgs[0] ==
'pmtlx'
:
20
cmdArgs[0] =
'preprocess_mtlx.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
33
if
__name__ ==
'__main__'
:
34
sys.exit(main())
© 2022-2025 NanMu Consulting.