import sys
import os
import distutils
import shutil
import nuke
def imageScale(source,destination,scale):
myRead = nuke.createNode("Read")
#SET VALUES
myRead["file"].setValue(source)
myRead["selected"].setValue(True)
#CREATE REFORMAT
myReformat = nuke.createNode("Reformat")
#SET VALUES
myReformat["type"].setValue("scale")
myReformat["scale"].setValue(scale)#.75)
#SELECTION
myRead["selected"].setValue(False)
myReformat["selected"] .setValue(True)
#CREATE WRITE
myWrite = nuke.createNode("Write")
#SET VALUES
myWrite["file"].setValue(destination)
myWrite["file_type"].setValue("png")
myWrite["channels"].setValue("rgba")
myWrite["name"].setValue("temp")
nuke.execute("temp",1,1,1)
我將能夠使用subprocess.popen來傳遞參數給
import subprocess
subprocess.Popen(['C:\Program Files\Nuke6.1v3\\Nuke6.1.exe', '-t', 'C:\Users\user\Desktop\\server.py'
我的imageScale函數,即我直接從子進程傳遞參數源,目標和縮放比例
雖然我必須使用Nuke6.1.exe for server.py才能正常工作 – user2315 2012-07-12 19:56:06