本文整理汇总了C++中UsdPrim::GetAuthoredPropertiesInNamespace方法的典型用法代码示例。如果您正苦于以下问题:C++ UsdPrim::GetAuthoredPropertiesInNamespace方法的具体用法?C++ UsdPrim::GetAuthoredPropertiesInNamespace怎么用?C++ UsdPrim::GetAuthoredPropertiesInNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsdPrim
的用法示例。
在下文中一共展示了UsdPrim::GetAuthoredPropertiesInNamespace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyPrimvars
static
void
_AddPrimToInheritedPrimvars(const UsdPrim &prim, const TfToken &pvPrefix,
const std::vector<UsdGeomPrimvar> *inputPrimvars,
std::vector<UsdGeomPrimvar> *outputPrimvars,
bool acceptAll)
{
auto copyPrimvars = [&inputPrimvars,&outputPrimvars]()
{
if (inputPrimvars != outputPrimvars){
*outputPrimvars = *inputPrimvars;
inputPrimvars = outputPrimvars;
}
};
for (UsdProperty const& prop:
prim.GetAuthoredPropertiesInNamespace(pvPrefix)) {
if (UsdGeomPrimvar pv = UsdGeomPrimvar(prop.As<UsdAttribute>())) {
// If the primvar does not provide a value, then it is as if it
// does not exist on prim
if (!pv.HasAuthoredValue()) {
continue;
}
// If pv is constant it will replace an instance already on the list;
// if non-constant we'll just remove it.
const TfToken &name = pv.GetName();
size_t i;
bool pvIsConstant = pv.GetInterpolation() == UsdGeomTokens->constant;
bool foundMatch = false;
for (i=0; i < inputPrimvars->size(); ++i) {
if (name == (*inputPrimvars)[i].GetName()) {
copyPrimvars();
foundMatch = true;
if (pvIsConstant || acceptAll){
(*outputPrimvars)[i] = std::move(pv);
break;
}
else {
// Swap to the end and truncate the vector.
// Don't bother to preserve order.
std::swap((*outputPrimvars)[i], outputPrimvars->back());
outputPrimvars->pop_back();
break;
}
}
}
if ( !foundMatch && (pvIsConstant || acceptAll)) {
copyPrimvars();
outputPrimvars->push_back(std::move(pv));
}
}
}
}