Store Parent-Child relationships

Is anyone have an idea how to store information about parent-child relationships in a Group of objects, so one can temporarily clear those relationships and apply different objects transformations without affecting their positions in the world space.
After finishing - the stored information will be used to restore the parent child relationship in this group of objects.

This is how I would do it:

  1. A script to temporarily break the relations. For every selected object, create a random text identifier, store that in Then, for every parent-child relation, store the identifier of the parent in[“parent”] and the identifier of the child in[“children”]. Then, the destroy the relation.

  2. A script to restore the relations, using the stored identifier.

Because everything is in text properties, you can do anything between breaking and restoring, even save and quit Blender.

the code below works fine, it uses props as Sjoerd proposed, (no name shuffle needed, just use one ‘parent’ prop)
some ‘worst cases’ handled, so the code looks a bit odd as it also keeps the props for testing, synched correctly. comment /uncomment the function calls at the end.
tested with python 2.5, 2.49

import Blender
from Blender import *


# selection example
obs = [ob for ob in sc.objects if ob.type == 'Mesh']

def clearParent(obs) :
	for ob in obs :
		for p in ob.getAllProperties() :
			if p.getName() == 'parent' :
				if type(ob.getParent())==Types.ObjectType : p.setData(ob.getParent().name)
				else : ob.removeProperty(p)
		else :
			if type(ob.getParent())==Types.ObjectType :

		ob.clrParent(2, 0)

def restoreParent(obs) :
	for ob in obs :
		for p in ob.getAllProperties() :
			if p.getName() == 'parent' :
				ob.clrParent(2, 0)



[ strange, one can getParent(), but one can’t setParent()… you have to retrieve the wanted parent ob then makeparent child0, child1. sure you can declare several child, but… oh anyway it works. ]

Thanks littleneo and Sjoerd!
It’s very nice and useful script!
I didn’t know about the addProperty and the similar methods, but it seems to work well for the task.
I have to test the script on a large scale to see if any problems.
Thank you for the help!