2
我想從攪拌機中導出動畫,以下是我迄今爲止所做的:
---這只是爲了讓您知道我在做什麼,爲了保持簡短而忽略了很多。
---如果它太混亂或者需要,我可以發佈整個來源。在攪拌機中導出關鍵幀python
# Get the armature
arm = ob.getData()
# Start at the root bone
for bone in bones:
if not bone.parent:
traceBone(bone)
def traceBone(bone):
# Get the channel for this bone
channel=action.getChannelIpo(bone.name);
# Get the loc x, y, z channels
c_locx=channel[Ipo.OB_LOCX].bezierPoints
frameCount=len(c_locx)
# Write each location frame
for frameIndex in range(frameCount):
frame_x=c_locx[frameIndex].pt
frameTime=int(frame_x[0]-1)
# Write the time of the frame
writeInt(frameTime)
# Write the x, y and z coordinates
writeFloats(frame_x[1], frame_z[1], frame_y[1])
# Iv'e done the same for rotation
c_quatx=channel[Ipo.PO_QUATX].bezierPoints
# Write the quaternion w, x, y and z values
writeFloats(frame_w[1], frame_x[1], frame_z[1], frame_y[1])
# Go through the children
for child in bone.children:
traceBone(child)
據我可以告訴這一切工作正常,問題是,這些值是偏移, 代表的變化,但我需要的是代表相對於骨骼的位置和旋轉值,它的絕對值家長。
我該如何獲得相對於其父項的位置和旋轉?
哇,我有一段時間沒見過攪拌器代碼。您可以在http://blenderartists.org/forum/獲得比這裏更多的成功。 – 2009-08-13 17:56:50
郵政編碼你有。或者如果你已經解決了這個問題,可以使用代碼 – HaltingState 2011-12-08 19:15:22