forked from blender/blender-addons
Adjust generating node classes and searching of mtlx files #7
@ -274,7 +274,21 @@ from bpy.props import (
|
|||||||
)
|
)
|
||||||
from {ADDON_ALIAS}.nodes.node import MxNode
|
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()}"
|
FILE_PATH = "{file_path.as_posix()}"
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
|
import platform
|
||||||
|
|
||||||
import MaterialX as mx
|
import MaterialX as mx
|
||||||
import bpy
|
import bpy
|
||||||
@ -17,6 +18,8 @@ log = logging.Log('utils')
|
|||||||
ADDON_ROOT_DIR = Path(__file__).parent
|
ADDON_ROOT_DIR = Path(__file__).parent
|
||||||
ADDON_DATA_DIR = Path(bpy.utils.user_resource('SCRIPTS', path=f"addons/{ADDON_ALIAS}_data", create=True))
|
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"
|
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_FOLDER = "libraries"
|
||||||
MX_LIBS_DIR = BL_DATA_DIR / MX_LIBS_FOLDER
|
MX_LIBS_DIR = BL_DATA_DIR / MX_LIBS_FOLDER
|
||||||
|
Loading…
Reference in New Issue
Block a user