Python Module: Bundle VFX library python bindings

When calling bpy.utils.expose_bundled_modules(), these modules are
added to sys.path.

This provides a solution/workaround to two problems:
* Using bpy together with packages like usd-core is problematic. Besides
  crashing due to C++ symbol conflicts, it's just impossible to import
  different versions of the same module, or to have distinct environment
  variables for both. (#127132)
* Blender add-ons using these VFX modules do not currently work with
  the bpy module.

This adds about 15MB to the bpy package.

Pull Request: https://projects.blender.org/blender/blender/pulls/133082
This commit is contained in:
Brecht Van Lommel
2025-01-17 10:13:31 +01:00
committed by Brecht Van Lommel
parent ae6b47f346
commit a6b293daac
7 changed files with 201 additions and 116 deletions

View File

@@ -8,3 +8,12 @@ sys.path.append(sys.argv[1])
# Just import bpy and see if there are any dynamic loader errors.
import bpy
# Try bundled libraries
bpy.utils.expose_bundled_modules()
from pxr import Usd
import MaterialX
import OpenImageIO
import PyOpenColorIO
import pyopenvdb