Files
Nexus/2023/scripts/animation_tools/studiolibrary/README.md
2025-11-24 22:26:56 +08:00

151 lines
4.0 KiB
Markdown
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.
# Studio Library
Studio Library 是一个免费的动画库工具,用于在 Autodesk Maya 中管理姿势和动画。
## 版本
Studio Library 2.20.2
## 官方信息
- **官网**: https://www.studiolibrary.com
- **GitHub**: https://github.com/krathjen/studiolibrary
- **作者**: Kurt Rathjen
## 功能特性
- 保存和加载动画姿势
- 管理动画片段
- 镜像姿势和动画
- 选择集管理
- 自定义缩略图
- 支持多个库
- 拖放操作
- 搜索和过滤
## 使用方法
### 方式 1使用 launcher推荐
```python
from animation_tools.studiolibrary import launcher
launcher.LaunchStudioLibrary()
```
### 方式 2直接导入
```python
# 需要先添加路径到 sys.path
import sys
import os
studiolibrary_path = r'h:\Workspace\Raw\Tools\Plugins\Maya\2023\scripts\animation_tools\studiolibrary'
if studiolibrary_path not in sys.path:
sys.path.insert(0, studiolibrary_path)
# 然后导入并启动
import studiolibrary
studiolibrary.main()
```
### 方式 3从 animation_tools 导入
```python
# 如果 animation_tools 已在 PYTHONPATH 中
from animation_tools import studiolibrary
studiolibrary.main()
```
### 在 MEL 中启动
```mel
python("from animation_tools.studiolibrary import launcher; launcher.LaunchStudioLibrary()");
```
### 从工具架启动
点击动画工具架上的 **StudioLib** 按钮即可启动。
## 模块结构
此模块包含以下子模块:
- **studiolibrary**: 核心库模块
- **studiolibrarymaya**: Maya 集成模块
- **mutils**: Maya 工具函数
- **studioqt**: Qt 界面组件
- **studiovendor**: 第三方依赖
## 注意事项
- 首次使用需要设置库路径
- 支持 Maya 2017 及更高版本
- 需要 PySide2 或 PySide6Maya 自带)
## 🔧 版本兼容性
### 支持的 Maya 版本
- **Maya 2017-2024** - 使用 PySide2
- **Maya 2025+** - 使用 PySide6
- **自动适配** - 运行时自动检测 Maya 环境和 Qt 版本
### Maya 2025 特别说明
- ✅ 已创建外层 `__init__.py` 文件,解决模块导入问题
- ✅ 自动检测并使用 PySide6
- ✅ 完全兼容新版本的 Python 3.11
### 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