added id_attributes.py, this containes ID doc strings, all datablocks that have use ID props import this docstring.

This commit is contained in:
2007-02-27 10:23:24 +00:00
parent 9d7ace2654
commit d067c11336
24 changed files with 8233 additions and 8262 deletions

View File

@@ -4,224 +4,224 @@
The Blender Python API Reference
================================
An asterisk (*) means the module has been updated.
An asterisk (*) means the module has been updated.
for a full list of changes since 2.42 see U{http://mediawiki.blender.org/index.php/Release_Notes/Notes243/Python_API}
for a full list of changes since 2.42 see U{http://mediawiki.blender.org/index.php/Release_Notes/Notes243/Python_API}
Top Module:
-----------
Top Module:
-----------
- L{Blender}
- L{Blender}
Submodules:
-----------
- L{Armature} (*)
- L{NLA}
- L{Action<NLA.Action>}
- L{BezTriple} (*)
- L{BGL}
- L{Camera} (*)
- L{Curve} (*)
- L{Draw} (*)
- L{Effect}
- L{Geometry} (*)
- L{Group} (*)
- L{Image} (*)
- L{Ipo} (*)
- L{IpoCurve} (*)
- L{Key} (*)
- L{Lamp}
- L{Lattice} (*)
- L{Library} (*)
- L{Material} (*)
- L{Mathutils} (*)
- L{Mesh} (*)
- L{MeshPrimitives} (*)
- L{Metaball} (*)
- L{NMesh} (*)
- L{Noise}
- L{Object} (*)
- L{Modifier} (*)
- L{Pose} (*)
- L{Constraint} (*)
- L{ActionStrips<NLA>} (*)
- L{Registry}
- L{Scene} (*)
- L{Radio}
- L{Render} (*)
- L{Sound} (*)
- L{Text}
- L{Text3d}
- L{Font}
- L{Texture} (*)
- L{TimeLine}
- L{Types}
- L{Window}
- L{Theme} (*)
- L{World}
- L{sys<Sys>}
Submodules:
-----------
- L{Armature} (*)
- L{NLA}
- L{Action<NLA.Action>}
- L{BezTriple} (*)
- L{BGL}
- L{Camera} (*)
- L{Curve} (*)
- L{Draw} (*)
- L{Effect}
- L{Geometry} (*)
- L{Group} (*)
- L{Image} (*)
- L{Ipo} (*)
- L{IpoCurve} (*)
- L{Key} (*)
- L{Lamp}
- L{Lattice} (*)
- L{Library} (*)
- L{Material} (*)
- L{Mathutils} (*)
- L{Mesh} (*)
- L{MeshPrimitives} (*)
- L{Metaball} (*)
- L{NMesh} (*)
- L{Noise}
- L{Object} (*)
- L{Modifier} (*)
- L{Pose} (*)
- L{Constraint} (*)
- L{ActionStrips<NLA>} (*)
- L{Registry}
- L{Scene} (*)
- L{Radio}
- L{Render} (*)
- L{Sound} (*)
- L{Text}
- L{Text3d}
- L{Font}
- L{Texture} (*)
- L{TimeLine}
- L{Types}
- L{Window}
- L{Theme} (*)
- L{World}
- L{sys<Sys>}
Additional information:
-----------------------
Additional information:
-----------------------
- L{Special features<API_related>}:
- scripts: registering in menus, documenting, configuring (new);
- command line examples (new);
- script links (*), space handler script links, Group module (new).
- L{Special features<API_related>}:
- scripts: registering in menus, documenting, configuring (new);
- command line examples (new);
- script links (*), space handler script links, Group module (new).
Introduction:
=============
This reference documents the Blender Python API, a growing collection of
Python modules (libraries) that give access to part of the program's internal
data and functions.
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.
This reference documents the Blender Python API, a growing collection of
Python modules (libraries) that give access to part of the program's internal
data and functions.
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.
This opens many interesting possibilities, ranging from automating repetitive
tasks to adding new functionality to the program: procedural models,
importers and exporters, even complex applications and so on. Blender itself
comes with some scripts, but many others can be found in the Scripts & Plugins
sections and forum posts at the Blender-related sites listed below.
This opens many interesting possibilities, ranging from automating repetitive
tasks to adding new functionality to the program: procedural models,
importers and exporters, even complex applications and so on. Blender itself
comes with some scripts, but many others can be found in the Scripts & Plugins
sections and forum posts at the Blender-related sites listed below.
Scripting and Blender:
======================
These are the basic ways to execute scripts in Blender:
1. They can be loaded or typed as text files in the Text Editor window, then
executed with ALT+P.
2. Via command line: C{blender -P <scriptname>} will start Blender and execute
the given script. <scriptname> can be a filename in the user's file system or
the name of a text saved in a .blend Blender file:
'blender myfile.blend -P textname'.
3. Via command line in I{background mode}: use the '-b' flag (the order is
important): C{blender -b <blendfile> -P <scriptname>}. <blendfile> can be any
.blend file, including the default .B.blend that is in Blender's home directory
L{Blender.Get}('homedir'). In this mode no window will be opened and the
program will leave as soon as the script finishes execution.
4. Properly registered scripts can be selected directly from the program's
menus.
5. Scriptlinks: these are also loaded or typed in the Text Editor window and
can be linked to objects, materials or scenes using the Scriptlink buttons
tab. Script links get executed automatically when their events (ONLOAD,
REDRAW, FRAMECHANGED) are triggered. Normal scripts can create (L{Text}) and
link other scripts to objects and events, see L{Object.Object.addScriptLink},
for example.
6. A script can call another script (that will run in its own context, with
its own global dictionary) with the L{Blender.Run} module function.
1. They can be loaded or typed as text files in the Text Editor window, then
executed with ALT+P.
2. Via command line: C{blender -P <scriptname>} will start Blender and execute
the given script. <scriptname> can be a filename in the user's file system or
the name of a text saved in a .blend Blender file:
'blender myfile.blend -P textname'.
3. Via command line in I{background mode}: use the '-b' flag (the order is
important): C{blender -b <blendfile> -P <scriptname>}. <blendfile> can be any
.blend file, including the default .B.blend that is in Blender's home directory
L{Blender.Get}('homedir'). In this mode no window will be opened and the
program will leave as soon as the script finishes execution.
4. Properly registered scripts can be selected directly from the program's
menus.
5. Scriptlinks: these are also loaded or typed in the Text Editor window and
can be linked to objects, materials or scenes using the Scriptlink buttons
tab. Script links get executed automatically when their events (ONLOAD,
REDRAW, FRAMECHANGED) are triggered. Normal scripts can create (L{Text}) and
link other scripts to objects and events, see L{Object.Object.addScriptLink},
for example.
6. A script can call another script (that will run in its own context, with
its own global dictionary) with the L{Blender.Run} module function.
Interaction with users:
-----------------------
Scripts can:
- simply run and exit;
- pop messages, menus and small number and text input boxes;
- draw graphical user interfaces (GUIs) with OpenGL calls and native
program buttons, which stay there accepting user input like any other
Blender window until the user closes them;
- attach themselves to a space's event or drawing code (aka space handlers,
L{check here<API_related>});
- make changes to the 3D View (set visible layer(s), view point, etc);
- grab the main input event queue and process (or pass to Blender) selected
keyboard, mouse, redraw events -- not considered good practice, but still
available for private use;
- tell Blender to execute other scripts (see L{Blender.Run}());
- use external Python libraries, if available.
Scripts can:
- simply run and exit;
- pop messages, menus and small number and text input boxes;
- draw graphical user interfaces (GUIs) with OpenGL calls and native
program buttons, which stay there accepting user input like any other
Blender window until the user closes them;
- attach themselves to a space's event or drawing code (aka space handlers,
L{check here<API_related>});
- make changes to the 3D View (set visible layer(s), view point, etc);
- grab the main input event queue and process (or pass to Blender) selected
keyboard, mouse, redraw events -- not considered good practice, but still
available for private use;
- tell Blender to execute other scripts (see L{Blender.Run}());
- use external Python libraries, if available.
You can read the documentation for the L{Window}, L{Draw} and L{BGL} modules
for more information and also check the Python site for external modules that
might be useful to you. Note though that any imported module will become a
requirement of your script, since Blender itself does not bundle external
modules.
You can read the documentation for the L{Window}, L{Draw} and L{BGL} modules
for more information and also check the Python site for external modules that
might be useful to you. Note though that any imported module will become a
requirement of your script, since Blender itself does not bundle external
modules.
Command line mode:
------------------
Python was embedded in Blender, so to access BPython modules you need to
run scripts from the program itself: you can't import the Blender module
into an external Python interpreter.
Python was embedded in Blender, so to access BPython modules you need to
run scripts from the program itself: you can't import the Blender module
into an external Python interpreter.
On the other hand, for many tasks it's possible to control Blender via
some automated process using scripts. Interested readers should learn about
features like "OnLoad" script links, the "-b <blendfile>" (background mode)
and "-P <script>" (run script) command line options and API calls like
L{Blender.Save}, L{Blender.Load}, L{Blender.Quit} and the L{Library} and
L{Render} modules.
On the other hand, for many tasks it's possible to control Blender via
some automated process using scripts. Interested readers should learn about
features like "OnLoad" script links, the "-b <blendfile>" (background mode)
and "-P <script>" (run script) command line options and API calls like
L{Blender.Save}, L{Blender.Load}, L{Blender.Quit} and the L{Library} and
L{Render} modules.
Note that command line scripts are run before Blender initializes its windows
(and in '-b' mode no window will be initialized), so many functions that get
or set window related attributes (like most in L{Window}) don't work here. If
you need those, use an ONLOAD script link (see L{Scene.Scene.addScriptLink})
instead -- it's also possible to use a command line script to write or set an
ONLOAD script link. Check the L{Blender.mode} module var to know if Blender
is being executed in "background" or "interactive" mode.
Note that command line scripts are run before Blender initializes its windows
(and in '-b' mode no window will be initialized), so many functions that get
or set window related attributes (like most in L{Window}) don't work here. If
you need those, use an ONLOAD script link (see L{Scene.Scene.addScriptLink})
instead -- it's also possible to use a command line script to write or set an
ONLOAD script link. Check the L{Blender.mode} module var to know if Blender
is being executed in "background" or "interactive" mode.
L{Click here for command line and background mode examples<API_related>}.
L{Click here for command line and background mode examples<API_related>}.
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 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
opened, B{unless Blender was started with the "-y" parameter}.
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 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
opened, B{unless Blender was started with the "-y" parameter}.
The Game Engine API:
--------------------
Blender has a game engine for users to create and play 3d games. This
engine lets programmers add scripts to improve game AI, control, etc, making
more complex interaction and tricks possible. The game engine API is
separate from the Blender Python API this document references and you can
find its own ref doc in the doc section of the main sites below.
Blender has a game engine for users to create and play 3d games. This
engine lets programmers add scripts to improve game AI, control, etc, making
more complex interaction and tricks possible. The game engine API is
separate from the Blender Python API this document references and you can
find its own ref doc in the doc 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.
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 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.
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).
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>}.
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:
--------------------------------
Interpreted languages are known to be much slower than compiled code, but for
many applications the difference is negligible or acceptable. Also, with
profiling (or even simple direct timing with L{Blender.sys.time<Sys.time>}) to
identify slow areas and well thought optimizations, the speed can be
I{considerably} improved in many cases. Try some of the best BPython scripts
to get an idea of what can be done, you may be surprised.
Interpreted languages are known to be much slower than compiled code, but for
many applications the difference is negligible or acceptable. Also, with
profiling (or even simple direct timing with L{Blender.sys.time<Sys.time>}) to
identify slow areas and well thought optimizations, the speed can be
I{considerably} improved in many cases. Try some of the best BPython scripts
to get an idea of what can be done, you may be surprised.
@author: The Blender Python Team
@requires: Blender 2.43 or newer.
@@ -235,14 +235,14 @@ A note to newbie script writers:
@see: U{www.python.org/doc<http://www.python.org/doc>}
@see: U{Blending into Python<en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python>}: User contributed documentation, featuring a blender/python cookbook with many examples.
@note: this documentation was generated by epydoc, which can output html and
pdf. For pdf it requires a working LaTeX environment.
pdf. For pdf it requires a working LaTeX environment.
@note: the official version of this reference guide is only updated for each
new Blender release. But you can build the current CVS
version yourself: install epydoc, grab all files in the
source/blender/python/api2_2x/doc/ folder of Blender's CVS and use the
epy_docgen.sh script also found there to generate the html docs.
Naturally you will also need a recent Blender binary to try the new
features. If you prefer not to compile it yourself, there is a testing
builds forum at U{blender.org<http://www.blender.org>}.
new Blender release. But you can build the current CVS
version yourself: install epydoc, grab all files in the
source/blender/python/api2_2x/doc/ folder of Blender's CVS and use the
epy_docgen.sh script also found there to generate the html docs.
Naturally you will also need a recent Blender binary to try the new
features. If you prefer not to compile it yourself, there is a testing
builds forum at U{blender.org<http://www.blender.org>}.
"""

View File

@@ -114,249 +114,245 @@ def Get (name = None):
"""
def New (name = None):
"""
Return a new armature.
@type name: string or nothing
@param name: The string name of the new armature.
@rtype: Blender Armature.
@return: A new armature.
"""
"""
Return a new armature.
@type name: string or nothing
@param name: The string name of the new armature.
@rtype: Blender Armature.
@return: A new armature.
"""
class Armature:
"""
The Armature object
===================
This object gives access to Armature-specific data in Blender.
@ivar name: The Armature name.
@type name: String
@ivar bones: A Dictionary of Bones (BonesDict) that make up this armature.
@type bones: BonesDict Object
@ivar vertexGroups: Whether vertex groups define deformation
@type vertexGroups: Bool
@ivar envelopes: Whether bone envelopes define deformation
@type envelopes: Bool
@ivar restPosition: Show rest position (no posing possible)
@type restPosition: Bool
@ivar delayDeform: Don't deform children when manipulating bones
@type delayDeform: Bool
@ivar drawAxes: Draw bone axes
@type drawAxes: Bool
@ivar drawNames: Draw bone names
@type drawNames: Bool
@ivar ghost: Draw ghosts around frame for current Action
@type ghost: Bool
@ivar ghostStep: Number of frames between ghosts
@type ghostStep: Int
@ivar drawType: The drawing type that is used to display the armature
Acceptable values are:
- Armature.OCTAHEDRON: bones drawn as octahedrons
- Armature.STICK: bones drawn as sticks
- Armature.BBONE: bones drawn as b-bones
- Armature.ENVELOPE: bones drawn as sticks with envelopes
@type drawType: Constant Object
@ivar mirrorEdit: X-axis mirrored editing
@type mirrorEdit: Bool
@ivar autoIK: Adds temporary IK chains while grabbing bones
@type autoIK: Bool
@ivar users: The number of users of the armature. Read-only.
@type users: int
@ivar fakeUser: The fake user status.
Enabling this will keep it in the blend even if there are no users.
@type fakeUser: bool
"""
"""
The Armature object
===================
This object gives access to Armature-specific data in Blender.
@ivar bones: A Dictionary of Bones (BonesDict) that make up this armature.
@type bones: BonesDict Object
@ivar vertexGroups: Whether vertex groups define deformation
@type vertexGroups: Bool
@ivar envelopes: Whether bone envelopes define deformation
@type envelopes: Bool
@ivar restPosition: Show rest position (no posing possible)
@type restPosition: Bool
@ivar delayDeform: Don't deform children when manipulating bones
@type delayDeform: Bool
@ivar drawAxes: Draw bone axes
@type drawAxes: Bool
@ivar drawNames: Draw bone names
@type drawNames: Bool
@ivar ghost: Draw ghosts around frame for current Action
@type ghost: Bool
@ivar ghostStep: Number of frames between ghosts
@type ghostStep: Int
@ivar drawType: The drawing type that is used to display the armature
Acceptable values are:
- Armature.OCTAHEDRON: bones drawn as octahedrons
- Armature.STICK: bones drawn as sticks
- Armature.BBONE: bones drawn as b-bones
- Armature.ENVELOPE: bones drawn as sticks with envelopes
@type drawType: Constant Object
@ivar mirrorEdit: X-axis mirrored editing
@type mirrorEdit: Bool
@ivar autoIK: Adds temporary IK chains while grabbing bones
@type autoIK: Bool
"""
def __init__(name = 'myArmature'):
"""
Initializer for the Armature TypeObject.
Example::
myNewArmature = Blender.Armature.Armature('AR_1')
@param name: The name for the new armature
@type name: string
@return: New Armature Object
@rtype: Armature Object
"""
def makeEditable():
"""
Put the armature into EditMode for editing purposes. (Enters Editmode)
@warning: Using Window.Editmode() to switch the editmode manually will cause problems and possibly even crash Blender.
@warning: This is only needed for operations such as adding and removing bones.
@warning: Do access pose data until you have called update() or settings will be lost.
@warning: The armature should not be in manual editmode
prior to calling this method. The armature must be parented
to an object prior to editing.
@rtype: None
"""
def __init__(name = 'myArmature'):
"""
Initializer for the Armature TypeObject.
Example::
myNewArmature = Blender.Armature.Armature('AR_1')
@param name: The name for the new armature
@type name: string
@return: New Armature Object
@rtype: Armature Object
"""
def makeEditable():
"""
Put the armature into EditMode for editing purposes. (Enters Editmode)
@warning: Using Window.Editmode() to switch the editmode manually will cause problems and possibly even crash Blender.
@warning: This is only needed for operations such as adding and removing bones.
@warning: Do access pose data until you have called update() or settings will be lost.
@warning: The armature should not be in manual editmode
prior to calling this method. The armature must be parented
to an object prior to editing.
@rtype: None
"""
def update():
"""
Save all changes and update the armature. (Leaves Editmode)
@note: Must have called makeEditable() first.
@rtype: None
"""
def update():
"""
Save all changes and update the armature. (Leaves Editmode)
@note: Must have called makeEditable() first.
@rtype: None
"""
import id_generics
Armature.__doc__ += id_generics.attributes
class BonesDict:
"""
The BonesDict object
====================
This object gives gives dictionary like access to the bones in an armature.
It is internal to blender but is called as 'Armature.bones'
"""
The BonesDict object
====================
This object gives gives dictionary like access to the bones in an armature.
It is internal to blender but is called as 'Armature.bones'
Removing a bone:
Example::
del myArmature.bones['bone_name']
Adding a bone:
Example::
myEditBone = Armature.Editbone()
myArmature.bones['bone_name'] = myEditBone
"""
Removing a bone:
Example::
del myArmature.bones['bone_name']
Adding a bone:
Example::
myEditBone = Armature.Editbone()
myArmature.bones['bone_name'] = myEditBone
"""
def items():
"""
Return the key, value pairs in this dictionary
@rtype: string, BPy_bone
@return: All strings, and py_bones in the armature (in that order)
"""
def items():
"""
Return the key, value pairs in this dictionary
@rtype: string, BPy_bone
@return: All strings, and py_bones in the armature (in that order)
"""
def keys():
"""
Return the keys in this dictionary
@rtype: string
@return: All strings representing the bone names
"""
def keys():
"""
Return the keys in this dictionary
@rtype: string
@return: All strings representing the bone names
"""
def values():
"""
Return the values in this dictionary
@rtype: BPy_bone
@return: All BPy_bones in this dictionary
"""
def values():
"""
Return the values in this dictionary
@rtype: BPy_bone
@return: All BPy_bones in this dictionary
"""
class Bone:
"""
The Bone object
===============
This object gives access to Bone-specific data in Blender. This object
cannot be instantiated but is returned by BonesDict when the armature is not in editmode.
@ivar name: The name of this Bone.
@type name: String
@ivar roll: This Bone's roll value.
Keys are:
- 'ARMATURESPACE' - this roll in relation to the armature
- 'BONESPACE' - the roll in relation to itself
@type roll: Dictionary
@ivar head: This Bone's "head" ending position when in rest state.
Keys are:
- 'ARMATURESPACE' - this head position in relation to the armature
- 'BONESPACE' - the head position in relation to itself
@type head: Dictionary
@ivar tail: This Bone's "tail" ending position when in rest state.
Keys are:
- 'ARMATURESPACE' - this tail position in relation to the armature
- 'BONESPACE' - the tail position in relation to itself
@type tail: Dictionary
@ivar matrix: This Bone's matrix. This cannot be set.
Keys are:
- 'ARMATURESPACE' - this matrix of the bone in relation to the armature
- 'BONESPACE' - the matrix of the bone in relation to itself
@type matrix: Matrix Object
@ivar parent: The parent Bone.
@type parent: Bone Object
@ivar children: The children directly attached to this bone.
@type children: List of Bone Objects
@ivar weight: The bone's weight.
@type weight: Float
@ivar options: Various bone options which can be:
- Armature.CONNECTED: IK to parent
- Armature.HINGE: No parent rotation or scaling
- Armature.NO_DEFORM: The bone does not deform geometry
- Armature.MULTIPLY: Multiply vgroups by envelope
- Armature.HIDDEN_EDIT: Hide bones in editmode
- Armature.ROOT_SELECTED: Selection of root ball of bone
- Armature.BONE_SELECTED: Selection of bone
- Armature.TIP_SELECTED: Selection of tip ball of bone
@type options: List of Constants
@ivar subdivision: The number of bone subdivisions.
@type subdivision: Int
@ivar deformDist: The deform distance of the bone
@type deformDist: Float
@ivar length: The length of the bone. This cannot be set.
@type length: Float
@ivar headRadius: The radius of this bones head (used for envalope bones)
@type headRadius: Float
@ivar tailRadius: The radius of this bones head (used for envalope bones)
@type tailRadius: Float
"""
"""
The Bone object
===============
This object gives access to Bone-specific data in Blender. This object
cannot be instantiated but is returned by BonesDict when the armature is not in editmode.
@ivar name: The name of this Bone.
@type name: String
@ivar roll: This Bone's roll value.
Keys are:
- 'ARMATURESPACE' - this roll in relation to the armature
- 'BONESPACE' - the roll in relation to itself
@type roll: Dictionary
@ivar head: This Bone's "head" ending position when in rest state.
Keys are:
- 'ARMATURESPACE' - this head position in relation to the armature
- 'BONESPACE' - the head position in relation to itself
@type head: Dictionary
@ivar tail: This Bone's "tail" ending position when in rest state.
Keys are:
- 'ARMATURESPACE' - this tail position in relation to the armature
- 'BONESPACE' - the tail position in relation to itself
@type tail: Dictionary
@ivar matrix: This Bone's matrix. This cannot be set.
Keys are:
- 'ARMATURESPACE' - this matrix of the bone in relation to the armature
- 'BONESPACE' - the matrix of the bone in relation to itself
@type matrix: Matrix Object
@ivar parent: The parent Bone.
@type parent: Bone Object
@ivar children: The children directly attached to this bone.
@type children: List of Bone Objects
@ivar weight: The bone's weight.
@type weight: Float
@ivar options: Various bone options which can be:
- Armature.CONNECTED: IK to parent
- Armature.HINGE: No parent rotation or scaling
- Armature.NO_DEFORM: The bone does not deform geometry
- Armature.MULTIPLY: Multiply vgroups by envelope
- Armature.HIDDEN_EDIT: Hide bones in editmode
- Armature.ROOT_SELECTED: Selection of root ball of bone
- Armature.BONE_SELECTED: Selection of bone
- Armature.TIP_SELECTED: Selection of tip ball of bone
@type options: List of Constants
@ivar subdivision: The number of bone subdivisions.
@type subdivision: Int
@ivar deformDist: The deform distance of the bone
@type deformDist: Float
@ivar length: The length of the bone. This cannot be set.
@type length: Float
@ivar headRadius: The radius of this bones head (used for envalope bones)
@type headRadius: Float
@ivar tailRadius: The radius of this bones head (used for envalope bones)
@type tailRadius: Float
"""
def hasParent():
"""
Whether or not this bone has a parent
@rtype: Bool
"""
def hasParent():
"""
Whether or not this bone has a parent
@rtype: Bool
"""
def hasChildren():
"""
Whether or not this bone has children
@rtype: Bool
"""
def hasChildren():
"""
Whether or not this bone has children
@rtype: Bool
"""
def getAllChildren():
"""
Gets all the children under this bone including the children's children.
@rtype: List of Bone object
@return: all bones under this one
"""
def getAllChildren():
"""
Gets all the children under this bone including the children's children.
@rtype: List of Bone object
@return: all bones under this one
"""
class Editbone:
"""
The Editbone Object
===================
This object is a wrapper for editbone data and is used only in the manipulation
of the armature in editmode.
@ivar name: The name of this Bone.
@type name: String
@ivar roll: This Bone's roll value (armaturespace).
@type roll: Float
@ivar head: This Bone's "head" ending position when in rest state (armaturespace).
@type head: Vector Object
@ivar tail: This Bone's "tail" ending position when in rest state (armaturespace).
@type tail: Vector Object
@ivar matrix: This Bone's matrix. (armaturespace)
@type matrix: Matrix Object
@ivar parent: The parent Bone.
@type parent: Editbone Object
@ivar weight: The bone's weight.
@type weight: Float
@ivar options: Various bone options which can be:
- Armature.CONNECTED: IK to parent
- Armature.HINGE: No parent rotation or scaling
- Armature.NO_DEFORM: The bone does not deform geometry
- Armature.MULTIPLY: Multiply vgroups by envelope
- Armature.HIDDEN_EDIT: Hide bones in editmode
- Armature.ROOT_SELECTED: Selection of root ball of bone
- Armature.BONE_SELECTED: Selection of bone
- Armature.TIP_SELECTED: Selection of tip ball of bone
@type options: List of Constants
@ivar subdivision: The number of bone subdivisions.
@type subdivision: Int
@ivar deformDist: The deform distance of the bone
@type deformDist: Float
@ivar length: The length of the bone. This cannot be set.
@type length: Float
@ivar headRadius: The radius of this bones head (used for envalope bones)
@type headRadius: Float
@ivar tailRadius: The radius of this bones head (used for envalope bones)
@type tailRadius: Float
"""
"""
The Editbone Object
===================
This object is a wrapper for editbone data and is used only in the manipulation
of the armature in editmode.
@ivar name: The name of this Bone.
@type name: String
@ivar roll: This Bone's roll value (armaturespace).
@type roll: Float
@ivar head: This Bone's "head" ending position when in rest state (armaturespace).
@type head: Vector Object
@ivar tail: This Bone's "tail" ending position when in rest state (armaturespace).
@type tail: Vector Object
@ivar matrix: This Bone's matrix. (armaturespace)
@type matrix: Matrix Object
@ivar parent: The parent Bone.
@type parent: Editbone Object
@ivar weight: The bone's weight.
@type weight: Float
@ivar options: Various bone options which can be:
- Armature.CONNECTED: IK to parent
- Armature.HINGE: No parent rotation or scaling
- Armature.NO_DEFORM: The bone does not deform geometry
- Armature.MULTIPLY: Multiply vgroups by envelope
- Armature.HIDDEN_EDIT: Hide bones in editmode
- Armature.ROOT_SELECTED: Selection of root ball of bone
- Armature.BONE_SELECTED: Selection of bone
- Armature.TIP_SELECTED: Selection of tip ball of bone
@type options: List of Constants
@ivar subdivision: The number of bone subdivisions.
@type subdivision: Int
@ivar deformDist: The deform distance of the bone
@type deformDist: Float
@ivar length: The length of the bone. This cannot be set.
@type length: Float
@ivar headRadius: The radius of this bones head (used for envalope bones)
@type headRadius: Float
@ivar tailRadius: The radius of this bones head (used for envalope bones)
@type tailRadius: Float
"""
def hasParent():
"""
Whether or not this bone has a parent
@rtype: Bool
"""
def hasParent():
"""
Whether or not this bone has a parent
@rtype: Bool
"""
def clearParent():
"""
Set the parent to None
@rtype: None
"""
def clearParent():
"""
Set the parent to None
@rtype: None
"""

View File

@@ -12,243 +12,245 @@ This module provides access to B{Camera Data} objects in Blender.
Example::
from Blender import Camera, Object, Scene
cam = Camera.New('ortho') # create new ortho camera data
cam.scale = 6.0 # set scale value for ortho view
scn = Scene.GetCurrent() # get current scene
ob = scn.objects.new(cam) # add a new camera object from the data
scn.setCurrentCamera(ob) # make this camera the active
from Blender import Camera, Object, Scene
cam = Camera.New('ortho') # create new ortho camera data
cam.scale = 6.0 # set scale value for ortho view
scn = Scene.GetCurrent() # get current scene
ob = scn.objects.new(cam) # add a new camera object from the data
scn.setCurrentCamera(ob) # make this camera the active
"""
def New (type = 'persp', name = 'CamData'):
"""
Create a new Camera Data object.
@type type: string
@param type: The Camera type: 'persp' or 'ortho'.
@type name: string
@param name: The Camera Data name.
@rtype: Blender Camera
@return: The created Camera Data object.
"""
"""
Create a new Camera Data object.
@type type: string
@param type: The Camera type: 'persp' or 'ortho'.
@type name: string
@param name: The Camera Data name.
@rtype: Blender Camera
@return: The created Camera Data object.
"""
def Get (name = None):
"""
Get the Camera Data object(s) from Blender.
@type name: string
@param name: The name of the Camera Data.
@rtype: Blender Camera or a list of Blender Cameras
@return: It depends on the I{name} parameter:
- (name): The Camera Data object with the given I{name};
- (): A list with all Camera Data objects in the current scene.
"""
"""
Get the Camera Data object(s) from Blender.
@type name: string
@param name: The name of the Camera Data.
@rtype: Blender Camera or a list of Blender Cameras
@return: It depends on the I{name} parameter:
- (name): The Camera Data object with the given I{name};
- (): A list with all Camera Data objects in the current scene.
"""
class Camera:
"""
The Camera Data object
======================
This object gives access to Camera-specific data in Blender.
@ivar name: The Camera Data name.
@ivar type: The Camera type: 'persp' or 'ortho'
@ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
@ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
@ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
@ivar clipStart: The clip start value in [0.0, 100.0].
@ivar clipEnd: The clip end value in [1.0, 5000.0].
@ivar dofDist: The dofDist value in [0.0, 5000.0].
@ivar shiftx: The horizontal offset of the camera [-2.0, 2.0].
@ivar shifty: The vertical offset of the camera [-2.0, 2.0].
@ivar alpha: The PassePart alpha [0.0, 1.0].
@ivar drawSize: The display size for the camera an the 3d view [0.1, 10.0].
@type ipo: Blender Ipo
@ivar ipo: The "camera data" ipo linked to this camera data object.
Set to None to clear the ipo.
"""
The Camera Data object
======================
This object gives access to Camera-specific data in Blender.
@ivar type: The Camera type: 'persp' or 'ortho'
@ivar mode: The mode flags: B{ORed value}: 'showLimits':1, 'showMist':2.
@ivar lens: The lens value in [1.0, 250.0], only relevant to *persp* cameras.
@ivar scale: The scale value in [0.01, 1000.00], only relevant to *ortho* cameras.
@ivar clipStart: The clip start value in [0.0, 100.0].
@ivar clipEnd: The clip end value in [1.0, 5000.0].
@ivar dofDist: The dofDist value in [0.0, 5000.0].
@ivar shiftx: The horizontal offset of the camera [-2.0, 2.0].
@ivar shifty: The vertical offset of the camera [-2.0, 2.0].
@ivar alpha: The PassePart alpha [0.0, 1.0].
@ivar drawSize: The display size for the camera an the 3d view [0.1, 10.0].
@type ipo: Blender Ipo
@ivar ipo: The "camera data" ipo linked to this camera data object.
Set to None to clear the ipo.
@ivar drawLimits: Toggle the option to show limits in the 3d view.
@ivar drawName: Toggle the option to show the camera name in the 3d view.
@ivar drawMist: Toggle the option to show mist in the 3d view.
@ivar drawTileSafe: Toggle the option to show tile safe in the 3d view.
@ivar drawPassepartout: Toggle the option to show pass part out in the 3d view.
@ivar drawLimits: Toggle the option to show limits in the 3d view.
@ivar drawName: Toggle the option to show the camera name in the 3d view.
@ivar drawMist: Toggle the option to show mist in the 3d view.
@ivar drawTileSafe: Toggle the option to show tile safe in the 3d view.
@ivar drawPassepartout: Toggle the option to show pass part out in the 3d view.
@warning: Most member variables assume values in some [Min, Max] interval.
When trying to set them, the given parameter will be clamped to lie in
that range: if val < Min, then val = Min, if val > Max, then val = Max.
"""
@warning: Most member variables assume values in some [Min, Max] interval.
When trying to set them, the given parameter will be clamped to lie in
that range: if val < Min, then val = Min, if val > Max, then val = Max.
"""
def getName():
"""
Get the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
@rtype: string
"""
def getName():
"""
Get the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
@rtype: string
"""
def setName(name):
"""
Set the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
@type name: string
@param name: The new name.
"""
def setName(name):
"""
Set the name of this Camera Data object. (B{deprecated}) See the L{name} attribute.
@type name: string
@param name: The new name.
"""
def getIpo():
"""
Get the Ipo associated with this camera data object, if any. (B{deprecated})
@rtype: Ipo
@return: the wrapped ipo or None. (B{deprecated}) See the L{ipo} attribute.
"""
def getIpo():
"""
Get the Ipo associated with this camera data object, if any. (B{deprecated})
@rtype: Ipo
@return: the wrapped ipo or None. (B{deprecated}) See the L{ipo} attribute.
"""
def setIpo(ipo):
"""
Link an ipo to this camera data object. (B{deprecated}) See the L{ipo} attribute.
@type ipo: Blender Ipo
@param ipo: a "camera data" ipo.
"""
def setIpo(ipo):
"""
Link an ipo to this camera data object. (B{deprecated}) See the L{ipo} attribute.
@type ipo: Blender Ipo
@param ipo: a "camera data" ipo.
"""
def clearIpo():
"""
Unlink the ipo from this camera data object. (B{deprecated}) See the L{ipo} attribute.
@return: True if there was an ipo linked or False otherwise.
"""
def clearIpo():
"""
Unlink the ipo from this camera data object. (B{deprecated}) See the L{ipo} attribute.
@return: True if there was an ipo linked or False otherwise.
"""
def getType():
"""
Get this Camera's type. (B{deprecated}) See the L{type} attribute.
@rtype: int
@return: 0 for 'persp' or 1 for 'ortho'.
"""
def getType():
"""
Get this Camera's type. (B{deprecated}) See the L{type} attribute.
@rtype: int
@return: 0 for 'persp' or 1 for 'ortho'.
"""
def setType(type):
"""
Set this Camera's type. (B{deprecated}) See the L{type} attribute.
@type type: string
@param type: The Camera type: 'persp' or 'ortho'.
"""
def setType(type):
"""
Set this Camera's type. (B{deprecated}) See the L{type} attribute.
@type type: string
@param type: The Camera type: 'persp' or 'ortho'.
"""
def getMode():
"""
Get this Camera's mode flags. (B{deprecated}) See the L{mode} attribute.
@rtype: int
@return: B{OR'ed value}: 'showLimits' is 1, 'showMist' is 2, or
respectively, 01 and 10 in binary.
"""
def getMode():
"""
Get this Camera's mode flags. (B{deprecated}) See the L{mode} attribute.
@rtype: int
@return: B{OR'ed value}: 'showLimits' is 1, 'showMist' is 2, or
respectively, 01 and 10 in binary.
"""
def setMode(mode1 = None, mode2 = None):
"""
Set this Camera's mode flags. Mode strings given are turned 'on'. (B{deprecated}) See the L{mode} attribute.
Those not provided are turned 'off', so cam.setMode() -- without
arguments -- turns off all mode flags for Camera cam.
@type mode1: string
@type mode2: string
@param mode1: A mode flag: 'showLimits' or 'showMist'.
@param mode2: A mode flag: 'showLimits' or 'showMist'.
"""
def setMode(mode1 = None, mode2 = None):
"""
Set this Camera's mode flags. Mode strings given are turned 'on'. (B{deprecated}) See the L{mode} attribute.
Those not provided are turned 'off', so cam.setMode() -- without
arguments -- turns off all mode flags for Camera cam.
@type mode1: string
@type mode2: string
@param mode1: A mode flag: 'showLimits' or 'showMist'.
@param mode2: A mode flag: 'showLimits' or 'showMist'.
"""
def getLens():
"""
Get the lens value. (B{deprecated}) See the L{lens} attribute.
@rtype: float
@warn: lens is only relevant for perspective (L{getType}) cameras.
"""
def getLens():
"""
Get the lens value. (B{deprecated}) See the L{lens} attribute.
@rtype: float
@warn: lens is only relevant for perspective (L{getType}) cameras.
"""
def setLens(lens):
"""
Set the lens value. (B{deprecated}) See the L{lens} attribute.
@type lens: float
@param lens: The new lens value.
@warn: lens is only relevant for perspective (L{type}) cameras.
"""
def setLens(lens):
"""
Set the lens value. (B{deprecated}) See the L{lens} attribute.
@type lens: float
@param lens: The new lens value.
@warn: lens is only relevant for perspective (L{type}) cameras.
"""
def getScale():
"""
Get the scale value. (B{deprecated}) See the L{scale} attribute.
@rtype: float
@warn: scale is only relevant for ortho (L{type}) cameras.
"""
def getScale():
"""
Get the scale value. (B{deprecated}) See the L{scale} attribute.
@rtype: float
@warn: scale is only relevant for ortho (L{type}) cameras.
"""
def setScale(scale):
"""
Set the scale value. (B{deprecated}) See the L{scale} attribute.
@type scale: float
@param scale: The new scale value in [0.01, 1000.00].
@warn: scale is only relevant for ortho (L{getType}) cameras.
"""
def setScale(scale):
"""
Set the scale value. (B{deprecated}) See the L{scale} attribute.
@type scale: float
@param scale: The new scale value in [0.01, 1000.00].
@warn: scale is only relevant for ortho (L{getType}) cameras.
"""
def getClipStart():
"""
Get the clip start value. (B{deprecated}) See the L{clipStart} attribute.
@rtype: float
"""
def getClipStart():
"""
Get the clip start value. (B{deprecated}) See the L{clipStart} attribute.
@rtype: float
"""
def setClipStart(clipstart):
"""
Set the clip start value. (B{deprecated}) See the L{clipStart} attribute.
@type clipstart: float
@param clipstart: The new lens value.
"""
def setClipStart(clipstart):
"""
Set the clip start value. (B{deprecated}) See the L{clipStart} attribute.
@type clipstart: float
@param clipstart: The new lens value.
"""
def getClipEnd():
"""
Get the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
@rtype: float
"""
def getClipEnd():
"""
Get the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
@rtype: float
"""
def setClipEnd(clipend):
"""
Set the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
@type clipend: float
@param clipend: The new clip end value.
"""
def setClipEnd(clipend):
"""
Set the clip end value. (B{deprecated}) See the L{clipEnd} attribute.
@type clipend: float
@param clipend: The new clip end value.
"""
def getDrawSize():
"""
Get the draw size value. (B{deprecated}) See the L{drawSize} attribute.
@rtype: float
"""
def getDrawSize():
"""
Get the draw size value. (B{deprecated}) See the L{drawSize} attribute.
@rtype: float
"""
def setDrawSize(drawsize):
"""
Set the draw size value. (B{deprecated}) See the L{drawSize} attribute.
@type drawsize: float
@param drawsize: The new draw size value.
"""
def setDrawSize(drawsize):
"""
Set the draw size value. (B{deprecated}) See the L{drawSize} attribute.
@type drawsize: float
@param drawsize: The new draw size value.
"""
def getScriptLinks (event):
"""
Get a list with this Camera's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def getScriptLinks (event):
"""
Get a list with this Camera's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def clearScriptLinks (links = None):
"""
Delete script links from this Camera. If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def clearScriptLinks (links = None):
"""
Delete script links from this Camera. If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def addScriptLink (text, event):
"""
Add a new script link to this Camera.
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
"""
def addScriptLink (text, event):
"""
Add a new script link to this Camera.
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
"""
def insertIpoKey(keytype):
"""
Inserts keytype values in camera ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-LENS
-CLIPPING
@return: py_none
"""
def insertIpoKey(keytype):
"""
Inserts keytype values in camera ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-LENS
-CLIPPING
@return: py_none
"""
def __copy__ ():
"""
Make a copy of this camera
@rtype: Camera
@return: a copy of this camera
"""
def __copy__ ():
"""
Make a copy of this camera
@rtype: Camera
@return: a copy of this camera
"""
import id_generics
Camera.__doc__ += id_generics.attributes

View File

@@ -4,223 +4,223 @@
The Blender.Constraint submodule
B{New}:
- provides access to Blender's constraint stack
- provides access to Blender's constraint stack
This module provides access to the Constraint Data in Blender.
Examples::
from Blender import *
from Blender import *
ob = Object.Get('Cube')
if len(ob.constraints) > 0:
const = ob.constraints[0]
if const.type == Constraint.Type.FLOOR:
offs = const[Constraint.Settings.OFFSET]
ob = Object.Get('Cube')
if len(ob.constraints) > 0:
const = ob.constraints[0]
if const.type == Constraint.Type.FLOOR:
offs = const[Constraint.Settings.OFFSET]
Or to print all the constraints attached to each bone in a pose::
from Blender import *
ob = Object.Get('Armature')
pose = ob.getPose()
for bonename in pose.bones.keys():
bone = pose.bones[bonename]
for const in bone.constraints:
print bone.name,'=>',const
from Blender import *
ob = Object.Get('Armature')
pose = ob.getPose()
for bonename in pose.bones.keys():
bone = pose.bones[bonename]
for const in bone.constraints:
print bone.name,'=>',const
@type Type: readonly dictionary
@var Type: Constant Constraint dict used by L{Constraints.append()} and
for comparison with L{Constraint.type}. Values are
TRACKTO, IKSOLVER, FOLLOWPATH, COPYROT, COPYLOC, COPYSIZE, ACTION,
LOCKTRACK, STRETCHTO, FLOOR, LIMITLOC, LIMITROT, LIMITSIZE, NULL
for comparison with L{Constraint.type}. Values are
TRACKTO, IKSOLVER, FOLLOWPATH, COPYROT, COPYLOC, COPYSIZE, ACTION,
LOCKTRACK, STRETCHTO, FLOOR, LIMITLOC, LIMITROT, LIMITSIZE, NULL
@type Settings: readonly dictionary
@var Settings: Constant dict used for changing constraint settings.
- Used for all constraints
- TARGET (Object) (Note: not used by Limit Location (LIMITLOC),
Limit Rotation (LIMITROT), Limit Scale (LIMITSIZE))
- BONE (string): name of Bone sub-target (for armature targets) (Note: not
used by Stretch To (STRETCHTO), Limit Location (LIMITLOC), Limit Rotation
(LIMITROT), Limit Scale (LIMITSIZE))
- Used by IK Solver (IKSOLVER) constraint:
- TOLERANCE (float): clamped to [0.0001:1.0]
- ITERATIONS (int): clamped to [1,10000]
- CHAINLEN (int): clamped to [0,255]
- POSWEIGHT (float): clamped to [0.01,1.0]
- ROTWEIGHT (float): clamped to [0.01,1.0]
- ROTATE (bool)
- USETIP (bool)
- Used by Action (ACTION) constraint:
- ACTION (Action Object)
- LOCAL (bool)
- START (int): clamped to [1,maxframe]
- END (int): clamped to [1,maxframe]
- MIN (float): clamped to [-180.0,180.0]
- MAX (float): clamped to [-180.0,180.0]
- KEYON (int): values are XROT, YROT, ZROT
- Used by Track To (TRACKTO) constraint:
- TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
TRACKNEGY, TRACKNEGZ
- UP (int): values are UPX, UPY, UPZ
- Used by Stretch To (STRETCHTO) constraint:
- RESTLENGTH (float): clamped to [0.0:100.0]
- VOLVARIATION (float): clamped to [0.0:100.0]
- VOLUMEMODE (int): values are VOLUMEXZ, VOLUMEX, VOLUMEZ,
VOLUMENONE
- PLANE (int): values are PLANEX, PLANEZ
- Used by Follow Path (FOLLOWPATH) constraint:
- FOLLOW (bool)
- OFFSET (float): clamped to [-maxframe:maxframe]
- FORWARD (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
TRACKNEGY, TRACKNEGZ
- UP (int): values are UPX, UPY, UPZ
- Used by Lock Track (FOLLOWPATH) constraint:
- TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
TRACKNEGY, TRACKNEGZ
- LOCK (int): values are LOCKX, LOCKY, LOCKZ
- Used by Floor (FLOOR) constraint:
- MINMAX (int): values are MINX, MINY, MINZ, MAXX, MAXY, MAXZ
- OFFSET (float): clamped to [-100.0,100.0]
- STICKY (bool)
- Used by Copy Location (COPYLOC) and Copy Rotation (COPYROT)
- COPY (bitfield): any combination of COPYX, COPYY and COPYZ
- LOCAL (bool): Only for constraints which Armature targets.
- Used by Copy Size (COPYSIZE) constraint:
- COPY (bitfield): any combination of COPYX, COPYY and COPYZ
- Used by Limit Location (LIMITLOC) constraint:
- LIMIT (bitfield): any combination of LIMIT_XMIN, LIMIT_XMAX,
LIMIT_YMIN, LIMIT_YMAX, LIMIT_ZMIN, LIMIT_ZMAX
- LIMIT_LOCAL_BONE (boolean): USE WITH CAUTION. Only do something
with this value if constraint is assigned to a bone.
- LIMIT_LOCAL_NOPARENT (boolean): USE WITH CAUTION. Only do something
with this value if constraint is assigned to an object with that
has been parented to something.
- XMIN (float): clamped to [-1000.0,1000.0]
- XMAX (float): clamped to [-1000.0,1000.0]
- YMIN (float): clamped to [-1000.0,1000.0]
- YMAX (float): clamped to [-1000.0,1000.0]
- ZMIN (float): clamped to [-1000.0,1000.0]
- ZMAX (float): clamped to [-1000.0,1000.0]
- Used by Limit Rotation (LIMITROT) constraint:
- LIMIT (bitfield): any combination of LIMIT_XROT, LIMIT_YROT,
LIMIT_ZROT
- LIMIT_LOCAL_BONE (boolean): USE WITH CAUTION. Only do something
with this value if constraint is assigned to a bone.
- XMIN (float): clamped to [-360.0,360.0]
- XMAX (float): clamped to [-360.0,360.0]
- YMIN (float): clamped to [-360.0,360.0]
- YMAX (float): clamped to [-360.0,360.0]
- ZMIN (float): clamped to [-360.0,360.0]
- ZMAX (float): clamped to [-360.0,360.0]
- Used by Limit Scale (LIMITSIZE) constraint:
- LIMIT (bitfield): any combination of LIMIT_XMIN, LIMIT_XMAX,
LIMIT_YMIN, LIMIT_YMAX, LIMIT_ZMIN, LIMIT_ZMAX
- XMIN (float): clamped to [-1000.0,1000.0]
- XMAX (float): clamped to [-1000.0,1000.0]
- YMIN (float): clamped to [-1000.0,1000.0]
- YMAX (float): clamped to [-1000.0,1000.0]
- ZMIN (float): clamped to [-1000.0,1000.0]
- ZMAX (float): clamped to [-1000.0,1000.0]
- Used for all constraints
- TARGET (Object) (Note: not used by Limit Location (LIMITLOC),
Limit Rotation (LIMITROT), Limit Scale (LIMITSIZE))
- BONE (string): name of Bone sub-target (for armature targets) (Note: not
used by Stretch To (STRETCHTO), Limit Location (LIMITLOC), Limit Rotation
(LIMITROT), Limit Scale (LIMITSIZE))
- Used by IK Solver (IKSOLVER) constraint:
- TOLERANCE (float): clamped to [0.0001:1.0]
- ITERATIONS (int): clamped to [1,10000]
- CHAINLEN (int): clamped to [0,255]
- POSWEIGHT (float): clamped to [0.01,1.0]
- ROTWEIGHT (float): clamped to [0.01,1.0]
- ROTATE (bool)
- USETIP (bool)
- Used by Action (ACTION) constraint:
- ACTION (Action Object)
- LOCAL (bool)
- START (int): clamped to [1,maxframe]
- END (int): clamped to [1,maxframe]
- MIN (float): clamped to [-180.0,180.0]
- MAX (float): clamped to [-180.0,180.0]
- KEYON (int): values are XROT, YROT, ZROT
- Used by Track To (TRACKTO) constraint:
- TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
TRACKNEGY, TRACKNEGZ
- UP (int): values are UPX, UPY, UPZ
- Used by Stretch To (STRETCHTO) constraint:
- RESTLENGTH (float): clamped to [0.0:100.0]
- VOLVARIATION (float): clamped to [0.0:100.0]
- VOLUMEMODE (int): values are VOLUMEXZ, VOLUMEX, VOLUMEZ,
VOLUMENONE
- PLANE (int): values are PLANEX, PLANEZ
- Used by Follow Path (FOLLOWPATH) constraint:
- FOLLOW (bool)
- OFFSET (float): clamped to [-maxframe:maxframe]
- FORWARD (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
TRACKNEGY, TRACKNEGZ
- UP (int): values are UPX, UPY, UPZ
- Used by Lock Track (FOLLOWPATH) constraint:
- TRACK (int): values are TRACKX, TRACKY, TRACKZ, TRACKNEGX,
TRACKNEGY, TRACKNEGZ
- LOCK (int): values are LOCKX, LOCKY, LOCKZ
- Used by Floor (FLOOR) constraint:
- MINMAX (int): values are MINX, MINY, MINZ, MAXX, MAXY, MAXZ
- OFFSET (float): clamped to [-100.0,100.0]
- STICKY (bool)
- Used by Copy Location (COPYLOC) and Copy Rotation (COPYROT)
- COPY (bitfield): any combination of COPYX, COPYY and COPYZ
- LOCAL (bool): Only for constraints which Armature targets.
- Used by Copy Size (COPYSIZE) constraint:
- COPY (bitfield): any combination of COPYX, COPYY and COPYZ
- Used by Limit Location (LIMITLOC) constraint:
- LIMIT (bitfield): any combination of LIMIT_XMIN, LIMIT_XMAX,
LIMIT_YMIN, LIMIT_YMAX, LIMIT_ZMIN, LIMIT_ZMAX
- LIMIT_LOCAL_BONE (boolean): USE WITH CAUTION. Only do something
with this value if constraint is assigned to a bone.
- LIMIT_LOCAL_NOPARENT (boolean): USE WITH CAUTION. Only do something
with this value if constraint is assigned to an object with that
has been parented to something.
- XMIN (float): clamped to [-1000.0,1000.0]
- XMAX (float): clamped to [-1000.0,1000.0]
- YMIN (float): clamped to [-1000.0,1000.0]
- YMAX (float): clamped to [-1000.0,1000.0]
- ZMIN (float): clamped to [-1000.0,1000.0]
- ZMAX (float): clamped to [-1000.0,1000.0]
- Used by Limit Rotation (LIMITROT) constraint:
- LIMIT (bitfield): any combination of LIMIT_XROT, LIMIT_YROT,
LIMIT_ZROT
- LIMIT_LOCAL_BONE (boolean): USE WITH CAUTION. Only do something
with this value if constraint is assigned to a bone.
- XMIN (float): clamped to [-360.0,360.0]
- XMAX (float): clamped to [-360.0,360.0]
- YMIN (float): clamped to [-360.0,360.0]
- YMAX (float): clamped to [-360.0,360.0]
- ZMIN (float): clamped to [-360.0,360.0]
- ZMAX (float): clamped to [-360.0,360.0]
- Used by Limit Scale (LIMITSIZE) constraint:
- LIMIT (bitfield): any combination of LIMIT_XMIN, LIMIT_XMAX,
LIMIT_YMIN, LIMIT_YMAX, LIMIT_ZMIN, LIMIT_ZMAX
- XMIN (float): clamped to [-1000.0,1000.0]
- XMAX (float): clamped to [-1000.0,1000.0]
- YMIN (float): clamped to [-1000.0,1000.0]
- YMAX (float): clamped to [-1000.0,1000.0]
- ZMIN (float): clamped to [-1000.0,1000.0]
- ZMAX (float): clamped to [-1000.0,1000.0]
"""
class Constraints:
"""
The Constraints object
======================
This object provides access to sequence of
L{constraints<Constraint.Constraint>} for a particular object.
They can be accessed from L{Object.constraints<Object.Object.constraints>}.
or L{PoseBone.constraints<Pose.PoseBone.constraints>}.
"""
"""
The Constraints object
======================
This object provides access to sequence of
L{constraints<Constraint.Constraint>} for a particular object.
They can be accessed from L{Object.constraints<Object.Object.constraints>}.
or L{PoseBone.constraints<Pose.PoseBone.constraints>}.
"""
def __getitem__(index):
"""
This operator returns one of the constraints in the stack.
@type index: int
@return: an Constraint object
@rtype: Constraint
@raise KeyError: index was out of range
"""
def __getitem__(index):
"""
This operator returns one of the constraints in the stack.
@type index: int
@return: an Constraint object
@rtype: Constraint
@raise KeyError: index was out of range
"""
def __len__():
"""
Returns the number of constraints in the constraint stack.
@return: number of Constraints
@rtype: int
"""
def __len__():
"""
Returns the number of constraints in the constraint stack.
@return: number of Constraints
@rtype: int
"""
def append(type):
"""
Appends a new constraint to the end of the constraint stack.
@param type: a constant specifying the type of constraint to create. as from L{Type}
@type type: int constant
@rtype: Constraint
@return: the new Constraint
"""
def append(type):
"""
Appends a new constraint to the end of the constraint stack.
@param type: a constant specifying the type of constraint to create. as from L{Type}
@type type: int constant
@rtype: Constraint
@return: the new Constraint
"""
def remove(con):
"""
Remove a constraint from this objects constraint sequence.
@param con: a constraint from this sequence to remove.
@type con: Constraint
@note: Accessing attributes of the constraint after it is removed will
throw an exception.
"""
def remove(con):
"""
Remove a constraint from this objects constraint sequence.
@param con: a constraint from this sequence to remove.
@type con: Constraint
@note: Accessing attributes of the constraint after it is removed will
throw an exception.
"""
def moveUp(con):
"""
Moves the constraint up in the object's constraint stack.
@param con: a constraint from this sequence to remove.
@type con: Constraint
@rtype: None
"""
def moveUp(con):
"""
Moves the constraint up in the object's constraint stack.
@param con: a constraint from this sequence to remove.
@type con: Constraint
@rtype: None
"""
def moveDown(con):
"""
Moves the constraint down in the object's constraint stack.
@param con: a constraint from this sequence to remove.
@type con: Constraint
@rtype: None
"""
def moveDown(con):
"""
Moves the constraint down in the object's constraint stack.
@param con: a constraint from this sequence to remove.
@type con: Constraint
@rtype: None
"""
class Constraint:
"""
The Constraint object
=====================
This object provides access to a constraint for a particular object
accessed from L{Constraints}.
@ivar name: The name of this constraint. 29 chars max.
@type name: string
@ivar type: The type of this constraint. Read-only. The returned value
matches the types in L{Type}.
@type type: int
@ivar influence: The influence value of the constraint. Valid values
are in the range [0.0,1.0].
@type influence: float
"""
"""
The Constraint object
=====================
This object provides access to a constraint for a particular object
accessed from L{Constraints}.
@ivar name: The name of this constraint. 29 chars max.
@type name: string
@ivar type: The type of this constraint. Read-only. The returned value
matches the types in L{Type}.
@type type: int
@ivar influence: The influence value of the constraint. Valid values
are in the range [0.0,1.0].
@type influence: float
"""
def __getitem__(key):
"""
This operator returns one of the constraint's data attributes.
@param key: value from constraint's L{Constraint.Settings} constant
@type key: int constant
@return: the requested data
@rtype: varies
@raise KeyError: the key does not exist for the constraint
"""
def __getitem__(key):
"""
This operator returns one of the constraint's data attributes.
@param key: value from constraint's L{Constraint.Settings} constant
@type key: int constant
@return: the requested data
@rtype: varies
@raise KeyError: the key does not exist for the constraint
"""
def __setitem__(key):
"""
This operator changes one of the constraint's data attributes.
@param key: value from constraint's L{Constraint.Settings} constant
@type key: int constant
@raise KeyError: the key does not exist for the constraint
"""
def __setitem__(key):
"""
This operator changes one of the constraint's data attributes.
@param key: value from constraint's L{Constraint.Settings} constant
@type key: int constant
@raise KeyError: the key does not exist for the constraint
"""
def insertKey(frame):
"""
Adds an influence keyframe for the constraint Ipo.
@rtype: None
@param frame: the frame number at which to insert the key.
@type frame: float
"""
def insertKey(frame):
"""
Adds an influence keyframe for the constraint Ipo.
@rtype: None
@param frame: the frame number at which to insert the key.
@type frame: float
"""

File diff suppressed because it is too large Load Diff

View File

@@ -9,61 +9,61 @@ Text3d.Font Objects
This module provides access to B{Font} objects in Blender.
Example::
import Blender
from Blender import Text3d
# Load a font
myfont= Text3d.Font.Load('/usr/share/fonts/ttf/verdana.ttf')
#
for font in Text3d.Font.Get():
print font.name, font.filename, font.packed
import Blender
from Blender import Text3d
# Load a font
myfont= Text3d.Font.Load('/usr/share/fonts/ttf/verdana.ttf')
#
for font in Text3d.Font.Get():
print font.name, font.filename, font.packed
"""
def Load (filename):
"""
Create a new Text3d.Font object.
@type filename: string
@param filename: file of the font
@rtype: Blender Text3d.Font
@return: The created Text3d.Font Data object.
"""
"""
Create a new Text3d.Font object.
@type filename: string
@param filename: file of the font
@rtype: Blender Text3d.Font
@return: The created Text3d.Font Data object.
"""
def Get (name = None):
"""
Get the Text3d.Font object(s) from Blender.
@type name: string
@param name: The name of the Text3d object.
@rtype: Blender Text3d or a list of Blender Text3ds
@return: It depends on the 'name' parameter:
- (name): The Text3d object with the given name;
- (): A list with all Font objects in the current .blend file.
"""
"""
Get the Text3d.Font object(s) from Blender.
@type name: string
@param name: The name of the Text3d object.
@rtype: Blender Text3d or a list of Blender Text3ds
@return: It depends on the 'name' parameter:
- (name): The Text3d object with the given name;
- (): A list with all Font objects in the current .blend file.
"""
class Font:
"""
The Text3d.Font object
======================
This object gives access Blender's B{Font} objects
@ivar name: The Font name.
@ivar filename: The filename (path) of the file loaded into this Font.
@ivar packed: Boolean, True when the sample is packed (readonly).
@ivar users: The number of users this font has (read only)
"""
"""
The Text3d.Font object
======================
This object gives access Blender's B{Font} objects
@ivar filename: The filename (path) of the file loaded into this Font.
@type filename: string
@ivar packed: Boolean, True when the sample is packed (readonly).
@type packed: string
"""
def pack():
"""
Packs the sound into the current blend file.
@note: An error will be raised if the sound is already packed or the filename path does not exist.
@returns: nothing
@rtype: none
"""
def pack():
"""
Packs the sound into the current blend file.
@note: An error will be raised if the sound is already packed or the filename path does not exist.
@returns: nothing
@rtype: none
"""
def unpack(mode):
"""
Unpacks the sound to the samples filename.
@param mode: One of the values in Blender.UnpackModes dict.
@note: An error will be raised if the sound is not packed or the filename path does not exist.
@returns: nothing
@rtype: none
@type mode: int
"""
def unpack(mode):
"""
Unpacks the sound to the samples filename.
@param mode: One of the values in Blender.UnpackModes dict.
@note: An error will be raised if the sound is not packed or the filename path does not exist.
@returns: nothing
@rtype: none
@type mode: int
"""

View File

@@ -10,121 +10,118 @@ This module provides access to B{Group} data in Blender.
Example::
# Make Dupli's Real, as a python script.
# Make Dupli's Real, as a python script.
from Blender import *
from Blender import *
scn= Scene.GetCurrent()
for ob in scn.objects:
print 'Object Group Settings'
print ob.name, ob.type
print 'enableDupVerts:', ob.enableDupVerts
print 'enableDupFrames:', ob.enableDupFrames
print 'enableDupGroup:', ob.enableDupGroup
print 'DupGroup:', ob.DupGroup
dupe_obs= ob.DupObjects
print 'num dup obs:', len(dupe_obs)
scn= Scene.GetCurrent()
for ob in scn.objects:
print 'Object Group Settings'
print ob.name, ob.type
print 'enableDupVerts:', ob.enableDupVerts
print 'enableDupFrames:', ob.enableDupFrames
print 'enableDupGroup:', ob.enableDupGroup
print 'DupGroup:', ob.DupGroup
dupe_obs= ob.DupObjects
print 'num dup obs:', len(dupe_obs)
for dup_ob, dup_matrix in dupe_obs:
print '\tDupOb', dup_ob.name
scn.objects.new(dup_ob.data)
new_ob.setMatrix(dup_matrix)
new_ob.sel= 1 # select all real instances.
for dup_ob, dup_matrix in dupe_obs:
print '\tDupOb', dup_ob.name
scn.objects.new(dup_ob.data)
new_ob.setMatrix(dup_matrix)
new_ob.sel= 1 # select all real instances.
ob.sel=0 # Desel the original object
ob.sel=0 # Desel the original object
Window.RedrawAll()
Window.RedrawAll()
Example::
# Make a new group with the selected objects, and add an instance of this group.
# Make a new group with the selected objects, and add an instance of this group.
from Blender import *
scn= Scene.GetCurrent()
# New Group
grp= Group.New('mygroup')
grp.objects= scn.objects
# Instance the group at an empty using dupligroups
ob= scn.objects.new(None)
ob.enableDupGroup= True
ob.DupGroup= grp
Window.RedrawAll()
from Blender import *
scn= Scene.GetCurrent()
# New Group
grp= Group.New('mygroup')
grp.objects= scn.objects
# Instance the group at an empty using dupligroups
ob= scn.objects.new(None)
ob.enableDupGroup= True
ob.DupGroup= grp
Window.RedrawAll()
Example::
# Remove all non mesh objects from a group.
# Remove all non mesh objects from a group.
from Blender import *
scn= Scene.GetCurrent()
# New Group
grp= Group.Get('mygroup')
for ob in list(grp.objects): # Convert to a list before looping because we are removing items
if ob.type != 'Mesh':
grp.objects.unlink(ob)
from Blender import *
scn= Scene.GetCurrent()
# New Group
grp= Group.Get('mygroup')
for ob in list(grp.objects): # Convert to a list before looping because we are removing items
if ob.type != 'Mesh':
grp.objects.unlink(ob)
"""
def New (name = None):
"""
Make a new empty group, name optional, default is "Group"
@type name: string
@param name: The name of the new group.
@rtype: Blender Group
@return: A Empty Blender Group object
"""
"""
Make a new empty group, name optional, default is "Group"
@type name: string
@param name: The name of the new group.
@rtype: Blender Group
@return: A Empty Blender Group object
"""
def Get (name = None):
"""
Get the Group object(s) from Blender.
@type name: string
@param name: The name of the Group object.
@rtype: Blender Group or a list of Blender Groups
@return: It depends on the I{name} parameter:
- (name): The Group object called I{name}, Exception if it is not found.
- (): A list with all Group objects in the current blend file.
"""
"""
Get the Group object(s) from Blender.
@type name: string
@param name: The name of the Group object.
@rtype: Blender Group or a list of Blender Groups
@return: It depends on the I{name} parameter:
- (name): The Group object called I{name}, Exception if it is not found.
- (): A list with all Group objects in the current blend file.
"""
def Unlink (group):
"""
Unlink (delete) this group from Blender.
@Note: No objects will be removed, just the group that references them.
@type group: group
@param group: A group to remove from this blend file, does not remove objects that this group uses.
"""
"""
Unlink (delete) this group from Blender.
@Note: No objects will be removed, just the group that references them.
@type group: group
@param group: A group to remove from this blend file, does not remove objects that this group uses.
"""
class Group:
"""
The Group object
================
This object gives access to Groups in Blender.
@ivar name: The name of this Group object.
@type name: string
@ivar users: Number of users this group has (read only)
@type users: int
@ivar fakeUser: The fake user status.
Enabling this will keep it in the blend even if there are no users.
@type fakeUser: bool
@ivar layers: Layer bitmask for this group.
@type layers: int
@ivar objects: Objects that this group uses.
This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
The groups objects can be set by assigning a list or iterator of objects to the groups objects.
objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
"""
The Group object
================
This object gives access to Groups in Blender.
@ivar layers: Layer bitmask for this group.
@type layers: int
@ivar objects: Objects that this group uses.
This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
The groups objects can be set by assigning a list or iterator of objects to the groups objects.
objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
after Blender 2.43 append() and remove() will not be available.
@type objects: custom object sequence
"""
B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
after Blender 2.43 append() and remove() will not be available.
@type objects: custom object sequence
"""
def __copy__ ():
"""
Make a copy of this group
@rtype: Group
@return: a copy of this group
"""
import id_generics
Group.__doc__ += id_generics.attributes
def __copy__ ():
"""
Make a copy of this group
@rtype: Group
@return: a copy of this group
"""

View File

@@ -11,348 +11,345 @@ B{New}: L{Image.setFilename}.
This module provides access to B{Image} objects in Blender.
Example::
import Blender
from Blender import Image
#
image = Image.Load("/path/to/my/image.png") # load an image file
print "Image from", image.getFilename(),
print "loaded to obj", image.getName())
image.setXRep(4) # set x tiling factor
image.setYRep(2) # set y tiling factor
print "All Images available now:", Image.Get()
import Blender
from Blender import Image
#
image = Image.Load("/path/to/my/image.png") # load an image file
print "Image from", image.getFilename(),
print "loaded to obj", image.getName())
image.setXRep(4) # set x tiling factor
image.setYRep(2) # set y tiling factor
print "All Images available now:", Image.Get()
"""
def Load (filename):
"""
Load the image called 'filename' into an Image object.
@type filename: string
@param filename: The full path to the image file.
@rtype: Blender Image
@return: A Blender Image object with the data from I{filename}.
"""
"""
Load the image called 'filename' into an Image object.
@type filename: string
@param filename: The full path to the image file.
@rtype: Blender Image
@return: A Blender Image object with the data from I{filename}.
"""
def New (name, width, height, depth):
"""
Create a new Image object.
@type name: string
@param name: The name of the new Image object.
@type width: int
@param width: The width of the new Image object, between 1 and 5000.
@type height: int
@param height: The height of the new Image object, between 1 and 5000.
@type depth: int
@param depth: The colour depth of the new Image object. (8:Grey, 24:RGB, 32:RGBA). (Not implimented yet, all new images will be 24bit)
@rtype: Blender Image
@return: A new Blender Image object.
"""
"""
Create a new Image object.
@type name: string
@param name: The name of the new Image object.
@type width: int
@param width: The width of the new Image object, between 1 and 5000.
@type height: int
@param height: The height of the new Image object, between 1 and 5000.
@type depth: int
@param depth: The colour depth of the new Image object. (8:Grey, 24:RGB, 32:RGBA). (Not implimented yet, all new images will be 24bit)
@rtype: Blender Image
@return: A new Blender Image object.
"""
def Get (name = None):
"""
Get the Image object(s) from Blender.
@type name: string
@param name: The name of the Image object.
@rtype: Blender Image or a list of Blender Images
@return: It depends on the I{name} parameter:
- (name): The Image object called I{name}, None if not found;
- (): A list with all Image objects in the current scene.
"""
"""
Get the Image object(s) from Blender.
@type name: string
@param name: The name of the Image object.
@rtype: Blender Image or a list of Blender Images
@return: It depends on the I{name} parameter:
- (name): The Image object called I{name}, None if not found;
- (): A list with all Image objects in the current scene.
"""
def GetCurrent ():
"""
Get the currently displayed Image from Blenders UV/Image window.
When multiple images are displayed, the last active UV/Image windows image is used.
@rtype: Blender Image
@return: The Current Blender Image, If there is no current image it returns None.
"""
"""
Get the currently displayed Image from Blenders UV/Image window.
When multiple images are displayed, the last active UV/Image windows image is used.
@rtype: Blender Image
@return: The Current Blender Image, If there is no current image it returns None.
"""
from IDProp import IDGroup, IDArray
class Image:
"""
The Image object
================
This object gives access to Images in Blender.
@ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
image's ID Properties.
@type properties: L{IDGroup<IDProp.IDGroup>}
@ivar name: The name of this Image object.
@type name: string
@ivar filename: The filename (path) to the image file loaded into this Image
object.
@type filename: string
@ivar size: The [width, height] dimensions of the image (in pixels).
@type size: list
@ivar depth: The pixel depth of the image. [8, 16, 18, 24, 32]
@type depth: int
@ivar xrep: Texture tiling: the number of repetitions in the x (horizontal)
axis. [1, 16].
@ivar yrep: Texture tiling: the number of repetitions in the y (vertical)
axis [1, 16].
@type xrep: int
@type yrep: int
@ivar start: Texture's animation start frame [0, 128].
@type start: int
@ivar end: Texture's animation end frame [0, 128].
@type end: int
@ivar speed: Texture's animation speed [1, 100].
@type speed: int
@ivar packed: True when the Texture is packed (readonly).
@type packed: boolean
@ivar has_data: True when the image has pixel data (readonly).
@type has_data: boolean
@ivar fields: enable or disable the fields option for this image.
@type fields: boolean
@ivar fields_odd: enable or disable the odd fields option for this image.
@type fields_odd: boolean
@ivar antialias: enable or disable the antialias option for this image.
@type antialias: boolean
@ivar bindcode: Texture's bind code (readonly).
@type bindcode: int
"""
"""
The Image object
================
This object gives access to Images in Blender.
@ivar filename: The filename (path) to the image file loaded into this Image
object.
@type filename: string
@ivar size: The [width, height] dimensions of the image (in pixels).
@type size: list
@ivar depth: The pixel depth of the image. [8, 16, 18, 24, 32]
@type depth: int
@ivar xrep: Texture tiling: the number of repetitions in the x (horizontal)
axis. [1, 16].
@ivar yrep: Texture tiling: the number of repetitions in the y (vertical)
axis [1, 16].
@type xrep: int
@type yrep: int
@ivar start: Texture's animation start frame [0, 128].
@type start: int
@ivar end: Texture's animation end frame [0, 128].
@type end: int
@ivar speed: Texture's animation speed [1, 100].
@type speed: int
@ivar packed: True when the Texture is packed (readonly).
@type packed: boolean
@ivar has_data: True when the image has pixel data (readonly).
@type has_data: boolean
@ivar fields: enable or disable the fields option for this image.
@type fields: boolean
@ivar fields_odd: enable or disable the odd fields option for this image.
@type fields_odd: boolean
@ivar antialias: enable or disable the antialias option for this image.
@type antialias: boolean
@ivar bindcode: Texture's bind code (readonly).
@type bindcode: int
"""
def getName():
"""
Get the name of this Image object.
@rtype: string
"""
def getName():
"""
Get the name of this Image object.
@rtype: string
"""
def getFilename():
"""
Get the filename of the image file loaded into this Image object.
@rtype: string
"""
def getFilename():
"""
Get the filename of the image file loaded into this Image object.
@rtype: string
"""
def getSize():
"""
Get the [width, height] dimensions (in pixels) of this image.
@rtype: list of 2 ints
"""
def getSize():
"""
Get the [width, height] dimensions (in pixels) of this image.
@rtype: list of 2 ints
"""
def getDepth():
"""
Get the pixel depth of this image.
@rtype: int
"""
def getDepth():
"""
Get the pixel depth of this image.
@rtype: int
"""
def getPixelF(x, y):
"""
Get the the colors of the current pixel in the form [r,g,b,a].
Returned values are floats normalized to 0.0 - 1.0.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@returns: [ r, g, b, a]
@rtype: list of 4 floats
@type x: int
@type y: int
@param x: the x coordinate of pixel.
@param y: the y coordinate of pixel.
"""
def getPixelI(x, y):
"""
Get the the colors of the current pixel in the form [r,g,b,a].
Returned values are ints normalized to 0 - 255.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@returns: [ r, g, b, a]
@rtype: list of 4 ints
@type x: int
@type y: int
@param x: the x coordinate of pixel.
@param y: the y coordinate of pixel.
"""
def getPixelF(x, y):
"""
Get the the colors of the current pixel in the form [r,g,b,a].
Returned values are floats normalized to 0.0 - 1.0.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@returns: [ r, g, b, a]
@rtype: list of 4 floats
@type x: int
@type y: int
@param x: the x coordinate of pixel.
@param y: the y coordinate of pixel.
"""
def getPixelI(x, y):
"""
Get the the colors of the current pixel in the form [r,g,b,a].
Returned values are ints normalized to 0 - 255.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@returns: [ r, g, b, a]
@rtype: list of 4 ints
@type x: int
@type y: int
@param x: the x coordinate of pixel.
@param y: the y coordinate of pixel.
"""
def getMaxXY():
"""
Get the x & y size for the image. Image coordinates range from 0 to size-1.
@returns: [x, y]
@rtype: list of 2 ints
"""
def getMaxXY():
"""
Get the x & y size for the image. Image coordinates range from 0 to size-1.
@returns: [x, y]
@rtype: list of 2 ints
"""
def getMinXY():
"""
Get the x & y origin for the image. Image coordinates range from 0 to size-1.
@returns: [x, y]
@rtype: list of 2 ints
"""
def getMinXY():
"""
Get the x & y origin for the image. Image coordinates range from 0 to size-1.
@returns: [x, y]
@rtype: list of 2 ints
"""
def getXRep():
"""
Get the number of repetitions in the x (horizontal) axis for this Image.
This is for texture tiling.
@rtype: int
"""
def getXRep():
"""
Get the number of repetitions in the x (horizontal) axis for this Image.
This is for texture tiling.
@rtype: int
"""
def getYRep():
"""
Get the number of repetitions in the y (vertical) axis for this Image.
This is for texture tiling.
@rtype: int
"""
def getYRep():
"""
Get the number of repetitions in the y (vertical) axis for this Image.
This is for texture tiling.
@rtype: int
"""
def getBindCode():
"""
Get the Image's bindcode. This is for texture loading using BGL calls.
See, for example, L{BGL.glBindTexture} and L{glLoad}.
@rtype: int
"""
def getBindCode():
"""
Get the Image's bindcode. This is for texture loading using BGL calls.
See, for example, L{BGL.glBindTexture} and L{glLoad}.
@rtype: int
"""
def getStart():
"""
Get the Image's start frame. Used for animated textures.
@rtype: int
"""
def getStart():
"""
Get the Image's start frame. Used for animated textures.
@rtype: int
"""
def getEnd():
"""
Get the Image's end frame. Used for animated textures.
@rtype: int
"""
def getEnd():
"""
Get the Image's end frame. Used for animated textures.
@rtype: int
"""
def getSpeed():
"""
Get the Image's speed (fps). Used for animated textures.
@rtype: int
"""
def getSpeed():
"""
Get the Image's speed (fps). Used for animated textures.
@rtype: int
"""
def reload():
"""
Reloads this image from the filesystem. If used within a loop you need to
redraw the Window to see the change in the image, e.g. with
Window.RedrawAll().
@warn: if the image file is corrupt or still being written, it will be
replaced by a blank image in Blender, but no error will be returned.
@returns: None
"""
def reload():
"""
Reloads this image from the filesystem. If used within a loop you need to
redraw the Window to see the change in the image, e.g. with
Window.RedrawAll().
@warn: if the image file is corrupt or still being written, it will be
replaced by a blank image in Blender, but no error will be returned.
@returns: None
"""
def glLoad():
"""
Load this image's data into OpenGL texture memory, if it is not already
loaded (image.bindcode is 0 if it is not loaded yet).
@note: Usually you don't need to call this method. It is only necessary
if you want to draw textured objects in the Scripts window and the
image's bind code is zero at that moment, otherwise Blender itself can
take care of binding / unbinding textures. Calling this method for an
image with nonzero bind code simply returns the image's bind code value
(see L{getBindCode}).
@rtype: int
@returns: the texture's bind code.
"""
def glLoad():
"""
Load this image's data into OpenGL texture memory, if it is not already
loaded (image.bindcode is 0 if it is not loaded yet).
@note: Usually you don't need to call this method. It is only necessary
if you want to draw textured objects in the Scripts window and the
image's bind code is zero at that moment, otherwise Blender itself can
take care of binding / unbinding textures. Calling this method for an
image with nonzero bind code simply returns the image's bind code value
(see L{getBindCode}).
@rtype: int
@returns: the texture's bind code.
"""
def glFree():
"""
Delete this image's data from OpenGL texture memory, only (the image itself
is not removed from Blender's memory). Internally, glDeleteTextures (see
L{BGL.glDeleteTextures}) is used, but this method also updates Blender's
Image object so that its bind code is set to 0. See also L{Image.glLoad},
L{Image.getBindCode}.
"""
def glFree():
"""
Delete this image's data from OpenGL texture memory, only (the image itself
is not removed from Blender's memory). Internally, glDeleteTextures (see
L{BGL.glDeleteTextures}) is used, but this method also updates Blender's
Image object so that its bind code is set to 0. See also L{Image.glLoad},
L{Image.getBindCode}.
"""
def setName(name):
"""
Set the name of this Image object.
@type name: string
@param name: The new name.
"""
def setName(name):
"""
Set the name of this Image object.
@type name: string
@param name: The new name.
"""
def setFilename(name):
"""
Change the filename of this Image object.
@type name: string
@param name: The new full filename.
@warn: use this with caution and note that the filename is truncated if
larger than 160 characters.
"""
def setFilename(name):
"""
Change the filename of this Image object.
@type name: string
@param name: The new full filename.
@warn: use this with caution and note that the filename is truncated if
larger than 160 characters.
"""
def setXRep(xrep):
"""
Texture tiling: set the number of x repetitions for this Image.
@type xrep: int
@param xrep: The new value in [1, 16].
"""
def setXRep(xrep):
"""
Texture tiling: set the number of x repetitions for this Image.
@type xrep: int
@param xrep: The new value in [1, 16].
"""
def setYRep(yrep):
"""
Texture tiling: set the number of y repetitions for this Image.
@type yrep: int
@param yrep: The new value in [1, 16].
"""
def setYRep(yrep):
"""
Texture tiling: set the number of y repetitions for this Image.
@type yrep: int
@param yrep: The new value in [1, 16].
"""
def setStart(start):
"""
Get the Image's start frame. Used for animated textures.
@type start: int
@param start: The new value in [0, 128].
"""
def setStart(start):
"""
Get the Image's start frame. Used for animated textures.
@type start: int
@param start: The new value in [0, 128].
"""
def setEnd(end):
"""
Set the Image's end frame. Used for animated textures.
@type end: int
@param end: The new value in [0, 128].
"""
def setEnd(end):
"""
Set the Image's end frame. Used for animated textures.
@type end: int
@param end: The new value in [0, 128].
"""
def setSpeed(speed):
"""
Set the Image's speed (fps). Used for animated textures.
@type speed: int
@param speed: The new value in [1, 100].
"""
def setSpeed(speed):
"""
Set the Image's speed (fps). Used for animated textures.
@type speed: int
@param speed: The new value in [1, 100].
"""
def setPixelF(x, y, (r, g, b,a )):
"""
Set the the colors of the current pixel in the form [r,g,b,a].
Color values must be floats in the range 0.0 - 1.0.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@type x: int
@type y: int
@type r: float
@type g: float
@type b: float
@type a: float
@returns: nothing
@rtype: none
"""
def setPixelI(x, y, (r, g, b, a)):
"""
Set the the colors of the current pixel in the form [r,g,b,a].
Color values must be ints in the range 0 - 255.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@type x: int
@type y: int
@type r: int
@type g: int
@type b: int
@type a: int
@returns: nothing
@rtype: none
"""
def save():
"""
Saves the current image.
@returns: nothing
@rtype: none
"""
def pack():
"""
Packs the image into the current blend file.
@note: An error will be raised if the image is already packed or the filename path does not exist.
@returns: nothing
@rtype: none
"""
def setPixelF(x, y, (r, g, b,a )):
"""
Set the the colors of the current pixel in the form [r,g,b,a].
Color values must be floats in the range 0.0 - 1.0.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@type x: int
@type y: int
@type r: float
@type g: float
@type b: float
@type a: float
@returns: nothing
@rtype: none
"""
def setPixelI(x, y, (r, g, b, a)):
"""
Set the the colors of the current pixel in the form [r,g,b,a].
Color values must be ints in the range 0 - 255.
Pixel coordinates are in the range from 0 to N-1. See L{getMaxXY}
@type x: int
@type y: int
@type r: int
@type g: int
@type b: int
@type a: int
@returns: nothing
@rtype: none
"""
def save():
"""
Saves the current image.
@returns: nothing
@rtype: none
"""
def pack():
"""
Packs the image into the current blend file.
@note: An error will be raised if the image is already packed or the filename path does not exist.
@returns: nothing
@rtype: none
"""
def unpack(mode):
"""
Unpacks the image to the images filename.
@param mode: One of the values in Blender.Unpackmodes dict.
@note: An error will be raised if the image is not packed or the filename path does not exist.
@returns: nothing
@rtype: none
@type mode: int
"""
def makeCurrent():
"""
Set the currently displayed Image from Blenders UV/Image window.
When multiple images are displayed, the last active UV/Image windows image is used.
@rtype: bool
@return: True if the current image could be set, if no window was available, return False.
"""
def unpack(mode):
"""
Unpacks the image to the images filename.
@param mode: One of the values in Blender.Unpackmodes dict.
@note: An error will be raised if the image is not packed or the filename path does not exist.
@returns: nothing
@rtype: none
@type mode: int
"""
def makeCurrent():
"""
Set the currently displayed Image from Blenders UV/Image window.
When multiple images are displayed, the last active UV/Image windows image is used.
@rtype: bool
@return: True if the current image could be set, if no window was available, return False.
"""
import id_generics
Image.__doc__ += id_generics.attributes

View File

@@ -4,62 +4,62 @@
The Blender.Ipo submodule
B{New}:
- Ipo updates to both the program and Bpython access.
- access to Blender's new Ipo driver capabilities.
- Ipo now supports the mapping operator [] to access IpoCurves
- Ipo updates to both the program and Bpython access.
- access to Blender's new Ipo driver capabilities.
- Ipo now supports the mapping operator [] to access IpoCurves
This module provides access to the Ipo Data in Blender. An Ipo is composed of
several IpoCurves, and an IpoCurve is composed of several BezTriples.
Example::
from Blender import Ipo
from Blender import Ipo
ob = Ipo.Get('ObIpo') # retrieves an Ipo object
ob.name = 'ipo1' # change the Ipo's name
icu = ipo[Ipo.OB_LOCX] # request X Location Ipo curve object
if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
val = icu[2.5] # get the curve's value at time 2.5
icu[Ipo.OB_LOCX] = None # delete the ipo curve
ob = Ipo.Get('ObIpo') # retrieves an Ipo object
ob.name = 'ipo1' # change the Ipo's name
icu = ipo[Ipo.OB_LOCX] # request X Location Ipo curve object
if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
val = icu[2.5] # get the curve's value at time 2.5
icu[Ipo.OB_LOCX] = None # delete the ipo curve
Each type of Ipo has different types Ipocurves. With the exception of Shape
Key Ipos, constants are used to specify all Ipocurves. There are two ways
to tell which Ipo curves go with which Ipo type:
- all constants start with a two-character identifier for their Ipo type;
for example, "OB_LOCX" is the LocX curve for an Object Ipo
- each Ipo now has a read-only attribute L{Ipo.curveConsts}, which returns
the valid Ipo curve types for that specific Ipo
- all constants start with a two-character identifier for their Ipo type;
for example, "OB_LOCX" is the LocX curve for an Object Ipo
- each Ipo now has a read-only attribute L{Ipo.curveConsts}, which returns
the valid Ipo curve types for that specific Ipo
The valid IpoCurve constants are:
1. Material Ipo: MA_R, MA_G, MA_B, MA_SPECR, MA_SPECG, MA_SPECB,
MA_MIRR, MA_MIRG, MA_MIRB, MA_REF, MA_ALPHA, MA_EMIT, MA_AMB,
MA_SPEC, MA_HARD, MA_SPTRA, MA_IOR, MA_MODE, MA_HASIZE, MA_TRANSLU,
MA_RAYMIR, MA_FRESMIR, MA_FRESMIRI, MA_FRESTRA, MA_FRESTRAI,
MA_TRAGLOW, MA_OFSX, MA_OFSY, MA_OFSZ, MA_SIZEX, MA_SIZEY, MA_SIZEZ,
MA_TEXR, MA_TEXG, MA_TEXB, MA_DEFVAR, MA_COL, MA_NOR, MA_VAR, MA_DISP
2. Lamp Ipo: LA_ENERG, LA_R, LA_G, LA_B, LA_DIST, LA_SPOSI, LA_SPOBL,
LA_QUAD1, LA_QUAD2, LA_HAINT, LA_OFSX, LA_OFSY, LA_OFSZ, LA_SIZEX,
LA_SIZEY, LA_SIZEZ, LA_TEXR, LA_TEXG, LA_TEXB, LA_DEFVAR, LA_COL
3. World Ipo: WO_HORR, WO_HORG, WO_HORB, WO_ZENR, WO_ZENG, WO_ZENB,
WO_EXPOS, WO_MISI, WO_MISDI, WO_MISSTA, WO_MISHI, WO_STARR,
WO_STARB, WO_STARG, WO_STARDI, WO_STARSI, WO_OFSX, WO_OFSY,
WO_OFSZ, WO_SIZEX, WO_SIZEY, WO_SIZEZ, WO_TEXR, WO_TEXG,
WO_TEXB, WO_DEFVAR, WO_COL, WO_NOR, WO_VAR
4. Camera Ipo: CA_LENS, CA_CLSTA, CA_CLEND, CA_APERT, CA_FDIST
5. Object Ipo: OB_LOCX, OB_LOCY, OB_LOCZ, OB_DLOCX, OB_DLOCY, OB_DLOCZ,
OB_ROTX, OB_ROTY, OB_ROTZ, OB_DROTX, OB_DROTY, OB_DROTZ,
OB_SIZEX, OB_SIZEY, OB_SIZEZ, OB_DSIZEX, OB_DSIZEY, OB_DSIZEZ,
OB_LAYER, OB_TIME, OB_COLR, OB_COLG, OB_COLB, OB_COLA,
OB_FSTRENG, OB_FFALL, OB_RDAMP, OB_DAMPING, OB_PERM
6. Curve Ipo: CU_SPEED
7. Constraint Ipo: CO_INF
8. Texture Ipo: TE_NSIZE, TE_NDEPTH, TE_NTYPE, TE_TURB, TE_VNW1, TE_VNW2,
TE_VNW3, TE_VNW4, TE_MINKMEXP, TE_DISTM, TE_COLT, TE_ISCALE,
TE_DISTA, TE_MGTYPE, TE_MGH, TE_LACU, TE_OCT, TE_MGOFF,
TE_MGGAIN, TE_NBASE1, TE_NBASE2, TE_COLR, TE_COLG, TE_COLB,
TE_BRIGHT, TE_CONTRAS
9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SIZEX, PO_SIZEY,
PO_SIZEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ
10. Sequence Ipo: SQ_FAC
1. Material Ipo: MA_R, MA_G, MA_B, MA_SPECR, MA_SPECG, MA_SPECB,
MA_MIRR, MA_MIRG, MA_MIRB, MA_REF, MA_ALPHA, MA_EMIT, MA_AMB,
MA_SPEC, MA_HARD, MA_SPTRA, MA_IOR, MA_MODE, MA_HASIZE, MA_TRANSLU,
MA_RAYMIR, MA_FRESMIR, MA_FRESMIRI, MA_FRESTRA, MA_FRESTRAI,
MA_TRAGLOW, MA_OFSX, MA_OFSY, MA_OFSZ, MA_SIZEX, MA_SIZEY, MA_SIZEZ,
MA_TEXR, MA_TEXG, MA_TEXB, MA_DEFVAR, MA_COL, MA_NOR, MA_VAR, MA_DISP
2. Lamp Ipo: LA_ENERG, LA_R, LA_G, LA_B, LA_DIST, LA_SPOSI, LA_SPOBL,
LA_QUAD1, LA_QUAD2, LA_HAINT, LA_OFSX, LA_OFSY, LA_OFSZ, LA_SIZEX,
LA_SIZEY, LA_SIZEZ, LA_TEXR, LA_TEXG, LA_TEXB, LA_DEFVAR, LA_COL
3. World Ipo: WO_HORR, WO_HORG, WO_HORB, WO_ZENR, WO_ZENG, WO_ZENB,
WO_EXPOS, WO_MISI, WO_MISDI, WO_MISSTA, WO_MISHI, WO_STARR,
WO_STARB, WO_STARG, WO_STARDI, WO_STARSI, WO_OFSX, WO_OFSY,
WO_OFSZ, WO_SIZEX, WO_SIZEY, WO_SIZEZ, WO_TEXR, WO_TEXG,
WO_TEXB, WO_DEFVAR, WO_COL, WO_NOR, WO_VAR
4. Camera Ipo: CA_LENS, CA_CLSTA, CA_CLEND, CA_APERT, CA_FDIST
5. Object Ipo: OB_LOCX, OB_LOCY, OB_LOCZ, OB_DLOCX, OB_DLOCY, OB_DLOCZ,
OB_ROTX, OB_ROTY, OB_ROTZ, OB_DROTX, OB_DROTY, OB_DROTZ,
OB_SIZEX, OB_SIZEY, OB_SIZEZ, OB_DSIZEX, OB_DSIZEY, OB_DSIZEZ,
OB_LAYER, OB_TIME, OB_COLR, OB_COLG, OB_COLB, OB_COLA,
OB_FSTRENG, OB_FFALL, OB_RDAMP, OB_DAMPING, OB_PERM
6. Curve Ipo: CU_SPEED
7. Constraint Ipo: CO_INF
8. Texture Ipo: TE_NSIZE, TE_NDEPTH, TE_NTYPE, TE_TURB, TE_VNW1, TE_VNW2,
TE_VNW3, TE_VNW4, TE_MINKMEXP, TE_DISTM, TE_COLT, TE_ISCALE,
TE_DISTA, TE_MGTYPE, TE_MGH, TE_LACU, TE_OCT, TE_MGOFF,
TE_MGGAIN, TE_NBASE1, TE_NBASE2, TE_COLR, TE_COLG, TE_COLB,
TE_BRIGHT, TE_CONTRAS
9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SIZEX, PO_SIZEY,
PO_SIZEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ
10. Sequence Ipo: SQ_FAC
Shape Key Ipos are handled differently from other Ipos. The user can rename
the curves, so string are used to access them instead of constants. The
@@ -68,371 +68,370 @@ key names.
"""
def New (type, name):
"""
Creates a new Ipo.
@type type: string
@type name: string
@param type: The Ipo's blocktype. Depends on the object the Ipo will be
linked to. Currently supported types are Object, Camera, World,
Material, Texture, Lamp, Action, Constraint, Sequence, Curve, Key.
@param name: The name for this Ipo.
@rtype: Blender Ipo
@return: The created Ipo.
"""
"""
Creates a new Ipo.
@type type: string
@type name: string
@param type: The Ipo's blocktype. Depends on the object the Ipo will be
linked to. Currently supported types are Object, Camera, World,
Material, Texture, Lamp, Action, Constraint, Sequence, Curve, Key.
@param name: The name for this Ipo.
@rtype: Blender Ipo
@return: The created Ipo.
"""
def Get (name = None):
"""
Get the Ipo from Blender.
@type name: string
@param name: The name of the requested Ipo, or nothing.
@rtype: Blender Ipo or a list of Blender Ipos
@return: It depends on the 'name' parameter:
- (name): The Ipo with the given name;
- (): A list with all Ipos in the current scene.
"""
"""
Get the Ipo from Blender.
@type name: string
@param name: The name of the requested Ipo, or nothing.
@rtype: Blender Ipo or a list of Blender Ipos
@return: It depends on the 'name' parameter:
- (name): The Ipo with the given name;
- (): A list with all Ipos in the current scene.
"""
class Ipo:
"""
The Ipo object
==============
This object gives access to Ipo data from all objects in Blender.
@Note: Blender Materials, Lamps and Worlds have I{texture channels} which
allow the user to assign textures to them. The Blender Ipo Window allows
the user to access the IpoCurves for these channels by specifying a number
between 0 and 9 (the number appears next to the Ipo type in the window
header). Prior to Version 2.42, the BPy API did not allow users to access
these texture channels in a predictable manner. A new attribute named
L{channel} was added to the API in Version 2.42 to correct this problem.
"""
The Ipo object
==============
This object gives access to Ipo data from all objects in Blender.
@Note: Blender Materials, Lamps and Worlds have I{texture channels} which
allow the user to assign textures to them. The Blender Ipo Window allows
the user to access the IpoCurves for these channels by specifying a number
between 0 and 9 (the number appears next to the Ipo type in the window
header). Prior to Version 2.42, the BPy API did not allow users to access
these texture channels in a predictable manner. A new attribute named
L{channel} was added to the API in Version 2.42 to correct this problem.
The current channel setting has an effect on the operators B{[]}, B{len()}
and others. For example, suppose a Material has three IpoCurves
(R, G, and B), and two texture channels (numbered 0 and 1), and furthermore
channel 0 has one Ipocurve (Col). The IpoCurve Col can only be
"seen" through the API when B{ipo.channel} is 0. Setting B{ipo.channel} to
1 will cause this curve to be ignored by B{len(ipo)}::
The current channel setting has an effect on the operators B{[]}, B{len()}
and others. For example, suppose a Material has three IpoCurves
(R, G, and B), and two texture channels (numbered 0 and 1), and furthermore
channel 0 has one Ipocurve (Col). The IpoCurve Col can only be
"seen" through the API when B{ipo.channel} is 0. Setting B{ipo.channel} to
1 will cause this curve to be ignored by B{len(ipo)}::
from Blender import Ipo
from Blender import Ipo
ipo = Ipo.Get('MatIpo')
for channel in xrange(2):
ipo.channel = channel
print 'channel is',channel
print ' len is',len(ipo)
names = dict([(x[1],x[0]) for x in ipo.curveConsts.items()])
for curve in [Ipo.MA_R,Ipo.MA_COL]:
print ' ',names[curve],'is',curve in ipo
ipo = Ipo.Get('MatIpo')
for channel in xrange(2):
ipo.channel = channel
print 'channel is',channel
print ' len is',len(ipo)
names = dict([(x[1],x[0]) for x in ipo.curveConsts.items()])
for curve in [Ipo.MA_R,Ipo.MA_COL]:
print ' ',names[curve],'is',curve in ipo
will output::
channel is 0
len is 4
MA_R is True
MA_COL is True
channel is 1
len is 3
MA_R is True
MA_COL is False
will output::
channel is 0
len is 4
MA_R is True
MA_COL is True
channel is 1
len is 3
MA_R is True
MA_COL is False
@ivar name: The Ipo datablock's name
@type name: string
@ivar curves: Ipo curves currently defined for the Ipo.
@type curves: list of Ipocurves.
@ivar curveConsts: The valid Ipo curves for this Ipo. These can be used
by the [] mapping operator. The value
depends on the Ipo curve type. If the Ipo is any type other than a Key or
Shape Ipo, this attribute returns a set of constants that can be
used to specify a particular curve. For Key or Shape Ipos, the attribute
returns a list of all defined keys by name.
@type curveConsts: constant or list of strings. Read-only.
@ivar channel: the current texture channel for Blender object which support
textures (materials, lamps and worlds). Returns None if the Ipo does
not support texture channels. Value must be in the range [0,9].
@type channel: int or None
"""
@ivar curves: Ipo curves currently defined for the Ipo.
@type curves: list of Ipocurves.
@ivar curveConsts: The valid Ipo curves for this Ipo. These can be used
by the [] mapping operator. The value
depends on the Ipo curve type. If the Ipo is any type other than a Key or
Shape Ipo, this attribute returns a set of constants that can be
used to specify a particular curve. For Key or Shape Ipos, the attribute
returns a list of all defined keys by name.
@type curveConsts: constant or list of strings. Read-only.
@ivar channel: the current texture channel for Blender object which support
textures (materials, lamps and worlds). Returns None if the Ipo does
not support texture channels. Value must be in the range [0,9].
@type channel: int or None
"""
def __contains__():
"""
The "in" operator for Ipos. It returns B{True} if the specified
IpoCurve exists for the Ipo. This operator B{should not} be used to
test for whether a curve constant is valid for a particular Ipo type.
Many constants for different Ipo types have the same value, and it is
the constant's value used internally.
No exceptions are raised if the argument is not a valid curve constant or
or string, nor does the operator return B{True} when the curve
constant is valid but does not currently exist. As such, it should only be
used to test for specific curves when the Ipo type is known::
ipo = Object.Get('Cube').ipo # get Object-type Ipo
if ipo:
print Ipo.OB_LOCX in ipo # prints "True" if 'LocX' curve exists
print Ipo.MA_R in ipo # also prints "True" since MA_R and OB_LOCX are have the same value
print 'hiccup' in ipo # always prints "False" since argument is not a constant
def __contains__():
"""
The "in" operator for Ipos. It returns B{True} if the specified
IpoCurve exists for the Ipo. This operator B{should not} be used to
test for whether a curve constant is valid for a particular Ipo type.
Many constants for different Ipo types have the same value, and it is
the constant's value used internally.
No exceptions are raised if the argument is not a valid curve constant or
or string, nor does the operator return B{True} when the curve
constant is valid but does not currently exist. As such, it should only be
used to test for specific curves when the Ipo type is known::
ipo = Object.Get('Cube').ipo # get Object-type Ipo
if ipo:
print Ipo.OB_LOCX in ipo # prints "True" if 'LocX' curve exists
print Ipo.MA_R in ipo # also prints "True" since MA_R and OB_LOCX are have the same value
print 'hiccup' in ipo # always prints "False" since argument is not a constant
@return: see above.
@rtype: Boolean
"""
@return: see above.
@rtype: Boolean
"""
def __getitem__():
"""
This operator is similar to the Python dictionary mapping operator [],
except that the user cannot assign arbitrary keys. Each Ipo type has
a pre-defined set of IpoCurves which may or may not exist at a given time. This operator
will either return an IpoCurve object if the specified curve exists,
return None if the curve does not exists, or throws a KeyError exception
if the curve is not valid for this Ipo type.
@return: an IpoCurve object if it exists
@rtype: IpoCurve or None
@raise KeyError: an undefined IpoCurve was specified for the Ipo
"""
def __getitem__():
"""
This operator is similar to the Python dictionary mapping operator [],
except that the user cannot assign arbitrary keys. Each Ipo type has
a pre-defined set of IpoCurves which may or may not exist at a given time. This operator
will either return an IpoCurve object if the specified curve exists,
return None if the curve does not exists, or throws a KeyError exception
if the curve is not valid for this Ipo type.
@return: an IpoCurve object if it exists
@rtype: IpoCurve or None
@raise KeyError: an undefined IpoCurve was specified for the Ipo
"""
def __iter__():
"""
Iterator for Ipos. It returns all the defined IpoCurve objects associated
with the Ipo. For example::
from Blender import Ipo
def __iter__():
"""
Iterator for Ipos. It returns all the defined IpoCurve objects associated
with the Ipo. For example::
from Blender import Ipo
ipo = Ipo.Get()
if len(ipo) > 0:
ipo = ipo[0]
print 'ipo name is',ipo.name
for icu in ipo:
print ' curve name is',icu.name
might result in::
ipo name is ObIpo
curve name is LocX
curve name is LocY
curve name is LocZ
ipo = Ipo.Get()
if len(ipo) > 0:
ipo = ipo[0]
print 'ipo name is',ipo.name
for icu in ipo:
print ' curve name is',icu.name
might result in::
ipo name is ObIpo
curve name is LocX
curve name is LocY
curve name is LocZ
@return: an IpoCurve object
@rtype: IpoCurve
"""
@return: an IpoCurve object
@rtype: IpoCurve
"""
def __len__():
"""
Returns the number of curves defined for the Ipo.
@return: number of defined IpoCurves
@rtype: int
"""
def __len__():
"""
Returns the number of curves defined for the Ipo.
@return: number of defined IpoCurves
@rtype: int
"""
def getName():
"""
Gets the name of the Ipo (B{deprecated}). See the L{name} attribute.
@rtype: string
@return: the name of the Ipo.
"""
def getName():
"""
Gets the name of the Ipo (B{deprecated}). See the L{name} attribute.
@rtype: string
@return: the name of the Ipo.
"""
def setName(newname):
"""
Sets the name of the Ipo (B{deprecated}). See the L{name} attribute.
@type newname: string
@rtype: None
@return: None
"""
def setName(newname):
"""
Sets the name of the Ipo (B{deprecated}). See the L{name} attribute.
@type newname: string
@rtype: None
@return: None
"""
def getCurves():
"""
Gets all the IpoCurves of the Ipo (B{deprecated}). Use the
L{iterator operator []<__iter__>} instead.
@rtype: list of IpoCurves
@return: A list (possibly empty) containing all the IpoCurves associated
to the Ipo object.
"""
def getCurves():
"""
Gets all the IpoCurves of the Ipo (B{deprecated}). Use the
L{iterator operator []<__iter__>} instead.
@rtype: list of IpoCurves
@return: A list (possibly empty) containing all the IpoCurves associated
to the Ipo object.
"""
def getCurve(curve):
"""
Return the specified IpoCurve (B{deprecated}). Use the L{mapping
operator B{[]}<__getitem__>} instead.
If the curve does not exist in the Ipo,
None is returned. I{curve} can be either a string or an integer,
denoting either the name of the Ipo curve or its internal adrcode.
The possible Ipo curve names are:
1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
Disp.
3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
RDamp, Perm.
4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGain, NBase1, NBase2.
7. Curve Ipo: Speed.
8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
QuatZ, QuatW.
9. Sequence Ipo: Fac.
10. Constraint Ipo: Inf.
def getCurve(curve):
"""
Return the specified IpoCurve (B{deprecated}). Use the L{mapping
operator B{[]}<__getitem__>} instead.
If the curve does not exist in the Ipo,
None is returned. I{curve} can be either a string or an integer,
denoting either the name of the Ipo curve or its internal adrcode.
The possible Ipo curve names are:
1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
Disp.
3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
RDamp, Perm.
4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGain, NBase1, NBase2.
7. Curve Ipo: Speed.
8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
QuatZ, QuatW.
9. Sequence Ipo: Fac.
10. Constraint Ipo: Inf.
The adrcode for the Ipo curve can also be given; this is useful for
accessing curves for Shape Key Ipos. The adrcodes for Shape Key Ipo are
numbered consecutively starting at 0.
@type curve : string or int
@rtype: IpoCurve object
@return: the corresponding IpoCurve, or None.
@raise ValueError: I{curve} is not a valid name or adrcode for this Ipo
type.
"""
The adrcode for the Ipo curve can also be given; this is useful for
accessing curves for Shape Key Ipos. The adrcodes for Shape Key Ipo are
numbered consecutively starting at 0.
@type curve : string or int
@rtype: IpoCurve object
@return: the corresponding IpoCurve, or None.
@raise ValueError: I{curve} is not a valid name or adrcode for this Ipo
type.
"""
def addCurve(curvename):
"""
Add a new curve to the Ipo object. The possible values for I{curvename} are:
1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
Disp.
3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
RDamp, Perm.
4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGain, NBase1, NBase2.
7. Curve Ipo: Speed.
8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
QuatZ, QuatW.
9. Sequence Ipo: Fac.
10. Constraint Ipo: Inf.
def addCurve(curvename):
"""
Add a new curve to the Ipo object. The possible values for I{curvename} are:
1. Camera Ipo: Lens, ClSta, ClEnd, Apert, FDist.
2. Material Ipo: R, G, B, SpecR, SpecG, SpecB, MirR, MirG, MirB, Ref,
Alpha, Emit, Amb, Spec, Hard, SpTra, Ior, Mode, HaSize, Translu,
RayMir, FresMir, FresMirI, FresTra, FresTraI, TraGlow, OfsX, OfsY,
OfsZ, SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var,
Disp.
3. Object Ipo: LocX, LocY, LocZ, dLocX, dLocY, dLocZ, RotX, RotY, RotZ,
dRotX, dRotY, dRotZ, SizeX, SizeY, SizeZ, dSizeX, dSizeY, dSizeZ,
Layer, Time, ColR, ColG, ColB, ColA, FStreng, FFall, Damping,
RDamp, Perm.
4. Lamp Ipo: Energ, R, G, B, Dist, SpoSi, SpoBl, Quad1, Quad2, HaInt.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StaR, StaG, StaB, StarDi, StarSi, OfsX, OfsY, OfsZ,
SizeX, SizeY, SizeZ, TexR, TexG, TexB, DefVar, Col, Nor, Var.
5. World Ipo: HorR, HorG, HorB, ZenR, ZenG, ZenB, Expos, Misi, MisDi,
MisSta, MisHi, StarR, StarB, StarG, StarDi, StarSi, OfsX, OfsY, OfsZ,i
SizeX, SizeY, SizeZ, texR, texG, texB, DefVar, Col, Nor, Var.
6. Texture Ipo: NSize, NDepth, NType, Turb, Vnw1, Vnw2, Vnw3, Vnw4,
MinkMExp, DistM, ColT, iScale, DistA, MgType, MgH, Lacu, Oct,
MgOff, MgGain, NBase1, NBase2.
7. Curve Ipo: Speed.
8. Action Ipo: LocX, LocY, LocZ, SizeX, SizeY, SizeZ, QuatX, QuatY,
QuatZ, QuatW.
9. Sequence Ipo: Fac.
10. Constraint Ipo: Inf.
For Key IPOs, the name must be an existing KeyBlock name. Use
L{curveConsts} to determine the set of valid names.
For Key IPOs, the name must be an existing KeyBlock name. Use
L{curveConsts} to determine the set of valid names.
@type curvename : string
@rtype: IpoCurve object
@return: the corresponding IpoCurve, or None.
@raise ValueError: I{curvename} is not valid or already exists
"""
@type curvename : string
@rtype: IpoCurve object
@return: the corresponding IpoCurve, or None.
@raise ValueError: I{curvename} is not valid or already exists
"""
def delCurve(curvename):
"""
Delete an existing curve from the Ipo object (B{deprecated}).
Use the L{mapping operator B{[]}<__getitem__>} instead::
from Blender import Ipo
def delCurve(curvename):
"""
Delete an existing curve from the Ipo object (B{deprecated}).
Use the L{mapping operator B{[]}<__getitem__>} instead::
from Blender import Ipo
ipo = Ipo.Get('ObIpo')
ipo[Ipo.LOCX] = None
ipo = Ipo.Get('ObIpo')
ipo[Ipo.LOCX] = None
@type curvename : string
@rtype: None
@return: None.
"""
@type curvename : string
@rtype: None
@return: None.
"""
def getBlocktype():
"""
Gets the blocktype of the Ipo.
@rtype: int
@return: the blocktype of the Ipo.
"""
def getBlocktype():
"""
Gets the blocktype of the Ipo.
@rtype: int
@return: the blocktype of the Ipo.
"""
def setBlocktype(newblocktype):
"""
Sets the blocktype of the Ipo.
@type newblocktype: int
@rtype: None
@return: None
@warn: 'newblocktype' should not be changed unless you really know what
you are doing ...
"""
def setBlocktype(newblocktype):
"""
Sets the blocktype of the Ipo.
@type newblocktype: int
@rtype: None
@return: None
@warn: 'newblocktype' should not be changed unless you really know what
you are doing ...
"""
def getRctf():
"""
Gets the rctf of the Ipo.
Kind of bounding box...
@rtype: list of floats
@return: the rctf of the Ipo.
"""
def getRctf():
"""
Gets the rctf of the Ipo.
Kind of bounding box...
@rtype: list of floats
@return: the rctf of the Ipo.
"""
def setRctf(newrctf):
"""
Sets the rctf of the Ipo.
@type newrctf: four floats.
@rtype: None
@return: None
@warn: rctf should not be changed unless you really know what you are
doing ...
"""
def setRctf(newrctf):
"""
Sets the rctf of the Ipo.
@type newrctf: four floats.
@rtype: None
@return: None
@warn: rctf should not be changed unless you really know what you are
doing ...
"""
def getNcurves():
"""
Gets the number of curves of the Ipo (B{deprecated}). Use
L{len(ipo)<__len__>} instead.
@rtype: int
@return: the number of curve of the Ipo.
"""
def getCurveBP(curvepos):
"""
This method is unsupported. BPoint Ipo curves are not implemented.
Calling this method throws a NotImplementedError exception.
@raise NotImplementedError: this method B{always} raises an exception
"""
def getBeztriple(curvepos,pointpos):
"""
Gets a beztriple of the Ipo (B{deprecated}). B{Note}:
Use L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} instead.
@type curvepos: int
@param curvepos: the position of the curve in the Ipo.
@type pointpos: int
@param pointpos: the position of the point in the curve.
@rtype: list of 9 floats
@return: the beztriple of the Ipo, or an error is raised.
"""
def getNcurves():
"""
Gets the number of curves of the Ipo (B{deprecated}). Use
L{len(ipo)<__len__>} instead.
@rtype: int
@return: the number of curve of the Ipo.
"""
def getCurveBP(curvepos):
"""
This method is unsupported. BPoint Ipo curves are not implemented.
Calling this method throws a NotImplementedError exception.
@raise NotImplementedError: this method B{always} raises an exception
"""
def setBeztriple(curvepos,pointpos,newbeztriple):
"""
Sets the beztriple of the Ipo (B{deprecated}). B{Note}: use
L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} to get a
BezTriple point, then use the
L{BezTriple} API to set the point's attributes.
@type curvepos: int
@param curvepos: the position of the curve in the Ipo.
@type pointpos: int
@param pointpos: the position of the point in the curve.
@type newbeztriple: list of 9 floats
@param newbeztriple: the new value for the point
@rtype: None
@return: None
"""
def getCurveCurval(curvepos):
"""
Gets the current value of a curve of the Ipo (B{deprecated}). B{Note}:
new scripts should use L{IpoCurve.evaluate()<IpoCurve.IpoCurve.evaluate>}.
@type curvepos: int or string
@param curvepos: the position of the curve in the Ipo or the name of the
curve
@rtype: float
@return: the current value of the selected curve of the Ipo.
"""
def getBeztriple(curvepos,pointpos):
"""
Gets a beztriple of the Ipo (B{deprecated}). B{Note}:
Use L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} instead.
@type curvepos: int
@param curvepos: the position of the curve in the Ipo.
@type pointpos: int
@param pointpos: the position of the point in the curve.
@rtype: list of 9 floats
@return: the beztriple of the Ipo, or an error is raised.
"""
def EvaluateCurveOn(curvepos,time):
"""
Gets the value at a specific time of a curve of the Ipo (B{deprecated}).
B{Note}: new scripts should use
L{IpoCurve.evaluate()<IpoCurve.IpoCurve.evaluate>}.
@type curvepos: int
@param curvepos: the position of the curve in the Ipo.
@type time: float
@param time: the desired time.
@rtype: float
@return: the current value of the selected curve of the Ipo at the given
time.
"""
def setBeztriple(curvepos,pointpos,newbeztriple):
"""
Sets the beztriple of the Ipo (B{deprecated}). B{Note}: use
L{IpoCurve.bezierPoints<IpoCurve.IpoCurve.bezierPoints>} to get a
BezTriple point, then use the
L{BezTriple} API to set the point's attributes.
@type curvepos: int
@param curvepos: the position of the curve in the Ipo.
@type pointpos: int
@param pointpos: the position of the point in the curve.
@type newbeztriple: list of 9 floats
@param newbeztriple: the new value for the point
@rtype: None
@return: None
"""
def getCurveCurval(curvepos):
"""
Gets the current value of a curve of the Ipo (B{deprecated}). B{Note}:
new scripts should use L{IpoCurve.evaluate()<IpoCurve.IpoCurve.evaluate>}.
@type curvepos: int or string
@param curvepos: the position of the curve in the Ipo or the name of the
curve
@rtype: float
@return: the current value of the selected curve of the Ipo.
"""
def EvaluateCurveOn(curvepos,time):
"""
Gets the value at a specific time of a curve of the Ipo (B{deprecated}).
B{Note}: new scripts should use
L{IpoCurve.evaluate()<IpoCurve.IpoCurve.evaluate>}.
@type curvepos: int
@param curvepos: the position of the curve in the Ipo.
@type time: float
@param time: the desired time.
@rtype: float
@return: the current value of the selected curve of the Ipo at the given
time.
"""
import id_generics
Ipo.__doc__ += id_generics.attributes

View File

@@ -8,97 +8,97 @@ This module provides access to B{Key} objects in Blender.
@type Types: readonly dictionary
@var Types: The type of a key owner, indicating the type of data in the
data blocks.
- MESH - the key is a Mesh key; data blocks contain
L{NMVert<NMesh.NMVert>} vertices.
- CURVE - the key is a Curve key; data blocks contains either
L{BezTriples<BezTriple.BezTriple>} or points (represented by a list of
3 floating point numbers).
- LATTICE - the key is a Lattice key; data blocks contain
BPoints, each point represented by a list of 3 floating point numbers.
- MESH - the key is a Mesh key; data blocks contain
L{NMVert<NMesh.NMVert>} vertices.
- CURVE - the key is a Curve key; data blocks contains either
L{BezTriples<BezTriple.BezTriple>} or points (represented by a list of
3 floating point numbers).
- LATTICE - the key is a Lattice key; data blocks contain
BPoints, each point represented by a list of 3 floating point numbers.
"""
def Get(name = None):
"""
Get the named Key object from Blender. If the name is omitted, it
will retrieve a list of all keys in Blender.
@type name: string
@param name: the name of the requested key
@return: If name was given, return that Key object (or None if not
found). If a name was not given, return a list of every Key object
in Blender.
"""
"""
Get the named Key object from Blender. If the name is omitted, it
will retrieve a list of all keys in Blender.
@type name: string
@param name: the name of the requested key
@return: If name was given, return that Key object (or None if not
found). If a name was not given, return a list of every Key object
in Blender.
"""
class Key:
"""
The Key object
==============
An object with keyframes (L{Lattice}, L{NMesh} or
L{Curve}) will contain a Key object representing the
keyframe data.
@ivar ipo: Key Ipo. Contains the Ipo if one is assigned to the
object, B{None} otherwise. Setting to B{None} clears the current Ipo.
@type ipo: Blender Ipo
@ivar value: The value of the key. Read-only.
@type value: float
@ivar type: An integer from the L{Types} dictionary
representing the Key type. Read-only.
@type type: int
@ivar blocks: A list of KeyBlocks for the key. Read-only.
@type blocks: Blender KeyBlock.
@ivar relative: Indicates whether the key is relative(=True) or normal.
@type relative: bool
"""
"""
The Key object
==============
An object with keyframes (L{Lattice}, L{NMesh} or
L{Curve}) will contain a Key object representing the
keyframe data.
@ivar ipo: Key Ipo. Contains the Ipo if one is assigned to the
object, B{None} otherwise. Setting to B{None} clears the current Ipo.
@type ipo: Blender Ipo
@ivar value: The value of the key. Read-only.
@type value: float
@ivar type: An integer from the L{Types} dictionary
representing the Key type. Read-only.
@type type: int
@ivar blocks: A list of KeyBlocks for the key. Read-only.
@type blocks: Blender KeyBlock.
@ivar relative: Indicates whether the key is relative(=True) or normal.
@type relative: bool
"""
def getIpo():
"""
Get the L{Ipo} object associated with this key.
"""
def getBlocks():
"""
Get a list of L{KeyBlock}s, containing the keyframes defined for
this Key.
"""
def getIpo():
"""
Get the L{Ipo} object associated with this key.
"""
def getBlocks():
"""
Get a list of L{KeyBlock}s, containing the keyframes defined for
this Key.
"""
class KeyBlock:
"""
The KeyBlock object
===================
Each Key object has a list of KeyBlocks attached, each KeyBlock
representing a keyframe.
"""
The KeyBlock object
===================
Each Key object has a list of KeyBlocks attached, each KeyBlock
representing a keyframe.
@ivar curval: Current value of the corresponding IpoCurve. Read-only.
@type curval: float
@ivar name: The name of the Keyblock. Truncated to 32 characters.
@type name: string
@ivar pos: The position of the keyframe.
@type pos: float
@ivar slidermin: The minimum value for the action slider.
Value is clamped to the range [-10.0,10.0].
@type slidermin: float
@ivar slidermax: The maximum value for the action slider.
Value is clamped to the range [-10.0,10.0].
@type slidermax: float
@ivar vgroup: The assigned VGroup for the Key Block.
@type vgroup: string
@ivar data: The data of the KeyBlock (see L{getData}). This
attribute is read-only.
@type data: varies
"""
@ivar curval: Current value of the corresponding IpoCurve. Read-only.
@type curval: float
@ivar name: The name of the Keyblock. Truncated to 32 characters.
@type name: string
@ivar pos: The position of the keyframe.
@type pos: float
@ivar slidermin: The minimum value for the action slider.
Value is clamped to the range [-10.0,10.0].
@type slidermin: float
@ivar slidermax: The maximum value for the action slider.
Value is clamped to the range [-10.0,10.0].
@type slidermax: float
@ivar vgroup: The assigned VGroup for the Key Block.
@type vgroup: string
@ivar data: The data of the KeyBlock (see L{getData}). This
attribute is read-only.
@type data: varies
"""
def getData():
"""
Get the data of a KeyBlock, as a list of data items. Each item
will have a different data type depending on the type of this
Key.
- Mesh keys have a list of L{NMVert<NMesh.NMVert>} objects in the data
block.
- Lattice keys have a list of BPoints in the data block. These
don't have corresponding Python objects yet, so each BPoint is
represented using a list of three floating-point numbers (the
coordinate for each lattice vertex).
- Curve keys return either a list of L{BezTriple<BezTriple.BezTriple>}
objects in the data if the curve is a Bezier curve, otherwise it
returns lists of three floats for each NURB or poly coordinate.
"""
def getData():
"""
Get the data of a KeyBlock, as a list of data items. Each item
will have a different data type depending on the type of this
Key.
- Mesh keys have a list of L{NMVert<NMesh.NMVert>} objects in the data
block.
- Lattice keys have a list of BPoints in the data block. These
don't have corresponding Python objects yet, so each BPoint is
represented using a list of three floating-point numbers (the
coordinate for each lattice vertex).
- Curve keys return either a list of L{BezTriple<BezTriple.BezTriple>}
objects in the data if the curve is a Bezier curve, otherwise it
returns lists of three floats for each NURB or poly coordinate.
"""

View File

@@ -12,511 +12,510 @@ This module provides control over B{Lamp Data} objects in Blender.
Example::
from Blender import Lamp, Scene
l = Lamp.New('Spot') # create new 'Spot' lamp data
l.setMode('Square', 'Shadow') # set these two lamp mode flags
scn = Scene.GetCurrent()
ob = scn.objects.new(l)
from Blender import Lamp, Scene
l = Lamp.New('Spot') # create new 'Spot' lamp data
l.setMode('Square', 'Shadow') # set these two lamp mode flags
scn = Scene.GetCurrent()
ob = scn.objects.new(l)
@type Types: read-only dictionary
@var Types: The lamp types.
- 'Lamp': 0
- 'Sun' : 1
- 'Spot': 2
- 'Hemi': 3
- 'Area': 4
- 'Photon': 5
- 'Lamp': 0
- 'Sun' : 1
- 'Spot': 2
- 'Hemi': 3
- 'Area': 4
- 'Photon': 5
@type Modes: read-only dictionary
@var Modes: The lamp modes. Modes may be ORed together.
- 'Shadows'
- 'Halo'
- 'Layer'
- 'Quad'
- 'Negative'
- 'OnlyShadow'
- 'Sphere'
- 'Square'
- 'NoDiffuse'
- 'NoSpecular'
- 'RayShadow'
- 'Shadows'
- 'Halo'
- 'Layer'
- 'Quad'
- 'Negative'
- 'OnlyShadow'
- 'Sphere'
- 'Square'
- 'NoDiffuse'
- 'NoSpecular'
- 'RayShadow'
Example::
from Blender import Lamp, Object
# Change the mode of selected lamp objects.
for ob in Object.GetSelected(): # Loop through the current selection
if ob.getType() == "Lamp": # if this is a lamp.
lamp = ob.getData() # get the lamp data.
if lamp.type == Lamp.Types["Spot"]: # Lamp type is not a flag
lamp.mode &= ~Lamp.Modes["RayShadow"] # Disable RayShadow.
lamp.mode |= Lamp.Modes["Shadows"] # Enable Shadowbuffer shadows
Example::
from Blender import Lamp, Object
# Change the mode of selected lamp objects.
for ob in Object.GetSelected(): # Loop through the current selection
if ob.getType() == "Lamp": # if this is a lamp.
lamp = ob.getData() # get the lamp data.
if lamp.type == Lamp.Types["Spot"]: # Lamp type is not a flag
lamp.mode &= ~Lamp.Modes["RayShadow"] # Disable RayShadow.
lamp.mode |= Lamp.Modes["Shadows"] # Enable Shadowbuffer shadows
"""
def New (type = 'Lamp', name = 'LampData'):
"""
Create a new Lamp Data object.
@type type: string
@param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'.
@type name: string
@param name: The Lamp Data name.
@rtype: Blender Lamp
@return: The created Lamp Data object.
"""
"""
Create a new Lamp Data object.
@type type: string
@param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'.
@type name: string
@param name: The Lamp Data name.
@rtype: Blender Lamp
@return: The created Lamp Data object.
"""
def Get (name = None):
"""
Get the Lamp Data object(s) from Blender.
@type name: string
@param name: The name of the Lamp Data.
@rtype: Blender Lamp or a list of Blender Lamps
@return: It depends on the I{name} parameter:
- (name): The Lamp Data object with the given I{name};
- (): A list with all Lamp Data objects in the current scene.
"""
"""
Get the Lamp Data object(s) from Blender.
@type name: string
@param name: The name of the Lamp Data.
@rtype: Blender Lamp or a list of Blender Lamps
@return: It depends on the I{name} parameter:
- (name): The Lamp Data object with the given I{name};
- (): A list with all Lamp Data objects in the current scene.
"""
class Lamp:
"""
The Lamp Data object
====================
This object gives access to Lamp-specific data in Blender.
"""
The Lamp Data object
====================
This object gives access to Lamp-specific data in Blender.
@ivar B: Lamp color blue component.
Value is clamped to the range [0.0,1.0].
@type B: float
@ivar G: Lamp color green component.
Value is clamped to the range [0.0,1.0].
@type G: float
@ivar R: Lamp color red component.
Value is clamped to the range [0.0,1.0].
@type R: float
@ivar bias: Lamp shadow map sampling bias.
Value is clamped to the range [0.01,5.0].
@type bias: float
@ivar bufferSize: Lamp shadow buffer size.
Value is clamped to the range [512,5120].
@type bufferSize: int
@ivar clipEnd: Lamp shadow map clip end.
Value is clamped to the range [1.0,5000.0].
@type clipEnd: float
@ivar clipStart: Lamp shadow map clip start.
Value is clamped to the range [0.1,1000.0].
@type clipStart: float
@ivar col: Lamp RGB color triplet.
Components are clamped to the range [0.0,1.0].
@type col: RGB tuple
@ivar dist: Lamp clipping distance.
Value is clamped to the range [0.1,5000.0].
@type dist: float
@ivar energy: Lamp light intensity.
Value is clamped to the range [0.0,10.0].
@type energy: float
@ivar haloInt: Lamp spotlight halo intensity.
Value is clamped to the range [0.0,5.0].
@type haloInt: float
@ivar haloStep: Lamp volumetric halo sampling frequency.
Value is clamped to the range [0,12].
@type haloStep: int
@ivar ipo: Lamp Ipo.
Contains the Ipo if one is assigned to the object, B{None} otherwise. Setting to B{None} clears the current Ipo..
@type ipo: Blender Ipo
@ivar mode: Lamp mode bitfield. See L{Modes} for values.
@type mode: int
@ivar name: Lamp data name.
@type name: str
@ivar quad1: Quad lamp linear distance attenuation.
Value is clamped to the range [0.0,1.0].
@type quad1: float
@ivar quad2: Quad lamp quadratic distance attenuation.
Value is clamped to the range [0.0,1.0].
@type quad2: float
@ivar samples: Lamp shadow map samples.
Value is clamped to the range [1,16].
@type samples: int
@ivar raySamplesX: Lamp raytracing X samples (X is used for the Y axis with square area lamps).
Value is clamped to the range [1,16].
@type raySamplesX: int
@ivar raySamplesY: Lamp raytracing Y samples (Y is only used for rectangle area lamps).
Value is clamped to the range [1,16].
@type raySamplesY: int
@ivar areaSizeX: Lamp X size (X is used for the Y axis with square area lamps)
Value is clamped to the range [0.01,100.0].
@type areaSizeX: float
@ivar areaSizeY: Lamp Y size (Y is only used for rectangle area lamps).
Value is clamped to the range [0.01,100.0].
@type areaSizeY: float
@ivar softness: Lamp shadow sample area size.
Value is clamped to the range [1.0,100.0].
@type softness: float
@ivar spotBlend: Lamp spotlight edge softness.
Value is clamped to the range [0.0,1.0].
@type spotBlend: float
@ivar spotSize: Lamp spotlight beam angle (in degrees).
Value is clamped to the range [1.0,180.0].
@type spotSize: float
@ivar type: Lamp type. See L{Types} for values.
@type type: int
@ivar users: Number of lamp users.
@type users: int
@ivar B: Lamp color blue component.
Value is clamped to the range [0.0,1.0].
@type B: float
@ivar G: Lamp color green component.
Value is clamped to the range [0.0,1.0].
@type G: float
@ivar R: Lamp color red component.
Value is clamped to the range [0.0,1.0].
@type R: float
@ivar bias: Lamp shadow map sampling bias.
Value is clamped to the range [0.01,5.0].
@type bias: float
@ivar bufferSize: Lamp shadow buffer size.
Value is clamped to the range [512,5120].
@type bufferSize: int
@ivar clipEnd: Lamp shadow map clip end.
Value is clamped to the range [1.0,5000.0].
@type clipEnd: float
@ivar clipStart: Lamp shadow map clip start.
Value is clamped to the range [0.1,1000.0].
@type clipStart: float
@ivar col: Lamp RGB color triplet.
Components are clamped to the range [0.0,1.0].
@type col: RGB tuple
@ivar dist: Lamp clipping distance.
Value is clamped to the range [0.1,5000.0].
@type dist: float
@ivar energy: Lamp light intensity.
Value is clamped to the range [0.0,10.0].
@type energy: float
@ivar haloInt: Lamp spotlight halo intensity.
Value is clamped to the range [0.0,5.0].
@type haloInt: float
@ivar haloStep: Lamp volumetric halo sampling frequency.
Value is clamped to the range [0,12].
@type haloStep: int
@ivar ipo: Lamp Ipo.
Contains the Ipo if one is assigned to the object, B{None} otherwise. Setting to B{None} clears the current Ipo..
@type ipo: Blender Ipo
@ivar mode: Lamp mode bitfield. See L{Modes} for values.
@type mode: int
@ivar quad1: Quad lamp linear distance attenuation.
Value is clamped to the range [0.0,1.0].
@type quad1: float
@ivar quad2: Quad lamp quadratic distance attenuation.
Value is clamped to the range [0.0,1.0].
@type quad2: float
@ivar samples: Lamp shadow map samples.
Value is clamped to the range [1,16].
@type samples: int
@ivar raySamplesX: Lamp raytracing X samples (X is used for the Y axis with square area lamps).
Value is clamped to the range [1,16].
@type raySamplesX: int
@ivar raySamplesY: Lamp raytracing Y samples (Y is only used for rectangle area lamps).
Value is clamped to the range [1,16].
@type raySamplesY: int
@ivar areaSizeX: Lamp X size (X is used for the Y axis with square area lamps)
Value is clamped to the range [0.01,100.0].
@type areaSizeX: float
@ivar areaSizeY: Lamp Y size (Y is only used for rectangle area lamps).
Value is clamped to the range [0.01,100.0].
@type areaSizeY: float
@ivar softness: Lamp shadow sample area size.
Value is clamped to the range [1.0,100.0].
@type softness: float
@ivar spotBlend: Lamp spotlight edge softness.
Value is clamped to the range [0.0,1.0].
@type spotBlend: float
@ivar spotSize: Lamp spotlight beam angle (in degrees).
Value is clamped to the range [1.0,180.0].
@type spotSize: float
@ivar type: Lamp type. See L{Types} for values.
@type type: int
@warning: Most member variables assume values in some [Min, Max] interval.
When trying to set them, the given parameter will be clamped to lie in
that range: if val < Min, then val = Min, if val > Max, then val = Max.
"""
@warning: Most member variables assume values in some [Min, Max] interval.
When trying to set them, the given parameter will be clamped to lie in
that range: if val < Min, then val = Min, if val > Max, then val = Max.
"""
def getName():
"""
Get the name of this Lamp Data object.
@rtype: string
"""
def getName():
"""
Get the name of this Lamp Data object.
@rtype: string
"""
def setName(name):
"""
Set the name of this Lamp Data object.
@type name: string
@param name: The new name.
"""
def setName(name):
"""
Set the name of this Lamp Data object.
@type name: string
@param name: The new name.
"""
def getType():
"""
Get this Lamp's type.
@rtype: int
"""
def getType():
"""
Get this Lamp's type.
@rtype: int
"""
def setType(type):
"""
Set this Lamp's type.
@type type: string
@param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'
"""
def setType(type):
"""
Set this Lamp's type.
@type type: string
@param type: The Lamp type: 'Lamp', 'Sun', 'Spot', 'Hemi', 'Area', or 'Photon'
"""
def getMode():
"""
Get this Lamp's mode flags.
@rtype: int
@return: B{OR'ed value}. Use the Modes dictionary to check which flags
are 'on'.
def getMode():
"""
Get this Lamp's mode flags.
@rtype: int
@return: B{OR'ed value}. Use the Modes dictionary to check which flags
are 'on'.
Example::
flags = mylamp.getMode()
if flags & mylamp.Modes['Shadows']:
print "This lamp produces shadows"
else:
print "The 'Shadows' flag is off"
"""
Example::
flags = mylamp.getMode()
if flags & mylamp.Modes['Shadows']:
print "This lamp produces shadows"
else:
print "The 'Shadows' flag is off"
"""
def setMode(m = None, m2 = None, m3 = None, m4 = None,
m5 = None, m6 = None, m7 = None, m8 = None):
"""
Set this Lamp's mode flags. Mode strings given are turned 'on'.
Those not provided are turned 'off', so lamp.setMode() -- without
arguments -- turns off all mode flags for Lamp lamp.
@type m: string
@param m: A mode flag. From 1 to 8 can be set at the same time.
"""
def setMode(m = None, m2 = None, m3 = None, m4 = None,
m5 = None, m6 = None, m7 = None, m8 = None):
"""
Set this Lamp's mode flags. Mode strings given are turned 'on'.
Those not provided are turned 'off', so lamp.setMode() -- without
arguments -- turns off all mode flags for Lamp lamp.
@type m: string
@param m: A mode flag. From 1 to 8 can be set at the same time.
"""
def getSamples():
"""
Get this lamp's samples value.
@rtype: int
"""
def getSamples():
"""
Get this lamp's samples value.
@rtype: int
"""
def setSamples(samples):
"""
Set the samples value.
@type samples: int
@param samples: The new samples value.
"""
def setSamples(samples):
"""
Set the samples value.
@type samples: int
@param samples: The new samples value.
"""
def getRaySamplesX():
"""
Get this lamp's raytracing sample value on the X axis.
This value is only used for area lamps.
@rtype: int
"""
def getRaySamplesX():
"""
Get this lamp's raytracing sample value on the X axis.
This value is only used for area lamps.
@rtype: int
"""
def setRaySamplesX():
"""
Set the lamp's raytracing sample value on the X axis, between 1 and 16.
This value is only used for area lamps.
@rtype: int
"""
def setRaySamplesX():
"""
Set the lamp's raytracing sample value on the X axis, between 1 and 16.
This value is only used for area lamps.
@rtype: int
"""
def getRaySamplesY():
"""
Get this lamp's raytracing sample value on the Y axis.
This value is only used for rectangle area lamps.
@rtype: int
"""
def getRaySamplesY():
"""
Get this lamp's raytracing sample value on the Y axis.
This value is only used for rectangle area lamps.
@rtype: int
"""
def setRaySamplesY():
"""
Set the lamp's raytracing sample value on the Y axis, between 1 and 16.
This value is only used for rectangle area lamps.
@rtype: int
"""
def setRaySamplesY():
"""
Set the lamp's raytracing sample value on the Y axis, between 1 and 16.
This value is only used for rectangle area lamps.
@rtype: int
"""
def getAreaSizeX():
"""
Get this lamp's size on the X axis.
This value is only used for area lamps.
@rtype: int
"""
def getAreaSizeX():
"""
Get this lamp's size on the X axis.
This value is only used for area lamps.
@rtype: int
"""
def setAreaSizeX():
"""
Set this lamp's size on the X axis.
This value is only used for area lamps.
@rtype: int
"""
def setAreaSizeX():
"""
Set this lamp's size on the X axis.
This value is only used for area lamps.
@rtype: int
"""
def getAreaSizeY():
"""
Get this lamp's size on the Y axis.
This value is only used for rectangle area lamps.
@rtype: int
"""
def getAreaSizeY():
"""
Get this lamp's size on the Y axis.
This value is only used for rectangle area lamps.
@rtype: int
"""
def setAreaSizeY():
"""
Set this lamp's size on the Y axis.
This value is only used for rectangle area lamps.
@rtype: int
"""
def setAreaSizeY():
"""
Set this lamp's size on the Y axis.
This value is only used for rectangle area lamps.
@rtype: int
"""
def getBufferSize():
"""
Get this lamp's buffer size.
@rtype: int
"""
def getBufferSize():
"""
Get this lamp's buffer size.
@rtype: int
"""
def setBufferSize(bufsize):
"""
Set the buffer size value.
@type bufsize: int
@param bufsize: The new buffer size value.
"""
def setBufferSize(bufsize):
"""
Set the buffer size value.
@type bufsize: int
@param bufsize: The new buffer size value.
"""
def getHaloStep():
"""
Get this lamp's halo step value.
@rtype: int
"""
def getHaloStep():
"""
Get this lamp's halo step value.
@rtype: int
"""
def setHaloStep(hastep):
"""
Set the halo step value.
@type hastep: int
@param hastep: The new halo step value.
"""
def setHaloStep(hastep):
"""
Set the halo step value.
@type hastep: int
@param hastep: The new halo step value.
"""
def getEnergy():
"""
Get this lamp's energy intensity value.
@rtype: float
"""
def getEnergy():
"""
Get this lamp's energy intensity value.
@rtype: float
"""
def setEnergy(energy):
"""
Set the energy intensity value.
@type energy: float
@param energy: The new energy value.
"""
def setEnergy(energy):
"""
Set the energy intensity value.
@type energy: float
@param energy: The new energy value.
"""
def getDist():
"""
Get this lamp's distance value.
@rtype: float
"""
def getDist():
"""
Get this lamp's distance value.
@rtype: float
"""
def setDist(distance):
"""
Set the distance value.
@type distance: float
@param distance: The new distance value.
"""
def setDist(distance):
"""
Set the distance value.
@type distance: float
@param distance: The new distance value.
"""
def getSpotSize():
"""
Get this lamp's spot size value.
@rtype: float
"""
def getSpotSize():
"""
Get this lamp's spot size value.
@rtype: float
"""
def setSpotSize(spotsize):
"""
Set the spot size value.
@type spotsize: float
@param spotsize: The new spot size value.
"""
def setSpotSize(spotsize):
"""
Set the spot size value.
@type spotsize: float
@param spotsize: The new spot size value.
"""
def getSpotBlend():
"""
Get this lamp's spot blend value.
@rtype: float
"""
def getSpotBlend():
"""
Get this lamp's spot blend value.
@rtype: float
"""
def setSpotBlend(spotblend):
"""
Set the spot blend value.
@type spotblend: float
@param spotblend: The new spot blend value.
"""
def setSpotBlend(spotblend):
"""
Set the spot blend value.
@type spotblend: float
@param spotblend: The new spot blend value.
"""
def getClipStart():
"""
Get this lamp's clip start value.
@rtype: float
"""
def getClipStart():
"""
Get this lamp's clip start value.
@rtype: float
"""
def setClipStart(clipstart):
"""
Set the clip start value.
@type clipstart: float
@param clipstart: The new clip start value.
"""
def setClipStart(clipstart):
"""
Set the clip start value.
@type clipstart: float
@param clipstart: The new clip start value.
"""
def getClipEnd():
"""
Get this lamp's clip end value.
@rtype: float
"""
def getClipEnd():
"""
Get this lamp's clip end value.
@rtype: float
"""
def setClipEnd(clipend):
"""
Set the clip end value.
@type clipend: float
@param clipend: The new clip end value.
"""
def setClipEnd(clipend):
"""
Set the clip end value.
@type clipend: float
@param clipend: The new clip end value.
"""
def getBias():
"""
Get this lamp's bias value.
@rtype: float
"""
def getBias():
"""
Get this lamp's bias value.
@rtype: float
"""
def setBias(bias):
"""
Set the bias value.
@type bias: float
@param bias: The new bias value.
"""
def setBias(bias):
"""
Set the bias value.
@type bias: float
@param bias: The new bias value.
"""
def getSoftness():
"""
Get this lamp's softness value.
@rtype: float
"""
def getSoftness():
"""
Get this lamp's softness value.
@rtype: float
"""
def setSoftness(softness):
"""
Set the softness value.
@type softness: float
@param softness: The new softness value.
"""
def setSoftness(softness):
"""
Set the softness value.
@type softness: float
@param softness: The new softness value.
"""
def getHaloInt():
"""
Get this lamp's halo intensity value.
@rtype: float
"""
def getHaloInt():
"""
Get this lamp's halo intensity value.
@rtype: float
"""
def setHaloInt(haloint):
"""
Set the halo intensity value.
@type haloint: float
@param haloint: The new halo intensity value.
"""
def setHaloInt(haloint):
"""
Set the halo intensity value.
@type haloint: float
@param haloint: The new halo intensity value.
"""
def getQuad1():
"""
Get this lamp's quad 1 value.
@rtype: float
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def getQuad1():
"""
Get this lamp's quad 1 value.
@rtype: float
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def setQuad1(quad1):
"""
Set the quad 1 value.
@type quad1: float
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def setQuad1(quad1):
"""
Set the quad 1 value.
@type quad1: float
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def getQuad2():
"""
Get this lamp's quad 2 value.
@rtype: float
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def getQuad2():
"""
Get this lamp's quad 2 value.
@rtype: float
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def setQuad2(quad2):
"""
Set the quad 2 value.
@type quad2: float
@param quad2: The new quad 2 value.
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def setQuad2(quad2):
"""
Set the quad 2 value.
@type quad2: float
@param quad2: The new quad 2 value.
@warning: this only applies to Lamps with the 'Quad' flag on.
"""
def getScriptLinks (event):
"""
Get a list with this Lamp's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def getScriptLinks (event):
"""
Get a list with this Lamp's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def clearScriptLinks (links = None):
"""
Delete script links from this Lamp. If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def clearScriptLinks (links = None):
"""
Delete script links from this Lamp. If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def addScriptLink (text, event):
"""
Add a new script link to this Lamp.
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
"""
def addScriptLink (text, event):
"""
Add a new script link to this Lamp.
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
"""
def getIpo():
"""
Get the Ipo associated with this Lamp object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def getIpo():
"""
Get the Ipo associated with this Lamp object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def setIpo(ipo):
"""
Link an ipo to this Lamp object.
@type ipo: Blender Ipo
@param ipo: a "lamp data" ipo.
"""
def setIpo(ipo):
"""
Link an ipo to this Lamp object.
@type ipo: Blender Ipo
@param ipo: a "lamp data" ipo.
"""
def clearIpo():
"""
Unlink the ipo from this Lamp object.
@return: True if there was an ipo linked or False otherwise.
"""
def insertIpoKey(keytype):
"""
Inserts keytype values in lamp ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-RGB
-ENERGY
-SPOTSIZE
-OFFSET
-SIZE
@return: py_none
"""
def clearIpo():
"""
Unlink the ipo from this Lamp object.
@return: True if there was an ipo linked or False otherwise.
"""
def insertIpoKey(keytype):
"""
Inserts keytype values in lamp ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-RGB
-ENERGY
-SPOTSIZE
-OFFSET
-SIZE
@return: None
"""
def __copy__ ():
"""
Make a copy of this lamp
@rtype: Lamp
@return: a copy of this lamp
"""
def __copy__ ():
"""
Make a copy of this lamp
@rtype: Lamp
@return: a copy of this lamp
"""
import id_generics
Lamp.__doc__ += id_generics.attributes

View File

@@ -41,169 +41,169 @@ Example::
"""
def New (name = None):
"""
Create a new Lattice object.
Passing a name to this function will name the Lattice
datablock, otherwise the Lattice data will be given a
default name.
@type name: string
@param name: The Lattice name.
@rtype: Blender Lattice
@return: The created Lattice Data object.
"""
"""
Create a new Lattice object.
Passing a name to this function will name the Lattice
datablock, otherwise the Lattice data will be given a
default name.
@type name: string
@param name: The Lattice name.
@rtype: Blender Lattice
@return: The created Lattice Data object.
"""
def Get (name = None):
"""
Get the Lattice object(s) from Blender.
@type name: string
@param name: The name of the Lattice object.
@rtype: Blender Lattice or a list of Blender Lattices
@return: It depends on the 'name' parameter:
- (name): The Lattice object with the given name;
- (): A list with all Lattice objects in the current scene.
"""
"""
Get the Lattice object(s) from Blender.
@type name: string
@param name: The name of the Lattice object.
@rtype: Blender Lattice or a list of Blender Lattices
@return: It depends on the 'name' parameter:
- (name): The Lattice object with the given name;
- (): A list with all Lattice objects in the current scene.
"""
class Lattice:
"""
The Lattice object
==================
This object gives access to Lattices in Blender.
@ivar name: The Lattice name.
@ivar width: The number of x dimension partitions.
@ivar height: The number of y dimension partitions.
@ivar depth: The number of z dimension partitions.
@ivar widthType: The x dimension key type.
@ivar heightType: The y dimension key type.
@ivar depthType: The z dimension key type.
@ivar mode: The current mode of the Lattice.
@ivar latSize: The number of points in this Lattice.
@cvar key: The L{Key.Key} object associated with this Lattice or None.
"""
"""
The Lattice object
==================
This object gives access to Lattices in Blender.
@ivar width: The number of x dimension partitions.
@ivar height: The number of y dimension partitions.
@ivar depth: The number of z dimension partitions.
@ivar widthType: The x dimension key type.
@ivar heightType: The y dimension key type.
@ivar depthType: The z dimension key type.
@ivar mode: The current mode of the Lattice.
@ivar latSize: The number of points in this Lattice (width*height*depth).
@cvar key: The L{Key.Key} object associated with this Lattice or None.
"""
def getName():
"""
Get the name of this Lattice datablock.
@rtype: string
@return: The name of the Lattice datablock.
"""
def getName():
"""
Get the name of this Lattice datablock.
@rtype: string
@return: The name of the Lattice datablock.
"""
def setName(name):
"""
Set the name of this Lattice datablock.
@type name: string
@param name: The new name.
"""
def setName(name):
"""
Set the name of this Lattice datablock.
@type name: string
@param name: The new name.
"""
def getPartitions():
"""
Gets the number of 'walls' or partitions that the Lattice has
in the x, y, and z dimensions.
@rtype: list of ints
@return: A list corresponding to the number of partitions: [x,y,z]
"""
def getPartitions():
"""
Gets the number of 'walls' or partitions that the Lattice has
in the x, y, and z dimensions.
@rtype: list of ints
@return: A list corresponding to the number of partitions: [x,y,z]
"""
def setPartitions(x,y,z):
"""
Set the number of 'walls' or partitions that the
Lattice will be created with in the x, y, and z dimensions.
@type x: int
@param x: The number of partitions in the x dimension of the Lattice.
@type y: int
@param y: The number of partitions in the y dimension of the Lattice.
@type z: int
@param z: The number of partitions in the z dimension of the Lattice.
"""
def setPartitions(x,y,z):
"""
Set the number of 'walls' or partitions that the
Lattice will be created with in the x, y, and z dimensions.
@type x: int
@param x: The number of partitions in the x dimension of the Lattice.
@type y: int
@param y: The number of partitions in the y dimension of the Lattice.
@type z: int
@param z: The number of partitions in the z dimension of the Lattice.
"""
def getKeyTypes():
"""
Returns the deformation key types for the x, y, and z dimensions of the
Lattice.
@rtype: list of strings
@return: A list corresponding to the key types will be returned: [x,y,z]
"""
def getKeyTypes():
"""
Returns the deformation key types for the x, y, and z dimensions of the
Lattice.
@rtype: list of strings
@return: A list corresponding to the key types will be returned: [x,y,z]
"""
def setKeyTypes(xType,yType,zType):
"""
Sets the deformation key types for the x, y, and z dimensions of the
Lattice.
There are three key types possible:
- Lattice.CARDINAL
- Lattice.LINEAR
- Lattice.BSPLINE
@type xType: enum constant
@param xType: the deformation key type for the x dimension of the Lattice
@type yType: enum constant
@param yType: the deformation key type for the y dimension of the Lattice
@type zType: enum constant
@param zType: the deformation key type for the z dimension of the Lattice
"""
def setKeyTypes(xType,yType,zType):
"""
Sets the deformation key types for the x, y, and z dimensions of the
Lattice.
There are three key types possible:
- Lattice.CARDINAL
- Lattice.LINEAR
- Lattice.BSPLINE
@type xType: enum constant
@param xType: the deformation key type for the x dimension of the Lattice
@type yType: enum constant
@param yType: the deformation key type for the y dimension of the Lattice
@type zType: enum constant
@param zType: the deformation key type for the z dimension of the Lattice
"""
def getMode():
"""
Returns the current Lattice mode
@rtype: string
@return: A string representing the current Lattice mode
"""
def getMode():
"""
Returns the current Lattice mode
@rtype: string
@return: A string representing the current Lattice mode
"""
def setMode(modeType):
"""
Sets the current Lattice mode
There are two Lattice modes possible:
- Lattice.GRID
- Lattice.OUTSIDE
@type modeType: enum constant
@param modeType: the Lattice mode
"""
def setMode(modeType):
"""
Sets the current Lattice mode
There are two Lattice modes possible:
- Lattice.GRID
- Lattice.OUTSIDE
@type modeType: enum constant
@param modeType: the Lattice mode
"""
def getPoint(index):
"""
Returns the coordinates of a point in the Lattice by index.
@type index: int
@param index: The index of the point on the Lattice you want returned
@rtype: list of floats
@return: The x,y,z coordiates of the Lattice point : [x,y,z]
"""
def getPoint(index):
"""
Returns the coordinates of a point in the Lattice by index.
@type index: int
@param index: The index of the point on the Lattice you want returned
@rtype: list of floats
@return: The x,y,z coordiates of the Lattice point : [x,y,z]
"""
def setPoint(index, position):
"""
Sets the coordinates of a point in the Lattice by index.
@type index: int
@param index: The index of the point on the Lattice you want set
@type position: list of floats
@param position: The x,y,z coordinates that you want the point to be: [x,y,z]
"""
def setPoint(index, position):
"""
Sets the coordinates of a point in the Lattice by index.
@type index: int
@param index: The index of the point on the Lattice you want set
@type position: list of floats
@param position: The x,y,z coordinates that you want the point to be: [x,y,z]
"""
def getKey():
"""
Returns the L{Key.Key} object associated with this Lattice.
@rtype: L{Key.Key}
@return: A key object representing the keyframes of the lattice or None.
"""
def getKey():
"""
Returns the L{Key.Key} object associated with this Lattice.
@rtype: L{Key.Key}
@return: A key object representing the keyframes of the lattice or None.
"""
def insertKey(frame):
"""
Inserts the current state of the Lattice as a new absolute keyframe
def insertKey(frame):
"""
Inserts the current state of the Lattice as a new absolute keyframe
B{Example}::
for z in range(5):
for y in range(125):
vec = myLat.getPoint(y)
co1 = vec[0] + vec[2]
co2 = vec[1] - vec[2]
co3 = vec[2] + vec[1]
myLat.setPoint(y,[co1,co2,co3])
w = (z + 1) * 10
myLat.insertKey(w)
B{Example}::
for z in range(5):
for y in range(125):
vec = myLat.getPoint(y)
co1 = vec[0] + vec[2]
co2 = vec[1] - vec[2]
co3 = vec[2] + vec[1]
myLat.setPoint(y,[co1,co2,co3])
w = (z + 1) * 10
myLat.insertKey(w)
@type frame: int
@param frame: the frame at which the Lattice will be set as a keyframe
"""
def __copy__ ():
"""
Make a copy of this lattice
@rtype: Lattice
@return: a copy of this lattice
"""
@type frame: int
@param frame: the frame at which the Lattice will be set as a keyframe
"""
def __copy__ ():
"""
Make a copy of this lattice
@rtype: Lattice
@return: a copy of this lattice
"""
import id_generics
Lattice.__doc__ += id_generics.attributes

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -99,143 +99,138 @@ Example::
def New (name):
"""
Creates a new Metaball.
@type name: string
@param name: The name of the metaball. If this parameter is not given (or not valid) blender will assign a name to the metaball.
@rtype: Blender Metaball
@return: The created Metaball.
"""
"""
Creates a new Metaball.
@type name: string
@param name: The name of the metaball. If this parameter is not given (or not valid) blender will assign a name to the metaball.
@rtype: Blender Metaball
@return: The created Metaball.
"""
def Get (name):
"""
Get the Metaball from Blender.
@type name: string
@param name: The name of the requested Metaball.
@rtype: Blender Metaball or a list of Blender Metaballs
@return: It depends on the 'name' parameter:
- (name): The Metaball with the given name;
- (): A list with all Metaballs in the current scene.
"""
"""
Get the Metaball from Blender.
@type name: string
@param name: The name of the requested Metaball.
@rtype: Blender Metaball or a list of Blender Metaballs
@return: It depends on the 'name' parameter:
- (name): The Metaball with the given name;
- (): A list with all Metaballs in the current scene.
"""
class Metaball:
"""
The Metaball object
===================
This metaball gives access to generic data from all metaballs in Blender.
@ivar name: The unique name of the metaball.
@type name: string
@ivar users: The user count (read only)
@type users: int
@ivar fakeUser: The fake user status.
Enabling this will keep it in the blend even if there are no users.
@type fakeUser: bool
@ivar elements: Element iterator of MetaElemSeq type.
@type elements: MetaElemSeq
@ivar wiresize: display resolution.
Value clamped between 0.05 and 1.0.
"""
The Metaball object
===================
This metaball gives access to generic data from all metaballs in Blender.
@ivar elements: Element iterator of MetaElemSeq type.
@type elements: MetaElemSeq
@ivar wiresize: display resolution.
Value clamped between 0.05 and 1.0.
A lower value results in more polygons.
@type wiresize: float
@ivar rendersize: render resolution.
Value clamped between 0.05 and 1.0.
A lower value results in more polygons.
@type wiresize: float
@ivar rendersize: render resolution.
Value clamped between 0.05 and 1.0.
A lower value results in more polygons.
@type rendersize: float
@ivar thresh: Threshold setting for this metaball.
Value clamped between 0.0 and 5.0.
@type thresh: float
@ivar materials: List of up to 16 Materials or None types
Only the first material of the mother-ball used at the moment.
@type materials: list
"""
A lower value results in more polygons.
@type rendersize: float
@ivar thresh: Threshold setting for this metaball.
Value clamped between 0.0 and 5.0.
@type thresh: float
@ivar materials: List of up to 16 Materials or None types
Only the first material of the mother-ball used at the moment.
@type materials: list
"""
def __copy__():
"""
Return a copy of this metaball object data.
@rtype: Metaball
@return: Metaball
"""
import id_generics
Metaball.__doc__ += id_generics.attributes
def __copy__():
"""
Return a copy of this metaball object data.
@rtype: Metaball
@return: Metaball
"""
class MetaElemSeq:
"""
The MetaElemSeq object
======================
This object provides sequence and iterator access to the metaballs elements.
The elements accessed within this iterator "wraps" the actual metaball elements; changing any
of the elements's attributes will immediately change the data in the metaball.
"""
The MetaElemSeq object
======================
This object provides sequence and iterator access to the metaballs elements.
The elements accessed within this iterator "wraps" the actual metaball elements; changing any
of the elements's attributes will immediately change the data in the metaball.
This iterator is most like pythons 'set' type.
"""
This iterator is most like pythons 'set' type.
"""
def add():
"""
Append a new element to the metaball.
no arguments are taken, instead a new metaelement is
added to the metaball data and returned.
This new element can then be modified.
def add():
"""
Append a new element to the metaball.
no arguments are taken, instead a new metaelement is
added to the metaball data and returned.
This new element can then be modified.
@return: a new meta element.
@rtype: Metaelement
"""
@return: a new meta element.
@rtype: Metaelement
"""
def remove(element):
"""
remove an element from the metaball data.
if the element is not a part of the metaball data, an error will be raised.
def remove(element):
"""
remove an element from the metaball data.
if the element is not a part of the metaball data, an error will be raised.
@return: None
@rtype: None
"""
@return: None
@rtype: None
"""
def __iter__():
"""
Iterate over elements in this metaball.
def __iter__():
"""
Iterate over elements in this metaball.
@return: One of the metaelem in this metaball.
@rtype: Metaelem
"""
@return: One of the metaelem in this metaball.
@rtype: Metaelem
"""
def __len__():
"""
Iterate over elements in this metaball.
def __len__():
"""
Iterate over elements in this metaball.
@return: The number of elements in this metaball
@rtype: int
"""
@return: The number of elements in this metaball
@rtype: int
"""
class Metaelem:
"""
The Metaelem object
===================
This gives direct access to meta element data within a metaball.
@ivar type: The type of the metaball.
Values must be from L{Types}
"""
The Metaelem object
===================
This gives direct access to meta element data within a metaball.
@ivar type: The type of the metaball.
Values must be from L{Types}
Example::
from Blender import Metaball
mb= Metaball.Get('mb')
for el in mb.elements:
el.type= Metaball.Types.CUBE
@type type: int
@ivar co: The location of this element.
@type co: Vector
@ivar dims: Element dimensions.
Values clamped between 0 and 20 on all axies.
@type dims: Vector
@ivar quat: Element rotation.
@type quat: Quaternion
@ivar stiffness: Element stiffness.
Value clamped between 0 and 10.
@type stiffness: float
@ivar radius: Element radius.
Value clamped between 0 and 5000.
@type radius: float
@ivar negative: Element negative volume status.
@type negative: bool
@ivar hide: Element hidden status.
@type hide: bool
"""
Example::
from Blender import Metaball
mb= Metaball.Get('mb')
for el in mb.elements:
el.type= Metaball.Types.CUBE
@type type: int
@ivar co: The location of this element.
@type co: Vector
@ivar dims: Element dimensions.
Values clamped between 0 and 20 on all axies.
@type dims: Vector
@ivar quat: Element rotation.
@type quat: Quaternion
@ivar stiffness: Element stiffness.
Value clamped between 0 and 10.
@type stiffness: float
@ivar radius: Element radius.
Value clamped between 0 and 5000.
@type radius: float
@ivar negative: Element negative volume status.
@type negative: bool
@ivar hide: Element hidden status.
@type hide: bool
"""

View File

@@ -13,11 +13,11 @@ Actions are linked to objects of type armature.
@type Flags: readonly dictionary
@var Flags: Constant dict used by the L{ActionStrip.flag} attribute.
It is a bitmask and settings are ORed together.
- SELECT: action strip is selected in NLA window
- STRIDE_PATH: play action based on path position and stride.
- HOLD: continue displaying the last frame past the end of the strip
- ACTIVE: action strip is active in NLA window
- LOCK_ACTION: action start/end are automatically mapped to strip duration
- SELECT: action strip is selected in NLA window
- STRIDE_PATH: play action based on path position and stride.
- HOLD: continue displaying the last frame past the end of the strip
- ACTIVE: action strip is active in NLA window
- LOCK_ACTION: action start/end are automatically mapped to strip duration
@type StrideAxes: readonly dictionary
@var StrideAxes: Constant dict used by the L{ActionStrip.strideAxis} attribute.
@@ -29,199 +29,202 @@ Currently the only value is MODE_ADD.
"""
def NewAction (name = 'DefaultAction'):
"""
Create a new Action object.
@type name: string
@param name: The Action name.
@rtype: PyAction
"""
"""
Create a new Action object.
@type name: string
@param name: The Action name.
@rtype: PyAction
"""
def CopyAction (action):
"""
Copy an action and it's keyframes
@type action: PyAction
@param action: The action to be copied.
@rtype: PyAction
@return: A copied action
"""
"""
Copy an action and it's keyframes
@type action: PyAction
@param action: The action to be copied.
@rtype: PyAction
@return: A copied action
"""
def GetActions ():
"""
Get all actions and return them as a Key : Value Dictionary.
@rtype: Dictionary of PyActions
@return: All the actions in blender
"""
"""
Get all actions and return them as a Key : Value Dictionary.
@rtype: Dictionary of PyActions
@return: All the actions in blender
"""
class Action:
"""
The Action object
=================
This object gives access to Action-specific data in Blender.
"""
"""
The Action object
=================
This object gives access to Action-specific data in Blender.
"""
def getName():
"""
Get the name of this Action.
@rtype: string
"""
def setName(name):
"""
Set the name of this Action.
@type name: string
@param name: The new name
"""
def setActive(object):
"""
Set this action as the current action for an object.
@type object: PyObject
@param object: The object whose action is to be set
"""
def getChannelIpo(channel):
"""
Get the Ipo for the named channel in this action
@type channel: string
@param channel: The name of a channel in this action
@rtype: PyIpo or None
@return: the Ipo for the channel
"""
def getName():
"""
Get the name of this Action.
@rtype: string
"""
def setName(name):
"""
Set the name of this Action.
@type name: string
@param name: The new name
"""
def setActive(object):
"""
Set this action as the current action for an object.
@type object: PyObject
@param object: The object whose action is to be set
"""
def getChannelIpo(channel):
"""
Get the Ipo for the named channel in this action
@type channel: string
@param channel: The name of a channel in this action
@rtype: PyIpo or None
@return: the Ipo for the channel
"""
def getFrameNumbers():
"""
Gets the frame numbers at which a key was inserted into this action
@rtype: PyList
@return: a list of ints
"""
def removeChannel(channel):
"""
Remove a named channel from this action
@type channel: string
@param channel: The name of a channel in this action to be removed
"""
def getAllChannelIpos():
"""
Get the all the Ipos for this action
@rtype: Dictionary [channel : PyIpo or None]
@return: the Ipos for all the channels in the action
"""
def getFrameNumbers():
"""
Gets the frame numbers at which a key was inserted into this action
@rtype: PyList
@return: a list of ints
"""
def removeChannel(channel):
"""
Remove a named channel from this action
@type channel: string
@param channel: The name of a channel in this action to be removed
"""
def getAllChannelIpos():
"""
Get the all the Ipos for this action
@rtype: Dictionary [channel : PyIpo or None]
@return: the Ipos for all the channels in the action
"""
import id_generics
Action.__doc__ += id_generics.attributes
class ActionStrips:
"""
The ActionStrips object
=======================
This object gives access to sequence of L{ActionStrip} objects for
a particular Object.
"""
"""
The ActionStrips object
=======================
This object gives access to sequence of L{ActionStrip} objects for
a particular Object.
"""
def __getitem__(index):
"""
This operator returns one of the action strips in the stack.
@type index: int
@return: an action strip object
@rtype: ActionStrip
@raise KeyError: index was out of range
"""
def __getitem__(index):
"""
This operator returns one of the action strips in the stack.
@type index: int
@return: an action strip object
@rtype: ActionStrip
@raise KeyError: index was out of range
"""
def __len__():
"""
Returns the number of action strips for the object.
@return: number of action strips
@rtype: int
"""
def __len__():
"""
Returns the number of action strips for the object.
@return: number of action strips
@rtype: int
"""
def append(action):
"""
Appends a new action to the end of the action strip sequence.
@type action: L{Action<NLA.Action>}
@param action: the action to use in the action strip
@rtype: ActionStrip
@return: the new action strip
"""
def append(action):
"""
Appends a new action to the end of the action strip sequence.
@type action: L{Action<NLA.Action>}
@param action: the action to use in the action strip
@rtype: ActionStrip
@return: the new action strip
"""
def remove(actionstrip):
"""
Remove an action strip from this object's actionstrip sequence.
@type actionstrip: an action strip from this sequence to remove.
@note: Accessing attributes of the action strip after it is removed will
throw an exception.
"""
def remove(actionstrip):
"""
Remove an action strip from this object's actionstrip sequence.
@type actionstrip: an action strip from this sequence to remove.
@note: Accessing attributes of the action strip after it is removed will
throw an exception.
"""
def moveDown(actionstrip):
"""
Move the action strip down in the object's actionstrip sequence.
@type actionstrip: an action strip from this sequence.
"""
def moveDown(actionstrip):
"""
Move the action strip down in the object's actionstrip sequence.
@type actionstrip: an action strip from this sequence.
"""
def moveUp(actionstrip):
"""
Move the action strip up in the object's actionstrip sequence.
@type actionstrip: an action strip from this sequence.
"""
def moveUp(actionstrip):
"""
Move the action strip up in the object's actionstrip sequence.
@type actionstrip: an action strip from this sequence.
"""
class ActionStrip:
"""
The ActionStrip object
======================
This object gives access to a particular action strip.
@ivar action: Action associated with the strip.
@type action: BPy Action object
@ivar stripStart: Starting frame of the strip.
@type stripStart: float
@ivar stripEnd: Ending frame of the strip.
@type stripEnd: float
@ivar actionStart: Starting frame of the action.
@type actionStart: float
@ivar actionEnd: Ending frame of the action.
@type actionEnd: float
@ivar repeat: The number of times to repeat the action range.
@type repeat: float
@ivar mode: Controls the ActionStrip mode. See L{Modes} for
valid values.
@type mode: int
@ivar flag: Controls various ActionStrip attributes. Values can be ORed.
See L{Flags} for valid values.
@type flag: int
@ivar strideAxis: Dominant axis for stride bone. See L{StrideAxes} for
valid values.
@type strideAxis: int
@ivar strideLength: Distance covered by one complete cycle of the action
specified in the Action Range.
@type strideLength: float
@ivar strideBone: Name of Bone used for stride
@type strideBone: string
@ivar groupTarget: Armature object within DupliGroup for local animation
@type groupTarget: object
@ivar blendIn: Number of frames of motion blending.
@type blendIn: float
@ivar blendOut: Number of frames of ease-out.
@type blendOut: float
"""
"""
The ActionStrip object
======================
This object gives access to a particular action strip.
@ivar action: Action associated with the strip.
@type action: BPy Action object
@ivar stripStart: Starting frame of the strip.
@type stripStart: float
@ivar stripEnd: Ending frame of the strip.
@type stripEnd: float
@ivar actionStart: Starting frame of the action.
@type actionStart: float
@ivar actionEnd: Ending frame of the action.
@type actionEnd: float
@ivar repeat: The number of times to repeat the action range.
@type repeat: float
@ivar mode: Controls the ActionStrip mode. See L{Modes} for
valid values.
@type mode: int
@ivar flag: Controls various ActionStrip attributes. Values can be ORed.
See L{Flags} for valid values.
@type flag: int
@ivar strideAxis: Dominant axis for stride bone. See L{StrideAxes} for
valid values.
@type strideAxis: int
@ivar strideLength: Distance covered by one complete cycle of the action
specified in the Action Range.
@type strideLength: float
@ivar strideBone: Name of Bone used for stride
@type strideBone: string
@ivar groupTarget: Armature object within DupliGroup for local animation
@type groupTarget: object
@ivar blendIn: Number of frames of motion blending.
@type blendIn: float
@ivar blendOut: Number of frames of ease-out.
@type blendOut: float
"""
def resetActionLimits():
"""
Activates the functionality found in NLA Strip menu under "Reset Action
Start/End". This method restores the values of ActionStart and
ActionEnd to their defaults, usually the first and last frames within
an action that contain keys.
@rtype: None
"""
def resetActionLimits():
"""
Activates the functionality found in NLA Strip menu under "Reset Action
Start/End". This method restores the values of ActionStart and
ActionEnd to their defaults, usually the first and last frames within
an action that contain keys.
@rtype: None
"""
def resetStripSize():
"""
Activates the functionality found in NLA Strip menu under "Reset Strip
Size". This method resets the action strip size to its creation values.
@rtype: None
"""
def resetStripSize():
"""
Activates the functionality found in NLA Strip menu under "Reset Strip
Size". This method resets the action strip size to its creation values.
@rtype: None
"""
def snapToFrame():
"""
Activates the functionality found in NLA Strip menu under "Snap to Frame".
This function snaps the ends of the action strip to the nearest whole
numbered frame.
@rtype: None
"""
def snapToFrame():
"""
Activates the functionality found in NLA Strip menu under "Snap to Frame".
This function snaps the ends of the action strip to the nearest whole
numbered frame.
@rtype: None
"""

File diff suppressed because it is too large Load Diff

View File

@@ -4,9 +4,9 @@
The Blender.Scene submodule.
B{New}:
- L{Scene.clearScriptLinks<Scene.Scene.clearScriptLinks>} accepts a parameter now.
- acess methods L{Scene.getLayers<Scene.Scene.getLayers>}, L{Scene.setLayers<Scene.Scene.setLayers>} via lists to complement the layers and
Layers Scene attributes which use bitmasks.
- L{Scene.clearScriptLinks<Scene.Scene.clearScriptLinks>} accepts a parameter now.
- acess methods L{Scene.getLayers<Scene.Scene.getLayers>}, L{Scene.setLayers<Scene.Scene.setLayers>} via lists to complement the layers and
Layers Scene attributes which use bitmasks.
Scene
=====
@@ -14,367 +14,365 @@ Scene
This module provides access to B{Scenes} in Blender.
Example::
import Blender
from Blender import Scene, Object, Camera
#
camdata = Camera.New('persp') # create new camera data
camdata.name = 'newCam'
camdata.lens = 16.0
scene = Scene.New('NewScene') # create a new scene
scene.objects.new(camdata,'Camera') # add a new object to the scene with newly-created data
scene.makeCurrent() # make this the current scene
import Blender
from Blender import Scene, Object, Camera
#
camdata = Camera.New('persp') # create new camera data
camdata.name = 'newCam'
camdata.lens = 16.0
scene = Scene.New('NewScene') # create a new scene
scene.objects.new(camdata,'Camera') # add a new object to the scene with newly-created data
scene.makeCurrent() # make this the current scene
@warn: B{scene.objects.new} is the preferred way to add new objects to a scene.
The older way is to create an object with B{Object.New()}, link the
data to the new object, then link the object to the scene. This way is
not recommended since a forgotten step or run-time error in the script can
cause bad things to be done to Blender's database.
The older way is to create an object with B{Object.New()}, link the
data to the new object, then link the object to the scene. This way is
not recommended since a forgotten step or run-time error in the script can
cause bad things to be done to Blender's database.
If you use this older method, it's recommended to always perform the
operations in this order. This is because if
there is no object data linked to an object B{ob}, B{scene.link(ob)} will
automatically create the missing data. This is OK on its own, but I{if
after that} object B{ob} is linked to obdata, the automatically created one
will be discarded -- as expected -- but will stay in Blender's memory
space until the program is exited, since Blender doesn't really get rid of
most kinds of data. So first linking ObData to object, then object to
scene is a tiny tiny bit faster than the other way around and also saves
some realtime memory (if many objects are created from scripts, the
savings become important).
If you use this older method, it's recommended to always perform the
operations in this order. This is because if
there is no object data linked to an object B{ob}, B{scene.link(ob)} will
automatically create the missing data. This is OK on its own, but I{if
after that} object B{ob} is linked to obdata, the automatically created one
will be discarded -- as expected -- but will stay in Blender's memory
space until the program is exited, since Blender doesn't really get rid of
most kinds of data. So first linking ObData to object, then object to
scene is a tiny tiny bit faster than the other way around and also saves
some realtime memory (if many objects are created from scripts, the
savings become important).
"""
def New (name = 'Scene'):
"""
Create a new Scene in Blender.
@type name: string
@param name: The Scene name.
@rtype: Blender Scene
@return: The created Scene.
"""
"""
Create a new Scene in Blender.
@type name: string
@param name: The Scene name.
@rtype: Blender Scene
@return: The created Scene.
"""
def Get (name = None):
"""
Get the Scene(s) from Blender.
@type name: string
@param name: The name of a Scene.
@rtype: Blender Scene or a list of Blender Scenes
@return: It depends on the I{name} parameter:
- (name): The Scene with the given I{name};
- (): A list with all Scenes currently in Blender.
"""
"""
Get the Scene(s) from Blender.
@type name: string
@param name: The name of a Scene.
@rtype: Blender Scene or a list of Blender Scenes
@return: It depends on the I{name} parameter:
- (name): The Scene with the given I{name};
- (): A list with all Scenes currently in Blender.
"""
def GetCurrent():
"""
Get the currently active Scene in Blender.
@rtype: Blender Scene
@return: The currently active Scene.
"""
"""
Get the currently active Scene in Blender.
@rtype: Blender Scene
@return: The currently active Scene.
"""
def Unlink(scene):
"""
Unlink (delete) a Scene from Blender.
@type scene: Blender Scene
@param scene: The Scene to be unlinked.
"""
"""
Unlink (delete) a Scene from Blender.
@type scene: Blender Scene
@param scene: The Scene to be unlinked.
"""
from IDProp import IDGroup, IDArray
class Scene:
"""
The Scene object
================
This object gives access to Scene data in Blender.
@ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this
scene's ID Properties.
@type properties: L{IDGroup<IDProp.IDGroup>}
@type name: string
@ivar name: The Scene name.
@type Layers: integer (bitmask)
@ivar Layers: The Scene layers (check also the easier to use
L{layers}). This value is a bitmask with at least
one position set for the 20 possible layers starting from the low order
bit. The easiest way to deal with these values in in hexadecimal
notation.
Example::
scene.Layers = 0x04 # sets layer 3 ( bit pattern 0100 )
scene.Layers |= 0x01
print scene.Layers # will print: 5 ( meaning bit pattern 0101)
After setting the Layers value, the interface (at least the 3d View and
the Buttons window) needs to be redrawn to show the changes.
@type layers: list of integers
@ivar layers: The Scene layers (check also L{Layers}).
This attribute accepts and returns a list of integer values in the
range [1, 20].
Example::
scene.layers = [3] # set layer 3
scene.layers = scene.layers.append(1)
print scene.layers # will print: [1, 3]
@type objects: sequence of objects
@ivar objects: The scene's objects. The sequence supports the methods .link(ob), .unlink(ob), and .new(obdata), and can be iterated over.
"""
"""
The Scene object
================
This object gives access to Scene data in Blender.
@type Layers: integer (bitmask)
@ivar Layers: The Scene layers (check also the easier to use
L{layers}). This value is a bitmask with at least
one position set for the 20 possible layers starting from the low order
bit. The easiest way to deal with these values in in hexadecimal
notation.
Example::
scene.Layers = 0x04 # sets layer 3 ( bit pattern 0100 )
scene.Layers |= 0x01
print scene.Layers # will print: 5 ( meaning bit pattern 0101)
After setting the Layers value, the interface (at least the 3d View and
the Buttons window) needs to be redrawn to show the changes.
@type layers: list of integers
@ivar layers: The Scene layers (check also L{Layers}).
This attribute accepts and returns a list of integer values in the
range [1, 20].
Example::
scene.layers = [3] # set layer 3
scene.layers = scene.layers.append(1)
print scene.layers # will print: [1, 3]
@type objects: sequence of objects
@ivar objects: The scene's objects. The sequence supports the methods .link(ob), .unlink(ob), and .new(obdata), and can be iterated over.
"""
def getName():
"""
Get the name of this Scene.
@rtype: string
"""
def getName():
"""
Get the name of this Scene.
@rtype: string
"""
def setName(name):
"""
Set the name of this Scene.
@type name: string
@param name: The new name.
"""
def setName(name):
"""
Set the name of this Scene.
@type name: string
@param name: The new name.
"""
def getLayers():
"""
Get the layers set for this Scene.
@rtype: list of integers
@return: a list where each number means the layer with that number is
set.
"""
def getLayers():
"""
Get the layers set for this Scene.
@rtype: list of integers
@return: a list where each number means the layer with that number is set.
"""
def setLayers(layers):
"""
Set the visible layers for this scene.
@type layers: list of integers
@param layers: a list of integers in the range [1, 20], where each available
index makes the layer with that number visible.
@note: if this Scene is the current one, the 3D View layers are also
updated, but the screen needs to be redrawn (at least 3D Views and
Buttons windows) for the changes to be seen.
"""
def setLayers(layers):
"""
Set the visible layers for this scene.
@type layers: list of integers
@param layers: a list of integers in the range [1, 20], where each available
index makes the layer with that number visible.
@note: if this Scene is the current one, the 3D View layers are also
updated, but the screen needs to be redrawn (at least 3D Views and
Buttons windows) for the changes to be seen.
"""
def copy(duplicate_objects = 1):
"""
Make a copy of this Scene.
@type duplicate_objects: int
@param duplicate_objects: Defines how the Scene children are duplicated:
- 0: Link Objects;
- 1: Link Object Data;
- 2: Full copy.
@rtype: Scene
@return: The copied Blender Scene.
"""
def copy(duplicate_objects = 1):
"""
Make a copy of this Scene.
@type duplicate_objects: int
@param duplicate_objects: Defines how the Scene children are duplicated:
- 0: Link Objects;
- 1: Link Object Data;
- 2: Full copy.
@rtype: Scene
@return: The copied Blender Scene.
"""
def makeCurrent():
"""
Make this Scene the currently active one in Blender.
"""
def makeCurrent():
"""
Make this Scene the currently active one in Blender.
"""
def update(full = 0):
"""
Update this Scene in Blender.
@type full: int
@param full: A bool to control the level of updating:
- 0: sort the base list of objects.
- 1: sort and also regroup, do ipos, keys, script links, etc.
@warn: When in doubt, try with I{full = 0} first, since it is faster.
The "full" update is a recent addition to this method.
"""
def update(full = 0):
"""
Update this Scene in Blender.
@type full: int
@param full: A bool to control the level of updating:
- 0: sort the base list of objects.
- 1: sort and also regroup, do ipos, keys, script links, etc.
@warn: When in doubt, try with I{full = 0} first, since it is faster.
The "full" update is a recent addition to this method.
"""
def getRenderingContext():
"""
Get the rendering context for this scene, see L{Render}.
@rtype: RenderData
@return: the render data object for this scene.
"""
def getRenderingContext():
"""
Get the rendering context for this scene, see L{Render}.
@rtype: RenderData
@return: the render data object for this scene.
"""
def getRadiosityContext():
"""
Get the radiosity context for this scene, see L{Radio}.
@rtype: Blender Radiosity
@return: the radiosity object for this scene.
@note: only the current scene can return a radiosity context.
"""
def getRadiosityContext():
"""
Get the radiosity context for this scene, see L{Radio}.
@rtype: Blender Radiosity
@return: the radiosity object for this scene.
@note: only the current scene can return a radiosity context.
"""
def getChildren():
"""
Get all objects linked to this Scene. (B{deprecated}). B{Note}: new scripts
should use the L{objects} attribute instead. In cases where a list is
required use list(scn.objects).
@rtype: list of Blender Objects
@return: A list with all Blender Objects linked to this Scene.
@note: L{Object.Get} will return all objects currently in Blender, which
means all objects from all available scenes. In most cases (exporter
scripts, for example), it's probably better to use this
scene.GetChildren instead, since it will only access objects from this
particular scene.
@warn: Depricated! use scene.objects instead.
"""
def getChildren():
"""
Get all objects linked to this Scene. (B{deprecated}). B{Note}: new scripts
should use the L{objects} attribute instead. In cases where a list is
required use list(scn.objects).
@rtype: list of Blender Objects
@return: A list with all Blender Objects linked to this Scene.
@note: L{Object.Get} will return all objects currently in Blender, which
means all objects from all available scenes. In most cases (exporter
scripts, for example), it's probably better to use this
scene.GetChildren instead, since it will only access objects from this
particular scene.
@warn: Depricated! use scene.objects instead.
"""
def getActiveObject():
"""
Get this scene's active object.
@note: the active object, if selected, can also be retrieved with
L{Object.GetSelected} -- it is the first item in the returned
list. But even when no object is selected in Blender, there can be
an active one (if the user enters editmode, for example, this is the
object that should become available for edition). So what makes this
scene method different from C{Object.GetSelected()[0]} is that it can
return the active object even when no objects are selected.
@rtype: Blender Object or None
@return: the active object or None if not available.
@warn: Depricated! use scene.objects.active instead.
"""
def getActiveObject():
"""
Get this scene's active object.
@note: the active object, if selected, can also be retrieved with
L{Object.GetSelected} -- it is the first item in the returned
list. But even when no object is selected in Blender, there can be
an active one (if the user enters editmode, for example, this is the
object that should become available for edition). So what makes this
scene method different from C{Object.GetSelected()[0]} is that it can
return the active object even when no objects are selected.
@rtype: Blender Object or None
@return: the active object or None if not available.
@warn: Depricated! use scene.objects.active instead.
"""
def getCurrentCamera():
"""
Get the currently active Camera for this Scene.
@note: The active camera can be any object type, not just a camera object.
@rtype: Blender Object
@return: The currently active Camera object.
"""
def getCurrentCamera():
"""
Get the currently active Camera for this Scene.
@note: The active camera can be any object type, not just a camera object.
@rtype: Blender Object
@return: The currently active Camera object.
"""
def setCurrentCamera(camera):
"""
Set the currently active Camera in this Scene.
@type camera: Blender Camera
@param camera: The new active Camera.
"""
def setCurrentCamera(camera):
"""
Set the currently active Camera in this Scene.
@type camera: Blender Camera
@param camera: The new active Camera.
"""
def link(object):
"""
Link an Object to this Scene.
@type object: Blender Object
@param object: A Blender Object.
"""
def link(object):
"""
Link an Object to this Scene.
@type object: Blender Object
@param object: A Blender Object.
"""
def unlink(object):
"""
Unlink an Object from this Scene.
@type object: Blender Object
@param object: A Blender Object.
@rtype: boolean
@return: true if object was found in the scene.
"""
def unlink(object):
"""
Unlink an Object from this Scene.
@type object: Blender Object
@param object: A Blender Object.
@rtype: boolean
@return: true if object was found in the scene.
"""
def getScriptLinks (event):
"""
Get a list with this Scene's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def getScriptLinks (event):
"""
Get a list with this Scene's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def clearScriptLinks (links = None):
"""
Delete script links from this Scene. If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def clearScriptLinks (links = None):
"""
Delete script links from this Scene. If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def addScriptLink (text, event):
"""
Add a new script link to this Scene.
Using OpenGL functions within a scene ScriptLink will draw graphics over the 3D view.
There is an issue with the zoom of the floating panels also scaling graphics drawn by your scriptlink.
This makes matching OpenGL graphics to mouse location impossible.
Make sure that you use floating point for operations that you would usually use int functions for: glRasterPos2f rather then glRasterPos2i.
The following example shows how you can use the OpenGL model view matrix to obtain the scale value.
Example::
from Blender import BGL
view_matrix = BGL.Buffer(BGL.GL_FLOAT, 16)
BGL.glGetFloatv(BGL.GL_MODELVIEW_MATRIX, view_matrix)
gl_scale = 1/viewMatrix[0]
# Now that we have the scale we can draw to the correct scale.
BGL.glRect2f(10*gl_scale, 10*gl_scale, 110*gl_scale, 110*gl_scale)
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
"""
def addScriptLink (text, event):
"""
Add a new script link to this Scene.
Using OpenGL functions within a scene ScriptLink will draw graphics over the 3D view.
There is an issue with the zoom of the floating panels also scaling graphics drawn by your scriptlink.
This makes matching OpenGL graphics to mouse location impossible.
Make sure that you use floating point for operations that you would usually use int functions for: glRasterPos2f rather then glRasterPos2i.
The following example shows how you can use the OpenGL model view matrix to obtain the scale value.
Example::
from Blender import BGL
view_matrix = BGL.Buffer(BGL.GL_FLOAT, 16)
BGL.glGetFloatv(BGL.GL_MODELVIEW_MATRIX, view_matrix)
gl_scale = 1/viewMatrix[0]
# Now that we have the scale we can draw to the correct scale.
BGL.glRect2f(10*gl_scale, 10*gl_scale, 110*gl_scale, 110*gl_scale)
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "OnLoad", "OnSave", "Redraw" or "Render".
"""
def play (mode = 0, win = '<VIEW3D>'):
"""
Play a realtime animation. This is the "Play Back Animation" function in
Blender, different from playing a sequence of rendered images (for that
check L{Render.RenderData.play}).
@type mode: int
@param mode: controls playing:
- 0: keep playing in the biggest 'win' window;
- 1: keep playing in all 'win', VIEW3D and SEQ windows;
- 2: play once in the biggest VIEW3D;
- 3: play once in all 'win', VIEW3D and SEQ windows.
@type win: int
@param win: window type, see L{Window.Types}. Only some of them are
meaningful here: VIEW3D, SEQ, IPO, ACTION, NLA, SOUND. But the others
are also accepted, since this function can be used simply as an
interruptible timer. If 'win' is not visible or invalid, VIEW3D is
tried, then any bigger visible window.
@rtype: bool
@return: 0 on normal exit or 1 when play back is canceled by user input.
"""
import id_generics
Scene.__doc__ += id_generics.attributes
def play (mode = 0, win = '<VIEW3D>'):
"""
Play a realtime animation. This is the "Play Back Animation" function in
Blender, different from playing a sequence of rendered images (for that
check L{Render.RenderData.play}).
@type mode: int
@param mode: controls playing:
- 0: keep playing in the biggest 'win' window;
- 1: keep playing in all 'win', VIEW3D and SEQ windows;
- 2: play once in the biggest VIEW3D;
- 3: play once in all 'win', VIEW3D and SEQ windows.
@type win: int
@param win: window type, see L{Window.Types}. Only some of them are
meaningful here: VIEW3D, SEQ, IPO, ACTION, NLA, SOUND. But the others
are also accepted, since this function can be used simply as an
interruptible timer. If 'win' is not visible or invalid, VIEW3D is
tried, then any bigger visible window.
@rtype: bool
@return: 0 on normal exit or 1 when play back is canceled by user input.
"""
class SceneObjects:
"""
The SceneObjects (Scene ObjectSeq) object
=========================================
This object gives access to the Objects in a Scene in Blender.
"""
The SceneObjects (Scene ObjectSeq) object
=========================================
This object gives access to the Objects in a Scene in Blender.
Example::
from Blender import Scene
scn = Scene.GetCurrent()
scn.objects.selected = [] # select none
scn.objects.selected = scn.objects # select all
scn.objects.context = scn.objects # select all and move into the scenes display layer
# get a list of mesh objects
obs = [ob for ob in scn.objects if ob.type == 'Mesh']
# Select only these mesh objects
scn.objects.selected = obs
# print all object names
for ob in scn.objects: print ob.name
# make a list of objects that you can add and remove to
# will not affect the current scene
scene_obs = list(scn.objects)
Example::
from Blender import Scene
scn = Scene.GetCurrent()
scn.objects.selected = [] # select none
scn.objects.selected = scn.objects # select all
scn.objects.context = scn.objects # select all and move into the scenes display layer
# get a list of mesh objects
obs = [ob for ob in scn.objects if ob.type == 'Mesh']
# Select only these mesh objects
scn.objects.selected = obs
# print all object names
for ob in scn.objects: print ob.name
# make a list of objects that you can add and remove to
# will not affect the current scene
scene_obs = list(scn.objects)
@ivar selected: an iterator over all the selected objects in a scene.
@type selected: sequence of L{Object}
@ivar context: an iterator over all the visible selected objects in a scene.
@type context: sequence of L{Object}
@ivar active: the active object in the scene.
@type active: L{Object}
"""
@ivar selected: an iterator over all the selected objects in a scene.
@type selected: sequence of L{Object}
@ivar context: an iterator over all the visible selected objects in a scene.
@type context: sequence of L{Object}
@ivar active: the active object in the scene.
@type active: L{Object}
"""
def new(data):
"""
Adds a new object to the scene. Data is either object data such as a
L{Mesh} or L{Curve}, or the string "Empty" for an Empty object. The
type of the object is determined by the type of the data.
@type data: string or object data
@param data: the object data for the new object
@return: the new object.
@rtype: L{Object}
"""
def new(data):
"""
Adds a new object to the scene. Data is either object data such as a
L{Mesh} or L{Curve}, or the string "Empty" for an Empty object. The
type of the object is determined by the type of the data.
@type data: string or object data
@param data: the object data for the new object
@return: the new object.
@rtype: L{Object}
"""
def link(object):
"""
Adds an existing object to the scene. If the object is already linked
to the scene, no action is taken and no exception is raised.
@type object: L{Object}
@param object: the object
@rtype: None
"""
def link(object):
"""
Adds an existing object to the scene. If the object is already linked
to the scene, no action is taken and no exception is raised.
@type object: L{Object}
@param object: the object
@rtype: None
"""
def unlink(object):
"""
Removes an object from the scene. If the object is not linked
to the scene, no action is taken and no exception is raised.
@type object: L{Object}
@param object: the object
@rtype: None
"""
def unlink(object):
"""
Removes an object from the scene. If the object is not linked
to the scene, no action is taken and no exception is raised.
@type object: L{Object}
@param object: the object
@rtype: None
"""

View File

@@ -9,13 +9,13 @@ Sound
This module provides access to B{Sound} objects in Blender.
Example::
import Blender
from Blender import Sound
#
sound = Sound.Load("/path/to/my/sound.wav") # load a sound file
print "Sound from", sound.filename,
print "loaded to obj", sound.name
print "All Sounds available now:", Sound.Get()
import Blender
from Blender import Sound
#
sound = Sound.Load("/path/to/my/sound.wav") # load a sound file
print "Sound from", sound.filename,
print "loaded to obj", sound.name
print "All Sounds available now:", Sound.Get()
No way to get the actual audio data is provided by this library,
but it is included in the Python standard library (module audioop).
@@ -23,125 +23,125 @@ Note that using that module requires a full/normal Python installation.
"""
def Load (filename):
"""
Load the sound called 'filename' into a Sound object.
@type filename: string
@param filename: The full path to the sound file.
@rtype: Blender Sound
@return: A Blender Sound object with the data from I{filename}.
"""
"""
Load the sound called 'filename' into a Sound object.
@type filename: string
@param filename: The full path to the sound file.
@rtype: Blender Sound
@return: A Blender Sound object with the data from I{filename}.
"""
def Get (name = None):
"""
Get the Sound object(s) from Blender.
@type name: string
@param name: The name of the Sound object.
@rtype: Blender Sound or a list of Blender Sounds
@return: It depends on the I{name} parameter:
- (name): The Sound object called I{name}, None if not found;
- (): A list with all Sound objects in the current scene.
"""
"""
Get the Sound object(s) from Blender.
@type name: string
@param name: The name of the Sound object.
@rtype: Blender Sound or a list of Blender Sounds
@return: It depends on the I{name} parameter:
- (name): The Sound object called I{name}, None if not found;
- (): A list with all Sound objects in the current scene.
"""
class Sound:
"""
The Sound object
================
This object gives access to Sounds in Blender.
@ivar name: The name of this Sound object.
@ivar filename: The filename (path) to the sound file loaded into this Sound
@ivar packed: Boolean, True when the sample is packed (readonly).
object.
"""
"""
The Sound object
================
This object gives access to Sounds in Blender.
@ivar filename: The filename (path) to the sound file loaded into this Sound
@ivar packed: Boolean, True when the sample is packed (readonly).
"""
def getName():
"""
Get the name of this Sound object.
@rtype: string
"""
def getName():
"""
Get the name of this Sound object.
@rtype: string
"""
def getFilename():
"""
Get the filename of the sound file loaded into this Sound object.
@rtype: string
"""
def getFilename():
"""
Get the filename of the sound file loaded into this Sound object.
@rtype: string
"""
def setName():
"""
Set the name of this Sound object.
@rtype: None
"""
def setName():
"""
Set the name of this Sound object.
@rtype: None
"""
def setFilename():
"""
Set the filename of the sound file loaded into this Sound object.
@rtype: None
"""
def setFilename():
"""
Set the filename of the sound file loaded into this Sound object.
@rtype: None
"""
def setCurrent():
"""
Make this the active sound in the sound buttons window (also redraws).
"""
def setCurrent():
"""
Make this the active sound in the sound buttons window (also redraws).
"""
def play():
"""
Play this sound.
"""
def play():
"""
Play this sound.
"""
def getVolume():
"""
Get this sound's volume.
rtype: float
"""
def getVolume():
"""
Get this sound's volume.
rtype: float
"""
def setVolume(f):
"""
Set this sound's volume.
@type f: float
@param f: the new volume value in the range [0.0, 1.0].
"""
def setVolume(f):
"""
Set this sound's volume.
@type f: float
@param f: the new volume value in the range [0.0, 1.0].
"""
def getAttenuation():
"""
Get this sound's attenuation value.
rtype: float
"""
def getAttenuation():
"""
Get this sound's attenuation value.
rtype: float
"""
def setAttenuation(f):
"""
Set this sound's attenuation.
@type f: float
@param f: the new attenuation value in the range [0.0, 5.0].
"""
def setAttenuation(f):
"""
Set this sound's attenuation.
@type f: float
@param f: the new attenuation value in the range [0.0, 5.0].
"""
def getPitch():
"""
Get this sound's pitch value.
rtype: float
"""
def getPitch():
"""
Get this sound's pitch value.
rtype: float
"""
def setPitch(f):
"""
Set this sound's pitch.
@type f: float
@param f: the new pitch value in the range [-12.0, 12.0].
"""
def setPitch(f):
"""
Set this sound's pitch.
@type f: float
@param f: the new pitch value in the range [-12.0, 12.0].
"""
def pack():
"""
Packs the sound into the current blend file.
@note: An error will be raised if the sound is already packed or the filename path does not exist.
@returns: nothing
@rtype: none
"""
def pack():
"""
Packs the sound into the current blend file.
@note: An error will be raised if the sound is already packed or the filename path does not exist.
@returns: nothing
@rtype: none
"""
def unpack(mode):
"""
Unpacks the sound to the samples filename.
@param mode: One of the values in Blender.Unpackmodes dict.
@note: An error will be raised if the sound is not packed or the filename path does not exist.
@returns: nothing
@rtype: none
@type mode: int
"""
def unpack(mode):
"""
Unpacks the sound to the samples filename.
@param mode: One of the values in Blender.Unpackmodes dict.
@note: An error will be raised if the sound is not packed or the filename path does not exist.
@returns: nothing
@rtype: none
@type mode: int
"""
import id_generics
Sound.__doc__ += id_generics.attributes

View File

@@ -9,126 +9,128 @@ Text Objects
This module provides access to B{Text} objects in Blender.
Example::
import Blender
from Blender import Text
#
txt = Text.New("MyText") # create a new Text object
print Text.Get() # current list of Texts in Blender
txt.write("Appending some ") # appending text
txt.write("text to my\\n") # '\\n' inserts new-line markers
txt.write("text buffer.")
print txt.asLines() # retrieving the buffer as a list of lines
Text.unlink(txt) # removing a Text object
import Blender
from Blender import Text
#
txt = Text.New("MyText") # create a new Text object
print Text.Get() # current list of Texts in Blender
txt.write("Appending some ") # appending text
txt.write("text to my\\n") # '\\n' inserts new-line markers
txt.write("text buffer.")
print txt.asLines() # retrieving the buffer as a list of lines
Text.unlink(txt) # removing a Text object
"""
def New (name = None, follow_cursor = 0):
"""
Create a new Text object.
@type name: string
@param name: The Text name.
@type follow_cursor: int
@param follow_cursor: The text follow flag: if 1, the text display always
follows the cursor.
@rtype: Blender Text
@return: The created Text Data object.
"""
"""
Create a new Text object.
@type name: string
@param name: The Text name.
@type follow_cursor: int
@param follow_cursor: The text follow flag: if 1, the text display always
follows the cursor.
@rtype: Blender Text
@return: The created Text Data object.
"""
def Get (name = None):
"""
Get the Text object(s) from Blender.
@type name: string
@param name: The name of the Text object.
@rtype: Blender Text or a list of Blender Texts
@return: It depends on the 'name' parameter:
- (name): The Text object with the given name;
- (): A list with all Text objects in the current scene.
"""
"""
Get the Text object(s) from Blender.
@type name: string
@param name: The name of the Text object.
@rtype: Blender Text or a list of Blender Texts
@return: It depends on the 'name' parameter:
- (name): The Text object with the given name;
- (): A list with all Text objects in the current scene.
"""
def Load (filename):
"""
Load a file into a Blender Text object.
@type filename: string
@param filename: The name of the file to load.
@rtype: Blender Text
@return: A Text object with the contents of the loaded file.
"""
"""
Load a file into a Blender Text object.
@type filename: string
@param filename: The name of the file to load.
@rtype: Blender Text
@return: A Text object with the contents of the loaded file.
"""
def unlink(textobj):
"""
Unlink (remove) the given Text object from Blender.
@type textobj: Blender Text
@param textobj: The Text object to be deleted.
"""
"""
Unlink (remove) the given Text object from Blender.
@type textobj: Blender Text
@param textobj: The Text object to be deleted.
"""
class Text:
"""
The Text object
===============
This object gives access to Texts in Blender.
@ivar name: The Text name.
@ivar filename: The filename of the file loaded into this Text.
@ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
@ivar nlines: The number of lines in this Text.
"""
"""
The Text object
===============
This object gives access to Texts in Blender.
@ivar filename: The filename of the file loaded into this Text.
@ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
@ivar nlines: The number of lines in this Text.
"""
def getName():
"""
Get the name of this Text object.
@rtype: string
"""
def getName():
"""
Get the name of this Text object.
@rtype: string
"""
def setName(name):
"""
Set the name of this Text object.
@type name: string
@param name: The new name.
"""
def setName(name):
"""
Set the name of this Text object.
@type name: string
@param name: The new name.
"""
def getFilename():
"""
Get the filename of the file loaded into this Text object.
@rtype: string
"""
def getFilename():
"""
Get the filename of the file loaded into this Text object.
@rtype: string
"""
def getNLines():
"""
Get the number of lines in this Text buffer.
@rtype: int
"""
def getNLines():
"""
Get the number of lines in this Text buffer.
@rtype: int
"""
def clear():
"""
Clear this Text object: its buffer becomes empty.
"""
def clear():
"""
Clear this Text object: its buffer becomes empty.
"""
def set(attribute, value):
"""
Set this Text's attributes.
@type attribute: string
@param attribute: The attribute to change:
currently, 'follow_cursor' is the only one available. It can be
turned 'on' with value = 1 and 'off' with value = 0.
@type value: int
@param value: The new attribute value.
"""
def set(attribute, value):
"""
Set this Text's attributes.
@type attribute: string
@param attribute: The attribute to change:
currently, 'follow_cursor' is the only one available. It can be
turned 'on' with value = 1 and 'off' with value = 0.
@type value: int
@param value: The new attribute value.
"""
def write(data):
"""
Append a string to this Text buffer.
@type data: string
@param data: The string to append to the text buffer.
"""
def write(data):
"""
Append a string to this Text buffer.
@type data: string
@param data: The string to append to the text buffer.
"""
def asLines():
"""
Retrieve the contents of this Text buffer as a list of strings.
@rtype: list of strings
@return: A list of strings, one for each line in the buffer
"""
def asLines():
"""
Retrieve the contents of this Text buffer as a list of strings.
@rtype: list of strings
@return: A list of strings, one for each line in the buffer
"""
def makeCurrent():
"""
Display this text in the current 3d view if any
@rtype: None
@return: None
"""
def makeCurrent():
"""
Display this text in the current 3d view if any
@rtype: None
@return: None
"""
import id_generics
Text.__doc__ += id_generics.attributes

View File

@@ -9,278 +9,279 @@ Text3d Objects
This module provides access to B{Font} objects in Blender.
Example::
import Blender
from Blender import Curve, Object, Scene, Text3d
txt = Text3d.New("MyText") # create a new Text3d object called MyText
scn = Scene.GetCurrent() # get current scene
ob = scn.objects.new(txt) # create an object from the obdata in the current scene
ob.makeDisplayList() # rebuild the display list for this object
Window.RedrawAll()
import Blender
from Blender import Curve, Object, Scene, Text3d
txt = Text3d.New("MyText") # create a new Text3d object called MyText
scn = Scene.GetCurrent() # get current scene
ob = scn.objects.new(txt) # create an object from the obdata in the current scene
ob.makeDisplayList() # rebuild the display list for this object
Window.RedrawAll()
"""
def New (name = None):
"""
Create a new Text3d object.
@type name: string
@param name: The name for the new object..
@rtype: Blender Text3d
@return: The created Text3d Data object.
"""
"""
Create a new Text3d object.
@type name: string
@param name: The name for the new object..
@rtype: Blender Text3d
@return: The created Text3d Data object.
"""
def Get (name = None):
"""
Get the Text3d object(s) from Blender.
@type name: string
@param name: The name of the Text3d object.
@rtype: Blender Text3d or a list of Blender Text3ds
@return: It depends on the 'name' parameter:
- (name): The Text3d object with the given name;
- (): A list with all Text3d objects in the current scene.
"""
"""
Get the Text3d object(s) from Blender.
@type name: string
@param name: The name of the Text3d object.
@rtype: Blender Text3d or a list of Blender Text3d's
@return: It depends on the 'name' parameter:
- (name): The Text3d object with the given name;
- (): A list with all Text3d objects in the current scene.
"""
class Text3d:
"""
The Text3d object
=================
This object gives access Blender's B{Font} objects
@ivar name: The Text3d name.
@ivar filename: The filename of the file loaded into this Text.
@ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
@ivar nlines: The number of lines in this Text.
"""
"""
The Text3d object
=================
This object gives access Blender's B{Font} objects
@ivar filename: The filename of the file loaded into this Text.
@ivar mode: The follow_mode flag: if 1 it is 'on'; if 0, 'off'.
@ivar nlines: The number of lines in this Text.
"""
def getName():
"""
Get the name of this Text3d object.
@rtype: string
"""
def getName():
"""
Get the name of this Text3d object.
@rtype: string
"""
def setName( name ):
"""
Set the name of this Text3d object.
@type name: string
@param name: The new name.
@returns: None
"""
def setName( name ):
"""
Set the name of this Text3d object.
@type name: string
@param name: The new name.
@returns: None
"""
def getText():
"""
Get text string for this object
@rtype: string
"""
def getText():
"""
Get text string for this object
@rtype: string
"""
def setText( name ):
"""
Set the text string in this Text3d object
@type name: string
@param name: The new text string for this object.
@returns: None
"""
def getDrawMode():
"""
Get the drawing mode (3d, front, and/or back)
Gets the text3d's drawing modes. Uses module constants
- DRAW3D : "3D" is set
- DRAWFRONT : "Front" is set
- DRAWBACK : "Back" is set
@rtype: tuple of module constants
"""
def setText( name ):
"""
Set the text string in this Text3d object
@type name: string
@param name: The new text string for this object.
@returns: None
"""
def getDrawMode():
"""
Get the drawing mode (3d, front, and/or back)
Gets the text3d's drawing modes. Uses module constants
- DRAW3D : "3D" is set
- DRAWFRONT : "Front" is set
- DRAWBACK : "Back" is set
@rtype: tuple of module constants
"""
def setDrawMode(val):
"""
Set the text3d's drawing mode. Uses module constants
- DRAW3D
- DRAWFRONT
- DRAWBACK
@rtype: None
@type val: single module constant or tuple of module constants
@param val : The Text3d's modes. See L{getDrawMode} for the meaning of
the constants.
"""
def setDrawMode(val):
"""
Set the text3d's drawing mode. Uses module constants
- DRAW3D
- DRAWFRONT
- DRAWBACK
@rtype: None
@type val: single module constant or tuple of module constants
@param val : The Text3d's modes. See L{getDrawMode} for the meaning of
the constants.
"""
def getUVordco():
"""
Return whether UV coords are used for Texture mapping
"""
def setUVordco(val):
"""
Set the font to use UV coords for Texture mapping
"""
def getBevelAmount():
"""
Get the Text3d's bevel resolution value.
@rtype: float
"""
def getUVordco():
"""
Return whether UV coords are used for Texture mapping
"""
def setUVordco(val):
"""
Set the font to use UV coords for Texture mapping
"""
def getBevelAmount():
"""
Get the Text3d's bevel resolution value.
@rtype: float
"""
def setBevelAmount(bevelresol):
"""
Set the Text3d's bevel resolution value.
@rtype: None
@type bevelresol: float
@param bevelresol: The new Curve's bevel resolution value.
"""
def getDefaultResolution():
"""
Return Default text resolution.
@rtype: float
"""
def setBevelAmount(bevelresol):
"""
Set the Text3d's bevel resolution value.
@rtype: None
@type bevelresol: float
@param bevelresol: The new Curve's bevel resolution value.
"""
def setDefaultResolution(resolu):
"""
Sets Default text Resolution.
@rtype: None
@type resolu: float
@param resolu: The new Curve's U-resolution value.
"""
def getWidth():
"""
Get the Text3d's width value.
@rtype: float
"""
def getDefaultResolution():
"""
Return Default text resolution.
@rtype: float
"""
def setWidth(width):
"""
Set the Text3d's width value.
@rtype: None
@type width: float
@param width: The new text3d's width value.
"""
def setDefaultResolution(resolu):
"""
Sets Default text Resolution.
@rtype: None
@type resolu: float
@param resolu: The new Curve's U-resolution value.
"""
def getgetExtrudeDepth():
"""
Get the text3d's ext1 value.
@rtype: float
"""
def getWidth():
"""
Get the Text3d's width value.
@rtype: float
"""
def setgetExtrudeDepth(ext1):
"""
Set the text3d's ext1 value.
@rtype: None
@type ext1: float
@param ext1: The new text3d's ext1 value.
"""
def setWidth(width):
"""
Set the Text3d's width value.
@rtype: None
@type width: float
@param width: The new text3d's width value.
"""
def getExtrudeBevelDepth():
"""
Get the text3d's ext2 value.
@rtype: float
"""
def getgetExtrudeDepth():
"""
Get the text3d's ext1 value.
@rtype: float
"""
def setExtrudeBevelDepth(ext2):
"""
Set the text3d's ext2 value.
@rtype: None
@type ext2: float
@param ext2: The new text3d's ext2 value.
"""
def setgetExtrudeDepth(ext1):
"""
Set the text3d's ext1 value.
@rtype: None
@type ext1: float
@param ext1: The new text3d's ext1 value.
"""
def getShear():
"""
Get the text3d's shear value.
@rtype: float
"""
def getExtrudeBevelDepth():
"""
Get the text3d's ext2 value.
@rtype: float
"""
def setShear(shear):
"""
Set the text3d's shear value.
@rtype: None
@type shear: float
@param shear: The new text3d's shear value.
"""
def setExtrudeBevelDepth(ext2):
"""
Set the text3d's ext2 value.
@rtype: None
@type ext2: float
@param ext2: The new text3d's ext2 value.
"""
def getSize():
"""
Get the text3d's size value.
@rtype: float
"""
def getShear():
"""
Get the text3d's shear value.
@rtype: float
"""
def setSize(size):
"""
Set the text3d's size value.
@rtype: None
@type size: float
@param size: The new text3d's size value.
"""
def setShear(shear):
"""
Set the text3d's shear value.
@rtype: None
@type shear: float
@param shear: The new text3d's shear value.
"""
def getLineSeparation():
"""
Get the text3d's ext2 value.
@rtype: float
"""
def getSize():
"""
Get the text3d's size value.
@rtype: float
"""
def setLineSeparation(sep):
"""
Set the text3d's ext2 value.
@rtype: None
@type sep: float
@param sep: The new text3d's separation value.
"""
def setSize(size):
"""
Set the text3d's size value.
@rtype: None
@type size: float
@param size: The new text3d's size value.
"""
def getSpacing():
"""
Get the text3d's spacing value.
@rtype: float
"""
def getLineSeparation():
"""
Get the text3d's ext2 value.
@rtype: float
"""
def setSpacing(spacing):
"""
Set the text3d's spacing value.
@rtype: None
@type spacing: float
@param spacing: The new text3d's spacing value.
"""
def setLineSeparation(sep):
"""
Set the text3d's ext2 value.
@rtype: None
@type sep: float
@param sep: The new text3d's separation value.
"""
def getXoffset():
"""
Get the text3d's Xoffset value.
@rtype: float
"""
def getSpacing():
"""
Get the text3d's spacing value.
@rtype: float
"""
def setXoffset(xof):
"""
Set the text3d's Xoffset value.
@rtype: None
@type xof: float
@param xof: The new text3d's Xoffset value.
"""
def setSpacing(spacing):
"""
Set the text3d's spacing value.
@rtype: None
@type spacing: float
@param spacing: The new text3d's spacing value.
"""
def getYoffset():
"""
Get the text3d's Yoffset value.
@rtype: float
"""
def getXoffset():
"""
Get the text3d's Xoffset value.
@rtype: float
"""
def setYoffset(yof):
"""
Set the text3d's Yoffset value.
@rtype: None
@type yof: float
@param yof: The new text3d's Yoffset value.
"""
def setXoffset(xof):
"""
Set the text3d's Xoffset value.
@rtype: None
@type xof: float
@param xof: The new text3d's Xoffset value.
"""
def getAlignment():
"""
Get the text3d's alignment value. Uses module constants
- LEFT
- RIGHT
- MIDDLE
- FLUSH
@rtype: module constant
"""
def getYoffset():
"""
Get the text3d's Yoffset value.
@rtype: float
"""
def setAlignment(align):
"""
Set the text3d's Alignment value. Uses module constants
- LEFT
- RIGHT
- MIDDLE
- FLUSH
@rtype: None
@type align: module constant
@param align: The new text3d's Alignment value.
"""
def setYoffset(yof):
"""
Set the text3d's Yoffset value.
@rtype: None
@type yof: float
@param yof: The new text3d's Yoffset value.
"""
def getAlignment():
"""
Get the text3d's alignment value. Uses module constants
- LEFT
- RIGHT
- MIDDLE
- FLUSH
@rtype: module constant
"""
def setAlignment(align):
"""
Set the text3d's Alignment value. Uses module constants
- LEFT
- RIGHT
- MIDDLE
- FLUSH
@rtype: None
@type align: module constant
@param align: The new text3d's Alignment value.
"""
import id_generics
Text3d.__doc__ += id_generics.attributes

View File

@@ -8,8 +8,8 @@
The Blender.Texture submodule.
B{New}:
- many new attributes in L{MTex} submodule
- new dictionaries (L{Texture.BlendModes}, L{Texture.Mappings}, L{Texture.Proj}) to use for the values of some of the new L{MTex} attributes.
- many new attributes in L{MTex} submodule
- new dictionaries (L{Texture.BlendModes}, L{Texture.Mappings}, L{Texture.Proj}) to use for the values of some of the new L{MTex} attributes.
Texture
=======
@@ -17,244 +17,242 @@ Texture
This module provides access to B{Texture} objects in Blender.
Example::
from Blender import Texture,Image,Material
footex = Texture.Get('foo') # get texture named 'foo'
footex.setType('Image') # make foo be an image texture
img = Image.Load('test.png') # load an image
footex.image = img # link the image to the texture
from Blender import Texture,Image,Material
footex = Texture.Get('foo') # get texture named 'foo'
footex.setType('Image') # make foo be an image texture
img = Image.Load('test.png') # load an image
footex.image = img # link the image to the texture
mat = Material.Get('bar') # get a material
mtextures = mat.getTextures() # get a list of the MTex objects
for mtex in mtextures:
if mtex.tex.type == Texture.Types.IMAGE:
print mtex.tex.image.filename # print the filenames of all the
# images in textures linked to "bar"
mat = Material.Get('bar') # get a material
mtextures = mat.getTextures() # get a list of the MTex objects
for mtex in mtextures:
if mtex.tex.type == Texture.Types.IMAGE:
print mtex.tex.image.filename # print the filenames of all the
# images in textures linked to "bar"
mat.setTexture(0, footex) # set the material's first texture
# to be our texture
mat.setTexture(0, footex) # set the material's first texture
# to be our texture
@type Types: readonly dictionary
@var Types: The available texture types:
- NONE - No texture
- CLOUDS - Clouds texture
- WOOD - Wood texture
- MARBLE - Marble texture
- MAGIC - Magic texture
- BLEND - Blend texture
- STUCCI - Stucci texture
- NOISE - Noise texture
- IMAGE - Image texture
- PLUGIN - Plugin texture
- ENVMAP - EnvMap texture
- MUSGRAVE - Musgrave procedural texture
- VORONOI - Voronoi procedural texture
- DISTNOISE - Distorted noise texture
- NONE - No texture
- CLOUDS - Clouds texture
- WOOD - Wood texture
- MARBLE - Marble texture
- MAGIC - Magic texture
- BLEND - Blend texture
- STUCCI - Stucci texture
- NOISE - Noise texture
- IMAGE - Image texture
- PLUGIN - Plugin texture
- ENVMAP - EnvMap texture
- MUSGRAVE - Musgrave procedural texture
- VORONOI - Voronoi procedural texture
- DISTNOISE - Distorted noise texture
@type Flags: readonly dictionary
@var Flags: The available Texture flags:
- FLIPBLEND - Flips the blend texture's X and Y directions
- NEGALPHA - Reverse the alpha value
- CHECKER_ODD - Fill the "odd" checkerboard tiles
- CHECKER_EVEN - Fill the "even" checkerboard tiles
- FLIPBLEND - Flips the blend texture's X and Y directions
- NEGALPHA - Reverse the alpha value
- CHECKER_ODD - Fill the "odd" checkerboard tiles
- CHECKER_EVEN - Fill the "even" checkerboard tiles
@type ImageFlags: readonly dictionary
@var ImageFlags: The available image flags for Texture.imageFlags:
- INTERPOL - Interpolate pixels of the image
- USEALPHA - Use the alpha layer
- MIPMAP - Enable mipmapping [cannot be used with FIELDS]
- FIELDS - Work with field images [cannot be used with MIPMAP]
- ROT90 - Rotate the image 90 degrees when rendering
- CALCALPHA - Calculate an alpha from the RGB
- STFIELD - Denotes this is a standard field
- MOVIE - Use a movie for an image
- CYCLIC - Repeat animation image
- ANTI - Use anti-aliasing
- NORMALMAP - Use image RGB values for normal mapping
- INTERPOL - Interpolate pixels of the image
- USEALPHA - Use the alpha layer
- MIPMAP - Enable mipmapping [cannot be used with FIELDS]
- FIELDS - Work with field images [cannot be used with MIPMAP]
- ROT90 - Rotate the image 90 degrees when rendering
- CALCALPHA - Calculate an alpha from the RGB
- STFIELD - Denotes this is a standard field
- MOVIE - Use a movie for an image
- CYCLIC - Repeat animation image
- ANTI - Use anti-aliasing
- NORMALMAP - Use image RGB values for normal mapping
@type ExtendModes: readonly dictionary
@var ExtendModes: Extend, clip, repeat or checker modes for image textures
- EXTEND - Extends the colour of the edge
- CLIP - Return alpha 0.0 outside image
- CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
- REPEAT - Repeat image vertically and horizontally
- CHECKER - Repeat image in checkerboard pattern
- EXTEND - Extends the colour of the edge
- CLIP - Return alpha 0.0 outside image
- CLIPCUBE - Return alpha 0.0 around cube-shaped area around image
- REPEAT - Repeat image vertically and horizontally
- CHECKER - Repeat image in checkerboard pattern
@type Noise: readonly dictionary
@var Noise: Noise types and bases. SINE, SAW and TRI are only used for
marble and wood textures, while the remainder are used for all textures
which has a noise basis function (for these textures, the constant should
be used with the second noise basis setting).
- SINE - Produce bands using sine wave (marble, wood textures)
- SAW - Produce bands using saw wave (marble, wood textures)
- TRI - Produce bands using triangle wave (marble, wood textures)
- BLENDER - Original Blender algorithm
- PERLIN - Ken Perlin's original (1985) algorithm
- IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
- VORONOIF1 - none
- VORONOIF2 - none
- VORONOIF3 - none
- VORONOIF4 - none
- VORONOIF2F1 - none
- VORONOICRACKLE - none
- CELLNOISE - Steven Worley's cellular basis algorithm (1996)
marble and wood textures, while the remainder are used for all textures
which has a noise basis function (for these textures, the constant should
be used with the second noise basis setting).
- SINE - Produce bands using sine wave (marble, wood textures)
- SAW - Produce bands using saw wave (marble, wood textures)
- TRI - Produce bands using triangle wave (marble, wood textures)
- BLENDER - Original Blender algorithm
- PERLIN - Ken Perlin's original (1985) algorithm
- IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
- VORONOIF1 - none
- VORONOIF2 - none
- VORONOIF3 - none
- VORONOIF4 - none
- VORONOIF2F1 - none
- VORONOICRACKLE - none
- CELLNOISE - Steven Worley's cellular basis algorithm (1996)
@type BlendModes: readonly dictionary
@var BlendModes: The available texture blending modes:
- MIX - mix texture with value
- MULTIPLY - multiply texture with value
- ADD - add texture to value
- SUBTRACT - subtract texture from value
- DIVIDE - divide value by texture
- DARKEN - replace value with texture if texture is darker
- DIFFERENCE - difference of texture from value
- LIGHTEN - replace value with texture if texture is lighter
- SCREEN - 'screen' mode
- MIX - mix texture with value
- MULTIPLY - multiply texture with value
- ADD - add texture to value
- SUBTRACT - subtract texture from value
- DIVIDE - divide value by texture
- DARKEN - replace value with texture if texture is darker
- DIFFERENCE - difference of texture from value
- LIGHTEN - replace value with texture if texture is lighter
- SCREEN - 'screen' mode
@type Mappings: readonly dictionary
@var Mappings: The available 2D texture coordinate mappings for images:
- FLAT - flat projection
- CUBE - cube projection
- TUBE - cylindrical projection
- SPHERE - spherical projection
- FLAT - flat projection
- CUBE - cube projection
- TUBE - cylindrical projection
- SPHERE - spherical projection
@type Proj: readonly dictionary
@var Proj: The available projections per axis:
- NONE - axis isn't used
- X - axis is used as final x axis
- Y - axis is used as final y axis
- Z - axis is used as final z axis
- NONE - axis isn't used
- X - axis is used as final x axis
- Y - axis is used as final y axis
- Z - axis is used as final z axis
@type STypes: readonly dictionary
@var STypes: Texture-type specific data. Depending on the value of
Texture.type, certain groups will make sense. For instance, when a texture
is of type CLOUD, the CLD_xxx stypes can be used. Note that the first
value in each group is the default.
1. Clouds type
- CLD_DEFAULT - Monochromatic noise
- CLD_COLOR - RGB noise
2. Wood type
- WOD_BANDS - Use standard wood texture
- WOD_RINGS - Use wood rings
- WOD_BANDNOISE - Add noise to standard wood
- WOD_RINGNOISE - Add noise to rings
3. Magic type
- MAG_DEFAULT - Magic has no STypes
4. Marble type
- MBL_SOFT - Use soft marble
- MBL_SHARP - Use more clearly defined marble
- MBL_SHARPER - Use very clearly dfefined marble
5. Blend type
- BLN_LIN - Use a linear progression
- BLN_QUAD - Use a quadratic progression
- BLN_EASE - Uses a more complicated blend function
- BLN_DIAG - Use a diagonal progression
- BLN_SPHERE - Use a progression with the shape of a sphere
- BLN_HALO - Use a quadratic progression with the shape of a sphere
6. Stucci type
- STC_PLASTIC - Standard stucci
- STC_WALLIN - Creates dimples
- STC_WALLOUT - Creates ridges
7. Noise type
- NSE_DEFAULT - Noise has no STypes
8. Image type
- IMG_DEFAULT - Image has no STypes
9. Plugin type
- PLG_DEFAULT - Plugin has no STypes
10. Envmap type
- ENV_STATIC - Calculate map only once
- ENV_ANIM - Calculate map each rendering
- ENV_LOAD - Load map from disk
11. Musgrave type
- MUS_MFRACTAL - Hetero Multifractal
- MUS_RIDGEDMF - Ridged Multifractal
- MUS_HYBRIDMF - Hybrid Multifractal
- MUS_FBM - Fractal Brownian Motion
- MUS_HTERRAIN - Hetero Terrain
12. Voronoi type
- VN_INT - Only calculate intensity
- VN_COL1 - Color cells by position
- VN_COL2 - Same as Col1 plus outline based on F2-F1
- VN_COL3 - Same as Col2 multiplied by intensity
13. Distorted noise type
- DN_BLENDER - Original Blender algorithm
- DN_PERLIN - Ken Perlin's original (1985) algorithm
- DN_IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
- DN_VORONOIF1 - none
- DN_VORONOIF2 - none
- DN_VORONOIF3 - none
- DN_VORONOIF4 - none
- DN_VORONOIF2F1 - none
- DN_VORONOICRACKLE - none
- DN_CELLNOISE - Steven Worley's cellular basis algorithm (1996)
Texture.type, certain groups will make sense. For instance, when a texture
is of type CLOUD, the CLD_xxx stypes can be used. Note that the first
value in each group is the default.
1. Clouds type
- CLD_DEFAULT - Monochromatic noise
- CLD_COLOR - RGB noise
2. Wood type
- WOD_BANDS - Use standard wood texture
- WOD_RINGS - Use wood rings
- WOD_BANDNOISE - Add noise to standard wood
- WOD_RINGNOISE - Add noise to rings
3. Magic type
- MAG_DEFAULT - Magic has no STypes
4. Marble type
- MBL_SOFT - Use soft marble
- MBL_SHARP - Use more clearly defined marble
- MBL_SHARPER - Use very clearly dfefined marble
5. Blend type
- BLN_LIN - Use a linear progression
- BLN_QUAD - Use a quadratic progression
- BLN_EASE - Uses a more complicated blend function
- BLN_DIAG - Use a diagonal progression
- BLN_SPHERE - Use a progression with the shape of a sphere
- BLN_HALO - Use a quadratic progression with the shape of a sphere
6. Stucci type
- STC_PLASTIC - Standard stucci
- STC_WALLIN - Creates dimples
- STC_WALLOUT - Creates ridges
7. Noise type
- NSE_DEFAULT - Noise has no STypes
8. Image type
- IMG_DEFAULT - Image has no STypes
9. Plugin type
- PLG_DEFAULT - Plugin has no STypes
10. Envmap type
- ENV_STATIC - Calculate map only once
- ENV_ANIM - Calculate map each rendering
- ENV_LOAD - Load map from disk
11. Musgrave type
- MUS_MFRACTAL - Hetero Multifractal
- MUS_RIDGEDMF - Ridged Multifractal
- MUS_HYBRIDMF - Hybrid Multifractal
- MUS_FBM - Fractal Brownian Motion
- MUS_HTERRAIN - Hetero Terrain
12. Voronoi type
- VN_INT - Only calculate intensity
- VN_COL1 - Color cells by position
- VN_COL2 - Same as Col1 plus outline based on F2-F1
- VN_COL3 - Same as Col2 multiplied by intensity
13. Distorted noise type
- DN_BLENDER - Original Blender algorithm
- DN_PERLIN - Ken Perlin's original (1985) algorithm
- DN_IMPROVEDPERLIN - Ken Perlin's newer (2002) algorithm
- DN_VORONOIF1 - none
- DN_VORONOIF2 - none
- DN_VORONOIF3 - none
- DN_VORONOIF4 - none
- DN_VORONOIF2F1 - none
- DN_VORONOICRACKLE - none
- DN_CELLNOISE - Steven Worley's cellular basis algorithm (1996)
@var TexCo: Flags for MTex.texco.
- ORCO - Use the original coordinates of the mesh
- REFL - Use reflection vector as texture coordinates
- NOR - Use normal vector as texture coordinates
- GLOB - Use global coordinates for the texture coordinates
- UV - Use UV coordinates for texture coordinates
- OBJECT - Use linked object's coordinates for texture coordinates
- WIN - Use screen coordinates as texture coordinates
- VIEW - Pass camera view vector on to the texture (World texture only!)
- STICK - Use mesh sticky coordinates for the texture coordinates
- STRESS - Use mesh stress coordinates for the texture coordinates
- TANGENT - Use mesh tangent coordinates for the texture coordinates
- ORCO - Use the original coordinates of the mesh
- REFL - Use reflection vector as texture coordinates
- NOR - Use normal vector as texture coordinates
- GLOB - Use global coordinates for the texture coordinates
- UV - Use UV coordinates for texture coordinates
- OBJECT - Use linked object's coordinates for texture coordinates
- WIN - Use screen coordinates as texture coordinates
- VIEW - Pass camera view vector on to the texture (World texture only!)
- STICK - Use mesh sticky coordinates for the texture coordinates
- STRESS - Use mesh stress coordinates for the texture coordinates
- TANGENT - Use mesh tangent coordinates for the texture coordinates
@type TexCo: readonly dictionary
@var MapTo: Flags for MTex.mapto.
- COL - Make the texture affect the basic colour of the material
- NOR - Make the texture affect the rendered normal
- CSP - Make the texture affect the specularity colour
- CMIR - Make the texture affect the mirror colour
- REF - Make the texture affect the diffuse reflectivity value
- SPEC - Make the texture affect the specularity value
- HARD - Make the texture affect the hardness value
- ALPHA - Make the texture affect the alpha value
- EMIT - Make the texture affect the emit value
- RAYMIR - Make the texture affect the mirror reflectivity value
- DISP - Make the texture displace the mesh
- TRANSLU - Make the texture affect the translucency value
- AMB - Make the texture affect the ambient value
- WARP - Make the texture affect texture coordinates for the following textures
- COL - Make the texture affect the basic colour of the material
- NOR - Make the texture affect the rendered normal
- CSP - Make the texture affect the specularity colour
- CMIR - Make the texture affect the mirror colour
- REF - Make the texture affect the diffuse reflectivity value
- SPEC - Make the texture affect the specularity value
- HARD - Make the texture affect the hardness value
- ALPHA - Make the texture affect the alpha value
- EMIT - Make the texture affect the emit value
- RAYMIR - Make the texture affect the mirror reflectivity value
- DISP - Make the texture displace the mesh
- TRANSLU - Make the texture affect the translucency value
- AMB - Make the texture affect the ambient value
- WARP - Make the texture affect texture coordinates for the following textures
@type MapTo: readonly dictionary
"""
def New (name = 'Tex'):
"""
Create a new Texture object.
@type name: string
@param name: The Texture name.
@rtype: Blender Texture
@return: The created Texture object.
"""
"""
Create a new Texture object.
@type name: string
@param name: The Texture name.
@rtype: Blender Texture
@return: The created Texture object.
"""
def Get (name = None):
"""
Get the Texture object(s) from Blender.
@type name: string
@param name: The name of the Texture.
@rtype: Blender Texture or a list of Blender Textures
@return: It depends on the I{name} parameter:
- (name): The Texture object with the given I{name};
- (): A list with all Texture objects in the current scene.
"""
"""
Get the Texture object(s) from Blender.
@type name: string
@param name: The name of the Texture.
@rtype: Blender Texture or a list of Blender Textures
@return: It depends on the I{name} parameter:
- (name): The Texture object with the given I{name};
- (): A list with all Texture objects in the current scene.
"""
from IDProp import IDGroup, IDArray
class Texture:
"""
The Texture object
==================
This object gives access to Texture-specific data in Blender.
"""
The Texture object
==================
This object gives access to Texture-specific data in Blender.
Note that many of the attributes of this object are only relevant for
specific texture types.
Note that many of the attributes of this object are only relevant for
specific texture types.
@ivar properties: Returns an L{IDGroup<IDProp.IDGroup>} reference to this texture's ID Properties.
@type properties: L{IDGroup<IDProp.IDGroup>}
@ivar animFrames: Number of frames of a movie to use.
Value is clamped to the range [0,30000].
@type animFrames: int
@@ -326,8 +324,6 @@ class Texture:
@type mipmap: int
@ivar movie: Movie frames as images enabled. Also see L{ImageFlags}.
@type movie: int
@ivar name: Texture data name.
@type name: string
@ivar noiseBasis: Noise basis type (wood, stucci, marble, clouds,
Musgrave, distorted). See L{Noise} dictionary.
@type noiseBasis: int
@@ -373,8 +369,6 @@ class Texture:
@type type: int
@ivar useAlpha: Use of image's alpha channel enabled. Also see L{ImageFlags}.
@type useAlpha: int
@ivar users: Number of texture users. Read-only.
@type users: int
@ivar weight1: Weight 1 (for Voronoi textures).
Value is clamped to the range [-2.0,2.0].
@type weight1: float
@@ -387,160 +381,161 @@ class Texture:
@ivar weight4: Weight 4 (for Voronoi textures).
Value is clamped to the range [-2.0,2.0].
@type weight4: float
"""
def getExtend():
"""
Get the extend mode of the texture. See L{setExtend}.
@rtype: string.
"""
def getImage():
"""
Get the Image associated with this texture (or None).
@rtype: Blender Image
"""
"""
def getExtend():
"""
Get the extend mode of the texture. See L{setExtend}.
@rtype: string.
"""
def getImage():
"""
Get the Image associated with this texture (or None).
@rtype: Blender Image
"""
def getName():
"""
Get the name of this Texture object.
@rtype: string
"""
def getName():
"""
Get the name of this Texture object.
@rtype: string
"""
def getType():
"""
Get this Texture's type. See L{setType}.
@rtype: string
"""
def getType():
"""
Get this Texture's type. See L{setType}.
@rtype: string
"""
def setExtend(extendmode):
"""
Set the extend mode of this texture (only used for IMAGE textures)
@param extendmode: The new extend mode. One of:
'Extend', 'Clip', 'ClipCube' and 'Repeat'
@type extendmode: string
"""
def setExtend(extendmode):
"""
Set the extend mode of this texture (only used for IMAGE textures)
@param extendmode: The new extend mode. One of:
'Extend', 'Clip', 'ClipCube' and 'Repeat'
@type extendmode: string
"""
def setFlags(f1=None, f2=None, f3=None, f4=None):
"""
Set this object's flags.
@param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of
'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
@type f1,f2,f3,f4: string
"""
def setImage(image):
"""
Set the Image of this texture.
@param image: The new Image.
@type image: Blender Image
@warning: This sets the texture's type to 'Image' if it is not already.
"""
def setFlags(f1=None, f2=None, f3=None, f4=None):
"""
Set this object's flags.
@param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of
'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
@type f1,f2,f3,f4: string
"""
def setImageFlags(f1=None, f2=None, f3=None, etc=None):
"""
Set the Image flags (only makes sense for IMAGE textures). Omitted
flags are cleared.
@param f1, f2, f3, etc: Flag to set. See L{ImageFlags} for their meanings. Can be
any of: 'InterPol', 'UseAlpha', 'MipMap', 'Fields', 'Rot90',
'CalcAlpha', 'Cyclic', 'Movie', 'StField', 'Anti' and 'NormalMap'
@type f1, f2, f3, etc: string
"""
def setName(name):
"""
Set the name of this Texture object.
@param name: The new name.
@type name: string
"""
def setImage(image):
"""
Set the Image of this texture.
@param image: The new Image.
@type image: Blender Image
@warning: This sets the texture's type to 'Image' if it is not already.
"""
def setSType(stype):
"""
Set the SType.
@param stype: The new stype. This can be any of the values listed in
L{STypes} or 'Default' which sets the stype to the default value.
@type stype: string
def setImageFlags(f1=None, f2=None, f3=None, etc=None):
"""
Set the Image flags (only makes sense for IMAGE textures). Omitted
flags are cleared.
@param f1, f2, f3, etc: Flag to set. See L{ImageFlags} for their meanings. Can be
any of: 'InterPol', 'UseAlpha', 'MipMap', 'Fields', 'Rot90',
'CalcAlpha', 'Cyclic', 'Movie', 'StField', 'Anti' and 'NormalMap'
@type f1, f2, f3, etc: string
"""
@note: the set of valid parameters is dependent on the current
texture type. Be sure to always set the texture type B{before}
setting the texture's stype; otherwise an exception might occur.
"""
def setName(name):
"""
Set the name of this Texture object.
@param name: The new name.
@type name: string
"""
def setType(type):
"""
Set this Texture's type.
@param type: The new type. Possible options are:
'None', 'Clouds', 'Wood', 'Marble', 'Magic', 'Blend', 'Stucci',
'Noise', 'Image', 'Plugin', 'EnvMap', 'Musgrave', 'Voronoi'
and 'DistNoise'
@type type: string
"""
def setSType(stype):
"""
Set the SType.
@param stype: The new stype. This can be any of the values listed in
L{STypes} or 'Default' which sets the stype to the default value.
@type stype: string
@note: the set of valid parameters is dependent on the current
texture type. Be sure to always set the texture type B{before}
setting the texture's stype; otherwise an exception might occur.
"""
def setType(type):
"""
Set this Texture's type.
@param type: The new type. Possible options are:
'None', 'Clouds', 'Wood', 'Marble', 'Magic', 'Blend', 'Stucci',
'Noise', 'Image', 'Plugin', 'EnvMap', 'Musgrave', 'Voronoi'
and 'DistNoise'
@type type: string
"""
import id_generics
Texture.__doc__ += id_generics.attributes
class MTex:
"""
The MTex Object
===============
"""
The MTex Object
===============
This object links a material to a texture. It allows the same texture to be
used in several different ways.
This object links a material to a texture. It allows the same texture to be
used in several different ways.
@ivar tex: The Texture this is linked to.
@type tex: Blender Texture
@ivar texco: Texture coordinates ("Map input"). See L{TexCo}
@ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}
@ivar object: Object whose space to use when texco is Object
@type object: Blender Object
@ivar col: Color that the texture blends with
@ivar dvar: Value that the texture blends with when not blending colors
@ivar blendmode: Texture blending mode. L{BlendModes}
@ivar colfac: Factor by which texture affects color
@ivar norfac: Factor by which texture affects normal
@ivar varfac: Factor by which texture affects most variables
@ivar dispfac: Factor by which texture affects displacement
@ivar warpfac: Factor by which texture affects warp
@ivar ofs: Offset to adjust texture space
@ivar size: Size to scale texture space
@ivar mapping: Mapping of texture coordinates (flat, cube, etc.). L{Mappings}
@ivar stencil: Stencil mode
@ivar neg: Negate texture values mode
@ivar noRGB: Convert texture RGB values to intensity values
@ivar correctNor: Correct normal mapping for Texture space and Object space
@ivar xproj: Projection of X axis to Texture space. L{Proj}
@ivar yproj: Projection of Y axis to Texture space. L{Proj}
@ivar zproj: Projection of Z axis to Texture space. L{Proj}
@ivar mtCol: How texture maps to color
@ivar mtNor: How texture maps to normals
@ivar mtCsp: How texture maps to specularity color
@ivar mtCmir: How texture maps to mirror color
@ivar mtRef: How texture maps to reflectivity
@ivar mtSpec: How texture maps to specularity
@ivar mtEmit: How texture maps to emit value
@ivar mtAlpha: How texture maps to alpha value
@ivar mtHard: How texture maps to hardness
@ivar mtRayMir: How texture maps to RayMir value
@ivar mtTranslu: How texture maps to translucency
@ivar mtAmb: How texture maps to ambient value
@ivar mtDisp: How texture maps to displacement
@ivar mtWarp: How texture maps to warp
"""
@ivar tex: The Texture this is linked to.
@type tex: Blender Texture
@ivar texco: Texture coordinates ("Map input"). See L{TexCo}
@ivar mapto: "Map to" field of texture. OR'd values of L{MapTo}
@ivar object: Object whose space to use when texco is Object
@type object: Blender Object
@ivar col: Color that the texture blends with
@ivar dvar: Value that the texture blends with when not blending colors
@ivar blendmode: Texture blending mode. L{BlendModes}
@ivar colfac: Factor by which texture affects color
@ivar norfac: Factor by which texture affects normal
@ivar varfac: Factor by which texture affects most variables
@ivar dispfac: Factor by which texture affects displacement
@ivar warpfac: Factor by which texture affects warp
@ivar ofs: Offset to adjust texture space
@ivar size: Size to scale texture space
@ivar mapping: Mapping of texture coordinates (flat, cube, etc.). L{Mappings}
@ivar stencil: Stencil mode
@ivar neg: Negate texture values mode
@ivar noRGB: Convert texture RGB values to intensity values
@ivar correctNor: Correct normal mapping for Texture space and Object space
@ivar xproj: Projection of X axis to Texture space. L{Proj}
@ivar yproj: Projection of Y axis to Texture space. L{Proj}
@ivar zproj: Projection of Z axis to Texture space. L{Proj}
@ivar mtCol: How texture maps to color
@ivar mtNor: How texture maps to normals
@ivar mtCsp: How texture maps to specularity color
@ivar mtCmir: How texture maps to mirror color
@ivar mtRef: How texture maps to reflectivity
@ivar mtSpec: How texture maps to specularity
@ivar mtEmit: How texture maps to emit value
@ivar mtAlpha: How texture maps to alpha value
@ivar mtHard: How texture maps to hardness
@ivar mtRayMir: How texture maps to RayMir value
@ivar mtTranslu: How texture maps to translucency
@ivar mtAmb: How texture maps to ambient value
@ivar mtDisp: How texture maps to displacement
@ivar mtWarp: How texture maps to warp
"""
def getIpo():
"""
Get the Ipo associated with this texture object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def getIpo():
"""
Get the Ipo associated with this texture object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def setIpo(ipo):
"""
Link an ipo to this texture object.
@type ipo: Blender Ipo
@param ipo: a "texture data" ipo.
"""
def setIpo(ipo):
"""
Link an ipo to this texture object.
@type ipo: Blender Ipo
@param ipo: a "texture data" ipo.
"""
def clearIpo():
"""
Unlink the ipo from this texture object.
@return: True if there was an ipo linked or False otherwise.
"""
def clearIpo():
"""
Unlink the ipo from this texture object.
@return: True if there was an ipo linked or False otherwise.
"""

View File

@@ -11,339 +11,341 @@ World
The module world allows you to access all the data of a Blender World.
Example::
import Blender
w = Blender.Get('World') #assume there exists a world named "world"
print w.getName()
w.hor = [1,1,.2]
print w.getHor()
import Blender
w = Blender.Get('World') #assume there exists a world named "world"
print w.getName()
w.hor = [1,1,.2]
print w.getHor()
Example::
import Blender
from Blender import *
import Blender
from Blender import *
AllWorlds = Blender.World.Get() # returns a list of created world objects
AvailWorlds = len(AllWorlds) # returns the number of available world objects
PropWorld = dir(AllWorlds[0]) # returns the properties of the class world
NameWorld = AllWorlds[0].getName() # get name of the first world object
AllWorlds = Blender.World.Get() # returns a list of created world objects
AvailWorlds = len(AllWorlds) # returns the number of available world objects
PropWorld = dir(AllWorlds[0]) # returns the properties of the class world
NameWorld = AllWorlds[0].getName() # get name of the first world object
MiType = AllWorlds[0].getMistype() # get kind of mist from the first world object
MiParam = AllWorlds[0].getMist() # get the parameters intensity, start, end and height of the mist
MiType = AllWorlds[0].getMistype() # get kind of mist from the first world object
MiParam = AllWorlds[0].getMist() # get the parameters intensity, start, end and height of the mist
HorColor = AllWorlds[0].getHor() # horizon color of the first world object
HorColorR = HorColor[0] # get the red channel (RGB) of the horizon color
HorColor = AllWorlds[0].getHor() # horizon color of the first world object
HorColorR = HorColor[0] # get the red channel (RGB) of the horizon color
ZenColor = AllWorlds[0].getZen() # zenith color of the first world object
ZenColorB = ZenColor[2] # get the blue channel (RGB) of the Zenith color
ZenColor = AllWorlds[0].getZen() # zenith color of the first world object
ZenColorB = ZenColor[2] # get the blue channel (RGB) of the Zenith color
blending = AllWorlds[0].getSkytype() # get the blending modes (real, blend, paper) of the first world object
blending = AllWorlds[0].getSkytype() # get the blending modes (real, blend, paper) of the first world object
"""
def New (name):
"""
Creates a new World.
@type name: string
@param name: World's name (optional).
@rtype: Blender World
@return: The created World. If the "name" parameter has not been provided, it will be automatically be set by blender.
"""
"""
Creates a new World.
@type name: string
@param name: World's name (optional).
@rtype: Blender World
@return: The created World. If the "name" parameter has not been provided, it will be automatically be set by blender.
"""
def Get (name):
"""
Get an World from Blender.
@type name: string
@param name: The name of the world to retrieve.
@rtype: Blender World or a list of Blender Worlds
@return:
- (name): The World corresponding to the name
- (): A list with all Worlds in the current scene.
"""
"""
Get an World from Blender.
@type name: string
@param name: The name of the world to retrieve.
@rtype: Blender World or a list of Blender Worlds
@return:
- (name): The World corresponding to the name
- (): A list with all Worlds in the current scene.
"""
def GetCurrent ():
"""
Get the active world of the scene.
@rtype: Blender World or None
"""
"""
Get the active world of the scene.
@rtype: Blender World or None
"""
class World:
"""
The World object
================
This object gives access to generic data from all worlds in Blender.
Its attributes depend upon its type.
"""
The World object
================
This object gives access to generic data from all worlds in Blender.
Its attributes depend upon its type.
@ivar name: the name of the world.
@ivar skytype: type of the sky. Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper.
@ivar mode:
@ivar mistype: type of mist : O : quadratic; 1 : linear; 2 : square
@ivar hor: the horizon color of a world object.
@ivar zen: the zenith color of a world object.
@ivar amb: the ambient color of a world object.
@ivar star: the star parameters of a world object. See getStar for the semantics of these parameters.
@ivar mist: the mist parameters of a world object. See getMist for the semantics of these parameters.
@type ipo: Blender Ipo
@ivar ipo: The world type ipo linked to this world object.
"""
def getRange():
"""
Retrieves the range parameter of a world object.
@rtype: float
@return: the range
"""
@ivar skytype: type of the sky. Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper.
@ivar mode:
@ivar mistype: type of mist : O : quadratic; 1 : linear; 2 : square
@ivar hor: the horizon color of a world object.
@ivar zen: the zenith color of a world object.
@ivar amb: the ambient color of a world object.
@ivar star: the star parameters of a world object. See getStar for the semantics of these parameters.
@ivar mist: the mist parameters of a world object. See getMist for the semantics of these parameters.
@type ipo: Blender Ipo
@ivar ipo: The world type ipo linked to this world object.
"""
def setRange(range):
"""
Sets the range parameter of a world object.
@type range: float
@param range: the new range parameter
@rtype: None
@return: None
"""
def getRange():
"""
Retrieves the range parameter of a world object.
@rtype: float
@return: the range
"""
def getName():
"""
Retrieves the name of a world object
@rtype: string
@return: the name of the world object.
"""
def setRange(range):
"""
Sets the range parameter of a world object.
@type range: float
@param range: the new range parameter
@rtype: None
@return: None
"""
def setName(name):
"""
Sets the name of a world object.
@type name: string
@param name : the new name.
@rtype: None
@return: None
"""
def getName():
"""
Retrieves the name of a world object
@rtype: string
@return: the name of the world object.
"""
def getIpo():
"""
Get the Ipo associated with this world object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def setName(name):
"""
Sets the name of a world object.
@type name: string
@param name : the new name.
@rtype: None
@return: None
"""
def setIpo(ipo):
"""
Link an ipo to this world object.
@type ipo: Blender Ipo
@param ipo: a "camera data" ipo.
"""
def getIpo():
"""
Get the Ipo associated with this world object, if any.
@rtype: Ipo
@return: the wrapped ipo or None.
"""
def clearIpo():
"""
Unlink the ipo from this world object.
@return: True if there was an ipo linked or False otherwise.
"""
def setIpo(ipo):
"""
Link an ipo to this world object.
@type ipo: Blender Ipo
@param ipo: a "camera data" ipo.
"""
def getSkytype():
"""
Retrieves the skytype of a world object.
The skytype is a combination of 3 bits : Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper.
@rtype: int
@return: the skytype of the world object.
"""
def clearIpo():
"""
Unlink the ipo from this world object.
@return: True if there was an ipo linked or False otherwise.
"""
def setSkytype(skytype):
"""
Sets the skytype of a world object.
See getSkytype for the semantics of the parameter.
@type skytype: int
@param skytype : the new skytype.
@rtype: None
@return: None
"""
def getSkytype():
"""
Retrieves the skytype of a world object.
The skytype is a combination of 3 bits : Bit 0 : Blend; Bit 1 : Real; Bit 2 : paper.
@rtype: int
@return: the skytype of the world object.
"""
def getMode():
"""
Retrieves the mode of a world object.
The mode is a combination of 5 bits:
- Bit 0 : mist simulation
- Bit 1 : starfield simulation
- Bit 2,3 : reserved
- Bit 4 : ambient occlusion
@rtype: int
@return: the mode of the world object.
"""
def setSkytype(skytype):
"""
Sets the skytype of a world object.
See getSkytype for the semantics of the parameter.
@type skytype: int
@param skytype : the new skytype.
@rtype: None
@return: None
"""
def setMode(mode):
"""
Sets the mode of a world object.
See getMode for the semantics of the parameter.
@type mode: int
@param mode : the new mode.
@rtype: None
@return: None
"""
def getMode():
"""
Retrieves the mode of a world object.
The mode is a combination of 5 bits:
- Bit 0 : mist simulation
- Bit 1 : starfield simulation
- Bit 2,3 : reserved
- Bit 4 : ambient occlusion
@rtype: int
@return: the mode of the world object.
"""
def getMistype():
"""
Retrieves the mist type of a world object.
The mist type is an integer 0 : quadratic; 1 : linear; 2 : square.
@rtype: int
@return: the mistype of the world object.
"""
def setMode(mode):
"""
Sets the mode of a world object.
See getMode for the semantics of the parameter.
@type mode: int
@param mode : the new mode.
@rtype: None
@return: None
"""
def setMistype(mistype):
"""
Sets the mist type of a world object.
See getMistype for the semantics of the parameter.
@type mistype: int
@param mistype : the new mist type.
@rtype: None
@return: None
"""
def getMistype():
"""
Retrieves the mist type of a world object.
The mist type is an integer 0 : quadratic; 1 : linear; 2 : square.
@rtype: int
@return: the mistype of the world object.
"""
def getHor():
"""
Retrieves the horizon color of a world object.
This color is a list of 3 floats.
@rtype: list of three floats
@return: the horizon color of the world object.
"""
def setMistype(mistype):
"""
Sets the mist type of a world object.
See getMistype for the semantics of the parameter.
@type mistype: int
@param mistype : the new mist type.
@rtype: None
@return: None
"""
def setHor(hor):
"""
Sets the horizon color of a world object.
@type hor: list of three floats
@param hor : the new hor.
@rtype: None
@return: None
"""
def getHor():
"""
Retrieves the horizon color of a world object.
This color is a list of 3 floats.
@rtype: list of three floats
@return: the horizon color of the world object.
"""
def getZen():
"""
Retrieves the zenith color of a world object.
This color is a list of 3 floats.
@rtype: list of three floats
@return: the zenith color of the world object.
"""
def setHor(hor):
"""
Sets the horizon color of a world object.
@type hor: list of three floats
@param hor : the new hor.
@rtype: None
@return: None
"""
def setZen(zen):
"""
Sets the zenith color of a world object.
@type zen: list of three floats
@param zen : the new zenith color.
@rtype: None
@return: None
"""
def getZen():
"""
Retrieves the zenith color of a world object.
This color is a list of 3 floats.
@rtype: list of three floats
@return: the zenith color of the world object.
"""
def getAmb():
"""
Retrieves the ambient color of a world object.
This color is a list of 3 floats.
@rtype: list of three floats
@return: the ambient color of the world object.
"""
def setZen(zen):
"""
Sets the zenith color of a world object.
@type zen: list of three floats
@param zen : the new zenith color.
@rtype: None
@return: None
"""
def setAmb(amb):
"""
Sets the ambient color of a world object.
@type amb: list of three floats
@param amb : the new ambient color.
@rtype: None
@return: None
"""
def getAmb():
"""
Retrieves the ambient color of a world object.
This color is a list of 3 floats.
@rtype: list of three floats
@return: the ambient color of the world object.
"""
def getStar():
"""
Retrieves the star parameters of a world object.
It is a list of nine floats :
red component of the color
green component of the color
blue component of the color
size of the stars
minimal distance between the stars
average distance between the stars
variations of the stars color
@rtype: list of nine floats
@return: the star parameters
"""
def setAmb(amb):
"""
Sets the ambient color of a world object.
@type amb: list of three floats
@param amb : the new ambient color.
@rtype: None
@return: None
"""
def setStar(star):
"""
Sets the star parameters of a world object.
See getStar for the semantics of the parameter.
@type star: list of 9 floats
@param star : the new star parameters.
@rtype: None
@return: None
"""
def getStar():
"""
Retrieves the star parameters of a world object.
It is a list of nine floats :
red component of the color
green component of the color
blue component of the color
size of the stars
minimal distance between the stars
average distance between the stars
variations of the stars color
@rtype: list of nine floats
@return: the star parameters
"""
def getMist():
"""
Retrieves the mist parameters of a world object.
It is a list of four floats :
intensity of the mist
start of the mist
end of the mist
height of the mist
@rtype: list of four floats
@return: the mist parameters
"""
def setStar(star):
"""
Sets the star parameters of a world object.
See getStar for the semantics of the parameter.
@type star: list of 9 floats
@param star : the new star parameters.
@rtype: None
@return: None
"""
def setMist(mist):
"""
Sets the mist parameters of a world object.
See getMist for the semantics of the parameter.
@type mist: list of 4 floats
@param mist : the new mist parameters.
@rtype: None
@return: None
"""
def getMist():
"""
Retrieves the mist parameters of a world object.
It is a list of four floats :
intensity of the mist
start of the mist
end of the mist
height of the mist
@rtype: list of four floats
@return: the mist parameters
"""
def getScriptLinks (event):
"""
Get a list with this World's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "Redraw", "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def setMist(mist):
"""
Sets the mist parameters of a world object.
See getMist for the semantics of the parameter.
@type mist: list of 4 floats
@param mist : the new mist parameters.
@rtype: None
@return: None
"""
def clearScriptLinks (links = None):
"""
Delete script links from this World :). If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def getScriptLinks (event):
"""
Get a list with this World's script links of type 'event'.
@type event: string
@param event: "FrameChanged", "Redraw", "Render".
@rtype: list
@return: a list with Blender L{Text} names (the script links of the given
'event' type) or None if there are no script links at all.
"""
def addScriptLink (text, event):
"""
Add a new script link to this World.
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
"""
def setCurrent ():
"""
Make this world active in the current scene.
@rtype: None
@return: None
"""
def insertIpoKey(keytype):
"""
Inserts keytype values in world ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-ZENTIH
-HORIZON
-MIST
-STARS
-OFFSET
-SIZE
@return: py_none
"""
def clearScriptLinks (links = None):
"""
Delete script links from this World :). If no list is specified, all
script links are deleted.
@type links: list of strings
@param links: None (default) or a list of Blender L{Text} names.
"""
def __copy__ ():
"""
Make a copy of this world
@rtype: World
@return: a copy of this world
"""
def addScriptLink (text, event):
"""
Add a new script link to this World.
@type text: string
@param text: the name of an existing Blender L{Text}.
@type event: string
@param event: "FrameChanged", "Redraw" or "Render".
"""
def setCurrent ():
"""
Make this world active in the current scene.
@rtype: None
@return: None
"""
def insertIpoKey(keytype):
"""
Inserts keytype values in world ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-ZENTIH
-HORIZON
-MIST
-STARS
-OFFSET
-SIZE
@return: py_none
"""
def __copy__ ():
"""
Make a copy of this world
@rtype: World
@return: a copy of this world
"""
import id_generics
World.__doc__ += id_generics.attributes

View File

@@ -0,0 +1,8 @@
epytext=\
''' @ivar name: The name of this Group object.
@type name: string
@ivar users: Number of users this group has (read only)
@type users: int
@ivar fakeUser: The fake user status.
Enabling this will keep it in the blend even if there are no users.
@type fakeUser: bool'''