This commit is contained in:
左右看
2023-07-30 00:38:21 +08:00
11 changed files with 2054 additions and 146 deletions
File diff suppressed because it is too large Load Diff
+353 -11
View File
@@ -930,7 +930,7 @@ RectTransform:
m_Children:
- {fileID: 887532140}
m_Father: {fileID: 523631780}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
@@ -2964,7 +2964,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 523631780}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
@@ -4738,6 +4738,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 197132282}
m_CullTransparentMesh: 1
--- !u!1 &202988918
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 202988919}
- component: {fileID: 202988921}
- component: {fileID: 202988920}
m_Layer: 5
m_Name: Checkmark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &202988919
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 202988918}
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: 922614215}
m_RootOrder: 0
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 &202988920
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 202988918}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &202988921
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 202988918}
m_CullTransparentMesh: 1
--- !u!1 &203967664
GameObject:
m_ObjectHideFlags: 0
@@ -14260,6 +14335,104 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 504748474}
m_CullTransparentMesh: 1
--- !u!1 &506660741
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 506660742}
- component: {fileID: 506660743}
m_Layer: 5
m_Name: Toggle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &506660742
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 506660741}
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:
- {fileID: 1556377413}
- {fileID: 922614215}
m_Father: {fileID: 523631780}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 261.13794, y: 62.5}
m_SizeDelta: {x: 227.715, y: 35}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &506660743
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 506660741}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 922614216}
toggleTransition: 1
graphic: {fileID: 202988920}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1564959567}
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
m_MethodName: SetLiveRecordMode
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_IsOn: 0
--- !u!1 &507044638
GameObject:
m_ObjectHideFlags: 0
@@ -14780,8 +14953,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 175, y: 80}
m_SizeDelta: {x: -450, y: 35}
m_AnchoredPosition: {x: 31.678, y: 80}
m_SizeDelta: {x: -626.645, y: 35}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &515484818
MonoBehaviour:
@@ -14829,16 +15002,28 @@ MonoBehaviour:
m_CaptionImage: {fileID: 0}
m_ItemText: {fileID: 1312133766}
m_ItemImage: {fileID: 0}
m_Value: 0
m_Value: 1
m_Options:
m_Options:
- m_Text: Preview Mode
- m_Text: Simple Mode
m_Image: {fileID: 0}
- m_Text: Full Live Mode(WIP)
m_Image: {fileID: 0}
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1564959567}
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
m_MethodName: UpdateLiveMode
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_AlphaFadeSpeed: 0.15
--- !u!114 &515484819
MonoBehaviour:
@@ -15037,6 +15222,7 @@ RectTransform:
- {fileID: 1406840791}
- {fileID: 1781049852}
- {fileID: 515484817}
- {fileID: 506660742}
- {fileID: 116348345}
- {fileID: 605931264}
- {fileID: 1280435371}
@@ -17252,7 +17438,7 @@ RectTransform:
- {fileID: 1834195527}
- {fileID: 960399988}
m_Father: {fileID: 523631780}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
@@ -24767,7 +24953,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Preview Mode
m_Text: Full Live Mode(WIP)
--- !u!222 &839781340
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -26943,6 +27129,82 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 919036165}
m_CullTransparentMesh: 1
--- !u!1 &922614214
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 922614215}
- component: {fileID: 922614217}
- component: {fileID: 922614216}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &922614215
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922614214}
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:
- {fileID: 202988919}
m_Father: {fileID: 506660742}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 35, y: 35}
m_Pivot: {x: 1, y: 0.5}
--- !u!114 &922614216
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922614214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &922614217
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922614214}
m_CullTransparentMesh: 1
--- !u!1 &926505643
GameObject:
m_ObjectHideFlags: 0
@@ -35168,7 +35430,7 @@ RectTransform:
m_Children:
- {fileID: 2061178672}
m_Father: {fileID: 523631780}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
@@ -42117,6 +42379,85 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 2141276146}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1556377412
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1556377413}
- component: {fileID: 1556377415}
- component: {fileID: 1556377414}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1556377413
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1556377412}
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: 506660742}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -15, y: -0.5}
m_SizeDelta: {x: -40, y: -3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1556377414
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1556377412}
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: 0.19607843, g: 0.19607843, b: 0.19607843, 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: 17
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Record VMD (Slow)
--- !u!222 &1556377415
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1556377412}
m_CullTransparentMesh: 1
--- !u!1 &1558324556
GameObject:
m_ObjectHideFlags: 0
@@ -42395,7 +42736,8 @@ MonoBehaviour:
EnableEyeTracking: 1
EnableFaceOverride: 1
LiveTime: 0
LiveDropdown: {fileID: 515484818}
isRecordVMD: 0
LiveRecoedToggle: {fileID: 0}
LiveMode: 0
currentFaceDrivenKeyTarget: {fileID: 0}
--- !u!114 &1564959568
@@ -19,6 +19,7 @@ public class UnityCameraVMDRecorder : MonoBehaviour
public int KeyReductionLevel = 2;
public List<Vector3> LocalPositions { get; private set; } = new List<Vector3>();
public List<Vector3> LocalRotations { get; private set; } = new List<Vector3>();
public bool IsRecording { get; private set; } = false;
public int FrameNumber { get; private set; } = 0;
@@ -136,12 +137,12 @@ public class UnityCameraVMDRecorder : MonoBehaviour
LastRotation = vmdRotation;
}
Vector3 DeltaVector(Vector3 val ,Vector3 lastVal)
public static Vector3 DeltaVector(Vector3 val ,Vector3 lastVal)
{
return new Vector3(DeltaDegree(val.x, lastVal.x), DeltaDegree(val.y, lastVal.y), DeltaDegree(val.z, lastVal.z));
}
float DeltaDegree(float val,float lastVal)
public static float DeltaDegree(float val,float lastVal)
{
var deltaVal = val - lastVal;
if (Mathf.Abs(deltaVal) < 180)
@@ -323,6 +324,206 @@ public class UnityCameraVMDRecorder : MonoBehaviour
Destroy(this);
}
public static void SaveLiveCameraVMD(List<LiveCameraFrame> frames)
{
string directory = $"{Application.dataPath}/../VMDRecords/";
Directory.CreateDirectory(directory);
var time = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
string fileName = $"{directory}LiveCamera_POS_{time}.vmd";
string fovFileName = $"{directory}LiveCamera_FOV_{time}.vmd";
const string modelName = "カメラ・照明";
Debug.Log("Live Camera VMDファイル作成開始");
//ファイルの書き込み
using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
try
{
const string ShiftJIS = "shift_jis";
const int intByteLength = 4;
//ファイルタイプの書き込み
const int fileTypeLength = 30;
const string RightFileType = "Vocaloid Motion Data 0002";
byte[] fileTypeBytes = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes(RightFileType);
binaryWriter.Write(fileTypeBytes, 0, fileTypeBytes.Length);
binaryWriter.Write(new byte[fileTypeLength - fileTypeBytes.Length], 0, fileTypeLength - fileTypeBytes.Length);
//モーション名の書き込み、Shift_JISで保存
const int motionNameLength = 20;
byte[] motionNameBytes = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("CameraAttach to 全ての親");
binaryWriter.Write(motionNameBytes, 0, Mathf.Min(motionNameBytes.Length, 20));
if (motionNameLength - motionNameBytes.Length > 0)
{
binaryWriter.Write(new byte[motionNameLength - motionNameBytes.Length], 0, motionNameLength - motionNameBytes.Length);
}
//全ボーンフレーム数の書き込み
byte[] allKeyFrameNumberByte = BitConverter.GetBytes((uint)frames.Count);
binaryWriter.Write(allKeyFrameNumberByte, 0, intByteLength);
foreach (var frame in frames)
{
const int boneNameLength = 15;
string boneNameString = "全ての親";
byte[] boneNameBytes = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes(boneNameString);
binaryWriter.Write(boneNameBytes, 0, boneNameBytes.Length);
binaryWriter.Write(new byte[boneNameLength - boneNameBytes.Length], 0, boneNameLength - boneNameBytes.Length);
byte[] frameNumberByte = BitConverter.GetBytes((ulong)(frame.frameIndex/2));
binaryWriter.Write(frameNumberByte, 0, intByteLength);
Vector3 position = frame.Position * WorldScaleFix;
byte[] positionX = BitConverter.GetBytes(position.x);
binaryWriter.Write(positionX, 0, intByteLength);
byte[] positionY = BitConverter.GetBytes(position.y);
binaryWriter.Write(positionY, 0, intByteLength);
byte[] positionZ = BitConverter.GetBytes(position.z);
binaryWriter.Write(positionZ, 0, intByteLength);
Quaternion rotation = frame.Rotation;
byte[] rotationX = BitConverter.GetBytes(rotation.x);
binaryWriter.Write(rotationX, 0, intByteLength);
byte[] rotationY = BitConverter.GetBytes(rotation.y);
binaryWriter.Write(rotationY, 0, intByteLength);
byte[] rotationZ = BitConverter.GetBytes(rotation.z);
binaryWriter.Write(rotationZ, 0, intByteLength);
byte[] rotationW = BitConverter.GetBytes(rotation.w);
binaryWriter.Write(rotationW, 0, intByteLength);
byte[] interpolateBytes = new byte[64];
binaryWriter.Write(interpolateBytes, 0, 64);
}
//全モーフフレーム数の書き込み
byte[] faceFrameCount = BitConverter.GetBytes(0);
binaryWriter.Write(faceFrameCount, 0, intByteLength);
//カメラの書き込み
byte[] cameraFrameCount = BitConverter.GetBytes(0);
binaryWriter.Write(cameraFrameCount, 0, intByteLength);
//照明の書き込み
byte[] lightFrameCount = BitConverter.GetBytes(0);
binaryWriter.Write(lightFrameCount, 0, intByteLength);
//セルフシャドウの書き込み
byte[] selfShadowCount = BitConverter.GetBytes(0);
binaryWriter.Write(selfShadowCount, 0, intByteLength);
//IKの書き込み
byte[] ikCount = BitConverter.GetBytes(0);
binaryWriter.Write(ikCount, 0, intByteLength);
}
catch (Exception ex)
{
Debug.Log("VMD書き込みエラー" + ex.Message);
}
finally
{
binaryWriter.Close();
}
}
using (FileStream fileStream = new FileStream(fovFileName, FileMode.Create))
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
try
{
const string ShiftJIS = "shift_jis";
const int intByteLength = 4;
//ファイルタイプの書き込み
const int fileTypeLength = 30;
const string RightFileType = "Vocaloid Motion Data 0002";
byte[] fileTypeBytes = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes(RightFileType);
binaryWriter.Write(fileTypeBytes, 0, fileTypeBytes.Length);
binaryWriter.Write(new byte[fileTypeLength - fileTypeBytes.Length], 0, fileTypeLength - fileTypeBytes.Length);
//モーション名の書き込み、Shift_JISで保存
const int motionNameLength = 20;
byte[] motionNameBytes = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes(modelName);
binaryWriter.Write(motionNameBytes, 0, Mathf.Min(motionNameBytes.Length, 20));
if (motionNameLength - motionNameBytes.Length > 0)
{
binaryWriter.Write(new byte[motionNameLength - motionNameBytes.Length], 0, motionNameLength - motionNameBytes.Length);
}
//全ボーンフレーム数の書き込み
byte[] allKeyFrameNumberByte = BitConverter.GetBytes(0);
binaryWriter.Write(allKeyFrameNumberByte, 0, intByteLength);
//全モーフフレーム数の書き込み
byte[] faceFrameCount = BitConverter.GetBytes(0);
binaryWriter.Write(faceFrameCount, 0, intByteLength);
var fovkeys = frames.FindAll(k => k.FovVaild);
//カメラの書き込み
byte[] cameraFrameCount = BitConverter.GetBytes((uint)fovkeys.Count);
binaryWriter.Write(cameraFrameCount, 0, intByteLength);
foreach (var frame in fovkeys)
{
byte[] frameNumberByte = BitConverter.GetBytes((ulong)frame.frameIndex/2);
binaryWriter.Write(frameNumberByte, 0, intByteLength);
byte[] cameraDistanceByte = BitConverter.GetBytes(0);
binaryWriter.Write(cameraDistanceByte, 0, intByteLength);
Vector3 position = Vector3.zero;
byte[] positionX = BitConverter.GetBytes(position.x);
binaryWriter.Write(positionX, 0, intByteLength);
byte[] positionY = BitConverter.GetBytes(position.y);
binaryWriter.Write(positionY, 0, intByteLength);
byte[] positionZ = BitConverter.GetBytes(position.z);
binaryWriter.Write(positionZ, 0, intByteLength);
Vector3 rotation = new Vector3(0,180,0) * Mathf.Deg2Rad;
byte[] rotationX = BitConverter.GetBytes(rotation.x);
binaryWriter.Write(rotationX, 0, intByteLength);
byte[] rotationY = BitConverter.GetBytes(rotation.y);
binaryWriter.Write(rotationY, 0, intByteLength);
byte[] rotationZ = BitConverter.GetBytes(rotation.z);
binaryWriter.Write(rotationZ, 0, intByteLength);
byte[] interpolateBytes = new byte[24];
binaryWriter.Write(interpolateBytes, 0, 24);
byte[] viewAngleByte = BitConverter.GetBytes((ulong)frame.Fov);
binaryWriter.Write(viewAngleByte, 0, intByteLength);
byte perspectiveByte = Convert.ToByte(frame.isOrthographic);
byte[] perspectiveBytes = new byte[] { perspectiveByte };
binaryWriter.Write(new byte[] { perspectiveByte }, 0, perspectiveBytes.Length);
}
//照明の書き込み
byte[] lightFrameCount = BitConverter.GetBytes(0);
binaryWriter.Write(lightFrameCount, 0, intByteLength);
//セルフシャドウの書き込み
byte[] selfShadowCount = BitConverter.GetBytes(0);
binaryWriter.Write(selfShadowCount, 0, intByteLength);
//IKの書き込み
byte[] ikCount = BitConverter.GetBytes(0);
binaryWriter.Write(ikCount, 0, intByteLength);
}
catch (Exception ex)
{
Debug.Log("FOV VMD書き込みエラー" + ex.Message);
}
finally
{
binaryWriter.Close();
}
}
}
/// <summary>
/// VMDを作成する
/// 呼び出す際は先にStopRecordingを呼び出すこと
@@ -334,4 +535,45 @@ public class UnityCameraVMDRecorder : MonoBehaviour
KeyReductionLevel = keyReductionLevel;
SaveVMD();
}
}
public class LiveCameraFrame
{
public int frameIndex;
public Vector3 Position;
public Quaternion Rotation;
public Vector3 CameraRotation;
public float Fov;
public bool FovVaild;
public bool isOrthographic;
public LiveCameraFrame(int frameIndex, Transform transform, float fov, LiveCameraFrame lastframe = null, bool isOrthographic = false)
{
this.frameIndex = frameIndex;
var fixedPosition = transform.position;
var vmdPosition = new Vector3(-fixedPosition.x, fixedPosition.y, -fixedPosition.z);
Position = vmdPosition;
var fixedQuatenion = transform.rotation;
var vmdQuatenion = new Quaternion(-fixedQuatenion.x, fixedQuatenion.y, -fixedQuatenion.z, fixedQuatenion.w);
Rotation = vmdQuatenion;
Vector3 vmdRotation = new Vector3(fixedQuatenion.eulerAngles.x, 180 - fixedQuatenion.eulerAngles.y, fixedQuatenion.eulerAngles.z);
var finalRotation = vmdRotation;
if (lastframe == null)
{
finalRotation = vmdRotation;
}
else
{
finalRotation = lastframe.CameraRotation + UnityCameraVMDRecorder.DeltaVector(vmdRotation, lastframe.CameraRotation);
}
CameraRotation = finalRotation;
Fov = fov;
this.isOrthographic = isOrthographic;
}
}
@@ -54,6 +54,7 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
Dictionary<BoneNames, List<Vector3>> positionDictionarySaved = new Dictionary<BoneNames, List<Vector3>>();
Dictionary<BoneNames, List<Quaternion>> rotationDictionary = new Dictionary<BoneNames, List<Quaternion>>();
Dictionary<BoneNames, List<Quaternion>> rotationDictionarySaved = new Dictionary<BoneNames, List<Quaternion>>();
Dictionary<int, bool> visitableDictionary = new Dictionary<int, bool>();
//ボーン移動量の補正係数
//この値は大体の値、正確ではない
const float DefaultBoneAmplifier = 12.5f;
@@ -66,10 +67,12 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
public MorphRecorder morphRecorder;
public MorphRecorder morphRecorderSaved;
private UmaContainer container;
float aposeDegress = 38.5f;
public void Initialize()
{
Time.fixedDeltaTime = FPSs;
container = GetComponentInParent<UmaContainer>();
List<Transform> objs = GetComponentsInChildren<Transform>().ToList();
BoneDictionary = new Dictionary<BoneNames, Transform>()
{
@@ -167,8 +170,6 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
animator.Play(state.shortNameHash, 0, state.normalizedTime);
}
private void FixedUpdate()
{
if (IsRecording)
@@ -178,11 +179,24 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
}
}
bool lastvisable;
void SaveFrame()
{
if (boneGhost != null) { boneGhost.GhostAll(); }
if (morphRecorder != null) { morphRecorder.RecrodAllMorph(); }
bool visable = container.LiveVisible;
if (visitableDictionary.Count == 0)
{
lastvisable = visable;
visitableDictionary.Add(0, visable);
}
else if(visable != lastvisable)
{
lastvisable = visable;
visitableDictionary.Add(FrameNumber, visable);
}
foreach (BoneNames boneName in BoneDictionary.Keys)
{
if (BoneDictionary[boneName] == null)
@@ -521,34 +535,40 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
//IKの書き込み
//0フレームにキーフレーム一つだけ置く
byte[] ikCount = BitConverter.GetBytes(1);
byte[] ikFrameNumber = BitConverter.GetBytes(0);
byte modelDisplay = Convert.ToByte(1);
//右足IKと左足IKと右足つま先IKと左足つま先IKの4つ
byte[] ikNumber = BitConverter.GetBytes(4);
const int IKNameLength = 20;
byte[] leftIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("左足IK");
byte[] rightIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("右足IK");
byte[] leftToeIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("左つま先IK");
byte[] rightToeIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("右つま先IK");
byte ikOn = Convert.ToByte(1);
byte ikOff = Convert.ToByte(0);
byte[] ikCount = BitConverter.GetBytes(visitableDictionary.Count);
binaryWriter.Write(ikCount, 0, intByteLength);
binaryWriter.Write(ikFrameNumber, 0, intByteLength);
binaryWriter.Write(modelDisplay);
binaryWriter.Write(ikNumber, 0, intByteLength);
binaryWriter.Write(leftIKName, 0, leftIKName.Length);
binaryWriter.Write(new byte[IKNameLength - leftIKName.Length], 0, IKNameLength - leftIKName.Length);
binaryWriter.Write(ikOff);
binaryWriter.Write(leftToeIKName, 0, leftToeIKName.Length);
binaryWriter.Write(new byte[IKNameLength - leftToeIKName.Length], 0, IKNameLength - leftToeIKName.Length);
binaryWriter.Write(ikOff);
binaryWriter.Write(rightIKName, 0, rightIKName.Length);
binaryWriter.Write(new byte[IKNameLength - rightIKName.Length], 0, IKNameLength - rightIKName.Length);
binaryWriter.Write(ikOff);
binaryWriter.Write(rightToeIKName, 0, rightToeIKName.Length);
binaryWriter.Write(new byte[IKNameLength - rightToeIKName.Length], 0, IKNameLength - rightToeIKName.Length);
binaryWriter.Write(ikOff);
foreach(var visable in visitableDictionary)
{
byte[] ikFrameNumber = BitConverter.GetBytes(visable.Key);
byte modelDisplay = Convert.ToByte(visable.Value ? 1 : 0);
binaryWriter.Write(ikFrameNumber, 0, intByteLength);
binaryWriter.Write(modelDisplay);
//右足IKと左足IKと右足つま先IKと左足つま先IKの4つ
byte[] ikNumber = BitConverter.GetBytes(4);
const int IKNameLength = 20;
byte[] leftIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("左足IK");
byte[] rightIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("右足IK");
byte[] leftToeIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("左つま先IK");
byte[] rightToeIKName = System.Text.Encoding.GetEncoding(ShiftJIS).GetBytes("右つま先IK");
byte ikOn = Convert.ToByte(1);
byte ikOff = Convert.ToByte(0);
binaryWriter.Write(ikNumber, 0, intByteLength);
binaryWriter.Write(leftIKName, 0, leftIKName.Length);
binaryWriter.Write(new byte[IKNameLength - leftIKName.Length], 0, IKNameLength - leftIKName.Length);
binaryWriter.Write(ikOff);
binaryWriter.Write(leftToeIKName, 0, leftToeIKName.Length);
binaryWriter.Write(new byte[IKNameLength - leftToeIKName.Length], 0, IKNameLength - leftToeIKName.Length);
binaryWriter.Write(ikOff);
binaryWriter.Write(rightIKName, 0, rightIKName.Length);
binaryWriter.Write(new byte[IKNameLength - rightIKName.Length], 0, IKNameLength - rightIKName.Length);
binaryWriter.Write(ikOff);
binaryWriter.Write(rightToeIKName, 0, rightToeIKName.Length);
binaryWriter.Write(new byte[IKNameLength - rightToeIKName.Length], 0, IKNameLength - rightToeIKName.Length);
binaryWriter.Write(ikOff);
}
}
catch (Exception ex)
{
@@ -577,6 +597,14 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
SaveVMD(modelName, fileName);
}
public void SaveLiveVMD(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"));
Directory.CreateDirectory(Application.dataPath + "/../VMDRecords");
KeyReductionLevel = keyReductionLevel;
SaveVMD(modelName, fileName);
}
//裏で正規化されたモデル
//(初期ポーズで各ボーンのlocalRotationがQuaternion.identityのモデル)を疑似的にアニメーションさせる
class BoneGhost
@@ -12,6 +12,8 @@ public class LiveViewerUI : MonoBehaviour
public RectTransform BottonUITransform;
public Dropdown FrameRateDropDown;
float targetHeight = 0;
float height;
private void Awake()
@@ -45,4 +47,9 @@ public class LiveViewerUI : MonoBehaviour
{
targetHeight = -height;
}
public void SetFrameRate(int fps)
{
Application.targetFrameRate = int.Parse(FrameRateDropDown.options[fps].text);
}
}
+1
View File
@@ -82,6 +82,7 @@ public class UmaContainer : MonoBehaviour
[Header("Live")]
public bool IsLive = false;
public bool LiveVisible = true;
public LiveTimelineCharaLocator LiveLocator;
[Header("Other")]
+1 -1
View File
@@ -22,7 +22,7 @@ public class UmaViewerAudio
static public UmaSoundInfo getSoundPath(string name)
{
Debug.Log(name);
//Debug.Log(name);
UmaSoundInfo info;
info.awb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb"));
return info;
+12 -11
View File
@@ -662,25 +662,26 @@ public class UmaViewerBuilder : MonoBehaviour
public void LoadLive(LiveEntry live, List<LiveCharacterSelect> characters)
{
GameObject MainLive = Instantiate(LiveControllerPrefab);
Gallop.Live.Director mController = MainLive.GetComponentInChildren<Gallop.Live.Director>();
mController.live = live;
mController.Initialize();
UmaSceneController.LoadScene("LiveScene",
delegate ()
{
GameObject MainLive = Instantiate(LiveControllerPrefab);
Gallop.Live.Director mController = MainLive.GetComponentInChildren<Gallop.Live.Director>();
mController.live = live;
mController.IsRecordVMD = UI.isRecordVMD;
List<GameObject> transferObjs = new List<GameObject>() {
List<GameObject> transferObjs = new List<GameObject>() {
MainLive,
GameObject.Find("ViewerMain"),
GameObject.Find("Directional Light"),
GameObject.Find("GlobalShaderController"),
GameObject.Find("AudioManager")
};
};
UmaSceneController.LoadScene("LiveScene",
delegate ()
{
// Move the GameObject (you attach this in the Inspector) to the newly loaded Scene
transferObjs.ForEach(o => SceneManager.MoveGameObjectToScene(o, SceneManager.GetSceneByName("LiveScene")));
mController.Initialize();
characters.ForEach(a =>
{
@@ -847,7 +848,7 @@ public class UmaViewerBuilder : MonoBehaviour
public void LoadAsset(UmaDatabaseEntry entry, bool IsSubAsset = false, Transform SetParent = null)
{
Debug.Log("Loading " + entry.Name);
//Debug.Log("Loading " + entry.Name);
var bundle = UmaAssetManager.LoadAssetBundle(entry, isRecursive: false);
LoadBundle(entry, bundle, IsSubAsset, SetParent);
}
+65 -62
View File
@@ -10,7 +10,6 @@ using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Debug = UnityEngine.Debug;
public class UmaViewerUI : MonoBehaviour
{
@@ -135,8 +134,9 @@ public class UmaViewerUI : MonoBehaviour
[Header("Live")]
public bool LiveTime = false;
public Dropdown LiveDropdown;
public int LiveMode = 0;
public bool isRecordVMD;
public Dropdown LiveRecoedToggle;
public int LiveMode = 1;
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
@@ -168,65 +168,6 @@ public class UmaViewerUI : MonoBehaviour
private void Update()
{
if (LiveMode != LiveDropdown.value)
{
LiveMode = LiveDropdown.value;
if (LiveSelectPannel.activeSelf && currentLive != null)
{
foreach (var select in LiveSelectList.content.GetComponentsInChildren<Transform>())
{
if(select != LiveSelectList.content.transform)
{
Destroy(select.gameObject);
}
}
switch (LiveMode)
{
case 0:
LiveSelectImage.sprite = currentLive.Icon;
int mainCount = 0;
foreach (var motion in Main.AbMotions.Where(a => a.Name.StartsWith($"3d/motion/live/body/son{currentLive.MusicId}") && Path.GetFileName(a.Name).Split('_').Length == 4))
{
mainCount += 1;
}
LiveSelectInfoText.text = $"{currentLive.SongName}\nMain Members Count: {mainCount}";
for (int i = 0; i < mainCount; i++)
{
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
chara.IndexText.text = (i + 1).ToString();
chara.GetComponent<Button>().onClick.AddListener(() =>
{
chara.SelectChara(this);
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
{
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
}
});
}
break;
case 1:
LiveSelectImage.sprite = currentLive.Icon;
LiveSelectInfoText.text = $"{currentLive.SongName}\nMembers Count: {currentLive.MemberCount}";
for (int i = 0; i < currentLive.MemberCount; i++)
{
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
chara.IndexText.text = (i + 1).ToString();
chara.GetComponent<Button>().onClick.AddListener(() =>
{
chara.SelectChara(this);
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
{
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
}
});
}
break;
}
}
}
if (Builder.CurrentAudioSources.Count > 0)
{
@@ -1366,6 +1307,66 @@ public class UmaViewerUI : MonoBehaviour
}
}
public void UpdateLiveMode(int val)
{
LiveMode = val;
if (LiveSelectPannel.activeSelf && currentLive != null)
{
foreach (var select in LiveSelectList.content.GetComponentsInChildren<Transform>())
{
if (select != LiveSelectList.content.transform)
{
Destroy(select.gameObject);
}
}
switch (LiveMode)
{
case 0:
LiveSelectImage.sprite = currentLive.Icon;
int mainCount = 0;
foreach (var motion in Main.AbMotions.Where(a => a.Name.StartsWith($"3d/motion/live/body/son{currentLive.MusicId}") && Path.GetFileName(a.Name).Split('_').Length == 4))
{
mainCount += 1;
}
LiveSelectInfoText.text = $"{currentLive.SongName}\nMain Members Count: {mainCount}";
for (int i = 0; i < mainCount; i++)
{
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
chara.IndexText.text = (i + 1).ToString();
chara.GetComponent<Button>().onClick.AddListener(() =>
{
chara.SelectChara(this);
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
{
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
}
});
}
break;
case 1:
LiveSelectImage.sprite = currentLive.Icon;
LiveSelectInfoText.text = $"{currentLive.SongName}\nMembers Count: {currentLive.MemberCount}";
for (int i = 0; i < currentLive.MemberCount; i++)
{
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
chara.IndexText.text = (i + 1).ToString();
chara.GetComponent<Button>().onClick.AddListener(() =>
{
chara.SelectChara(this);
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
{
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
}
});
}
break;
}
}
}
public void UpdateGameDB()
{
if (UpdateResVerCoroutine != null && Config.Instance.WorkMode != WorkMode.Standalone) return;
@@ -1411,6 +1412,8 @@ public class UmaViewerUI : MonoBehaviour
Shader.SetGlobalFloat("_GlobalOutlineWidth", val);
}
public void SetLiveRecordMode(bool val) { isRecordVMD = val; }
public void ShowMessage(string msg, UIMessageType type)
{
MessageText.text += type switch
@@ -97,6 +97,9 @@ namespace Gallop.Live.Cutt
private bool _isExtraCameraLayer;
public bool IsRecordVMD;
public List<LiveCameraFrame> RecordFrames = new List<LiveCameraFrame>();
public float currentLiveTime
{
get
@@ -216,6 +219,7 @@ namespace Gallop.Live.Cutt
if (Director.instance)
{
Director.instance._liveTimelineControl = this;
IsRecordVMD = Director.instance.IsRecordVMD;
}
}
@@ -323,6 +327,21 @@ namespace Gallop.Live.Cutt
AlterUpdate_CameraFov(workSheet, _currentFrame);
AlterUpdate_CameraRoll(workSheet, _currentFrame);
_isNowAlterUpdate = false;
if (IsRecordVMD)
{
var currentFrame = Mathf.RoundToInt(_currentFrame);
var oldFrame = Mathf.RoundToInt(_oldFrame);
CacheCamera cacheCamera = GetCamera(workSheet.targetCameraIndex);
if ((oldFrame == currentFrame && currentFrame > 0)|| cacheCamera == null) return;
LiveCameraFrame lastframe = RecordFrames.Count > 0 ? RecordFrames[RecordFrames.Count - 1] : null;
var transform = cacheCamera.cacheTransform;
var camera = cacheCamera.camera;
LiveCameraFrame frame = new LiveCameraFrame(currentFrame, transform, camera.fieldOfView, lastframe);
RecordFrames.Add(frame);
}
}
public void AlterUpdate_CharaMotionSequence(float liveTime)
@@ -527,16 +546,21 @@ namespace Gallop.Live.Cutt
var chara = Director.instance.CharaContainerScript[targetIndex];
if (!chara) return;
chara.Materials.ForEach(m=>
{
foreach(var key in m.Renderers.Keys)
if(chara.LiveVisible != curKey.visible)
{
chara.Materials.ForEach(m =>
{
foreach (var key in m.Renderers.Keys)
{
key.gameObject.SetActive(curKey.visible);
if (key.gameObject.activeSelf != curKey.visible)
key.gameObject.SetActive(curKey.visible);
}
}
);
});
chara.LiveVisible = curKey.visible;
}
if (curKey.visible)
if (curKey.visible || IsRecordVMD)
{
if(nextKey != null && nextKey.interpolateType != LiveCameraInterpolateType.None)
{
@@ -259,7 +259,6 @@ namespace Gallop.Live
public static Director instance => _instance;
public static bool HasInstance { get; }
public LiveTimelineControl LiveTimelineControl { get; }
public Director.DisplayMode displayMode { get; set; }
public bool IsStarted { get; }
public bool IsFinished { get; set; }
@@ -347,6 +346,8 @@ namespace Gallop.Live
public SliderControl sliderControl;
public bool IsRecordVMD;
public bool isTimelineControlled
{
get
@@ -589,6 +590,22 @@ namespace Gallop.Live
_isLiveSetup = true;
_liveCurrentTime = 0;
if (IsRecordVMD)
{
foreach(var container in CharaContainerScript)
{
var rootbone = container.transform.Find("Position");
var newRecorder = rootbone.gameObject.AddComponent<UnityHumanoidVMDRecorder>();
newRecorder.UseParentOfAll = true;
newRecorder.UseAbsoluteCoordinateSystem = true;
newRecorder.Initialize();
if (!newRecorder.IsRecording)
{
newRecorder.StartRecording();
}
}
}
}
private void OnTimelineUpdate(float _liveCurrentTime)
@@ -604,18 +621,15 @@ namespace Gallop.Live
void Update()
{
if (isExit) return;
if (Input.GetKeyDown(KeyCode.Escape))
{
isExit = true;
UmaSceneController.LoadScene("Version2");
UmaAssetManager.UnloadAllBundle(true);
}
if (_isLiveSetup)
{
if(_syncTime == false)
if (Input.GetKeyDown(KeyCode.Escape) || _liveCurrentTime >= totalTime)
{
ExitLive();
}
if (_syncTime == false)
{
if (liveMusic.sourceList[0].time > 0.01)
{
@@ -672,9 +686,7 @@ namespace Gallop.Live
{
_liveCurrentTime += Time.deltaTime;
UI.ProgressBar.value = _liveCurrentTime / totalTime;
//Debug.Log((float)liveMusic.time / 1000);
Debug.Log(_liveCurrentTime * 60);
UI.ProgressBar.SetValueWithoutNotify(_liveCurrentTime / totalTime);
OnTimelineUpdate(_liveCurrentTime);
}
}
@@ -686,6 +698,43 @@ namespace Gallop.Live
{
_liveTimelineControl.AlterLateUpdate();
}
private void ExitLive()
{
isExit = true;
if (_liveTimelineControl.IsRecordVMD)
{
var frames = _liveTimelineControl.RecordFrames;
frames[0].FovVaild = true;
var fov = _liveTimelineControl.data.worksheetList[0].cameraFovKeys.thisList;
fov.ForEach(k => {
var index = k.frame;
if (index < frames.Count)
{
frames[index].FovVaild = true;
if(index - 1 > 0) frames[index - 1].FovVaild = true;
if(index - 2 > 0) frames[index - 2].FovVaild = true;
}
});
UnityCameraVMDRecorder.SaveLiveCameraVMD(frames);
foreach (var container in CharaContainerScript)
{
var rootbone = container.transform.Find("Position");
if (rootbone.gameObject.TryGetComponent(out UnityHumanoidVMDRecorder recorder))
{
if (recorder.IsRecording)
{
recorder.StopRecording();
recorder.SaveLiveVMD($"Live{live.MusicId}_Pos{CharaContainerScript.IndexOf(container)}", 1);
}
}
}
}
UmaSceneController.LoadScene("Version2");
UmaAssetManager.UnloadAllBundle(true);
}
}
}