Maya PySide sliders



Hey Guys,

I have a UI that I made in Maya using PySide. The tool lists all the blendshapes in the scene and creates sliders for them. I can easily connect each slider to the blendshapes in the blendshape node and they will update when moving the sliders.

Is there an easy way to get the sliders to update if i change the value in the blendshape node manually outside the UI? Like a signal that gets sent back to the UI if a blendshape value changes that was not done in the UI.

I got it working by using OpenMaya.MEventMessage.addEventCallback and rebuilding the slider list every time a value is changed and then collecting and removing the callbacks when I close the UI, but it feels like hack and messy for a task like that. Or is this the only way of connecting maya attributes to a PySide window?




Could you instead try a scriptJob?

If you use the attributeChanged kwarg, perhaps you could tie each lodGroup attribute to the function that updates the slider. You could still continue to update every slider - or just the one you want. :wink: It’s an idea, haven’t tried that myself.

The other thing to do is to set the parent kwarg to UI window object (so the scriptJob is killed when the window is destroyed).