This commit is contained in:
CroakFang
2023-07-31 21:25:32 +08:00
parent 2a3cb02153
commit 9d27eb87ed
3 changed files with 130 additions and 125 deletions
@@ -325,17 +325,16 @@ public class UnityCameraVMDRecorder : MonoBehaviour
} }
public static void SaveLiveCameraVMD(List<LiveCameraFrame> frames, int MultiCameraIndex = -1) public static void SaveLiveCameraVMD(LiveEntry liveEntry,DateTime time, List<LiveCameraFrame> frames, int MultiCameraIndex = -1)
{ {
string directory = $"{Application.dataPath}/../VMDRecords/"; string directory = $"{Application.dataPath}/../VMDRecords/Live{liveEntry.MusicId}_{time.ToString("yyyy-MM-dd_HH-mm-ss")}/";
Directory.CreateDirectory(directory); Directory.CreateDirectory(directory);
var time = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"); string fileName = $"{directory}LiveCamera_POS.vmd";
string fileName = $"{directory}LiveCamera_POS_{time}.vmd"; string fovFileName = $"{directory}LiveCamera_FOV.vmd";
string fovFileName = $"{directory}LiveCamera_FOV_{time}.vmd";
if(MultiCameraIndex >= 0) if(MultiCameraIndex >= 0)
{ {
fileName = $"{directory}LiveMultiCamera{MultiCameraIndex}_POS_{time}.vmd"; fileName = $"{directory}LiveMultiCamera{MultiCameraIndex}_POS.vmd";
fovFileName = $"{directory}LiveMultiCamera{MultiCameraIndex}_FOV_{time}.vmd"; fovFileName = $"{directory}LiveMultiCamera{MultiCameraIndex}_FOV.vmd";
} }
const string modelName = "カメラ・照明"; const string modelName = "カメラ・照明";
@@ -596,10 +596,10 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
SaveVMD(modelName, fileName); SaveVMD(modelName, fileName);
} }
public void SaveLiveVMD(string modelName, int keyReductionLevel = 3) public void SaveLiveVMD(LiveEntry liveEntry, DateTime time ,string modelName, int keyReductionLevel = 3)
{ {
string fileName = Application.dataPath + "/../VMDRecords/" + string.Format("{0}_{1}.vmd", modelName, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); string fileName = $"{Application.dataPath}/../VMDRecords/Live{liveEntry.MusicId}_{time.ToString("yyyy-MM-dd_HH-mm-ss")}/{modelName}.vmd";
Directory.CreateDirectory(Application.dataPath + "/../VMDRecords"); Directory.CreateDirectory(Path.GetDirectoryName(fileName));
KeyReductionLevel = keyReductionLevel; KeyReductionLevel = keyReductionLevel;
SaveVMD(modelName, fileName); SaveVMD(modelName, fileName);
} }
+121 -115
View File
@@ -151,85 +151,85 @@ namespace Gallop.Live
private const float LiveTotalTimeMargin = 0; private const float LiveTotalTimeMargin = 0;
private const float MaxOutlineOffLength = 99999; private const float MaxOutlineOffLength = 99999;
private const int FINALIZE_CAMERA_DEPTH = 19; private const int FINALIZE_CAMERA_DEPTH = 19;
private static Director _instance = null; private static Director _instance = null;
[SerializeField] [SerializeField]
private Director.State _state; private Director.State _state;
private bool _isDestroyed; private bool _isDestroyed;
public LiveTimelineControl _liveTimelineControl; //Edited to public public LiveTimelineControl _liveTimelineControl; //Edited to public
private bool _isFinished; private bool _isFinished;
private readonly RandomTable<float> _randomTable; private readonly RandomTable<float> _randomTable;
private RandomRatioTable _blinkLightRandomRatioTable; private RandomRatioTable _blinkLightRandomRatioTable;
private float _sceneFrameRate; private float _sceneFrameRate;
[SerializeField] [SerializeField]
public float _liveCurrentTime; //Edited to public public float _liveCurrentTime; //Edited to public
private bool _isRequestFadeOut; private bool _isRequestFadeOut;
public bool _isLiveSetup; //Edit to pulic public bool _isLiveSetup; //Edit to pulic
[SerializeField] [SerializeField]
private bool _isEnableBloom; private bool _isEnableBloom;
private bool _isBloom; private bool _isBloom;
private bool _isDof; private bool _isDof;
public StageController _stageController; //Edited to public public StageController _stageController; //Edited to public
private bool _isEnabledStageController; private bool _isEnabledStageController;
public RenderTexture[] MonitorTextureArray; public RenderTexture[] MonitorTextureArray;
[SerializeField] [SerializeField]
private Transform _globalLightTransform; private Transform _globalLightTransform;
[SerializeField] [SerializeField]
private GameObject[] _cameraNodes; private GameObject[] _cameraNodes;
private Camera[] _cameraObjects; private Camera[] _cameraObjects;
private Transform[] _cameraTransforms; private Transform[] _cameraTransforms;
private CameraEventCallback[] _cameraEventCallbackArray; private CameraEventCallback[] _cameraEventCallbackArray;
private GameObject _transparentCameraObject; private GameObject _transparentCameraObject;
private Camera _transparentCamera; private Camera _transparentCamera;
private Transform _transparentCameraTransform; private Transform _transparentCameraTransform;
private MultiCameraFinalComposite[] _multiCameraFinalCompositeArray; private MultiCameraFinalComposite[] _multiCameraFinalCompositeArray;
private MultiCameraComposite[] _multiCameraCompositionArray; private MultiCameraComposite[] _multiCameraCompositionArray;
private MultiCamera _multiCamera; private MultiCamera _multiCamera;
[SerializeField] [SerializeField]
private CameraLookAt _cameraLookAt; private CameraLookAt _cameraLookAt;
[SerializeField] [SerializeField]
private Animator _cameraAnimator; private Animator _cameraAnimator;
private RuntimeAnimatorController _cameraRuntimeAnimator; private RuntimeAnimatorController _cameraRuntimeAnimator;
private GameObject[] _monitorCameraObjectArray; private GameObject[] _monitorCameraObjectArray;
private MonitorCamera[] _monitorCameraArray; private MonitorCamera[] _monitorCameraArray;
[SerializeField] [SerializeField]
private HandShakeCamera _handShakeCamera; private HandShakeCamera _handShakeCamera;
private int _activeCameraIndex = 1; private int _activeCameraIndex = 1;
private readonly int kMotionCameraIndex; private readonly int kMotionCameraIndex;
private readonly int[] kTimelineCameraIndices = new int[3] { 1, 2, 3 }; private readonly int[] kTimelineCameraIndices = new int[3] { 1, 2, 3 };
//private GallopFrameBuffer _frameBuffer; //private GallopFrameBuffer _frameBuffer;
//private LowResolutionCameraFrameBuffer[] _lowResolutionCameraArray; //private LowResolutionCameraFrameBuffer[] _lowResolutionCameraArray;
private Camera _mainCameraObject; private Camera _mainCameraObject;
private Transform _mainCameraTransform; private Transform _mainCameraTransform;
public Action OnChangeOriantationLandscapeCallback; public Action OnChangeOriantationLandscapeCallback;
public Action OnChangeOriantationPortraitCallback; public Action OnChangeOriantationPortraitCallback;
private readonly List<CharacterObject> _characterObjectList; private readonly List<CharacterObject> _characterObjectList;
private List<CharaEffectInfo> _listShadowEffectInfo; private List<CharaEffectInfo> _listShadowEffectInfo;
private List<CharaEffectInfo> _listSpotLightEffectInfo; private List<CharaEffectInfo> _listSpotLightEffectInfo;
private ModelController.ModelDepthInfo[] _depthOrderInfoArray; private ModelController.ModelDepthInfo[] _depthOrderInfoArray;
private readonly List<ModelController> _modelControllerList; private readonly List<ModelController> _modelControllerList;
private bool _isUpdateModelRenderQueue; private bool _isUpdateModelRenderQueue;
//private PropsManager _propsManager; //private PropsManager _propsManager;
private SongPart _songPart; private SongPart _songPart;
//public LiveChampionsTextController ChampionsTextController; //public LiveChampionsTextController ChampionsTextController;
public LiveTitleController TitleController; public LiveTitleController TitleController;
private LiveFadeController _fadeController; private LiveFadeController _fadeController;
//private readonly List<LiveImageEffect> _imageEffectLive3dList; //private readonly List<LiveImageEffect> _imageEffectLive3dList;
//private IndirectLightShaftsParam[] _indirectLightShaftsParamArray; //private IndirectLightShaftsParam[] _indirectLightShaftsParamArray;
private Texture2D[] _indirectLightShaftsTexture; private Texture2D[] _indirectLightShaftsTexture;
private ColorCorrectionParam _colorCorrectionParameter; private ColorCorrectionParam _colorCorrectionParameter;
[SerializeField] [SerializeField]
private float _outlineFovMin; private float _outlineFovMin;
[SerializeField] [SerializeField]
private float _outlineFovMinOffLength; private float _outlineFovMinOffLength;
[SerializeField] [SerializeField]
private float _outlineFovLessOffLength; private float _outlineFovLessOffLength;
[SerializeField] [SerializeField]
private float _outlineFovMax; private float _outlineFovMax;
[SerializeField] [SerializeField]
private float _outlineFovMaxOffLength; private float _outlineFovMaxOffLength;
[SerializeField] [SerializeField]
private float _outlineFovGreaterOffLength; private float _outlineFovGreaterOffLength;
private List<Director.OutLineOffLengthItem> _outlineOffLengthItems; private List<Director.OutLineOffLengthItem> _outlineOffLengthItems;
private const int VariationCallOn = 1; private const int VariationCallOn = 1;
private const int VariationCallOff = 2; private const int VariationCallOff = 2;
private const int CharaSongVariation = 1; private const int CharaSongVariation = 1;
@@ -237,24 +237,24 @@ namespace Gallop.Live
private const int PROPS_BLINKLIGHT_RENDERQUEUE_START = 100; private const int PROPS_BLINKLIGHT_RENDERQUEUE_START = 100;
private const string LIGHT_UVMOVIE_FILE_NAME = "gal_UVmovie_{0}_Light"; private const string LIGHT_UVMOVIE_FILE_NAME = "gal_UVmovie_{0}_Light";
private const string LIVE_IMAGE_SUFFIX_CHAMPIONS_LOGO = "champions_logo"; private const string LIVE_IMAGE_SUFFIX_CHAMPIONS_LOGO = "champions_logo";
private const string LIVE_IMAGE_SUFFIX_CHAMPIONS_JACKET = "champions_jacket"; private const string LIVE_IMAGE_SUFFIX_CHAMPIONS_JACKET = "champions_jacket";
private Director.LoadAssetTask _loadAssetTask; private Director.LoadAssetTask _loadAssetTask;
private bool _isClothInitialized; private bool _isClothInitialized;
private int _charaClothResetTimer; private int _charaClothResetTimer;
private GameObject _initializeCamera; private GameObject _initializeCamera;
private Transform _initializeCameraTransform; private Transform _initializeCameraTransform;
private float _clothInitTimer; private float _clothInitTimer;
//private List<PropsManager.PropsData> _propsDataList; //private List<PropsManager.PropsData> _propsDataList;
private int _usualMultiTrainedCharaId; private int _usualMultiTrainedCharaId;
private bool _isInitializedMultiCamera; private bool _isInitializedMultiCamera;
private bool _isInitialized; private bool _isInitialized;
private static GameObject _cuttPrefab; private static GameObject _cuttPrefab;
private static bool _usingAssetBundleCuttPrefab; private static bool _usingAssetBundleCuttPrefab;
private static TextAsset _cyalumeChoreographyCsv; private static TextAsset _cyalumeChoreographyCsv;
private static TextAsset _songPartCsv; private static TextAsset _songPartCsv;
private static TextAsset[] _uvMovieJsonArray; private static TextAsset[] _uvMovieJsonArray;
private bool _enableTimelineGlobalRimParam; private bool _enableTimelineGlobalRimParam;
private Vector3 _tempRateVector; private Vector3 _tempRateVector;
private Vector3 _tempAttachRateVector; private Vector3 _tempAttachRateVector;
public static Director instance => _instance; public static Director instance => _instance;
@@ -317,7 +317,7 @@ namespace Gallop.Live
public List<Transform> charaObjs; public List<Transform> charaObjs;
public List<UmaContainer> CharaContainerScript = new List<UmaContainer>(); public List<UmaContainer> CharaContainerScript = new List<UmaContainer>();
public List<Animation> charaAnims; public List<Animation> charaAnims;
@@ -384,10 +384,11 @@ namespace Gallop.Live
Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), this.gameObject.transform); Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), this.gameObject.transform);
//Make CharacterObject //Make CharacterObject
var characterStandPos = this._liveTimelineControl.transform.Find("CharacterStandPos"); var characterStandPos = this._liveTimelineControl.transform.Find("CharacterStandPos");
int counter = 0; int counter = 0;
foreach (Transform trans in characterStandPos.GetComponentsInChildren<Transform>()) { foreach (Transform trans in characterStandPos.GetComponentsInChildren<Transform>())
{
if (trans == characterStandPos) if (trans == characterStandPos)
{ {
continue; continue;
@@ -413,7 +414,7 @@ namespace Gallop.Live
public void InitializeUI() public void InitializeUI()
{ {
UI = GameObject.Find("LiveUI").GetComponent<LiveViewerUI>(); UI = GameObject.Find("LiveUI").GetComponent<LiveViewerUI>();
sliderControl = UI.ProgressBar.GetComponent<SliderControl>(); sliderControl = UI.ProgressBar.GetComponent<SliderControl>();
} }
@@ -446,7 +447,7 @@ namespace Gallop.Live
var nextKey = keyData_.nextKey as LiveTimelineKeyLipSyncData; var nextKey = keyData_.nextKey as LiveTimelineKeyLipSyncData;
for (int k = 0; k < charaObjs.Count; k++) for (int k = 0; k < charaObjs.Count; k++)
{ {
if(k < CharaContainerScript.Count) if (k < CharaContainerScript.Count)
{ {
var container = CharaContainerScript[k]; var container = CharaContainerScript[k];
container.FaceDrivenKeyTarget.AlterUpdateAutoLip(prevKey, curKey, liveTime_, ((int)curKey.character >> k) % 2); container.FaceDrivenKeyTarget.AlterUpdateAutoLip(prevKey, curKey, liveTime_, ((int)curKey.character >> k) % 2);
@@ -455,7 +456,7 @@ namespace Gallop.Live
}; };
_liveTimelineControl.OnUpdateFacial += delegate (FacialDataUpdateInfo updateInfo_, float liveTime_, int position) _liveTimelineControl.OnUpdateFacial += delegate (FacialDataUpdateInfo updateInfo_, float liveTime_, int position)
{ {
if( position < charaObjs.Count) if (position < charaObjs.Count)
{ {
var container = CharaContainerScript[position]; var container = CharaContainerScript[position];
container.FaceDrivenKeyTarget.AlterUpdateFacialNew(ref updateInfo_, liveTime_); container.FaceDrivenKeyTarget.AlterUpdateFacialNew(ref updateInfo_, liveTime_);
@@ -473,7 +474,7 @@ namespace Gallop.Live
_liveTimelineControl.SetTimelineCamera(_cameraObjects[num], i); _liveTimelineControl.SetTimelineCamera(_cameraObjects[num], i);
} }
} }
_liveTimelineControl.OnUpdateCameraSwitcher += delegate (int cameraIndex_) _liveTimelineControl.OnUpdateCameraSwitcher += delegate (int cameraIndex_)
{ {
if (cameraIndex_ < 0) if (cameraIndex_ < 0)
@@ -508,7 +509,7 @@ namespace Gallop.Live
} }
} }
public void InitializeMultiCamera(LiveTimelineControl control) public void InitializeMultiCamera(LiveTimelineControl control)
{ {
var cameraCount = control.data.multiCameraSettings.cameraNum; var cameraCount = control.data.multiCameraSettings.cameraNum;
MultiCamera[] cameras = new MultiCamera[cameraCount]; MultiCamera[] cameras = new MultiCamera[cameraCount];
@@ -547,7 +548,7 @@ namespace Gallop.Live
private void SetupCharacterLocator() private void SetupCharacterLocator()
{ {
if (!_liveTimelineControl) return; if (!_liveTimelineControl) return;
for (int i = 0; i < CharaContainerScript.Count; i++) for (int i = 0; i < CharaContainerScript.Count; i++)
{ {
var container = CharaContainerScript[i]; var container = CharaContainerScript[i];
container.LiveLocator = new LiveTimelineCharaLocator(container); container.LiveLocator = new LiveTimelineCharaLocator(container);
@@ -613,8 +614,8 @@ namespace Gallop.Live
if (IsRecordVMD) if (IsRecordVMD)
{ {
foreach(var container in CharaContainerScript) foreach (var container in CharaContainerScript)
{ {
var rootbone = container.transform.Find("Position"); var rootbone = container.transform.Find("Position");
var newRecorder = rootbone.gameObject.AddComponent<UnityHumanoidVMDRecorder>(); var newRecorder = rootbone.gameObject.AddComponent<UnityHumanoidVMDRecorder>();
newRecorder.UseParentOfAll = true; newRecorder.UseParentOfAll = true;
@@ -624,7 +625,7 @@ namespace Gallop.Live
{ {
newRecorder.StartRecording(); newRecorder.StartRecording();
} }
} }
} }
} }
@@ -667,7 +668,7 @@ namespace Gallop.Live
{ {
UmaViewerAudio.SetTime(liveMusic, _liveCurrentTime); UmaViewerAudio.SetTime(liveMusic, _liveCurrentTime);
foreach (var vocal in liveVocal) foreach (var vocal in liveVocal)
{ {
UmaViewerAudio.SetTime(vocal, _liveCurrentTime); UmaViewerAudio.SetTime(vocal, _liveCurrentTime);
@@ -690,7 +691,7 @@ namespace Gallop.Live
else if (sliderControl.is_Touched) else if (sliderControl.is_Touched)
{ {
_liveCurrentTime = UI.ProgressBar.value * totalTime; _liveCurrentTime = UI.ProgressBar.value * totalTime;
if (liveMusic != null) if (liveMusic != null)
{ {
UmaViewerAudio.Stop(liveMusic); UmaViewerAudio.Stop(liveMusic);
@@ -699,7 +700,7 @@ namespace Gallop.Live
UmaViewerAudio.Stop(vocal); UmaViewerAudio.Stop(vocal);
} }
} }
OnTimelineUpdate(_liveCurrentTime); OnTimelineUpdate(_liveCurrentTime);
} }
else else
@@ -710,7 +711,7 @@ namespace Gallop.Live
UI.ProgressBar.SetValueWithoutNotify(_liveCurrentTime / totalTime); UI.ProgressBar.SetValueWithoutNotify(_liveCurrentTime / totalTime);
OnTimelineUpdate(_liveCurrentTime); OnTimelineUpdate(_liveCurrentTime);
} }
} }
} }
UpdateMainCamera(); UpdateMainCamera();
@@ -721,18 +722,16 @@ namespace Gallop.Live
_liveTimelineControl.AlterLateUpdate(); _liveTimelineControl.AlterLateUpdate();
} }
DateTime ExitTime;
private void ExitLive() private void ExitLive()
{ {
isExit = true; isExit = true;
if (_liveTimelineControl.IsRecordVMD) if (_liveTimelineControl.IsRecordVMD)
{ {
ExitTime = DateTime.Now;
SaveCameraVMD(); SaveCameraVMD();
SaveMultiCameraVMD(); SaveMultiCameraVMD();
SaveCharacterVMD(); SaveCharacterVMD();
} }
UmaSceneController.LoadScene("Version2"); UmaSceneController.LoadScene("Version2");
UmaAssetManager.UnloadAllBundle(true); UmaAssetManager.UnloadAllBundle(true);
@@ -748,7 +747,7 @@ namespace Gallop.Live
if (recorder.IsRecording) if (recorder.IsRecording)
{ {
recorder.StopRecording(); recorder.StopRecording();
recorder.SaveLiveVMD($"Live{live.MusicId}_Pos{CharaContainerScript.IndexOf(container)}"); recorder.SaveLiveVMD(live, ExitTime, $"Live{live.MusicId}_Pos{CharaContainerScript.IndexOf(container)}");
} }
} }
} }
@@ -761,18 +760,21 @@ namespace Gallop.Live
var frames = _liveTimelineControl.MultiRecordFrames[i]; var frames = _liveTimelineControl.MultiRecordFrames[i];
frames[0].FovVaild = true; frames[0].FovVaild = true;
var fov = _liveTimelineControl.data.worksheetList[0].multiCameraPosKeys[i].keys.thisList; var fov = _liveTimelineControl.data.worksheetList[0].multiCameraPosKeys[i].keys.thisList;
fov.ForEach(k => { fov.ForEach(k =>
var index = k.frame; {
if (index < frames.Count) var keyframe = frames.Find(f => f.frameIndex == k.frame);
if (keyframe != null)
{ {
frames[index].FovVaild = true; var index = frames.IndexOf(keyframe);
keyframe.FovVaild = true;
if (index + 1 < frames.Count) frames[index + 1].FovVaild = true;
if (index - 1 > 0) frames[index - 1].FovVaild = true; if (index - 1 > 0) frames[index - 1].FovVaild = true;
if (index - 2 > 0) frames[index - 2].FovVaild = true; if (index - 2 > 0) frames[index - 2].FovVaild = true;
if (index - 3 > 0) frames[index - 3].FovVaild = true; if (index - 3 > 0) frames[index - 3].FovVaild = true;
} }
}); });
UnityCameraVMDRecorder.SaveLiveCameraVMD(frames,i); UnityCameraVMDRecorder.SaveLiveCameraVMD(live, ExitTime, frames, i);
} }
} }
@@ -781,18 +783,22 @@ namespace Gallop.Live
var frames = _liveTimelineControl.RecordFrames; var frames = _liveTimelineControl.RecordFrames;
frames[0].FovVaild = true; frames[0].FovVaild = true;
var fov = _liveTimelineControl.data.worksheetList[0].cameraFovKeys.thisList; var fov = _liveTimelineControl.data.worksheetList[0].cameraFovKeys.thisList;
fov.ForEach(k => { fov.ForEach(k =>
var index = k.frame; {
if (index < frames.Count)
var keyframe = frames.Find(f => f.frameIndex == k.frame);
if (keyframe != null)
{ {
frames[index].FovVaild = true; var index = frames.IndexOf(keyframe);
keyframe.FovVaild = true;
if (index + 1 < frames.Count) frames[index + 1].FovVaild = true;
if (index - 1 > 0) frames[index - 1].FovVaild = true; if (index - 1 > 0) frames[index - 1].FovVaild = true;
if (index - 2 > 0) frames[index - 2].FovVaild = true; if (index - 2 > 0) frames[index - 2].FovVaild = true;
if (index - 3 > 0) frames[index - 3].FovVaild = true; if (index - 3 > 0) frames[index - 3].FovVaild = true;
} }
}); });
UnityCameraVMDRecorder.SaveLiveCameraVMD(frames); UnityCameraVMDRecorder.SaveLiveCameraVMD(live, ExitTime, frames);
} }
} }