This is a script to get objects from a file:
import Blender
from Blender import Library
Library.Open("//HumanRig08.blend")
groups = Library.LinkableGroups()
for db in groups:
print “DATABLOCK %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()
Blender.Redraw()
Very simple, basically ripped right from the API. Funny thing though, when running the script, it seems to leave it to Blender to decide, at something that appears to be random, whether or not to bring an object’s parenting information along with it; some objects ar eparented as they should be, some are not. There is no apparent logic behind which are and which are not, but every time the script is run, the same objects are/aren’t parented.
This makes no sense to me. Can someone explain what is wrong?
EDIT: Okay, now Blender is adding insult to injury… It seems that an object’s NAME has major influence on whether or not the script will import it’s parenting data. In my .blend file, there are three objects (there are more, but let’s stick to these three): Chest, Abdomen, and Hip. In the .blend file, Chest is the child of Abdomen, and Abdomen is the child of Hip; moving or rotating Hip affects all.
(remainder deleted due to EDIT2)
EDIT2: I may just have figured out how it works. For some reason, a parenting link only works when the name of the parent is alphabetically after the child; if ‘alpha_ob’ is the parent of ‘beta_ob’, the link does NOT get imported, but if ‘alpha_ob’ is the child, it does.
I cannot see any reason for this in the script. Since I have found several other oddities surrounding Blender’s parenting functions, I am worrying there might be a real problem. If someone can see the flaw in the script, please tell me and put my worries to rest…