November 2019 Summary
- Finished “Devastation of the Xmas” video for SWRT
- Setup Eclipse/PyDev/Blender Extension IDE
- Started ABX Development (File & Path Context)
Developing Blender Extensions in Eclipse/PyDev
I’ve been following Witold Jaworski’s e-book, Programming Add-Ons for Blender 2.8 in Eclipse/PyDev as a way to set up my development environment, and I’ve started working on interface design.
I did add one small wrinkle to Jaworski’s debugging system, which might be worth mentioning:
Jaworski sets up the “Remote Debugger” and provides a simple client script for running your script in Blender and connecting to the PyDev remote debugger server. However, for reasons that are not clear to me, he did not automate the process of launching the Add-On in Blender, even though that’s fairly easy to do.
Here’s how I did that:
But then I created another script, “DebugInBlender.py” that is run in the native Python interpreter. It’s very short:
#!/usr/bin/env python # Run the script in the debugger client within Blender: import subprocess subprocess.call(['blender', '-P', '/path/to/BlenderRemoteDebug.py'])
All it does is use subprocess to call Blender with the “-P” option to inject and run the “BlenderRemoteDebug.py” script in Blender.
I then went into “Run configurations…” and configured this script to be run when I click on the “Debug” icon in Eclipse.
So my testing cycle is simply to push the button to start the “remote debugging server” in PyDev (1) and then click the “Debug” button to run Blender (2), load the script, and run it with the debugger. Since I’ve set a breakpoint early in the script, I also need to click on “Resume” (3) in order for Blender to finish loading.
The debugging messages show up on the remote debugger console in Eclipse (4), as expected:
I’m currently using this to write a set of studio-specific extensions — “Anansi Blender Extensions” or “ABX” to automate repetitive tasks, like setting up scenes to follow our standard naming conventions, check consistency, and set up compositing nodes for our usual Color/Ink rendering.
It has been awhile since I posted anything. and this is the reason. I wanted to start using ABX to set up the boilerplate for rendering scenes, but that meant bringing my Blender extension up to a useful state.
That in turn meant that I had to implement the context and metadata introspection the software would need to correctly name objects during the process, and so I got drawn into the rabbit hole of software architecture for the project.
I’m starting to see the light at the end of the tunnel, but I had to put a lot of thought into how to make the design general enough without becoming excessively complicated.
The software is getting close to a state where it can read file names like:
And figure out:
- It’s a character animation file (role: ‘anim’).
- It’s part of season 1, episode 1.
- Sequence ‘TB’ (“Touring Baikonur”).
- Subsequence 2.
- Shots B & C.
- Titled: ‘Train Station – GCS Monument’
And then, from this, it can figure out what sort of rendering settings and other information it should set up.