WIP: MaterialX addon #104594

Closed
Bogdan Nagirniak wants to merge 34 commits from BogdanNagirniak/blender-addons:materialx-addon into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 17 additions and 0 deletions
Showing only changes of commit c218b6543d - Show all commits

View File

@ -274,7 +274,21 @@ from bpy.props import (
)
from {ADDON_ALIAS}.nodes.node import MxNode
""")
if file_path.is_relative_to(utils.MX_LIBS_DIR):
code_strings.append(
f"""from {ADDON_ALIAS}.utils import MX_LIBS_DIR
FILE_PATH = MX_LIBS_DIR / "{(file_path.relative_to(utils.MX_LIBS_DIR)).as_posix()}"
""")
elif file_path.is_relative_to(utils.MX_ADDON_LIBS_DIR):
code_strings.append(
f"""from {ADDON_ALIAS}.utils import MX_ADDON_LIBS_DIR
FILE_PATH = MX_ADDON_LIBS_DIR / "{(file_path.relative_to(utils.MX_ADDON_LIBS_DIR)).as_posix()}"
""")
else:
code_strings.append(
f"""
FILE_PATH = "{file_path.as_posix()}"
""")

View File

@ -5,6 +5,7 @@ import os
from pathlib import Path
import tempfile
import shutil
import platform
import MaterialX as mx
import bpy
@ -17,6 +18,8 @@ log = logging.Log('utils')
ADDON_ROOT_DIR = Path(__file__).parent
ADDON_DATA_DIR = Path(bpy.utils.user_resource('SCRIPTS', path=f"addons/{ADDON_ALIAS}_data", create=True))
BL_DATA_DIR = Path(bpy.utils.resource_path('LOCAL')).parent / "materialx"
if platform.system() == 'Windows':
BL_DATA_DIR = BL_DATA_DIR.parent / "blender.shared" / BL_DATA_DIR.name
MX_LIBS_FOLDER = "libraries"
MX_LIBS_DIR = BL_DATA_DIR / MX_LIBS_FOLDER