日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python数据动画_[转载]Maya使用Python获取动画每帧的rotation数据

發(fā)布時(shí)間:2023/12/10 python 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python数据动画_[转载]Maya使用Python获取动画每帧的rotation数据 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

··············

import?maya.cmds as

mc

import?os

#添加一個(gè)"Maya動(dòng)畫收集數(shù)據(jù)"窗口設(shè)置動(dòng)畫開始播放

#win = mc.window(title = "Maya動(dòng)畫收集數(shù)據(jù)", w = 400, h = 40)

#mc.frameLayout( lv=False )

#mc.playbackOptions( minTime=0, maxTime=20 )

mc.select("jamie_arm_R",?"jamie_elbow_R")#輸入模型骨骼,最后輸出的就是這些骨骼對(duì)應(yīng)的數(shù)據(jù)

sel?=?mc.ls(sl?=?1)

maxT?=?mc.playbackOptions(query?=?True,

maxTime?=?True)

minT?=?mc.playbackOptions(query?=?True,

minTime?=?True)

os.remove("D:\RotationInfo.txt")#在添加數(shù)據(jù)之前刪除原存數(shù)據(jù)的txt

#定義GetRot方法

def?GetRot(time):

info?=?[]

#t

= mc.currentTime(query = True)

t?=?mc.currentTime(time)

for?i?in?sel:

rotx?=?mc.getAttr(i?+?".rx")

roty?=?mc.getAttr(i?+?".ry")

rotz?=?mc.getAttr(i?+?".rz")

iposInfo?=?[i,

rotx, roty, rotz]

info.append(iposInfo)

info_str?=?""

for?i?in?info:

info_str?=?info_str?+?"rn"?+?str(i[1])?+?"rn"?+?str(i[2])?+?"rn"?+?str(i[3])

#info_str

= info_str + i[0] + "rnrotX:" + str(i[1]) + "?rotY:" + str(i[2]) + "?rotZ:" + str(i[3]) +

"rnrn"

#info_str

= str(t) + "rnrn" + info_str

f?=?open("D:\RotationInfo.txt"?,?"a")#打開要存數(shù)據(jù)的txt,若不存在則新建一個(gè)

f.write(info_str)

f.close

for?i?in?range(int(minT),?int(maxT?+?1)):

GetRot(i)

#mc.showWindow(win)

#mc.text(label = "選擇動(dòng)畫的其中一幀,然后點(diǎn)擊“收集數(shù)據(jù)”執(zhí)行數(shù)據(jù)統(tǒng)計(jì)", h = 50)

#mc.button(label = "播放動(dòng)畫", command = "mc.play(state = 1)")

#mc.button(label = "收集數(shù)據(jù)", command = "GetRot()")

#mc.button(label = "結(jié)束播放", command = "mc.play(state = 0)")

總結(jié)

以上是生活随笔為你收集整理的python数据动画_[转载]Maya使用Python获取动画每帧的rotation数据的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。