diff --git a/Assets/Scenes/LiveScene.unity b/Assets/Scenes/LiveScene.unity index 9056010..ede5b29 100644 --- a/Assets/Scenes/LiveScene.unity +++ b/Assets/Scenes/LiveScene.unity @@ -2831,6 +2831,85 @@ RectTransform: m_AnchoredPosition: {x: -7.5, y: -0.5} m_SizeDelta: {x: -35, y: -13} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1950769033 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1950769034} + - component: {fileID: 1950769036} + - component: {fileID: 1950769035} + m_Layer: 5 + m_Name: Recording + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1950769034 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950769033} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2146838901} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1950769035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950769033} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 036631af73b15ac41a9d10f75f5bbafe, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 49 + m_Alignment: 2 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u25CF Recording...\n" +--- !u!222 &1950769036 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1950769033} + m_CullTransparentMesh: 1 --- !u!1 &1975009925 GameObject: m_ObjectHideFlags: 0 @@ -2895,7 +2974,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 2146838901} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1988617878 GameObject: @@ -3056,6 +3135,7 @@ MonoBehaviour: ProgressBar: {fileID: 912298141} BottonUITransform: {fileID: 1107325621} FrameRateDropDown: {fileID: 499218592} + RecordingUI: {fileID: 1950769033} --- !u!81 &2017920250 AudioListener: m_ObjectHideFlags: 0 @@ -3394,6 +3474,7 @@ RectTransform: m_Children: - {fileID: 679139655} - {fileID: 61452365} + - {fileID: 1950769034} - {fileID: 1975009928} m_Father: {fileID: 0} m_RootOrder: 2 diff --git a/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs b/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs index 773efe7..788b0d6 100644 --- a/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs +++ b/Assets/Scripts/Exporters/VMDRecorder/UnityHumanoidVMDRecorder.cs @@ -69,6 +69,8 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour private UmaContainer container; float aposeDegress = 38.5f; + + public bool IsLive; public void Initialize() { Time.fixedDeltaTime = FPSs; @@ -172,7 +174,7 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour private void FixedUpdate() { - if (IsRecording) + if (IsRecording && !IsLive) { SaveFrame(); FrameNumber++; @@ -315,6 +317,15 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour } } + void LiveSaveFrame() + { + if (IsRecording && IsLive) + { + SaveFrame(); + FrameNumber++; + } + } + void SetInitialPositionAndRotation() { if (UseAbsoluteCoordinateSystem) @@ -337,10 +348,17 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour /// /// レコーディングを開始または再開 /// - public void StartRecording() + public void StartRecording(bool islive = false) { SetInitialPositionAndRotation(); IsRecording = true; + IsLive = islive; + + if (islive) + { + var director = Gallop.Live.Director.instance; + director._liveTimelineControl.RecordUma += LiveSaveFrame; + } } /// @@ -369,6 +387,12 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour rotationDictionary.Add(boneName, new List()); } morphRecorder = new MorphRecorder(transform); + + if (IsLive) + { + var director = Gallop.Live.Director.instance; + director._liveTimelineControl.RecordUma -= LiveSaveFrame; + } } /// diff --git a/Assets/Scripts/LiveToolBox/LiveViewerUI.cs b/Assets/Scripts/LiveToolBox/LiveViewerUI.cs index 207aa87..938474e 100644 --- a/Assets/Scripts/LiveToolBox/LiveViewerUI.cs +++ b/Assets/Scripts/LiveToolBox/LiveViewerUI.cs @@ -14,6 +14,7 @@ public class LiveViewerUI : MonoBehaviour public Dropdown FrameRateDropDown; + public GameObject RecordingUI; float targetHeight = 0; float height; private void Awake() diff --git a/Assets/Scripts/UmaViewerBuilder.cs b/Assets/Scripts/UmaViewerBuilder.cs index a0edf8f..1b7da7b 100644 --- a/Assets/Scripts/UmaViewerBuilder.cs +++ b/Assets/Scripts/UmaViewerBuilder.cs @@ -704,6 +704,7 @@ public class UmaViewerBuilder : MonoBehaviour Gallop.Live.Director.instance.InitializeTimeline(characters, UI.LiveMode); Gallop.Live.Director.instance.InitializeMusic(live.MusicId, characters); Gallop.Live.Director.instance.Play(); + LiveViewerUI.Instance.RecordingUI.SetActive(Gallop.Live.Director.instance.IsRecordVMD); } ); } diff --git a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs index 749ce28..40a8031 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineControl.cs @@ -101,6 +101,7 @@ namespace Gallop.Live.Cutt public bool IsRecordVMD; public List RecordFrames = new List(); public List> MultiRecordFrames = new List>(); + public event Action RecordUma; public float currentLiveTime { @@ -307,10 +308,10 @@ namespace Gallop.Live.Cutt _isNowAlterUpdate = true; _oldLiveTime = currentLiveTime; currentLiveTime = liveTime; + _currentFrame = currentLiveTime * 60f; _oldFrame = _oldLiveTime * 60f; _deltaTime = currentLiveTime - _oldLiveTime; _deltaTimeRatio = _deltaTime / 0.0166666675f; - _currentFrame = currentLiveTime * 60f; AlterUpdate_CharaMotionSequence(liveTime); AlterUpdate_FacialData(liveTime); AlterUpdate_LipSync(liveTime); @@ -355,6 +356,8 @@ namespace Gallop.Live.Cutt LiveCameraFrame mulframe = new LiveCameraFrame(currentFrame, MulCamera.transform, cam.fieldOfView, lastMulframe); MulFrame.Add(mulframe); } + + if (currentFrame % 2 == 0) RecordUma?.Invoke(); } } diff --git a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineMotionSequence.cs b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineMotionSequence.cs index 8df4a87..ab2c57f 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineMotionSequence.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Cutt/LiveTimelineMotionSequence.cs @@ -80,13 +80,12 @@ namespace Gallop.Live.Cutt public void AlterUpdate(float currentTime) { - if(Director.instance.liveMode == 0) + var director = Director.instance; + if (Director.instance.liveMode == 0) { - - if(_targetAnim != null) + if (_targetAnim != null) { - //_tempAnim[_targetAnim.name].time = currentTime; - if (Director.instance.sliderControl.is_Touched) + if (director.sliderControl.is_Touched || director.IsRecordVMD) { _tempAnim[_targetAnim.name].time = currentTime; _tempAnim.Play(_targetAnim.name); @@ -108,7 +107,7 @@ namespace Gallop.Live.Cutt _curIndex = curKey.index; - if ((curKey != null && _curIndex != -1 && _curIndex != _prevIndex) || Director.instance.sliderControl.is_Touched || Director.instance._syncTime == false) + if ((curKey != null && _curIndex != -1 && _curIndex != _prevIndex) || Director.instance.sliderControl.is_Touched || Director.instance._syncTime == false || director.IsRecordVMD) { LiveTimelineKeyCharaMotionData arg = curKey.key as LiveTimelineKeyCharaMotionData; diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index 0a077a2..4647ad1 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -623,7 +623,7 @@ namespace Gallop.Live newRecorder.Initialize(); if (!newRecorder.IsRecording) { - newRecorder.StartRecording(); + newRecorder.StartRecording(true); } } } @@ -660,13 +660,28 @@ namespace Gallop.Live } else { - if (sliderControl.is_Outed) + if (IsRecordVMD) + { + _liveCurrentTime += (1/60f); + if (liveMusic != null) + { + UmaViewerAudio.Stop(liveMusic); + foreach (var vocal in liveVocal) + { + UmaViewerAudio.Stop(vocal); + } + } + + UI.ProgressBar.SetValueWithoutNotify(_liveCurrentTime / totalTime); + OnTimelineUpdate(_liveCurrentTime); + _liveTimelineControl.AlterLateUpdate(); + } + else if (sliderControl.is_Outed) { _liveCurrentTime = UI.ProgressBar.value * totalTime; if (liveMusic != null) { - UmaViewerAudio.SetTime(liveMusic, _liveCurrentTime); foreach (var vocal in liveVocal) @@ -706,20 +721,20 @@ namespace Gallop.Live else { _liveCurrentTime += Time.deltaTime; - - //Debug.Log(_liveCurrentTime * 60); - UI.ProgressBar.SetValueWithoutNotify(_liveCurrentTime / totalTime); OnTimelineUpdate(_liveCurrentTime); } } + UpdateMainCamera(); } - UpdateMainCamera(); } private void LateUpdate() { - _liveTimelineControl.AlterLateUpdate(); + if (_isLiveSetup && _syncTime && !IsRecordVMD) + { + _liveTimelineControl.AlterLateUpdate(); + } } DateTime ExitTime;