Web Viewer: Add support for drag-and-drop of materials with image references
Issue
If you drag-drop a MTLX file with image dependencies the image dependencies cannot be found to be bound. Seems to be the case for
- Image files in same folder as MTLX file
- Image files in sub-folders of MTLX file
- Image files in sibling or parent folders
Perhaps this is due to the usage of relative file paths, though would think that 1 would work.
Diagnosis
Found while loading and examining the console log in a browser.
Can I pick this issue for the dev day 2024 ?
Absolutely, and welcome!
As an FYI, AFAIK this could just not be feasible to do as you can't access local file paths due to security. Thus drag-and-drop supports zip files load. If there is a way @Avgilles, I'd be very interested in how to set this up :).
Hello, is there is a way to have resolve path in material X (like asset resolver in USD ) ? I see here that the path is get in local when it's drag and drop, but the buffer store the blob url, maybe I can get the blob url and resolve it ? @kwokcb https://github.com/AcademySoftwareFoundation/MaterialX/blob/e6b96502e965392c8851bab9de847d3135a48396/javascript/MaterialXView/source/helper.js#L117
When all the files are dropped together (or the folder containing them), then the references can indeed be resolved with a custom loader. (this is, for example, how all glTF viewers work when dropping .gltf + .bin + some textures).
I'll see if I find time to fix this :)
Hi @hybridherbst,
Thanks for you comments on this.
Actually @Avgilles was trying to do this for ASWF dev days but if Gilles is still interested maybe just some pointers would be appreciated.
Also, the case I don't think is possible is drag-and-drop only the MaterialX file (not the folder or other with images files) and have the file references inside the MaterialX file parsed to load in associated images.