[英]Maya python check if mesh has animation
我正在遍歷 Maya 中的選定對象並嘗試檢查它們是否具有變換或變形 animation。 有沒有辦法檢查這個? 我發現了如何檢查變換 animation,但不確定如何檢查變形 animation,這將是基於頂點的動畫或骨骼驅動的動畫。
import maya.cmds as cmds
def hasTransformAnimation(transform):
if cmds.objExists(transform):
animAttributes = cmds.listAnimatable(transform)
for attribute in animAttributes:
numKeyframes = cmds.keyframe(attribute, query=True, keyframeCount=True)
if numKeyframes > 0:
return True
return False
def hasDeformationAnimation(transform):
return False
sel = cmds.ls(sl=True, l=True, type=('transform'))
for o in sel:
print('Transform', o, hasTransformAnimation(o))
print('Deformation', o, hasDeformationAnimation(o))
我通過簡單地檢查變換節點是否具有到變換屬性的傳入連接或者網格形狀是否具有連接到inMesh
屬性的傳入連接來完成此操作。 這種方法的唯一缺點是您看不到幾何圖形是否真的是動畫的,或者它是否是 static。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.