Skip to content

Commit

Permalink
Merge branch 'master' into skip-normal-check-for-empty-mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 authored Oct 14, 2023
2 parents 263ff91 + ecc8261 commit 7869e3a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog].

## [Unreleased]
### Added
- Add compatibility for Satania's KiseteneEx `#584`

### Changed

Expand All @@ -16,6 +17,10 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Error with MeshRenderer without MeshFilter `#581`
- Preview not working with VRMConverter `#582`
- AvatarMask about HumanoidBone broken `#586`
- Unused Homanoid Bones can be removed `#587`

### Security

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog].

## [Unreleased]
### Added
- Add compatibility for Satania's KiseteneEx `#584`

### Changed

Expand All @@ -16,6 +17,10 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Error with MeshRenderer without MeshFilter `#581`
- Preview not working with VRMConverter `#582`
- AvatarMask about HumanoidBone broken `#586`
- Unused Homanoid Bones can be removed `#587`

### Security

Expand Down
1 change: 1 addition & 0 deletions Editor/EditModePreview/RemoveMeshPreviewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ private void UpdatePreviewMesh()
_indexBuffer.Add(_triangles[triIdx].Third);
}

PreviewMesh.subMeshCount = _subMeshTriangleEndIndices.Length;
while (subMeshIdx < _subMeshTriangleEndIndices.Length &&
triIdx + 1 == _subMeshTriangleEndIndices[subMeshIdx])
{
Expand Down
2 changes: 2 additions & 0 deletions Editor/Processors/ApplyObjectMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ private Object CustomClone(Object o)
else if (o is AvatarMask mask)
{
var newMask = new AvatarMask();
for (var part = AvatarMaskBodyPart.Root; part < AvatarMaskBodyPart.LastBodyPart; ++part)
newMask.SetHumanoidBodyPartActive(part, mask.GetHumanoidBodyPartActive(part));
newMask.name = "rebased " + mask.name;
newMask.transformCount = mask.transformCount;
var dstI = 0;
Expand Down
3 changes: 2 additions & 1 deletion Editor/Processors/SkinnedMeshes/MeshInfo2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public MeshInfo2(MeshRenderer renderer)
SourceRenderer = renderer;
BuildReport.ReportingObject(renderer, true, () =>
{
var mesh = renderer.GetComponent<MeshFilter>().sharedMesh;
var meshFilter = renderer.GetComponent<MeshFilter>();
var mesh = meshFilter ? meshFilter.sharedMesh : null;
if (mesh && !mesh.isReadable)
{
BuildReport.LogFatal("The Mesh is not readable. Please Check Read/Write")?.WithContext(mesh);
Expand Down
29 changes: 29 additions & 0 deletions Editor/Processors/TraceAndOptimize/ComponentDependencyCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ private static void InitByTypeParsers()
for (var bone = HumanBodyBones.Hips; bone < HumanBodyBones.LastBone; bone++)
{
var boneTransform = component.GetBoneTransform(bone);
deps.AddActiveDependency(boneTransform);
foreach (var transform in boneTransform.ParentEnumerable())
{
if (transform == component.transform) break;
Expand Down Expand Up @@ -590,10 +591,38 @@ void CollectTransforms(Transform bone)
_byTypeParser.Add(contextHolder, (collector, deps, component) => deps.EntrypointComponent = true);
}

#region Satania's Kisetene Components

// KiseteneComponent holds information about which cloth the bone came from, which is not important on build
var kiseteneComponent = GetTypeByGuidFileId("e78466b6bcd24e5409dca557eb81d45b", 11500000);
if (kiseteneComponent != null)
_byTypeParser.Add(kiseteneComponent, (collector, deps, component) => deps.EntrypointComponent = true);

// FlyAvatarSetupTool is on-inspector tool which is not important on build
var flyAvatarSetupTool = GetTypeByGuidFileId("7f9c3fe1cfb9d1843a9dc7da26352ce2", 11500000);
if (flyAvatarSetupTool != null)
_byTypeParser.Add(flyAvatarSetupTool, (collector, deps, component) => deps.EntrypointComponent = true);

// BlendShapeOverrider is on-inspector tool which is not important on build
var blendShapeOverrider = GetTypeByGuidFileId("95f6e1368d803614f8a351322ab09bac", 11500000);
if (blendShapeOverrider != null)
_byTypeParser.Add(blendShapeOverrider, (collector, deps, component) => deps.EntrypointComponent = true);

#endregion


// Components Proceed after T&O later
AddEntryPointParser<MergeBone>();
}

private static Type GetTypeByGuidFileId(string guid, long fileId)
{
if (!GlobalObjectId.TryParse($"GlobalObjectId_V1-1-{guid}-{fileId}-0", out var id)) return null;
var script = GlobalObjectId.GlobalObjectIdentifierToObjectSlow(id) as MonoScript;
if (!script) return null;
return script.GetClass();
}

#endregion
}
}
Expand Down

0 comments on commit 7869e3a

Please sign in to comment.