Best way to export scene to glTF without "Types" collection of duplicate objects baked into model

Hi,
I'm working on a script that imports an IFC, then iterates through the 3d objects that compose the scene, parenting them to empty transforms to produce a transform hierarchy for a glTF export.
Here's the result when importing the glTF in Unity:

All objects come through correctly, except for these duplicate "floaters" around the origin.

I see that these are in the "Types" collection that is hidden by default on import, so I started doing some digging into identifying these and filtering them out of my object export list using if not element hasattr(e, "Types"). Still, even after selecting only the "scene objects" excluding these objects under Type they still get exported.

It seems like because they are linked to their instances in the scene, maybe they cannot be easily separated for export purposes.

Does anyone have ideas on a solution for this? I have tried creating copies, unlinking, etc. but it is extremely slow and not ideal, I'd like to do as little post processing on the scene as possible.

Comments

  • edited April 25

    I think I resolved it. On a fresh scene running the script, as long as I filter out the objects within the Types collection by hasattr(element, "Types") the scene is exported correctly without these duplicate objects at origin.
    Not sure what exactly fixed it, maybe something in memory while I was working. Glad this was an easy fix, I thought maybe this had to do with the IFC scene and its links to objects!

  • Hello, not sure how you call it in your script but the operator has several options to restrict which objects are exported. You might want to look into it.

Sign In or Register to comment.