VFX-UsdAssetResolver icon indicating copy to clipboard operation
VFX-UsdAssetResolver copied to clipboard

Production setup documentation contains issues on provided code snippets

Open dkeraudren opened this issue 10 months ago • 0 comments

After following the documentation to get started with asset resolution, I encountered several issues in the provided code examples and explanations that could cause confusion or errors for new users:

  1. Incorrect Path Separator Handling in CreateRelativePathIdentifier:
    The current snippet:

    anchor_path = anchor_path[:-1] if anchor_path[-1] == "/" else anchor_path[:anchor_path.rfind("/")]
    

    assumes the use of forward slashes. However, since GetPathString() seems to return paths with backslashes on some systems, a more robust version would be:

    anchor_path = anchor_path[:-1] if anchor_path[-1] == os.path.sep else anchor_path[:anchor_path.rfind(os.path.sep)]
    

    or an equivalent platform-independent solution.

  2. Incorrect Delimiter in Entity Parsing:
    The following line:

    entity_element, entity_version = entity_element.split("-")
    

    should be updated to:

    entity_element, entity_version = entity_element.split("_")
    

    since example files use underscores (_) to separate the version.

  3. Incorrect Path Reference in Documentation:
    In the [Loading our Shot] section, the documentation refers to shots/shotsA, which appears to be a typo. It should be shots/shotA.

  4. Missing Globals in Precompiled PythonExpose.py:
    The precompiled version of PythonExpose.py does not include the Globals setup, likely by design, as this file is intended to be customized for production environments. However, a short section in the documentation covering these global variables would be helpful for less experienced users.

As it stands, running the copy-pasted example leads to the error:

Failed to call Resolver.ResolveAndCache in PythonExpose.py. Please verify that the python code is valid!

even though the code is taken directly from the docs.

Adding clarification around these points would make the onboarding process smoother and reduce friction for first-time users.

Thanks for the great work overall!

dkeraudren avatar Apr 08 '25 15:04 dkeraudren