I’m trying to export to FBX, but it's only exporting the mesh and not the full heirarchy.
Is this possible?
import bpy sCollection = bpy.context.collection def parentCol(_colParent, _objParent): for col in _colParent.children: newObj = bpy.data.objects.new("empty", None) bpy.context.scene.collection.objects.link(newObj) newObj.name = col.name newObj.parent = _objParent if len(col.objects) > 0: objs = col.objects for obj in objs: obj.parent = newObj else: parentCol(col, newObj) root = bpy.data.objects.new("empty", None) bpy.context.scene.collection.objects.link(root) root.name = sCollection.name parentCol(sCollection, root)
The script is originally from this question. Since I see you spotted the script as working for you I wanted to flag your question as duplication, but system doesn't allowing me to do that. For that I copy&pasted the script here as answer. So you can accept it here if this solved your needs.