Skip to content

Commit

Permalink
Make exporters unpack data by default
Browse files Browse the repository at this point in the history
Also make sure you can't export the root collection to prevent accidentally exporting the entire project
  • Loading branch information
passivestar committed May 5, 2024
1 parent a4bcad1 commit 28f6bed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 6 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

bl_info = {
'name': 'QuickMenu',
'version': (3, 0, 7),
'version': (3, 0, 8),
'author': 'passivestar',
'blender': (4, 1, 0),
'location': 'Press the hotkey in 3D View',
Expand Down Expand Up @@ -1186,7 +1186,7 @@ class ExportOperator(bpy.types.Operator):
"""Export"""
bl_idname, bl_label = 'qm.export', 'Export'
mode: StringProperty(name='Mode', default='fbx')
unpack_data: BoolProperty(name='Unpack Data', default=False)
unpack_data: BoolProperty(name='Unpack Data', default=True)
apply_modifiers: BoolProperty(name='Apply Modifiers', default=True)
apply_transform: BoolProperty(name='Apply Transform', default=True)
batch_mode: StringProperty(name='Batch Mode', default='OFF')
Expand All @@ -1201,6 +1201,10 @@ def execute(self, context):
file_directory = os.path.dirname(bpy.data.filepath)
active_collection_name_clean = re.sub(r'[^a-zA-Z0-9_]', '_', bpy.context.view_layer.active_layer_collection.name)

if self.batch_mode == "COLLECTION" and (self.mode == "gltf" or self.mode == "glb") and active_collection_name_clean == "Scene_Collection":
self.report({'ERROR'}, 'Select a collection')
return {'FINISHED'}

# Save the blend file
bpy.ops.wm.save_mainfile()

Expand Down
12 changes: 1 addition & 11 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,12 @@
{ "path": "(F) Mode", "operator": "view3d.object_mode_pie_or_toggle" },

{ "path": "(Z) Files/(Q) Export GLB", "operator": "qm.export", "params": { "mode": "glb" } },
{ "path": "(Z) Files/(W) Export GLTF Selected Object", "operator": "qm.export", "params": {"mode" : "gltf", "selected_object": true}},
{ "path": "(Z) Files/(E) Export GLTF Active Collection", "operator": "qm.export", "params": { "mode": "gltf", "batch_mode": "COLLECTION" } },
{ "path": "(Z) Files/(W) Export GLTF Active Collection", "operator": "qm.export", "params": { "mode": "gltf", "batch_mode": "COLLECTION" } },

{ "path": "(Z) Files/[Separator]" },

{ "path": "(Z) Files/(A) Export FBX", "operator": "qm.export", "params": { "mode": "fbx", "batch_mode": "OFF" } },
{ "path": "(Z) Files/(S) Export FBX Collections", "operator": "qm.export", "params": { "mode": "fbx", "batch_mode": "COLLECTION" } },
{
"path": "(Z) Files/(D) Export FBX Collections (Unpack Data and Apply Transform)", "operator": "qm.export",
"params": {
"mode": "fbx",
"batch_mode": "COLLECTION",
"apply_transform": true,
"unpack_data": true
}
},

{ "path": "(Z) Files/[Separator]" },

Expand Down

0 comments on commit 28f6bed

Please sign in to comment.