Module Blender
[frames | no frames]

Module Blender

The main Blender module.

New: 'homedir', 'scriptsdir' and 'uscriptsdir' parameters in Get.

Blender


Function Summary
  Get(request)
Retrieve settings from Blender.
  Load(filename)
Load a Blender .blend file or any of the other supported file formats.
  Quit()
Exit from Blender immediately.
  Redraw()
Redraw all 3D windows.
  Save(filename, overwrite)
Save a Blender .blend file with the current program data or export to one of the builtin file formats.
  Set(request, data)
Update settings in Blender.

Function Details

Get(request)

Retrieve settings from Blender.
Parameters:
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
  • 'homedir': Blender's home dir
  • 'datadir' : the path to the dir where scripts should store and retrieve their data files, including saved configuration (can be None, if not found).
  • 'scriptsdir': the path to the main dir where scripts are stored (can be None, if not found).
  • 'uscriptsdir': the path to the user defined dir for scripts, see the paths tab in the User Preferences window in Blender (can be None, if not found).
  • 'version' : the Blender version number

           (type=string)
Returns:
The requested data.

Load(filename=None)

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.
Parameters:
filename - the pathname to the desired file. If 'filename' isn't given or if it contains the substring '.B.blend', the default .B.blend file is loaded.
           (type=string)

Warnings:

  • loading a new .blend file removes the current data in Blender. For safety, this function saves the current data as an autosave file in the temporary dir used by Blender before loading a new Blender file.
  • 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.
  • if in edit mode, this function leaves it, since Blender itself requires that.

Quit()

Exit from Blender immediately.

Warning: 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.

Redraw()

Redraw all 3D windows.

Save(filename, overwrite=0)

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).
Parameters:
filename - the filename for the file to be written. It must have one of the supported extensions or an error will be returned.
           (type=string)
overwrite - if non-zero, file 'filename' will be overwritten if it already exists. By default existing files are not overwritten (an error is returned).
           (type=int (bool))

Notes:

  • The substring ".B.blend" is not accepted inside 'filename'.
  • DXF, STL and Videoscape export only selected meshes.

Set(request, data)

Update settings in Blender.
Parameters:
request - The setting to change:
  • 'curframe': the current animation frame

           (type=string)
data - The new value.
           (type=int)

Generated by Epydoc 2.1 on Tue Jan 4 13:43:05 2005 http://epydoc.sf.net