feat: add on-demand format conversion support (FBX, STL, USDZ, MP4, GIF)

- Discover /creations/resourceConvert endpoint via browser inspection
- Add resource_convert() method to api.py and api_complete.py
- Extend MODEL_FORMAT_KEYS with fbx, stl, usdz, mp4, gif
- Update get_model_urls() and download_model() with include_converted flag
- Update CLI with --converted flag for formats and download commands
- Update reverse engineering docs with native vs converted format tables
This commit is contained in:
KawasakiAkasei
2026-05-27 13:42:29 +08:00
parent ad3c86b8ba
commit 5328c213fe
5 changed files with 181 additions and 14 deletions

View File

@@ -137,8 +137,14 @@ result = api.generate_from_image(resource_url, title="我的模型")
# 列出某个创作所有可用的下载格式
hunyuan3dweb formats <creation_id>
# 包含转换格式fbx, stl, usdz, mp4, gif
hunyuan3dweb formats <creation_id> --converted
# 下载指定格式(默认 glb
hunyuan3dweb download <creation_id> --format glb -o model.glb
# 下载转换格式(如 usdz
hunyuan3dweb download <creation_id> --format usdz --converted -o model.usdz
```
---
@@ -154,6 +160,7 @@ hunyuan3dweb download <creation_id> --format glb -o model.glb
| 作品列表 | POST | `/creations/list` | 查询参数 |
| 作品数量 | POST | `/creations/count` | 查询参数 |
| 取消生成 | POST | `/creations/cancel` | 查询参数 |
| 资源转换 | POST | `/creations/resourceConvert` | 查询参数 |
| 上传凭证 | POST | `/resource/genUploadInfo` | 查询参数 |
| 资源审核 | POST | `/resource/review` | 查询参数 |
| 创建分享 | POST | `/share` | 查询参数 |
@@ -162,7 +169,9 @@ hunyuan3dweb download <creation_id> --format glb -o model.glb
### 模型下载格式
`/creations/detail` 返回的 `urlResult` 字段最多包含 14 种格式键:
#### 原生格式(来自 `urlResult`
`/creations/detail` 返回的 `urlResult` 字段包含 14 种原生格式键:
| 键名 | 说明 |
|-----|------|
@@ -181,6 +190,28 @@ hunyuan3dweb download <creation_id> --format glb -o model.glb
| `invisible_wall` | 不可见碰撞墙 |
| `air_wall` | 空气墙(碰撞体) |
#### 转换格式(通过 `/creations/resourceConvert`
以下格式由网站按需将 OBJ zip 转换生成:
| 键名 | 说明 | 来源 |
|-----|------|------|
| `fbx` | Autodesk FBX 格式 | OBJ zip 转换 |
| `stl` | STL 格式3D打印 | OBJ zip 转换 |
| `usdz` | USDZ 格式iOS AR | OBJ zip 转换 |
| `mp4` | MP4 视频格式 | OBJ zip 转换 |
| `gif` | GIF 动图格式 | OBJ zip 转换 |
**转换接口示例**
```python
POST /creations/resourceConvert
Body: {
"sourceResource": [{"format": "zip", "url": "<obj_zip_url>"}],
"targetFormatList": ["usdz", "fbx"]
}
Response: {"convertResult": [{"format": "usdz", "url": "..."}]}
```
---
## 技术细节