BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
# This is not a real module, it's simply an introductory text.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
The Blender Python API Reference
|
|
|
|
|
================================
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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}
|
|
|
|
|
|
|
|
|
|
Top Module:
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
- L{Blender}
|
2007-03-26 19:44:44 +00:00
|
|
|
- L{bpy<Bpy>}
|
2007-02-27 10:23:24 +00:00
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
- 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).
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
Introduction:
|
|
|
|
|
=============
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
Scripting and Blender:
|
|
|
|
|
======================
|
|
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
These are the basic ways to execute scripts in Blender:
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
Interaction with users:
|
|
|
|
|
-----------------------
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
Command line mode:
|
|
|
|
|
------------------
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
L{Click here for command line and background mode examples<API_related>}.
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
Demo mode:
|
|
|
|
|
----------
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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}.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
The Game Engine API:
|
|
|
|
|
--------------------
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2004-08-04 08:03:39 +00:00
|
|
|
Blender Data Structures:
|
|
|
|
|
------------------------
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
2004-08-04 08:03:39 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
2004-08-04 08:03:39 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
2004-08-04 08:03:39 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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).
|
2004-08-04 08:03:39 +00:00
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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>}.
|
2004-08-04 08:03:39 +00:00
|
|
|
|
2004-11-27 18:32:26 +00:00
|
|
|
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
A note to newbie script writers:
|
|
|
|
|
--------------------------------
|
|
|
|
|
|
2007-02-27 10:23:24 +00:00
|
|
|
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.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
|
@author: The Blender Python Team
|
2007-01-31 21:30:27 +00:00
|
|
|
@requires: Blender 2.43 or newer.
|
|
|
|
|
@version: 2.43
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
@see: U{www.blender3d.org<http://www.blender3d.org>}: main site
|
|
|
|
|
@see: U{www.blender.org<http://www.blender.org>}: documentation and forum
|
2007-01-02 13:12:23 +00:00
|
|
|
@see: U{blenderartists.org<http://blenderartists.org>}: user forum
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
@see: U{projects.blender.org<http://projects.blender.org>}
|
2004-08-04 08:03:39 +00:00
|
|
|
@see: U{blender architecture<http://www.blender3d.org/cms/Blender_Architecture.336.0.html>}: blender architecture document
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
@see: U{www.python.org<http://www.python.org>}
|
|
|
|
|
@see: U{www.python.org/doc<http://www.python.org/doc>}
|
2007-01-31 21:30:27 +00:00
|
|
|
@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.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
@note: this documentation was generated by epydoc, which can output html and
|
2007-02-27 10:23:24 +00:00
|
|
|
pdf. For pdf it requires a working LaTeX environment.
|
2004-08-17 04:26:00 +00:00
|
|
|
|
|
|
|
|
@note: the official version of this reference guide is only updated for each
|
2007-02-27 10:23:24 +00:00
|
|
|
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>}.
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
"""
|