TfToken UsdProperty::GetBaseName() 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) ? _PropName() : TfToken(fullName.c_str() + delim+1)); }
SdfRelationshipSpecHandle UsdRelationship::_CreateSpec(bool fallbackCustom) const { UsdStage *stage = _GetStage(); // Try to create a spec for editing either from the definition or from // copying existing spec info. TfErrorMark m; if (SdfRelationshipSpecHandle relSpec = stage->_CreateRelationshipSpecForEditing(*this)) { return relSpec; } // If creating the spec on the stage failed without issuing an error, that // means there was no existing authored scene description to go on (i.e. no // builtin info from prim type, and no existing authored spec). Stamp a // spec with the provided default values. if (m.IsClean()) { SdfChangeBlock block; return SdfRelationshipSpec::New( stage->_CreatePrimSpecForEditing(GetPrimPath()), _PropName().GetString(), /* custom = */ fallbackCustom, SdfVariabilityUniform); } return TfNullPtr; }
bool UsdProperty::IsAuthoredAt(const UsdEditTarget &editTarget) const { if (editTarget.IsValid()) { SdfPath mappedPath = editTarget.MapToSpecPath(GetPrimPath()); return !mappedPath.IsEmpty() && editTarget.GetLayer()->HasSpec( SdfAbstractDataSpecId(&mappedPath, &_PropName())); } return false; }
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; }
std::vector<std::string> UsdProperty::SplitName() const { return SdfPath::TokenizeIdentifier(_PropName()); }