当前位置: 首页>>代码示例>>C++>>正文


C++ GetPrim函数代码示例

本文整理汇总了C++中GetPrim函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPrim函数的具体用法?C++ GetPrim怎么用?C++ GetPrim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetPrim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _GetCollectionPropertyName

UsdRelationship 
UsdLuxLinkingAPI::_GetExcludesRel(bool create /* =false */) const
{
    const TfToken &relName = _GetCollectionPropertyName(_tokens->excludes);
    return create ? GetPrim().CreateRelationship(relName, /* custom */ false) :
                    GetPrim().GetRelationship(relName);
}
开发者ID:lvxejay,项目名称:USD,代码行数:7,代码来源:linkingAPI.cpp

示例2: GetPrim

PXR_NAMESPACE_CLOSE_SCOPE

// ===================================================================== //
// Feel free to add custom code below this line. It will be preserved by
// the code generator.
//
// Just remember to wrap code in the appropriate delimiters:
// 'PXR_NAMESPACE_OPEN_SCOPE', 'PXR_NAMESPACE_CLOSE_SCOPE'.
// ===================================================================== //
// --(BEGIN CUSTOM CODE)--

PXR_NAMESPACE_OPEN_SCOPE

UsdGeomPrimvar 
UsdGeomPrimvarsAPI::CreatePrimvar(const TfToken& attrName,
                                const SdfValueTypeName &typeName,
                                const TfToken& interpolation,
                                int elementSize) const
{
    const UsdPrim &prim = GetPrim();

    UsdGeomPrimvar primvar(prim, attrName, typeName);

    if (primvar){
        if (!interpolation.IsEmpty())
            primvar.SetInterpolation(interpolation);
        if (elementSize > 0)
            primvar.SetElementSize(elementSize);
    }
    // otherwise, errors have already been issued
    return primvar;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:32,代码来源:primvarsAPI.cpp

示例3: TRACE_FUNCTION

UsdGeomPrimvar 
UsdGeomPrimvarsAPI::FindPrimvarWithInheritance(const TfToken &name) const
{
    TRACE_FUNCTION();

    const TfToken attrName = UsdGeomPrimvar::_MakeNamespaced(name);
    UsdPrim prim = GetPrim();
    if (!prim) {
        TF_CODING_ERROR("FindPrimvarWithInheritance called on invalid prim: %s", 
                        UsdDescribe(prim).c_str());
        return UsdGeomPrimvar();
    }
    UsdGeomPrimvar  localPv = GetPrimvar(name);
    if (localPv.HasAuthoredValue()){
        return localPv;
    }
    
    for (prim = prim.GetParent(); prim && !prim.IsPseudoRoot();
         prim = prim.GetParent()) {
        UsdAttribute attr = prim.GetAttribute(attrName);
        if (attr.HasAuthoredValue()) {
            if (UsdGeomPrimvar pv = UsdGeomPrimvar(attr)) {
                // Only constant primvars can be inherited.
                if (pv.GetInterpolation() == UsdGeomTokens->constant) {
                    return pv;
                } else {
                    // Non-constant interpolation blocks inheritance.
                    return UsdGeomPrimvar();
                }
            }
        }
    }
    return localPv;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:34,代码来源:primvarsAPI.cpp

示例4: prim

UsdAttribute
UsdSchemaBase::_CreateAttr(TfToken const &attrName,
                           SdfValueTypeName const & typeName,
                           bool custom, SdfVariability variability,
                           VtValue const &defaultValue, 
                           bool writeSparsely) const
{
    UsdPrim prim(GetPrim());
    
    if (writeSparsely && !custom){
        // We are a builtin, and we're trying to be parsimonious.
        // We only need to even CREATE a propertySpec if we are
        // authoring a non-fallback default value
        UsdAttribute attr = prim.GetAttribute(attrName);
        VtValue  fallback;
        if (defaultValue.IsEmpty() ||
            (!attr.HasAuthoredValueOpinion()
             && attr.Get(&fallback)
             && fallback == defaultValue)){
            return attr;
        }
    }
    
    UsdAttribute attr(prim.CreateAttribute(attrName, typeName,
                                           custom, variability));
    if (attr && !defaultValue.IsEmpty()) {
        attr.Set(defaultValue);
    }

    return attr;
}
开发者ID:MWDD,项目名称:USD,代码行数:31,代码来源:schemaBase.cpp

示例5: UsdShadeNodeGraph

UsdShadeNodeGraph::InterfaceInputConsumersMap
UsdRiMaterialAPI::ComputeInterfaceInputConsumersMap(
        bool computeTransitiveConsumers) const
{
    return UsdShadeNodeGraph(GetPrim())._ComputeInterfaceInputConsumersMap(
        computeTransitiveConsumers, _tokens->ri);
}
开发者ID:JT-a,项目名称:USD,代码行数:7,代码来源:materialAPI.cpp

示例6: GetPrim

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;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:26,代码来源:volume.cpp

示例7: GetPrim

bool
UsdGeomPointInstancer::ActivateAllIds() const
{
    SdfInt64ListOp  op;
    op.SetExplicitItems(std::vector<int64_t>());
    
    return GetPrim().SetMetadata(UsdGeomTokens->inactiveIds, op);
}
开发者ID:JT-a,项目名称:USD,代码行数:8,代码来源:pointInstancer.cpp

示例8: UsdGeomPrimvar

UsdGeomPrimvar
UsdGeomPrimvarsAPI::GetPrimvar(const TfToken &name) const
{
    // The getter SHOULD issue an error if 'name' is malformed, which
    // _MakeNamespaced() will do for us.
    return UsdGeomPrimvar(GetPrim().GetAttribute
                           (UsdGeomPrimvar::_MakeNamespaced(name)));
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:8,代码来源:primvarsAPI.cpp

示例9: GetPrim

bool 
UsdSpecializes::SetSpecializes(const SdfPathVector& items)
{
    // Proxy editor has no clear way of setting explicit items in a single
    // call, so instead, just set the field directly.
    SdfPathListOp paths;
    paths.SetExplicitItems(items);
    return GetPrim().SetMetadata(SdfFieldKeys->Specializes, paths);
}
开发者ID:mplanck,项目名称:USD,代码行数:9,代码来源:specializes.cpp

示例10: TfStringPrintf

std::string
UsdSkelSkeletonQuery::GetDescription() const
{
    if(IsValid()) {
        return TfStringPrintf(
            "UsdSkelSkeletonQuery (skel = <%s>, anim = <%s>)",
            GetPrim().GetPath().GetText(),
            _animQuery.GetPrim().GetPath().GetText());
    }
    return "invalid UsdSkelSkeletonQuery";
}
开发者ID:rodeofx,项目名称:USD,代码行数:11,代码来源:skeletonQuery.cpp

示例11: SdfAbstractDataSpecId

bool
UsdProperty::IsAuthored() const
{
    // Look for the strongest authored property spec.
    for (Usd_Resolver res(
             &GetPrim().GetPrimIndex()); res.IsValid(); res.NextLayer()) {
        if (res.GetLayer()->HasSpec(
                SdfAbstractDataSpecId(&res.GetLocalPath(), &_PropName())))
            return true;
    }
    return false;
}
开发者ID:lvxejay,项目名称:USD,代码行数:12,代码来源:property.cpp

示例12: UsdShadeOutput

UsdShadeOutput 
UsdRiMaterialAPI::_GetShadeOutput(const UsdAttribute &outputAttr, 
                                  const TfToken &oldEncodingRelName) const
{
    if (outputAttr) {
        return UsdShadeOutput(outputAttr);
    } else if (UsdShadeUtils::ReadOldEncoding()) {
        if (UsdRelationship rel = GetPrim().GetRelationship(oldEncodingRelName))
        {
            return UsdShadeOutput(rel);
        }
    }
    return UsdShadeOutput();
}
开发者ID:JT-a,项目名称:USD,代码行数:14,代码来源:materialAPI.cpp

示例13: surfaceOutput

bool
UsdRiMaterialAPI::SetSurfaceSource(const SdfPath &surfacePath) const
{
    if (UsdShadeUtils::WriteNewEncoding()) {
        UsdShadeOutput surfaceOutput(CreateSurfaceAttr());
        return UsdShadeConnectableAPI::ConnectToSource(
            surfaceOutput, surfacePath.IsPropertyPath() ? surfacePath :
                surfacePath.AppendProperty(_tokens->defaultOutputName));
    } else if (UsdRelationship surfaceRel = GetPrim().CreateRelationship(
                    _tokens->riLookSurface, /*custom*/ false)) {
        return surfaceRel.SetTargets(std::vector<SdfPath>{surfacePath});
    }
    return false;
}
开发者ID:JT-a,项目名称:USD,代码行数:14,代码来源:materialAPI.cpp

示例14: bxdfOutput

bool
UsdRiMaterialAPI::SetBxdfSource(const SdfPath &bxdfPath) const
{
    if (UsdShadeUtils::WriteNewEncoding()) {
        UsdShadeOutput bxdfOutput(CreateBxdfAttr());
        return UsdShadeConnectableAPI::ConnectToSource(
            bxdfOutput, bxdfPath.IsPropertyPath() ? 
                bxdfPath :
                bxdfPath.AppendProperty(_tokens->defaultOutputName));
    } else if (UsdRelationship bxdfRel = GetPrim().CreateRelationship(
                    _tokens->riLookBxdf, /*custom*/ false)) {
        return bxdfRel.SetTargets(std::vector<SdfPath>{bxdfPath});
    }
    return false;
}
开发者ID:JT-a,项目名称:USD,代码行数:15,代码来源:materialAPI.cpp

示例15: GetNormalsAttr

bool
UsdGeomPointBased::SetNormalsInterpolation(TfToken const &interpolation)
{
    if (UsdGeomPrimvar::IsValidInterpolation(interpolation)){
        return GetNormalsAttr().SetMetadata(UsdGeomTokens->interpolation, 
                                            interpolation);
    }

    TF_CODING_ERROR("Attempt to set invalid interpolation "
                     "\"%s\" for normals attr on prim %s",
                     interpolation.GetText(),
                     GetPrim().GetPath().GetString().c_str());
    
    return false;
}
开发者ID:400dama,项目名称:USD,代码行数:15,代码来源:pointBased.cpp


注:本文中的GetPrim函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。