Skip to content

Commit 031b7f5

Browse files
committed
Recalculate tangent on UV flip
1 parent 3685289 commit 031b7f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Plugins/CafeLibrary/Bfres/Editing/Nodes/ModelWrapper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,9 @@ private void FlipUVsHorizontalAction()
22532253
foreach (var mesh in ModelWrapper.GetSelectedMeshes())
22542254
{
22552255
mesh.FlipUvsHorizontal();
2256+
// Check for tangent usage and update for UV changes
2257+
if (VertexBuffer.Attributes.ContainsKey("_t0"))
2258+
mesh.CalculateTangentBitangent(0);
22562259
mesh.ApplyVertexData();
22572260
}
22582261
}
@@ -2262,6 +2265,9 @@ private void FlipUVsVerticalAction()
22622265
foreach (var mesh in ModelWrapper.GetSelectedMeshes())
22632266
{
22642267
mesh.FlipUvsVertical();
2268+
// Check for tangent usage and update for UV changes
2269+
if (VertexBuffer.Attributes.ContainsKey("_t0"))
2270+
mesh.CalculateTangentBitangent(0);
22652271
mesh.ApplyVertexData();
22662272
}
22672273
}

0 commit comments

Comments
 (0)