This commit is contained in:
2025-11-24 21:05:22 +08:00
parent e76152945e
commit e4c713035b
12 changed files with 585 additions and 414 deletions

View File

@@ -59,6 +59,64 @@ studiolibrary.main()
- 支持 Maya 2017 及更高版本
- 需要 PySide2 或 PySide6Maya 自带)
## 🔧 版本兼容性
### 支持的 Maya 版本
- **Maya 2017+** - 支持所有现代版本的 Maya
- **自动适配** - 运行时自动检测 Maya 环境和 Qt 版本
### Qt 兼容性
Studio Library 使用 `Qt.py` 兼容层,支持多种 Qt 绑定:
- **PySide6** - Maya 2025+ (优先)
- **PySide2** - Maya 2017-2024 (优先)
- **PyQt5** - 备用方案
- **PySide** - Maya 2014-2016 (备用)
- **PyQt4** - 备用方案
### 兼容性特性
1. **自动 Qt 检测** - 运行时检测可用的 Qt 绑定
2. **Maya 环境检测** - 自动识别是否在 Maya 中运行
3. **跨版本支持** - 同一代码在不同 Maya 版本中运行
4. **Python 2/3 兼容** - 使用 `six` 库实现 Python 2 和 3 的兼容
### Qt 绑定优先级
```
PySide6 > PySide2 > PyQt5 > PySide > PyQt4
```
可通过环境变量 `QT_PREFERRED_BINDING` 指定优先使用的绑定:
```python
import os
os.environ['QT_PREFERRED_BINDING'] = 'PySide2'
```
## 💡 技术架构
### 核心模块
- **studiolibrary** - 核心库逻辑,与 DCC 无关
- **studiolibrarymaya** - Maya 特定集成
- **mutils** - Maya 工具函数(动画、姿势等)
- **studioqt** - Qt UI 组件
- **studiovendor** - 第三方依赖Qt.py, six
### 兼容性层次
```
┌─────────────────────────────┐
│ Studio Library UI │
└──────────┬──────────────────┘
┌──────────▼──────────────────┐
│ Qt.py (兼容层) │
│ - PySide6/PySide2/PyQt5 │
└──────────┬──────────────────┘
┌──────────▼──────────────────┐
│ Maya API │
│ - maya.cmds │
│ - maya.OpenMaya │
└─────────────────────────────┘
```
## 许可证
GNU Lesser General Public License v3.0

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Studio Library Launcher
用于从工具架快速启动 Studio Library
支持所有 Maya 版本
"""
import sys
import os
def LaunchStudioLibrary():
"""
启动 Studio Library 主界面
自动检测 Maya 版本和 Qt 绑定
"""
try:
# 获取 Studio Library 路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 确保路径在 sys.path 中
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
# 导入并启动 Studio Library
import studiolibrary
# 打印版本信息
print(f"Studio Library version: {studiolibrary.version()}")
# 检测 Maya 环境
if studiolibrary.isMaya():
print("Running in Maya environment")
else:
print("Running in standalone mode")
# 启动主窗口
window = studiolibrary.main()
print("Studio Library launched successfully")
return window
except Exception as e:
print(f"Failed to launch Studio Library: {e}")
import traceback
traceback.print_exc()
return None
if __name__ == "__main__":
LaunchStudioLibrary()