feat(Blenvy:Blender): fixed issue with duplicate objects when using parenting in blender

This commit is contained in:
kaosat.dev 2024-07-27 18:57:47 +02:00
parent 55a4deac1c
commit ab7a0cab65
1 changed files with 3 additions and 0 deletions

View File

@ -81,11 +81,14 @@ def generate_temporary_scene_and_export(settings, gltf_export_settings, gltf_out
# copies the contents of a collection into another one while replacing library instances with empties # copies the contents of a collection into another one while replacing library instances with empties
def copy_hollowed_collection_into(source_collection, destination_collection, parent_empty=None, filter=None, blueprints_data=None, settings={}): def copy_hollowed_collection_into(source_collection, destination_collection, parent_empty=None, filter=None, blueprints_data=None, settings={}):
collection_instances_combine_mode = getattr(settings.auto_export, "collection_instances_combine_mode") collection_instances_combine_mode = getattr(settings.auto_export, "collection_instances_combine_mode")
for object in source_collection.objects: for object in source_collection.objects:
if object.name.endswith("____bak"): # some objects could already have been handled, ignore them if object.name.endswith("____bak"): # some objects could already have been handled, ignore them
continue continue
if filter is not None and filter(object) is False: if filter is not None and filter(object) is False:
continue continue
if object.parent is not None: # if there is a parent, this object is not a direct child of the collection, and should be ignored (it will get picked up by the recursive scan inside duplicate_object)
continue
#check if a specific collection instance does not have an ovveride for combine_mode #check if a specific collection instance does not have an ovveride for combine_mode
combine_mode = object['_combine'] if '_combine' in object else collection_instances_combine_mode combine_mode = object['_combine'] if '_combine' in object else collection_instances_combine_mode
parent = parent_empty parent = parent_empty