From 6a89bba5e3195e103dc200f9eed0e5bd57919d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Fri, 7 Jul 2023 05:30:20 +0800 Subject: [PATCH 1/5] improve live --- ... Jobs (Unity 2018.2.4f1).unitypackage.meta | 7 - .../IK Jobs (Unity 2019.3).unitypackage.meta | 7 - ...culus Integration v1.37).unitypackage.meta | 7 - ...4.28f1, PlayMaker 1.9.0).unitypackage.meta | 7 - ..., SteamVR Plugin v2.2.0).unitypackage.meta | 7 - ... 2017.4.28f1, UMA 2.8.1).unitypackage.meta | 7 - Assets/Scenes/LiveScene.unity | 162 ++++++++++++++++++ Assets/Scripts/FreeCam.cs | 145 ++++++++++++++++ Assets/Scripts/FreeCam.cs.meta | 11 ++ Assets/Scripts/UmaViewerBuilder.cs | 5 +- Assets/Scripts/UmaViewerGlobalShader.cs | 2 +- .../umamusume/Gallop/FaceDrivenKeyTarget.cs | 84 ++++----- .../Gallop/Live/Cutt/FacialDataUpdateInfo.cs | 3 +- .../Gallop/Live/Cutt/LiveTimelineControl.cs | 83 ++++++--- .../Scripts/umamusume/Gallop/Live/Director.cs | 23 ++- 15 files changed, 443 insertions(+), 117 deletions(-) delete mode 100644 Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2018.2.4f1).unitypackage.meta delete mode 100644 Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2019.3).unitypackage.meta delete mode 100644 Assets/Plugins/RootMotion/FinalIK/_Integration/Oculus (Unity 2017.4.28f1, Oculus Integration v1.37).unitypackage.meta delete mode 100644 Assets/Plugins/RootMotion/FinalIK/_Integration/Playmaker (Unity 2017.4.28f1, PlayMaker 1.9.0).unitypackage.meta delete mode 100644 Assets/Plugins/RootMotion/FinalIK/_Integration/Steam VR (Unity 2017.4.28f1, SteamVR Plugin v2.2.0).unitypackage.meta delete mode 100644 Assets/Plugins/RootMotion/FinalIK/_Integration/UMA (Unity 2017.4.28f1, UMA 2.8.1).unitypackage.meta create mode 100644 Assets/Scripts/FreeCam.cs create mode 100644 Assets/Scripts/FreeCam.cs.meta diff --git a/Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2018.2.4f1).unitypackage.meta b/Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2018.2.4f1).unitypackage.meta deleted file mode 100644 index fd115b1..0000000 --- a/Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2018.2.4f1).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: b3e58808cb15120468eafdef64280407 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2019.3).unitypackage.meta b/Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2019.3).unitypackage.meta deleted file mode 100644 index 00a91fc..0000000 --- a/Assets/Plugins/RootMotion/FinalIK/_Integration/IK Jobs (Unity 2019.3).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 59d63bcae2fecff42be7b4fc8b1df10f -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/RootMotion/FinalIK/_Integration/Oculus (Unity 2017.4.28f1, Oculus Integration v1.37).unitypackage.meta b/Assets/Plugins/RootMotion/FinalIK/_Integration/Oculus (Unity 2017.4.28f1, Oculus Integration v1.37).unitypackage.meta deleted file mode 100644 index d9fcdc9..0000000 --- a/Assets/Plugins/RootMotion/FinalIK/_Integration/Oculus (Unity 2017.4.28f1, Oculus Integration v1.37).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 7d1083877b3838042b9e91b249731b89 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/RootMotion/FinalIK/_Integration/Playmaker (Unity 2017.4.28f1, PlayMaker 1.9.0).unitypackage.meta b/Assets/Plugins/RootMotion/FinalIK/_Integration/Playmaker (Unity 2017.4.28f1, PlayMaker 1.9.0).unitypackage.meta deleted file mode 100644 index 7ce27d6..0000000 --- a/Assets/Plugins/RootMotion/FinalIK/_Integration/Playmaker (Unity 2017.4.28f1, PlayMaker 1.9.0).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0512c18ad5403428db876010796c1cda -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/RootMotion/FinalIK/_Integration/Steam VR (Unity 2017.4.28f1, SteamVR Plugin v2.2.0).unitypackage.meta b/Assets/Plugins/RootMotion/FinalIK/_Integration/Steam VR (Unity 2017.4.28f1, SteamVR Plugin v2.2.0).unitypackage.meta deleted file mode 100644 index 839abdf..0000000 --- a/Assets/Plugins/RootMotion/FinalIK/_Integration/Steam VR (Unity 2017.4.28f1, SteamVR Plugin v2.2.0).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 57ddc43ace113674392034825a54600a -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/RootMotion/FinalIK/_Integration/UMA (Unity 2017.4.28f1, UMA 2.8.1).unitypackage.meta b/Assets/Plugins/RootMotion/FinalIK/_Integration/UMA (Unity 2017.4.28f1, UMA 2.8.1).unitypackage.meta deleted file mode 100644 index 21cc026..0000000 --- a/Assets/Plugins/RootMotion/FinalIK/_Integration/UMA (Unity 2017.4.28f1, UMA 2.8.1).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d00cc5f8e672c264d856aa10ed20df7e -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scenes/LiveScene.unity b/Assets/Scenes/LiveScene.unity index fe1ff71..1febacf 100644 --- a/Assets/Scenes/LiveScene.unity +++ b/Assets/Scenes/LiveScene.unity @@ -123,3 +123,165 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &1529990365 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1529990370} + - component: {fileID: 1529990369} + - component: {fileID: 1529990368} + - component: {fileID: 1529990366} + - component: {fileID: 1529990367} + m_Layer: 0 + m_Name: Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1529990366 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1529990365} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} + m_Name: + m_EditorClassIdentifier: + volumeTrigger: {fileID: 1529990370} + volumeLayer: + serializedVersion: 2 + m_Bits: 1 + stopNaNPropagation: 1 + finalBlitToCameraTarget: 0 + antialiasingMode: 0 + temporalAntialiasing: + jitterSpread: 0.75 + sharpness: 0.25 + stationaryBlending: 0.615 + motionBlending: 0.85 + subpixelMorphologicalAntialiasing: + quality: 2 + fastApproximateAntialiasing: + fastMode: 1 + keepAlpha: 1 + fog: + enabled: 1 + excludeSkybox: 1 + debugLayer: + lightMeter: + width: 512 + height: 256 + showCurves: 1 + histogram: + width: 512 + height: 256 + channel: 3 + waveform: + exposure: 0.12 + height: 256 + vectorscope: + size: 256 + exposure: 0.12 + overlaySettings: + linearDepth: 0 + motionColorIntensity: 4 + motionGridSize: 64 + colorBlindnessType: 0 + colorBlindnessStrength: 1 + m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} + m_ShowToolkit: 0 + m_ShowCustomSorter: 0 + breakBeforeColorGrading: 0 + m_BeforeTransparentBundles: [] + m_BeforeStackBundles: [] + m_AfterStackBundles: [] +--- !u!114 &1529990367 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1529990365} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a45300b2c43d19444a0331fd08a640d2, type: 3} + m_Name: + m_EditorClassIdentifier: + movementSpeed: 10 + fastMovementSpeed: 100 + freeLookSensitivity: 3 + zoomSensitivity: 10 + fastZoomSensitivity: 50 +--- !u!81 &1529990368 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1529990365} + m_Enabled: 1 +--- !u!20 &1529990369 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1529990365} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0, g: 1, b: 0.08161616, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.01 + far clip plane: 1000 + field of view: 40 + orthographic: 0 + orthographic size: 400 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1529990370 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1529990365} + m_LocalRotation: {x: 0, y: -1, z: 0, w: 0} + m_LocalPosition: {x: 0, y: 1, z: 10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: -180, z: 0} diff --git a/Assets/Scripts/FreeCam.cs b/Assets/Scripts/FreeCam.cs new file mode 100644 index 0000000..cd131fb --- /dev/null +++ b/Assets/Scripts/FreeCam.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +/// +/// A simple free camera to be added to a Unity game object. +/// +/// Keys: +/// wasd / arrows - movement +/// q/e - up/down (local space) +/// r/f - up/down (world space) +/// pageup/pagedown - up/down (world space) +/// hold shift - enable fast movement mode +/// right mouse - enable free look +/// mouse - free look / rotation +/// +/// +public class FreeCam : MonoBehaviour +{ + /// + /// Normal speed of camera movement. + /// + public float movementSpeed = 10f; + + /// + /// Speed of camera movement when shift is held down, + /// + public float fastMovementSpeed = 100f; + + /// + /// Sensitivity for free look. + /// + public float freeLookSensitivity = 3f; + + /// + /// Amount to zoom the camera when using the mouse wheel. + /// + public float zoomSensitivity = 10f; + + /// + /// Amount to zoom the camera when using the mouse wheel (fast mode). + /// + public float fastZoomSensitivity = 50f; + + /// + /// Set to true when free looking (on right mouse button). + /// + private bool looking = false; + + void Update() + { + var fastMode = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); + var movementSpeed = fastMode ? this.fastMovementSpeed : this.movementSpeed; + + if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow)) + { + transform.position = transform.position + (-transform.right * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow)) + { + transform.position = transform.position + (transform.right * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow)) + { + transform.position = transform.position + (transform.forward * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow)) + { + transform.position = transform.position + (-transform.forward * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.Q)) + { + transform.position = transform.position + (transform.up * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.E)) + { + transform.position = transform.position + (-transform.up * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.R) || Input.GetKey(KeyCode.PageUp)) + { + transform.position = transform.position + (Vector3.up * movementSpeed * Time.deltaTime); + } + + if (Input.GetKey(KeyCode.F) || Input.GetKey(KeyCode.PageDown)) + { + transform.position = transform.position + (-Vector3.up * movementSpeed * Time.deltaTime); + } + + if (looking) + { + float newRotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * freeLookSensitivity; + float newRotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * freeLookSensitivity; + transform.localEulerAngles = new Vector3(newRotationY, newRotationX, 0f); + } + + float axis = Input.GetAxis("Mouse ScrollWheel"); + if (axis != 0) + { + var zoomSensitivity = fastMode ? this.fastZoomSensitivity : this.zoomSensitivity; + transform.position = transform.position + transform.forward * axis * zoomSensitivity; + } + + if (Input.GetKeyDown(KeyCode.Mouse1)) + { + StartLooking(); + } + else if (Input.GetKeyUp(KeyCode.Mouse1)) + { + StopLooking(); + } + } + + void OnDisable() + { + StopLooking(); + } + + /// + /// Enable free looking. + /// + public void StartLooking() + { + looking = true; + Cursor.visible = false; + Cursor.lockState = CursorLockMode.Locked; + } + + /// + /// Disable free looking. + /// + public void StopLooking() + { + looking = false; + Cursor.visible = true; + Cursor.lockState = CursorLockMode.None; + } +} \ No newline at end of file diff --git a/Assets/Scripts/FreeCam.cs.meta b/Assets/Scripts/FreeCam.cs.meta new file mode 100644 index 0000000..b8bda98 --- /dev/null +++ b/Assets/Scripts/FreeCam.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a45300b2c43d19444a0331fd08a640d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UmaViewerBuilder.cs b/Assets/Scripts/UmaViewerBuilder.cs index bc217e5..c7e8c2d 100644 --- a/Assets/Scripts/UmaViewerBuilder.cs +++ b/Assets/Scripts/UmaViewerBuilder.cs @@ -670,9 +670,8 @@ public class UmaViewerBuilder : MonoBehaviour GameObject.Find("CriWare"), GameObject.Find("CriWareLibraryInitializer"), GameObject.Find("ViewerMain"), - GameObject.Find("Camera"), GameObject.Find("Directional Light"), - GameObject.Find("AnimationCameraRoot"), + GameObject.Find("GlobalShaderController"), GameObject.Find("AudioManager") }; @@ -702,7 +701,7 @@ public class UmaViewerBuilder : MonoBehaviour }, delegate () { - Gallop.Live.Director.instance.InitializeTimeline(); + Gallop.Live.Director.instance.InitializeTimeline(characters.Count); Gallop.Live.Director.instance.Play(live.MusicId, characters); } ); diff --git a/Assets/Scripts/UmaViewerGlobalShader.cs b/Assets/Scripts/UmaViewerGlobalShader.cs index e32be48..7594966 100644 --- a/Assets/Scripts/UmaViewerGlobalShader.cs +++ b/Assets/Scripts/UmaViewerGlobalShader.cs @@ -128,7 +128,7 @@ public class UmaViewerGlobalShader : MonoBehaviour { //Used to calculate the correct outline //Outline need more adjust in live - if (!UmaViewerUI.Instance.LiveTime) + if (UmaViewerBuilder.Instance.AnimationCamera != null) { if (UmaViewerBuilder.Instance.CurrentUMAContainer) { diff --git a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs index 651aa74..9e098a7 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs @@ -816,8 +816,6 @@ namespace Gallop { _prevLipKeyData = null; _lastLipKeyData = null; - MouthMorphs.ForEach(morph => morph.weight = 0); - ChangeMorphMouth(); return; } @@ -826,42 +824,6 @@ namespace Gallop _prevLipKeyData = _lastLipKeyData; } - /* - float keyTime = (float)keyData_.frame / 60; - - float easeTime = (float)keyData_.time/ 60; - - float passTime = liveTime_ - keyTime; - - float weightRatio = 0; - - if (passTime >= easeTime) - { - weightRatio = 1; - } - else - { - float ratio = passTime / easeTime; - switch (keyData_.interpolateType) - { - case InterpolateType.Linear: - weightRatio = ratio; - break; - case InterpolateType.EaseIn: - weightRatio = Easing.EaseIn(ratio); - break; - case InterpolateType.EaseOut: - weightRatio = Easing.EaseOut(ratio); - break; - case InterpolateType.EaseInOut: - weightRatio = Easing.EaseInOut(ratio); - break; - default: - weightRatio = ratio; - break; - } - } - */ float weightRatio = CalcMorphWeight(liveTime_, keyData_.time, keyData_.interpolateType, keyData_, null); MouthMorphs.ForEach(morph => morph.weight = 0); @@ -897,6 +859,9 @@ namespace Gallop _lastLipKeyData = keyData_; } + private LiveTimelineKeyFacialMouthData _prevMouthKeyData; + private LiveTimelineKeyFacialMouthData _lastMouthKeyData; + private LiveTimelineKeyFacialEyeData _prevEyesKeyData; private LiveTimelineKeyFacialEyeData _lastEyesKeyData; @@ -908,7 +873,48 @@ namespace Gallop public void AlterUpdateFacialNew(ref FacialDataUpdateInfo updateInfo_, float liveTime_) { - if(updateInfo_.eyeCur != null) + if (updateInfo_.mouthCur != null) + { + if (_lastMouthKeyData != updateInfo_.mouthCur) + { + _prevMouthKeyData = _lastMouthKeyData; + } + + float weightRatio = CalcMorphWeight(liveTime_, updateInfo_.mouthCur.time, updateInfo_.mouthCur.interpolateType, updateInfo_.mouthCur, updateInfo_.mouthNext); + + MouthMorphs.ForEach(morph => morph.weight = 0); + + if (_prevMouthKeyData != null) + { + if (weightRatio != 1) + { + foreach (var part in _prevMouthKeyData.facialPartsDataArray) + { + if (part.FacialPartsId == 0) { continue; } + MouthMorphs[part.FacialPartsId - 1].weight = ((float)part.WeightPer / 100 * (1 - weightRatio)) * ((float)_prevMouthKeyData.weight / 100); + } + } + else + { + foreach (var part in _prevMouthKeyData.facialPartsDataArray) + { + if (part.FacialPartsId == 0) { continue; } + MouthMorphs[part.FacialPartsId - 1].weight = 0; + } + } + } + + foreach (var part in updateInfo_.mouthCur.facialPartsDataArray) + { + if (part.FacialPartsId == 0) { continue; } + MouthMorphs[part.FacialPartsId - 1].weight += ((float)part.WeightPer / 100 * weightRatio) * ((float)updateInfo_.mouthCur.weight / 100); + } + + ChangeMorphMouth(); + + _lastMouthKeyData = updateInfo_.mouthCur; + } + if (updateInfo_.eyeCur != null) { if (_lastEyesKeyData != updateInfo_.eyeCur) { diff --git a/Assets/Scripts/umamusume/Gallop/Live/Cutt/FacialDataUpdateInfo.cs b/Assets/Scripts/umamusume/Gallop/Live/Cutt/FacialDataUpdateInfo.cs index fc3a5c1..71e56cb 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Cutt/FacialDataUpdateInfo.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Cutt/FacialDataUpdateInfo.cs @@ -9,7 +9,8 @@ namespace Gallop.Live.Cutt // Fields public LiveTimelineKeyFacialFaceData faceCur; // 0x0 public LiveTimelineKeyFacialFaceData faceNext; // 0x8 - public LiveTimelineKeyFacialMouthData mouth; // 0x10 + public LiveTimelineKeyFacialMouthData mouthCur; // 0x10 + public LiveTimelineKeyFacialMouthData mouthNext; // 0x10 public LiveTimelineKeyFacialEyeData eyeCur; // 0x18 public LiveTimelineKeyFacialEyeData eyeNext; // 0x20 public LiveTimelineKeyFacialEyebrowData eyebrowCur; // 0x28 diff --git a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs index 864af03..71ac241 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs @@ -27,7 +27,7 @@ namespace Gallop.Live.Cutt public event Action OnUpdateLipSync; - public event Action OnUpdateFacial; + public event Action OnUpdateFacial; public void CopyValues(T from, T to) { @@ -55,7 +55,7 @@ namespace Gallop.Live.Cutt //} } - public void InitCharaMotionSequence() + public void InitCharaMotionSequence(int[] motionSequence) { //Create Animation foreach (var obj in Director.instance.charaObjs) @@ -77,16 +77,17 @@ namespace Gallop.Live.Cutt { _keyArray[i] = data.worksheetList[0].charaMotSeqList[i].keys; } - + //Set Motion - int CharaPositionMax = characterStandPosLocators.Length; + int CharaPositionMax = Director.instance.allowCount; _motionSequenceArray = new LiveTimelineMotionSequence[CharaPositionMax]; + for (int i = 0; i < CharaPositionMax; i++) { _motionSequenceArray[i] = new LiveTimelineMotionSequence(); - _motionSequenceArray[i].Initialize(Director.instance.charaObjs[i], i, i, this); + _motionSequenceArray[i].Initialize(Director.instance.charaObjs[i], i, motionSequence[i], this); } } @@ -94,8 +95,8 @@ namespace Gallop.Live.Cutt public void AlterUpdate(float liveTime) { AlterUpdate_CharaMotionSequence(liveTime); - AlterUpdate_LipSync(liveTime); AlterUpdate_FacialData(liveTime); + AlterUpdate_LipSync(liveTime); } public void AlterUpdate_CharaMotionSequence(float liveTime) @@ -112,10 +113,37 @@ namespace Gallop.Live.Cutt FacialDataUpdateInfo updateInfo = default(FacialDataUpdateInfo); if (facialDataList != null) { + SetupFacialUpdateInfo_Mouth(ref updateInfo, facialDataList.mouthKeys, liveTime); SetupFacialUpdateInfo_Eye(ref updateInfo, facialDataList.eyeKeys, liveTime); SetupFacialUpdateInfo_Eyebrow(ref updateInfo, facialDataList.eyebrowKeys, liveTime); SetupFacialUpdateInfo_Ear(ref updateInfo, facialDataList.earKeys, liveTime); - this.OnUpdateFacial(updateInfo, liveTime); + this.OnUpdateFacial(updateInfo, liveTime, 0); + } + + var otherFacialDataList = data.worksheetList[0].other4FacialArray; + for(int i = 0; i < otherFacialDataList.Length && i < Director.instance.characterCount - 1; i++) + { + SetupFacialUpdateInfo_Mouth(ref updateInfo, otherFacialDataList[i].mouthKeys, liveTime); + SetupFacialUpdateInfo_Eye(ref updateInfo, otherFacialDataList[i].eyeKeys, liveTime); + SetupFacialUpdateInfo_Eyebrow(ref updateInfo, otherFacialDataList[i].eyebrowKeys, liveTime); + SetupFacialUpdateInfo_Ear(ref updateInfo, otherFacialDataList[i].earKeys, liveTime); + this.OnUpdateFacial(updateInfo, liveTime, i+1); + } + } + + private void SetupFacialUpdateInfo_Mouth(ref FacialDataUpdateInfo updateInfo, LiveTimelineKeyFacialMouthDataList keys, float time) + { + LiveTimelineKey liveTimelineKey = null; + LiveTimelineKey liveTimelineKey2 = null; + + LiveTimelineKeyIndex curKey = AlterUpdate_Key(keys, time); + if (curKey != null) + { + liveTimelineKey = curKey.key; + liveTimelineKey2 = curKey.nextKey; + updateInfo.mouthCur = liveTimelineKey as LiveTimelineKeyFacialMouthData; + updateInfo.mouthNext = liveTimelineKey2 as LiveTimelineKeyFacialMouthData; + updateInfo.mouthKeyIndex = curKey.index; } } @@ -125,11 +153,14 @@ namespace Gallop.Live.Cutt LiveTimelineKey liveTimelineKey2 = null; LiveTimelineKeyIndex curKey = AlterUpdate_Key(keys, time); - liveTimelineKey = curKey.key; - liveTimelineKey2 = curKey.nextKey; - updateInfo.eyeCur = liveTimelineKey as LiveTimelineKeyFacialEyeData; - updateInfo.eyeNext = liveTimelineKey2 as LiveTimelineKeyFacialEyeData; - updateInfo.eyeKeyIndex = curKey.index; + if (curKey != null) + { + liveTimelineKey = curKey.key; + liveTimelineKey2 = curKey.nextKey; + updateInfo.eyeCur = liveTimelineKey as LiveTimelineKeyFacialEyeData; + updateInfo.eyeNext = liveTimelineKey2 as LiveTimelineKeyFacialEyeData; + updateInfo.eyeKeyIndex = curKey.index; + } } private void SetupFacialUpdateInfo_Eyebrow(ref FacialDataUpdateInfo updateInfo, LiveTimelineKeyFacialEyebrowDataList keys, float time) @@ -138,11 +169,14 @@ namespace Gallop.Live.Cutt LiveTimelineKey liveTimelineKey2 = null; LiveTimelineKeyIndex curKey = AlterUpdate_Key(keys, time); - liveTimelineKey = curKey.key; - liveTimelineKey2 = curKey.nextKey; - updateInfo.eyebrowCur = liveTimelineKey as LiveTimelineKeyFacialEyebrowData; - updateInfo.eyebrowNext = liveTimelineKey2 as LiveTimelineKeyFacialEyebrowData; - updateInfo.eyebrowKeyIndex = curKey.index; + if (curKey != null) + { + liveTimelineKey = curKey.key; + liveTimelineKey2 = curKey.nextKey; + updateInfo.eyebrowCur = liveTimelineKey as LiveTimelineKeyFacialEyebrowData; + updateInfo.eyebrowNext = liveTimelineKey2 as LiveTimelineKeyFacialEyebrowData; + updateInfo.eyebrowKeyIndex = curKey.index; + } } private void SetupFacialUpdateInfo_Ear(ref FacialDataUpdateInfo updateInfo, LiveTimelineKeyFacialEarDataList keys, float time) @@ -151,11 +185,14 @@ namespace Gallop.Live.Cutt LiveTimelineKey liveTimelineKey2 = null; LiveTimelineKeyIndex curKey = AlterUpdate_Key(keys, time); - liveTimelineKey = curKey.key; - liveTimelineKey2 = curKey.nextKey; - updateInfo.earCur = liveTimelineKey as LiveTimelineKeyFacialEarData; - updateInfo.earNext = liveTimelineKey2 as LiveTimelineKeyFacialEarData; - updateInfo.earKeyIndex = curKey.index; + if (curKey != null) + { + liveTimelineKey = curKey.key; + liveTimelineKey2 = curKey.nextKey; + updateInfo.earCur = liveTimelineKey as LiveTimelineKeyFacialEarData; + updateInfo.earNext = liveTimelineKey2 as LiveTimelineKeyFacialEarData; + updateInfo.earKeyIndex = curKey.index; + } } public void AlterUpdate_LipSync(float liveTime) @@ -164,7 +201,7 @@ namespace Gallop.Live.Cutt LiveTimelineKeyIndex curKey = AlterUpdate_Key(lipDataList, liveTime); - if (curKey != null && curKey.index != -1) + if (curKey != null && curKey.index != -1 && curKey.nextKey != null) { LiveTimelineKeyLipSyncData arg = curKey.key as LiveTimelineKeyLipSyncData; this.OnUpdateLipSync(arg, liveTime); diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index cab9a98..1a34929 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -339,6 +339,9 @@ namespace Gallop.Live public bool _syncTime = false; public bool _soloMode = false; + public int characterCount = 0; + public int allowCount = 0; + private void Awake() { if (live != null) @@ -376,9 +379,11 @@ namespace Gallop.Live } } - public void InitializeTimeline() + public void InitializeTimeline(int count) { - _liveTimelineControl.InitCharaMotionSequence(); + allowCount = count; + + _liveTimelineControl.InitCharaMotionSequence(_liveTimelineControl.data.characterSettings.motionSequenceIndices); _liveTimelineControl.OnUpdateLipSync += delegate (LiveTimelineKeyLipSyncData keyData_, float liveTime_) { @@ -391,10 +396,13 @@ namespace Gallop.Live } } }; - _liveTimelineControl.OnUpdateFacial += delegate (FacialDataUpdateInfo updateInfo_, float liveTime_) + _liveTimelineControl.OnUpdateFacial += delegate (FacialDataUpdateInfo updateInfo_, float liveTime_, int position) { - var container = charaObjs[0].GetComponentInChildren(); - container.FaceDrivenKeyTarget.AlterUpdateFacialNew(ref updateInfo_, liveTime_); + if( position < charaObjs.Count) + { + var container = charaObjs[position].GetComponentInChildren(); + container.FaceDrivenKeyTarget.AlterUpdateFacialNew(ref updateInfo_, liveTime_); + } }; } @@ -402,15 +410,14 @@ namespace Gallop.Live { Debug.Log(songid); - var charaCount = 0; for (int i = 0; i < characters.Count; i++) { if (characters[i].CharaEntry.Name != "") { - charaCount += 1; + characterCount += 1; } } - if(charaCount == 1) + if(characterCount == 1) { _soloMode = true; } From 220e6e160f5875e8f787c5612ac588c379785592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Fri, 7 Jul 2023 09:54:42 +0800 Subject: [PATCH 2/5] minor update --- Assets/Scripts/umamusume/Gallop/Live/Director.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index 1a34929..f92d472 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -525,6 +525,7 @@ namespace Gallop.Live else { _liveCurrentTime += Time.deltaTime; + Debug.Log(_liveCurrentTime * 60); OnTimelineUpdate(_liveCurrentTime); } } From c0c5aefb218d1999da74be2c90b9e90d35f25aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Fri, 7 Jul 2023 09:56:01 +0800 Subject: [PATCH 3/5] minor update --- Assets/Scripts/umamusume/Gallop/Live/Director.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index f92d472..4bfd2b8 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -337,7 +337,7 @@ namespace Gallop.Live public PartEntry partInfo; public bool _syncTime = false; - public bool _soloMode = false; + public bool _soloMode = true; public int characterCount = 0; public int allowCount = 0; From f0c76b12b21f70f2756582470efa1d23e8538012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Fri, 7 Jul 2023 11:01:19 +0800 Subject: [PATCH 4/5] improve live lipsync --- .../umamusume/Gallop/FaceDrivenKeyTarget.cs | 15 +++++++++++++-- .../Gallop/Live/Cutt/LiveTimelineControl.cs | 2 +- Assets/Scripts/umamusume/Gallop/Live/Director.cs | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs index 9e098a7..ae9411a 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs @@ -811,8 +811,8 @@ namespace Gallop public void AlterUpdateAutoLip(LiveTimelineKeyLipSyncData keyData_, float liveTime_, float _switch) { - - if(_switch == 0) + //|| lockMouth + if (_switch == 0 || lockMouth) { _prevLipKeyData = null; _lastLipKeyData = null; @@ -871,10 +871,21 @@ namespace Gallop private LiveTimelineKeyFacialEarData _prevEarsKeyData; private LiveTimelineKeyFacialEarData _lastEarsKeyData; + public bool lockMouth = false; + public void AlterUpdateFacialNew(ref FacialDataUpdateInfo updateInfo_, float liveTime_) { if (updateInfo_.mouthCur != null) { + if((int)updateInfo_.mouthCur.attribute == 131072) + { + lockMouth = true; + } + else + { + lockMouth = false; + } + if (_lastMouthKeyData != updateInfo_.mouthCur) { _prevMouthKeyData = _lastMouthKeyData; diff --git a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs index 71ac241..5f52a4c 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs @@ -201,7 +201,7 @@ namespace Gallop.Live.Cutt LiveTimelineKeyIndex curKey = AlterUpdate_Key(lipDataList, liveTime); - if (curKey != null && curKey.index != -1 && curKey.nextKey != null) + if (curKey != null && curKey.index != -1) { LiveTimelineKeyLipSyncData arg = curKey.key as LiveTimelineKeyLipSyncData; this.OnUpdateLipSync(arg, liveTime); diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index 4bfd2b8..cdb45e4 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -337,7 +337,7 @@ namespace Gallop.Live public PartEntry partInfo; public bool _syncTime = false; - public bool _soloMode = true; + public bool _soloMode = false; public int characterCount = 0; public int allowCount = 0; @@ -525,7 +525,7 @@ namespace Gallop.Live else { _liveCurrentTime += Time.deltaTime; - Debug.Log(_liveCurrentTime * 60); + //Debug.Log(_liveCurrentTime * 60); OnTimelineUpdate(_liveCurrentTime); } } From 875751d080ea5074f1c40905494d2aa070ac07ac Mon Sep 17 00:00:00 2001 From: CroakFang <1605296300@qq.com> Date: Sat, 8 Jul 2023 20:07:51 +0800 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83a9c47..8f57af3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Unity application that makes it easy to view assets from Uma Musume: Pretty Derb ------------ - For Developers/Contributors -1. [Unity Hub](https://unity3d.com/get-unity/download) with [Unity Engine Version 2020.3.28f1](unityhub://2020.3.28f1/f5400f52e03f) is recommended. It should be possible to run it on newer 2020.3.X versions. +1. [Unity Hub](https://unity3d.com/get-unity/download) with [Unity Engine Version 2020.3.24f1](unityhub://2020.3.28f1/f5400f52e03f) is recommended. It should be possible to run it on newer 2020.3.X versions. 1. Clone or download and extract this repository. 1. Import and Open the project in Unity Hub, missing files should be automatically repaired. 1. Open the Assets/Scenes/Version2 scene.