2003-06-24 07:21:17 +00:00
|
|
|
# The Blender Module
|
|
|
|
|
|
2003-06-25 04:38:38 +00:00
|
|
|
# The module files in this folder are used to create the API documentation.
|
|
|
|
|
# Doc system used: epydoc - http://epydoc.sf.net
|
2003-07-12 18:21:07 +00:00
|
|
|
# command line:
|
|
|
|
|
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
# epydoc -o BPY_API_23x --url "http://www.blender.org" -t Blender.py \
|
2003-07-16 01:44:51 +00:00
|
|
|
# -n "Blender" --no-private --no-frames Blender.py \
|
|
|
|
|
# Types.py Scene.py Object.py NMesh.py Material.py Camera.py Lamp.py \
|
|
|
|
|
# Armature.py Metaball.py Effect.py Curve.py Ipo.py World.py BGL.py Window.py \
|
2004-03-02 11:56:20 +00:00
|
|
|
# Draw.py Image.py Text.py Lattice.py Texture.py Registry.py Sys.py Mathutils.py
|
2003-06-25 04:38:38 +00:00
|
|
|
|
2003-06-24 07:21:17 +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
|
|
|
The main Blender module.
|
2003-06-28 07:38:21 +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
|
|
|
Blender
|
|
|
|
|
=======
|
2003-06-24 07:21:17 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Set (request, data):
|
|
|
|
|
"""
|
2004-01-23 19:24:45 +00:00
|
|
|
Update settings in Blender.
|
2003-06-24 07:21:17 +00:00
|
|
|
@type request: string
|
|
|
|
|
@param request: The setting to change:
|
|
|
|
|
- 'curframe': the current animation frame
|
|
|
|
|
@type data: int
|
|
|
|
|
@param data: The new value.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Get (request):
|
|
|
|
|
"""
|
|
|
|
|
Retrieve settings from Blender.
|
|
|
|
|
@type request: string
|
|
|
|
|
@param request: The setting data to be returned:
|
|
|
|
|
- 'curframe': the current animation frame
|
|
|
|
|
- 'curtime' : the current animation time
|
|
|
|
|
- 'staframe': the start frame of the animation
|
|
|
|
|
- 'endframe': the end frame of the animation
|
|
|
|
|
- 'filename': the name of the last file read or written
|
2004-05-22 20:25:22 +00:00
|
|
|
- 'datadir' : the path to the dir where scripts should store and
|
|
|
|
|
retrieve their data files, including saved configuration (can
|
|
|
|
|
be None, if not found).
|
2003-06-24 07:21:17 +00:00
|
|
|
- 'version' : the Blender version number
|
|
|
|
|
@return: The requested data.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def Redraw ():
|
|
|
|
|
"""
|
2004-01-23 19:24:45 +00:00
|
|
|
Redraw all 3D windows.
|
2003-06-24 07:21:17 +00:00
|
|
|
"""
|
|
|
|
|
|
2004-05-22 20:25:22 +00:00
|
|
|
def Load (filename = None):
|
2003-06-24 07:21:17 +00:00
|
|
|
"""
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
Load a Blender .blend file or any of the other supported file formats.
|
|
|
|
|
|
|
|
|
|
Supported formats:
|
|
|
|
|
- Blender's .blend;
|
|
|
|
|
- DXF;
|
|
|
|
|
- Open Inventor 1.0 ASCII;
|
|
|
|
|
- Radiogour;
|
|
|
|
|
- STL;
|
|
|
|
|
- Videoscape;
|
|
|
|
|
- VRML 1.0 asc.
|
|
|
|
|
|
2004-05-22 20:25:22 +00:00
|
|
|
@type filename: string
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
@param filename: the pathname to the desired file. If 'filename'
|
2004-05-22 20:25:22 +00:00
|
|
|
isn't given or if it contains the substring '.B.blend', the default
|
|
|
|
|
.B.blend file is loaded.
|
|
|
|
|
|
|
|
|
|
@warn: loading a new .blend file removes the current data in Blender. For
|
|
|
|
|
safety, this function saves the current data as an autosave file in
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
the temporary dir used by Blender before loading a new Blender file.
|
|
|
|
|
@warn: after a call to Load(blendfile), current data in Blender is lost,
|
|
|
|
|
including the Python dictionaries. Any posterior references in the
|
|
|
|
|
script to previously defined data will generate a NameError. So it's
|
|
|
|
|
better to put Blender.Load as the last executed command in the script,
|
|
|
|
|
when this function is used to open .blend files.
|
2004-05-22 20:25:22 +00:00
|
|
|
"""
|
|
|
|
|
|
2004-06-24 09:43:13 +00:00
|
|
|
def Save (filename, overwrite = 0):
|
|
|
|
|
"""
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
Save a Blender .blend file with the current program data or export to
|
|
|
|
|
one of the builtin file formats.
|
|
|
|
|
|
|
|
|
|
Supported formats:
|
|
|
|
|
- Blender (.blend);
|
|
|
|
|
- DXF (.dxf);
|
|
|
|
|
- STL (.stl);
|
|
|
|
|
- Videoscape (.obj);
|
|
|
|
|
- VRML 1.0 (.wrl).
|
|
|
|
|
|
2004-06-24 09:43:13 +00:00
|
|
|
@type filename: string
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
@param filename: the filename for the file to be written. It must have one
|
|
|
|
|
of the supported extensions or an error will be returned.
|
2004-06-24 09:43:13 +00:00
|
|
|
@type overwrite: int (bool)
|
|
|
|
|
@param overwrite: if non-zero, file 'filename' will be overwritten if it
|
|
|
|
|
already exists. By default existing files are not overwritten (an error
|
|
|
|
|
is returned).
|
|
|
|
|
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
@note: The substring ".B.blend" is not accepted inside 'filename'.
|
|
|
|
|
@note: DXF, STL and Videoscape export only B{selected} meshes.
|
2004-06-24 09:43:13 +00:00
|
|
|
"""
|
|
|
|
|
|
2004-05-22 20:25:22 +00:00
|
|
|
def Quit ():
|
|
|
|
|
"""
|
|
|
|
|
Exit from Blender immediately.
|
|
|
|
|
@warn: the use of this function should obviously be avoided, it is available
|
|
|
|
|
because there are some cases where it can be useful, like in automated
|
|
|
|
|
tests. For safety, a "quit.blend" file is saved (normal Blender behavior
|
|
|
|
|
upon exiting) when this function is called, so the data in Blender isn't
|
|
|
|
|
lost.
|
2003-06-24 07:21:17 +00:00
|
|
|
"""
|