imporve live morph speed

This commit is contained in:
左右看
2023-07-30 01:12:16 +08:00
parent 9c30ff2573
commit d9e021286c
3 changed files with 25 additions and 8 deletions
+1 -1
View File
@@ -42738,7 +42738,7 @@ MonoBehaviour:
LiveTime: 0 LiveTime: 0
isRecordVMD: 0 isRecordVMD: 0
LiveRecoedToggle: {fileID: 0} LiveRecoedToggle: {fileID: 0}
LiveMode: 0 LiveMode: 1
currentFaceDrivenKeyTarget: {fileID: 0} currentFaceDrivenKeyTarget: {fileID: 0}
--- !u!114 &1564959568 --- !u!114 &1564959568
MonoBehaviour: MonoBehaviour:
@@ -804,7 +804,7 @@ namespace Gallop
float weightRatio = CalcMorphWeight(liveTime_, keyData_.time, keyData_.interpolateType, keyData_, null); float weightRatio = CalcMorphWeight(liveTime_, keyData_.speed, keyData_.time, keyData_.interpolateType, keyData_, null);
MouthMorphs.ForEach(morph => morph.weight = 0); MouthMorphs.ForEach(morph => morph.weight = 0);
@@ -853,7 +853,7 @@ namespace Gallop
} }
float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.mouthCur.time, updateInfo_.mouthCur.interpolateType, updateInfo_.mouthCur, updateInfo_.mouthNext); float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.mouthCur.speed, updateInfo_.mouthCur.time, updateInfo_.mouthCur.interpolateType, updateInfo_.mouthCur, updateInfo_.mouthNext);
MouthMorphs.ForEach(morph => morph.weight = 0); MouthMorphs.ForEach(morph => morph.weight = 0);
@@ -889,7 +889,7 @@ namespace Gallop
if (updateInfo_.eyeCur != null) if (updateInfo_.eyeCur != null)
{ {
float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.eyeCur.time, updateInfo_.eyeCur.interpolateType, updateInfo_.eyeCur, updateInfo_.eyeNext); float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.eyeCur.speed, updateInfo_.eyeCur.time, updateInfo_.eyeCur.interpolateType, updateInfo_.eyeCur, updateInfo_.eyeNext);
EyeMorphs.ForEach(morph => morph.weight = 0); EyeMorphs.ForEach(morph => morph.weight = 0);
@@ -941,7 +941,7 @@ namespace Gallop
if (updateInfo_.eyebrowCur != null) if (updateInfo_.eyebrowCur != null)
{ {
float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.eyebrowCur.time, updateInfo_.eyebrowCur.interpolateType, updateInfo_.eyebrowCur, updateInfo_.eyebrowNext); float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.eyebrowCur.speed, updateInfo_.eyebrowCur.time, updateInfo_.eyebrowCur.interpolateType, updateInfo_.eyebrowCur, updateInfo_.eyebrowNext);
EyeBrowMorphs.ForEach(morph => morph.weight = 0); EyeBrowMorphs.ForEach(morph => morph.weight = 0);
@@ -993,7 +993,7 @@ namespace Gallop
if (updateInfo_.earCur != null) if (updateInfo_.earCur != null)
{ {
float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.earCur.time, updateInfo_.earCur.interpolateType, updateInfo_.earCur, updateInfo_.earNext); float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.earCur.speed, updateInfo_.earCur.time, updateInfo_.earCur.interpolateType, updateInfo_.earCur, updateInfo_.earNext);
EarMorphs.ForEach(morph => morph.weight = 0); EarMorphs.ForEach(morph => morph.weight = 0);
@@ -1052,11 +1052,28 @@ namespace Gallop
} }
} }
public float CalcMorphWeight(float time, int interFrame, InterpolateType interType, LiveTimelineKey curKey, LiveTimelineKey nextKey) public float CalcMorphWeight(float time, int speed, int interFrame, InterpolateType interType, LiveTimelineKey curKey, LiveTimelineKey nextKey)
{ {
float keyTime = (float)curKey.frame / 60; float keyTime = (float)curKey.frame / 60;
switch (speed)
{
case 1:
interFrame = 3;
break;
case 10:
interFrame = 2;
break;
case 20:
interFrame = 6;
break;
case 21:
interFrame = 9;
break;
default:
break;
}
float duringTime; float duringTime;
if (nextKey != null) if (nextKey != null)
@@ -338,7 +338,7 @@ namespace Gallop.Live
public int characterCount = 0; public int characterCount = 0;
public int allowCount = 0; public int allowCount = 0;
public int liveMode = 0; public int liveMode = 1;
public LiveViewerUI UI; public LiveViewerUI UI;