diff --git a/io_scene_psk_psa/psk/importer.py b/io_scene_psk_psa/psk/importer.py index 6464d2b..c2f3348 100644 --- a/io_scene_psk_psa/psk/importer.py +++ b/io_scene_psk_psa/psk/importer.py @@ -131,7 +131,8 @@ def import_psk(psk: Psk, context, options: PskImportOptions) -> PskImportResult: # Material does not yet exist, and we have the BDK addon installed. # Attempt to load it using BDK addon's operator. material_reference = psk.material_references[material_index] - if material_reference and bpy.ops.bdk.link_material(reference=material_reference, repository_id=options.bdk_repository_id) == {'FINISHED'}: + repository_id = options.bdk_repository_id if options.bdk_repository_id is not None else '' + if material_reference and bpy.ops.bdk.link_material(reference=material_reference, repository_id=repository_id) == {'FINISHED'}: material = bpy.data.materials[material_name] else: # Just create a blank material. diff --git a/io_scene_psk_psa/shared/helpers.py b/io_scene_psk_psa/shared/helpers.py index ba3cff2..b8ba47e 100644 --- a/io_scene_psk_psa/shared/helpers.py +++ b/io_scene_psk_psa/shared/helpers.py @@ -163,7 +163,5 @@ def get_export_bone_names(armature_object: Object, bone_filter_mode: str, bone_c return bone_names -def is_bdk_addon_loaded(): - # TODO: this does not work anymore for *reasons*. Just check if bpy.ops.bdk.link_material exists. - # return addon_utils.check('bdk_addon')[1] - return bpy.ops.bdk.link_material is not None +def is_bdk_addon_loaded() -> bool: + return bpy.ops.bdk is not None and bpy.ops.bdk.link_material is not None