我正在尝试为某些按钮创建一个功能。我不想为每个按钮创建一个,所以写了这个
def setSmValue (self, attr):
selection = mc.ls(sl=True)
lightShapes = [mc.pickWalk(shape, direction="down")[0] for shape in selection if mc.nodeType(mc.pickWalk(shape, direction="down")) in ['directionalLight','pointLight','spotLight','areaLight']]
mc.select(selection, r=True)
value = mc.textFieldButtonGrp(self.smapResolutionField, q=True, text=True)
for l in lightShapes:
mc.setAttr('%s.%s' % (l, attr), float(value))
这是有效但对所有按钮都不好。我想改变
self.smapResolutionField
类似
('self.%s' % attr)
我尝试了所有我能想到的但似乎我不太清楚自己的使用:)
任何提示?
由于
编辑:我可能忘了提到我正在使用该命令来查询textField(用户将值放在那里,我需要将其读回来)