I'm trying to make a python script that will recursively rename the children in a hierarchy with a name derived after their parent, from a selected object.
Now I've gotten as far as I can select an object, run the script - and it will rename all the children accordingly.
The problem is that, if those children also has children of their own - I also want to rename those as well. But I cant find a way to rename the child of a child of an object.
I'm pretty new to python, but any solution or advice for what I should be looking at is much appreciated.
So heres what little I got so far:
def execute(self, context):
for child in bpy.context.object.children:
#Rename child to "[ParentName]_[Type]"
child.name = bpy.context.object.name + ("_") + child.type
return {'FINISHED'}