adobe / USD-Fileformat-plugins

A collection of USD fileformat plugins
312 stars 21 forks source link

Building Python USD Wheels with Fileformat plugins? #40

Open joao-dgg opened 2 weeks ago

joao-dgg commented 2 weeks ago

I would like to build a Python wheels package for easier sharing and installation of the binaries. USD itself has a setup.py file in its build scripts that does exactly that, if you execute it after the actual build process. However, I'm having a hard time figuring out how to make the fileformat plugins work with this wheel building workflow.

As far as I can tell, the build of USD is correct, and so is the build of the fileformat plugins. I believe I'm not moving the fileformat files into the proper folders for the setup.py script from USD to pick them up, though. Running the setup.py script seems to "ignore" the files generated by the plugin.

I tried to follow the steps of the readme to "copy" the files into the USD install folder before running the setup.py script, but I guess that's either not enough or I'm missing something, as there's no fileformat related files in the resulting .wheel package.

I understand that the setup.py script probably doesn't take 3rd Party plugins into account, but any help would be appreciated, if anyone has any idea.

Expected Behaviour

After running the setup.py script, assuming USD-Fileformat-plugins files are in the proper locations beforehand, the user should have a .wheel package file that can be distributed or installed in any machine, without needing to manually setup env variables or move files. The USD-Fileformat-plugins should then be accessible by the Python environment that the .wheel package is installed to.

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  mkdir -p ./LOCAL_USD_INSTALL/plugin/usd
  cp -r ./USD-Fileformat-plugins/bin/plugin/usd/* ./LOCAL_USD_INSTALL/plugin/usd/
  cp ./USD-Fileformat-plugins/bin/bin/* ./LOCAL_USD_INSTALL/plugin/usd/

Platform and Version

Windows 11, Python 3.9, newest version from Main.

Sample Code that illustrates the problem

>>> from pxr import Usd
>>> stage = Usd.Stage.Open("test_file.glb")

Logs taken while reproducing problem

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pxr.Tf.ErrorException:
        Error in 'pxrInternal_v0_24__pxrReserved__::SdfLayer::_OpenLayerAndUnlockRegistry' at line 3344 in file C:\Users\dgg_26\Desktop\ASWF\OpenUSD\OpenUSDSrc\pxr\usd\sdf\layer.cpp : 'Cannot determine file format for @C:/Users/dgg_26/Desktop/test_file.glb:SDF_FORMAT_ARGS:target=usd@'
        Error in 'pxrInternal_v0_24__pxrReserved__::UsdStage::Open' at line 1051 in file C:\Users\dgg_26\Desktop\ASWF\OpenUSD\OpenUSDSrc\pxr\usd\usd\stage.cpp : 'Failed to open layer @C:\Users\dgg_26\Desktop\test_file.glb@'