本文整理汇总了C++中SdfPath::AppendMapper方法的典型用法代码示例。如果您正苦于以下问题:C++ SdfPath::AppendMapper方法的具体用法?C++ SdfPath::AppendMapper怎么用?C++ SdfPath::AppendMapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SdfPath
的用法示例。
在下文中一共展示了SdfPath::AppendMapper方法的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: SdfPath
SdfPath
SdfPath::_ReplacePrefix(const SdfPath &oldPrefix, const SdfPath &newPrefix,
bool fixTargetPaths) const
{
if (*this == oldPrefix) {
// Base case: we've reached oldPrefix.
return newPrefix;
}
if (GetPathElementCount() == 0) {
// Empty paths have nothing to replace.
return *this;
}
// If we've recursed above the oldPrefix, we can bail as long as there
// are no target paths we need to fix.
if (GetPathElementCount() <= oldPrefix.GetPathElementCount() &&
(!fixTargetPaths || !_pathNode->ContainsTargetPath())) {
// We'll never see oldPrefix beyond here, so return.
return *this;
}
// Recursively translate the parent.
SdfPath parent =
GetParentPath()._ReplacePrefix(oldPrefix, newPrefix, fixTargetPaths);
// Translation of the parent may fail; it will have emitted an error.
// Return here so we don't deref an invalid _pathNode below.
if (parent.IsEmpty())
return SdfPath();
// Append the tail component. Use _AppendNode() except in these cases:
// - For prims and properties, we construct child nodes directly
// so as to not expand out ".." components and to avoid the cost
// of unnecessarily re-validating identifiers.
// - For embedded target paths, translate the target path.
switch (_pathNode->GetNodeType()) {
case Sdf_PathNode::PrimNode:
return SdfPath(Sdf_PathNode::FindOrCreatePrim(parent._pathNode,
_pathNode->GetName()));
case Sdf_PathNode::PrimPropertyNode:
return SdfPath(Sdf_PathNode::FindOrCreatePrimProperty(
parent._pathNode, _pathNode->GetName()));
case Sdf_PathNode::TargetNode:
if (fixTargetPaths) {
return parent.AppendTarget( _pathNode->GetTargetPath()
._ReplacePrefix(oldPrefix, newPrefix, fixTargetPaths));
} else {
return _AppendNode(parent, _pathNode);
}
case Sdf_PathNode::MapperNode:
if (fixTargetPaths) {
return parent.AppendMapper( _pathNode->GetTargetPath()
._ReplacePrefix(oldPrefix, newPrefix, fixTargetPaths));
} else {
return _AppendNode(parent, _pathNode);
}
default:
return _AppendNode(parent, _pathNode);
}
}