2009-08-13 10 views
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) 

私の知る限り、すべてが正常に動作し、これを言うことができるように、問題は、これらの値は変化を表すオフセット、 ですが、私は必要なのそれだと骨の相対的な位置と回転値を表す絶対値であるということです親。

親に対して相対的な位置と回転を取得するにはどうすればよいですか?

+0

しばらくブレンダーコードを見たことがありません。 http://blenderartists.org/forum/でもっと成功するかもしれません。あなたが持っているポストコード –

+0

。問題を解決した場合は作業コード。 – HaltingState

答えて

2

チャネルデータはバインドポーズマトリックスの上に適用する必要があります。

完全な式は次のとおり

* B0 * P0 * B1 * P1 ... Bnの* Pnの

氏= MS:

=骨「n」の結果行列

Ms =スケルトン→ワールドマトリックス

バイ =バインドがパイ 'i' は

を骨のためのマトリックスをもたらす=(エクスポートすること)

'N-1' 記憶されたチャネルから構築実際のマトリックスをもたらす親の骨であります'n-2'は 'n-1'の親、...、 '0'は '1'の親です

関連する問題