Untitled

mail@pastecode.io avatar
unknown
python
7 months ago
1.2 kB
2
Indexable
Never
#help: Create a LowRes version of the cam BG

def bgToLr():

    cam = hou.selectedNodes()[0]
    viz = cam.item("Image_Plane_01")
    
    cop = viz.createNode("cop2net")
    cop.moveToGoodPosition()
    file = cop.createNode("file")
    rop = cop.createNode("rop_comp")
    
    rop.setInput(0, file)
    rop.moveToGoodPosition()
    
    shade = viz.item("SHADE")
    shadelow = viz.createNode("uvquickshade")
    shadelow.setInput(0,shade.input(0))
    shadelow.moveToGoodPosition()
    
    opath = shade.parm("texture").eval()
    frame = str(hou.frame)
    opath = opath.replace(str(int(hou.frame())),"$F4")
    npath = "$HIP/bglow/bglow_$F4.jpg"
    
    file.parm("filename1").set(opath)
    rop.parm("copoutput").set(npath)
    rop.parm("f1").setExpression("$RFSTART")
    rop.parm("f2").setExpression("$RFEND")
    rop.parm("tres").set(2) #1/3 Res
    
    shadelow.parm("texture").set(npath)
    shadelow.setDisplayFlag(1)
    
    rop.parm("execute").pressButton()
    hou.ui.displayMessage("Low Res BG generated : {}".format(npath))
    
try:
    bgToLr()
except:
    hou.ui.displayMessage("No image plane found")