Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r--source/creator/creator.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c
index f4f5e3dcbde..32377da5284 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -112,6 +112,20 @@ int main_python_enter(int argc, const char **argv);
void main_python_exit(void);
#endif
+#ifdef WITH_USD
+/* Workaround to make it possible to pass a path at runtime to USD.
+ *
+ * USD requires some JSON files, and it uses a static constructor to determine the possible
+ * filesystem paths to find those files. This made it impossible for Blender to pass a path to the
+ * USD library at runtime, as the constructor would run before Blender's main() function. We have
+ * patched USD (see usd.diff) to avoid that particular static constructor, and have an
+ * initialisation function instead.
+ *
+ * This function is implemented in the USD source code, pxr/base/lib/plug/initConfig.cpp.
+ */
+void usd_initialise_plugin_path(const char *datafiles_usd_path);
+#endif
+
/* written to by 'creator_args.c' */
struct ApplicationState app_state = {
.signal =
@@ -411,6 +425,13 @@ int main(int argc,
init_def_material();
+#ifdef WITH_USD
+ /* 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.
+ */
+ usd_initialise_plugin_path(BKE_appdir_folder_id(BLENDER_DATAFILES, "usd"));
+#endif
+
if (G.background == 0) {
#ifndef WITH_PYTHON_MODULE
BLI_argsParse(ba, 2, NULL, NULL);