minor bug fix

This commit is contained in:
左右看
2023-07-30 18:30:20 +08:00
parent eb3173f6ac
commit 6b476cf1dc
7 changed files with 108 additions and 13 deletions
@@ -19,7 +19,9 @@ namespace Gallop.Live.Cutt
public LiveTimelineKeyFacialEyebrowData eyebrowPrev; // 0x28
public LiveTimelineKeyFacialEyebrowData eyebrowCur; // 0x28
public LiveTimelineKeyFacialEyebrowData eyebrowNext; // 0x28
public LiveTimelineKeyFacialEyeTrackData eyeTrack; // 0x30
public LiveTimelineKeyFacialEyeTrackData eyeTrackPrev; // 0x30
public LiveTimelineKeyFacialEyeTrackData eyeTrackCur; // 0x30
public LiveTimelineKeyFacialEyeTrackData eyeTrackNext; // 0x30
public LiveTimelineKeyFacialEarData earPrev; // 0x38
public LiveTimelineKeyFacialEarData earCur; // 0x38
public LiveTimelineKeyFacialEarData earNext; // 0x38
@@ -46,7 +46,7 @@ namespace Gallop.Live.Cutt
public Quaternion liveCharaPositionLocalRotation { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public Vector3 liveCharaHeadPosition => UmaContainer.HeadBone.transform.position + new Vector3(0, UmaContainer.EyeHeight, 0);
public Vector3 liveCharaHeadPosition => UmaContainer.HeadBone.transform.position + new Vector3(0, 0.1f, 0);
public Vector3 liveCharaWaistPosition => Bones["Waist"].position;
@@ -6,6 +6,7 @@ using static RootMotion.FinalIK.IKSolverVR;
using System.Linq;
using System.IO;
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
using static Gallop.Live.Cutt.LiveTimelineDefine;
namespace Gallop.Live.Cutt
{
@@ -363,6 +364,7 @@ namespace Gallop.Live.Cutt
SetupFacialUpdateInfo_Eye(ref updateInfo, facialDataList.eyeKeys, liveTime);
SetupFacialUpdateInfo_Eyebrow(ref updateInfo, facialDataList.eyebrowKeys, liveTime);
SetupFacialUpdateInfo_Ear(ref updateInfo, facialDataList.earKeys, liveTime);
SetupFacialUpdateInfo_EyeTrack(ref updateInfo, facialDataList.eyeTrackKeys, liveTime);
this.OnUpdateFacial(updateInfo, liveTime, 0);
}
@@ -373,6 +375,7 @@ namespace Gallop.Live.Cutt
SetupFacialUpdateInfo_Eye(ref updateInfo, otherFacialDataList[i].eyeKeys, liveTime);
SetupFacialUpdateInfo_Eyebrow(ref updateInfo, otherFacialDataList[i].eyebrowKeys, liveTime);
SetupFacialUpdateInfo_Ear(ref updateInfo, otherFacialDataList[i].earKeys, liveTime);
SetupFacialUpdateInfo_EyeTrack(ref updateInfo, otherFacialDataList[i].eyeTrackKeys, liveTime);
this.OnUpdateFacial(updateInfo, liveTime, i+1);
}
}
@@ -457,6 +460,26 @@ namespace Gallop.Live.Cutt
}
}
private void SetupFacialUpdateInfo_EyeTrack(ref FacialDataUpdateInfo updateInfo, LiveTimelineKeyFacialEyeTrackDataList keys, float time)
{
LiveTimelineKey liveTimelineKey = null;
LiveTimelineKey liveTimelineKey2 = null;
LiveTimelineKey liveTimelineKey3 = null;
LiveTimelineKeyIndex curKey = AlterUpdate_Key(keys, time);
if (curKey != null)
{
liveTimelineKey = curKey.prevKey;
liveTimelineKey2 = curKey.key;
liveTimelineKey3 = curKey.nextKey;
updateInfo.eyeTrackPrev = liveTimelineKey as LiveTimelineKeyFacialEyeTrackData;
updateInfo.eyeTrackCur = liveTimelineKey2 as LiveTimelineKeyFacialEyeTrackData;
updateInfo.eyeTrackNext = liveTimelineKey3 as LiveTimelineKeyFacialEyeTrackData;
updateInfo.eyeTrackKeyIndex = curKey.index;
}
}
public void AlterUpdate_LipSync(float liveTime)
{
var lipDataList = data.worksheetList[0].ripSyncKeys;
@@ -578,14 +601,14 @@ namespace Gallop.Live.Cutt
if(nextKey != null && nextKey.interpolateType != LiveCameraInterpolateType.None)
{
float ratio = CalculateInterpolationValue(curKey, nextKey, time * 60);
chara.transform.position = Vector3.Lerp(curKey.Position, nextKey.Position, ratio);
chara.transform.localPosition = Vector3.Lerp(curKey.Position, nextKey.Position, ratio);
var x = chara.Position.localEulerAngles.x;
var z = chara.Position.localEulerAngles.z;
chara.Position.localEulerAngles = new Vector3(x, Mathf.Lerp(curKey.LocalRotationY, nextKey.LocalRotationY, ratio), z);
}
else
{
chara.transform.position = curKey.Position;
chara.transform.localPosition = curKey.Position;
var x = chara.Position.localEulerAngles.x;
var z = chara.Position.localEulerAngles.z;
chara.Position.localEulerAngles = new Vector3(x, curKey.LocalRotationY, z);
@@ -686,7 +686,7 @@ namespace Gallop.Live
{
_liveCurrentTime += Time.deltaTime;
//Debug.Log(_liveCurrentTime * 60);
Debug.Log(_liveCurrentTime * 60);
UI.ProgressBar.SetValueWithoutNotify(_liveCurrentTime / totalTime);
OnTimelineUpdate(_liveCurrentTime);