| 72 | } |
| 73 | |
| 74 | ArResolvedPath |
| 75 | PythonResolver::_Resolve( |
| 76 | const std::string& assetPath) const |
| 77 | { |
| 78 | const PythonResolverContext* contexts[2] = {this->_GetCurrentContextPtr(), &_fallbackContext}; |
| 79 | std::string serializedContext = ""; |
| 80 | std::string serializedFallbackContext = _fallbackContext.GetData(); |
| 81 | if (contexts[0] != nullptr){serializedContext=this->_GetCurrentContextPtr()->GetData();} |
| 82 | TF_DEBUG(PYTHONRESOLVER_RESOLVER).Msg("Resolver::_Resolve('%s', '%s', '%s')\n", assetPath.c_str(), |
| 83 | serializedContext.c_str(), serializedFallbackContext.c_str()); |
| 84 | ArResolvedPath pythonResult; |
| 85 | int state = TfPyInvokeAndExtract(DEFINE_STRING(AR_PYTHONRESOLVER_USD_PYTHON_EXPOSE_MODULE_NAME), |
| 86 | "Resolver._Resolve", |
| 87 | &pythonResult, assetPath, serializedContext, serializedFallbackContext); |
| 88 | if (!state) { |
| 89 | std::cerr << "Failed to call Resolver._Resolve in " << DEFINE_STRING(AR_PYTHONRESOLVER_USD_PYTHON_EXPOSE_MODULE_NAME) << ".py. "; |
| 90 | std::cerr << "Please verify that the python code is valid!" << std::endl; |
| 91 | } |
| 92 | return pythonResult; |
| 93 | } |
| 94 | |
| 95 | ArResolvedPath |
| 96 | PythonResolver::_ResolveForNewAsset( |
no test coverage detected