hexabits / nifskope

Other
245 stars 54 forks source link

[Dev 9] Error saving some files with CMS collision #67

Open GammaMetroid opened 11 months ago

GammaMetroid commented 11 months ago

Attempting to save some files, e.g. meshes\clutter\weaponrack\wrplaqueshield01.nif from vanilla Skyrim, results in this error:

Failed to write block bhkCompressedMeshShapeData (9).

The error did not occur in dev 7.

W-Drew commented 8 months ago

meshes\dungeons\nordic\levers\pullchain\genpullchain01.nif / meshes\dungeons\nordic\levers\pullchain\genpullchain02.nif are also impacted

Meridiano commented 8 months ago

I can confirm this is a real issue for many files. "meshes\landscape\bridges\bridge01.nif" and others. This commit can be related and fix this: https://github.com/UnknownExplorer13/NifSkope/commit/3cb428f8dc274a544a9cc3847e96cdd9b24ad85a. Many thanks to @candoran2 for his explanation!

W-Drew commented 8 months ago

Looking at that commit, is this a bug in the 0.9.3.0 version of nif.xml where it broke support for compressed mesh shapes, or is it a problem on the consumption side (need to update nifskope to use the new schema)?

Candoran2 commented 8 months ago

It's not a bug in the 0.9.3.0 version of the nif xml, just a change - so yes, NifSkope needs to be updated to match it. Most of that has already happened in https://github.com/hexabits/nifskope/commit/1365ca1d6d68a6b3d18efe1c5c43a7c605313939 . As a result, the display and loading of the bhkCompressedMeshShape seems to go fine. It's only the saving that goes wrong.

Candoran2 commented 8 months ago

I think I found the problem. In this line: https://github.com/hexabits/nifskope/blob/a08b0c1d3428740f13abea6047ccb258c5741f3e/src/io/nifstream.cpp#L640 the == 3 needs to be changed to a == 6. That seems to have fixed the problem on my end.

W-Drew commented 8 months ago

That's odd. When I build latest develop, I don't actually encounter this error anymore even though nifstream.cpp does not have the fix @Candoran2 mentioned previously. Saving and re-opening one of the aforementioned files preserves the bhkCompressedMeshShape.

Though, while I don't get the compressed mesh shape save failure, I see on both open/save of genpullchain01.nif / other files.

BSTriShape [16]\Vertex Data [0]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [0]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [1]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [1]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [2]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [2]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [3]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [3]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [4]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [4]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [5]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [5]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [6]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [6]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [7]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [7]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [8]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [8]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [9]\Bitangent Y: Could not convert a value of type Byte (1) to a float.
BSTriShape [16]\Vertex Data [9]\Bitangent Z: Could not convert a value of type Byte (1) to a float.
Candoran2 commented 8 months ago

That's odd. When I build latest develop, I don't actually encounter this error anymore even though nifstream.cpp does not have the fix

That'll be because the develop branch doesn't yet have the nif.xml that's used in the release. Copy the one in the release from there into the build folder and compile it again, or copy it into the place where you've put the built NifSkope to get all that recent nif.xml information.

W-Drew commented 8 months ago

Is that just changed outside of source control for the releases? Or are releases building off of some other fork? If outside of source control, are there any other edits needed to get parity with a release build?

Candoran2 commented 8 months ago

Is that just changed outside of source control for the releases? Or are releases building off of some other fork? If outside of source control, are there any other edits needed to get parity with a release build?

It's supposed to be edited with the source control, but it's easily forgotten. There's even been cases of edits in the xml that made it into a NifSkope release without ever being in the xml repository, though that's obviously not how it's supposed to happen.

Safest bet for now is just to copy the one from the release. I believe gavrant's fork (the one with the open PR for this fork) actually has it updated already.