Is it possible to combine arbitrary SdfFileFormat and ArResolver plugins?

Background:

  1. We have a few ArResolver plugins that we use in-house to deal with cloud-based assets. These asset paths are invalid on the local machine.
  2. I recently compiled Adobe’s FileFormats plugins and discovered that they work by registering multiple SdfFileFormat plugins.

The Adobe’s plugins cannot recognize our in-house asset paths, and it is not a good idea to make them depend on our in-house packages. Based on my development experience, I decided to support them by using ArAssets, which has been fully tested for years since Ar2.0.

I modified the base class of SdfFileFormat to cache assets locally when matching a certain regular expression, and I have attached my patch to this thread. I’m pretty sure my patch works outside the USD modules since we are still using it. However, when the same patch is applied to USD’s or USD plugins’ source code, it will not take effect.

I’m writing to ask for help and to find out what the correct way to do this. I wonder if the patch fails due to the loading phase or some other complex dependency issues, but I can’t figure it out…

Ping @spiff, and hope you have a good day. :laughing:
SdfFileFormat.txt (6.7 KB)

I can’t really answer for the Adobe plugins specifically, but as for your primary question: yes you can definitely mix and match file format plugins and resolvers.

I unfortunately can’t share my code for our resolver that pulls data from a server and stores it in memory caches, but if memory serves

  1. The file format plugins first rely on you reporting back from _GetExtension in the resolver as they’re an extension based lookup.
  2. If you’re in memory, you also need a custom ArAsset to feed the bytes back to the file format plugins

Unless the Adobe plugins are working differently than the built in format plugins, that should be all you need.

Yep. The only thing I’d add over what @dhruvgovil said is that you might get better results when integrating into DCC’s if you support your assets via “URI resolvers” rather than a single, in-house, Primary resolver.