MCPcopy Create free account
hub / github.com/ImageEngine/cortex / addProperty

Method addProperty

contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp:929–1148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

927}
928
929void 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;

Callers

nothing calls this directly

Calls 12

dataMethod · 0.80
sceneMethod · 0.45
getMethod · 0.45
numTransformSamplesMethod · 0.45
transformSampleTimeMethod · 0.45
numAttributeSamplesMethod · 0.45
attributeSampleTimeMethod · 0.45
numBoundSamplesMethod · 0.45
boundSampleTimeMethod · 0.45
numObjectSamplesMethod · 0.45
objectSampleTimeMethod · 0.45
hasAttributeMethod · 0.45

Tested by

no test coverage detected