Merge pull request #2366 from MoritzBrueckner/fix-collection-export

Fix exporting collections with parent object in another collection
This commit is contained in:
Lubos Lenco 2021-10-25 10:00:41 +02:00 committed by GitHub
commit 3df2916f5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1573,7 +1573,7 @@ Make sure the mesh only has tris/quads.""")
self.output['probe_datas'].append(o)
def export_collection(self, collection):
def export_collection(self, collection: bpy.types.Collection):
"""Exports a single collection."""
scene_objects = self.scene.collection.all_objects
@ -1584,10 +1584,13 @@ Make sure the mesh only has tris/quads.""")
}
for bobject in collection.objects:
if not bobject.arm_export:
continue
# Add unparented objects only, then instantiate full object
# child tree
if bobject.parent is None and bobject.arm_export:
# Only add unparented objects or objects with their parent
# outside the collection, then instantiate the full object
# child tree if the collection gets spawned as a whole
if bobject.parent is None or bobject.parent.name not in collection.objects:
# This object is controlled by proxy
has_proxy_user = False