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


C++ TfToken函数代码示例

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


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

示例1: OptionVecVal

    NdrOptionVec
    OptionVecVal(const std::string& optionStr)
    {
        std::vector<std::string> tokens = TfStringSplit(optionStr, "|");

        // The input string should be formatted as one of the following:
        //
        //     list:   "option1|option2|option3|..."
        //     mapper: "key1:value1|key2:value2|..."
        //
        // If it's a mapper, return the result as a list of key-value tuples to
        // preserve order.

        NdrOptionVec options;

        for (const std::string& token : tokens) {
            size_t colonPos = token.find(':');

            if (colonPos != std::string::npos) {
                options.emplace_back(std::make_pair(
                    TfToken(token.substr(0, colonPos)),
                    TfToken(token.substr(colonPos + 1)))
                );
            } else {
                options.emplace_back(std::make_pair(
                    TfToken(token),
                    TfToken())
                );
            }
        }

        return options;
    }
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:33,代码来源:shaderMetadataHelpers.cpp

示例2: seDepNode

UsdPrim
PxrUsdMayaShadingModeExportContext::MakeStandardMaterialPrim(
        const AssignmentVector& assignmentsToBind,
        const std::string& name) const
{
    UsdPrim ret;

    std::string materialName = name;
    if (materialName.empty()) {
        MStatus status;
        MFnDependencyNode seDepNode(_shadingEngine, &status);
        if (!status) {
            return ret;
        }
        MString seName = seDepNode.name();
        materialName = MNamespace::stripNamespaceFromName(seName).asChar();
    }

    materialName = PxrUsdMayaUtil::SanitizeName(materialName);
    UsdStageRefPtr stage = GetUsdStage();
    if (UsdPrim materialParent = _GetMaterialParent(stage, assignmentsToBind)) {
        SdfPath materialPath = materialParent.GetPath().AppendChild(
                TfToken(materialName));
        UsdShadeMaterial material = UsdShadeMaterial::Define(
                GetUsdStage(), materialPath);

        UsdPrim materialPrim = material.GetPrim();

        // could use this to determine where we want to export.
        TF_FOR_ALL(iter, assignmentsToBind) {
            const SdfPath &boundPrimPath = iter->first;
            const VtIntArray &faceIndices = iter->second;

            UsdPrim boundPrim = stage->OverridePrim(boundPrimPath);
            if (faceIndices.empty()) {
                material.Bind(boundPrim);
            } else if (TfGetEnvSetting(PIXMAYA_EXPORT_OLD_STYLE_FACESETS)) {
                UsdGeomFaceSetAPI faceSet = material.CreateMaterialFaceSet(
                        boundPrim);
                faceSet.AppendFaceGroup(faceIndices, materialPath);
            } else {
                // It might be worth adding a utility method for the following 
                // block of code in core.
                UsdGeomSubset faceSubset = 
                    UsdShadeMaterial::CreateMaterialBindFaceSubset(
                        UsdGeomImageable(boundPrim), 
                        /* subsetName */ TfToken(materialName),
                        faceIndices);
                material.Bind(faceSubset.GetPrim());

                UsdShadeMaterial::SetMaterialBindFaceSubsetsFamilyType(
                    UsdGeomImageable(boundPrim), 
                    UsdGeomSubset::FamilyType::Partition);
            }
        }

        return materialPrim;
    }
开发者ID:mplanck,项目名称:USD,代码行数:58,代码来源:shadingModeExporterContext.cpp

示例3: glslfx

Hd_PointsShaderKey::Hd_PointsShaderKey()
    : glslfx(_tokens->baseGLSLFX)
{
    VS[0] = _tokens->instancing;
    VS[1] = _tokens->mainVS;
    VS[2] = TfToken();

    FS[0] = _tokens->mainFS;
    FS[1] = TfToken();
}
开发者ID:400dama,项目名称:USD,代码行数:10,代码来源:pointsShaderKey.cpp

示例4: _PropName

TfToken
UsdProperty::GetNamespace() const
{
    std::string const &fullName = _PropName().GetString();
    size_t delim = fullName.rfind(GetNamespaceDelimiter());

    if (!TF_VERIFY(delim != fullName.size()-1))
        return TfToken();

    return ((delim == std::string::npos) ?
            TfToken() :
            TfToken(fullName.substr(0, delim)));
}
开发者ID:lvxejay,项目名称:USD,代码行数:13,代码来源:property.cpp

示例5: _GetMetadataUnchecked

static bool
_GetMetadataUnchecked(
    const MFnDependencyNode& node,
    const TfToken& key,
    VtValue* value)
{
    VtValue fallback = SdfSchema::GetInstance().GetFallback(key);
    if (fallback.IsEmpty()) {
        return false;
    }

    std::string mayaAttrName = _GetMayaAttrNameForMetadataKey(key);
    MPlug plug = node.findPlug(mayaAttrName.c_str());
    if (plug.isNull()) {
        return false;
    }

    TfType ty = fallback.GetType();
    VtValue result = UsdMayaWriteUtil::GetVtValue(plug, ty, TfToken());
    if (result.IsEmpty()) {
        TF_RUNTIME_ERROR(
                "Cannot convert plug '%s' into metadata '%s' (%s)",
                plug.name().asChar(),
                key.GetText(),
                ty.GetTypeName().c_str());
        return false;
    }

    *value = result;
    return true;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:31,代码来源:adaptor.cpp

示例6: _MakeNamespaced

/* static */
TfToken 
UsdGeomXformOp::GetOpName(
    const Type opType, 
    const TfToken &opSuffix,
    bool isInverseOp)
{
    TfToken opName = _MakeNamespaced(GetOpTypeToken(opType));

    if (!opSuffix.IsEmpty())
        opName = TfToken(opName.GetString() + ":" + opSuffix.GetString());

    if (isInverseOp)
        opName = TfToken(_tokens->invertPrefix.GetString() + opName.GetString());

    return opName;
}
开发者ID:JT-a,项目名称:USD,代码行数:17,代码来源:xformOp.cpp

示例7: TRACE_FUNCTION

SdfAttributeSpecHandle
SdfAttributeSpec::New(
    const SdfPrimSpecHandle& owner,
    const std::string& name,
    const SdfValueTypeName& typeName,
    SdfVariability variability,
    bool custom)
{
    TRACE_FUNCTION();

    if (not owner) {
	TF_CODING_ERROR("Cannot create an SdfAttributeSpec with a null owner");
	return TfNullPtr;
    }

    if (not Sdf_ChildrenUtils<Sdf_AttributeChildPolicy>::IsValidName(name)) {
        TF_CODING_ERROR(
            "Cannot create attribute on %s with invalid name: %s",
            owner->GetPath().GetText(), name.c_str());
        return TfNullPtr;
    }

    SdfPath attributePath = owner->GetPath().AppendProperty(TfToken(name));
    if (not attributePath.IsPropertyPath()) {
        TF_CODING_ERROR(
            "Cannot create attribute at invalid path <%s.%s>",
            owner->GetPath().GetText(), name.c_str());
        return TfNullPtr;
    }

    return _New(owner, attributePath, typeName, variability, custom);
}
开发者ID:400dama,项目名称:USD,代码行数:32,代码来源:attributeSpec.cpp

示例8:

bool
SdfPropertySpec::CanSetName(const std::string &newName,
                               std::string *whyNot) const
{
    return Sdf_ChildrenUtils<Sdf_PropertyChildPolicy>::CanRename(
        *this, TfToken(newName)).IsAllowed(whyNot);
}
开发者ID:400dama,项目名称:USD,代码行数:7,代码来源:propertySpec.cpp

示例9: _lightingContext

PXR_NAMESPACE_OPEN_SCOPE


HdxSimpleLightingShader::HdxSimpleLightingShader() 
    : _lightingContext(GlfSimpleLightingContext::New())
    , _bindingMap(TfCreateRefPtr(new GlfBindingMap()))
    , _useLighting(true)
{
    // TODO: robust binding from codegen
    _bindingMap->GetUniformBinding(TfToken("GlobalUniform"));
    _bindingMap->GetUniformBinding(TfToken("DrawDataBuffer"));
    _lightingContext->InitUniformBlockBindings(_bindingMap);
    _lightingContext->InitSamplerUnitBindings(_bindingMap);

    _glslfx.reset(new GlfGLSLFX(HdxPackageSimpleLightingShader()));
}
开发者ID:lvxejay,项目名称:USD,代码行数:16,代码来源:simpleLightingShader.cpp

示例10: TfToken

/* static */
TfToken
UsdGeomConstraintTarget::GetConstraintAttrName(
    const std::string &constraintName)
{
    return TfToken(_tokens->constraintTargets.GetString() + ":" +
                   constraintName);
}
开发者ID:ZeroCrunch,项目名称:USD,代码行数:8,代码来源:constraintTarget.cpp

示例11: GetPluginDescs

TfToken 
HdxRendererPluginRegistry::GetDefaultPluginId()
{
    // Get all the available plugins to see if any of them is supported on this
    // platform and use the first one as the default.
    // 
    // Important note, we want to avoid loading plugins as much as possible, 
    // we would prefer to only load plugins when the user asks for them.  So
    // we will only load plugins until we find the first one that works.
    HfPluginDescVector pluginDescriptors;
    GetPluginDescs(&pluginDescriptors);
    for (const HfPluginDesc &desc : pluginDescriptors) {
        
        HdxRendererPlugin *plugin = HdxRendererPluginRegistry::GetInstance().
            GetRendererPlugin(desc.id);

        // Important to bail out as soon as we found a plugin that works to
        // avoid loading plugins unnecessary as that can be arbitrarily
        // expensive.
        if (plugin && plugin->IsSupported()) {
            HdxRendererPluginRegistry::GetInstance().ReleasePlugin(plugin);
            return desc.id;
        }

        HdxRendererPluginRegistry::GetInstance().ReleasePlugin(plugin);
    }

    return TfToken();
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:29,代码来源:rendererPluginRegistry.cpp

示例12: TfToken

TfToken 
UsdGeomXformOp::GetOpName() const
{
    return _isInverseOp ? TfToken(_tokens->invertPrefix.GetString() + 
                                  GetName().GetString()) 
                        : GetName();
}
开发者ID:JT-a,项目名称:USD,代码行数:7,代码来源:xformOp.cpp

示例13: TfToken

TfToken
UsdMayaAdaptor::GetUsdTypeName() const
{
    if (!*this) {
        return TfToken();
    }

    const TfType ty = GetUsdType();
    const SdfPrimSpecHandle primDef = UsdSchemaRegistry::GetInstance()
            .GetPrimDefinition(ty);
    if (!primDef) {
        return TfToken();
    }

    return primDef->GetNameToken();
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:16,代码来源:adaptor.cpp

示例14: _GetMaterialsScopeName

static
TfToken
_GetMaterialsScopeName(const std::string& materialsScopeName)
{
    const TfToken defaultMaterialsScopeName = UsdUtilsGetMaterialsScopeName();

    if (TfGetEnvSetting(USD_FORCE_DEFAULT_MATERIALS_SCOPE_NAME)) {
        // If the env setting is set, make sure we don't allow the materials
        // scope name to be overridden by a parameter value.
        return defaultMaterialsScopeName;
    }

    if (SdfPath::IsValidIdentifier(materialsScopeName)) {
        return TfToken(materialsScopeName);
    }

    TF_CODING_ERROR(
        "'%s' value '%s' is not a valid identifier. Using default "
        "value of '%s' instead.",
        UsdMayaJobExportArgsTokens->materialsScopeName.GetText(),
        materialsScopeName.c_str(),
        defaultMaterialsScopeName.GetText());

    return defaultMaterialsScopeName;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:25,代码来源:jobArgs.cpp

示例15: TfToken

bool MayaMeshWriter::_createUVPrimVar(
        UsdGeomGprim &primSchema,
        const TfToken& name,
        const VtArray<GfVec2f>& data,
        const TfToken& interpolation,
        const VtArray<int>& assignmentIndices,
        const int unassignedValueIndex)
{
    unsigned int numValues = data.size();
    if (numValues == 0) {
        return false;
    }

    TfToken interp = interpolation;
    if (numValues == 1 && interp == UsdGeomTokens->constant) {
        interp = TfToken();
    }

    UsdGeomPrimvar primVar =
        primSchema.CreatePrimvar(name,
                                 SdfValueTypeNames->Float2Array,
                                 interp);

    primVar.Set(data);

    if (!assignmentIndices.empty()) {
        primVar.SetIndices(assignmentIndices);
        if (unassignedValueIndex != primVar.GetUnauthoredValuesIndex()) {
           primVar.SetUnauthoredValuesIndex(unassignedValueIndex);
        }
    }

    return true;
}
开发者ID:lvxejay,项目名称:USD,代码行数:34,代码来源:MayaMeshWriter_PrimVars.cpp


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