needle-tools / usd-viewer

USD Web Viewer based on Autodesk's WASM USD bindings and a three.js Hydra render delegate
Other
75 stars 9 forks source link

Unable to show merged USDA files on Windows and Ubuntu #27

Open AstraBert opened 2 weeks ago

AstraBert commented 2 weeks ago

Issue description

I'm trying to display a USDA file which represents the merging of two other .usd* files, according to this logic:

#usda 1.0
(
    defaultPrim = "World"
    metersPerUnit = 1
    upAxis = "Z"
)

def Xform "World"
{
    def Xform "Object1" (
        references = @/path/to/obj1@
    )
    {
        float3 xformOp:translate = (0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
    }

    def Xform "Object2" (
        references = @/path/to/obj2@
    )
    {
        float3 xformOp:translate = (10, 0, 0)
        float3 xformOp:scale = (2, 2, 2)
        uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:scale"]
    }
}

When I try to load them inside the viewer, the console logs this:

Warning: in _ReportErrors at line 3172 of /Users/andrewbeers/git/needle/OpenUSD/pxr/usd/usd/stage.cpp -- In </World/Object2>: Could not open asset @/path/to/obj1@ for reference introduced by @/merged.usda@</World/Object2>. (instantiating stage on stage @/merged.usda@ <0x297445d0>)

emHdBindings.js:1523 Warning: in _ReportErrors at line 3172 of /Users/andrewbeers/git/needle/OpenUSD/pxr/usd/usd/stage.cpp -- In </World/Object1>: Could not open asset  @/path/to/obj2@ for reference introduced by @/merged.usda@</World/Object1>. (instantiating stage on stage @/merged.usda@ <0x297445d0>)

I would expect that the viewer would be able to load each of the two files, given that I provided both of their absolute paths. I also tried relative paths and I tried to put the usd files both under the same directory, but nothing seemed to work. This issue persists with both Linux and Windows.

To Reproduce Steps to reproduce the behavior:

  1. Run npm run start to start the viewer
  2. Open the viewer on http://127.0.0.1:3003
  3. Load the a USDA file that merges two files following the syntaxis reported above
  4. CTRL+SHIFT+C opens the console, in which you'll see the error as reported above.

Expected behavior The viewer should load the file without problems.

Device (please complete the following information):

hybridherbst commented 2 weeks ago

Hey there, thanks for opening an issue! To load multiple files, you need to drop all of them or the folder they are in. Browsers can't access your file system directly – so they can't "find" the files if you don't drop them all in one go.

We could definitely improve that in the UI at some point (for example telling you that a reference can't be found instead of just logging to the console)!

Let me know if that solves the issue for you, otherwise would be great if you attach an example that reproduces the problem.