Rigging 檢查 API
在對模型進行 rigging 之前,先了解 Meshy 是否能夠對該模型進行 rigging 並產生動畫,以及它適合哪種 animation_type。要對模型進行 rigging,請參閱 Rigging API。
建立 Rigging Check 任務
建立一個 Rigging Check 任務。該任務會檢查 Meshy 是否可以為你某個任務的模型進行綁定骨架和製作動畫,以及它適合哪種 animation_type。它會在背景執行,具體過程請見任務生命週期。
這項檢查是選擇性的。你可以不進行檢查,直接建立 Rigging 任務,它的結果並不會改變 Rigging 的處理方式。它能幫助你跳過 Rigging 不支援的模型,例如汽車或鳥類。
檢查會查看任務的預覽圖像。當模型符合以下所有規則時,riggable 為 true:
- 只有一個角色。
- 該角色是人形(雙足)或四足動物(四足)。
- 它處於站立姿態,四足動物則用四條腿站立。
- 它的手臂和腿與身體及彼此之間沒有重疊。
- 它沒有站在底座或基座上。
- 它正面朝前。
- 它在 Rigging 的面數限制之內。
Request
# Check whether a model can be rigged
curl https://api.meshy.ai/openapi/v1/rigging/check \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"input_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578"
}'
Response
{
"result": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70"
}
參數
- Name
- input_task_id
- Type
- string
- 必選
- Description
要檢查的模型所屬任務的 ID。它必須是你已
SUCCEEDED(成功)且具有預覽圖像的某個 API 任務,例如 Text to 3D、Image to 3D、Remesh 或 Retexture 任務。
回傳值
202 Accepted。回應的 result 欄位保存著新建的 Rigging Check 任務的 ID。
失敗情況
- Name
400 - Bad Request- Description
請求無法執行。錯誤訊息會說明發現的問題。例如:
- 缺少參數:未傳送
input_task_id。 - 輸入任務未找到:
input_task_id與你的任何任務都不符合。 - 輸入任務無效:
input_task_id未指向某個 API 任務。 - 輸入任務尚未就緒:
input_task_id對應的任務尚未達到SUCCEEDED狀態。請等待其成功後再重試。
修正請求後重新傳送。請參見 Errors。
- 缺少參數:未傳送
- Name
401 - Unauthorized- Description
API 金鑰缺失或無效。請檢查
Authorization請求標頭。
- Name
402 - Payment Required- Description
例如:
- 積分不足:帳戶沒有足夠的積分,或帳戶已達到積分限額。請檢查你的積分餘額,然後重試。
- 免費方案:該檢查需要付費方案。請在訂閱設定中升級你的方案,然後重試。
- Name
403 - Forbidden- Description
input_task_id是一個浮雕模型,Meshy 無法對其進行檢查。錯誤訊息為This model type does not support this operation。請傳送其他模型。
- Name
404 - Not Found- Description
Meshy 找不到
input_task_id任務的預覽圖像。可能的原因有:- 該任務的檔案在其
expires_at之後已被 Meshy 刪除。請重新建立該任務,然後傳送該任務的 ID。 - 該任務沒有預覽圖像,例如 Convert、尺寸調整 或 文字生成影像 任務。請檢查其來源任務。
- 該任務的檔案在其
- Name
429 - Too Many Requests- Description
你超出了速率限制,或者待處理任務過多。請稍候重試。請參見速率限制。
Meshy 建立的任務仍可能失敗。失敗原因請參見 Rigging Check 任務物件中的 task_error。
獲取綁骨檢測任務
根據 ID 返回一個綁骨檢測任務。
Request
curl https://api.meshy.ai/openapi/v1/rigging/check/0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70",
"type": "rig-check",
"status": "SUCCEEDED",
"progress": 100,
"created_at": 1790640079880,
"started_at": 1790640080112,
"finished_at": 1790640086935,
"expires_at": 1790899286935,
"task_error": null,
"result": {
"riggable": false,
"animation_type": "biped",
"animatable": false,
"reasons": [
{
"code": "limbs_not_separated",
"message": "The arms or legs touch the body or each other. Generate it in a T-pose or A-pose with the limbs clear of the body."
}
]
},
"consumed_credits": 1
}
刪除一個 Rigging Check 任務
永久刪除一個 Rigging Check 任務,包括其結果。刪除操作無法復原。
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/rigging/check/0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// 200 OK on success, with an empty body.
//
// 409 Conflict when the task is IN_PROGRESS. The task keeps running:
{
"message": "Task is IN_PROGRESS and cannot be deleted. Credits for a task the worker has already started are not refundable; wait for it to reach SUCCEEDED, FAILED or CANCELED, then delete it."
}
路徑參數
- Name
- id
- Type
- path
- Description
要刪除的任務的 ID。
任務狀態
刪除一個 PENDING 任務會退還建立該任務時所使用的積分。
IN_PROGRESS 任務無法被刪除。該請求會回傳 409 Conflict,
且任務會繼續執行。Meshy 不會為已經開始的任務退款,
因此刪除它會讓你同時損失積分和結果。請等待它
進入 SUCCEEDED 或 FAILED 狀態後再刪除。
刪除處於最終狀態(SUCCEEDED 或 FAILED)的任務不會退還
其積分。
回傳值
任務刪除成功時回傳 200 OK;當任務處於
IN_PROGRESS 狀態時回傳 409 Conflict。
取得 Rigging Check 任務列表
回傳您的 Rigging Check 任務列表。
Request
curl https://api.meshy.ai/openapi/v1/rigging/check?page_size=10 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
[
{
"id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70",
"type": "rig-check",
"status": "SUCCEEDED",
"progress": 100,
"created_at": 1790640079880,
"started_at": 1790640080112,
"finished_at": 1790640086935,
"expires_at": 1790899286935,
"task_error": null,
"result": {
"riggable": true,
"animation_type": "biped",
"animatable": true,
"reasons": []
},
"consumed_credits": 1
}
]
參數
- Name
- page_num
- Type
- integer
- 預設值 1
- Description
要回傳的頁碼,從
1開始。
- Name
- page_size
- Type
- integer
- 預設值 10
- Description
每頁的任務數量,最多
100個。
- Name
- sort_by
- Type
- string
- Description
排序方式。
可用值:
+created_at:最早的排在最前-created_at:最新的排在最前
回傳
分頁的 Rigging Check 任務物件列表。
流式取得骨骼綁定檢查任務
以伺服器推送事件(SSE)的形式串流回傳骨骼綁定檢查任務的更新。
Request
curl -N https://api.meshy.ai/openapi/v1/rigging/check/0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response Stream
// Error event example
event: error
data: {
"status_code": 404,
"message": "Task not found"
}
// Message event examples illustrate task progress.
// Every frame is the full task object.
// The following PENDING frame is abbreviated to the fields that change.
event: message
data: {
"id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70",
"type": "rig-check",
"status": "SUCCEEDED",
"progress": 100,
"created_at": 1790640079880,
"started_at": 1790640080112,
"finished_at": 1790640086935,
"expires_at": 1790899286935,
"task_error": null,
"result": {
"riggable": true,
"animation_type": "quadruped",
"animatable": true,
"reasons": []
},
"consumed_credits": 1
}
參數
- Name
- id
- Type
- path
- Description
建立回應中回傳的任務 ID。
回傳
以伺服器推送事件形式回傳的骨骼綁定檢查任務物件串流。
每個事件都包含完整的任務物件,其結構與 Get endpoint 回傳的相同。當任務處於
PENDING 或 IN_PROGRESS 狀態時,finished_at 為 0。只有當任務狀態變為
SUCCEEDED 後,Meshy 才會傳送 result 欄位。
骨骼檢測任務物件
骨骼檢測任務物件描述對某個模型的一次檢測。它保存著狀態、progress,以及任務成功時的結果。
The Rigging Check Task Object
{
"id": "0193c1a2-5b7e-7d4f-9a3c-8e2f1b6d4c70",
"type": "rig-check",
"status": "SUCCEEDED",
"progress": 100,
"created_at": 1790640079880,
"started_at": 1790640080112,
"finished_at": 1790640086935,
"expires_at": 1790899286935,
"task_error": null,
"result": {
"riggable": false,
"animation_type": "biped",
"animatable": false,
"reasons": [
{
"code": "limbs_not_separated",
"message": "The arms or legs touch the body or each other. Generate it in a T-pose or A-pose with the limbs clear of the body."
}
]
},
"consumed_credits": 1
}
- Name
- id
- Type
- string
- Description
任務 ID。請將其視為不透明字串,不要依賴其格式。
- Name
- type
- Type
- string
- Description
任務類型,始終為
rig-check。
- Name
- status
- Type
- string
- Description
任務狀態,取值為
PENDING、IN_PROGRESS、SUCCEEDED或FAILED之一。
- Name
- progress
- Type
- integer
- Description
任務完成的百分比。在任務開始前為
0,成功時為100。
- Name
- preceding_tasks
- Type
- integer
- Description
排在該任務前面的任務數量。該值僅在任務為
PENDING時才有意義。當該值為0時,此欄位會被省略。
- Name
- created_at
- Type
- timestamp
- Description
任務建立的時間,單位為 Unix 毫秒。
- Name
- started_at
- Type
- timestamp
- Description
任務開始的時間,單位為 Unix 毫秒。在任務開始前為
0。
- Name
- finished_at
- Type
- timestamp
- Description
任務完成的時間,單位為 Unix 毫秒。在任務完成前為
0。
- Name
- expires_at
- Type
- timestamp
- Description
任務結果過期的時間,單位為 Unix 毫秒。在任務完成前為
0。
- Name
- task_error
- Type
- object
- Description
任務失敗時的錯誤詳情。除非狀態為
FAILED,否則為null。骨骼檢測任務會因以下原因之一而失敗:code為moderation_blocked:模型的預覽圖可能不符合 Meshy 的平台規則。請傳送其他模型。type為service_unavailable:Meshy 無法檢測該模型。請重新建立任務。
Meshy 會為失敗的任務退還積分。詳見錯誤。
- Name
type- Type
- string
- Description
錯誤類別,例如
invalid_input或service_unavailable。
- Name
code- Type
- string
- Description
具體問題,例如
moderation_blocked。當 Meshy 提供更多細節時才會出現。
- Name
message- Type
- string
- Description
對出錯原因的描述。
- Name
- result
- Type
- object
- Description
結果。在任務變為
SUCCEEDED之前不會出現。- Name
riggable- Type
- boolean
- Description
模型是否符合本頁面上的所有規則。當其為
false時,reasons會說明原因。
- Name
animation_type- Type
- string
- Description
模型所屬的角色類型,即使
riggable為false時也會回傳。可用值:
biped:人形角色。建立骨骼綁定任務時將其作為animation_type傳送。quadruped:四足動物。建立骨骼綁定任務時將其作為animation_type傳送。other:其他任何類型,例如鳥類、章魚或道具。骨骼綁定不支援此類模型。
- Name
animatable- Type
- boolean
- Description
為模型完成骨骼綁定後,Animation API 是否可以為其產生動畫。當
riggable為false時,此值絕不會為true。
- Name
reasons- Type
- array
- Description
按固定順序說明
riggable或animatable為false的原因。當兩者皆為true時,此項為空陣列。- Name
code- Type
- string
- Description
模型存在的問題,供你的程式碼據此處理。Meshy 可能會新增代碼,因此遇到無法識別的代碼時,應將其視為模型不符合要求的原因。
可用值:
not_a_character:模型不是人物或生物,例如載具或道具。unsupported_body_type:該生物既不是人形也不是四足動物,例如鳥類、蛇或章魚。multiple_subjects:模型中包含不止一個角色。has_base:角色站立在底座或基座上。not_standing:角色處於坐姿、躺姿、跪姿或蹲姿,或四足動物未以四肢著地站立。limbs_not_separated:手臂或腿部與身體或彼此相觸。facing_away:角色背對正面朝向。too_many_faces:模型超過 Rigging 的面數限制。請先對其執行 Remesh API。
- Name
message- Type
- string
- Description
以句子形式說明給使用者看的原因,並給出修復模型的方法。對於
too_many_faces,會給出模型的三角面數以及應使用的重構網格設定。措辞可能會變化,因此請根據code而非message來做分支判斷。
- Name
- consumed_credits
- Type
- integer
- Description
該任務消耗的積分數量。其值為
1,若任務為FAILED則為0,因為 Meshy 會在任務失敗時退還積分。