--- pxr/base/plug/initConfig.cpp.orig 2020-04-13 14:32:52.000000000 -0400 +++ pxr/base/plug/initConfig.cpp 2021-02-02 09:30:21.000000000 -0500 @@ -69,10 +69,40 @@ ARCH_CONSTRUCTOR(Plug_InitConfig, 2, void) { + /* The contents of this constructor have been moved to usd_initialise_plugin_path(...) */ +} + +}; // end of anonymous namespace + +/** + * The contents of this function used to be in the static constructor Plug_InitConfig. + * This static constructor 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. + * + * This function is wrapped in a C function of the same name (defined below), + * so that it can be called from Blender's main() function. + * + * The datafiles_usd_path path is used to point to the USD plugin path when Blender + * has been installed. The fallback_usd_path path should point to the build-time + * location of the USD plugin files so that Blender can be run on a development machine + * without requiring an installation step. + */ +void +usd_initialise_plugin_path(const char *datafiles_usd_path) +{ std::vector result; std::vector debugMessages; + // Add Blender-specific paths. They MUST end in a slash, or symlinks will not be treated as directory. + if (datafiles_usd_path != NULL && datafiles_usd_path[0] != '\0') { + std::string datafiles_usd_path_str(datafiles_usd_path); + if (datafiles_usd_path_str.back() != '/') { + datafiles_usd_path_str += "/"; + } + result.push_back(datafiles_usd_path_str); + } + // Determine the absolute path to the Plug shared library. Any relative // paths specified in the plugin search path will be anchored to this // directory, to allow for relocatability. Note that this can fail when pxr @@ -114,9 +144,24 @@ _AppendPathList(&result, installLocation, binaryPath); #endif // PXR_INSTALL_LOCATION - Plug_SetPaths(result, debugMessages); -} + if (!TfGetenv("PXR_PATH_DEBUG").empty()) { + printf("USD Plugin paths: (%zu in total):\n", result.size()); + for(const std::string &path : result) { + printf(" %s\n", path.c_str()); + } + } + Plug_SetPaths(result, debugMessages); } PXR_NAMESPACE_CLOSE_SCOPE + +/* Workaround to make it possible to pass a path at runtime to USD. */ +extern "C" { +void +usd_initialise_plugin_path( + const char *datafiles_usd_path) +{ + PXR_NS::usd_initialise_plugin_path(datafiles_usd_path); +} +} --- pxr/base/arch/align.h.orig 2020-04-13 14:32:52.000000000 -0400 +++ pxr/base/arch/align.h 2021-02-02 09:36:43.000000000 -0500 @@ -77,7 +77,11 @@ /// The size of a CPU cache line on the current processor architecture in bytes. /// /// \hideinitializer +#if defined(ARCH_OS_DARWIN) && defined(ARCH_CPU_ARM) +#define ARCH_CACHE_LINE_SIZE 128 +#else #define ARCH_CACHE_LINE_SIZE 64 +#endif ///@} --- pxr/base/arch/math.h.orig 2020-04-13 14:32:52.000000000 -0400 +++ pxr/base/arch/math.h 2021-02-02 09:39:42.000000000 -0500 @@ -42,7 +42,7 @@ /// \addtogroup group_arch_Math ///@{ -#if defined (ARCH_CPU_INTEL) || defined(doxygen) +#if defined (ARCH_CPU_INTEL) || defined(ARCH_CPU_ARM) || defined(doxygen) /// This is the smallest value e such that 1+e^2 == 1, using floats. /// True for all IEEE754 chipsets.