Skip to content

Commit

Permalink
spApplyTransformation: fixed error on full precision BSTriShape vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
fo76utils committed Dec 17, 2024
1 parent c268a90 commit 16886fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Exported UV layouts can be solid filled.
* Improvements to OBJ export.
* Added support for more Skyrim Havok material types that were previously unknown.
* Fixed error message on using Transform/Apply on BSTriShape geometry with full precision vertex positions.
* Fixed the block types NiMeshPSysData and NiMeshParticleSystem being incorrectly filtered out by 'Block/Insert'.

#### NifSkope-2.0.dev9-20241112
Expand Down
11 changes: 8 additions & 3 deletions src/spells/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,14 @@ QModelIndex spApplyTransformation::cast( NifModel * nif, const QModelIndex & ind
for ( int i = 0; i < nif->rowCount( iVertData ); i++ ) {
auto iVert = nif->getIndex( iVertData, i );

auto vertex = t * nif->get<Vector3>( iVert, "Vertex" );
if ( !nif->set<HalfVector3>( iVert, "Vertex", vertex ) )
nif->set<Vector3>( iVert, "Vertex", vertex );
auto iVertex = nif->getItem( iVert, "Vertex" );
if ( iVertex ) {
auto vertex = t * nif->get<Vector3>( iVertex );
if ( iVertex->hasValueType( NifValue::tHalfVector3 ) )
nif->set<HalfVector3>( iVertex, vertex );
else
nif->set<Vector3>( iVertex, vertex );
}

// Transform BTN if applicable
if ( !(t.rotation == Matrix()) ) {
Expand Down

0 comments on commit 16886fe

Please sign in to comment.