本文整理汇总了C++中UsdPrim::GetProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ UsdPrim::GetProperties方法的具体用法?C++ UsdPrim::GetProperties怎么用?C++ UsdPrim::GetProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsdPrim
的用法示例。
在下文中一共展示了UsdPrim::GetProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TfToken
void
UsdImagingGprimAdapter::_DiscoverPrimvarsDeprecated(UsdGeomGprim const& gprim,
SdfPath const& cachePath,
UsdPrim const& shaderPrim,
UsdTimeCode time,
UsdImagingValueCache* valueCache)
{
UsdImagingValueCache::PrimvarInfo primvar;
std::vector<UsdProperty> const& props
= shaderPrim.GetProperties();
TF_FOR_ALL(propIt, props) {
UsdAttribute attr = propIt->As<UsdAttribute>();
if (not attr) {
continue;
}
if (attr.GetPath().IsNamespacedPropertyPath()) {
continue;
}
// Ok this is a parameter, check source input.
if (UsdAttribute texAttr = shaderPrim.GetAttribute(
TfToken(attr.GetPath().GetName()
+ ":texture"))) {
TfToken t;
SdfAssetPath ap;
VtValue v;
UsdGeomPrimvar primvarAttr;
texAttr.Get(&ap, UsdTimeCode::Default());
bool isPtex = GlfPtexTexture::IsPtexTexture(TfToken(ap.GetAssetPath()));
if (isPtex) {
t = UsdImagingTokens->ptexFaceIndex;
// Allow the client to override this name
texAttr.GetMetadata(UsdImagingTokens->faceIndexPrimvar, &t);
primvarAttr = gprim.GetPrimvar(t);
if (primvarAttr) {
if (primvarAttr.ComputeFlattened(&v, time)) {
primvar.name = t;
primvar.interpolation = primvarAttr.GetInterpolation();
valueCache->GetPrimvar(cachePath, t) = v;
_MergePrimvar(primvar, &valueCache->GetPrimvars(cachePath));
}
}
t = UsdImagingTokens->ptexFaceOffset;
// Allow the client to override this name
texAttr.GetMetadata(UsdImagingTokens->faceOffsetPrimvar, &t);
primvarAttr = gprim.GetPrimvar(t);
if (primvarAttr) {
primvar.name = t;
primvar.interpolation = primvarAttr.GetInterpolation();
if (primvarAttr.ComputeFlattened(&v, time)) {
valueCache->GetPrimvar(cachePath, t) = v;
_MergePrimvar(primvar, &valueCache->GetPrimvars(cachePath));
}
}
} else {
texAttr.GetMetadata(UsdImagingTokens->uvPrimvar, &t);
primvarAttr = gprim.GetPrimvar(t);
if (TF_VERIFY(primvarAttr, "%s\n", t.GetText())) {
if (TF_VERIFY(primvarAttr.ComputeFlattened(&v, time))) {
primvar.name = t; // does not include primvars:
primvar.interpolation = primvarAttr.GetInterpolation();
// Convert double to float, we don't need double precision.
if (v.IsHolding<VtVec2dArray>()) {
v = VtValue::Cast<VtVec2fArray>(v);
}
valueCache->GetPrimvar(cachePath, t) = v;
_MergePrimvar(primvar, &valueCache->GetPrimvars(cachePath));
}
}
}
} else if (UsdAttribute pvAttr = shaderPrim.GetAttribute(
TfToken(attr.GetPath().GetName()
+ ":primvar"))) {
TfToken t;
VtValue v;
UsdGeomPrimvar primvarAttr;
if (TF_VERIFY(pvAttr.Get(&t, UsdTimeCode::Default()))) {
primvarAttr = gprim.GetPrimvar(t);
if (TF_VERIFY(primvarAttr.ComputeFlattened(&v, time))) {
primvar.name = t; // does not include primvars:
primvar.interpolation = primvarAttr.GetInterpolation();
valueCache->GetPrimvar(cachePath, t) = v;
_MergePrimvar(primvar, &valueCache->GetPrimvars(cachePath));
}
}
}
}