import maya.cmds as cmds
cmds.window(title = "test window", w=400, h=600, mxb=False, mnb=False)
mainLayout = cmds.columnLayout(w=400, h=600)
cmds.tabLayout(imw=5, imh=5)
vrayMtlList = cmds.ls(type = "VRayMtl")
cmds.columnLayout("Material matte ID", w=400, h=600)
for vrayMtl in vrayMtlList:
if cmds.objExists(vrayMtl + ".vrayMaterialId"):
currentMatteID = cmds.getAttr(vrayMtl + ".vrayMaterialId")
matteIdValue = cmds.intFieldGrp(numberOfFields = 1, label=vrayMtl + "_matteID", value1 = currentMatteID)
cmds.showWindow()
Hi,
Use "changeCommand" flag to attach a function to intFieldGrp.
If you have some arguments to pass, you have to use partial from functools :
from functools import partial
def myFunction(myArg01, myArg02, *args):
print myArg01, myArg02
arg01 = "first value"
arg02 = "anything"
cmds.intFieldGrp(numberOfFields = 1, label=vrayMtl + "_matteID", value1 = currentMatteID, changeCommand = partial(myFunction, arg01, arg02) )
I hope it help.
Alexis
Cheers,
JH