Ejemplo n.º 1
0
static bool
_ProvidesForType(
        const PlugPluginPtr& plug,
        const std::vector<TfToken>& scope,
        const std::string& typeName,
        std::string* mayaPluginName)
{

    JsObject metadata = plug->GetMetadata();
    JsObject mayaTranslatorMetadata;
    if (!_ReadNestedDict(metadata, scope, &mayaTranslatorMetadata)) {
        return false;
    }

    JsValue any;
    if (!TfMapLookup(mayaTranslatorMetadata, _tokens->providesTranslator, &any)) {
        return false;
    }
    std::vector<std::string> usdTypes;
    if (!_GetData(any, &usdTypes)) {
        return false;
    }

    bool provides = std::find(
            usdTypes.begin(), usdTypes.end(), 
            typeName) != usdTypes.end();
    if (provides) {
        if (TfMapLookup(mayaTranslatorMetadata, _tokens->mayaPlugin, &any)) {
            return _GetData(any, mayaPluginName);
        }
    }

    return provides;
}
Ejemplo n.º 2
0
static bool
_HasShadingModePlugin(
    const PlugPluginPtr& plug,
    const std::vector<TfToken>& scope,
    std::string* mayaPluginName)
{
    JsObject metadata = plug->GetMetadata();
    JsObject mayaTranslatorMetadata;
    if (!_ReadNestedDict(metadata, scope, &mayaTranslatorMetadata)) {
        return false;
    }

    JsValue any;
    if (TfMapLookup(mayaTranslatorMetadata, _tokens->mayaPlugin, &any)) {
        return _GetData(any, mayaPluginName);
    }

    return false;
}