Skip to content

get_translation() and set_translation() of Matrix44 not working correctly #72

@Candoran2

Description

@Candoran2

@niftools/pyffi-reviewers

Issue Overview

Because the Matrix44 class is imported/exported transposed to how it is displayed in NifSkope, the get_translation() and set_translation() functions of that class do not work as expected.

Version Information

Pyffi Version Info

2.2.4.dev3, can confirm it is also happening with 2.2.4.dev4

Platform information

Windows 10 64-bit, using pyffi through the Blender Nif plugin.

Context

The transform of a bhkConvexTransformShape is transposed to how it is displayed in NifSkope. This is even right after the pyffi import (i.e. at the end of the load_nif function) or right before pyffi export (i.e. just before the data.write(stream)). This means that the get_translation() and set_translation() functions, which set and get from the bottom row (correct with how it is displayed in NifSkope), do not operate on the translation, but on the useless fourth column once back in NifSkope.

Steps to Reproduce

  • Load a model with a bhkConvexTransformShape that has a non-zero translation using Pyffi
  • (optional) Display the bhkConvexTransformShape's transform
  • Modify the translation using set_translation() and get_translation() (e.g. multiply the translation by 2)
  • (optional) Display the bhkConvexTransformShape's transform
  • Save it back as a nif

Expected Result

The expected result is that get_translation() and set_translation() do the intended modification.

Actual Result

There is no modification on the exported translation, instead the fourth column is affected.

Possible Fix

Either change get_translation() and set_translation() to reflect the fact that the Matrix44 is transposed upon import/export, or do not transpose the Matrix44.

Screenshot

image
image
image
image

Logs and Files

File I tested with:
https://cdn.discordapp.com/attachments/702566403605266435/706515307014914138/irondagger.nif

Console Output

Relevant output found in screenshots above.

Similar Known Issues

None that I could find.

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions