Pyside QSlider (+x, +y, -x, -y) Coordinates

Hi.

I´m currently development a visual interface for a character picker. The interface that i building is writing in python and PySide to be exactly. This is the first time that i used Pyside in a big way. In the pass, i just use the lenguague to build tools than don´t require estranges forms or advance looking widgets and behaviors rather than the normal ones. I need to create a (+x, +y, -x, -y) coordinates based QSlider to manipulate the facial expressions of the characters, like the way Jason´s Osipa using in his book. Basically i want to mimic the old school way that we use in Inside a common 3d software to manipulate facial expressions using nurb´s curves. I be investigate all day i really i can´t find nothing that´s drive me to the solution of this. For that i know, PyQt widgets library doest not include any element whit this approach. I think using QSliders but, they only work independently.

¿Maybe i have to combine both of thems ??? Or create a new stylesheet class?

Can anybody give me a hand to reach the solution of this question ?

Thanks to all to take the time reading this.

Greetings.

Rigardo.

I have some references like this one of Victors Vynail´s use a long time ago. But i think his is using native Maya elements and images. But thats the idea.


QSlider only has one dimension movement once, but you want two…

I guess use QgraphicView is better for this case
1.get widget size and coordinate --> QtCore.QPoint( (self.widget.size() ) self.widget.geometry()
2.get cursor position --> QCursor.pos().x() QCursor.pos().y()
3.track cursor movement with mouse event (and mouse event Filter)
4.dynamic draw a dot at QgraphicView

I don’t know if specifically QGraphicsView is necessary, because that means a graphics scene too, and possibly dealing with some of the view’s specialized features which might just get in the way. Dontnoun’s step 3, however, seems like pretty much the heart of what you need to do:

I would envision a QFrame and some arbitrary widget (anything you want as your picker control) parented to it. Subclass one of these, depending on if you want to be able to move the control without necessarily clicking on it (by clicking elsewhere inside the frame). In your subclass, re-implement mousePressEvent, possibly making it begin a drag operation or just setting some internal flag which is read by mouseMoveEvent.

One thing you may or may not have to grapple with is how to create the connections. With a MEL UI, you can use cmds.connectControl, which creates a two-way connection between the in-scene node and the UI object. I’m not sure if this is possible using PySide and a custom class (which Maya certainly won’t recognize). If this GUI picker is the only way of affecting the connected attributes, or if you feel comfortable with only a one-way connection with the picker affecting the rig, then great. But if there are other in-scene controls for the same parts of the rig, I don’t know how to make the GUI update to reflect any changes.

i agree with the simple widget subclasses, much simpler and with css you can make it look however you like. as for 2 way control, yu’d have to attach a scriptjob to the class on init and have that job killed in the delete(or closeEvent) override. then in the callback, check if the incoming value is equal to the current value and return if it is, that way nothing changes so the events stop there.

Hi.
Thansk to everybody for the quick responses. Yeah, now i´m looking forward how to implement the use of subclases to create a custom widget as you say Clamdragon. And whit the use of script jobs(as Maxx says) or Maya callbacks i´ m going to connect the interfece whit the objects. It´s already done whit functions, but the problem is that there´s no real connection between the Qt widget and the maya object, they just simple triger a function that resolve some attribute modifications, but if i modify the object inside Maya scene, the interface does not recognice this action as Maya connectControl work.

Anyway, let me go deep through this issue and i´m tell guys later how is going on.

Thank you very much !