Blender  V3.3
usd_common.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation. All rights reserved. */
3 
4 #include "usd_common.h"
5 
6 #include <pxr/base/plug/registry.h>
7 
8 #include "BKE_appdir.h"
9 
10 namespace blender::io::usd {
11 
13 {
14  static bool plugin_path_registered = false;
15  if (plugin_path_registered) {
16  return;
17  }
18  plugin_path_registered = true;
19 
20  /* Tell USD which directory to search for its JSON files. If 'datafiles/usd'
21  * does not exist, the USD library will not be able to read or write any files. */
22  const std::string blender_usd_datafiles = BKE_appdir_folder_id(BLENDER_DATAFILES, "usd");
23  /* The trailing slash indicates to the USD library that the path is a directory. */
24  pxr::PlugRegistry::GetInstance().RegisterPlugins(blender_usd_datafiles + "/");
25 }
26 
27 } // namespace blender::io::usd
const char * BKE_appdir_folder_id(int folder_id, const char *subfolder)
Definition: appdir.c:672
@ BLENDER_DATAFILES
Definition: BKE_appdir.h:154
void ensure_usd_plugin_path_registered()
Definition: usd_common.cc:12