2009-08-13 3 views
2

블렌더에서 애니메이션을 내보내려고합니다. 여기까지 한 내용은
입니다. 이것은 내가하고있는 일에 대한 아이디어를 제공하기위한 것입니다. 짧게 유지하기 위해 많이 버렸습니다.
--- 너무 혼란 스럽거나 필요한 경우 전체 소스를 게시 할 수 있습니다.블렌더 파이썬에서 키 프레임 내보내기

# 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) 

지금까지 내가 모두 잘 작동이 말할 수있는, 문제는 이러한 값의 변화를 나타내는 오프셋 (offset), 하지만 내가 필요로하는 것은 그것의에 뼈의 위치와 회전 값을 나타내는 절대 값이라는 것이다 부모의.

부모에 대한 상대적인 위치 및 순환 게재는 어떻게합니까?

+0

와우, 잠시 동안 블렌더 코드를 보지 못했습니다. http://blenderartists.org/forum/에서보다 많은 성공을 얻을 수 있습니다. –

+0

코드를 게시하십시오. 또는 문제를 해결 한 경우 작업 코드. – HaltingState

답변

2

채널 데이터는 바인드 포즈 행렬의 맨 위에 적용되어야합니다.

전체 공식은 다음

B0 * * * B1 * P0 P1 ... BN * PN

씨 = MS :

= 뼈 'n'에 대한 결과 행렬

Ms = 골격 -> 월드 매트릭스

양방향 = 바인드 파이 'i'를

를 뼈 매트릭스 포즈 = (내보내는 있음)

'N-1'에 저장된 채널로 구성 실제 행렬 포즈 상위 뼈는 'n-2'는 'n-1'의 부모이고 ..., '0'은 '1'의 부모입니다

관련 문제