Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Simple add gamma correct
- # cwisbg
- from pymel.core import *
- sl = selected()
- nodeCheck = "gammaCorrect", "mip_gamma_gain"
- for s in sl:
- colorGrab = listAttr(se=1)
- for attr in colorGrab:
- if attr[-5:] == "color" or attr[-7:] == "diffuse":
- currentCon = listConnections("{0}.{1}".format(s,attr), p=1)
- currentType = nodeType(currentCon)
- if currentType in nodeCheck:
- pass
- else:
- nwGamma = shadingNode("gammaCorrect", asUtility=1, n= "{0}_{1}_gamma".format(s, attr))
- setAttr("{0}.gammaX".format(nwGamma), 0.454545)
- setAttr("{0}.gammaY".format(nwGamma), 0.454545)
- setAttr("{0}.gammaZ".format(nwGamma), 0.454545)
- if currentCon:
- currentCon[0] >> nwGamma.value
- else:
- colorCon = getAttr("{0}.{1}".format(s,attr))
- nwGamma.outValue >> "{0}.{1}".format(s,attr)
Advertisement
Add Comment
Please, Sign In to add comment