Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ class ExportBlenderCollection(Operator, ExportHelper):
default=False
)

clean_fakes: BoolProperty(
name="Clean Fake Users",
description="Set all items in the new scene to not use fake users before purging orphans.",
default=False
)

@classmethod
def poll(cls, context):
return context.mode == 'OBJECT' # Because funky things happen when not in Object Mode
Expand All @@ -150,7 +156,8 @@ def execute(self, context):
"export_selected": True,
"export_as_collection": True,
"collection_name": context.selected_ids[0].name, #XXX Assumes only one collection is selected
"backlink": self.backlink
"backlink": self.backlink,
"clean_fakes": self.clean_fakes
}
if bpy.app.version > (2, 93, 0):
export_settings["mark_asset"] = self.mark_asset
Expand Down
7 changes: 7 additions & 0 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,19 @@ def export_blend_objects(context, export_settings):
if export_settings["export_selected"] and export_settings["export_as_collection"]:
if export_settings["is_collection"] == False:
export_collection = bpy.data.collections.new(export_settings["collection_name"])
if export_settings["clean_fakes"]:
for key in bpy.data.user_map():
key.use_fake_user = False
else:
export_collection = bpy.data.collections[export_settings["collection_name"]]
export_scene.collection.children.link(export_collection)

# Add objects from list to scene
for ob in objects:
if export_settings["clean_fakes"]:
for key in bpy.data.user_map():
key.use_fake_user = False

export_scene.collection.objects.link(ob)
if export_settings["export_selected"]:
if export_settings["export_as_collection"] and export_settings["is_collection"] == False:
Expand Down