If you have pymel you should use the Callback class implemented there. It
has better handling of errors and undos and whatnot.
If you don't have pymel you could just define this simple version and use
it:
class Callback(object): def __init__(self, func, *args, **kwargs): self.func
= func self.args = args self.kwargs = kwargs def __call__(self): return
self.func( *self.args, **self.kwargs )
def fillUDPanel():
global sliderContainer
sel=cmds.ls(sl=1)
if len(sel) == 0:
mel.error("You must have an object selected!")
for obj in sel:
attributes=cmds.listAttr(obj, ud=1)
if not attributes :
print obj,'doesn\'t have obj user-defined atttrs.'
continue
cmds.setParent('frameBegin')
sliderContainer
= cmds.frameLayout('sliderFrame',collapsable=1,l=obj ,bs="etchedOut")
cmds.rowColumnLayout('sliderPanel', nc = 2, columnWidth=[(2,
40)])
for attr in attributes:
fullName=(str(obj) + "." + str(attr))
cmds.attrFieldSliderGrp(cw=(1,
90),at=fullName,cat=(1, 'left', 10))
cmds.button(l='Sel',w=20, command = *Callback(selectMe,
fullName)* )
- Ofer
www.mrbroken.com
On Tue, Jan 11, 2011 at 7:55 PM, PixelMuncher <[email protected]> wrote:
> and this is the command I'm trying to assign to the buttons:
> def selectMe(who):
> print 'selectMe:',who
> cmds.select (who)
>
> --
> http://groups.google.com/group/python_inside_maya
>
--
http://groups.google.com/group/python_inside_maya