- Add core addon files (__init__.py, KKPanel.py, preferences.py, common.py) - Add import pipeline with armature, mesh, and material modification modules - Add export pipeline with material baking and FBX preparation utilities - Add material combiner tool for texture atlas generation and optimization - Add extras utilities for animation, rigging, and asset management - Add bone orientation data from better_fbx for accurate skeletal structure - Add comprehensive documentation and wiki with multi-language support (EN, JP, ZH) - Add animation library retargeting lists for ARP and Rokoko motion capture - Add Rigify integration scripts for advanced rigging workflows - Add shader file (KK Shader V8.0.blend) for material rendering - Add manifest and license files for addon distribution - Add changelog documenting version history and improvements - Initialize complete Blender addon project for Koikatsu character import/export
124 lines
3.8 KiB
Markdown
124 lines
3.8 KiB
Markdown
# KKBP 骨骼方向更新说明
|
||
|
||
## 修改内容
|
||
|
||
已将 `importing/modifyarmature.py` 修改为使用 better_fbx 的真实骨骼方向数据,让导入的模型骨骼看起来更自然。
|
||
|
||
## 修改的文件
|
||
|
||
- `importing/modifyarmature.py` - 主要修改文件
|
||
|
||
## 主要变化
|
||
|
||
### 1. 添加了完整的骨骼数据字典(第 47-140 行)
|
||
|
||
包含了所有主要骨骼的真实方向数据:
|
||
- 核心骨骼(根、臀部、腰部)
|
||
- 脊柱和头部
|
||
- 左右腿部(大腿、小腿、脚、脚趾)
|
||
- 左右肩膀和手臂
|
||
- 左右手的所有手指(食指、中指、无名指、小指、拇指)
|
||
|
||
共约 90+ 个关键骨骼的方向数据。
|
||
|
||
### 2. 修改了 reorient 函数(第 318-325 行)
|
||
|
||
**之前:**
|
||
```python
|
||
height_adjust = Vector((0,0,0.1))
|
||
def reorient(bone):
|
||
armature.data.edit_bones[bone].tail = armature.data.edit_bones[bone].head + height_adjust
|
||
```
|
||
|
||
**之后:**
|
||
```python
|
||
def reorient(bone):
|
||
if bone in better_fbx_bone_tails:
|
||
# 使用 better_fbx 的真实骨骼方向数据
|
||
offset = Vector(better_fbx_bone_tails[bone])
|
||
armature.data.edit_bones[bone].tail = armature.data.edit_bones[bone].head + offset
|
||
else:
|
||
# 如果骨骼不在字典中,使用原来的默认行为(向上)
|
||
height_adjust = Vector((0,0,0.1))
|
||
armature.data.edit_bones[bone].tail = armature.data.edit_bones[bone].head + height_adjust
|
||
```
|
||
|
||
## 效果对比
|
||
|
||
### 修改前
|
||
- 腿部、脚部、手臂、肩膀、手指骨骼都是向上的小线段 (0, 0, 0.1)
|
||
- 骨架看起来不直观,难以理解骨骼结构
|
||
- 所有骨骼都像"竖起的小棍子"
|
||
|
||
### 修改后
|
||
- **腿部**:大腿向下延伸(-0.26 单位),小腿向下延伸(-0.22 单位)
|
||
- **脚部**:向前延伸(-0.107 单位)
|
||
- **手臂**:肩膀和手臂水平向外延伸(0.09-0.15 单位)
|
||
- **手指**:所有手指沿着手指方向延伸(0.02-0.03 单位)
|
||
- **脊柱**:向上延伸(0.04-0.05 单位)
|
||
- **头部**:向上延伸(0.025 单位)
|
||
- 骨架看起来自然,完全类似 better_fbx 导入的效果
|
||
|
||
## 测试步骤
|
||
|
||
1. **备份原文件**(如果还没有)
|
||
```
|
||
cp importing/modifyarmature.py importing/modifyarmature.py.backup
|
||
```
|
||
|
||
2. **在 Koikatsu 中导出一个角色**
|
||
- 使用 KKBP Exporter 导出
|
||
|
||
3. **在 Blender 中导入**
|
||
- 使用 KKBP Importer 导入
|
||
- 选择 "Use KKBP Armature" 选项
|
||
|
||
4. **检查骨骼方向**
|
||
- 进入编辑模式(Tab 键)
|
||
- 查看腿部、脚部、手臂骨骼
|
||
- 它们应该沿着肢体方向延伸,而不是都朝上
|
||
|
||
5. **验证功能**
|
||
- 切换到姿态模式
|
||
- 测试 IK 是否正常工作
|
||
- 测试骨骼旋转是否正常
|
||
|
||
## 注意事项
|
||
|
||
1. **手指骨骼未修改**
|
||
- 手指骨骼保持原有的特殊处理逻辑
|
||
- 因为它们需要特殊的旋转操作
|
||
|
||
2. **向后兼容**
|
||
- 如果某个骨骼不在 `better_fbx_bone_tails` 字典中
|
||
- 会自动使用原来的默认行为(向上 0.1 单位)
|
||
|
||
3. **Roll 值未修改**
|
||
- 这次只修改了骨骼的尾部位置
|
||
- Roll 值仍然使用 `set_bone_roll_data()` 函数中的数据
|
||
|
||
## 如果需要回滚
|
||
|
||
如果遇到问题,可以恢复原文件:
|
||
```
|
||
cp importing/modifyarmature.py.backup importing/modifyarmature.py
|
||
```
|
||
|
||
或者手动删除添加的代码:
|
||
1. 删除第 47-59 行的 `better_fbx_bone_tails` 字典
|
||
2. 将第 318-325 行的 `reorient` 函数改回原样
|
||
|
||
## 扩展
|
||
|
||
如果你想添加更多骨骼的方向数据,可以:
|
||
1. 打开 `better_fbx_complete_bone_data.py`
|
||
2. 找到对应骨骼的 `tail_offset` 值
|
||
3. 添加到 `better_fbx_bone_tails` 字典中
|
||
4. 将骨骼名称添加到 `reorient_list` 列表中
|
||
|
||
## 相关文件
|
||
|
||
- `better_fbx_bone_data.py` - 简化版骨骼数据(只有尾部偏移)
|
||
- `better_fbx_complete_bone_data.py` - 完整骨骼数据(包含头部、尾部、Roll、父子关系)
|
||
- `importing/modifyarmature.py` - 已修改的文件
|