MaterialXUSD
0.25.05
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, pmtlx, or getmtlx'
)
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
elif
cmdArgs[0] ==
'getmtlx'
:
22
cmdArgs[0] =
'mtlxdownload.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 = sys.executable +
' '
+ packageLocation +
'/'
+ cmd
31
print(
'Running command:'
, cmd)
32
33
# Run the command
34
return
subprocess.call(cmd, shell=
True
)
35
36
if
__name__ ==
'__main__'
:
37
sys.exit(main())
© 2022-2025 NanMu Consulting.