[Bf-blender-cvs] [7eb3008d99d] tmp_libupdate_34: USD: Fix failing tests with 3.3 libs

Ray Molenkamp noreply at git.blender.org
Mon Aug 22 18:11:22 CEST 2022


Commit: 7eb3008d99dcb91eba380d01382625fb7cf4ea0f
Author: Ray Molenkamp
Date:   Mon Aug 22 10:11:12 2022 -0600
Branches: tmp_libupdate_34
https://developer.blender.org/rB7eb3008d99dcb91eba380d01382625fb7cf4ea0f

USD: Fix failing tests with 3.3 libs

===================================================================

M	source/blender/io/usd/intern/usd_common.cc
M	source/blender/io/usd/tests/usd_tests_common.cc
M	source/creator/CMakeLists.txt

===================================================================

diff --git a/source/blender/io/usd/intern/usd_common.cc b/source/blender/io/usd/intern/usd_common.cc
index 821e2ca0783..e5a83442140 100644
--- a/source/blender/io/usd/intern/usd_common.cc
+++ b/source/blender/io/usd/intern/usd_common.cc
@@ -11,11 +11,10 @@ namespace blender::io::usd {
 
 void ensure_usd_plugin_path_registered()
 {
-  /* Windows copies the files already to the right location, no hinting
-   * is required. */
-#ifdef WIN32
-  return;
-#endif
+  /* if PXR_PYTHON_SUPPORT_ENABLED is defined, we *must* be dynamic and
+     the plugins are placed relative to the USD shared library hence no
+     hinting is required. */
+#ifndef PXR_PYTHON_SUPPORT_ENABLED
   static bool plugin_path_registered = false;
   if (plugin_path_registered) {
     return;
@@ -27,6 +26,7 @@ void ensure_usd_plugin_path_registered()
   const std::string blender_usd_datafiles = BKE_appdir_folder_id(BLENDER_DATAFILES, "usd");
   /* The trailing slash indicates to the USD library that the path is a directory. */
   pxr::PlugRegistry::GetInstance().RegisterPlugins(blender_usd_datafiles + "/");
+#endif
 }
 
 }  // namespace blender::io::usd
diff --git a/source/blender/io/usd/tests/usd_tests_common.cc b/source/blender/io/usd/tests/usd_tests_common.cc
index 9f18a289433..d9285b3f3db 100644
--- a/source/blender/io/usd/tests/usd_tests_common.cc
+++ b/source/blender/io/usd/tests/usd_tests_common.cc
@@ -36,9 +36,12 @@ std::string register_usd_plugins_for_tests()
   BLI_assert(path_len + 1 < FILE_MAX);
   usd_datafiles_dir[path_len] = '/';
   usd_datafiles_dir[path_len + 1] = '\0';
-
+  /* if PXR_PYTHON_SUPPORT_ENABLED is defined, we *must* be dynamic and
+     the plugins are placed relative to the USD shared library hence no
+     hinting is required. */
+#ifndef PXR_PYTHON_SUPPORT_ENABLED
   pxr::PlugRegistry::GetInstance().RegisterPlugins(usd_datafiles_dir);
-
+#endif
   return usd_datafiles_dir;
 }
 
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index dd579d90a54..a4068e63182 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1306,8 +1306,9 @@ if(WITH_USD)
   add_definitions(-DWITH_USD)
   blender_include_dirs(../blender/io/usd)
   # On windows the usd library site in ./blender.shared copy the files
-  # relative to the location of the USD dll.
-  if(WIN32)
+  # relative to the location of the USD dll, if the dll does not exist
+  # assume we are linking against the static 3.4 lib.
+  if(WIN32 AND EXISTS ${LIBDIR}/usd/lib/usd_usd_ms.dll)
     install(DIRECTORY
       ${USD_LIBRARY_DIR}/usd
       DESTINATION "./blender.shared"



More information about the Bf-blender-cvs mailing list