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 imageLoad Function
This function looks at all the .jpg’s in a folder, creates a plane for each one, and maps the image onto it. Here’s the folder with images I’ve compiled.
Note that before running the function, you’ll need to set Blender to the Cycles Render. If you accidentally run it with a different render engine set, you may need to restart the program to get it to stop throwing errors.
The function takes one parameter—the file path of the folder that contains the .jpg’s. Blender materials can’t have wildly long names, so the function takes the names of those files and slices them down to 20 characters.
As written, it places the planes along the z axis separated in 5 blender unit intervals.
Here’s a more intense breakdown of how it works:
After it’s run, you should see this cool line-up of images ready to go.
A copy/paste version of this code is available at this gist.