[Bf-python] bpy.libraries modules (was "Adding a new way to deal with libraries")

Martin Poirier theeth at yahoo.com
Fri Mar 16 04:15:58 CET 2007


--- Ken Hughes <khughes at pacific.edu> wrote:

> Ok, here's a epydoc description of the proposed new
> module for 
> bpy.libraries:
> 
> http://www1.pacific.edu/~khughes/Libseq-module.html
> 
> As Martin suggested, it is atomically
> load/link/close for each action. 
> It also will incorporate the equivalent to
> Library.Update() (or 
> Library.Load() with update=1).
> 
> Also, in keeping with the design goal of not
> allowing the creation of 
> Blender objects which are not linked to scenes, the
> types which are 
> returned by the libraries.objects.link() and
> .append() methods are 
> "pseudo-types" which must be passed to
> scene.objects.new() in order to 
> actually create the object.
> 
> Feedback, comments, etc., welcome.

Excellent, I like what I'm seeing.

So, if I got this write, the actual data append/link
only happens when the pseudo-object is linked to an
already existing scene datablock (object->scene).

What would be nice would be that that pseudo-object is
implemented as a materialization proxy (pardon the
technobable). That is, the pseudo-object provides the
same methods/properties as a real Object except that
any call/access throws an error until the object is
really added to a scene, in which case the calls are
forwarded to the real object (a reference is kept when
the scn.objects.new call is made).

This is extra work though and I'm not sure it'd be
really worth it.

Also, that's not mentioned, but I assume the load
function throws IOError if the lib doesn't exist (and
possibly ValueError if it's not a blend file).

Good work.

Martin


 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 



More information about the Bf-python mailing list