This commit is contained in:
CroakFang
2022-11-03 23:55:36 +08:00
parent badbcf8e7b
commit 63a3bbcc7a
3 changed files with 37 additions and 16 deletions
+2 -4
View File
@@ -40,8 +40,6 @@ public class UmaContainer : MonoBehaviour
public void MergeModel()
{
if (!Body) return;
HeadBone = (GameObject)Body.GetComponent<AssetHolder>()._assetTable.list.FindLast(a => a.Key == "head").Value;
EyeHeight = 0.1f;
TrackTarget = Camera.main.gameObject;
@@ -137,7 +135,7 @@ public class UmaContainer : MonoBehaviour
private void FixedUpdate()
{
if (TrackTarget&&!isAnimatorControl)
if (TrackTarget&&!isAnimatorControl&&!IsMini)
{
var targetPosotion = TrackTarget.transform.position - HeadBone.transform.up*EyeHeight;
var deltaPos = HeadBone.transform.InverseTransformPoint(targetPosotion);
@@ -146,7 +144,7 @@ public class UmaContainer : MonoBehaviour
FaceDrivenKeyTarget.SetEyeRange(finalRotation.x, finalRotation.y, finalRotation.x, -finalRotation.y);
}
if (isAnimatorControl)
if (isAnimatorControl && !IsMini)
{
FaceDrivenKeyTarget.ProcessLocator();
}
+16 -5
View File
@@ -286,8 +286,11 @@ public class UmaViewerBuilder : MonoBehaviour
emotionDriven.FaceDrivenKeyTarget = FaceDriven;
emotionDriven.FaceEmotionKey = UmaDatabaseController.Instance.FaceTypeData.ToList();
emotionDriven.Initialize();
CurrentUMAContainer.HeadBone = (GameObject)CurrentUMAContainer.Body.GetComponent<AssetHolder>()._assetTable.list.FindLast(a => a.Key == "head").Value;
}
CurrentUMAContainer.MergeModel();
CurrentUMAContainer.LoadPhysics();
LoadAsset(UmaViewerMain.Instance.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{id}_00_idle01_loop")));
@@ -956,8 +959,12 @@ public class UmaViewerBuilder : MonoBehaviour
}
else if (clip.name.Contains("face"))
{
CurrentUMAContainer.FaceOverrideController["clip_1"] = clip;
CurrentUMAContainer.FaceDrivenKeyTarget.ResetLocator();
if (CurrentUMAContainer.FaceDrivenKeyTarget)
{
CurrentUMAContainer.FaceDrivenKeyTarget.ResetLocator();
CurrentUMAContainer.FaceOverrideController["clip_1"] = clip;
}
CurrentUMAContainer.isAnimatorControl = true;
CurrentUMAContainer.UmaFaceAnimator.Play("motion_1", 0, 0);
}
@@ -996,7 +1003,8 @@ public class UmaViewerBuilder : MonoBehaviour
else
{
CurrentUMAContainer.isAnimatorControl = false;
CurrentUMAContainer.FaceDrivenKeyTarget.ResetLocator();
if (CurrentUMAContainer.FaceDrivenKeyTarget)
CurrentUMAContainer.FaceDrivenKeyTarget.ResetLocator();
PreviewCamera.enabled = false;
if (CurrentCameraAnimator)
@@ -1095,8 +1103,11 @@ public class UmaViewerBuilder : MonoBehaviour
if (container.Slider != null)
container.Slider.SetValueWithoutNotify(0);
}
CurrentUMAContainer.FaceDrivenKeyTarget.ClearMorph();
CurrentUMAContainer.FaceDrivenKeyTarget.ChangeMorph();
if (CurrentUMAContainer.FaceDrivenKeyTarget)
{
CurrentUMAContainer.FaceDrivenKeyTarget.ClearMorph();
CurrentUMAContainer.FaceDrivenKeyTarget.ChangeMorph();
}
}
}
+19 -7
View File
@@ -565,6 +565,7 @@ public class UmaViewerUI : MonoBehaviour
AnimationSlider.SetValueWithoutNotify(0);
// Reset settings by Panel
Builder.CurrentUMAContainer.UmaAnimator.speed = AnimationSpeedSlider.value;
if(Builder.CurrentUMAContainer.UmaFaceAnimator)
Builder.CurrentUMAContainer.UmaFaceAnimator.speed = AnimationSpeedSlider.value;
}
@@ -668,23 +669,28 @@ public class UmaViewerUI : MonoBehaviour
if (state)
{
animator.speed = 0;
animator_face.speed = 0;
if (animator_face)
animator_face.speed = 0;
animator_cam.speed = 0;
}
else if (AnimeState.normalizedTime < 1f)
{
animator.speed = AnimationSpeedSlider.value;
animator_face.speed = AnimationSpeedSlider.value;
animator_cam.speed = AnimationSpeedSlider.value;
if (animator_face)
animator_face.speed = AnimationSpeedSlider.value;
}
else
{
animator.speed = AnimationSpeedSlider.value;
animator.Play(0, -1, 0);
animator_face.speed = AnimationSpeedSlider.value;
animator_face.Play(0, -1, 0);
animator_cam.speed = AnimationSpeedSlider.value;
animator_cam.Play(0, -1, 0);
if (animator_face)
{
animator_face.speed = AnimationSpeedSlider.value;
animator_face.Play(0, -1, 0);
}
}
}
@@ -703,10 +709,13 @@ public class UmaViewerUI : MonoBehaviour
// Pause and Seek;
animator.speed = 0;
animator.Play(0, -1, val);
animator_face.speed = 0;
animator_face.Play(0, -1, val);
animator_cam.speed = 0;
animator_cam.Play(0, -1, val);
if (animator_face)
{
animator_face.speed = 0;
animator_face.Play(0, -1, val);
}
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
}
@@ -717,8 +726,11 @@ public class UmaViewerUI : MonoBehaviour
AnimationSpeedText.text = string.Format("Animation Speed: {0:F2}", val);
if (!Builder.CurrentUMAContainer || !Builder.CurrentUMAContainer.UmaAnimator) return;
Builder.CurrentUMAContainer.UmaAnimator.speed = val;
Builder.CurrentUMAContainer.UmaFaceAnimator.speed = val;
Builder.CurrentCameraAnimator.speed = val;
if (Builder.CurrentUMAContainer.UmaFaceAnimator)
{
Builder.CurrentUMAContainer.UmaFaceAnimator.speed = val;
}
}
public void ResetAudioPlayer()