Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pinning file support #22

Merged
merged 83 commits into from
Sep 13, 2024
Merged

Feature/pinning file support #22

merged 83 commits into from
Sep 13, 2024

Conversation

Lypsolon
Copy link
Collaborator

@Lypsolon Lypsolon commented Jul 17, 2024

TODO

  • convert settings keys to the tuple and change evaluate function to take tuple instead ADDON_SETTINGS_USD_RESOLVER_LOG_LVL
    • Fixed in LakeFs branch
  • implement a standalone system that generates a pinning file

This Pr tracks a pinning file creation via the Usd API.

Here are some related chats on the AOUSD forums.
https://forum.aousd.org/t/get-all-references-sublayers-recursively-of-stage/1322/2?u=bigroynl
https://forum.aousd.org/t/sdf-format-args-and-custom-ar-resolvers/1660/6

function to get info about the USD version
Usd.GetVersion()

@Lypsolon Lypsolon linked an issue Jul 17, 2024 that may be closed by this pull request
5 tasks
@Lypsolon Lypsolon self-assigned this Jul 17, 2024
@Lypsolon Lypsolon requested a review from antirotor July 18, 2024 12:48
@Lypsolon
Copy link
Collaborator Author

okay.
There is this thread on the AOUSD forums. Where they talk about changes in the behaviour of UsdUtils.ExtractExternalReferences, the version of Usd I developed with outputs the 1001-1100 range, and this creates the problem that we don't have the info about how URI was resolved and thereby creating the pinning file this way is pointless because we are missing central information.

We could implement a function that gets all the data from the stage ourselves and not rely on the UsdUtils functions. @dee-ynput @antirotor, do you have any opinions about this?

https://forum.aousd.org/t/usdutils-extractexternalreferences-converts-udim-to-1001-in-23-11/1669

client/ayon_usd/addon.py Outdated Show resolved Hide resolved
client/ayon_usd/config.py Outdated Show resolved Hide resolved
client/ayon_usd/hooks/pre_resolver_init.py Outdated Show resolved Hide resolved
server/settings/main.py Outdated Show resolved Hide resolved
@Lypsolon Lypsolon marked this pull request as ready for review August 20, 2024 12:37
@Lypsolon Lypsolon requested a review from BigRoy August 20, 2024 13:14
LICENSE Outdated Show resolved Hide resolved
server/settings/main.py Outdated Show resolved Hide resolved
@Lypsolon
Copy link
Collaborator Author

Lypsolon commented Sep 9, 2024

Pinning File creation now allows to create a pinning file with relative paths and rootless paths for both key and value.

PS: resolve also has the update but i did not recompile it yet.

@Lypsolon Lypsolon requested a review from BigRoy September 9, 2024 17:16
@Lypsolon
Copy link
Collaborator Author

New Resolver's Are uploaded to LakeFs Pinning File Branch for testing.

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 10, 2024

Overall this looks good - However, I'm getting this when running inside e.g. Maya:

# Error: module 'pxr.UsdShade' has no attribute 'UdimUtils'
# # Traceback (most recent call last):
# #   File "<maya console>", line 15, in <module>
# #   File "E:\dev\ayon-usd\client\ayon_usd\standalone\usd\pinning\__pinning_file_generation_funcs.py", line 334, in generate_pinning_file
# #     pinning_data = get_asset_dependencies(entry_usd, resolver)
# #   File "E:\dev\ayon-usd\client\ayon_usd\standalone\usd\pinning\__pinning_file_generation_funcs.py", line 207, in get_asset_dependencies
# #     recursive_result = get_asset_dependencies(
# #   File "E:\dev\ayon-usd\client\ayon_usd\standalone\usd\pinning\__pinning_file_generation_funcs.py", line 207, in get_asset_dependencies
# #     recursive_result = get_asset_dependencies(
# #   File "E:\dev\ayon-usd\client\ayon_usd\standalone\usd\pinning\__pinning_file_generation_funcs.py", line 207, in get_asset_dependencies
# #     recursive_result = get_asset_dependencies(
# #   [Previous line repeated 3 more times]
# #   File "E:\dev\ayon-usd\client\ayon_usd\standalone\usd\pinning\__pinning_file_generation_funcs.py", line 191, in get_asset_dependencies
# #     udim_data = _resolve_udim(identifier, layer)
# #   File "E:\dev\ayon-usd\client\ayon_usd\standalone\usd\pinning\__pinning_file_generation_funcs.py", line 123, in _resolve_udim
# #     resolved_udims = UsdShade.UdimUtils.ResolveUdimTilePaths(
# # AttributeError: module 'pxr.UsdShade' has no attribute 'UdimUtils'

This may be due to USD version that is old in Maya 2024.2 with MayaUSD 0.27? It works in Houdini 20.0.273 however.

I used something like:

from ayon_usd.standalone.usd import pinning
import ayon_api
import os


def get_root_info(project_name=None) -> "dict[str, str]":
    project_name = project_name or os.environ.get("AYON_PROJECT_NAME")
    return ayon_api.get(f"projects/{project_name}/siteRoots").data


usd_path = r"/path/to/entry.usd"
pinning_file_path = "E:/asset_pin.json"
root_info = get_root_info()
pinning.generate_pinning_file(usd_path, root_info, pinning_file_path)

Also, I'm getting lots of prints of the AYON-USD downloads folder in the launcher console logs. You seem to have an extraneous print statement somewhere? :)

@Lypsolon
Copy link
Collaborator Author

@BigRoy i fixed the udim issue if you can give it a quick test that be great.
i believe everything works but im not sure.

also i just saw that the tray publisher would allow for texture publish (not really Udim ready) but we would need a product that has in the name and the > is not allowed. not important just wanted to mention (other than that texture resolve via uri works)

@Lypsolon
Copy link
Collaborator Author

Lypsolon commented Sep 11, 2024

@BigRoy i tested the pinning file creation on Maya 2025_5(just installed) it works there gonna install 2024_2 and then test there

tested with 2024_2(new_install) and yes UdimUtils is not there love it.

…sure that win drive letters are lower case
@Lypsolon
Copy link
Collaborator Author

Lypsolon commented Sep 11, 2024

@BigRoy i just added a function to make the Win Drive letters lower case. if you could give it a short spin that be great.

also the print Downloads dir should be fixed

@Lypsolon
Copy link
Collaborator Author

Lypsolon commented Sep 12, 2024

As per comment here we'll have to do additional fixes to the logic.

i believe this is done ?

  • Udims get abs rootless paths
  • Win Drive letters get to be lower case

maya_pin.json Outdated Show resolved Hide resolved
Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had the open comment on code style for _normalize_path. Other than that this looks nice! I haven't been able yet to confirm the actual usage of the file pinning itself - since I was way too busy. But since this is about to get merged anyway with continuous work still by @antirotor in the follow up PR this is about as good a time as any to get the bulk of this in.... and then do a full test run again since we're still in alpha.

@Lypsolon Lypsolon merged commit 76b0e3f into develop Sep 13, 2024
1 check passed
@Lypsolon Lypsolon deleted the feature/pinning_file_suport branch September 13, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement system for using pinning file suport on the resolver
5 participants