本文整理汇总了C++中UsdPrim::GetRelationship方法的典型用法代码示例。如果您正苦于以下问题:C++ UsdPrim::GetRelationship方法的具体用法?C++ UsdPrim::GetRelationship怎么用?C++ UsdPrim::GetRelationship使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsdPrim
的用法示例。
在下文中一共展示了UsdPrim::GetRelationship方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: riStatements
static bool
_GatherRibAttributes(
const UsdPrim &prim,
double currentTime,
FnKat::GroupBuilder& attrsBuilder)
{
bool hasAttrs = false;
// USD SHADING STYLE ATTRIBUTES
UsdRiStatements riStatements(prim);
if (riStatements) {
const std::vector<UsdProperty> props =
riStatements.GetRiAttributes();
std::string attrName;
TF_FOR_ALL(propItr, props) {
UsdProperty prop = *propItr;
if (!prop) continue;
std::string nameSpace =
riStatements.GetRiAttributeNameSpace(prop).GetString();
nameSpace = TfStringReplace(nameSpace, ":", ".") + ".";
attrName = nameSpace +
riStatements.GetRiAttributeName(prop).GetString();
VtValue vtValue;
UsdAttribute usdAttr = prim.GetAttribute(prop.GetName());
if (usdAttr) {
if (not usdAttr.Get(&vtValue, currentTime))
continue;
// XXX asShaderParam really means:
// "For arrays, as a single attr vs a type/value pair group"
// The type/value pair group is meaningful for attrs who don't
// have a formal type definition -- like a "user" RiAttribute.
//
// However, other array values (such as two-element shadingrate)
// are not expecting the type/value pair form and will not
// generate rib correctly. As such, we'll handle the "user"
// attribute as a special case.
bool asShaderParam = true;
if (nameSpace == "user.")
{
asShaderParam = false;
}
attrsBuilder.set(attrName, PxrUsdKatanaUtils::ConvertVtValueToKatAttr(vtValue,
asShaderParam) );
}
else {
UsdRelationship usdRel = prim.GetRelationship(prop.GetName());
attrsBuilder.set(attrName, PxrUsdKatanaUtils::ConvertRelTargetsToKatAttr(usdRel,
/* asShaderParam */ false) );
}
hasAttrs = true;
}
}
示例2:
std::vector<UsdShadeParameter>
UsdShadeInterfaceAttribute::GetRecipientParameters(
const TfToken& renderTarget) const
{
UsdPrim prim = _attr.GetPrim();
std::vector<UsdShadeParameter> ret;
if (UsdRelationship rel = prim.GetRelationship(
_GetInterfaceAttributeRelName(renderTarget, *this))) {
std::vector<SdfPath> targets;
rel.GetTargets(&targets);
TF_FOR_ALL(targetIter, targets) {
const SdfPath& target = *targetIter;
if (target.IsPropertyPath()) {
if (UsdPrim targetPrim = prim.GetStage()->GetPrimAtPath(
target.GetPrimPath())) {
if (UsdAttribute attr = targetPrim.GetAttribute(
target.GetNameToken())) {
ret.push_back(UsdShadeParameter(attr));
}
}
}
}
}