Export sets bone rotations to 0,0,-90 after multiple imports

The place to ask for help with the Blender scripts or to report bugs. Post game-specific questions in the modding section below.

Export sets bone rotations to 0,0,-90 after multiple imports

Postby opusGlass » Sun Mar 19, 2017 10:00 pm

NifTools 2.6.0 Dev 4 (from June 18th 2016), with the following changes to fix armature export:
https://github.com/niftools/blender_nif ... /252/files
viewtopic.php?f=21&t=6700
Blender 2.78c
Skyrim

I mentioned this in my last post (about bone names) but since I solved that one, I think I should post a separate thread for this.

In certain situations, all bones have a rotation of 0,0,-90 after exporting, regardless of their original value. This causes the meshes to appear terribly deformed in-game.
It seems to only happen if multiple meshes were imported into a file, but behaves strangely:

Importing Troll.nif then immediately exporting is successful.
Importing Troll.nif then IcicleThinStrip.nif, then exporting only the troll, fails to export bone rotations.
Importing Troll.nif then IcicleThinStrip.nif, merging them, deleting the icicle trishape, then exporting, is successful.
Importing Troll.nif then IcicleThinStrip.nif, merging them, deleting the troll, then exporting, fails to export bone rotations.

This makes it impossible add parts of other meshes to the troll AFAIK, since it will ruin your rigging. Which is strange, since I've done this successfully with the Frost Giant mesh before.

If anyone knows how to fix this, please let me know.


edit: I've had some luck with copying the mesh components into separate blender files before exporting. Not an ideal solution but it has worked so far.
opusGlass
 
Posts: 23
Joined: Mon Sep 07, 2015 10:08 pm

Re: Export sets bone rotations to 0,0,-90 after multiple imp

Postby neomonkeus » Mon Mar 20, 2017 2:38 pm

Created - https://github.com/niftools/blender_nif ... issues/262
If you can provide I can further fill out the ticket.
- Please post bugs and feature requests on the forum.

Latest Blender Nif Plug-in News
Blender Nif Plug-in - Dev Version
Blender Nif Plug-in - Dev - Milestone/Issues

A diffuse map is a piece of paper which tells you where the bomb is so that you can diffuse it.
Please avoid using the .obj format, it usually ends in tears :D.
User avatar
neomonkeus
NifTools Developer
NifTools Developer
 
Posts: 1629
Joined: Wed Jul 14, 2010 12:14 pm
Location: whatever couch I can find, Ireland

Re: Export sets bone rotations to 0,0,-90 after multiple imp

Postby opusGlass » Tue Mar 21, 2017 5:11 am

I wrote the following extra information about the problem. But, then I tried testing some more cases, and the problem seems to have partly disappeared. It still occurs when I load a saved .Blend file that already had the issue, but it is no longer occurring for any newly-imported Nifs. Even when I test the exact cases that I tested with last night. Maybe I imported those files before fixing the naming issue, and that caused some data to be lost? I know the bone names are used for indexing, so it's possible. But I could've sworn I did a bunch of testing after fixing the naming issue...idk.

In any case, here is what I wrote before. I'm not sure how much of it is true anymore, but I'll publish it for the record.


---


I've figured out an easy way to avoid this problem (and I'm kicking myself for not thinking of it before). If you merge all of the objects into a single mesh with CTRL+J, it will export the bone data correctly. (The NiTriShapes will be grouped under a single NiNode, which causes CTD in-game, but that is easily fixed by parenting the NiTriShapes directly to the root node and deleting the extra NiNode.)

So from this, I am concluding that the issue only occurs when the Object Export protocols need to be used. When it is only an Armature Export there is no issue.
This is supported by the fix I found for the other issue (bone naming during export). I now realize that the renaming issue occurs in similar circumstances as this rotation issue -- only when exporting a blend file containing multiple separate meshes that haven't been joined. The fix for this was in the get_bone_name_for_nif function. Running a findstr command, I see that this function is called from 6 places; examining all 6 places, they are all used strictly for indexing purposes (which only need to be internally consistent to work) except for a single call from object_export.py, which saves the value into a variable for export into the Nif. Since the naming error occurs in similar circumstances as rotation error, I believe that the rotation error probably also stems from object_export.py or a function that it uses.

Unfortunately I don't think I will be able to identify the exact issue in the code, since linear algebra isn't my strong point.
opusGlass
 
Posts: 23
Joined: Mon Sep 07, 2015 10:08 pm

Re: Export sets bone rotations to 0,0,-90 after multiple imp

Postby neomonkeus » Wed Mar 22, 2017 2:14 pm

Bone names are stored in file as part of the blend file, so if they imported incorrectly, then I would suspect it would remain as such in the existing .blend file, even post fix
Updated the issue on github with the additional information.
- Please post bugs and feature requests on the forum.

Latest Blender Nif Plug-in News
Blender Nif Plug-in - Dev Version
Blender Nif Plug-in - Dev - Milestone/Issues

A diffuse map is a piece of paper which tells you where the bomb is so that you can diffuse it.
Please avoid using the .obj format, it usually ends in tears :D.
User avatar
neomonkeus
NifTools Developer
NifTools Developer
 
Posts: 1629
Joined: Wed Jul 14, 2010 12:14 pm
Location: whatever couch I can find, Ireland


Return to Blender Plug-in Help & Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest