本文整理汇总了C++中SdfPathVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ SdfPathVector::push_back方法的具体用法?C++ SdfPathVector::push_back怎么用?C++ SdfPathVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SdfPathVector
的用法示例。
在下文中一共展示了SdfPathVector::push_back方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPath
bool
UsdRelationship::SetTargets(const SdfPathVector& targets) const
{
SdfPathVector mappedPaths;
mappedPaths.reserve(targets.size());
for (const SdfPath &target: targets) {
std::string errMsg;
mappedPaths.push_back(_GetTargetForAuthoring(target, &errMsg));
if (mappedPaths.back().IsEmpty()) {
TF_CODING_ERROR("Cannot set target <%s> on relationship <%s>: %s",
target.GetText(), GetPath().GetText(),
errMsg.c_str());
return false;
}
}
// NOTE! Do not insert any code that modifies scene description between the
// changeblock and the call to _CreateSpec! Explanation: _CreateSpec calls
// code that inspects the composition graph and then does some authoring.
// We want that authoring to be inside the change block, but if any scene
// description changes are made after the block is created but before we
// call _CreateSpec, the composition structure may be invalidated.
SdfChangeBlock block;
SdfRelationshipSpecHandle relSpec = _CreateSpec();
if (!relSpec)
return false;
relSpec->GetTargetPathList().ClearEditsAndMakeExplicit();
for (const SdfPath &path: mappedPaths) {
relSpec->GetTargetPathList().Add(path);
}
return true;
}
示例2: GetPath
bool
UsdRelationship::SetTargets(const SdfPathVector& targets) const
{
SdfPathVector mappedPaths;
mappedPaths.reserve(targets.size());
BOOST_FOREACH(const SdfPath &target, targets) {
std::string errMsg;
mappedPaths.push_back(_GetTargetForAuthoring(target, &errMsg));
if (mappedPaths.back().IsEmpty()) {
TF_CODING_ERROR("Cannot set target <%s> on relationship <%s>: %s",
target.GetText(), GetPath().GetText(),
errMsg.c_str());
return false;
}
}
示例3:
SdfPathVector
Sdf_MarkerUtils<Spec>::GetMarkerPaths(const Spec& owner)
{
SdfPathVector paths;
const SdfLayerHandle layer = owner.GetLayer();
const SdfPathVector children = owner.template GetFieldAs<SdfPathVector>(
_MarkerPolicy::GetChildFieldKey());
TF_FOR_ALL(path, children) {
const SdfPath targetSpecPath = owner.GetPath().AppendTarget(*path);
if (layer->HasField(targetSpecPath, SdfFieldKeys->Marker)) {
paths.push_back(*path);
}
}
return paths;
}
示例4: primvars
bool
UsdGeomPrimvar::SetIdTarget(
const SdfPath& path) const
{
if (_idTargetRelName.IsEmpty()) {
TF_CODING_ERROR("Can only set ID Target for string or string[] typed"
" primvars (primvar type is '%s')",
_attr.GetTypeName().GetAsToken().GetText());
return false;
}
if (UsdRelationship rel = _GetIdTargetRel(true)) {
SdfPathVector targets;
targets.push_back(path.IsEmpty() ? _attr.GetPrimPath() :
path);
return rel.SetTargets(targets);
}
return false;
}
示例5: sourcesBldr
//.........这里部分代码省略.........
aggregateBounds[4] = aggregateExtent[0][2]; // min z
aggregateBounds[5] = aggregateExtent[1][2]; // max z
}
//
// Build sources. Keep track of which instances use them.
//
FnGeolibServices::StaticSceneCreateOpArgsBuilder sourcesBldr(false);
std::vector<int> instanceIndices;
instanceIndices.reserve(numInstances);
std::vector<std::string> instanceSources;
instanceSources.reserve(protoPaths.size());
std::map<std::string, int> instanceSourceIndexMap;
std::vector<int> omitList;
omitList.reserve(numInstances);
std::map<SdfPath, std::string> protoPathsToKatPaths;
for (size_t i = 0; i < numInstances; ++i)
{
int index = protoIndices[i];
// Check to see if we are pruned.
//
bool isPruned = (!pruneMaskValues.empty() and
pruneMaskValues[i] == false);
if (isPruned)
{
omitList.push_back(i);
}
const SdfPath &protoPath = protoPaths[index];
// Compute the full (Katana) path to this prototype.
//
std::string fullProtoPath;
std::map<SdfPath, std::string>::const_iterator pptkpIt =
protoPathsToKatPaths.find(protoPath);
if (pptkpIt != protoPathsToKatPaths.end())
{
fullProtoPath = pptkpIt->second;
}
else
{
_PathToPrimMap::const_iterator pcIt = primCache.find(protoPath);
const UsdPrim &protoPrim = pcIt->second;
if (!protoPrim) {
continue;
}
// Determine where (what path) to start building the prototype prim
// such that its material bindings will be preserved. This could be
// the prototype path itself or an ancestor path.
//
SdfPathVector commonPrefixes;
UsdRelationship materialBindingsRel =
UsdShadeMaterial::GetBindingRel(protoPrim);
auto assetAPI = UsdModelAPI(protoPrim);
std::string assetName;
示例6: while
SdfPathVector
SdfPath::GetConciseRelativePaths(const SdfPathVector& paths) {
SdfPathVector primPaths;
SdfPathVector anchors;
SdfPathVector labels;
// initialize the vectors
TF_FOR_ALL(iter, paths) {
if(!iter->IsAbsolutePath()) {
TF_WARN("argument to GetConciseRelativePaths contains a relative path.");
return paths;
}
// first, get the prim paths
SdfPath primPath = iter->GetPrimPath();
SdfPath anchor = primPath.GetParentPath();
primPaths.push_back(primPath);
anchors.push_back(anchor);
// we have to special case root anchors, since MakeRelativePath can't handle them
if(anchor == SdfPath::AbsoluteRootPath())
labels.push_back(primPath);
else
labels.push_back(primPath.MakeRelativePath(anchor));
}
// each ambiguous path must be raised to its parent
bool ambiguous;
do {
ambiguous = false;
// the next iteration of labels
SdfPathVector newAnchors;
SdfPathVector newLabels;
// find ambiguous labels
for(size_t i=0;i<labels.size();++i) {
int ok = true;
// search for some other path that makes this one ambiguous
for(size_t j=0;j<labels.size();++j) {
if(i != j && labels[i] == labels[j] && primPaths[i] != primPaths[j]) {
ok = false;
break;
}
}
if(!ok) {
// walk the anchor up one node
SdfPath newAnchor = anchors[i].GetParentPath();
newAnchors.push_back(newAnchor);
newLabels.push_back( newAnchor == SdfPath::AbsoluteRootPath() ? primPaths[i]
: primPaths[i].MakeRelativePath( newAnchor ) );
ambiguous = true;
} else {
newAnchors.push_back(anchors[i]);
newLabels.push_back(labels[i]);
}
}
anchors = newAnchors;
labels = newLabels;
} while(ambiguous);
// generate the final set from the anchors
SdfPathVector result;
for(size_t i=0; i<anchors.size();++i) {
if(anchors[i] == SdfPath::AbsoluteRootPath()) {
result.push_back( paths[i] );
} else {
result.push_back( paths[i].MakeRelativePath( anchors[i] ));
}
}
return result;
}