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...

March 02, 2014

On closures (nested functions)

Coffeescript class syntax has made me realize the Python Class syntax is a bit bulky. Instead of using a class as a closure to protect namespace it's OK to use nested functions. Also after watching Stop Writing Classes with Jack Diederich for a second time, I think this tangentially relates.

This script yanks the colour profile file from a dribbble page and:
- sets the render engine to Cycles
- adds modifiers
- adds materials that correspond with the colours found
For me the unfortunate thing about the above script is that it generates a new base mesh for each object, not a big deal when only a small number of objects are present but perhaps useful to avoid when dealing with thousands of objects.

Further optimization will involve setting the object.link to 'OBJECT' (I think), to avoid materials being shared by meshes
.

Strip it down

The above script can be simplified to figure out a solution to the base mesh problem.