UsdUtils.ExtractExternalReferences converts <udim> to 1001 in 23.11

Hi,
we are in the process of updating USD from 23.02 to 23.11 and noticed a change in the returned paths.

we have a simple test USD that points to a texture using <udim> tag in the path

#usda 1.0
(
    upAxis = "Y"
)

def Scope "mtl"
{
    def Material "material"
    {
        token outputs:surface.connect = </mtl/material/PBRShader.outputs:surface>

        def Shader "PBRShader"
        {
            uniform token info:id = "arnold:standard_surface"
            color3f inputs:base_color.connect = </mtl/material/diffuseTexture.outputs:rgb>
            token outputs:surface
        }

        def Shader "diffuseTexture"
        {
            uniform token info:id = "arnold:image"
            asset inputs:filename = @C:/CODE/pyCharm/pipeline/fin_unittest/TEST_PROJECT_0/_Temp/Creatures/gorilla-tex/lookDev/texture/texture/0001/gorilla-tex_lookDev_texture_v0001_base_colour.<UDIM>.exr@
            color3f outputs:rgb
        }
    }
}

when we query the dependencies of this file using UsdUtils.ExtractExternalReferences
we get the exact same path as in the USD file from 23.02. However, 23.11 returns it as: gorilla-tex_lookDev_texture_v0001_base_colour.1001.exr'

23.02 β†’ gorilla-tex_lookDev_texture_v0001_base_colour.<UDIM>.exr
23.11 β†’ gorilla-tex_lookDev_texture_v0001_base_colour.1001.exr

this may have unforeseen implications in our pipeline and I wanted to check if this is the desired outcome and what the thinking behind it is. From the current API we don’t know if this is a single texture or a sequence (maybe the artist wants to have the same texture on all udims etc?)

does anyone know if there is any other way to access the path as stored in the USD file?

You could iterate all AttributeSpecs (or properties) in the Sdf.Layer and if it is an assetPath then do something with it.

def get_layer_property_paths(layer: Sdf.Layer) -> List[Sdf.Path]:
    """Return all property paths from a layer"""
    paths = []

    def collect_paths(path):
        if not path.IsPropertyPath():
            return
        paths.append(path)

    layer.Traverse("/", collect_paths)

    return paths

And then consider the spec only if it’s of type asset?
An example of something like that is here also using the above function in that code.

Does that help? Or are you looking to do this for a composed USD stage and not the raw layers?

Hello Pawel,

Thank you for pointing this out. We did some refactoring of the underlying system that backs a number of the UsdUtils functions and it looks like udim functionality for UsdUtils.ExtractExternalReferences slipped through the cracks. Would you mind creating an issue on github for this?

Thanks!

1 Like

thank you @BigRoyNL I will experiment with the properties.
@mlarocca of course I can make github bug report. thank you for looking into it!