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
385 stars 104 forks source link

"AttributeError: 'x' object has no attribute 'y'" for original Oblivion files #552

Open Allofich opened 1 year ago

Allofich commented 1 year ago

Issue Overview

Some .nif files that come with Oblivion have an "AttributeError: 'NoneType' object has no attribute 'data'" error on import.

Version Information

Blender Niftools Addon Version Info

Built the addon using the following: Python 3.11 New Pyffi: https://github.com/Candoran2/new-pyffi/commit/6d113fdcfcf950eae138f7e75efcc6b057c1d605 New nif xml: https://github.com/Candoran2/nifxml/commit/d0ab9271e2c2bf75eacb46082b93e1d304b551e6 Latest blender addon code at: https://github.com/Candoran2/blender_nif_plugin/commit/cc4012830897ed32c378c3a2e5335e68d7ef3d48

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 the problem mesh from Oblivion (below) into Blender.
  3. The file is imported but has an error.

    Expected Result

    Should import without errors.

Actual Result

Imports with an error.

Console Output

niftools:INFO:Inserting key 'CLaw_L01'
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 234, in import_branch
    b_child = self.import_branch(n_child, b_armature=b_armature)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 200, in import_branch
    return self.objecthelper.import_geometry_object(b_armature, n_block)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\object\__init__.py", line 135, in import_geometry_object
    self.mesh.import_mesh(n_block, b_obj)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\geometry\mesh\__init__.py", line 167, in import_mesh
    self.morph_anim.import_morph_controller(n_block, b_obj)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\morph.py", line 98, in import_morph_controller
    morph = n_morph_ctrl.interpolators[morph_i].data.data
AttributeError: 'NoneType' object has no attribute 'data'

Nif File

claw_l.zip

Allofich commented 1 year ago

claw_l It's probably this NiFloatInterpolator where the issue happens.

Candoran2 commented 1 year ago

Do you know if that one serves any purpose or is it just a non-functional block?

Allofich commented 1 year ago

Sorry, I don't know.

Allofich commented 1 year ago

I tried removing the block with NifSkope, then saving (with auto-sanitize on) and using it as an override model. I spawned a spider daedra and the game didn't crash and I didn't see any obvious problems with animation or anything.

Allofich commented 1 year ago

Also tried without auto-sanitize, same result.

Candoran2 commented 1 year ago

Alright. Thank you for the thorough reporting and providing example nif files. Since I haven't installed the game it really helps highlight cases that might otherwise be missed and makes it much easier to test.

Allofich commented 1 year ago

As mentioned in https://github.com/niftools/blender_niftools_addon/issues/553, a similar error occurs when importing .kf files.

Traceback (most recent call last):
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\operators\kf_import_op.py", line 67, in execute
    return KfImport(self, context).execute()
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\kf_import.py", line 79, in execute
    self.transform_anim.import_kf_root(kf_root, b_armature)
  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\animation\transform.py", line 209, in import_controller_sequence
    actions.add(self.import_keyframe_controller(kfc, b_armature_obj, b_target, b_action_name))
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\transform.py", line 263, in import_keyframe_controller
    self.import_keys(QUAT, b_action, bone_name, times, keys, flags, interp, n_bind_rot_inv, n_bind_trans)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\transform.py", line 314, in import_keys
    keys = [key_func(val) for val in keys]
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\transform.py", line 314, in <listcomp>
    keys = [key_func(val) for val in keys]
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\transform.py", line 56, in as_b_quat
    return mathutils.Quaternion([n_val.w, n_val.x, n_val.y, n_val.z])
AttributeError: 'BaseStruct' object has no attribute 'w'

I used: https://github.com/OpenNaja/cobra-tools/commit/638a4556b1eb1af6592389f75c664156a0937c3d https://github.com/Candoran2/new-pyffi/commit/4b18387137a4e73386f020fff66d033354ab2186 https://github.com/Candoran2/nifxml/commit/d0ab9271e2c2bf75eacb46082b93e1d304b551e6 https://github.com/Candoran2/blender_nif_plugin/commit/7fd1cdb0fecc9b046599fe1ec5fa4975734707aa

python-3.11.1-amd64.exe blender-3.4.1-windows-x64.msi

Edit: Fixed by the new cobra-tools code.

Allofich commented 1 year ago

Another one is creatures\clannfear\skeleton.nif.

skeleton.zip

It errors with

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 163, in import_root
    self.constrainthelper.import_bhk_constraints()
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\constraint\__init__.py", line 60, in import_bhk_constraints
    self.import_constraint(hkbody)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\constraint\__init__.py", line 106, in import_constraint
    hkdescriptor = hkconstraint.ragdoll
AttributeError: 'bhkMalleableConstraint' object has no attribute 'ragdoll'

using the same environment as described in the above post.

Allofich commented 1 year ago

And another is creatures\endgame\battle.nif.

battle.zip

It errors with

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 234, in import_branch
    b_child = self.import_branch(n_child, b_armature=b_armature)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 234, in import_branch
    b_child = self.import_branch(n_child, b_armature=b_armature)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 234, in import_branch
    b_child = self.import_branch(n_child, b_armature=b_armature)
  [Previous line repeated 11 more times]
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\nif_import.py", line 200, in import_branch
    return self.objecthelper.import_geometry_object(b_armature, n_block)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\object\__init__.py", line 135, in import_geometry_object
    self.mesh.import_mesh(n_block, b_obj)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\geometry\mesh\__init__.py", line 159, in import_mesh
    self.mesh_prop_processor.process_property_list(n_block, b_obj)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\property\geometry\mesh.py", line 114, in process_property_list
    self.process_property(prop)
  File "****\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\property\geometry\niproperty.py", line 129, in process_nimaterial_property
    MaterialAnimation().import_material_controllers(self.n_block, self.b_mat)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\material.py", line 61, in import_material_controllers
    self.import_material_alpha_controller(b_material, n_material)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\material.py", line 78, in import_material_alpha_controller
    n_ctrl_data = self.get_controller_data(n_ctrl)
  File "****\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\io_scene_niftools\modules\nif_import\animation\__init__.py", line 62, in get_controller_data
    data = ctrl.interpolator.data
AttributeError: 'NiBlendFloatInterpolator' object has no attribute 'data'