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


C++ TfToken::GetString方法代码示例

本文整理汇总了C++中TfToken::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ TfToken::GetString方法的具体用法?C++ TfToken::GetString怎么用?C++ TfToken::GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TfToken的用法示例。


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

示例1: newProgram

HdStGLSLProgramSharedPtr
HdStGLSLProgram::GetComputeProgram(
        TfToken const &shaderToken,
        HdStResourceRegistry *resourceRegistry)
{
    // Find the program from registry
    HdInstance<HdStGLSLProgram::ID, HdStGLSLProgramSharedPtr> programInstance;

    std::unique_lock<std::mutex> regLock = 
        resourceRegistry->RegisterGLSLProgram(
            HdStGLSLProgram::ComputeHash(shaderToken), &programInstance);

    if (programInstance.IsFirstInstance()) {
        // if not exists, create new one
        HdStGLSLProgramSharedPtr newProgram(
            new HdStGLSLProgram(HdTokens->computeShader));

        GlfGLSLFX glslfx(HdStPackageComputeShader());
        std::string version = "#version 430\n";
        if (!newProgram->CompileShader(
                GL_COMPUTE_SHADER, version + glslfx.GetSource(shaderToken))) {
            TF_CODING_ERROR("Fail to compile " + shaderToken.GetString());
            return HdStGLSLProgramSharedPtr();
        }
        if (!newProgram->Link()) {
            TF_CODING_ERROR("Fail to link " + shaderToken.GetString());
            return HdStGLSLProgramSharedPtr();
        }
        programInstance.SetValue(newProgram);
    }
    return programInstance.GetValue();
}
开发者ID:rodeofx,项目名称:USD,代码行数:32,代码来源:glslProgram.cpp

示例2: TfToken

/* 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

示例3: _IsNamespaced

static
TfToken
_MakeNamespaced(const TfToken& name)
{
    return _IsNamespaced(name) ? name : 
        TfToken(_tokens->xformOpPrefix.GetString() + 
                name.GetString());
}
开发者ID:JT-a,项目名称:USD,代码行数:8,代码来源:xformOp.cpp

示例4: TfToken

TfToken 
UsdGeomCollectionAPI::_GetCollectionPropertyName(
    const TfToken &baseName /* =TfToken() */) const
{
    return TfToken(UsdGeomTokens->collection.GetString() + ":" + 
                   _name.GetString() + 
                   (baseName.IsEmpty() ? "" : (":" + baseName.GetString())));
}
开发者ID:JT-a,项目名称:USD,代码行数:8,代码来源:collectionAPI.cpp

示例5: TfStringPrintf

PXR_NAMESPACE_OPEN_SCOPE

