Files
Nexus/plug-ins/ARTv2/verify_artv2.py
2025-12-07 23:00:40 +08:00

125 lines
3.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ARTv2 验证脚本 - 检查所有关键模块是否可以正确导入
在 Maya Script Editor 中运行此脚本
"""
from __future__ import print_function
import sys
import traceback
def test_imports():
"""测试所有关键模块的导入"""
print("=" * 80)
print("ARTv2 模块导入测试")
print("=" * 80)
modules_to_test = [
# Core modules
('System.utils', 'Core utilities'),
('System.interfaceUtils', 'Interface utilities'),
('System.riggingUtils', 'Rigging utilities'),
('System.ART_RigModule', 'Base rig module'),
# Qt
('ThirdParty.Qt', 'Qt compatibility layer'),
# Rig Modules
('RigModules.ART_Root', 'Root module'),
('RigModules.ART_Torso', 'Torso module'),
('RigModules.ART_Arm_Standard', 'Arm module'),
('RigModules.ART_Leg_Standard', 'Leg module'),
('RigModules.ART_Head', 'Head module'),
('RigModules.ART_Chain', 'Chain module'),
('RigModules.ART_Leaf', 'Leaf module'),
# Interfaces
('Interfaces.ART_RigCreatorUI', 'Rig Creator UI'),
('Interfaces.ART_EditRigUI', 'Edit Rig UI'),
('Interfaces.ART_AnimationUI', 'Animation UI'),
]
passed = 0
failed = 0
errors = []
for module_name, description in modules_to_test:
try:
__import__(module_name)
print(f"{description:30s} ({module_name})")
passed += 1
except Exception as e:
print(f"{description:30s} ({module_name})")
print(f" Error: {str(e)}")
failed += 1
errors.append((module_name, str(e), traceback.format_exc()))
print("\n" + "=" * 80)
print(f"测试结果: {passed} 通过, {failed} 失败")
print("=" * 80)
if failed > 0:
print("\n详细错误信息:")
print("=" * 80)
for module_name, error, tb in errors:
print(f"\n模块: {module_name}")
print(f"错误: {error}")
print("Traceback:")
print(tb)
else:
print("\n✓ 所有模块导入成功ARTv2 已准备就绪。")
return failed == 0
def test_qt_compatibility():
"""测试 Qt 兼容性"""
print("\n" + "=" * 80)
print("Qt 兼容性测试")
print("=" * 80)
try:
from ThirdParty.Qt import QtCore, QtGui, QtWidgets, QtCompat
print("✓ Qt 模块导入成功")
# Test QtCompat
if hasattr(QtCompat, 'wrapInstance'):
print("✓ QtCompat.wrapInstance 可用")
else:
print("✗ QtCompat.wrapInstance 不可用")
return False
# Test Qt version
print(f" Qt 绑定: {QtCore.__binding__}")
print(f" Qt 版本: {QtCore.__qt_version__}")
return True
except Exception as e:
print(f"✗ Qt 兼容性测试失败: {e}")
traceback.print_exc()
return False
def main():
"""主函数"""
print("\n开始 ARTv2 验证...")
print(f"Python 版本: {sys.version}")
# Test imports
imports_ok = test_imports()
# Test Qt
qt_ok = test_qt_compatibility()
# Final result
print("\n" + "=" * 80)
if imports_ok and qt_ok:
print("✓✓✓ ARTv2 验证通过!所有系统正常。✓✓✓")
else:
print("✗✗✗ ARTv2 验证失败,请检查上述错误。✗✗✗")
print("=" * 80)
if __name__ == '__main__':
main()