本文整理汇总了C++中SdfPath::AppendRelationalAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SdfPath::AppendRelationalAttribute方法的具体用法?C++ SdfPath::AppendRelationalAttribute怎么用?C++ SdfPath::AppendRelationalAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SdfPath
的用法示例。
在下文中一共展示了SdfPath::AppendRelationalAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmptyPath
static SdfPath
_AppendNode(const SdfPath &path, const Sdf_PathNodeConstRefPtr &node) {
switch (node->GetNodeType()) {
case Sdf_PathNode::PrimNode:
return path.AppendChild(node->GetName());
case Sdf_PathNode::PrimPropertyNode:
return path.AppendProperty(node->GetName());
case Sdf_PathNode::PrimVariantSelectionNode:
{
const Sdf_PathNode::VariantSelectionType& selection =
node->GetVariantSelection();
return path.AppendVariantSelection(selection.first.GetString(),
selection.second.GetString());
}
case Sdf_PathNode::TargetNode:
return path.AppendTarget( node->GetTargetPath());
case Sdf_PathNode::RelationalAttributeNode:
return path.AppendRelationalAttribute(node->GetName());
case Sdf_PathNode::MapperNode:
return path.AppendMapper(node->GetTargetPath());
case Sdf_PathNode::MapperArgNode:
return path.AppendMapperArg(node->GetName());
case Sdf_PathNode::ExpressionNode:
return path.AppendExpression();
default:
// CODE_COVERAGE_OFF
// Should never get here. All reasonable cases are
// handled above.
TF_CODING_ERROR("Unexpected node type %i", node->GetNodeType());
return SdfPath::EmptyPath();
// CODE_COVERAGE_ON
}
}
示例2: AppendProperty
SdfAttributeSpecHandle
SdfAttributeSpec::_New(
const SdfRelationshipSpecHandle& owner,
const SdfPath& path,
const std::string& name,
const SdfValueTypeName& typeName,
SdfVariability variability,
bool custom)
{
if (not owner) {
TF_CODING_ERROR("NULL owner");
return TfNullPtr;
}
if (not typeName) {
TF_CODING_ERROR("Cannot create attribute spec <%s> with invalid type",
owner->GetPath().AppendTarget(path).
AppendProperty(TfToken(name)).GetText());
return TfNullPtr;
}
SdfChangeBlock block;
// Determine the path of the relationship target
SdfPath absPath = path.MakeAbsolutePath(owner->GetPath().GetPrimPath());
SdfPath targetPath = owner->GetPath().AppendTarget(absPath);
// Check to make sure that the name is valid
if (not Sdf_ChildrenUtils<Sdf_AttributeChildPolicy>::IsValidName(name)) {
TF_CODING_ERROR(
"Cannot create attribute on %s with invalid name: %s",
targetPath.GetText(), name.c_str());
return TfNullPtr;
}
// Create the relationship target if it doesn't already exist. Note
// that this does not automatically get added to the relationship's
// target path list.
SdfSpecHandle targetSpec = owner->_FindOrCreateTargetSpec(path);
// AttributeSpecs are considered initially to have only required fields
// only if they are not custom.
bool hasOnlyRequiredFields = (not custom);
// Create the relational attribute spec
SdfPath attrPath = targetPath.AppendRelationalAttribute(TfToken(name));
if (not Sdf_ChildrenUtils<Sdf_AttributeChildPolicy>::CreateSpec(
owner->GetLayer(), attrPath, SdfSpecTypeAttribute,
hasOnlyRequiredFields)) {
return TfNullPtr;
}
SdfAttributeSpecHandle spec =
owner->GetLayer()->GetAttributeAtPath(attrPath);
// Avoid expensive dormancy checks in the case of binary-backed data.
SdfAttributeSpec *specPtr = get_pointer(spec);
if (TF_VERIFY(specPtr)) {
specPtr->SetField(SdfFieldKeys->Custom, custom);
specPtr->SetField(SdfFieldKeys->TypeName, typeName.GetAsToken());
specPtr->SetField(SdfFieldKeys->Variability, variability);
}
return spec;
}