Home | Trees | Index | Help |
|
---|
Module API_intro |
|
Blender
(*)
Armature
BGL
(*)
Camera
Curve
Draw
Effect
(*)
Image
Ipo
Lamp
Lattice
Library
Material
Mathutils
Metaball
NMesh
Noise
Object
(*)
Registry
Scene
(*)
Sound
(new)
Text
Texture
Types
Window
(*)
Theme
(new)
World
(*)
sys
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 Python, 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.Text
) and link other scripts to
objects and events, see Object.Object.addScriptLink
, for
example.
Try 'blender -d' to know where your default dir for scripts is, it will inform either the dir or the file with that info already parsed, which is in the same dir of the scripts folder.
The header should be like this one (all double and single apostrophes below are required):#!BPY # """ # Name: 'Script Name' # Blender: 233 # Group: 'Export' # Submenu: 'All' all # Submenu: 'Selected' sel # Submenu: 'Configure (gui)' gui # Tooltip: 'Export to some format.' # """where:
Submenu lines are not required, use them if you want to provide extra options. To see which submenu the user chose, check the "__script__" dictionary in your code: __script__['arg'] has the defined keyword (the word after the submenu string name: all, sel or gui in the example above) of the chosen submenu. For example, if the user clicked on submenu 'Selected' above, __script__['arg'] will be "sel".
If your script requires extra data or configuration files, there is a special folder where they can be saved: see 'datadir' inBlender.Get
.
Window
, Draw
and BGL
modules for
more information and also check Python's 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.
Blender.Save
, Blender.Load
, Blender.Quit
and the Library
module, for many tasks it's possible to control Blender via some
automated process using scripts. Note that command line scripts are
run before Blender initializes its windows, so many functions that
get or set window related attributes (like most in Window
) don't
work here. If you need those, use an ONLOAD script link (see Scene.Scene.addScriptLink
) instead --
it's also possible to use a command line script to write or set an
ONLOAD script link.
Programs manipulate data structures. Blender python scripts are no exception. Blender uses an Object Oriented architecture. The bpython interface tries to present Blender objects and their attributes in the same way you see them through the User Interface ( the GUI ). One key to bpython programming is understanding the information presented in Blender's OOPS window where Blender objects and their relationships are displayed.
Each Blender graphic element (Mesh, Lamp, Curve, etc.) is composed from two parts: an Object and ObData. The Object holds information about the position, rotation and size of the element. This is information that all elements have in common. The ObData holds information specific to that particular type of element.
Each Object has a link to its associated ObData. A single ObData may be shared by many Objects. A graphic element also has a link to a list of Materials. By default, this list is associated with the ObData.
All Blender objects have a unique name. However, the name is qualified by the type of the object. This means you can have a Lamp Object called Lamp.001 (OB:Lamp.001) and a Lamp ObData called Lamp.001 (LA:Lamp.001).
For a more in-depth look at Blender internals, and some understanding of why Blender works the way it does, see the Blender Architecture document.The "Scripts Help Browser" script in the Help menu can parse special variables from registered scripts and display help information for users. For that, authors only need to add proper information to their scripts, after the registration header.
The expected variables:__author__ = 'Mr. Author' __version__ = '1.0 11/11/04' __url__ = ["Author's site, http://somewhere.com", "Support forum, http://somewhere.com/forum/", "blender", "elysiun"] __email__ = ["Mr. Author, mrauthor:somewhere*com", "scripts"] __bpydoc__ = """\ This script does this and that. Explaining better, this script helps you create ... You can write as many paragraphs as needed. Shortcuts:<br> Esc or Q: quit.<br> etc. Supported:<br> Meshes, metaballs. Known issues:<br> This is just an example, there's no actual script. Notes:<br> You can check scripts bundled with Blender to see more examples of how to add documentation to your own works."""
Version: 2.35 - 2.36
Author: The Blender Python Team
Notes:
Requires: Blender 2.35 or newer.
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Tue Jan 4 13:43:05 2005 | http://epydoc.sf.net |