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;
}
예제 #2
0
파일: xformOp.cpp 프로젝트: JT-a/USD
/* static */
bool 
UsdGeomXformOp::IsXformOp(const UsdAttribute &attr)
{
    if (!attr)
        return false;

    return IsXformOp(attr.GetName());
}
예제 #3
0
파일: primvar.cpp 프로젝트: JT-a/USD
/* static */
bool 
UsdGeomPrimvar::IsPrimvar(const UsdAttribute &attr)
{
    if (!attr)
        return false;
    
    TfToken const &name = attr.GetName();
    return _IsNamespaced(name) && !_ContainsExtraNamespaces(name);
}
예제 #4
0
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()));
    }
}
예제 #5
0
파일: parameter.cpp 프로젝트: davidgyu/USD
static
UsdRelationship 
_GetConnectionRel(const UsdAttribute &parameter, 
                  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();
}
예제 #6
0
/* static */
bool
UsdSkelInbetweenShape::IsInbetween(const UsdAttribute& attr)
{
    return attr ? _IsValidInbetweenName(attr.GetName()) : false;
}
예제 #7
0
파일: output.cpp 프로젝트: JT-a/USD
/* static */
bool 
UsdShadeOutput::IsOutput(const UsdAttribute &attr)
{
    return TfStringStartsWith(attr.GetName().GetString(), 
                              UsdShadeTokens->outputs);
}