Fix wrong path for PXR_MTLX_STDLIB_SEARCH_PATHS #30

Merged
Bogdan Nagirniak merged 3 commits from BLEN-398 into hydra-render 2023-04-28 11:44:03 +02:00

View File

@ -37,6 +37,7 @@ __all__ = (
)
import os
import platform
import traceback
from pathlib import Path
@ -64,8 +65,10 @@ 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") + \
os.pathsep + os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "")
root_folder = "blender.shared" if platform.system() == 'Windows' else "lib"
os.environ['PXR_MTLX_STDLIB_SEARCH_PATHS'] = os.pathsep.join([
BrianSavery marked this conversation as resolved Outdated

Isn't there a more compact way to do this in python? Seems you're going back and forth from string to path and using path separators? If it's a path you shouldn't have to use os.pathseparator.

Isn't there a more compact way to do this in python? Seems you're going back and forth from string to path and using path separators? If it's a path you shouldn't have to use os.pathseparator.

os.pathsep equals to ';' in windows or ':' in unix to separate different paths in env variable

`os.pathsep` equals to ';' in windows or ':' in unix to separate different paths in env variable

I understand that but doing some_path / some_other_path takes care of worrying about the pathsep

I understand that but doing `some_path / some_other_path` takes care of worrying about the pathsep
Path(bpy.app.binary_path).parent / f"{root_folder}/materialx/libraries",
os.environ.get('PXR_MTLX_STDLIB_SEARCH_PATHS', "")])
@classmethod
def unregister(cls):