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:
authorSybren A. Stüvel <sybren@blender.org>2020-09-01 18:29:01 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-09-01 18:29:01 +0300
commit23767937ef6bd61736dae09da0fff0a69b37aa5b (patch)
tree48641e11739b78c9b9f04d53c49e99497a067d50 /source/blender/io/usd/tests
parentfef1a6c54e74372b863561ad40c1bd5bffef8c38 (diff)
USD: remove library initialisation hack
Remove the hack for library initialisation; this is no longer necessary as the required information can be passed to the USD library after its static initialisers have run. This new approach is compatible with both the patched and original USD library. This means that platform maintainers don't need to rebuild the USD library until the next upgrade. Manifest Task: https://developer.blender.org/T80320
Diffstat (limited to 'source/blender/io/usd/tests')
-rw-r--r--source/blender/io/usd/tests/usd_stage_creation_test.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/io/usd/tests/usd_stage_creation_test.cc b/source/blender/io/usd/tests/usd_stage_creation_test.cc
index e6bd0bab6ce..3d28d8f8f5a 100644
--- a/source/blender/io/usd/tests/usd_stage_creation_test.cc
+++ b/source/blender/io/usd/tests/usd_stage_creation_test.cc
@@ -17,6 +17,8 @@
* All rights reserved.
*/
#include "testing/testing.h"
+
+#include <pxr/base/plug/registry.h>
#include <pxr/usd/usd/stage.h>
#include <string>
@@ -26,11 +28,6 @@
#include "BKE_appdir.h"
-extern "C" {
-/* Workaround to make it possible to pass a path at runtime to USD. See creator.c. */
-void usd_initialise_plugin_path(const char *datafiles_usd_path);
-}
-
namespace blender::io::usd {
class USDStageCreationTest : public testing::Test {
@@ -44,9 +41,16 @@ TEST_F(USDStageCreationTest, JSONFileLoadingTest)
}
char usd_datafiles_dir[FILE_MAX];
- BLI_path_join(usd_datafiles_dir, FILE_MAX, release_dir.c_str(), "datafiles", "usd", nullptr);
+ const size_t path_len = BLI_path_join(
+ usd_datafiles_dir, FILE_MAX, release_dir.c_str(), "datafiles", "usd", nullptr);
+
+ /* BLI_path_join removes trailing slashes, but the USD library requires one in order to recognise
+ * the path as directory. */
+ BLI_assert(path_len + 1 < FILE_MAX);
+ usd_datafiles_dir[path_len] = '/';
+ usd_datafiles_dir[path_len + 1] = '\0';
- usd_initialise_plugin_path(usd_datafiles_dir);
+ pxr::PlugRegistry::GetInstance().RegisterPlugins(usd_datafiles_dir);
/* Simply the ability to create a USD Stage for a specific filename means that the extension
* has been recognized by the USD library, and that a USD plugin has been loaded to write such
@@ -61,9 +65,8 @@ TEST_F(USDStageCreationTest, JSONFileLoadingTest)
unlink(filename.c_str());
}
else {
- FAIL() << "unable to find suitable USD plugin to write " << filename
- << "; re-run with the environment variable PXR_PATH_DEBUG non-empty to see which paths "
- "are considered.";
+ FAIL() << "unable to find suitable USD plugin to write " << filename << "; looked in "
+ << usd_datafiles_dir;
}
}