This commit is contained in:
Jeffreytsai1004 2025-02-07 10:29:50 +08:00
parent d0fba2b340
commit d5bbe481f7
3 changed files with 43 additions and 4 deletions

View File

@ -30,7 +30,12 @@ except ImportError:
QtCore = QtGui = QtWidgets = None QtCore = QtGui = QtWidgets = None
wrapInstance = None wrapInstance = None
TOOL_PATH = data.TOOL_PATH ROOT_DIR = data.TOOL_PATH
MAYA_VERSION = data.MAYA_VERSION
PYDNA_PATH = data.PYDNA_PATH
print(f"ROOT_DIR: {ROOT_DIR}")
print(f"MAYA_VERSION: {MAYA_VERSION}")
print(f"PYDNA_PATH: {PYDNA_PATH}")
#===================================== 3. Utility Functions ===================================== #===================================== 3. Utility Functions =====================================
def maya_main_window(): def maya_main_window():
@ -205,8 +210,13 @@ class InstallDialog(QtWidgets.QDialog):
"""Create or update the .mod file for Maya""" """Create or update the .mod file for Maya"""
modules_dir = get_maya_modules_dir() modules_dir = get_maya_modules_dir()
mod_content = f"""+ {data.TOOL_NAME} {data.TOOL_VERSION} {data.TOOL_PATH} mod_content = f"""+ {data.TOOL_NAME} {data.TOOL_VERSION} {data.TOOL_PATH}
scripts: {data.SCRIPTS_PATH} scripts: {data.SCRIPTS_PATH}
""" plug-ins: plugins/{data.SYSTEM_OS}/{data.MAYA_VERSION}
XBMLANGPATH+:=resources/icons
PYTHONPATH+:=plugins/{data.SYSTEM_OS}/{data.MAYA_VERSION}
PYTHONPATH+:=plugins/{data.SYSTEM_OS}/{data.MAYA_VERSION}/pydna/{data.PYTHON_VERSION_DIR}
TOOL_PATH+:={data.TOOL_PATH}
"""
mod_file_path = os.path.join(modules_dir, data.TOOL_MOD_FILENAME) mod_file_path = os.path.join(modules_dir, data.TOOL_MOD_FILENAME)
self._write_mod_file(mod_file_path, mod_content) self._write_mod_file(mod_file_path, mod_content)

View File

@ -1,6 +1,35 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import sys
import maya.cmds as cmds
from .config import data
# 设置DNA路径
ROOT_DIR = data.TOOL_PATH
MAYA_VERSION = data.MAYA_VERSION
PYDNA_PATH = data.PYDNA_PATH
print(f"ROOT_DIR: {ROOT_DIR}")
print(f"MAYA_VERSION: {MAYA_VERSION}")
print(f"PYDNA_PATH: {PYDNA_PATH}")
# 添加DNA路径
if PYDNA_PATH not in sys.path:
sys.path.insert(0, PYDNA_PATH)
if PYDNA_PATH not in os.environ["PATH"]:
os.environ["PATH"] = os.pathsep.join([PYDNA_PATH, os.environ["PATH"]])
# 先导入dna模块
try:
import dna
except ImportError as e:
print(f"无法导入dna模块: {e}")
print(f"PYDNA_PATH: {PYDNA_PATH}")
print(f"sys.path: {sys.path}")
raise
# 现在导入其他模块
from .api import build_meshes, build_rig from .api import build_meshes, build_rig
from .builder.config import Config, RigConfig from .builder.config import Config, RigConfig
from .builder.maya.skin_weights import ( from .builder.maya.skin_weights import (

View File

@ -52,7 +52,7 @@ PYTHON_VERSION_MAP = {
} }
# 获取Python版本目录 # 获取Python版本目录
PYTHON_VERSION_DIR = str(PYTHON_VERSION_MAP.get(version_tuple, "python3")) PYTHON_VERSION_DIR = str(PYTHON_VERSION_MAP.get(version_tuple, "python397"))
# PATHS # PATHS
PLUGIN_PATH = str(os.path.join(TOOL_PATH, "plugins", SYSTEM_OS, MAYA_VERSION).replace("\\", "/")) PLUGIN_PATH = str(os.path.join(TOOL_PATH, "plugins", SYSTEM_OS, MAYA_VERSION).replace("\\", "/"))