Qt Blender Integration - Demo WIP

Hello,
This may be in the wrong location as I do not require support, but there is also no released scripts here. . .

I am currently working on putting a demo together for the benefits of integrating Qt in Blender.

For those who do not know, Qt is an interface design framework that allows anyone to create UI’s.
From the novice who can use the included QtDesigner, to the advanced who can create UI’s from scratch in object oriented python.

I will be working on a custom build of blender with PyQt and PySide built in, so no source code will be available at the present time.

I will be starting with some basic Qt widgets such as an Ivy/Tree generation widgets, and will be following through to more advanced Character UI’s and Custom Node Graphs.

The purpose of this Demo is to submit to the blender developers the pros and cons of having a robust UI building system integrated into Blender.
Although this would increase the download size by about 60Mb, it would allow for some truly amazing scripts to be created by the community.

For those looking at downloading Qt, you can get it here: http://qt-project.org/wiki/PySide

I am open to feedback, but bear in mind that the purpose of this demo is not to create Tools.

Thank you
-Alex Telford

Here is the first part demonstrating the power of using Qt windows to wrap around existing blender commands.
In this instance I have expanded upon the existing Ivy Generation toolset.

1 Like

Here is an older one I wrote but thought it might be worthwhile adding here.
This is a script editor that imitates the maya script editor.
You could easily add a syntax highlighter and code completion to this using built in Qt Modules

Another quicky, this sculpting demo shows the usage of my ImageNode widget.
This widget is a quick way to load preview images and position them around my work.

The code for this is online if you want it (You still need a Qt build of blender)
http://www.pasteall.org/49434/python

1 Like

Ok Here is an old one that probably won’t be in the Demo, but nevertheless it is a fun way to see how we could embed educational material into blender.

Very cool! This should be in the main blender discussion sub forum so that we can get some eyes on it. This could mean big things for blenders ui future.

You could get a gsoc proposal going with this!
Definitelly should be forwarded to the right people.

best of luck and keep up the awesome work!

GSoC is only for students

This looks absolutely amazing, would love to try it out. Does a build exist for Linux?

This needs to become the Blender standard, customizing the UI is for me impossible in the current state.

@metalix: So how do you handle the context being invalid in these situations?

@m9105826 good point, if a moderator is around, feel free to move this to general discussion :wink:

@blurymind, @Richard Marklew Correct this is for students, however I am not the one that would be integrating this into blender, I have down a very quick and dirty “Add Qt and rebuild Blender” with a few core tweaks to make it work like maya.
We would still need a way to access the full context in blender without falling back on hacks.

@NinthJake No this is currently windows only, I did send a tutorial to Jonathan Williamson for an easier way of adding Qt to blender without requiring to rebuild it, but it has not been published yet and has probably been forgotten.
I don’t think that this should be the Blender Standard as that would require rewriting Blender in Qt.
I would like Qt to be included as a built in Library plus perhaps some wrappers to help work with it. I’d like to talk to the person who ends up working on this to make sure all the required commands are there otherwise we become quite restricted (I create Qt UI’s for a living and there is many things that are currently impossible/Difficult in Blender)

@Atom I wrote a wrapper to create a blender context.
You can use bpy.context.copy() to create an instance of the context at launch, then you can get all the attributes for the ones you care about through bpy.data such as [obj.select for obj in bpy.data.objects] to return the selected objects.
[EDIT] You can also hijack the main blender thread to get the context, but I found this to be quite unstable, until Blender has it’s own QApplication instance it will just crash as soon as you set up a link between the UI’s (Which is why none of my UI’s will be embedded into blender at this stage)

-Alex Telford

Sorry I had to work late tonight so haven’t got started on the tree widget yet.
So I thought I would take this opportunity to ask:
Is there any UI you have seen that you want to know if it can be possible in Qt?
-Alex Telford

I’ve heard that anything with nodes is a pain with Qt. Any truth to that?

Hi metalix, I’m using Qt too, but not the PySide and PyQt, however i never thought at such combination. Looks really cool, if all Qt c++ widget are available to python, blender can take great advantage from this, especially for Add-ons developer.

@m9105826 No, working with nodes and Qt opengl viewports in general is a delight, though if you are just getting started the process for working with svg graphic items and graphics scenes can seem difficult, but if anything in Qt is a pain it would be multi-threading.
threading is great once you learn how it works but it will cause many hours of frustration beforehand.
Nodes are great and I wish I was able to make more UI’s that utilized them.

@rebellion C++ and python Qt is basically the same, you can copy a piece of c++ code to python in a matter of minutes by just changing the -> to .
(Plus other minor tweaks of course)
All widgets I have required are available in PySide/PyQt, though I admit when you start dealing with more complex UI’s with heavy data calls C++ is the way to go.
I very seldom create Qt apps in C++ as python is so much faster to develop with such a minimal impact on performance.
-Alex Telford

this is a nice effort.there is a free tree generator script for 3dsmax atree3d which has very good interface,like to increase radius of trunk you pull a ring widget,change scale and position of branches with manipulators - a good combination of procedural and manual tree modelling with interactive interface.some demo videos are there.

http://www.avizstudio.com/tools/atree3d/

Some questions…

  • why would you need a custom build of Blender? If you include PyQt4 or PySide in the python interpreter shipped with blender you could call QT just like that.
  • shouldn’t it be possible to create UI with widgets using the Blender API? I don’t see the benefit of doing that with QT as opposed to native Blender UI.

Nice project otherwise :slight_smile:

Rg,

Arnaud

I just spent nearly 2 days trying to figure out a way to do something with the Blender gui which would have taken about 5 minutes in Qt. You can technically do a lot of the same things in native Blender, but it takes a ton more effort.

Incidentally, my original node system was built with pyside before I moved it to pynodes. I found it quite pleasant.

@rusted, yes that is a good script, personally I like to use speedtree as it has a similar approach, I probably won’t be doing any custom Blender manipulators at this stage due to the limitations in context.

@sphaero

  • why would you need a custom build of Blender? If you include PyQt4 or PySide in the python interpreter shipped with blender you could call QT just like that.

You can yes, this is how I did it in my tutorial, however blender becomes unstable when you attempt to use memory pointers and the QApplication, By building Qt into blender I can make sure that Blender has it’s own QEventLoop which makes it more stable and cuts down the amount of code I need.

  • shouldn’t it be possible to create UI with widgets using the Blender API? I don’t see the benefit of doing that with QT as opposed to native Blender UI.

Yes, I have created a number of UI’s using plain old openGL and C++, however Qt makes this process so much simpler, especially when it comes to threading and animated widgets for example.

Here is a simple node interface someone wrote in QT, I wouldn’t even know where to begin to write something like this in OpenGL.

-Alex Telford

I managed to get a couple of hours in for working on the tree widget today, it is far from being a “functional tool” but It’s a start.


To Do:
Link input values to command
Store and retrieve tree data (So you can edit a tree you created previously)
Load presets and save preset images
Add transparency slider
Take common functions out of tabs (Show geometry, leaves etc)

You may not see much updates from me these coming weeks, I only get about an hour a night to work on personal projects outside of work (Such as this Qt Demo, the advanced shaders series for CG Cookie, two games I am working on etc etc etc)
But if you have any questions ask them here and I will do my best to answer them.
-Alex Telford