Added morph clear button
removed redundant property
This commit is contained in:
@@ -20,7 +20,6 @@ public class UmaContainer : MonoBehaviour
|
||||
public AnimatorOverrideController OverrideController;
|
||||
|
||||
[Header("Face")]
|
||||
public List<AnimationClip> FacialClips = new List<AnimationClip>();
|
||||
public FaceDrivenKeyTarget FaceDrivenKeyTarget;
|
||||
public FaceEmotionKeyTarget FaceEmotionKeyTarget;
|
||||
|
||||
|
||||
@@ -1043,4 +1043,23 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
Destroy(CurrentUMAContainer.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearMorphs()
|
||||
{
|
||||
if (CurrentUMAContainer != null && CurrentUMAContainer.FaceDrivenKeyTarget != null)
|
||||
{
|
||||
foreach (var container in UI.EmotionList.GetComponentsInChildren<UmaUIContainer>())
|
||||
{
|
||||
if (container.Slider != null)
|
||||
container.Slider.value = 0;
|
||||
}
|
||||
foreach (var container in UI.FacialList.GetComponentsInChildren<UmaUIContainer>())
|
||||
{
|
||||
if (container.Slider != null)
|
||||
container.Slider.SetValueWithoutNotify(0);
|
||||
}
|
||||
CurrentUMAContainer.FaceDrivenKeyTarget.ClearMorph();
|
||||
CurrentUMAContainer.FaceDrivenKeyTarget.ChangeMorph();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,40 @@ public class UmaViewerUI : MonoBehaviour
|
||||
canvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.Shrink;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Builder.CurrentAudioSources.Count > 0)
|
||||
{
|
||||
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
||||
if (MianSource.clip)
|
||||
{
|
||||
TitleText.text = MianSource.clip.name;
|
||||
ProgressText.text = string.Format("{0} / {1}", ToTimeFormat(MianSource.time), ToTimeFormat(MianSource.clip.length));
|
||||
AudioSlider.SetValueWithoutNotify(MianSource.time / MianSource.clip.length);
|
||||
LyricsText.text = GetCurrentLyrics(MianSource.time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Builder.CurrentUMAContainer != null && Builder.CurrentUMAContainer.OverrideController != null)
|
||||
{
|
||||
if (Builder.CurrentUMAContainer.OverrideController["clip_2"].name != "clip_2")
|
||||
{
|
||||
bool isLoop = Builder.CurrentUMAContainer.OverrideController["clip_2"].name.EndsWith("_loop");
|
||||
var AnimeState = Builder.CurrentUMAContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0);
|
||||
var AnimeClip = Builder.CurrentUMAContainer.OverrideController["clip_2"];
|
||||
if (AnimeClip && Builder.CurrentUMAContainer.UmaAnimator.speed != 0)
|
||||
{
|
||||
var normalizedTime = (isLoop) ? Mathf.Repeat(AnimeState.normalizedTime, 1) : Mathf.Min(AnimeState.normalizedTime, 1);
|
||||
|
||||
AnimationTitleText.text = AnimeClip.name;
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
AnimationSlider.SetValueWithoutNotify(normalizedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HighlightChildImage(Transform mainObject, Image child)
|
||||
{
|
||||
foreach(var t in mainObject.GetComponentsInChildren<Image>())
|
||||
@@ -184,7 +218,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
{
|
||||
var container = Instantiate(UmaContainerSliderPrefab, FacialList.content).GetComponent<UmaUIContainer>();
|
||||
container.Name.text = morph.name + " (" + morph.tag + ")";
|
||||
container.Slider.value = morph.Weight;
|
||||
container.Slider.value = morph.weight;
|
||||
container.Slider.maxValue = 1;
|
||||
container.Slider.minValue = 0;
|
||||
container.Slider.onValueChanged.AddListener((a) => { target.ChangeMorphWeight(morph, a); });
|
||||
@@ -647,40 +681,6 @@ public class UmaViewerUI : MonoBehaviour
|
||||
Builder.CurrentUMAContainer.UmaAnimator.speed = val;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Builder.CurrentAudioSources.Count > 0)
|
||||
{
|
||||
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
||||
if (MianSource.clip)
|
||||
{
|
||||
TitleText.text = MianSource.clip.name;
|
||||
ProgressText.text = string.Format("{0} / {1}", ToTimeFormat(MianSource.time), ToTimeFormat(MianSource.clip.length));
|
||||
AudioSlider.SetValueWithoutNotify(MianSource.time/ MianSource.clip.length);
|
||||
LyricsText.text = GetCurrentLyrics(MianSource.time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Builder.CurrentUMAContainer != null && Builder.CurrentUMAContainer.OverrideController != null)
|
||||
{
|
||||
if(Builder.CurrentUMAContainer.OverrideController["clip_2"].name != "clip_2")
|
||||
{
|
||||
bool isLoop = Builder.CurrentUMAContainer.OverrideController["clip_2"].name.EndsWith("_loop");
|
||||
var AnimeState = Builder.CurrentUMAContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0);
|
||||
var AnimeClip = Builder.CurrentUMAContainer.OverrideController["clip_2"];
|
||||
if (AnimeClip && Builder.CurrentUMAContainer.UmaAnimator.speed != 0)
|
||||
{
|
||||
var normalizedTime = (isLoop) ? Mathf.Repeat(AnimeState.normalizedTime, 1) : Mathf.Min(AnimeState.normalizedTime, 1);
|
||||
|
||||
AnimationTitleText.text = AnimeClip.name;
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
AnimationSlider.SetValueWithoutNotify(normalizedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetAudioPlayer()
|
||||
{
|
||||
TitleText.text = "No Audio";
|
||||
|
||||
@@ -142,17 +142,17 @@ namespace Gallop
|
||||
{
|
||||
foreach (FacialMorph morph in EyeBrowMorphs)
|
||||
{
|
||||
morph._weight = 0;
|
||||
morph.weight = 0;
|
||||
}
|
||||
|
||||
foreach (FacialMorph morph in EyeMorphs)
|
||||
{
|
||||
morph._weight = 0;
|
||||
morph.weight = 0;
|
||||
}
|
||||
|
||||
foreach (FacialMorph morph in MouthMorphs)
|
||||
{
|
||||
morph._weight = 0;
|
||||
morph.weight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,9 +162,9 @@ namespace Gallop
|
||||
{
|
||||
if (trs.transform)
|
||||
{
|
||||
trs.transform.localScale += trs._scale * morph.Weight;
|
||||
trs.transform.localPosition += trs._position * morph.Weight;
|
||||
RotationRecorder[trs.transform] += trs._rotation * morph.Weight;
|
||||
trs.transform.localScale += trs._scale * morph.weight;
|
||||
trs.transform.localPosition += trs._position * morph.weight;
|
||||
RotationRecorder[trs.transform] += trs._rotation * morph.weight;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ namespace Gallop
|
||||
|
||||
public void ChangeMorphWeight(FacialMorph morph,float val)
|
||||
{
|
||||
morph.Weight = val;
|
||||
morph.weight = val;
|
||||
ChangeMorph();
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FaceEmotionKeyTarget : ScriptableObject
|
||||
}
|
||||
newValue.weight = Convert.ToInt32(splitArray[1]);
|
||||
faceTypeData.emotionKeys.Add(newValue);
|
||||
Debug.Log(newValue.weight);
|
||||
//Debug.Log(newValue.weight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -62,7 +62,7 @@ public class FaceEmotionKeyTarget : ScriptableObject
|
||||
}
|
||||
newValue.weight = 100;
|
||||
faceTypeData.emotionKeys.Add(newValue);
|
||||
Debug.Log(morphName);
|
||||
//Debug.Log(morphName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class FaceEmotionKeyTarget : ScriptableObject
|
||||
{
|
||||
foreach (var key in emotion.emotionKeys)
|
||||
{
|
||||
key.morph.Weight += key.weight / 100 * emotion.Weight;
|
||||
key.morph.weight += key.weight / 100 * emotion.Weight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,18 +14,7 @@ namespace Gallop
|
||||
public string tag = "";
|
||||
public bool direction;
|
||||
public FaceDrivenKeyTarget target;
|
||||
public float _weight;
|
||||
public float Weight
|
||||
{
|
||||
get
|
||||
{
|
||||
return _weight;
|
||||
}
|
||||
set
|
||||
{
|
||||
_weight = value;
|
||||
}
|
||||
}
|
||||
public float weight;
|
||||
public List<TrsArray> trsArray;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user