1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2024-11-23 22:40:59 +01:00

Fixed is_bdk_addon_loaded function

This commit is contained in:
Colin Basnett 2024-09-09 16:29:20 -07:00
parent b5dba35ac4
commit 1c4967bd67
2 changed files with 4 additions and 5 deletions

View File

@ -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.

View File

@ -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