Qt's Widget

117 views
Skip to first unread message

illunara

unread,
Jan 16, 2013, 11:58:41 AM1/16/13
to python_in...@googlegroups.com
Hi everybody
In Maya 2013, they create new view node editor (like in 3dsmax) with drop down menu

http://usa.autodesk.com/maya/features/

I wonder if there is any Qt's Widget which support to do that? Or its a custom one?

Thanks

Sascha Kremers

unread,
Jan 16, 2013, 3:41:07 PM1/16/13
to python_in...@googlegroups.com
There is no out of the box node editor widget in Qt, you have to create this application by yourself.

And this can be a pretty big project, depending on the feature set you have in mind.

You should look into QGraphicsScene and QGraphicsview as a starting point.
And then into the QGraphicsItems.

Resources:
A good starting point are the elasticNodes and diagramScene projects in the Qt4 examples.

Coral, very interesting project to look at.

Sascha

illunara

unread,
Jan 17, 2013, 12:29:48 PM1/17/13
to python_in...@googlegroups.com
Thank for the suggestion, Sascha.
Btw, in the QGraphicsScece, can i attach an item (QGraphicsItems) to another one?,it not like parent. More like get the item's position and attach another one to follow it? (like pointConstrain in Maya)

Justin Israel

unread,
Jan 17, 2013, 1:55:01 PM1/17/13
to python_in...@googlegroups.com

I think if you did not want a parent-child relationship and just a position constraint, then you may need to do that by reacting to the itemChange() of the source item:
http://doc.qt.digia.com/qt/qgraphicsitem.html#itemChange

Tuan Nguyen

unread,
Jan 17, 2013, 10:18:49 PM1/17/13
to python_in...@googlegroups.com
Didn't read the docs careful again. Thank Justin, i will run a few test now :D


On Fri, Jan 18, 2013 at 1:55 AM, Justin Israel <justin...@gmail.com> wrote:

I think if you did not want a parent-child relationship and just a position constraint, then you may need to do that by reacting to the itemChange() of the source item:
http://doc.qt.digia.com/qt/qgraphicsitem.html#itemChange

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To post to this group, send email to python_in...@googlegroups.com.
To unsubscribe from this group, send email to python_inside_m...@googlegroups.com.
 
 

illunara

unread,
Jan 19, 2013, 10:20:39 AM1/19/13
to python_in...@googlegroups.com
But PyQt is quite limited, isn't it. You can't edit the code inside QtDesigner, many item in QtGui is not present. Just some basic form, and you have to write it all inside after subClass.My friend told me that i should write this on C, or using the original QT's app from nokia. Why people chose python to use anyway? Because Maya supports Python?

Sascha Kremers

unread,
Jan 19, 2013, 10:42:13 AM1/19/13
to python_in...@googlegroups.com
I don't think it's limited.
Just think about how many widgets you would need to serve every purpose out of the box, you'd have to choose one out of thousand. By subclassing I can modify it to my personal needs.

And when you become more involved in qt development you'll start reusing own classes, it's not like you are rewriting everything all the time over and over again.

Reasons for python might be, that the're simply people who don't know c++, people who enjoy the rapid prototyping in python, the fact that you don't have to compile it for every platform.

At the end of the day it's up to you what tool/language to use. But even with switching to c++ you will not be able to skip the part of subclassing. Especially not on a project like a node editor.

Sascha

illunara

unread,
Jan 19, 2013, 11:34:09 AM1/19/13
to python_in...@googlegroups.com
Well, if it possibles, i would love to do all those UI-setup: paint,event,drag-drop.... in the UI file, for convenient, also easy to manage, right? :)

Justin Israel

unread,
Jan 19, 2013, 2:37:51 PM1/19/13
to python_in...@googlegroups.com

Pyside/pyqt is not limited. At Designer is not the language. It is a tool. This tool is more useful for c++ 

The things you would find missing from the python bindings are things that are not needed in python.

Auto desk doesn't support pyqt/pyside. They support at and users have to build python bindings. Python is supported because it is fast to prototype or build many tools that are fast enough. You also have access to a massive choice of python libraries. You can also move critical code to python c extensions and still continue using python overall

