Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

May 10, 2012

Cycles materials from dribbble generated swatch

Materials and Nodes

Dribbble generates .aco (swatch) schemes from any upload, that's great for archiving my favourite color schemes. To avoid headache and lowlevel python i've resorted to leeching the color values directly from the html, instead of decoding the .aco file. Currently the snippet creates cycles node materials from swatches using urllib and extracts it using regex. The idea is to keep things simple in the event that dribbble changes their html.

This will facilitate using cool palettes to generate abstract visuals (but cycles only)

But Wait! There is more!

The following version also creates primitive cubes and assigns them each a swatch colour.
becomes

And more!

Here's another version It's a small rewrite to get an idea of what kind of code juggling is permitted within python - it's a bit more modular but might take more intuition to read. This was an intermediate step to the next iteration.

This revision demonstrates the evils of using ops, i would prefer to make the geometry mathematically or part math part lathe operation.

Programmed Lathing!

If we look at the previous snippet, it leaves a nasty taste because it amounts to no more than a macro coding. Let's see what a more low level coded interpretation looks like: using from_pydata