TfType UsdMayaAdaptor::GetUsdType() const { if (!*this) { return TfType(); } MObject object = _handle.object(); MFnDependencyNode depNode(object); // The adaptor type mapping might be registered externally in a prim writer // plugin. This simply pokes the prim writer registry to load the prim // writer plugin in order to pull in the adaptor mapping. UsdMayaPrimWriterRegistry::Find(depNode.typeName().asChar()); TfRegistryManager::GetInstance().SubscribeTo<UsdMayaAdaptor>(); const auto iter = _schemaLookup.find(depNode.typeName().asChar()); if (iter != _schemaLookup.end()) { return iter->second; } else { return TfType(); } }
TfType SdfPropertySpec::GetValueType() const { // The value type of an attribute is specified by the user when it is // constructed, while the value type of a relationship is always SdfPath. // Normally, one would use virtual functions to encapsulate this difference; // however we don't want to use virtuals as SdfSpec and its subclasses are // intended to be simple value types that are merely wrappers around // a layer. So, we have this hacky 'virtual' function. switch (GetSpecType()) { case SdfSpecTypeAttribute: return GetSchema().FindType(_GetAttributeValueTypeName()).GetType(); case SdfSpecTypeRelationship: { static const TfType type = TfType::Find<SdfPath>(); return type; } default: TF_CODING_ERROR("Unrecognized subclass of SdfPropertySpec on <%s>", GetPath().GetText()); return TfType(); } }