This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SdfReference Class Reference

Represents a reference and all its meta data. More...

#include <reference.h>

Classes

struct  IdentityEqual
 Struct that defines equality of SdfReferences based on their identity (the asset path and prim path). More...
 
struct  IdentityLessThan
 Struct that defines a strict weak ordering of SdfReferences based on their identity (the asset path and prim path). More...
 

Public Member Functions

SDF_API SdfReference (const std::string &assetPath=std::string(), const SdfPath &primPath=SdfPath(), const SdfLayerOffset &layerOffset=SdfLayerOffset(), const VtDictionary &customData=VtDictionary())
 Creates a reference with all its meta data.
 
const std::string & GetAssetPath () const
 Returns the asset path to the root layer of the referenced layer stack.
 
void SetAssetPath (const std::string &assetPath)
 Sets the asset path for the root layer of the referenced layer stack.
 
const SdfPathGetPrimPath () const
 Returns the path of the referenced prim.
 
void SetPrimPath (const SdfPath &primPath)
 Sets the path of the referenced prim.
 
const SdfLayerOffsetGetLayerOffset () const
 Returns the layer offset associated with the reference.
 
void SetLayerOffset (const SdfLayerOffset &layerOffset)
 Sets a new layer offset.
 
const VtDictionaryGetCustomData () const
 Returns the custom data associated with the reference.
 
void SetCustomData (const VtDictionary &customData)
 Sets the custom data associated with the reference.
 
SDF_API void SetCustomData (const std::string &name, const VtValue &value)
 Sets a custom data entry for the reference.
 
void SwapCustomData (VtDictionary &customData)
 Swaps the custom data dictionary for this reference.
 
SDF_API bool IsInternal () const
 Returns true in the case of an internal reference.
 
SDF_API bool operator== (const SdfReference &rhs) const
 Returns whether this reference equals rhs.
 
bool operator!= (const SdfReference &rhs) const
 
SDF_API bool operator< (const SdfReference &rhs) const
 Returns whether this reference is less than rhs.
 
bool operator> (const SdfReference &rhs) const
 
bool operator<= (const SdfReference &rhs) const
 
bool operator>= (const SdfReference &rhs) const
 

Friends

size_t hash_value (const SdfReference &r)
 

Detailed Description

Represents a reference and all its meta data.

A reference is expressed on a prim in a given layer and it identifies a prim in a layer stack. All opinions in the namespace hierarchy under the referenced prim will be composed with the opinions in the namespace hierarchy under the referencing prim.

The asset path specifies the layer stack being referenced. If this asset path is non-empty, this reference is considered an 'external' reference to the layer stack rooted at the specified layer. If this is empty, this reference is considered an 'internal' reference to the layer stack containing (but not necessarily rooted at) the layer where the reference is authored.

The prim path specifies the prim in the referenced layer stack from which opinions will be composed. If this prim path is empty, it will be considered a reference to the default prim specified in the root layer of the referenced layer stack – see SdfLayer::GetDefaultPrim.

The meta data for a reference is its layer offset and custom data. The layer offset is an affine transformation applied to all anim splines in the referenced prim's namespace hierarchy, see SdfLayerOffset for details. Custom data is for use by plugins or other non-tools supplied extensions that need to be able to store data associated with references.

Definition at line 58 of file reference.h.

Constructor & Destructor Documentation

◆ SdfReference()

SDF_API SdfReference ( const std::string &  assetPath = std::string(),
const SdfPath primPath = SdfPath(),
const SdfLayerOffset layerOffset = SdfLayerOffset(),
const VtDictionary customData = VtDictionary() 
)

Creates a reference with all its meta data.

The default reference is an internal reference to the default prim. See SdfAssetPath for what characters are valid in assetPath. If assetPath contains invalid characters, issue an error and set this reference's asset path to the empty asset path.

Member Function Documentation

◆ GetAssetPath()

const std::string & GetAssetPath ( ) const
inline

Returns the asset path to the root layer of the referenced layer stack.

This will be empty in the case of an internal reference.

Definition at line 75 of file reference.h.

◆ GetCustomData()

const VtDictionary & GetCustomData ( ) const
inline

Returns the custom data associated with the reference.

Definition at line 120 of file reference.h.

◆ GetLayerOffset()

const SdfLayerOffset & GetLayerOffset ( ) const
inline

Returns the layer offset associated with the reference.

Definition at line 108 of file reference.h.

◆ GetPrimPath()

const SdfPath & GetPrimPath ( ) const
inline

Returns the path of the referenced prim.

This will be empty if the referenced prim is the default prim specified in the referenced layer stack.

Definition at line 94 of file reference.h.

◆ IsInternal()

SDF_API bool IsInternal ( ) const

Returns true in the case of an internal reference.

An internal reference is a reference with an empty asset path.

◆ operator!=()

bool operator!= ( const SdfReference rhs) const
inline
See also
SdfReference::operator==(const SdfReference&)

Definition at line 160 of file reference.h.

◆ operator<()

SDF_API bool operator< ( const SdfReference rhs) const

Returns whether this reference is less than rhs.

The meaning of less than is somewhat arbitrary.

◆ operator<=()

bool operator<= ( const SdfReference rhs) const
inline
See also
SdfReference::operator<(const SdfReference&)

Definition at line 174 of file reference.h.

◆ operator==()

SDF_API bool operator== ( const SdfReference rhs) const

Returns whether this reference equals rhs.

◆ operator>()

bool operator> ( const SdfReference rhs) const
inline
See also
SdfReference::operator<(const SdfReference&)

Definition at line 169 of file reference.h.

◆ operator>=()

bool operator>= ( const SdfReference rhs) const
inline
See also
SdfReference::operator<(const SdfReference&)

Definition at line 179 of file reference.h.

◆ SetAssetPath()

void SetAssetPath ( const std::string &  assetPath)
inline

Sets the asset path for the root layer of the referenced layer stack.

This may be set to an empty string to specify an internal reference. See SdfAssetPath for what characters are valid in assetPath. If assetPath contains invalid characters, issue an error and set this reference's asset path to the empty asset path.

Definition at line 84 of file reference.h.

◆ SetCustomData() [1/2]

SDF_API void SetCustomData ( const std::string &  name,
const VtValue value 
)

Sets a custom data entry for the reference.

If value is empty, then this removes the given custom data entry.

◆ SetCustomData() [2/2]

void SetCustomData ( const VtDictionary customData)
inline

Sets the custom data associated with the reference.

Definition at line 126 of file reference.h.

◆ SetLayerOffset()

void SetLayerOffset ( const SdfLayerOffset layerOffset)
inline

Sets a new layer offset.

Definition at line 114 of file reference.h.

◆ SetPrimPath()

void SetPrimPath ( const SdfPath primPath)
inline

Sets the path of the referenced prim.

This may be set to an empty path to specify a reference to the default prim in the referenced layer stack.

Definition at line 102 of file reference.h.

◆ SwapCustomData()

void SwapCustomData ( VtDictionary customData)
inline

Swaps the custom data dictionary for this reference.

Definition at line 137 of file reference.h.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const SdfReference r)
friend

Definition at line 147 of file reference.h.


The documentation for this class was generated from the following file: