UsdVolVolume::FieldMap UsdVolVolume::GetFieldPaths() const { std::map<TfToken, SdfPath> fieldMap; const UsdPrim &prim = GetPrim(); if (prim) { std::vector<UsdProperty> fieldProps = prim.GetPropertiesInNamespace(_tokens->fieldPrefix); for (const UsdProperty &fieldProp : fieldProps) { UsdRelationship fieldRel = fieldProp.As<UsdRelationship>(); SdfPathVector targets; // All relationships starting with "field:" should point to // UsdVolFieldBase primitives. if (fieldRel && fieldRel.GetForwardedTargets(&targets)) { if (targets.size() == 1 && targets.front().IsPrimPath()) { fieldMap.emplace(fieldRel.GetBaseName(), targets.front()); } } } } return fieldMap; }
SdfPath UsdVolVolume::GetFieldPath(const TfToken &name) const { UsdRelationship fieldRel = GetPrim().GetRelationship(_MakeNamespaced(name)); SdfPathVector targets; if (fieldRel && fieldRel.GetForwardedTargets(&targets)) { if (targets.size() == 1 && targets.front().IsPrimPath()) { return targets.front(); } } return SdfPath::EmptyPath(); }