getUsdLayerEncoding#

Fully qualified name: usdex::core::getUsdLayerEncoding

pxr::TfToken usdex::core::getUsdLayerEncoding(
const pxr::SdfLayerHandle layer,
)#

Get the USD file format encoding of the given SdfLayer.

SdfLayers can be written in several formats, the most common of which is .usd. However, any .usd file could be either USDA encoded (human-readable text) or USDC encoded (a binary Crate encoding).

Both encodings are also available as their own dedicated file extensions (.usda and .usdc), which can help clarify the intent of content and prevent encoding mistakes.

This function returns the USD file format encoding of the given SdfLayer. It will return “usda”, “usdc”, or “usd” for valid USD layers, and an empty token for any other file format (i.e. 3rd party SdfFileFormatPlugin layers).

Parameters:

layer – The layer to get the USD file format encoding of.

Returns:

The USD file format encoding of the layer, or an empty token if the layer is not a valid USD layer.