Skip to content

Commit

Permalink
Changed HtoAConvertPrimVdbToArnold symbol lookup from pythonX.Xlibs/_…
Browse files Browse the repository at this point in the history
…htoa_pygeo lookup to scripts/bin/htoa_geo.dll (#1850)
  • Loading branch information
TomMinor authored Feb 9, 2024
1 parent df45feb commit 14659e7
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions libs/render_delegate/volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,43 +119,42 @@ struct HtoAFnSet {
/// installed in a path containing `;` or `&`.
constexpr auto convertVdbName = "HtoAConvertPrimVdbToArnold";
const auto HOUDINI_PATH = ArchGetEnv("HOUDINI_PATH");
auto searchForPygeo = [&](const std::string& path) -> bool {
auto searchForLibHtoaGeo = [&](const std::string& path) -> bool {
if (path == "&") {
return false;
}
std::string dsoPath;
void* htoaPygeo = nullptr;
#ifdef ARCH_OS_WINDOWS
std::string ext = ".dll";
#if defined(ARCH_OS_WINDOWS)
constexpr const char* htoaGeoDso = "htoa_geo.dll";
#elif defined(ARCH_OS_LINUX)
constexpr const char* htoaGeoDso = "libhtoa_geo.so";
#elif defined(ARCH_OS_OSX)
constexpr const char* htoaGeoDso = "libhtoa_geo.dylib";
#else
std::string ext = ".so";
TF_WARN("Error loading %s - unsupported architecture", convertVdbName);
return false;
#endif
// TODO: we need to find a solution that doesn't require to add the future python version of houdini
std::array<std::string, 4> pythonVersions = {"2.7", "3.7", "3.9", "3.10"};
for (const auto &pyVer : pythonVersions) {
dsoPath = path + ARCH_PATH_SEP + "python" + pyVer + "libs" + ARCH_PATH_SEP + "_htoa_pygeo" + ext;
htoaPygeo = ArchLibraryOpen(dsoPath, ARCH_LIBRARY_NOW);
if (htoaPygeo) break;
}
if (!htoaPygeo) {

const std::string dsoPath = path + ARCH_PATH_SEP + "scripts" ARCH_PATH_SEP + "bin" + ARCH_PATH_SEP + htoaGeoDso;
void* htoaGeo = ArchLibraryOpen(dsoPath, ARCH_LIBRARY_NOW);
if (!htoaGeo) {
return false;
}
convertPrimVdbToArnold = reinterpret_cast<HtoAConvertPrimVdbToArnold>(GETSYM(htoaPygeo, convertVdbName));
convertPrimVdbToArnold = reinterpret_cast<HtoAConvertPrimVdbToArnold>(GETSYM(htoaGeo, convertVdbName));
if (convertPrimVdbToArnold == nullptr) {
TF_WARN("Error loading %s from %s", convertVdbName, dsoPath.c_str());
}
return true;
};
const auto houdiniPaths = TfStringSplit(HOUDINI_PATH, ARCH_PATH_LIST_SEP);
for (const auto& houdiniPath : houdiniPaths) {
if (searchForPygeo(houdiniPath)) {
if (searchForLibHtoaGeo(houdiniPath)) {
return;
}
#ifndef ARCH_OS_WINDOWS
if (TfStringContains(houdiniPath, ";")) {
const auto subPaths = TfStringSplit(houdiniPath, ";");
for (const auto& subPath : subPaths) {
if (searchForPygeo(subPath)) {
if (searchForLibHtoaGeo(subPath)) {
return;
}
}
Expand Down

0 comments on commit 14659e7

Please sign in to comment.