Skip to content

Commit

Permalink
Update individual cell mesh togglers if the global toggler is interac…
Browse files Browse the repository at this point in the history
…ted with.
  • Loading branch information
originalnicodr committed Aug 5, 2024
1 parent 8f2ec19 commit 7a580d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Cinematic/Cells/AnimatorCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void SetAnimatorPlayer(AnimatorPlayer animatorPlayer){
inspectButton.ButtonText.text = animatorPlayer.animator.name;
IgnoreMasterToggle.isOn = animatorPlayer.shouldIgnoreMasterToggle;
animatorToggler.isOn = animatorPlayer.animator.speed != 0;
MeshToggle.isOn = animatorPlayer.IsMeshHidden();

UpdateDropdownOptions();
}
Expand Down
5 changes: 5 additions & 0 deletions src/Cinematic/Cells/AnimatorPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public void SetMeshesEnabled(bool value){
meshRenderer.gameObject.SetActive(value);
}
}

public bool IsMeshHidden(){
// Could maybe save a variable to set on SetMeshesEnabled instead
return skinnedMeshes.Any( m => m.TryCast<Renderer>().enabled) || extraMeshes.Any( m => m.gameObject.activeSelf);
}
}

public class IAnimator
Expand Down

0 comments on commit 7a580d1

Please sign in to comment.