2

Python スクリプトを使用して、現在のプロジェクトを異なる (vray) カメラ、特定の (vray) マテリアルの異なるテクスチャ パス、異なるレンダリング イメージ ファイル名、および特定の設定でレンダリングするためにキューに入れようとしています。キューに入れるものを制御する方法が見つかりませんでした。

私の質問は:

  1. 現在のドキュメント内のすべての (vray) カメラのリストを取得する方法 擬似コード:camNameList = [c.GetName() for c in currentbasedocument.GetAllCameras()]

  2. (vray) マテリアルのテクスチャを編集するには?

  3. セット {cameras} ✕ {textures} をキューに入れ、レンダリングする方法は?

私はプロジェクト vray カメラに持っています:

camNameList = ["vray Cam2 global", "vray Cam1 close tree", "vray Cam3 closer tree",
    "vray Cam4 angle L", "vray Cam5 angle R", "vray Cam6", "floor"]

しかし、私はそれらにアクセスできませんでした:

batch = documents.GetBatchRender()
batch.Open()
batch.AddFile(file, 1) # works but I have not control over 1) which camera
    # 2) which render setting 3) which filename for the rendered image

camOList = doc.SearchObject("vray Cam2 global")
print (camOList) # result: None
  
bd  = doc.GetActiveBaseDraw()
cam = bd.GetEditorCamera()
cname = bd.GetSceneCamera(doc)
print(cam.GetName()) # result: "Camera" but it is not in camNameList
print(cname.GetName()) # result: "Camera"

これらの関数を使用して {cameras} ✕ {textures} のデカルト積を計算し、レンダリング ファイル名を指定します。

from os.path import isfile, join

doneFiles = ["im1.JPG", "im2.JPG"]
def GetTex(path):
    return [f for f in listdir(path) if isfile(join(path, f)) and f.endswith(".JPG") and f not in doneFiles]

def FilterCams(camNameList, camTagList):
    return [c for c in camNameList for t in camTagList if t in c]
  
def GetRenderUple(renderList):
    finalUple = []
    for file, camtag in renderList:
        filetag = file.split(".")[0]
        cameraName = [c for c in camNameList if camtag in c][0]
        renderFile = filetag + "_" + camtag + ".tif"
        finalUple.append((file, cameraName, renderFile))
    return finalUple

デカルト積に問題はありません:

from os import listdir
from itertools import product

camNumbers = [2,1,4,5]
camTagList = ["Cam"+str(i) for i in camNumbers]

selectedCam = FilterCams(camNameList, camTagList)
# print(selectedCam)

renderList = list(product(flist, camTagList))
# print(renderList)
4

0 に答える 0