API แอนิเมชัน
endpoint สำหรับค้นหาแอนิเมชันที่มีให้ใช้งานและนำไปใช้กับตัวละครที่ rig แล้ว
สร้างงานแอนิเมชัน
เอนด์พอยต์นี้ช่วยให้คุณสร้างงานใหม่เพื่อใช้แอ็กชันแอนิเมชันที่ระบุกับตัวละครที่ผ่านการ rigging ก่อนหน้า รวมถึงตัวเลือกการประมวลผลภายหลัง
พารามิเตอร์
- Name
- rig_task_id
- Type
- string
- จำเป็น
- Description
idของงาน rigging ที่เสร็จสมบูรณ์สำเร็จ (จากPOST /openapi/v1/rigging) ตัวละครจากงานนี้จะถูกทำให้เป็นแอนิเมชัน
- Name
- action_id
- Type
- integer
- จำเป็น
- Description
ตัวระบุของแอ็กชันแอนิเมชันที่จะนำไปใช้ ดู ข้อมูลอ้างอิงคลังแอนิเมชัน
สำหรับรายการแอนิเมชันที่พร้อมใช้งานทั้งหมด
- Name
- post_process
- Type
- object
- Description
การประมวลผลภายหลังแบบไม่บังคับสำหรับผลลัพธ์แอนิเมชัน ละไว้เพื่อรับไฟล์แอนิเมชันมาตรฐาน
post_process is set- Name
- operation_type
- Type
- string
- จำเป็น
- Description
ประเภทของการดำเนินการที่จะทำ ค่าที่พร้อมใช้งาน:
change_fps,fbx2usdz,extract_armature
- Name
- fps
- Type
- integer
- ค่าเริ่มต้น 30
- Description
อัตราเฟรมเป้าหมาย ใช้ได้เฉพาะเมื่อ
operation_typeเป็นchange_fpsค่าที่อนุญาต:24,25,30,60
ส่งคืน
พร็อพเพอร์ตี result ของการตอบกลับประกอบด้วย id ของงานแอนิเมชันที่สร้างขึ้นใหม่
โหมดความล้มเหลว
- Name
400 - Bad Request- Description
คำขอไม่สามารถยอมรับได้ สาเหตุทั่วไป:
- พารามิเตอร์ขาดหาย:
rig_task_idหรือaction_idขาดหายไป - งาน rig ไม่ถูกต้อง:
rig_task_idไม่ถูกต้อง หรืออ้างอิงถึงงานที่ล้มเหลว/ไม่มีอยู่ - ID แอ็กชันไม่ถูกต้อง:
action_idไม่สอดคล้องกับแอนิเมชันที่ถูกต้อง
- พารามิเตอร์ขาดหาย:
- Name
401 - Unauthorized- Description
การยืนยันตัวตนล้มเหลว โปรดตรวจสอบ API คีย์ของคุณ
- Name
402 - Payment Required- Description
เครดิตไม่เพียงพอในการทำงานนี้
- Name
404 - Not Found- Description
ไม่พบงาน rigging ที่ระบุโดย
rig_task_id
- Name
429 - Too Many Requests- Description
คุณเกินการจำกัดอัตราของคุณแล้ว
Request
# Animate a rigged model with required params only
curl https://api.meshy.ai/openapi/v1/animations \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"action_id": 92
}'
# With post-processing to change FPS
curl https://api.meshy.ai/openapi/v1/animations \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"action_id": 92,
"post_process": {
"operation_type": "change_fps",
"fps": 24
}
}'
Response
{
"result": "018c425b-b2c6-727e-d333-3c1887i9h791"
}
ดึงข้อมูลงานแอนิเมชัน
เอนด์พอยต์นี้ช่วยให้คุณดึงข้อมูลงานแอนิเมชันโดยใช้ id ของงานที่ถูกต้อง โปรดดู อ็อบเจ็กต์งานแอนิเมชัน เพื่อดูว่ามีพร็อพเพอร์ตีใดบ้างที่รวมอยู่
พารามิเตอร์
- Name
- id
- Type
- path
- Description
ตัวระบุที่ไม่ซ้ำกันสำหรับงานแอนิเมชันที่จะดึงข้อมูล
การส่งคืน
การตอบกลับประกอบด้วยอ็อบเจ็กต์งานแอนิเมชัน ตรวจสอบส่วน อ็อบเจ็กต์งานแอนิเมชัน เพื่อดูรายละเอียด
Request
curl https://api.meshy.ai/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"type": "animate",
"status": "SUCCEEDED",
"created_at": 1747032440896,
"progress": 100,
"started_at": 1747032441210,
"finished_at": 1747032457530,
"expires_at": 1747291657530,
"task_error": {
"message": ""
},
"consumed_credits": 3,
"result": {
"animation_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/Animation_Reaping_Swing_withSkin.glb?Expires=...",
"animation_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/Animation_Reaping_Swing_withSkin.fbx?Expires=...",
"processed_usdz_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed.usdz?Expires=...",
"processed_armature_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed_armature.fbx?Expires=...",
"processed_animation_fps_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed_60fps.fbx?Expires=..."
},
"preceding_tasks": 0
}
ลบงานแอนิเมชัน
เอนด์พอยต์นี้จะลบงานแอนิเมชันอย่างถาวร รวมถึงโมเดลและข้อมูลที่เกี่ยวข้องทั้งหมด การดำเนินการนี้ไม่สามารถย้อนกลับได้
พารามิเตอร์พาธ
- Name
- id
- Type
- path
- Description
ID ของงานแอนิเมชันที่จะลบ
การส่งคืน
ส่งคืน 200 OK เมื่อสำเร็จ
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/animations/018b314a-a1b5-716d-c222-2f1776f7f579 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// Returns 200 Ok on success.
สตรีมงานแอนิเมชัน
เอนด์พอยต์นี้สตรีมการอัปเดตแบบเรียลไทม์สำหรับงานแอนิเมชันโดยใช้ Server-Sent Events (SSE)
พารามิเตอร์
- Name
- id
- Type
- path
- Description
ตัวระบุที่ไม่ซ้ำกันสำหรับงานแอนิเมชันที่จะสตรีม
ส่งคืน
ส่งคืนสตรีมของ ออบเจ็กต์งานแอนิเมชัน เป็น Server-Sent Events
สำหรับงาน PENDING หรือ IN_PROGRESS สตรีมการตอบกลับจะมีเฉพาะฟิลด์ progress และ status ที่จำเป็นเท่านั้น
Request
curl -N https://api.meshy.ai/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791/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.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"progress": 50,
"status": "IN_PROGRESS"
}
event: message
data: { // Example of a SUCCEEDED task stream item, mirroring The Animation Task Object structure
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"type": "animate",
"status": "SUCCEEDED",
"created_at": 1747032440896,
"progress": 100,
"started_at": 1747032441210,
"finished_at": 1747032457530,
"expires_at": 1747291657530,
"task_error": {
"message": ""
},
"consumed_credits": 3,
"result": {
"animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?...",
"animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?...",
"processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?...",
"processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?...",
"processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?..."
},
"preceding_tasks": 0
}
ออบเจ็กต์งานแอนิเมชัน
ออบเจ็กต์งานแอนิเมชันแสดงถึงหน่วยงานสำหรับการนำแอนิเมชันไปใช้กับตัวละครที่ผ่านการริกแล้ว。
คุณสมบัติ
- Name
- id
- Type
- string
- Description
ตัวระบุที่ไม่ซ้ำสำหรับงาน
- Name
- type
- Type
- string
- Description
ประเภทของงานแอนิเมชัน ค่าคือ
animate
- Name
- status
- Type
- string
- Description
สถานะของงาน ค่าที่เป็นไปได้:
PENDING,IN_PROGRESS,SUCCEEDED,FAILED,CANCELED
- Name
- progress
- Type
- integer
- Description
progress ของงาน (0-100)
- Name
- created_at
- Type
- timestamp
- Description
ไทม์สแตมป์ (มิลลิวินาทีตั้งแต่ epoch) เมื่อสร้างงาน
ไทม์สแตมป์แสดงจำนวนมิลลิวินาทีที่ผ่านไปนับตั้งแต่วันที่ 1 มกราคม 1970 UTC ตาม มาตรฐาน RFC 3339
ตัวอย่างเช่น วันศุกร์ที่ 1 กันยายน 2023 เวลา 12:00:00 PM GMT จะแสดงเป็น1693569600000สิ่งนี้ใช้กับ ไทม์สแตมป์ ทั้งหมด ใน Meshy API
- Name
- started_at
- Type
- timestamp
- Description
ไทม์สแตมป์ (มิลลิวินาทีตั้งแต่ epoch) เมื่องานเริ่มประมวลผล เป็น
0หากยังไม่เริ่ม
- Name
- finished_at
- Type
- timestamp
- Description
ไทม์สแตมป์ (มิลลิวินาทีตั้งแต่ epoch) เมื่องานเสร็จสิ้น เป็น
0หากยังไม่เสร็จสิ้น
- Name
- expires_at
- Type
- timestamp
- Description
ไทม์สแตมป์ (มิลลิวินาทีตั้งแต่ epoch) เมื่อแอสเซตผลลัพธ์ของงานหมดอายุ
- Name
- task_error
- Type
- object
- Description
รายละเอียดข้อผิดพลาดสำหรับงานที่ล้มเหลว ดู ข้อผิดพลาด สำหรับข้อมูลอ้างอิงออบเจ็กต์
task_errorแบบเต็ม
- Name
- consumed_credits
- Type
- integer
- Description
จำนวนเครดิตที่งานนี้ใช้ มีอยู่เมื่อสถานะของงานเป็น
PENDING,IN_PROGRESSหรือSUCCEEDEDคืนค่า0สำหรับงานFAILED(เครดิตจะได้รับการคืนเมื่อเกิดความล้มเหลว)
- Name
- result
- Type
- object
- Description
มี URL ของแอนิเมชันเอาต์พุต หากงาน
SUCCEEDED- Name
animation_glb_url- Type
- string
- Description
- URL ที่ดาวน์โหลดได้สำหรับแอนิเมชันในรูปแบบ GLB
- Name
animation_fbx_url- Type
- string
- Description
- URL ที่ดาวน์โหลดได้สำหรับแอนิเมชันในรูปแบบ FBX
- Name
processed_usdz_url- Type
- string
- Description
- URL ที่ดาวน์โหลดได้สำหรับแอนิเมชันที่ประมวลผลแล้วในรูปแบบ USDZ
- Name
processed_armature_fbx_url- Type
- string
- Description
- URL ที่ดาวน์โหลดได้สำหรับอาร์เมเจอร์ที่ประมวลผลแล้วในรูปแบบ FBX
- Name
processed_animation_fps_fbx_url- Type
- string
- Description
- URL ที่ดาวน์โหลดได้สำหรับแอนิเมชันที่เปลี่ยน FPS ในรูปแบบ FBX (เช่น หากมีการใช้การดำเนินการ
change_fps)
- Name
- preceding_tasks
- Type
- integer
- Description
จำนวนงานก่อนหน้าในคิว มีความหมายเฉพาะเมื่อสถานะเป็น
PENDING
Example Animation Task Object
{
"id": "018c425b-b2c6-727e-d333-3c1887i9h791",
"type": "animate",
"status": "SUCCEEDED",
"created_at": 1747032440896,
"progress": 100,
"started_at": 1747032441210,
"finished_at": 1747032457530,
"expires_at": 1747291657530,
"task_error": {
"message": ""
},
"consumed_credits": 3,
"result": {
"animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?...",
"animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?...",
"processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?...",
"processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?...",
"processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?..."
},
"preceding_tasks": 0
}