[英]Problem to save render jpeg with maxscript
我正在制作一個腳本來自動化渲染 multiple.max 文件的過程。 我幾乎完成了我假裝要實現的目標,唯一的問題是我不知道如何通過 maxscript 保存渲染圖像。 我嘗試了在 inte.net 上找到的幾種方法,但沒有一種有效。
studioFile = getOpenFileName caption: "Select the Studio"
loadMaxFile studioFile
folderPath = getSavePath caption: "Select the Folder with the Assets to Render"
maxPath = folderPath + "\*.max"
maxFiles = getFiles maxPath
renderPath = getSavePath caption: "Select the Render Folder"
for current in maxFiles do(
xrefs.addNewXRefFile current
currentName = getFilenameFile current
print currentName
for c in cameras where classof c != Targetobject do(
render camera:c output: ("E:\\MUVA\\Renders\\" + currentName + "_" + c.name + "_" + ".jpeg")
)
xrefs.deleteAllXRefs()
)
這就是我的代碼現在的樣子並對其進行解釋:
我真的不知道該怎么辦了。 所以,如果有人能幫我解決這個問題,我將不勝感激。
PS.: 渲染圖的 output 目前還沒有使用選擇保存渲染圖的文件夾,因為我正在測試將所有路徑放入該文件夾。
根據MAXScript 參考,文件名的參數是outputfile:
。 在您的情況下,該行將是:
render camera:c outputfile:("E:\\MUVA\\Renders\\" + currentName + "_" + c.name + "_" + ".jpeg")
還有另一種方法:您可以保存render()
function 返回的 bitmap object:
bm = render camera:c
bm.filename = "E:\\MUVA\\Renders\\" + currentName + "_" + c.name + "_" + ".jpeg"
save bm
該目錄必須存在才能使這些方法中的任何一個起作用,因此您可能希望在循環之前創建它:
makeDir "E:\\MUVA\\Renders" all:true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.