thanks chad.

good to know.. at least i know i'll be barking up the right tree by
going this route.

btw, i know this is straying into another topic, but:

i wrote a node plugin a while back that used kAttributeChanged
callbacks 'attached' to all attrs on the plugin node, as a way of
monitoring (its own) attrs for change, and then i filter those signals
using a string attr that names the attribute to listen for and a
script to run when it changes. (as kind of an alternative to
scriptJob). but to do this, it meant that i had to create the node
itself as a plugin to expose all the various callback signals to the
attrs to capture when they change.

do you know of a way to do this without having to create the node
itself as a plugin?
ie. an alternative to scriptjob 'attrchange' that would use already
existing (non-plugin) maya nodes?

ie. ie.. attach an 'attrchanged' callback to, say, all (or some) of
the attrs of a nurbsSphere without having to write the sphere node
itself as a plugin, and without having to write a scriptjob to monitor
each attr individualy? (another scheme might create a plugin deformer
node that would associate an attr being dirtied with a script to run..
then just connect that attr to an already existing maya node.attr that
you want to monitor.. but im trying to avoid that scheme as well)

i think you may have alluded to alternatives to these node plugin
schemes in your previous post:

"I do it with a callback from MNodeMessage to update the UI when the
attribute changes."

(i could really use somthing like this right about now!)
but up till now i could only figure out how to monitor for attrchange,
if i create the whole node, with the attrs to monitor, as a plugin
itself..

would love to be able to just have a command or something that would
replace scriptjob and work on already existing out of the box
node.attrs

-thanks

-mark therrell

On Dec 17, 12:02 pm, Chad Vernon <[email protected]> wrote:
> 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

Reply via email to