Merged changed from Croakfang's branch. (#72)

* merge (#71)

* Bug fix, improved UI layout and live vocals

* Bug Fixes, New Live Compatibility

---------

Co-authored-by: CroakFang <1605296300@qq.com>

* recovered shader functions

* Fixed texture loading for costume 0015

---------

Co-authored-by: CroakFang <1605296300@qq.com>
This commit is contained in:
katboi01
2024-09-09 10:27:37 +02:00
committed by GitHub
parent 4292484f25
commit 3b2bae40cd
23 changed files with 916 additions and 617 deletions
@@ -87,7 +87,6 @@ namespace Gallop
bool isTail = gameObject.name.Contains("tail");//The tail needs less traction
var dynamic = bone.gameObject.AddComponent<DynamicBone>();
dynamic.m_Root = bone;
dynamic.m_UpdateMode = DynamicBone.UpdateMode.Normal;
dynamic.m_Gravity = new Vector3(0, Mathf.Clamp01(-30 / spring._gravity), 0);
dynamic.m_LimitAngel_Min = spring._limitAngleMin;
dynamic.m_LimitAngel_Max = spring._limitAngleMax;
@@ -1242,7 +1242,7 @@ namespace Gallop
public static float CalcMorphWeight(float time, int speed, int interFrame, InterpolateType interType, LiveTimelineKey curKey, LiveTimelineKey nextKey)
{
float keyTime = (float)curKey.frame / 60;
float keyTime = (float)curKey.FrameSecond;
switch (speed)
{
@@ -75,6 +75,8 @@ namespace Gallop.Live.Cutt
_tempAnim.AddClip(key.clip, key.clip.name);
}
}
_tempAnim.wrapMode = WrapMode.Clamp;
_tempAnim.enabled = false;
}
public void AlterUpdate(float currentTime)
@@ -108,39 +110,24 @@ namespace Gallop.Live.Cutt
LiveTimelineKeyCharaMotionData arg = curKey.key as LiveTimelineKeyCharaMotionData;
AnimationClip anim = arg.clip;
if ((curKey != null && _curIndex != -1 && _curIndex != _prevIndex) || Director.instance.sliderControl.is_Touched || Director.instance._syncTime == false || director.IsRecordVMD)
double start;
if (arg.isMotionHeadFrameAll)
{
double start;
if(arg.isMotionHeadFrameAll)
{
start = (double)arg.motionHeadFrame / 60;
}
else
{
start = (double)arg.motionHeadFrameSeparetes[charaIndex] / 60;
}
double interval = currentTime - (double)arg.frame / 60;
start = (double)arg.motionHeadFrame / 60;
}
else
{
start = (double)arg.motionHeadFrameSeparetes[charaIndex] / 60;
}
double interval = (currentTime - arg.FrameSecond) * arg.playSpeed;
float currentAnimationTime = (float)(start + interval);
_tempAnim.wrapMode = (arg.loop ? WrapMode.Loop : WrapMode.Default);
_tempAnim[anim.name].time = (float)(start + interval);
if (Mathf.Abs(_prevFrameAnimationTime - currentTime) < 0.01f && Director.instance.sliderControl.is_Touched)
{
if (_tempAnim.IsPlaying(anim.name))
{
_tempAnim.Stop();
}
}
else
{
_tempAnim.Play(anim.name);
}
}
else if (!_tempAnim.IsPlaying(anim.name))
{
_tempAnim.Play(anim.name);
}
var state = _tempAnim[anim.name];
state.enabled = true;
state.weight = 1;
state.time = arg.loop ? Mathf.Repeat(currentAnimationTime, state.length) : currentAnimationTime;
_tempAnim.Sample();
state.enabled = false;
_prevIndex = _curIndex;
}
@@ -254,7 +254,7 @@ namespace Gallop.Live.Cutt
{
for (int i = thisList.Count - 1; i >= 0; i--)
{
if (currentTime >= (double)thisList[i].frame / 60)
if (currentTime >= thisList[i].FrameSecond)
{
thisTimeKeyIndex.index = i;
thisTimeKeyIndex.key = thisList[i];
@@ -285,7 +285,7 @@ namespace Gallop.Live.Cutt
{
if (thisTimeKeyIndex.nextKey != null)
{
if (currentTime >= (double)thisTimeKeyIndex.nextKey.frame / 60)
if (currentTime >= thisTimeKeyIndex.nextKey.FrameSecond)
{
thisTimeKeyIndex.index++;
thisTimeKeyIndex.key = thisList[thisTimeKeyIndex.index];
@@ -602,6 +602,19 @@ namespace Gallop.Live.Cutt
{
public int frame;
public LiveTimelineKeyAttribute attribute;
private double _framesecond = -999;
public double FrameSecond {
get{
if (_framesecond == -999)
{
_framesecond = (double)frame / 60;
}
return _framesecond;
}
set => _framesecond = value;
}
}
[System.Serializable]
@@ -20,22 +20,21 @@ namespace Gallop.Live.Cyalume
}
private void Update()
private void FixedUpdate()
{
if (CyalumeMaterial == null)
return;
if (passedtime >= intervaltime)
{
y_offset += (float)0.03125;
if(y_offset >= 1.0f)
if (y_offset >= 1.0f)
{
y_offset = 0.0f;
}
CyalumeMaterial.SetTextureOffset("_MainTex", new Vector2(0, y_offset));
passedtime = 0;
}
passedtime += Time.deltaTime;
//Debug.Log(CyalumeMaterial);
//Debug.Log(passedtime);
passedtime += Time.fixedDeltaTime;
}
public void InitializeCyalume()
@@ -47,7 +46,7 @@ namespace Gallop.Live.Cyalume
GameObject tempObj = Instantiate((GameObject)obj.Value, transform);
if (obj.Value.name.Contains("cyalume")){
CyalumeObj = tempObj;
CyalumeMaterial = gameObject.GetComponentInChildren<MeshRenderer>().sharedMaterial;
CyalumeMaterial = gameObject.GetComponentInChildren<MeshRenderer>().material;
}
}
}
@@ -62,6 +62,8 @@ namespace Gallop.Live
public bool IsRecordVMD;
public bool RequireStage = true;
public Transform MainCameraTransform => _mainCameraTransform;
private Transform _mainCameraTransform;
@@ -97,9 +99,12 @@ namespace Gallop.Live
{
_instance = this;
Debug.Log(string.Format(CUTT_PATH, live.MusicId));
Debug.Log(live.BackGroundId);
Builder.LoadAssetPath(string.Format(CUTT_PATH, live.MusicId), transform);
Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), transform);
if (RequireStage)
{
Debug.Log(live.BackGroundId);
Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), transform);
}
//Make CharacterObject
@@ -128,6 +133,7 @@ namespace Gallop.Live
//Get live parts info
UmaDatabaseEntry partAsset = UmaViewerMain.Instance.AbList[string.Format(LIVE_PART_PATH, live.MusicId)];
UmaViewerAudio.LastAudioPartIndex = -1;
Debug.Log(partAsset.Name);
@@ -352,7 +358,7 @@ namespace Gallop.Live
_liveTimelineControl.AlterUpdate(_liveCurrentTime);
if (!_soloMode)
{
UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal);
UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal, sliderControl.is_Outed);
}
}