@@ -16,7 +16,7 @@ The Blender Python API Reference
- L{NLA}
- L{BGL}
- L{Camera} (*)
- L{Curve}
- L{Curve} (*)
- L{Draw} (*)
- L{Effect}
- L{Image} (*)
...
...
@@ -35,7 +35,7 @@ The Blender Python API Reference
- L{Radio} (new)
- L{Render}
- L{Text}
- L{Texture}
- L{Texture} (*)
- L{Types}
- L{Window} (* important: L{Window.EditMode})
- L{World} (*)
...
...
@@ -50,7 +50,7 @@ Introduction:
Python modules (libraries) that give access to part of the program's internal
data and functions.
Through scripting Blender can be extended in realtime via
Through scripting Blender can be extended in real-time via
U{Python <www.python.org>}, an impressive high level, multi-paradigm, open
source language. Newcomers are recommended to start with the tutorial that
comes with it.
...
...
@@ -159,7 +159,7 @@ Demo mode:
Blender has a demo mode, where once started it can work without user
intervention, "showing itself off". Demos can render stills and animations,
play rendered or realtime animations, calculate radiosity simulations and
play rendered or real-time animations, calculate radiosity simulations and
do many other nifty things. If you want to turn a .blend file into a demo,
write a script to run the show and link it as a scene "OnLoad" scriptlink.
The demo will then be played automatically whenever this .blend file is
...
...
@@ -174,6 +174,28 @@ The Game Engine API:
separate from the Blender Python API this document references and you can
find its own ref doc in the docs section of the main sites below.
Blender Data Structures:
------------------------
Programs manipulate data structures. Blender python scripts are no exception.
Blender uses an Object Oriented architecture. The bpython interface tries to
present Blender objects and their attributes in the same way you see them through
the User Interface ( the GUI ). One key to bpython programming is understanding
the information presented in Blender's OOPS window where Blender objects and their
relationships are displayed.
Each Blender graphic element ( Mesh, Lamp, Curve, etc.) is composed from two parts:
An Object and ObData. The Object holds information about the position, rotation and size
of the element. This is information that all elements have in common. The ObData holds
information specific to that particular type of element.
Each Object has a link to its associated ObData. A single ObData may be shared by many Objects. A graphic element also has a link to a list of Materials. By default, this list is associated with the ObData.
All Blender objects have a unique name. However, the name is qualified by the type of the object. This means you can have a Lamp Object called Lamp.001 ( OB:Lamp.001 ) and a Lamp ObData called Lamp.001 ( LA:Lamp.001 )
For a more in-depth look at Blender internals, and some understanding of why
Blender works the way it does, see the U{Blender Architecture document<http://www.blender3d.org/cms/Blender_Architecture.336.0.html>}.
A note to newbie script writers:
--------------------------------
...
...
@@ -190,6 +212,7 @@ A note to newbie script writers:
@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
@see: U{www.elysiun.com<http://www.elysiun.com>}: user forum
This module provides access to B{Curve Data} objects in Blender.
Example::
A Blender Curve can consist of multiple curves. Try converting a Text object to a Curve to see an example of this. Each curve is of
type Bezier or Nurb. The underlying curves can be accessed with
the [] operator. Operator [] returns an object of type CurNurb.
The Curve module also supports the Python iterator interface. This means you can access the curves in a Curve or the control points in a CurNurb using a python for statement.
Add a Curve to a Scene Example::
from Blender import Curve, Object, Scene
c = Curve.New() # create new curve data
cur = Scene.getCurrent() # get current scene
ob = Object.New('Curve') # make curve object
ob.link(c) # link curve data with this object
cur.link(ob) # link object into scene
Iterator Example::
ob = Object.GetSelected()[0]
curve = ob.getData()
for cur in curve:
print type( cur ), cur
for point in cur:
print type( point ), point
"""
defNew(name='CurData'):
...
...
@@ -42,6 +59,7 @@ class Curve:
The Curve Data object
=====================
This object gives access to Curve-specific data in Blender.
@cvar name: The Curve Data name.
@cvar pathlen: The Curve Data path length.
@cvar totcol: The Curve Data maximal number of linked materials.
...
...
@@ -230,6 +248,28 @@ class Curve:
See L{getControlPoint} for the length of the list.
"""
defappendPoint(numcurve,new_control_point):
"""
add a new control point to the indicated curve.
@rtype: PyNone
@type numcurve: int
@type new_control_point: list xyzw or BezTriple
@param numcurve: index for spline in Curve, starting from 0
@param new_control_point: depends on curve's type.
- type bezier: a BezTriple
- type nurb: a list of four floats for the xyzw values
@raise AttributeError: throws exeption if numcurve is out of range.
"""
defappendNurb(new_point):
"""
add a new curve to this Curve. The new point is added to the new curve. Blender does not support a curve with zero points. The new curve is added to the end of the list of curves in the Curve.
@rtype: PyNone
@return: PyNone
@type new_point: BezTriple or list of xyzw coords for a Nurb curve.
@param new_point: see L{CurNurb.append} for description of parameter.
"""
defgetLoc():
"""
Get the curve's location value.
...
...
@@ -271,3 +311,78 @@ class Curve:
@type size: list[3]
@param size: The new Curve's size values.
"""
defgetMaterials():
"""
Returns a list of materials assigned to the Curve.
@rtype: list of Material Objects
@return: list of Material Objects assigned to the Curve.
"""
defupdate():
"""
Updates display list for a Curve.
Used after making changes to control points.
You B{must} use this if you want to see your changes!
@rtype: PyNone
@return: PyNone
"""
defisNurb(curve_num):
"""
method used to determine whether a CurNurb is of type Bezier or of type Nurb.
@rtype: integer
@return: Zero of curve is type Bezier, One if curve is of type Nurb.
@type curve_num: integer
@param curve_num: zero-based index into list of curves in this Curve.
@raise AttributeError: throws execption if curve_num is out of range.
"""
classCurNurb:
"""
The CurNurb Object
==================
This object provides access to the control points of the curves that make up a Blender Curve.
The CurNurb supports the python iterator protocol which means you can use a python for statement to access the points in a curve.
The CurNurb also supports the sequence protocol which means you can access the control points of a CurNurb using the [] operator.
"""
defappend(new_point):
"""
Appends a new point to a curve. This method appends points to both Bezier and Nurb curves. The type of the argument must match the type of the curve. An empty curve will assume the type of the first appended point.
@rtype: PyNone
@return: PyNone
@type new_point: BezTriple or list of 4 floats
@param new_point: the new point to be appended to the curve. The new point can be either a BezTriple type or a list of 4 floats in x,y,z,w format for a Nurb curve.
"""
defsetMatIndex(index):
"""
Sets the Material index for this CurNurb.
@rtype: PyNone
@return: PyNone
@type index: integer
@param index: the new value for the Material number of this CurNurb. No range checking is done.
"""
defgetMatIndex():
"""
Returns the Material index for this CurNurb.
@rtype: integer
@return: integer
"""
defisNurb():
"""
Boolean method used to determine whether a CurNurb is of type Bezier or of type Nurb.