Hi. Long time no see. But eventually find myself back here. Great community.
I was looking into building more complex UI:s in Maya using PySide2 or QML. What I’m looking for is to create something like this. Arbitrary shaped hitboxes.
Not really sure what he uses, but the type of things I’m interested in can be achieved in HTML. however I’m not sure if it is possible in Qt this way. There used to be HTML support in Maya, right? like back in v6? https://www.youtube.com/watch?v=prU2MYPMoiw
So I’m eager for anyones ideas or tips really.
Keep it up!
The QGraphicsScene is a special kind of widget which allows you to paint items on a canvas and define how they draw and what actions occur when you interact with them etc.
Essetially you create a graphics scene, then you add items to the scene. Those items could be simple circles, rectangles etc - or they could be custom items which draw they own shapes using paths or images. Because items are classes, you can then override the mouse events, the paint events and most other things too.
As you progress you can utilise script jobs to make the panel bi-directional too, for instance in that video he clicks an item in the panel and it selects the control in the rig, it can be a nice polish feature to have the panel update live as you select things in the scene as well
This is a very simple example of code:
That is doing the bare minimum to add something to the scene (the text item). Whilst this is a more thorough example:
Dont be put off by the amount of math in the second example, that can largely be ignored (because its creating a dynamic spring effect between the nodes). But it shows creating custom items and defining their draw behaviours etc.
Hope that helps a little - and please post any questions, we’re all more than happy to help!