Skip to content

Commit

Permalink
Fixed enabled in BonesPanel, refactored SetMeshesEnabled to not use r…
Browse files Browse the repository at this point in the history
…eflection and to disable meshes consistently with the BonesManager.
  • Loading branch information
originalnicodr committed Jun 20, 2024
1 parent af2ad05 commit d2d22de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Cinematic/Cells/AnimatorPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,12 @@ public void OpenBonesPanel(){
}

public void SetMeshesEnabled(bool value){
PropertyInfo enabledProperty = typeof(SkinnedMeshRenderer).GetProperty("enabled");
foreach (SkinnedMeshRenderer skinnedMesh in skinnedMeshes) {
enabledProperty.SetValue(skinnedMesh, value, null);
skinnedMesh.TryCast<Renderer>().enabled = value;
}

foreach (MeshRenderer meshRenderer in extraMeshes) {
meshRenderer.enabled = value;
meshRenderer.gameObject.SetActive(value);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Panels/BonesPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void OnTurnOffAnimatorToggle(bool value)
bone.localEulerAngles = CachedBonesTransform.angles;
bone.localScale = CachedBonesTransform.scale;
// We assume these were on before. If not we should save its state beforehand.
bone.gameObject.SetEnabled(true);
bone.gameObject.SetActive(true);
}
} else {
bonesOriginalState.Clear();
Expand Down

0 comments on commit d2d22de

Please sign in to comment.