Skip to content

Commit

Permalink
Merge pull request #708 from anatawa12/fix-enablement
Browse files Browse the repository at this point in the history
fix: enablement detection doesn't use activeness of parents
  • Loading branch information
anatawa12 authored Nov 11, 2023
2 parents a98e8a2 + d23a66f commit a484de5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Editor/Processors/SkinnedMeshes/MergeSkinnedMeshProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ public override void Process(BuildContext context, MeshInfo2 target)
List<MeshRenderer> staticMeshRenderers;
if (Component.skipEnablementMismatchedRenderers)
{
bool RendererEnabled(Renderer x) => x.enabled && x.gameObject.activeSelf;
bool RendererEnabled(Renderer x)
{
if (!x.enabled) return false;
for (var transform = x.transform;
transform != null && transform != context.AvatarRootTransform;
transform = transform.parent)
if (!transform.gameObject.activeSelf)
return false;
return true;
}

var enabledSelf = RendererEnabled(Target);
skinnedMeshRenderers = SkinnedMeshRenderers.Where(x => RendererEnabled(x) == enabledSelf).ToList();
staticMeshRenderers = StaticMeshRenderers.Where(x => RendererEnabled(x) == enabledSelf).ToList();
Expand Down

0 comments on commit a484de5

Please sign in to comment.