# Get dependencies faster than ComputeAllDependencies from UsdUtils

**URL:** <https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488>\
**Category:** USD\
**Tags:** python\
**Created:** [June 2, 2025, 12:34pm UTC](https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488 "2025-06-02T12:34:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patateon](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Patateon](https://forum.aousd.org/u/Patateon)\
**Post date:** [June 2, 2025, 12:34pm UTC](https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488/1 "2025-06-02T12:34:06Z")

</div>

Hello, I’m a work study at Illogic Studios, Montpellier,

In order to get every dependencies of a USD stage in Houdini, I used ComputeAllDepencencies function in UsdUtils module.

But it seems that for external references it can take a lot of times, especially for references to heavy files like some bgeo.

I found this workaround below that modify the layer to remove references if there are not USD files, and store them and it is really faster.

```Python
DEPS = []

def filter_not_USD(assetPathProcessed):
    if not 'usd' in assetPathProcessed:
        global DEPS
        DEPS.append(os.path.normpath(assetPathProcessed))
        # Return an empty string to remove the asset path
        return ''
    return assetPathProcessed
    
def apply_filter(layer, dependencyInfo):
    layer.Reload(force=True)
    UsdUtils.ModifyAssetPaths(layer, filter_not_USD)
    
    return dependencyInfo
    
def getDependencies(asset_path: Sdf.AssetPath) -> list[str]:
    layer = Sdf.Layer.FindOrOpen(asset_path.path)
    if not layer:
        print(f"Failed to open layer: {asset_path.path}")
        return []
    layer.Reload(force=True)

    global DEPS
    DEPS = []

    UsdUtils.ModifyAssetPaths(layer, filter_not_USD)
    
    dependencies = UsdUtils.ComputeAllDependencies(layer.identifier, apply_filter)

```

I would like to know if there was a cleaner way to achieve the same result.

---

<div class="post-metadata">

**Author:** ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)\
**Post date:** [June 3, 2025, 6:43pm UTC](https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488/2 "2025-06-03T18:43:12Z")

</div>

Hi @Patateon , can we first ask whether the bgeo “references” appear in a `references`, `subLayers`, `payload` arc or `clipSets` in an environment where referencing bgeo iles translates them to USD through a FileFormat plugin, or are they just appearing in `asset` valued attributes?

---

<div class="post-metadata">

**Author:** ![Patateon](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Patateon](https://forum.aousd.org/u/Patateon)\
**Post date:** [June 4, 2025, 3:35pm UTC](https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488/3 "2025-06-04T15:35:56Z")

</div>

Hey @spiff, i just checked inside the USD file and my bgeo appears like this:

```auto
asset primvars:define_and_setup_ocean_procedural:spectra.timeSamples = {
    995: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_0995.bgeo.sc@,
    996: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_0996.bgeo.sc@,
    997: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_0997.bgeo.sc@,
    998: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_0998.bgeo.sc@,
    999: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_0999.bgeo.sc@,
    1000: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_1000.bgeo.sc@,
    1001: @../../../Scenefiles/FX/water/geo/FILM-010_water_v006.spectrav03_1001.bgeo.sc@,
    ...
}

```

So i suppose they are just appearing in `asset` valued attributes.

---

<div class="post-metadata">

**Author:** ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)\
**Post date:** [June 4, 2025, 5:53pm UTC](https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488/4 "2025-06-04T17:53:21Z")

</div>

OK, that’s definitely perplexing, and we’d love to get to the bottom of it. If you can put your **unfixed** dependency computation in a standalone script, would you be able to run it with `strace` and send us the zipped output, so we can see what files are actually being opened?

That said, we do agree that we should provide an official way to do filtering of assets by name/pattern or extension, with the caveat that you may then miss some transitive dependencies, depending on what you filter.

---

<div class="post-metadata">

**Author:** ![Patateon](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Patateon](https://forum.aousd.org/u/Patateon)\
**Post date:** [June 18, 2025, 12:41pm UTC](https://forum.aousd.org/t/get-dependencies-faster-than-computealldependencies-from-usdutils/2488/5 "2025-06-18T12:41:11Z")

</div>

Hello, sorry for the late answer,  
As we are working on Windows, I used `procmon` to get a system call trace.  
How can I send you the trace in private?
