kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to convert to USDZ . But USDA works

FaiyazMdAbdul opened this issue · comments

I am able to create usda file. But usdz fails. I have attached screenshot of error

usdzproblem

Windows 10
Python 2.7.16
USD installed and built

@FaiyazMdAbdul I believe this is due to an AR check that executes, even if the switch isn't specified.

gltf2usd/Source/gltf2usd.py

Lines 872 to 887 in 34fdd28

success = check_usd_compliance(resolved_asset, arkit=args.arkit)
with Ar.ResolverContextBinder(context):
if arkit and not success:
usd.logger.warning('USD is not ARKit compliant')
return
success = UsdUtils.CreateNewUsdzPackage(resolved_asset, temp_usd_file) and success
if success:
shutil.copyfile(temp_usd_file, usd_file)
usd.logger.info('created package {} with contents:'.format(usd_file))
zip_file = Usd.ZipFile.Open(usd_file)
file_names = zip_file.GetFileNames()
for file_name in file_names:
usd.logger.info('\t{}'.format(file_name))
else:
usd.logger.error('could not create {}'.format(usd_file))

Line 872 runs a compliance check against ARKit. If it fails, success is now false. The script then checks to see if the AR check has been specified and returns if it has and the compliance check failed. And right after that, the usdz package is created and success is determined based on the return of that method and the current value of success. In the case of the AR kit validation failure, the current value of success is false thus resulting in the script assuming the usdz package creation failed when it actually didn't.

The temporary fix is to remove and success from line 878. I still have a problem with the temporary directory not being cleaned up properly, though.