MaterialX / glTF Texture Procedurals
0.0.1
Utilities for interoperability between MaterialX and glTF Texture Procedurals
Loading...
Searching...
No Matches
__main__.py
Go to the documentation of this file.
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 gltf_materialx_converter <command> [options] where command is mtlx2gltf or gltf2mtlx'
)
14
15
# Check if the command is valid
16
# Check if the command is valid
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
# Build the command
27
cmd =
' '
.join(cmdArgs)
28
packageLocation = os.path.dirname(__file__)
29
cmd =
'python '
+ packageLocation +
'/'
+ cmd
30
31
# Run the command
32
return
subprocess.call(cmd, shell=
True
)
33
34
if
__name__ ==
'__main__'
:
35
sys.exit(
main
())
gltf_materialx_converter.__main__.main
int main()
Main entry point for running commands in the package.
Definition
__main__.py:4
source
gltf_materialx_converter
__main__.py