從Max裏導出相機數據

最近在公司碰到個問題,就是從Max裏導出相機到Maya裏,不論是導出fbx還是abc,在Maya焦距的大小和Max裏怎麼都對不不上,於是只能在Max裏逐幀將相機的焦距的數值記錄到一個文件裏,然後再回到Maya裏重新設置一遍焦距,總算暫時解決了生產中的任務,不知各位大佬還有更好的解決辦法沒,下面是我在Max裏的實現方法。


fn getSelName=
(
	for s in selection do return s
)

start = animationRange.start.frame
end = animationRange.end.frame

txt_file = "F:/3DMax/cam_lens.txt"

camera_lens = #()
for j=start to end do
(
	slidertime = j
	select_object = getSelName()
	FOV = select_object.fov
	lens = 0.5 * (GetRendApertureWidth()/tan(FOV/2.0))

	print lens

	append camera_lens lens

)

print camera_lens

if doesFileExist(txt_file) == false do
(
	textFile = createFile txt_file
	close textFile

)

fs = openFile txt_file mode:"r+"
for item in camera_lens do
(
	item_string = item as string + "\n"
	print item_string
	format item_string to:fs
	
)
close fs

在Maya中重新設置焦距就簡單了,自己這裏就不囉嗦了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章