FnUsdAbstractionLib 0.6.0
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
usg::Relationship Class Reference

#include <Relationship.h>

Public Member Functions

 Relationship ()
 Abstraction handle for casting to UsdRelationship.
 
 Relationship (const Relationship &)
 Copy constructors.
 
Relationshipoperator= (const Relationship &)
 
bool isAuthored () const
 True if Relationship holds UsdRelationship, not SdfRelationshipSpec, and is authored.
 
bool isValid () const
 True if RelationshipHandle is valid (has a valid object binding.)
 
 operator bool () const
 
Relationship::RelationshipSpecHandle * getSdfRelationshipSpec (int usd_version)
 
const Relationship::RelationshipSpecHandle * getSdfRelationshipSpec (int usd_version) const
 
Relationship::UsdRelationshipHandle * getUsdRelationship (int usd_version)
 
const Relationship::UsdRelationshipHandle * getUsdRelationship (int usd_version) const
 
const std::string & getName () const
 
Token getNameToken () const
 
const std::string & getBaseName () const
 Returns the base name of the relationship.
 
Token getBaseNameToken () const
 Returns the base name of the relationship as a token.
 
Path getPath () const
 Full path including the Prim parent.
 
std::string getDisplayName () const
 Returns the display name of the attribute.
 
void setCustom (bool isCustom)
 Sets if Relationship is custom or not.
 
bool getCustom () const
 Gets if Relationship is custom or not.
 
usg::TokenArray getFieldNames () const
 Gets a list of field names as tokens defined on the Relationship.
 
usg::TokenArray getAuthoredFieldNames () const
 Gets a list of authored field names.
 
Value getField (const Token &fieldName) const
 
bool setField (const Token &fieldName, const Value &value)
 Sets the contents of a field, creating it if required.
 
void setCustomData (const std::string &key, const Value &value)
 Sets a value in the custom data for this relationship.
 
bool getCustomData (const std::string &key, Value &value) const
 Returns the value for key in the custom data for this relationship.
 
CustomDataRef getCustomData () const
 Returns the relationship's custom data.
 
void setTarget (const Path &targetPath)
 Sets the relationship's target path to a single path.
 
Path getTarget () const
 Retrieve the first target path.
 
void setTargets (const PathArray &targetPaths)
 Sets the relationship's target paths.
 
PathArray getTargets () const
 Retrieves the relationship's target paths.
 
 Relationship (const Relationship::Impl &)
 Wrapper abstraction for implementation type.
 
Relationshipoperator= (const Relationship::Impl &)
 
bool setFromImpl (Relationship::Impl &&b)
 Takes ownership of 'b' - returns true if resulting Relationship is valid.
 
Relationship::Impl * impl ()
 
const Relationship::Impl * impl () const
 

Protected Attributes

std::unique_ptr< Relationship::Impl, void(*)(Relationship::Impl *)> _pImpl
 

Friends

USG_API std::ostream & operator<< (std::ostream &o, const Relationship &b)
 Calls through to << operator on the contained data.
 

Detailed Description

Relationships are always attached to Prims so use the Prim interface to create or get access to them.

To create a new Relationship use Prim::createIntrinsicRelationship() or Prim::createCustomRelationship(). To access an existing Relationship use Prim::getRelationship().

TODO: We're only supporting a single relationship target currently! Need multiple targets for PointInstancer, maybe other classes

Constructor & Destructor Documentation

◆ Relationship()

usg::Relationship::Relationship ( )

Abstraction handle for casting to UsdRelationship.

Default ctor builds an empty (invalid) relationship.

Member Function Documentation

◆ getSdfRelationshipSpec()

Relationship::RelationshipSpecHandle * usg::Relationship::getSdfRelationshipSpec ( int  usd_version)

If the Relationship is bound to an SdfRelationshipSpecHandle return a pointer to the underlying SdfRelationshipSpecHandle object if the usd_version passed in matches the Usd version this library was built with, otherwise return null.

The version must match the one returned by usg::usdAPIVersion().

Caller should cast the returned pointer to an SdfRelationshipSpecHandle* and possibly double-check its validity since a Relationship can be created without a valid binding. However, if Relationship::isValid() returns true then the underlying binding will also be valid.

◆ getUsdRelationship()

Relationship::UsdRelationshipHandle * usg::Relationship::getUsdRelationship ( int  usd_version)

If the Relationship is bound to a UsdRelationship return a pointer to the underlying UsdRelationship object if the usd_version passed in matches the Usd version this library was built with, otherwise return null.

The version must match the one returned by usg::usdAPIVersion().

Caller should cast the returned pointer to an UsdRelationship* and possibly double-check its validity since a Relationship can be created without a valid binding. However, if Relationship::isValid() returns true then the underlying binding will also be valid.

◆ getField()

Value usg::Relationship::getField ( const Token fieldName) const

Returns the content of the non-empty named field, otherwise an invalid Value.



©2025 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk