From 18de8fe3973e4776f11f73f4d4272156199aa333 Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Tue, 25 Apr 2023 11:34:48 +0300 Subject: [PATCH 1/3] initial --- scripts/modules/bpy_hydra.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index 3923a78d6bcc..103c08ba1b07 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -37,6 +37,7 @@ __all__ = ( ) import os +import platform import traceback from pathlib import Path @@ -64,7 +65,8 @@ class HydraRenderEngine(bpy.types.RenderEngine): @classmethod def register(cls): _bpy_hydra.init() - os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = str(Path(bpy.app.binary_path).parent / "materialx/libraries") + \ + root_folder = "blender.shared" if platform.system() == 'Windows' else "lib" + os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = str(Path(bpy.app.binary_path).parent / f"{root_folder}/materialx/libraries") + \ os.pathsep + os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "") @classmethod -- 2.30.2 From cd82bdd21bec3bf96c56d23ac3bb1f889e5f4aed Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Fri, 28 Apr 2023 12:08:31 +0300 Subject: [PATCH 2/3] fix review comments --- scripts/modules/bpy_hydra.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index 103c08ba1b07..2ea50cb3e016 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -66,8 +66,10 @@ class HydraRenderEngine(bpy.types.RenderEngine): def register(cls): _bpy_hydra.init() root_folder = "blender.shared" if platform.system() == 'Windows' else "lib" - os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = str(Path(bpy.app.binary_path).parent / f"{root_folder}/materialx/libraries") + \ - os.pathsep + os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "") + os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = os.pathsep.join([Path(bpy.app.binary_path).parent / + f"{root_folder}/materialx/libraries", + os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "") + ]) @classmethod def unregister(cls): -- 2.30.2 From c3ad228d8017bb61089235351e4e584f85f4af67 Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Fri, 28 Apr 2023 12:13:45 +0300 Subject: [PATCH 3/3] reformat code --- scripts/modules/bpy_hydra.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index 2ea50cb3e016..7f7eea93519f 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -66,10 +66,9 @@ class HydraRenderEngine(bpy.types.RenderEngine): def register(cls): _bpy_hydra.init() root_folder = "blender.shared" if platform.system() == 'Windows' else "lib" - os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = os.pathsep.join([Path(bpy.app.binary_path).parent / - f"{root_folder}/materialx/libraries", - os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "") - ]) + os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = os.pathsep.join([ + Path(bpy.app.binary_path).parent / f"{root_folder}/materialx/libraries", + os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "")]) @classmethod def unregister(cls): -- 2.30.2