Blender Python, a glorious rant session

Andrew ChristophersenAndrew Christophersen 08:52

I’ve been digging into setting up an asset pipeline for Blender to Unreal as a way to learn Blender. After many years in Maya I gotta say this thing is snappy. Not sure how I feel about the API yet but having fun learning it. Does the native UI work for most tool development or do people usually setup Qt?

1

Andreas RånmanAndreas Rånman 09:14

I prefer using the native UI when I can over first spending time getting Qt to work and not to mention make sure it works for all versions we would want to support to then focus on the actual utility. But would of course depend on what you intend on making.

1

Bob WhiteBob White 09:30

Yeah, I always kind of saw bqt as a shim for surfacing existing tools/interfaces into blender, but blender-specific tools I’d kind of assume would just be done with the internal UI. (Granted I’ve been out of the DCC tools gig for a few years now so I can’t quite remember how painful some of that actually is) (edited)

1

HH 12:59

Blender UI RANT
(As a recent active maintainer of bqt. and someone who made native blender tools)Native blender tools are more robust. and bqt is more prone to have issues if you don’t have familiarity with Qt and a technical background.I still see bqt as superior though, because it alows more freedom. native blender restricts UI, doesn’t allow popups. custom widgets, etc.
Blender devs on purpose restrict e.g. new window pop ups because it keeps things more in line with the blender UI. less lots of random windows popping up, and more all tools in same side panel location.
because most addons are created by people online and not in professional studios this likely makes sense.After attending Blendcon I realized how much the blender devs dislike big capitalist VFX animation studios.
The lack of cooperation with big studios, results in them never seeing the need for reusable tools outside Blender.
Their whole world is Blender only.
The reason i worked on bqt wasn’t to have a better UI pipeline than the native one. It’s to work together with other (commercial) apps. Creating a single unified pipeline. Reusing the same Qt tools between apps like blender, maya, max, unreal. (edited)

1

A. An.A. An. 13:24

To add to your rant, using their UI code is like eating cactus.

11

1 reply

Today at 12:36View thread

Chris CunninghamChris Cunningham 13:28

above has been my experience bring up any issue or wanted feature that is mostly about pipelines for larger studios

Bob WhiteBob White 14:04

Yeah, it’s a pretty common observation about their goals. They don’t want to be part of the pipeline, they want to be the pipeline

Steve TheodoreSteve Theodore 14:09

Because god knows, nothing says “VFX industry” like “we’re going to make it impossible for you to build a business with our stuff”

1

Andrew ChristophersenAndrew Christophersen 15:20

Thanks for all the insight gang. I lean Qt most of the time because it is what I know but for smaller scale productions I like the idea of cutting down on complexity.

1 reply

Today at 12:38View thread

Andrew ChristophersenAndrew Christophersen 15:22

@H if Blender doesn’t allow pop-ups how do you handle situations where you need the user to make a decision before moving forward? Modal UIs seem like such a common feature of software but I’m trying to get my head around the Blender way. (edited)

2 replies

Last reply today at 14:51View thread

Andrew ChristophersenAndrew Christophersen 15:25

Today I taught myself skeleton creation and weighting in Blender but man is it hard to fight against decades of Maya experience. But in Blender absolutely love how clean the UI is and how fast it boots. (edited)

1

Today


New

HH 12:39

has anyone used Blender’s new extension system? that will replace addons?
believe it has python requirement support?

12:40

H

Chris CunninghamChris Cunningham 12:42

never knew it was a thing

HH 12:42

it seems complicated, think you need to build your own wheels

Chris CunninghamChris Cunningham 12:42

implementation wise whats it offer over add-ons

HH 12:42

addons dont support dependencies

12:43

H

i think they try to handle that, and make it more package based so you can install form a central repo that hosts packages

12:43

H

but not sure. read on it a while ago and back then it didnt seem worth it.

Chris CunninghamChris Cunningham 12:43

dependencies in this case bing pip stuff or like other blender extensions?

1 reply

Today at 12:44View thread

HH 12:43

mainly cause they have a custom package format, instead of using python packages (edited)

Chris CunninghamChris Cunningham 12:44

will look into it, been meaning to get back to some addon i was making

12:44

Chris Cunningham

though tis been years

HH 12:44

another reason though is that they wanted to move a lot of default addons out of the blender development itself.

12:45

H

so they dont ship w blender, but you can install them from a list

Chris CunninghamChris Cunningham 12:46

yeah was working on maya command port style connection to blender from PyCharm

1

12:46

Chris Cunningham

and auto generating stubs

HH 12:46

why they didnt decide to use python packages i dont get though
reading the docs it looks liek a blender version of pip
manifests and repos: Get Extensions - Blender 4.2 Manual
and how to make one: How to Create Extensions - Blender 4.2 Manual

12:47

H

you can link python wheels as dependencies. but no pip. need to vendor them

Optional: bundle 3rd party Python modules. # Python Wheels - Blender 4.3 Manual # wheels = [ # “./wheels/hexdump-3.3-py3-none-any.whl”, # “./wheels/jsmin-3.0.1-py3-none-any.whl”, # ]

12:48

H

they use a custom toml format instead of python wheel toml standard manifest

Chris CunninghamChris Cunningham 12:48

i dont do much python stuff anymore, but i like vendoring thigns anyways

Thorsten KaufmannThorsten Kaufmann 12:48

As if python packaging was not fragmented enough sigh

Chris CunninghamChris Cunningham 12:48

since its nice to know something pulled at a given version will always be 100% correct for that time and owrk

HH 12:48

ye it’s nice if vendored to a submodule. so it doesnt affect other packages.

12:49

H

this is vendored to the main modules. so will clash with other addons

1

Chris CunninghamChris Cunningham 12:49

oof

12:49

Chris Cunningham

hate python for stuff like that

12:49

Chris Cunningham

so this means i can break other peoples extensions with my then

Thorsten KaufmannThorsten Kaufmann 12:49

I hate people dodging standards and reinventing the wheel worse because they think they know better. blender does that here and there

HH 12:50

like pyblish does nice vendoring. import pyblish.qtpy for it’s own

Chris CunninghamChris Cunningham 12:50

yeah @instinct-vfx what i think with stuff like this, or like when something comes out with its own scripting langauge

Thorsten KaufmannThorsten Kaufmann 12:50

Also as a maintainer: vendoring will also ensure that any issues are 100% nailed into place forever

HH 12:50

ye i dislike that belnder addons are python scripts, that are not importable

12:51

H

they use their own python path management, which means lots of default python behaviour doesnt happen in blender

12:51

H

maya and max dont try to be smart, and just use default python interpreter logic

12:51

H

so much easier to know what to expect

Chris CunninghamChris Cunningham 12:51

really i kinda want to blame python, have all the langauges i worked with python is always the one with weird ass per application implementations

Thorsten KaufmannThorsten Kaufmann 12:51

I just wonder why? Is there any rationale? It’s more work, tends to break things, makes all devs with a python background and existing processes hate you

Chris CunninghamChris Cunningham 12:52

like every DCC app does weird stuff with it, when i did medical imaging stuff mevis did weird stuff with it

HH 12:52

my guess, blender is mainly a compiled app. python likelywas added as an afterthought

Thorsten KaufmannThorsten Kaufmann 12:52

I would not blame python. The packaging ecosystem is complex in python but if you want to simplify drop backwards compatibility and just use any of the existing latest standards. Done.

HH 12:53

ye it’s just blender, i v made tools in so many dccs

Chris CunninghamChris Cunningham 12:53

is there a existing latest standard ?

HH 12:53

like unreal is clunky and annoying cause no docs, but still follows most basic python logic.

Chris CunninghamChris Cunningham 12:53

like thought it was still just venv and pip and a requirements file

HH 12:53

venv is not official i believe

12:53

H

not sure on that

Chris CunninghamChris Cunningham 12:53

is that just not hte description of working in unreal for anything

H

like unreal is clunky and annoying cause no docs, but still follows most basic python logic.

Posted in blender | Today at 12:53 | View message

HH 12:53

but yes there are standards for each OS

Thorsten KaufmannThorsten Kaufmann 12:54

https://packaging.python.org/en/latest/tutorials/packaging-projects/

HH 12:54

e.g. python will always import your site packages from appdata, install folder, etc

Thorsten KaufmannThorsten Kaufmann 12:54

pyproject.toml is the current official recommendation

HH 12:54

site packages vs PYTHON path logic

12:54

H

so if i add a path to PYTHONPATH it will import that

12:54

H

that kinda stuff is all predictable

Chris CunninghamChris Cunningham 12:54

do the “standard” for python is still to pollute the whole system (edited)

Thorsten KaufmannThorsten Kaufmann 12:54

No

HH 12:55

there is a convention for it

12:55

H

LOCAL, SYSTEM and INSTALL

Thorsten KaufmannThorsten Kaufmann 12:55

Default installation is user based. So not the system, but the user installation

Chris CunninghamChris Cunningham 12:55

to most people that is the same difference

12:56

Chris Cunningham

but i mean that by default unless you introduce a third party tool like venv it is not isolated to what each project needs

HH 12:56

blender max and maya dont use venv

12:56

H

but only blender fucks it up

Thorsten KaufmannThorsten Kaufmann 12:56

It has improved. Again: I totally agree that many things are not ideal. But there is a current standard. And the above official docs about packaging are the first google result for python packaging . Why not just stick to that?

Chris CunninghamChris Cunningham 12:56

was talking in general python packaing

HH 12:56

i m not following i believe

Thorsten KaufmannThorsten Kaufmann 12:57

My guess: They were falling for the same fallacy than python devs many times: We know better syndrome. My stance would be: Even if your system would be slightly better (and it clearly is not) the standard has so many other advantages that it is not worth it.

Chris CunninghamChris Cunningham 12:58

there is often more value in consistency then slightly better

Thorsten KaufmannThorsten Kaufmann 12:58

yeah

HH 12:58

ye package logic tends to be
installed stuff (dependencies) goes to site packages
modules go to scripts unreal max maya and python all do this

12:58

H

blender uses it’s own

12:58

H

if you use native python logic, you dont need to code anything.
blender made their own path manager to handle it. and guess what it sucks

12:59

H

instead of registering a path with the mative site package module, you need to use their paths.
i just dont get why they did that.

Thorsten KaufmannThorsten Kaufmann 12:59

It’s also a way harder to solve problem than it seems at first. I would give them that. But it’s still weird

HH 12:59

it means that code that works in every other python app, wont work here if it relies on e.g. startup logic

Chris CunninghamChris Cunningham 13:00

its hard problem to solve, but then thats when you really should look at established solutions and standards

1

13:02

Chris Cunningham

i like that atleast its a toml file for defining the properties of it now

13:02

Chris Cunningham

and not just a dict on a module it needs to import to see (edited)

HH 13:03

TBH: as an addon you werent even able to import that dict by default sicne it;s not included in the path

Thorsten KaufmannThorsten Kaufmann 13:03

yeah there is a fair bit of improvement. I also really like that DCCs are following python releases a lot closer than they used to. Which reminds me i am still flabbergasted that Max was the first to go Py3 (They are also still really uptodate)

HH 13:03

pyside 6 now

13:04

H

anyway for all the annoyance at blender, it is pretty cool tbh. being free and powerfull and all that. just frustrating but so are all the others at times

2

Chris CunninghamChris Cunningham 13:04

its sitll possible to just execute blender with a python script and pass it args right?

HH 13:04

unreal follows conventions and i think i dislike python there even more

13:05

H

ye, and you can also include scripts that auto run on startup.

Chris CunninghamChris Cunningham 13:05

to be fair Maya had some weird stuff too to put up with, and atleast i do not have to do business with autodesk to use blender (edited)

HH 13:05

so i can give someone a tool in a .blend file. which is neat

Chris CunninghamChris Cunningham 13:06

yeah was asking since i have a tool that fires up blender and passes is a script and some args to setup a socket server to communicate with it with

HH 13:06

also shameless plug time now that we are talking about Blender packages

13:07

H

i made a package manager, that works in maya, max, blender, unreal, krita, etc.
auto installs dependencies, and has a UI for artists.

13:08

H

been testing it a lot together with bqt.
so it can 1 click install a qt tool and install everything else. so user doesnt need to install pip things

HH 13:14

The main purpose is to be able to easy install Qt tools in various apps.
I often find that manually installing a Qt tool in multiple apps takes a lot of time, and this helped me to make more generic tools.
e.g. this generic pip qt tool GitHub - hannesdelbeke/pip-qt: pip qt widget
works in unreal GitHub - hannesdelbeke/pip-qt-unreal
maya GitHub - hannesdelbeke/pip-qt-maya: install pip packages in maya
and blender GitHub - hannesdelbeke/pip-qt-addon
and plugget auto installs the right dependencies in the right place.
whereas a manual pip install, would require you to know the unique path management from each dcc.

1

13:16

H

the end goal is to be able to install a whole pipeline with 1 click, outside of a studio.
all hooked up with a env manager App Launcher