niftools / blender_niftools_addon

The Blender Niftools Addon is a Blender add-on to enable import and export of NetImmese File Formats including .nif, .kf, .egm.
http://www.niftools.org
Other
389 stars 105 forks source link

NameError: name 'NifLog' is not defined in io_scene_nif.modules.nif_import.scene #379

Closed josephbburg closed 4 years ago

josephbburg commented 4 years ago

Issue Overview

Importing a particular model with version 2.6.0.dev4.b2-80 causes an error because of a missing definition

Version 2.6.0.dev4.b2-80 Blender 2.91 daily build (from source) Kubuntu 20.04

Context

Was delighted to learnt that NifTools is being ported to 2.8+! While trying out the importer, I encountered this error:

location: <unknown location>:-1
Python: Traceback (most recent call last):
  File "/home/theangerspecialist/.config/blender/2.91/scripts/addons/io_scene_nif/operators/nif_import_op.py", line 125, in execute
    return nif_import.NifImport(self, context).execute()
  File "/home/theangerspecialist/.config/blender/2.91/scripts/addons/io_scene_nif/nif_import.py", line 73, in execute
    self.load_files()  # needs to be first to provide version info.
  File "/home/theangerspecialist/.config/blender/2.91/scripts/addons/io_scene_nif/nif_import.py", line 142, in load_files
    scene.import_version_info(NifData.data)
  File "/home/theangerspecialist/.config/blender/2.91/scripts/addons/io_scene_nif/modules/nif_import/scene/__init__.py", line 75, in import_version_info
    NifLog.warn(f"Game set to '{possible_games[0]}', but multiple games qualified")
NameError: name 'NifLog' is not defined

Steps to Reproduce

Attempt to import almelexia.nif from this Morrowind Mod: https://www.nexusmods.com/morrowind/mods/23388/?tab=files (I don't think I have permission to redistribute it directly)

Expected Result

Import of file into Blender

Actual Result

The error I pasted above ^

Possible Fix

Adding this line to __init__.py in io_scene_nif/modules/nif_import/scene/ from ....utils.util_logging import NifLog resolves the issue. (but it seems other issues occur later, which I assume are unrelated. If they aren't due to user error, unsupported features, etc., I might report them.)

I'm happy to reply with more info if needed. Thanks for keeping the plugin updated. To think I was about to install Blender 2.49b...

neomonkeus commented 4 years ago

@josephbburg Thanks for the great bug report, especially filling in the template fully, very much appreciated. 😄 Fix is being reviewed atm. If you want to try it out yourself, you just need to update the files as shown in the link above.