How to add RenderVR job to queue

Started by Art-Ray, May 06, 2016, 01:15:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Art-Ray

Bellow is Python code of Scripting for rendering VR.
How to fix it to add RenderVR job to queue?

=======================================
import os, re

centers = ["VR_CENTER_CAMERA",
           "VR_CENTER_CAMERA_PIVOT",
           "VR_CENTER_ENVIRONMENT",
           "VR_CENTER_OBJECT"]

types = ["VR_TYPE_CUSTOM",
         "VR_TYPE_HEMISPHERICAL",
         "VR_TYPE_SPHERICAL",
         "VR_TYPE_TUMBLE",
         "VR_TYPE_TURNTABLE"]

#VR_CENTER_CAMERA = 4
#VR_CENTER_CAMERA_PIVOT = 5
#VR_CENTER_ENVIRONMENT = 1
#VR_CENTER_OBJECT = 2
#VR_TYPE_CUSTOM = 5
#VR_TYPE_HEMISPHERICAL = 3
#VR_TYPE_SPHERICAL = 2
#:VR_TYPE_TUMBLE = 4
#:VR_TYPE_TURNTABLE = 1

def main():

    info = lux.getSceneInfo()
    values = [("folder", lux.DIALOG_FOLDER, "匯出位置", None),
                           
              ("width", lux.DIALOG_INTEGER, "寬:", info["width"]),
              ("height", lux.DIALOG_INTEGER, "高:", info["height"]),
              ("vwidth", lux.DIALOG_INTEGER, "v寬:", info["width"]),
              ("vheight", lux.DIALOG_INTEGER, "v高:", info["height"]),
              ("hframes", lux.DIALOG_INTEGER, "高frames數:", 5, (1, 360)),
              ("vframes", lux.DIALOG_INTEGER, "寬frames數:", 3, (1, 180)),
              ("hbegin", lux.DIALOG_INTEGER, "水平開始:", -180, (-180, 180)),
              ("hend", lux.DIALOG_INTEGER, "水平結束:", 180, (-180, 180)),
              ("vbegin", lux.DIALOG_INTEGER, "垂直開始:", -90,(-90, 90)),
              ("vend", lux.DIALOG_INTEGER, "垂直結束:", 90, (-90, 90)),

              (lux.DIALOG_LABEL, "--"), # 分隔線
              ("center", lux.DIALOG_ITEM, "旋轉中心", centers[0], centers),
              ("type", lux.DIALOG_ITEM, "VR形式", types[0], types),
              (lux.DIALOG_LABEL, "--"),
             
              ("queue", lux.DIALOG_CHECK, "Add to queue", True),
              ("process", lux.DIALOG_CHECK, "Process queue after running script", False)]
    opts = lux.getInputDialog(title = "VR",
                              desc = "VR",
                              values = values,
                              id = "renderimages.py.luxion")

    if not opts: return

    if len(opts["folder"]) == 0:
        raise Exception("Folder cannot be empty!")

    fld = opts["folder"]
    na = "VR"
    w = opts["width"]
    h = opts["height"]
    vw = opts["vwidth"]
    vh = opts["vheight"]
    hfs = opts["hframes"]
    vfs = opts["vframes"]
    hbg = opts["hbegin"]
    hed = opts["hend"]
    vbg = opts["vbegin"]
    ved = opts["vend"]
    queue = opts["queue"]
    process = opts["process"]
   
    print("outpit:" + fld)
    name = "VR"

    opts = lux.getRenderOptions()
    opts.setAddToQueue(add = 0)

    lux.renderVR(folder = fld, name = name, type = 5, center = 5, width = w, height = h, vwidth = vw,
                                vheight = vh, hframes = hfs, vframes = vfs, hbegin = hbg, hend = hed, vbegin = vbg, vend = ved):

    if process and not cancelled:
        print("processing queue")
        lux.processQueue()

main()