cwisbg

simple_Gamma

Aug 27th, 2012
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. # Simple add gamma correct
  2. # cwisbg
  3. from pymel.core import *
  4. sl = selected()
  5. nodeCheck = "gammaCorrect", "mip_gamma_gain"
  6. for s in sl:
  7.     colorGrab = listAttr(se=1)
  8.     for attr in colorGrab:      
  9.         if attr[-5:] == "color" or attr[-7:] == "diffuse":
  10.             currentCon = listConnections("{0}.{1}".format(s,attr), p=1)
  11.             currentType = nodeType(currentCon)
  12.             if currentType in nodeCheck:
  13.                 pass
  14.             else:
  15.                 nwGamma = shadingNode("gammaCorrect", asUtility=1, n= "{0}_{1}_gamma".format(s, attr))
  16.                 setAttr("{0}.gammaX".format(nwGamma), 0.454545)
  17.                 setAttr("{0}.gammaY".format(nwGamma), 0.454545)
  18.                 setAttr("{0}.gammaZ".format(nwGamma), 0.454545)
  19.                 if currentCon:
  20.                     currentCon[0] >> nwGamma.value
  21.                 else:
  22.                     colorCon = getAttr("{0}.{1}".format(s,attr))            
  23.                 nwGamma.outValue >> "{0}.{1}".format(s,attr)
Advertisement
Add Comment
Please, Sign In to add comment