24 #ifndef PXR_USD_SDF_REFERENCE_H
25 #define PXR_USD_SDF_REFERENCE_H
30 #include "pxr/usd/sdf/api.h"
33 #include "pxr/usd/sdf/path.h"
35 #include "pxr/base/vt/value.h"
37 #include <boost/operators.hpp>
43 PXR_NAMESPACE_OPEN_SCOPE
47 typedef std::vector<SdfReference> SdfReferenceVector;
85 const std::string &assetPath = std::string(),
121 _primPath = primPath;
133 _layerOffset = layerOffset;
145 _customData = customData;
156 _customData.
swap(customData);
165 friend inline size_t hash_value(
const SdfReference &r) {
167 boost::hash_combine(h, r._assetPath);
168 boost::hash_combine(h, r._primPath);
169 boost::hash_combine(h, r._layerOffset);
170 boost::hash_combine(h, r._customData);
175 SDF_API
bool operator==(
const SdfReference &rhs)
const;
179 SDF_API
bool operator<(
const SdfReference &rhs)
const;
185 bool operator()(
const SdfReference &lhs,
const SdfReference &rhs)
const {
186 return lhs._assetPath == rhs._assetPath &&
187 lhs._primPath == rhs._primPath;
195 bool operator()(
const SdfReference &lhs,
const SdfReference &rhs)
const {
196 return lhs._assetPath < rhs._assetPath ||
197 (lhs._assetPath == rhs._assetPath &&
198 lhs._primPath < rhs._primPath);
204 std::string _assetPath;
227 const SdfReferenceVector &references,
231 SDF_API std::ostream &
operator<<( std::ostream &out,
234 PXR_NAMESPACE_CLOSE_SCOPE
236 #endif // PXR_USD_SDF_REFERENCE_H
const VtDictionary & GetCustomData() const
Returns the custom data associated with the reference.
void SetCustomData(const VtDictionary &customData)
Sets the custom data associated with the reference.
SDF_API bool operator<(const SdfReference &rhs) const
Returns whether this reference is less than rhs.
VT_API void swap(VtDictionary &dict)
Swaps the contents of two VtDictionaries.
void SetLayerOffset(const SdfLayerOffset &layerOffset)
Sets a new layer offset.
A map with string keys and VtValue values.
const std::string & GetAssetPath() const
Return the asset path.
void SetAssetPath(const std::string &assetPath)
Sets the asset path for the root layer of the referenced layer stack.
Struct that defines equality of SdfReferences based on their identity (the asset path and prim path)...
const std::string & GetAssetPath() const
Returns the asset path to the root layer of the referenced layer stack.
SDF_API bool IsInternal() const
Returns true in the case of an internal reference.
const SdfLayerOffset & GetLayerOffset() const
Returns the layer offset associated with the reference.
Struct that defines a strict weak ordering of SdfReferences based on their identity (the asset path a...
A path value used to locate objects in layers or scenegraphs.
SDF_API bool operator==(const SdfReference &rhs) const
Returns whether this reference equals rhs.
void SetPrimPath(const SdfPath &primPath)
Sets the path of the referenced prim.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
Represents a reference and all its meta data.
void SwapCustomData(VtDictionary &customData)
Swaps the custom data dictionary for this reference.
Contains an asset path and an optional resolved path.
const SdfPath & GetPrimPath() const
Returns the path of the referenced prim.
SDF_API int SdfFindReferenceByIdentity(const SdfReferenceVector &references, const SdfReference &referenceId)
Convenience function to find the index of the reference in references that has the same identity as t...
Represents a time offset and scale between layers.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
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.