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

Oblivion .NIF files auto-assigned wrong game #546

Open Allofich opened 1 year ago

Allofich commented 1 year ago

Issue Overview

.NIF files from Oblivion are not correctly detected as Oblivion .NIF files.

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/c8508fe316aa2e978e7677308f06f1b6a2ff48e4 New nif xml: https://github.com/niftools/nifxml/commit/89d03ffe69254ef4b3b58b0a22ec2ff9820b2e63 Latest blender addon code at: https://github.com/Candoran2/blender_nif_plugin/commit/f3898fe667b214367569c5be761bbcf49b527eea (code up for PR in https://github.com/niftools/blender_niftools_addon/pull/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 Oblivion into Blender. This file can be obtained by extracting it from data/Oblivion - Meshes.bsa with a BSA extracting program.
  3. Observe that the file has been auto-assigned the incorrect game. For anvilaltar01.nif from a DVD Oblivion installation the game is set to UNKNOWN. For anvilaltar01.nif taken from a GOG or Steam installation the game is set to Fallout 3.

    Expected Result

    The files are automatically detected as Oblivion files.

Nif File

anvilaltar01.zip

Candoran2 commented 1 year ago

This should be fixed by a simple edit to the nif xml. Changing user="10" to user="10 11" for V20_0_0_5_OBL should work to make it detect this as Oblivion (and also fix #547 as a side-effect).

Allofich commented 1 year ago

I tried modifying this line <version id="V20_0_0_5_OBL" num="20.0.0.5" user="10" bsver="11">{{Oblivion}}</version> in nif.xml to <version id="V20_0_0_5_OBL" num="20.0.0.5" user="10 11" bsver="11">{{Oblivion}}</version> and recreating the addon.

For the DVD version of the .nif, both this and #547 are fixed, as you said. The GOG/Steam .nif is still detected as "Fallout 3", though.

Candoran2 commented 1 year ago

Interesting, for me it's detected as Oblivion (but it's always going to be ambiguous, since that version is also used by Fallout 3).

Allofich commented 1 year ago

Could it maybe be because I used the nif.xml file from https://github.com/niftools/nifxml/tree/develop, rather than the nif.xml file from https://github.com/Candoran2/nifxml/tree/develop?

Allofich commented 1 year ago

No, that's not it. I just tried with the nif.xml file from https://github.com/Candoran2/nifxml/tree/develop (with the "10 11" modification) and it still detected the file as "Fallout 3".

Candoran2 commented 1 year ago

If you use the one from https://github.com/Candoran2/nifxml/tree/mickeychanges it should work. I added Oblivion to that version there (that branch contains an 'illegal' change to the xml, at least for NifSkope, hence it's a separate branch).

Allofich commented 1 year ago

Yes, that one works. Even without the "10 11" change, it detects the GOG/Steam .nif as "Oblivion" (but the DVD one as "UNKNOWN"). With the change, both are detected as "Oblivion".

Allofich commented 1 year ago

I just found another one. meshes/architecture/anvil/lighthouseladder01.nif (GOG/Steam version) is imported as Oblivion KF, which I assume is supposed to be for .kf files.

This appears in the console:

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 181, in import_bhk_rigid_body
    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 ()

lighthouseladder01.zip

This is while using the nif.xml from https://github.com/niftools/nifxml/tree/develop.

c-d-a commented 1 year ago

Not sure if any of the following is relevant, but could potentially provide some context. Different DVD versions of the game can also have different nifs. About 75% of models in Russian version are different from the English version, and this doesn't seem related to localization at all. The originals often have version 2.0.0.4, while the modified meshes use 2.0.0.5 and more closely match the updated meshes in Shivering Isles (e.g. skeleton.nif - which btw I'm not sure the unmodded game even makes use of, considering the wacky BSA override rules). Pretty sure retail English DVDs have the same meshes as the Steam version though.

Candoran2 commented 1 year ago

Lighthouseladder01.nif is now imported without error, at least on my end. It still auto-assigns the game as Oblivion KF, but nothing to be done about that - though it gives a warning now that multiple games are possible (i.e. Oblivion KF and Oblivion).

Allofich commented 1 year ago

I can confirm Lighthouseladder01.nif imports without error.

In addition to the Oblivion/Oblivion KF issue (which, if that can't be addressed, I won't bring up anymore), there are other .nifs from Oblivion that are detected as other games. For example, the ear .nifs for the various races are detected as Zoo Tycoon 2. Also several of the .nifs used for the editor, like the a number of the "marker" .nifs, are detected incorrectly as other games. I assume those aren't high-priority, but if these are valid issues, I can list up/provide .nifs that are detected as other games (not just as Oblivion KF).

Candoran2 commented 1 year ago

I can confirm Lighthouseladder01.nif imports without error.

In addition to the Oblivion/Oblivion KF issue (which, if that can't be addressed, I won't bring up anymore), there are other .nifs from Oblivion that are detected as other games. For example, the ear .nifs for the various races are detected as Zoo Tycoon 2. Also several of the .nifs used for the editor, like the a number of the "marker" .nifs, are detected incorrectly as other games. I assume those aren't high-priority, but if these are valid issues, I can list up/provide .nifs that are detected as other games (not just as Oblivion KF).

It would be helpful if you could provide those nifs as reference, yes. The misdetection as Zoo Tycoon 2, specifically, will probably not be fixed, though - per nif version, user version and BS version combination there can be only one game type associated. V10_0_1_0 (0x0A000100, 0 and 0 for that combination) seems to be the only nif version used by Zoo Tycoon 2, so that game will always be selected above Oblivion, where it's only used incidentally.

You can see this in the xml by the <version> tag. The chosen game will be the first game for which this is the default (denoted with {{Game name}} notation), or just the first game if there is no default game.