diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2004-04-25 00:04:37 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2004-04-25 00:04:37 +0400 |
commit | 382297b68753b1d17d6e57846206d086fde251b0 (patch) | |
tree | 3aec01ecd44aed5a2376f3311791d63d560e9dbb /source/blender/python/api2_2x/doc | |
parent | e5e4c0fc4fc06228523993e088b7e2bdc8a60a47 (diff) |
BPython:
- New module + doc: Blender.Library:
It's like File->Append, loads datablocks from .blend files.
- small updates to fix warnings and accomodate for the new module, in readfile.[ch]
- New Blender.sys module function: time, a wrapper of the PIL get time function.
- Updated original makefile and scons builds.
Diffstat (limited to 'source/blender/python/api2_2x/doc')
-rw-r--r-- | source/blender/python/api2_2x/doc/Blender.py | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Library.py | 110 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Sys.py | 10 |
3 files changed, 121 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py index d86607587f7..2bdd658a52f 100644 --- a/source/blender/python/api2_2x/doc/Blender.py +++ b/source/blender/python/api2_2x/doc/Blender.py @@ -29,6 +29,7 @@ The Blender Python API Reference - L{Ipo} - L{Lamp} - L{Lattice} + - L{Library} - L{Material} - L{Mathutils} - L{Metaball} diff --git a/source/blender/python/api2_2x/doc/Library.py b/source/blender/python/api2_2x/doc/Library.py new file mode 100644 index 00000000000..5f0f754dd78 --- /dev/null +++ b/source/blender/python/api2_2x/doc/Library.py @@ -0,0 +1,110 @@ +# Blender.Library submodule + +""" +The Blender.Library submodule. + +Library +======= + +This module provides access to objects stored in .blend files. With it scripts +can append from Blender files to the current scene, like the File->Append +menu entry in Blender does. It allows programmers to use .blend files as +data files for their scripts. + +@warn: This is a new, still experimental module. + +Example:: + import Blender + from Blender import Library + + def f(name): + open_library(name) + + def open_library(name): + Library.Open(name) + groups = Library.LinkableGroups() + + for db in groups: + print "\nDATABLOCK %s:" % db + for obname in Library.Datablocks(db): + print obname + + if 'Object' in groups: + for obname in Library.Datablocks('Object'): + Library.Load(obname, 'Object', 0) # note the 0... + Library.Update() + + Library.Close() + b.Redraw() + + b.Window.FileSelector(f, "Choose Library", "*.blend") + +""" + +def Open (filename): + """ + Open an existing .blend file. If there was already one open file, it is + closed first. + @type filename: string + @param filename: The filename of a Blender file. + @rtype: bool + @return: 1 if succesful, 0 otherwise. + """ + +def Close (): + """ + Close the currently open library file, if any. + """ + +def getName (): + """ + Get the filename of the currently open library file. + @rtype: string + @return: The open library filename. + """ + +def LinkableGroups (): + """ + Get all the linkable group names from the currently open library file. These + are the available groups for linking with the current scene. Ex: 'Object', + 'Mesh', 'Material', 'Text', etc. + @rtype: list of strings + @return: the list of linkable groups. + """ + +def Datablocks (group): + """ + Get all datablock objects of the given 'group' available in the currently + open library file. + @type group: string + @param group: datablock group, see L{LinkableGroups}. + """ + +def Load (datablock, group, update = 1): + """ + Load the given datablock object from the current library file + @type datablock: string + @type group: string + @type update: bool + @param datablock: an available object name, as returned by L{Datablocks}. + @param group: an available group name, as returned by L{LinkableGroups}. + @param update: defines if Blender should be updated after loading this + object. This means linking all objects and remaking all display lists, + so it is potentially very slow. + + @warn: If you plan to load more than one object in sequence, it is + B{definitely recommended} to set 'update' to 0 in all calls to this + function and after them call L{Update}. + """ + +def Update (): + """ + Update all links and display lists in Blender. This function should be + called after a series of L{Load}(datablock, group, B{0}) calls to make + everything behave nicely. + @warn: to use this function, remember to set the third L{Load} parameter to + zero or each loading will automatically update Blender, which will slow + down your script and make you look like a lousy programmer. + Enough warnings :)? + """ + diff --git a/source/blender/python/api2_2x/doc/Sys.py b/source/blender/python/api2_2x/doc/Sys.py index e212784d33c..d488c8a1f65 100644 --- a/source/blender/python/api2_2x/doc/Sys.py +++ b/source/blender/python/api2_2x/doc/Sys.py @@ -6,6 +6,8 @@ The Blender.sys submodule. sys === +B{New}: L{time} + This module provides a minimal set of helper functions and data. Its purpose is to avoid the need for the standard Python module 'os', in special 'os.path', though it is only meant for the simplest cases. @@ -63,3 +65,11 @@ def splitext (path): @rtype: list with two strings @return: (root, ext) """ + +def time (): + """ + Get the current time in seconds since a fixed value. Successive calls to + this function are garanteed to return values greater than the previous call. + @rtype: float + @return: the elapsed time in seconds. + """ |