Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix merge bone break fur #542

Merged
merged 3 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- MergeBone may break Fur (hotfix) `#540`
- MergePhysBone component may be shown as unknown components `#541`
- MergeBone may break Fur `#542`

### Security

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- MergeBone may break Fur (hotfix) `#540`
- MergePhysBone component may be shown as unknown components `#541`
- MergeBone may break Fur `#542`

### Security

Expand Down
29 changes: 0 additions & 29 deletions Editor/DebugConfigWindow.cs

This file was deleted.

3 changes: 0 additions & 3 deletions Editor/DebugConfigWindow.cs.meta

This file was deleted.

4 changes: 0 additions & 4 deletions Editor/Processors/MergeBoneProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ private void DoBoneMap2(MeshInfo2 meshInfo2, Dictionary<Transform, Transform> me

if (!boneReplaced) return;

// disable BindPose optimization by default
if (!EditorPrefs.GetBool("com.anatawa12.avatar-optimizer.merge-bone-bindpose-optimization", false))
return;

// Optimization 1: if vertex is affected by only one bone, we can merge to one weight
foreach (var vertex in meshInfo2.Vertices)
{
Expand Down
9 changes: 2 additions & 7 deletions Editor/Processors/SkinnedMeshes/MeshInfo2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void WriteToMesh(Mesh destMesh)
for (var i = 0; i < Vertices.Count; i++)
{
vertices[i] = Vertices[i].Position;
normals[i] = Vertices[i].Normal.normalized;
normals[i] = Vertices[i].Normal;
}

destMesh.vertices = vertices;
Expand All @@ -317,12 +317,7 @@ public void WriteToMesh(Mesh destMesh)
{
var tangents = new Vector4[Vertices.Count];
for (var i = 0; i < Vertices.Count; i++)
{
var tangent3 = (Vector3)Vertices[i].Tangent;
var tangentW = Vertices[i].Tangent.w;
tangent3.Normalize();
tangents[i] = new Vector4(tangent3.x, tangent3.y, tangent3.z, tangentW);
}
tangents[i] = Vertices[i].Tangent;
destMesh.tangents = tangents;
}

Expand Down