There is no benefit to writing your code in C++ unless it will provide a performance increase.

On Jan 20, 2013 5:34 AM, "illunara" <cb.il...@gmail.com> wrote:
Well, if it possibles, i would love to do all those UI-setup: paint,event,drag-drop.... in the UI file, for convenient, also easy to manage, right? :)

Justin Israel

unread,
Jan 19, 2013, 5:16:29 PM1/19/13
to python_in...@googlegroups.com

The auto correction on my new phone switched "Qt" to "at"

illunara

unread,
Jan 19, 2013, 11:44:05 PM1/19/13
to python_in...@googlegroups.com
Thank Justin, i were confuse about it all the time.

Christopher Evans

unread,
Jan 20, 2013, 4:12:47 AM1/20/13
to python_in...@googlegroups.com
This performance increase often cannot be overlooked. If you do anything with meshes or animations especially.  Not to mention that many C++ functions are still not exposed to openMaya, but many times a C++ plugin will do something in milliseconds but the python code could take minutes.
--
CE

Justin Israel

unread,
Jan 20, 2013, 4:26:21 AM1/20/13
to python_in...@googlegroups.com

Ya, I hope I wasn't being misleading. There are things that will require c++ to achieve proper performance.
What I mean is that simply writing in c++ won't equal a gain across the board.
As you put it, you can't just disregard it as an option entirely. It comes down to profiling the code in question.

Tuan Nguyen

unread,
Jan 20, 2013, 6:34:27 AM1/20/13
to python_in...@googlegroups.com
Yeah, like when you handle a deform problem, most of them are plugin i think. I know that what Python can do, C++ can do it better. Then can i understand it like this? Python is for scripting, solving small problem that suddenly popup, or small tool. In a long,large project, or if you wanna be a characterTD, this is when C++ come in handy.

Normally, characterTD or tech-artist is not a coder from beginning, aren't they. So Python is for beginner.

Justin Israel

unread,
Jan 20, 2013, 1:17:43 PM1/20/13
to python_in...@googlegroups.com

Again, no. Its not a black and white statement like "whatever python can do, c++ can do it better". It is also not that python is for beginners and c++ is for large projects.
If you look around, you will see mixed examples. There are huge Python projects out there and there are tiny command line c++ tools.
For something that does heavy number crunching and looping, there are times when it must be done in c++ for the benefits of a compiled static language. Thus you will see Maya plugins that do Deformer nodes (etc) in the c++ api.
But even then, there are ways python developers can move critical code to c such as numpy. Math/matrix code is written in c and accessed as an extension in python to make the operations fast.
Not every "td written" tool needs to be c++, and not every small bit of code needs to be python.
And don't forget that cpython is written in c, which means many operations are backed by c calls. It depends on what you are doing.

Sorry to write so much. It just sounds like the conclusions being made are  bit off.

dgovil

unread,
Jan 20, 2013, 3:29:45 PM1/20/13
to python_in...@googlegroups.com
Think of it this way, is the time you save using C++'s performance greater than the time you would spend writing, optimizing , compiling and maintaining the same C++ code.

The advantage to Python is that it's very easy to read, maintain, distribute, compile and share. It's performance is good enough for most things, and like Justin said, for most other things, you can always branch out to a C extension.

There's also the added advantage that you can more easily reuse the code for other projects and other applications like Nuke and Houdini.

You also have fewer concerns about Maya versions, what compiler is used etc..

Even if you do go the C++ route, the performance achieved is also directly proportional to your own coding abilities, whereas python takes care of a lot of things for you.


Each one has it's own place, but definitely don't disregard python because it seems 'inferior'

Daniel Lindsey

unread,
Jan 20, 2013, 8:47:27 PM1/20/13
to python_in...@googlegroups.com
I personally like to use python to do the initial node writing, to make sure my logic is sound and I get all my work flow issues worked out. Then if the node is too slow I will eventually get around to make the plugin a c++ node. I also do this for convenience too because I tend to work on all three oses so python nodes are a no brainier for that. That's just my 2 cents though

Reply all
Reply to author
Forward
0 new messages