I do it with a callback from MNodeMessage to update the UI when the attribute changes. You'll need to do some signal blocking to not get an infinite loop. For time change you could use MDGMessage.addTimeChangeCallback.
Everyone that I've talked to using Qt and Maya say you pretty much just have to manage all the callbacks yourself. On Fri, Dec 17, 2010 at 11:30 AM, mtherrell <[email protected]> wrote: > thanks chad. > > this does work .. but in one direction. (qtcontrol -> attr) > > the undo will return the node.attr to where it should be, but it won't > undo my qt interface to correspond. > similarly, scrubbing the attr does not automatically change the qt > interface either..like with "connectControl" > ..with this scheme i will need to find a way to trigger the QT event > with undo, or just somehow update the qt control when its the attr > changes with a callback (scriptJob or somthing)...and this could get > kind of messy. > > i can see there may be a need for the creation of a command plugin (or > just a py function) that will create a two way connection between attr > and a QT control, > and either tie the qt control in with maya's undo scheme or just rely > on that two way connection to reset the control.. > > Does anyone know exactly how connectControl works under the hood in > maya? > it would be nice to emulate the way it works, while extending it to > work with QT slots and signals. > > cheers. > > -mt > > > On Dec 16, 9:18 am, Chad Vernon <[email protected]> wrote: > > I've been doing a setAttr with > > > > cmds.undoInfo(openChunk=True) > > cmds.undoInfo(closeChunk=True) > > > > on the mouse events. I haven't found a way to do any direct connection. > > > > On Tue, Dec 14, 2010 at 11:04 AM, mtherrell <[email protected]> > wrote: > > > Hi, > > > > > with mel there is a command 'connectControl' that would link the > > > output of, say, a mel float slider, to say, the translateX attribute > > > of a node in maya. > > > > > in my project, i am dual subClassing a QObject and QGraphicsItem. > > > adding my own signal to the resulting item that is triggered when the > > > item is moved around in a QGraphicsScene, and now i want to connect > > > that signal to the translateX of a node in maya. > > > > > I could just re-implement the QGraphicsItem.itemChange function and > > > inside that, call setAttr on the translateX, but this seems ugly and > > > possibly slow since setAttr is less direct than connectControl would > > > be. > > > > > I could maybe use the maya API equivalent of setAttr in the same > > > scheme.. but would that be any faster? > > > > > I would like to avoid a literal callback mechanism inside my object's > > > event handlers. > > > > > what i would like to be able to do is exactly what connectControl mel > > > command does, connecting the output of a widget to an attr in maya.. > > > but instead, using the signal and slot mechanism of QT. > > > > > is there a way to define a node.attr in maya as a QT slot? ---that > > > would be awesome---. > > > > > is there something like a pymel "QConnectControl" command that i am > > > missing? > > > > > thanks for any help on this. > > > > > - > > > > > -- > > >http://groups.google.com/group/python_inside_maya > > > > > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
