[Bf-python] Adding a new way to deal with libraries

Campbell Barton cbarton at metavr.com
Sat Mar 10 11:56:53 CET 2007


For now Ill assume "bpy" is acceptable and move on... we can of course 
change, as with any part of the new API parts.

next step is to deciede how library data could be delt with.

Id like to replace Blender.Library with somthing a bit less messy.
  Im not sure they fit into the libdata iterator-like way of working

heres an example of how it might work..
ob = bpy.libraries['//mylib.blend'].objects.link("somedata")

# '//mylib.blend' - could be a new or used lib, if its new it would be 
added to bpy.libraries

# Loop through used libraries...
for lib in bpy.libraries:
	print lib.filename
	print lib.objects # just a list of strings, a little misleading since 
its not like bpy.objects


An alternative method is to deal with libdata through the existing 
libdata-seq type..

group = bpy.groups.link('groupName', '//lib.blend')







More information about the Bf-python mailing list