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 29, 2013

Add PolySphere (Dynamic)

This is the addon and ui boilerplate for the addon:
Writing the boilerplate first lets you update live inside blender. Here is the next step, I start thinking about how to fill the Faces and Verts lists. Now at this point, there is an almost philosophical choice. Do I write convenient code, or efficient code, or some compromise. Generally good practice is to write code that works first, then prune and trim if performance is required.

At this point it can dynamically create verts and faces of one plane, not the most exciting code but possibly a little cryptic if you've never assigned a grid location purely from an index number. This results in an interim script, that produces the following mesh.

Then adding extra sides to the cube, requires a bit of extra logic.

At this point, turning it into a cube would be the next step. code here

At this point i'm thinking, it might be cool to have a slider that can control how much to spherize the cuboid. But first, why not code the spherify part.
And that's exactly what this code does:

finally, here is the full script with spherize factor included.



  1. This is really interesting!! Very cool. I have to study this properly one day.

    How did you get the UI floating like that?


Please use Blender.StackExchange.com for python scripting questions unrelated to this post.