Should I have done this in Python instead of C++? (Blender Render Manager App)

(LetWritersWrite) #1

Hello guys,
I’m working on this little app that will manage a queue of render jobs and easily use background rendering for reducing render times in half! I love using Qt5 and C++ but I’m beginning to wonder if I should have used Python instead. I have no idea if it’s irrelevant when you make a standalone application. I’m wondering if I can access the Blender API externally or if it needs to be an add on. I really don’t want to make an add-on. I know there’s pyQt if I want to use python instead with the Qt framework but as I mentioned, it would still be an external application. Below is a video of my work in progress. There’s some stuff I wish I could do but I’m pretty certain I can’t with C++ such as tracking the progress of a render, being able to pause blender, etc.

(cmomoney) #2

I think you might have more options and some things might be easier to implement if you used Python, but that’s just my opinion. But on the other hand if you love C++, I’d go with what works best for me, I guess.

(LetWritersWrite) #3

I tried going into the #blendercoders IRC and haven’t had much luck. One of the developers said I should make it an add-on but I don’t see how this could be possible. Can you use an add on to queue multiple blender jobs? Seems like it needs to be a separate app. Am I missing something?

(nBurn) #4

You should be able to convert this into an addon, but it would not be a pleasant experience. The issue is Blender’s current Python API is extremely limited in terms of GUI elements/widgets and was mostly intended as a way to add simple elements into Blender’s existing header bars and side panel’s. You might be able to expand your options by re-implementing Tkinter, but that would make for a considerable amount of trial and error.

Not sure about queuing render jobs. Only thing I can think of would be to look into how other render addons like Blender to Backburner or Kostex’s Quick Render Slot Selection work.

(kilon) #5

It’s not true that the API is limited I am making an addon with completely custom GUI. This is possible because blender gives access to its OpenGL context via bgl module and you can do some insane stuff with this ability.

Should you have done this in Python ? Not necessarily however Python has two very large advantages

  1. it has access to Blender Python API which is the only official blender API. C++ has no API for blender ,you can only modify the blender source but Python can do also the same. But source has barely any documentation compared to the blender Python API
  2. Python is light years ahead when it comes to ease of use and efficiency of debugging compared to C++

so yes python must must be your number one choice unless you do something that need to execute fast in that case you should use C++ and Python or C++ alone depending on what you doing.

Blender addons are extremely powerful and blender Python devs barely scratch the surface of what is possible with them because blender imposes no limitation on Python and Python is both a more powerful and more popular language than both C and C++. It rare for a C++ library not to have wrappers for Python but not vice versa.

(nBurn) #6

kilon, you misread my post. I said the “built-in” GUI element/widget options included with Blender’s Python API are limited, not the Python API itself. Blender’s GUI toolkit is most certainly a huge step down from what the Qt Framework offers. Yes, you can extend your options with OpenGL, but (depending on the GUI) that could significantly increase the amount of time required to develop the addon.

(kilon) #7

I do not see how something is limited when it gives you full access to its openGL context. Difficult yes, limited no.

QT is a GUI api that has many goals most of them are irrelevant to Blender. QT also specializes in creating GUIs not just displaying them.

Yes trying to recreate QT with bgl would be extremely hard but why on earth you would want to do that ?

If like me you aim for a simple good looking GUI its actually very easy with some basic knowledge of OpenGL you could even go as far as messing with the viewport rendering or even cycles viewport rendering,

BGL is a full blown OpenGL and it offers even access to much modern versions. The only real limitation is python performance wise but that wont in most cases affect the gui itself but rather the addon which happens anyway. BGL by the way is build in, which is what made possible the existence of pie menus. Blender code editor (text editor) even comes with example source code of how to use it. You cannot get any more “official” than that.

No I understand exactly what you were saying and what you claim is simply not the case. Blender GUI is as powerful as QT , the difference with QT is that QT make most things a lot easier to do. But then QT does not come with a 3d app included :wink: