by karolist · 4y ago · 0 comments
This update comes with many geometry node improvements which continue the trend of making Blender the premium non-destructive modelling solution. I'm in particular interested in seeing how 6900 XT and regular M1 (in Mac mini form) will perform under Metal with 3.1 and macOs 12.3. I was a long time Radeon VII user on Mac but before 3.0 the stability and performance was just not there so I've moved my Blender experiments to Windows and Nvidia which works spectacularly but I'm not fussed about booting win just for Blender. Sadly I don't think AMD is bringing HIP for their older, pre-6000 GPUs https://code.blender.org/2021/11/next-level-support-for-amd-...
One area I wish they would start to give more attention is their scripting. I consider myself a Python expert, and the Python API leaves a lot to be desired at an architectural level. For example, many operations (bpy.ops) require an accurate "context" to succeed. This context is essentially putting the UI in a particular state, as if the user had clicked specific items and activated certain windows. This makes the api feel like an afterthought to the traditional UI interaction, and introduces a number of issues that I won't bore you with. Suffice to say, you end up writing a lot of boilerplate to ensure predictable state changes in between operations.
If they levelled up the Python API to be more friendly to the code-oriented generative art crowd, they would be even more unstoppable!
>>> arm.bones['Bone'] is arm.bones['Bone']
False
This is not a bug: https://developer.blender.org/T88914As for operator overrides, you may find this list useful:
https://blender.stackexchange.com/questions/248274/a-compreh...
>>> 1 is 1
True
>>> 999999 is 99999
False
"is" is a pretty special operation in python. The only thing it can be reliably used for is to check if two things refer to the exact same object. Retrieving the same value twice has no guarantees about returning the same object twice."is" causes so much confusion I'm not sure if it should've been a part of the language in the first place. It can always be substituted with the more explicit
id(a)==id(b)Of course in the end of the day it's not a problem that you have to use equality operator instead for bpy wrappers. It's just surprising, non-idiomatic in Python, where a developer unaware of this gotcha would rather think using `==` can give `True` for two different bones but similar enough that the `__eq__()` returns `True`.
Substituting with `id` solves nothing and goes against Python's spirit.
My goal with Blender is to animate explainers and screencasts, how feasible is to have a procedural pipeline where I could just launch Python scripts changing basic properties like text, position? Basically I want to generate animations where I have a bunch of re-useable objects but change their properties via code, is this something Python bindings could help me?
https://storage.googleapis.com/lulim-api-file-storage-prod/R...
The bpy.ops are really just a python shim to be able to call them from the UI.
Not a good idea to call them from a script (because of the reasons you cited) but that hasn’t stopped anyone, ever. The whole of blender is designed around the MVC model and the operators are the ‘control’ and are dependent on the ‘view’ (aka context) to do their thing.
All the underlying data structures should be exposed to the python API (through bpy.data IIRC) so, in theory, one could do whatever their little heart desires.
Weird design but once you realize the UI runs everything through python it mostly makes sense.
I think it was the outliner (the part where you edit the keyframes?) where the underlying design made the python API an absolute trainwreck. I spent a bunch of time on that and it was just bad, the best that could be done was to expose it and let people who were sufficiently motivated dig around and figure out how all the pieces interacted because it wasn’t at all obvious. Horrible design from the python side…
Anyhoo, sounds like someone just needs to add a collection.duplicate() or .clone() method — whichever is more pythonic.
In the end I was able to get what I wanted (a script which would spawn a bunch of geometric objects according to a procedural function, set the scene, and ray trace a frame) but it took a bunch of weird incantations in a mix of API idioms.
I had no clue how to use blender before, but now I feel like I have at least a passable idea of how the UI works -- despite basically never having touched it!
Don't get me wrong. Full props to Blender and its contributors. The UI/UX, speed, and stability have improved by leaps and bounds in the last few years. I miss the game engine though.