| 927 | } |
| 928 | |
| 929 | void SceneCacheData::addProperty( |
| 930 | TfTokenVector& properties, |
| 931 | const SdfPath& primPath, |
| 932 | const TfToken& attributeName, |
| 933 | const SdfValueTypeName& typeName, |
| 934 | bool custom, |
| 935 | const SdfVariability & variability, |
| 936 | const TfToken * defaultValue, |
| 937 | bool defaultValueIsArray, |
| 938 | const TfToken * interpolation, |
| 939 | bool useObjectSample, |
| 940 | bool isCortexAttribute |
| 941 | ) |
| 942 | { |
| 943 | // build path to attribute |
| 944 | SdfPath attributePath; |
| 945 | if ( isCortexAttribute ) |
| 946 | { |
| 947 | std::string attrStr = attributeName.GetString(); |
| 948 | AttributeAlgo::Name usdName = AttributeAlgo::nameToUSD( attrStr ); |
| 949 | if( usdName.isPrimvar ) |
| 950 | { |
| 951 | usdName.name = TfToken( "primvars:" + usdName.name.GetString() ); |
| 952 | } |
| 953 | properties.push_back( usdName.name ); |
| 954 | attributePath = primPath.AppendProperty( usdName.name ); |
| 955 | } |
| 956 | else |
| 957 | { |
| 958 | properties.push_back( attributeName ); |
| 959 | attributePath = primPath.AppendProperty( attributeName ); |
| 960 | } |
| 961 | |
| 962 | SpecData spec; |
| 963 | spec.specType = SdfSpecTypeAttribute; |
| 964 | |
| 965 | // variability |
| 966 | spec.fields.push_back( FieldValuePair( SdfFieldKeys->Variability, variability ) ); |
| 967 | |
| 968 | if( isCortexAttribute ) |
| 969 | { |
| 970 | spec.fields.push_back( FieldValuePair( UsdGeomTokens->interpolation, UsdGeomTokens->constant ) ); |
| 971 | } |
| 972 | |
| 973 | // default value |
| 974 | if( defaultValue ) |
| 975 | { |
| 976 | FieldValuePair defaultValueField; |
| 977 | defaultValueField.first = SdfFieldKeys->Default; |
| 978 | if ( defaultValueIsArray ) |
| 979 | { |
| 980 | VtArray<TfToken> defaultValueArray(1); |
| 981 | *defaultValueArray.data() = *defaultValue; |
| 982 | defaultValueField.second = defaultValueArray; |
| 983 | } |
| 984 | else |
| 985 | { |
| 986 | defaultValueField.second = *defaultValue; |
nothing calls this directly
no test coverage detected