本文整理汇总了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();
}
示例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;
}
示例3: _IsNamespaced
static
TfToken
_MakeNamespaced(const TfToken& name)
{
return _IsNamespaced(name) ? name :
TfToken(_tokens->xformOpPrefix.GetString() +
name.GetString());
}
示例4: TfToken
TfToken
UsdGeomCollectionAPI::_GetCollectionPropertyName(
const TfToken &baseName /* =TfToken() */) const
{
return TfToken(UsdGeomTokens->collection.GetString() + ":" +
_name.GetString() +
(baseName.IsEmpty() ? "" : (":" + baseName.GetString())));
}
示例5: TfStringPrintf
PXR_NAMESPACE_OPEN_SCOPE
static std::string
_GetMayaAttrNameForMetadataKey(const TfToken& key)
{
return TfStringPrintf("USD_%s",
TfMakeValidIdentifier(key.GetString()).c_str());
}
示例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;
}
示例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;
}
示例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();
}
示例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));
}
示例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.
}
示例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();
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}