Module LibData :: Class LibData
[frames | no frames]

Class LibData


Generic Library Data Access

This class provides access to a specific type of library data.
Method Summary
Blender data append(name)
Append a new datablock from a library.
Blender data link(name)
Link a new datablock from a library.

Method Details

append(name)

Append a new datablock from a library. The new copy is added to the current .blend file.

Note: Blender Objects cannot be appended or linked without linking them to a scene. For this reason, lib.objects.append() returns a special "wrapper object" which must be passed to Scene.objects.link() or bpy.scenes.active.link() in order to actually create the object. So the following code will not create a new object:
       import bpy

       scn= bpy.scenes.active                            # get current scene
       lib = bpy.libraries.load('//file.blend')          # open file.blend
       pseudoOb = lib.objects.append('Cube'))            # get an object wrapper
But this code will:
       import bpy

       scn= bpy.scenes.active                            # get current scene
       lib = bpy.libraries.load('//file.blend')          # open file.blend
       pseudoOb = lib.objects.append('Cube'))            # get an object wrapper
       ob = scn.objects.link(pseudoOb)                                   # link to scene
Returns:
return a Blender datablock or object
           (type=Blender data)
Raises:
IOError - library cannot be read
ValueError - library does not contain name

link(name)

Link a new datablock from a library. The linked data is not copied into the local .blend file.

See append for notes on special handling of Blender Objects.
Returns:
return a Blender datablock or object
           (type=Blender data)
Raises:
IOError - library cannot be read
ValueError - library does not contain name

Generated by Epydoc 2.1 on Thu May 10 20:32:00 2007 http://epydoc.sf.net