57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
|
import os
|
||
|
import maya.cmds as cmds
|
||
|
|
||
|
def check_installation():
|
||
|
"""检查插件安装状态"""
|
||
|
# 获取当前插件路径
|
||
|
plugin_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||
|
|
||
|
issues = []
|
||
|
|
||
|
# 检查mod文件
|
||
|
maya_mod_path = os.path.join(os.getenv('MAYA_APP_DIR'), 'modules')
|
||
|
mod_file = os.path.join(maya_mod_path, 'MetaFusion.mod')
|
||
|
if not os.path.exists(mod_file):
|
||
|
issues.append("缺少mod文件")
|
||
|
else:
|
||
|
# 验证mod文件内容
|
||
|
with open(mod_file, 'r') as f:
|
||
|
content = f.read()
|
||
|
if plugin_path not in content:
|
||
|
issues.append("mod文件路径不正确")
|
||
|
|
||
|
# 检查必要目录
|
||
|
required_dirs = [
|
||
|
'ui',
|
||
|
'utils',
|
||
|
'config',
|
||
|
'resources/icons'
|
||
|
]
|
||
|
for dir_path in required_dirs:
|
||
|
if not os.path.exists(os.path.join(plugin_path, dir_path)):
|
||
|
issues.append(f"缺少必要目录: {dir_path}")
|
||
|
|
||
|
# 检查必要文件
|
||
|
required_files = [
|
||
|
'MetaFusion.py',
|
||
|
'ui/__init__.py',
|
||
|
'ui/menu.py',
|
||
|
'ui/models.py',
|
||
|
'ui/rigging.py',
|
||
|
'ui/define.py',
|
||
|
'utils/adjust_utils.py',
|
||
|
'utils/define_utils.py',
|
||
|
'config/data.py'
|
||
|
]
|
||
|
for file_path in required_files:
|
||
|
if not os.path.exists(os.path.join(plugin_path, file_path)):
|
||
|
issues.append(f"缺少必要文件: {file_path}")
|
||
|
|
||
|
# 检查插件加载
|
||
|
if not cmds.pluginInfo('MetaFusion', q=True, loaded=True):
|
||
|
try:
|
||
|
cmds.loadPlugin('MetaFusion')
|
||
|
except:
|
||
|
issues.append("插件无法加载")
|
||
|
|
||
|
return issues
|