MCPcopy Create free account
hub / github.com/LucaScheller/VFX-UsdAssetResolver / _CreateIdentifier

Method _CreateIdentifier

src/PythonResolver/resolver.cpp:32–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30PythonResolver::~PythonResolver() = default;
31
32std::string
33PythonResolver::_CreateIdentifier(
34 const std::string& assetPath,
35 const ArResolvedPath& anchorAssetPath) const
36{
37 const PythonResolverContext* contexts[2] = {this->_GetCurrentContextPtr(), &_fallbackContext};
38 std::string serializedContext = "";
39 std::string serializedFallbackContext = _fallbackContext.GetData();
40 if (contexts[0] != nullptr){serializedContext=this->_GetCurrentContextPtr()->GetData();}
41 TF_DEBUG(PYTHONRESOLVER_RESOLVER).Msg("Resolver::_CreateIdentifier('%s', '%s', '%s', '%s')\n",
42 assetPath.c_str(), anchorAssetPath.GetPathString().c_str(),
43 serializedContext.c_str(), serializedFallbackContext.c_str());
44 std::string pythonResult;
45 int state = TfPyInvokeAndExtract(DEFINE_STRING(AR_PYTHONRESOLVER_USD_PYTHON_EXPOSE_MODULE_NAME),
46 "Resolver._CreateIdentifier",
47 &pythonResult, assetPath, anchorAssetPath, serializedContext, serializedFallbackContext);
48 if (!state) {
49 std::cerr << "Failed to call Resolver._CreateIdentifier in " << DEFINE_STRING(AR_PYTHONRESOLVER_USD_PYTHON_EXPOSE_MODULE_NAME) << ".py. ";
50 std::cerr << "Please verify that the python code is valid!" << std::endl;
51 }
52 return pythonResult;
53}
54
55std::string
56PythonResolver::_CreateIdentifierForNewAsset(

Callers

nothing calls this directly

Calls 1

_GetCurrentContextPtrMethod · 0.95

Tested by

no test coverage detected