Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"TypeError: bpy_struct: item.attr = val: enum "1" not found in ()" with original Oblivion .NIF file #547

Closed
Allofich opened this issue Dec 18, 2022 · 4 comments
Assignees
Labels
Bug Issue with specific functionality not working as intended but overall plugin is working.

Comments

@Allofich
Copy link
Contributor

Issue Overview

An error appears during import of an original Oblivion .NIF file.

Version Information

Blender Niftools Addon Version Info

Built the addon using the following:
Python 3.11
New Pyffi: Candoran2/new-pyffi@c8508fe
New nif xml: niftools/nifxml@89d03ff
Latest blender addon code at: Candoran2@f3898fe
(code up for PR in #541)

Blender Version Info

3.4

Platform information

Windows 11 22H2

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]

  1. Build the latest blender_niftools_addon using the code versions listed above.
  2. Import meshes/architecture/anvil/anvilaltar01.nif from the Oblivion DVD installation into Blender. This file can be obtained by extracting it from data/Oblivion - Meshes.bsa with a BSA extracting program.
  3. An error (see below) appears in the console.

Expected Result

No errors when importing a valid .NIF file.

Actual Result

Error happens.

Console Output

Traceback (most recent call last):
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\operators\nif_import_op.py", line 134, in execute
    return NifImport(self, context).execute()
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 131, in execute
    self.import_root(root)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 159, in import_root
    b_obj = self.import_branch(root_block)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 240, in import_branch
    b_children.extend(self.import_collision(n_block))
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 184, in import_collision
    return self.bhkhelper.import_bhk_shape(n_node.collision_object.body)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\collision\havok.py", line 94, in import_bhk_shape
    return self.process_bhk(bhk_shape)
  File "****\Blender 3.4\3.4\python\lib\functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\collision\havok.py", line 170, in import_bhk_rigidbody_t
    self._import_bhk_rigid_body(bhk_shape, collision_objs)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\collision\havok.py", line 216, in _import_bhk_rigid_body
    b_col_obj.nifcollision.collision_layer = str(body_info.havok_filter.layer.value)
TypeError: bpy_struct: item.attr = val: enum "1" not found in ()

This warning only appears when importing the anvilaltar01.nif from the DVD installation. It does not happen with the version of this file found in the GOG/Steam versions.

Nif File

See #546.

@Allofich Allofich added the Bug Issue with specific functionality not working as intended but overall plugin is working. label Dec 18, 2022
Candoran2 added a commit to Candoran2/blender_nif_plugin that referenced this issue Dec 19, 2022
@Allofich
Copy link
Contributor Author

As you mentioned in the other issue, this error doesn't happen when using the nif.xml in https://github.com/Candoran2/nifxml/tree/mickeychanges, as the .nif is assigned the game "Oblivion" instead of "UNKNOWN". I didn't ever see the .nif being detected as "Oblivion KF" by the import plugin, so I don't understand why the above commit for the "Oblivion KF" type is supposed to fix this issue. If it's correct that a "Oblivion KF" file can use collision layers, then all is well I guess, but if that change was supposed to fix the TypeError: bpy_struct: item.attr = val: enum "1" not found in () error for this .nif, I don't see the connection on my end.

I'm assuming the https://github.com/Candoran2/nifxml/tree/mickeychanges nif.xml is the best one to use for testing, since it seems to be the most up-to-date now, so I'll use it from now on. By the way, I consider this issue to be closed because of the changes in that nif.xml file, but I'll wait a while before closing in case you have a comment.

@Candoran2
Copy link
Member

It's essentially a safeguard just in case a (Oblivion) kf file uses collision layers, yeah.

@Allofich
Copy link
Contributor Author

Allofich commented Dec 20, 2022

OK, just letting you know that the "Fix for #547" commit wasn't actually a fix for this issue (for me at least), as it was fixed by the new nif.xml and wasn't detected as "Oblivion KF" for me, anyway. Maybe you were thinking of the ladder .nif in #546? That one was detected as "Oblivion KF".

Edit: Or the 7 was just a typo, maybe you meant to type "Fix for #546?" That would explain it.

@Allofich
Copy link
Contributor Author

Allofich commented Dec 20, 2022

Well, the ladder .nif wrong detection in #546 is also fixed by the new nif.xml, not the safeguard... Whatever, if it's a good change, that's fine, I just wanted to let you know I couldn't confirm it as fixing any of the issues I created. So if it was a change you otherwise wouldn't have wanted to make, but you made it to fix an issue I created, I think you can remove it. But if it's good to have regardless, than never mind.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug Issue with specific functionality not working as intended but overall plugin is working.
Projects
None yet
Development

No branches or pull requests

3 participants