static bool _CheckUsdTypeAndResizeArrays( const UsdAttribute& usdAttr, const TfType& expectedType, const GfInterval& timeInterval, std::vector<double>* timeSamples, MTimeArray* timeArray, MDoubleArray* valueArray) { // Validate that the attribute holds values of the expected type. const TfType type = usdAttr.GetTypeName().GetType(); if (type != expectedType) { TF_CODING_ERROR("Unsupported type name for USD attribute '%s': %s", usdAttr.GetName().GetText(), type.GetTypeName().c_str()); return false; } if (!usdAttr.GetTimeSamplesInInterval(timeInterval, timeSamples)) { return false; } size_t numTimeSamples = timeSamples->size(); if (numTimeSamples < 1) { return false; } timeArray->setLength(numTimeSamples); valueArray->setLength(numTimeSamples); return true; }
/* static */ bool UsdGeomXformOp::IsXformOp(const UsdAttribute &attr) { if (!attr) return false; return IsXformOp(attr.GetName()); }
/* static */ bool UsdGeomPrimvar::IsPrimvar(const UsdAttribute &attr) { if (!attr) return false; TfToken const &name = attr.GetName(); return _IsNamespaced(name) && !_ContainsExtraNamespaces(name); }
UsdShadeInterfaceAttribute::UsdShadeInterfaceAttribute( const UsdAttribute &attr) { TfToken const &interfaceAttrName = attr.GetName(); if (TfStringStartsWith(interfaceAttrName, _tokens->interface)){ _attr = attr; _name = TfToken(interfaceAttrName.GetString().substr(_tokens->interface.GetString().size())); } }
static UsdRelationship _GetConnectionRel(const UsdAttribute ¶meter, bool create) { if (!parameter) { TF_WARN("Invalid attribute: %s", UsdDescribe(parameter).c_str()); return UsdRelationship(); } const UsdPrim& prim = parameter.GetPrim(); const TfToken& relName = _GetConnectionRelName(parameter.GetName()); if (UsdRelationship rel = prim.GetRelationship(relName)) { return rel; } else if (create) { return prim.CreateRelationship(relName, /* custom = */ false); } return UsdRelationship(); }
/* static */ bool UsdSkelInbetweenShape::IsInbetween(const UsdAttribute& attr) { return attr ? _IsValidInbetweenName(attr.GetName()) : false; }
/* static */ bool UsdShadeOutput::IsOutput(const UsdAttribute &attr) { return TfStringStartsWith(attr.GetName().GetString(), UsdShadeTokens->outputs); }