예제 #1
0
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;
}
예제 #2
0
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();
}