ynput / ayon-houdini

Houdini addon for AYON
Apache License 2.0
11 stars 9 forks source link

Publish USD should support the file remapping the ROP's output processor performs #137

Open BigRoy opened 1 month ago

BigRoy commented 1 month ago

Is there an existing issue for this?

Current Behavior:

We currently are using a Collector to collect the current scene's USD stage and its layers - and from that detect e.g. Explicit Layer Save Paths. However, a USD ROP may be doing a lot of that on export to adjust the resulting USD file using the Output Processors you can configure on a USD ROP.

Some exports, like e.g. a Component Builder, also have default output processors applied to make the results relative to an output directory.

Expected Behavior:

We will likely need to be able to detect the processing a USD ROP performs and remap our paths/expectations accordingly so we know where the source files will actually live that it exports.

We likely can not just consume the written USD file of the ROP itself - since not all asset paths in that file may be related to the current USD ROP export actually generating those files. It may have references to files that already existed. And the relevant save layer path metadata is stripped by the USD ROP (by default) so we don't know which were relevant. Even if we were to enable it on the ROP we could technically parse that after and then remove the metadata ourselves after - however that would not work if a USD ROP was ever 'inside another HDA' (like the component builder) because it'd be "non-editable" when include - hence we can't change those toggles nor can we put in a custom processor of our own that just collects the paths.

Most likely we'll need to first detect all asset paths in a layer from the current stage and for each of those and their prim paths in the Sdf.Layer, go over the exported USD file, compare the same attributes with their value and assume if the value differs that it got remapped - and then after Extraction detect the remapped values, etc. 🤯

Similarly - if the ROP node would make "relative paths" of references (including to "referenced" files that are not created from the current exported position) we should actually remap them to be relative from the file's published destination path.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Create a component builder
  2. Disable "Use asset contribution"
  3. Publish as USD

Are there any labels you wish to add?

Relevant log output:

CRITICAL: Error when registering
Traceback (most recent call last):
  File "E:\Ynput\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 158, in process
    self.register(instance, file_transactions, filtered_repres)
  File "E:\Ynput\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 290, in register
    file_transactions.process()
  File "E:\Ynput\ayon-core\client\ayon_core\lib\file_transaction.py", line 140, in process
    copyfile(src, dst)
  File "C:\Users\Mustafa Taher\AppData\Local\Ynput\AYON\dependency_packages\ayon_2410170032_windows.zip\dependencies\speedcopy\__init__.py", line 332, in copyfile
    ret = COPYFILE('\\\\?\\' + source_file,
  File "_ctypes/callproc.c", line 997, in GetResult
OSError: [WinError -2147024773] The filename, directory name, or volume label syntax is incorrect

Traceback (most recent call last):
  File "C:\Users\Mustafa Taher\AppData\Local\Ynput\AYON\dependency_packages\ayon_2410170032_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "E:\Ynput\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 170, in process
    raise exc
  File "E:\Ynput\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 158, in process
    self.register(instance, file_transactions, filtered_repres)
  File "E:\Ynput\ayon-core\client\ayon_core\plugins\publish\integrate.py", line 290, in register
    file_transactions.process()
  File "E:\Ynput\ayon-core\client\ayon_core\lib\file_transaction.py", line 140, in process
    copyfile(src, dst)
  File "C:\Users\Mustafa Taher\AppData\Local\Ynput\AYON\dependency_packages\ayon_2410170032_windows.zip\dependencies\speedcopy\__init__.py", line 332, in copyfile
    ret = COPYFILE('\\\\?\\' + source_file,
  File "_ctypes/callproc.c", line 997, in GetResult
OSError: [WinError -2147024773] The filename, directory name, or volume label syntax is incorrect

Additional context:

component_builder_error

component_builder_instances