All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
layerUtils.h File Reference
+ Include dependency graph for layerUtils.h:

Go to the source code of this file.

Functions

 TF_DECLARE_REF_PTRS (SdfLayer)
 
 SDF_DECLARE_HANDLES (SdfLayer)
 
SDF_API std::string SdfComputeAssetPathRelativeToLayer (const SdfLayerHandle &anchor, const std::string &assetPath)
 Returns the path to the asset specified by assetPath, using the anchor layer to anchor the path if it is relative. More...
 
SDF_API SdfLayerRefPtr SdfFindOrOpenRelativeToLayer (const SdfLayerHandle &anchor, std::string *layerPath, const SdfLayer::FileFormatArguments &args=SdfLayer::FileFormatArguments())
 Returns a layer with the given layerPath relative to the anchor layer. More...
 

Function Documentation

SDF_API std::string SdfComputeAssetPathRelativeToLayer ( const SdfLayerHandle &  anchor,
const std::string &  assetPath 
)

Returns the path to the asset specified by assetPath, using the anchor layer to anchor the path if it is relative.

If the result of anchoring assetPath to anchor's path cannot be resolved and assetPath is a search path, assetPath will be returned. If assetPath is not relative, assetPath will be returned. Otherwise, the anchored path will be returned.

Note that if anchor is an anonymous layer, we will always return the untouched assetPath.

SDF_API SdfLayerRefPtr SdfFindOrOpenRelativeToLayer ( const SdfLayerHandle &  anchor,
std::string *  layerPath,
const SdfLayer::FileFormatArguments args = SdfLayer::FileFormatArguments() 
)

Returns a layer with the given layerPath relative to the anchor layer.

This function uses SdfComputeAssetPathRelativeToLayer with anchor and layerPath to compute the layer path to find or open. See documentation on that function for more details.

If the anchor layer is invalid, the layerPath pointer is invalid, or layerPath contains an empty string, a coding error is raised and a null layer is returned.