mirror of
https://github.com/originalnicodr/CinematicUnityExplorer.git
synced 2025-07-18 17:38:01 +08:00
Search AnimatorCell-associated meshes again when refreshing the animator's list. Refreshes the bone panel with the new meshes.
This commit is contained in:
@ -48,8 +48,12 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
this.favAnimations = new List<IAnimationClip>();
|
||||
|
||||
this.skinnedMeshes.AddRange(this.animator.wrappedObject.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(false));
|
||||
this.extraMeshes.AddRange(this.animator.wrappedObject.gameObject.GetComponentsInChildren<MeshRenderer>(false));
|
||||
SearchMeshes();
|
||||
}
|
||||
|
||||
public void SearchMeshes(){
|
||||
skinnedMeshes = new List<SkinnedMeshRenderer>(animator.wrappedObject.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(false));
|
||||
extraMeshes = new List<MeshRenderer>(animator.wrappedObject.gameObject.GetComponentsInChildren<MeshRenderer>(false));
|
||||
}
|
||||
|
||||
// Include the animations being played in other layers
|
||||
@ -125,7 +129,7 @@ namespace UnityExplorer.UI.Panels
|
||||
}
|
||||
}
|
||||
|
||||
private List<Transform> GetMeshes(){
|
||||
private List<Transform> GetMeshesTransforms(){
|
||||
List<Transform> meshes = new List<Transform>();
|
||||
|
||||
foreach (SkinnedMeshRenderer skinnedMesh in skinnedMeshes) {
|
||||
@ -139,11 +143,16 @@ namespace UnityExplorer.UI.Panels
|
||||
public void OpenBonesPanel(){
|
||||
if (skinnedMeshes.Count == 0 && extraMeshes.Count == 0) return;
|
||||
if (bonesManager == null){
|
||||
bonesManager = new BonesManager(UIManager.GetPanel<UnityExplorer.UI.Panels.AnimatorPanel>(UIManager.Panels.AnimatorPanel).Owner, GetMeshes(), animator);
|
||||
bonesManager = new BonesManager(UIManager.GetPanel<UnityExplorer.UI.Panels.AnimatorPanel>(UIManager.Panels.AnimatorPanel).Owner, GetMeshesTransforms(), animator);
|
||||
}
|
||||
bonesManager.SetActive(true);
|
||||
}
|
||||
|
||||
public void MaybeResetBonesPanel(){
|
||||
if (bonesManager == null) return;
|
||||
bonesManager.RefreshBones(GetMeshesTransforms());
|
||||
}
|
||||
|
||||
public void SetMeshesEnabled(bool value){
|
||||
foreach (SkinnedMeshRenderer skinnedMesh in skinnedMeshes) {
|
||||
skinnedMesh.TryCast<Renderer>().enabled = value;
|
||||
|
@ -76,6 +76,10 @@ namespace UnityExplorer.UI.Panels
|
||||
animators[i].animations.Add(animationClip);
|
||||
}
|
||||
newAnimators[newAnimatorsIndex] = animators[i];
|
||||
|
||||
// Reset meshes
|
||||
newAnimators[newAnimatorsIndex].SearchMeshes();
|
||||
newAnimators[newAnimatorsIndex].MaybeResetBonesPanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,13 @@ namespace UnityExplorer.UI.Panels
|
||||
BuildBoneTrees();
|
||||
}
|
||||
|
||||
public void RefreshBones(List<Transform> bones) {
|
||||
this.bones = bones;
|
||||
boneTrees.Clear();
|
||||
BuildBoneTrees();
|
||||
boneScrollPool.Refresh(true, true);
|
||||
}
|
||||
|
||||
private void BuildBoneTrees(){
|
||||
BoneTree root = new BoneTree(animator.wrappedObject.gameObject, bones);
|
||||
if (root.obj != null){
|
||||
|
Reference in New Issue
Block a user