ousnius / BodySlide-and-Outfit-Studio

BodySlide and Outfit Studio, a tool to convert, create, and customize outfits and bodies for Bethesda games.
GNU General Public License v3.0
290 stars 64 forks source link

CTD induced by incorrect sorted blocks #328

Closed testiger2 closed 3 years ago

testiger2 commented 3 years ago

Just wanted to report an issue with the new block ordering from https://github.com/ousnius/BodySlide-and-Outfit-Studio/issues/316

I found out that Collision blocks get ordered/indexed in the reverse order they are supposed to. Normally you would have something like this: (4)bhkCollisionObject->(3)bhkRigidBody->(2)bhkBoxShape

The new code orders them like this ; (2)bhkCollisionObject->(3)bhkRigidBody->(4)bhkBoxShape This behavior reliably leads to CTD's in Oldrim (did not test SSE or FO)

Was able to reproduce it by running a vanilla mesh (gnd mesh with collision) through some test code:

#include "NifFile.h"

int main(int argc, char* const argv[])
{
    char* filename = argv[1];
    if (!filename) return 1;

    NifFile nif;
    nif.Load(filename);

    nif.Save(filename);
    std::cout << "Done" << std::endl;
    return 0;
}

Testing procedure i used:

I have no clue wether other blocktypes are affected as well i just stumpbled upon the Collisions when i made some meshes.

ousnius commented 3 years ago

This was fixed before the next release (the bug was not present in any Nexus release yet). Thanks for the report.