Today I’m rebooting an oldie—we’re going to run a short script to show how Python is a friggin’ delight in Blender. I have with me a boring old kitchen that I want to add a bunch of little lights to.Continue reading “Python: How to Start Scripting in Blender”
It’s not difficult to load Python scripts into Blender’s text editor, but there’s something reassuring about just getting them to populate in the space bar menu.
How do you get Blender to do that, you ask?
You make your script into an add-on.
I have an obsession with timelines, which honestly may be bordering on manic and unhealthy. A 3D timeline has been on my back-burner for months because while I have written a function that auto-creates materials in Python, I had not yet mastered the art of applying image textures to those materials.
That’s today’s project.
The human mouth is kind of a bastard. Animating it frame-by-frame requires a patience that I just don’t have. Blender has shape keys that can help you mold lips into different configurations for each sound, but you still have to set keyframes to match up with a particular word at each and every frame.
Or you can be lazy. Like me.
Getting coordinates to scale properly to Blender units has been extremely frustrating for me since I started attempting more 3D maps. So, finally, in a fit of rage this weekend, I wrote a function to do it for me.
It scales the latitude and longitude down along the Z (height) and X (width) axes, taking into account the size of a base map oriented along those axes. In my version, it places a sphere at each coordinate set, but that can be easily changed to other objects.
After a long vacation, a wedding, a bad flu, and a whole mess of planes, trains, and automobiles, I’m back to talk about textures. I love playing with transparency in scenes, but scripting transclucency is a bit unusual in Processing. The normal Processing canvas doesn’t support an alpha channel, so it requires something called PGraphics().
Animated textures in Blender is a thing! Immediately after finding that out, I set out to script a grid crawler texture in Processing. Because no one in their right mind would want to draw that by hand.
A Bit Of Everything has a post with the logic for a static grid, but somehow getting an animated version ate 3 hours of my life. All in all, it took about 12 tries. What I love about Processing is that even bad guesses can have pleasing results.
I’m generally opposed to functions that overload on parameters. But seeing as how Blender functions do it all the time, I figured I’d go nuts for this updated text animation function.
I’ve been reading Code Breakers by Rudolf Kippenhahn. What hooked me into it was the part about the Wheel Cipher, a device envisioned by Thomas Jefferson in the late 1700’s. You can see Jefferson’s note about the wheel in his very own, genuinely awful handwriting here.
Updated: May 2021
Sometimes I get embarrassingly excited about being able to do things in Python that I will probably never need to do again. This is one of those times.
I had a mesh—a plane that I had turned into an a spiral walk-way. And I had the thought, this thing can’t have walls. Eventually I want the walk-way to be the center of a large arena that’s coated in fog. And the only way you’d really be able to see that it’s a spiral is if it’s semi-transparent and lined in lights.Continue reading “Python: How to Loop through Every Vertex in a Mesh”