From 0a7804b5abdb8564be9dd033710c53856a598a44 Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Sat, 27 Jan 2024 00:42:51 -0800 Subject: [PATCH] Improved reporting of PSK import error when there is nothing selected to import --- io_scene_psk_psa/psk/import_/operators.py | 4 ++++ io_scene_psk_psa/psk/importer.py | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/io_scene_psk_psa/psk/import_/operators.py b/io_scene_psk_psa/psk/import_/operators.py index ea57ccc..0a4db97 100644 --- a/io_scene_psk_psa/psk/import_/operators.py +++ b/io_scene_psk_psa/psk/import_/operators.py @@ -107,6 +107,10 @@ class PSK_OT_import(Operator, ImportHelper): options.should_import_shape_keys = self.should_import_shape_keys options.scale = self.scale + if not options.should_import_mesh and not options.should_import_skeleton: + self.report({'ERROR'}, 'Nothing to import') + return {'CANCELLED'} + result = import_psk(psk, context, options) if len(result.warnings): diff --git a/io_scene_psk_psa/psk/importer.py b/io_scene_psk_psa/psk/importer.py index e6efe89..8fe4da5 100644 --- a/io_scene_psk_psa/psk/importer.py +++ b/io_scene_psk_psa/psk/importer.py @@ -54,9 +54,6 @@ def import_psk(psk: Psk, context, options: PskImportOptions) -> PskImportResult: armature_object = None mesh_object = None - if not options.should_import_mesh and not options.should_import_skeleton: - raise Exception('Nothing to import') - if options.should_import_skeleton: # ARMATURE armature_data = bpy.data.armatures.new(options.name)