[Bf-blender-cvs] [ce4c16b7e29] master: USD: fix startup issue on linux

Ray Molenkamp noreply at git.blender.org
Thu Dec 8 22:08:11 CET 2022


Commit: ce4c16b7e2985b706e409df7d0ffa64b7e6c6dd6
Author: Ray Molenkamp
Date:   Thu Dec 8 14:08:06 2022 -0700
Branches: master
https://developer.blender.org/rBce4c16b7e2985b706e409df7d0ffa64b7e6c6dd6

USD: fix startup issue on linux

On linux a man page is generated before the
scripts are installed, this lead to USD getting
a null pointer for it's pluging path and crashing
the process.

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

M	source/blender/io/usd/intern/usd_common.cc

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

diff --git a/source/blender/io/usd/intern/usd_common.cc b/source/blender/io/usd/intern/usd_common.cc
index e5a83442140..2cfd3c5196e 100644
--- a/source/blender/io/usd/intern/usd_common.cc
+++ b/source/blender/io/usd/intern/usd_common.cc
@@ -23,9 +23,12 @@ void ensure_usd_plugin_path_registered()
 
   /* Tell USD which directory to search for its JSON files. If 'datafiles/usd'
    * does not exist, the USD library will not be able to read or write any files. */
-  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 + "/");
+  const char *blender_usd_datafiles = BKE_appdir_folder_id(BLENDER_DATAFILES, "usd");
+  if (blender_usd_datafiles) {
+    const std::string blender_usd_data_folder = blender_usd_datafiles;
+    /* The trailing slash indicates to the USD library that the path is a directory. */
+    pxr::PlugRegistry::GetInstance().RegisterPlugins(blender_usd_data_folder + "/");
+  }
 #endif
 }



More information about the Bf-blender-cvs mailing list