當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。