static std::string
_GetMayaAttrNameForMetadataKey(const TfToken& key)
{
    return TfStringPrintf("USD_%s",
            TfMakeValidIdentifier(key.GetString()).c_str());
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:8,代码来源:adaptor.cpp

示例6: ArchHash

/* static */
HdStGLSLProgram::ID
HdStGLSLProgram::ComputeHash(TfToken const &sourceFile)
{
    HD_TRACE_FUNCTION();

    uint32_t hash = 0;
    std::string const &filename = sourceFile.GetString();
    hash = ArchHash(filename.c_str(), filename.size(), hash);

    return hash;
}
开发者ID:rodeofx,项目名称:USD,代码行数:12,代码来源:glslProgram.cpp

示例7: TfToken

TfToken
UsdVolVolume::_MakeNamespaced(const TfToken& name)
{
    TfToken result;

    if (TfStringStartsWith(name, _tokens->fieldPrefix)) {
	result = name;
    }
    else {
	result = TfToken(_tokens->fieldPrefix.GetString() + name.GetString());
    }

    return result;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:14,代码来源:volume.cpp

示例8: GetPrim

UsdAttribute
UsdRiStatementsAPI::GetRiAttribute(
    const TfToken &name, 
    const std::string &nameSpace)
{
    TfToken fullName = _MakeRiAttrNamespace(nameSpace, name.GetString());
    if (UsdGeomPrimvar p = UsdGeomPrimvarsAPI(GetPrim()).GetPrimvar(fullName)) {
        return p;
    }
    if (TfGetEnvSetting(USDRI_STATEMENTS_READ_OLD_ATTR_ENCODING)) {
        return GetPrim().GetAttribute(fullName);
    }
    return UsdAttribute();
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:14,代码来源:statementsAPI.cpp

示例9: EmptyPath

SdfPath
SdfPath::AppendProperty(TfToken const &propName) const {
    if (!IsValidNamespacedIdentifier(propName.GetString())) {
        //TF_WARN("Invalid property name.");
        return EmptyPath();
    }
    if (!IsPrimVariantSelectionPath() && 
        !IsPrimPath() && 
                (_pathNode != Sdf_PathNode::GetRelativeRootNode())) {
        TF_WARN("Can only append a property '%s' to a prim path (%s)",
                propName.GetText(), GetText());
        return EmptyPath();
    }
    return SdfPath(Sdf_PathNode::FindOrCreatePrimProperty(_pathNode, propName));
}
开发者ID:lvxejay,项目名称:USD,代码行数:15,代码来源:path.cpp

示例10:

SdfFileFormat::SdfFileFormat(
    const TfToken& formatId,
    const TfToken& versionString,
    const TfToken& target,
    const std::string& extension)
    : _formatId(formatId)
    , _target(target)
    , _cookie("#" + formatId.GetString())
    , _versionString(versionString)
    , _extensions(1, extension)
    , _isPrimaryFormat(
        _FileFormatRegistry
            ->GetPrimaryFormatForExtension(extension) == formatId)
{
    // Do Nothing.
}
开发者ID:rodeofx,项目名称:USD,代码行数:16,代码来源:fileFormat.cpp

示例11: IsValidNamespacedIdentifier

std::string
UsdRiStatementsAPI::MakeRiAttributePropertyName(const std::string &attrName)
{
    std::vector<string> names = TfStringTokenize(attrName, ":");

    // If this is an already-encoded name, return it unchanged.
    if (TfGetEnvSetting(USDRI_STATEMENTS_WRITE_NEW_ATTR_ENCODING)) {
        if (names.size() == 5 &&
            TfStringStartsWith(attrName, _tokens->primvarAttrNamespace)) {
            return attrName;
        }
    }
    if (names.size() == 4 &&
        TfStringStartsWith(attrName, _tokens->fullAttributeNamespace)) {
        return attrName;
    }

    // Attempt to parse namespaces in different forms.
    if (names.size() == 1) {
        names = TfStringTokenize(attrName, ".");
    }
    if (names.size() == 1) {
        names = TfStringTokenize(attrName, "_");
    }

    // Fallback to user namespace if no other exists.
    if (names.size() == 1) {
        names.insert(names.begin(), "user");
    }

    TfToken prefix =
        TfGetEnvSetting(USDRI_STATEMENTS_WRITE_NEW_ATTR_ENCODING) ?
        _tokens->primvarAttrNamespace :
        _tokens->fullAttributeNamespace;

    string fullName = prefix.GetString() + 
        names[0] + ":" + ( names.size() > 2 ?
                           TfStringJoin(names.begin() + 1, names.end(), "_")
                           : names[1]);

    return SdfPath::IsValidNamespacedIdentifier(fullName) ? fullName : string();
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:42,代码来源:statementsAPI.cpp

示例12: UsdGeomPrimvarsAPI

UsdAttribute
UsdRiStatementsAPI::CreateRiAttribute(
    const TfToken &name, 
    const TfType &tfType,
    const string &nameSpace)
{
    TfToken fullName = _MakeRiAttrNamespace(nameSpace, name.GetString());
    SdfValueTypeName usdType = SdfSchema::GetInstance().FindType(tfType);
    if (TfGetEnvSetting(USDRI_STATEMENTS_WRITE_NEW_ATTR_ENCODING)) {
        return UsdGeomPrimvarsAPI(GetPrim())
            .CreatePrimvar(fullName, usdType).GetAttr();
    } else {
        UsdAttribute attr = GetPrim().CreateAttribute(fullName, usdType,
                                                      /* custom = */ false);
        if (!TF_VERIFY(attr)) {
            return UsdAttribute();
        }
        return attr;
    }
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:20,代码来源:statementsAPI.cpp

示例13:

void
KindRegistry::_Register(const TfToken& kind,
                        const TfToken& baseKind)
{
    if (not TfIsValidIdentifier(kind.GetString())) {
        TF_CODING_ERROR("Invalid kind: '%s'", kind.GetText());
        return;
    }

    _KindMap::const_iterator it = _kindMap.find(kind);

    if (it != _kindMap.end()) {
        TF_CODING_ERROR("Kind '%s' has already been registered",
                        kind.GetText());
        return;
    }

    _KindData data;
    data.baseKind = baseKind;
    _kindMap[kind] = data;
}
开发者ID:400dama,项目名称:USD,代码行数:21,代码来源:registry.cpp

示例14: TfToken

/* static */
TfToken
UsdSkelInbetweenShape::_MakeNamespaced(const TfToken& name, bool quiet)
{
    TfToken result;
    if(_IsNamespaced(name)){
        result = name;
    } else {
        result = TfToken(_tokens->inbetweensPrefix.GetString() +
                         name.GetString());
    }

    // XXX: All properly namespaced attributes are legal inbetweens.
    // However, if we extend the schema to include any special attributes
    // -- such as a namespaced pointIndices attr on each shape -- then  
    // we must validate that the name does not conflict with those.

    if(!_IsValidInbetweenName(result, quiet)) {
        result = TfToken();
    }
    return result;
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:22,代码来源:inbetweenShape.cpp

示例15: TfToken

/* static */
TfToken
UsdGeomPrimvar::_MakeNamespaced(const TfToken& name, bool quiet)
{
    TfToken  result;
    if (_IsNamespaced(name)){
        result = name;
    }
    else {
        result = TfToken(_tokens->primvarsPrefix.GetString() + name.GetString());
    }

    if (_ContainsExtraNamespaces(result)){
        result = TfToken();
        if (!quiet){
            TF_CODING_ERROR("%s is not a valid name for a Primvar, because"
                            " it contains namespaces.",
                            name.GetText());
        }
    }
    
    return result;
}
开发者ID:JT-a,项目名称:USD,代码行数:23,代码来源:primvar.cpp


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