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
|