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.
Thanks!

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 object.properties. Then, for every parent-child relation, store the identifier of the parent in child.properties[“parent”] and the identifier of the child in parent.properties[“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 *

sc=Scene.GetCurrent()

# 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)
				break
		else :
			if type(ob.getParent())==Types.ObjectType :
				ob.addProperty('parent',ob.getParent().name,'STRING')

		ob.clrParent(2, 0)

def restoreParent(obs) :
	for ob in obs :
		for p in ob.getAllProperties() :
			if p.getName() == 'parent' :
				parentname=p.getData()
				ob.removeProperty(p)
				ob.clrParent(2, 0)
				obp=Object.Get(parentname)
				obp.makeParent([ob])
				break

clearParent(obs)
#restoreParent(obs)

Blender.Window.RedrawAll()

[ 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!