Sunday, August 23, 2009

Release of Data Origami Library 0.006

The Data Origami Library for Blender 2.49a has been updated. This library's goal is to reduce the number of lines of python required to generate a useful image, animation, or game in Blender.

In this release, the image class now supports the following methods:

  • Orienting the camera by using a lookAt and lookFrom location
  • Adding Blocks defined by opposing corners
  • Adding Cylinders defined by end locations
  • Adding Spheres
  • Adding Text boxes
  • Adding Lighting which can be aimed at a target
  • Adding Tubes which can be used to draw arbitrary curves from either piecewise lines or smooth curves.

The library can be downloaded here. To install, simply unzip to a working directory and execute the test scripts from the Blender command line.

The images above were generated by the test scripts contained in the zip files.

This example shows how the library can be used to generate an image with just a few lines of python.

#BPY
# setup to allow the module to be imported from the same directory
#   the script is in
import sys
import os
filename = sys.argv[2]
filepath = os.path.dirname(filename)
sys.path.insert(0,filepath)
import OLib as MyLib

import Blender
import Blender.Mathutils
from Blender.Mathutils import *
from Blender import *

image = MyLib.Image('MyScene')
#image.lookFrom(3.5,3,15)
image.lookFrom(15,5,15)
image.lookAt(0,0,1)

ob = image.addPolyline()
image.addTube(tubeShape=ob)
image.addCylinder(p1=[0,0,0],p2=[0,0,5])

image.save(filepath+'\\images\\'+'test001_Tube.jpg')

To copy the code snippets easily, see:http://dataorigami.blogspot.com/2009/06/how-to-easily-copy-code-snippets-from.html

To execute the script in Blender, see:http://dataorigami.blogspot.com/2009/06/how-to-execute-script-from-command-line.html

To work with the script in a simple IDE, see:http://dataorigami.blogspot.com/2009/04/developing-scripts-for-blender.html

No comments:

Post a Comment