1
$\begingroup$

I’m trying to export to FBX, but it's only exporting the mesh and not the full heirarchy.
Is this possible?
Thank you…

$\endgroup$
3
  • $\begingroup$ Just advice, try to simplify your question as much as possible to attract more audience. Also it is not clear to me if you speak about objects in collection or objects parented to an object stored in collection. Thank you $\endgroup$ – vklidu Jan 16 at 8:31
  • $\begingroup$ Probably related blender.stackexchange.com/questions/189856/… $\endgroup$ – vklidu Jan 16 at 8:37
  • $\begingroup$ Hi 💥💥💥💥💥💥💥💥💥 I need to know If there is a way to Export the groups hierarchy created in blender in the FBX Format file. i’m trying to export to FBX but it's only exporting the mesh and not the full heirarchy. is this possible to export fbx with full collectios heirarchy? thank you… $\endgroup$ – vishal vaghela Jan 16 at 10:19
0
$\begingroup$
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.

$\endgroup$
2
  • $\begingroup$ Keep seeing this code... IMO there is an issue in that will destroy any existing object parenting. (eg if parent cube to cam in default file, run script will remove) ... Suggest if not obj.parent: obj.parent = newObj .... but there is still no hard n fast rule that collections == parenting. $\endgroup$ – batFINGER Jan 16 at 16:14
  • $\begingroup$ @batFINGER I don't have a scripting knowledge, if you'r able to help with that I will delete my answer, since I posted it here because I saw OP's reaction - it works. When I tried to run the script it created just an Empty without parenting. $\endgroup$ – vklidu Jan 16 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.