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:
committed by
Brecht Van Lommel
parent
ae6b47f346
commit
a6b293daac
@@ -22,6 +22,9 @@ class CustomHydraRenderEngine(bpy.types.HydraRenderEngine):
|
||||
# Register path to plugin.
|
||||
@classmethod
|
||||
def register(cls):
|
||||
# Make pxr module available, for running as bpy pip package.
|
||||
bpy.utils.expose_bundled_modules()
|
||||
|
||||
import pxr.Plug
|
||||
pxr.Plug.Registry().RegisterPlugins(['/path/to/plugin'])
|
||||
|
||||
|
||||
@@ -185,11 +185,15 @@ bl_info = {
|
||||
|
||||
import bpy
|
||||
import bpy.types
|
||||
import textwrap
|
||||
|
||||
# Make pxr module available, for running as bpy pip package.
|
||||
bpy.utils.expose_bundled_modules()
|
||||
|
||||
import pxr.Gf as Gf
|
||||
import pxr.Sdf as Sdf
|
||||
import pxr.Usd as Usd
|
||||
import pxr.UsdShade as UsdShade
|
||||
import textwrap
|
||||
|
||||
|
||||
class USDHookExample(bpy.types.USDHook):
|
||||
|
||||
Reference in New Issue
Block a user