Merge pull request #7 from croakfang/master
Add Eye tracking and victory animation preview support
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
class SelectAllOfTagHash : ScriptableWizard
|
||||||
|
{
|
||||||
|
|
||||||
|
string tagName = "ExampleTag";
|
||||||
|
|
||||||
|
|
||||||
|
[MenuItem("Hash/Get Hash")]
|
||||||
|
static void SelectAllOfTagHashWizard()
|
||||||
|
{
|
||||||
|
ScriptableWizard.DisplayWizard(
|
||||||
|
"Hash/Get Hash",
|
||||||
|
typeof(SelectAllOfTagHash),
|
||||||
|
"Get Hash");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnWizardCreate()
|
||||||
|
{
|
||||||
|
//AssetDatabase.RemoveObjectFromAsset(Selection.objects[0]);
|
||||||
|
//AssetDatabase.CreateAsset(Selection.objects[0], "Assets/"+ Selection.objects[0].name + ".asset");
|
||||||
|
|
||||||
|
UnityEngine.GameObject obj = (GameObject)Selection.activeObject;
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("You must select GameObj first!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string result = "";
|
||||||
|
|
||||||
|
var children = obj.GetComponentsInChildren<Transform>();
|
||||||
|
|
||||||
|
foreach(var selectChild in children)
|
||||||
|
{
|
||||||
|
var tempChild = selectChild;
|
||||||
|
|
||||||
|
if (tempChild != null && tempChild != obj.transform)
|
||||||
|
{
|
||||||
|
result = tempChild.name;
|
||||||
|
while (tempChild.parent != obj.transform && tempChild.parent != null)
|
||||||
|
{
|
||||||
|
tempChild = tempChild.parent;
|
||||||
|
result = string.Format("{0}/{1}", tempChild.name, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Log(string.Format("GameObject:{0}, Hash:{1}", result, (uint)Animator.StringToHash(result)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e3d086c88fee2954d9cee0d1acca0969
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1102 &-1046042063806159501
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: motion_1
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions: []
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400000, guid: ad7fc1d5eece1a946a437cd1bb81bf90, type: 2}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter: animSpeed
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter: animSpeed
|
||||||
|
--- !u!91 &9100000
|
||||||
|
AnimatorController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Camera Controller
|
||||||
|
serializedVersion: 5
|
||||||
|
m_AnimatorParameters:
|
||||||
|
- m_Name: animSpeed
|
||||||
|
m_Type: 1
|
||||||
|
m_DefaultFloat: 1
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: next
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: next_s
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
m_AnimatorLayers:
|
||||||
|
- serializedVersion: 5
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_StateMachine: {fileID: 1917244892325702502}
|
||||||
|
m_Mask: {fileID: 0}
|
||||||
|
m_Motions: []
|
||||||
|
m_Behaviours: []
|
||||||
|
m_BlendingMode: 0
|
||||||
|
m_SyncedLayerIndex: -1
|
||||||
|
m_DefaultWeight: 0
|
||||||
|
m_IKPass: 0
|
||||||
|
m_SyncedLayerAffectsTiming: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
--- !u!1107 &1917244892325702502
|
||||||
|
AnimatorStateMachine:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_ChildStates:
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: -1046042063806159501}
|
||||||
|
m_Position: {x: 260, y: 120, z: 0}
|
||||||
|
m_ChildStateMachines: []
|
||||||
|
m_AnyStateTransitions: []
|
||||||
|
m_EntryTransitions: []
|
||||||
|
m_StateMachineTransitions: {}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||||
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
|
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||||
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
|
m_DefaultState: {fileID: -1046042063806159501}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 31e8857c44e57504abdcd9f9e7f5a041
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 9100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!221 &22100000
|
||||||
|
AnimatorOverrideController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Camera Override Controller
|
||||||
|
m_Controller: {fileID: 9100000, guid: 09aea86c4ae2e9345a1cfb74dd3b27b1, type: 2}
|
||||||
|
m_Clips: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2074a3b49810aed419168eda443b9e1a
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 22100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -81,7 +81,8 @@ AnimatorState:
|
|||||||
m_Name: motion_2
|
m_Name: motion_2
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions: []
|
m_Transitions:
|
||||||
|
- {fileID: 2501757138902606358}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
m_IKOnFeet: 0
|
m_IKOnFeet: 0
|
||||||
@@ -222,6 +223,28 @@ AnimatorStateTransition:
|
|||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 1
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &2501757138902606358
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions: []
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -1569566867637420955}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 1
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &3046527319765726241
|
--- !u!1102 &3046527319765726241
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1101 &-4072449279223152736
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions: []
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -1046042063806159501}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 1
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1102 &-1046042063806159501
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: motion_1
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: -4072449279223152736}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400000, guid: ad7fc1d5eece1a946a437cd1bb81bf90, type: 2}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter: animSpeed
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter: animSpeed
|
||||||
|
--- !u!91 &9100000
|
||||||
|
AnimatorController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Face Controller
|
||||||
|
serializedVersion: 5
|
||||||
|
m_AnimatorParameters:
|
||||||
|
- m_Name: animSpeed
|
||||||
|
m_Type: 1
|
||||||
|
m_DefaultFloat: 1
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: next
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
- m_Name: next_s
|
||||||
|
m_Type: 9
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
m_AnimatorLayers:
|
||||||
|
- serializedVersion: 5
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_StateMachine: {fileID: 1917244892325702502}
|
||||||
|
m_Mask: {fileID: 0}
|
||||||
|
m_Motions: []
|
||||||
|
m_Behaviours: []
|
||||||
|
m_BlendingMode: 0
|
||||||
|
m_SyncedLayerIndex: -1
|
||||||
|
m_DefaultWeight: 0
|
||||||
|
m_IKPass: 0
|
||||||
|
m_SyncedLayerAffectsTiming: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
--- !u!1107 &1917244892325702502
|
||||||
|
AnimatorStateMachine:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_ChildStates:
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: -1046042063806159501}
|
||||||
|
m_Position: {x: 310, y: 130, z: 0}
|
||||||
|
m_ChildStateMachines: []
|
||||||
|
m_AnyStateTransitions: []
|
||||||
|
m_EntryTransitions: []
|
||||||
|
m_StateMachineTransitions: {}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||||
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
|
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||||
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
|
m_DefaultState: {fileID: -1046042063806159501}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 09aea86c4ae2e9345a1cfb74dd3b27b1
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 9100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!221 &22100000
|
||||||
|
AnimatorOverrideController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Face Override Controller
|
||||||
|
m_Controller: {fileID: 9100000, guid: 09aea86c4ae2e9345a1cfb74dd3b27b1, type: 2}
|
||||||
|
m_Clips: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21f82840716293147bcb9f4bfb58cc99
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 22100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -7,7 +7,7 @@ AnimationClip:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: clip_2
|
m_Name: clip_2
|
||||||
serializedVersion: 7
|
serializedVersion: 6
|
||||||
m_Legacy: 0
|
m_Legacy: 0
|
||||||
m_Compressed: 0
|
m_Compressed: 0
|
||||||
m_UseHighQualityCurve: 1
|
m_UseHighQualityCurve: 1
|
||||||
|
|||||||
+4769
-724
File diff suppressed because it is too large
Load Diff
@@ -82,25 +82,10 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
|
|
||||||
if (AAMode != AAModeDropdown.value)
|
if (AAMode != AAModeDropdown.value)
|
||||||
{
|
{
|
||||||
var postprocessLayer = Camera.main.GetComponent<PostProcessLayer>();
|
var postprocessLayerMain = Camera.main.GetComponent<PostProcessLayer>();
|
||||||
switch (AAModeDropdown.value) //new
|
var postprocessLayerPreview = UmaViewerBuilder.Instance.PreviewCamera.GetComponent<PostProcessLayer>();
|
||||||
{
|
postprocessLayerMain.antialiasingMode = postprocessLayerPreview.antialiasingMode = (PostProcessLayer.Antialiasing)AAModeDropdown.value;
|
||||||
case 0:
|
Debug.Log($"Switched AntiAliasing to {(PostProcessLayer.Antialiasing)AAModeDropdown.value}");
|
||||||
postprocessLayer.antialiasingMode = PostProcessLayer.Antialiasing.None;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
postprocessLayer.antialiasingMode = PostProcessLayer.Antialiasing.FastApproximateAntialiasing;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
postprocessLayer.antialiasingMode = PostProcessLayer.Antialiasing.SubpixelMorphologicalAntialiasing;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
postprocessLayer.antialiasingMode = PostProcessLayer.Antialiasing.TemporalAntialiasing;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
postprocessLayer.antialiasingMode = PostProcessLayer.Antialiasing.None;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
AAMode = AAModeDropdown.value;
|
AAMode = AAModeDropdown.value;
|
||||||
}
|
}
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ public class Screenshot : MonoBehaviour
|
|||||||
|
|
||||||
public static void TakeScreenshot()
|
public static void TakeScreenshot()
|
||||||
{
|
{
|
||||||
|
var camera = UmaViewerBuilder.Instance.PreviewCamera.enabled ? UmaViewerBuilder.Instance.PreviewCamera : Camera.main;
|
||||||
int width = int.Parse(UmaViewerUI.Instance.SSWidth.text);
|
int width = int.Parse(UmaViewerUI.Instance.SSWidth.text);
|
||||||
int height = int.Parse(UmaViewerUI.Instance.SSHeight.text);
|
int height = int.Parse(UmaViewerUI.Instance.SSHeight.text);
|
||||||
width = width == -1 ? Screen.width : width;
|
width = width == -1 ? Screen.width : width;
|
||||||
height = height == -1 ? Screen.height : height;
|
height = height == -1 ? Screen.height : height;
|
||||||
var image = GrabFrame(width, height, UmaViewerUI.Instance.SSTransparent.isOn);
|
var image = GrabFrame(camera, width, height, UmaViewerUI.Instance.SSTransparent.isOn);
|
||||||
|
|
||||||
string fileName = Application.dataPath + "/../Screenshots/" + string.Format("UmaViewer_{0}", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff"));
|
string fileName = Application.dataPath + "/../Screenshots/" + string.Format("UmaViewer_{0}", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-fff"));
|
||||||
byte[] pngShot = ImageConversion.EncodeToPNG(image);
|
byte[] pngShot = ImageConversion.EncodeToPNG(image);
|
||||||
@@ -39,13 +40,14 @@ public class Screenshot : MonoBehaviour
|
|||||||
recording = true;
|
recording = true;
|
||||||
UmaViewerUI.Instance.GifButton.interactable = false;
|
UmaViewerUI.Instance.GifButton.interactable = false;
|
||||||
UmaViewerUI.Instance.GifSlider.value = 0;
|
UmaViewerUI.Instance.GifSlider.value = 0;
|
||||||
StartCoroutine(RecordGif(int.Parse(UmaViewerUI.Instance.GifWidth.text), int.Parse(UmaViewerUI.Instance.GifHeight.text), UmaViewerUI.Instance.GifTransparent.isOn, (int)UmaViewerUI.Instance.GifQuality.value));
|
StartCoroutine(RecordGif(int.Parse(UmaViewerUI.Instance.GifWidth.text), int.Parse(UmaViewerUI.Instance.GifHeight.text), UmaViewerUI.Instance.GifTransparent.isOn, 10)); //(int)UmaViewerUI.Instance.GifQuality.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IEnumerator RecordGif(int width, int height, bool transparent, int quality)
|
private IEnumerator RecordGif(int width, int height, bool transparent, int quality)
|
||||||
{
|
{
|
||||||
var ppLayer = Camera.main.GetComponent<PostProcessLayer>();
|
var camera = UmaViewerBuilder.Instance.PreviewCamera.enabled ? UmaViewerBuilder.Instance.PreviewCamera : Camera.main;
|
||||||
|
var ppLayer = camera.GetComponent<PostProcessLayer>();
|
||||||
bool oldPpState = ppLayer.enabled;
|
bool oldPpState = ppLayer.enabled;
|
||||||
ppLayer.enabled = false;
|
ppLayer.enabled = false;
|
||||||
|
|
||||||
@@ -58,36 +60,36 @@ public class Screenshot : MonoBehaviour
|
|||||||
var clipFrameCount = Mathf.RoundToInt(animeClip.length * animeClip.frameRate);
|
var clipFrameCount = Mathf.RoundToInt(animeClip.length * animeClip.frameRate);
|
||||||
StartCoroutine(CaptureToGIFCustom.Instance.Encode(animeClip.frameRate, quality));
|
StartCoroutine(CaptureToGIFCustom.Instance.Encode(animeClip.frameRate, quality));
|
||||||
|
|
||||||
animator.speed = 0;
|
UmaViewerUI.Instance.AnimationSpeedChange(0);
|
||||||
animator.Play(0, -1, 0);
|
UmaViewerUI.Instance.AnimationProgressChange(0);
|
||||||
yield return new WaitForSeconds(1); //wait for dynamicBone to settle;
|
yield return new WaitForSeconds(1); //wait for dynamicBone to settle;
|
||||||
|
|
||||||
while (frame < clipFrameCount)
|
while (frame < clipFrameCount)
|
||||||
{
|
{
|
||||||
UmaViewerUI.Instance.GifSlider.value = (float)frame / clipFrameCount;
|
UmaViewerUI.Instance.GifSlider.value = (float)frame / clipFrameCount;
|
||||||
animator.Play(0, -1, (float)frame/clipFrameCount);
|
UmaViewerUI.Instance.AnimationProgressChange((float)frame / clipFrameCount);
|
||||||
yield return new WaitForEndOfFrame();
|
yield return new WaitForEndOfFrame();
|
||||||
var tex = GrabFrame(width, height, transparent, transparent);
|
var tex = GrabFrame(camera, width, height, transparent, transparent);
|
||||||
CaptureToGIFCustom.Instance.Frames.Add(new Image(tex));
|
CaptureToGIFCustom.Instance.Frames.Add(new Image(tex));
|
||||||
Destroy(tex);
|
Destroy(tex);
|
||||||
frame++;
|
frame++;
|
||||||
}
|
}
|
||||||
|
|
||||||
recording = false;
|
recording = false;
|
||||||
animator.speed = 1;
|
UmaViewerUI.Instance.AnimationProgressChange(0);
|
||||||
|
UmaViewerUI.Instance.AnimationSpeedChange(1);
|
||||||
ppLayer.enabled = oldPpState;
|
ppLayer.enabled = oldPpState;
|
||||||
CaptureToGIFCustom.Instance.stop = true;
|
CaptureToGIFCustom.Instance.stop = true;
|
||||||
UmaViewerUI.Instance.GifButton.interactable = true;
|
UmaViewerUI.Instance.GifButton.interactable = true;
|
||||||
UmaViewerUI.Instance.GifSlider.value = 1;
|
UmaViewerUI.Instance.GifSlider.value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture2D GrabFrame(int width, int height, bool transparent = true, bool gifBackground = false)
|
public static Texture2D GrabFrame(Camera cam, int width, int height, bool transparent = true, bool gifBackground = false)
|
||||||
{
|
{
|
||||||
var dimensions = GetResolution(width, height);
|
var dimensions = GetResolution(width, height);
|
||||||
width = dimensions.x;
|
width = dimensions.x;
|
||||||
height = dimensions.y;
|
height = dimensions.y;
|
||||||
|
|
||||||
Camera cam = Camera.main;
|
|
||||||
int oldMask = cam.cullingMask;
|
int oldMask = cam.cullingMask;
|
||||||
var oldClearFlags = cam.clearFlags;
|
var oldClearFlags = cam.clearFlags;
|
||||||
Color oldBG = cam.backgroundColor;
|
Color oldBG = cam.backgroundColor;
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class UmaContainer : MonoBehaviour
|
public class UmaContainer : MonoBehaviour
|
||||||
{
|
{
|
||||||
UmaViewerUI UI => UmaViewerUI.Instance;
|
|
||||||
|
|
||||||
public JObject CharaData;
|
public JObject CharaData;
|
||||||
public GameObject Body;
|
public GameObject Body;
|
||||||
public GameObject Tail;
|
public GameObject Tail;
|
||||||
@@ -19,9 +17,17 @@ public class UmaContainer : MonoBehaviour
|
|||||||
public Animator UmaAnimator;
|
public Animator UmaAnimator;
|
||||||
public AnimatorOverrideController OverrideController;
|
public AnimatorOverrideController OverrideController;
|
||||||
|
|
||||||
|
public bool isAnimatorControl;
|
||||||
|
public Animator UmaFaceAnimator;
|
||||||
|
public AnimatorOverrideController FaceOverrideController;
|
||||||
|
|
||||||
[Header("Face")]
|
[Header("Face")]
|
||||||
public FaceDrivenKeyTarget FaceDrivenKeyTarget;
|
public FaceDrivenKeyTarget FaceDrivenKeyTarget;
|
||||||
public FaceEmotionKeyTarget FaceEmotionKeyTarget;
|
public FaceEmotionKeyTarget FaceEmotionKeyTarget;
|
||||||
|
public GameObject HeadBone;
|
||||||
|
public GameObject TrackTarget;
|
||||||
|
public float EyeHeight;
|
||||||
|
public bool EnableEyeTracking = true;
|
||||||
|
|
||||||
[Header("Generic")]
|
[Header("Generic")]
|
||||||
public bool IsGeneric = false;
|
public bool IsGeneric = false;
|
||||||
@@ -35,6 +41,9 @@ public class UmaContainer : MonoBehaviour
|
|||||||
public void MergeModel()
|
public void MergeModel()
|
||||||
{
|
{
|
||||||
if (!Body) return;
|
if (!Body) return;
|
||||||
|
EyeHeight = 0.1f;
|
||||||
|
TrackTarget = Camera.main.gameObject;
|
||||||
|
|
||||||
List<Transform> bodybones = new List<Transform>(Body.GetComponentInChildren<SkinnedMeshRenderer>().bones);
|
List<Transform> bodybones = new List<Transform>(Body.GetComponentInChildren<SkinnedMeshRenderer>().bones);
|
||||||
List<Transform> emptyBones = new List<Transform>();
|
List<Transform> emptyBones = new List<Transform>();
|
||||||
emptyBones.Add(Body.GetComponentInChildren<SkinnedMeshRenderer>().rootBone.Find("Tail_Ctrl"));
|
emptyBones.Add(Body.GetComponentInChildren<SkinnedMeshRenderer>().rootBone.Find("Tail_Ctrl"));
|
||||||
@@ -82,7 +91,8 @@ public class UmaContainer : MonoBehaviour
|
|||||||
//MergeAvatar
|
//MergeAvatar
|
||||||
UmaAnimator = gameObject.AddComponent<Animator>();
|
UmaAnimator = gameObject.AddComponent<Animator>();
|
||||||
UmaAnimator.avatar = AvatarBuilder.BuildGenericAvatar(gameObject, gameObject.name);
|
UmaAnimator.avatar = AvatarBuilder.BuildGenericAvatar(gameObject, gameObject.name);
|
||||||
UmaAnimator.runtimeAnimatorController = OverrideController = Instantiate(UmaViewerBuilder.Instance.OverrideController);
|
OverrideController = Instantiate(UmaViewerBuilder.Instance.OverrideController);
|
||||||
|
UmaAnimator.runtimeAnimatorController = OverrideController;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,4 +134,23 @@ public class UmaContainer : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
if (TrackTarget&& EnableEyeTracking && !IsMini)
|
||||||
|
{
|
||||||
|
var targetPosotion = TrackTarget.transform.position - HeadBone.transform.up*EyeHeight;
|
||||||
|
var deltaPos = HeadBone.transform.InverseTransformPoint(targetPosotion);
|
||||||
|
var deltaRotation = Quaternion.LookRotation(deltaPos.normalized, HeadBone.transform.up).eulerAngles;
|
||||||
|
if (deltaRotation.x > 180) deltaRotation.x -= 360;
|
||||||
|
if (deltaRotation.y > 180) deltaRotation.y -= 360;
|
||||||
|
|
||||||
|
var finalRotation = new Vector2(Mathf.Clamp(deltaRotation.y / 35,-1,1), Mathf.Clamp(-deltaRotation.x / 25, -1, 1));//Limited to the angle of view
|
||||||
|
FaceDrivenKeyTarget.SetEyeRange(finalRotation.x, finalRotation.y, finalRotation.x, -finalRotation.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAnimatorControl && !IsMini)
|
||||||
|
{
|
||||||
|
FaceDrivenKeyTarget.ProcessLocator();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
||||||
|
|
||||||
public AnimatorOverrideController OverrideController;
|
public AnimatorOverrideController OverrideController;
|
||||||
|
public AnimatorOverrideController FaceOverrideController;
|
||||||
|
public AnimatorOverrideController CameraOverrideController;
|
||||||
|
public Animator PreviewCameraAnimator;
|
||||||
|
public Camera PreviewCamera;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@@ -167,7 +170,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbList.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/clothes")))
|
foreach (var asset1 in UmaViewerMain.Instance.AbList.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/clothes")))
|
||||||
{
|
{
|
||||||
if (asset1.Name.Contains("cloth00"))
|
if (asset1.Name.Contains("cloth04"))
|
||||||
RecursiveLoadAsset(asset1);
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,18 +276,23 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
var firsehead = CurrentUMAContainer.Head;
|
var firsehead = CurrentUMAContainer.Head;
|
||||||
var FaceDriven = firsehead.GetComponent<AssetHolder>()._assetTable.list.Find(a => { return a.Key == "facial_target"; }).Value as FaceDrivenKeyTarget;
|
var FaceDriven = firsehead.GetComponent<AssetHolder>()._assetTable.list.Find(a => { return a.Key == "facial_target"; }).Value as FaceDrivenKeyTarget;
|
||||||
|
var EarDriven = firsehead.GetComponent<AssetHolder>()._assetTable.list.Find(a => { return a.Key == "ear_target"; }).Value as DrivenKeyTarget;
|
||||||
|
FaceDriven._earTarget = EarDriven._targetFaces;
|
||||||
CurrentUMAContainer.FaceDrivenKeyTarget = FaceDriven;
|
CurrentUMAContainer.FaceDrivenKeyTarget = FaceDriven;
|
||||||
CurrentUMAContainer.FaceDrivenKeyTarget.Container = CurrentUMAContainer;
|
CurrentUMAContainer.FaceDrivenKeyTarget.Container = CurrentUMAContainer;
|
||||||
FaceDriven.Initialize(firsehead.GetComponentsInChildren<Transform>().ToList());
|
FaceDriven.Initialize(firsehead.GetComponentsInChildren<Transform>().ToList());
|
||||||
|
|
||||||
CurrentUMAContainer.FaceEmotionKeyTarget = new FaceEmotionKeyTarget()
|
var emotionDriven = ScriptableObject.CreateInstance<FaceEmotionKeyTarget>();
|
||||||
{
|
emotionDriven.name = $"char{id}_{costumeId}_emotion_target";
|
||||||
FaceDrivenKeyTarget = FaceDriven,
|
CurrentUMAContainer.FaceEmotionKeyTarget = emotionDriven;
|
||||||
FaceEmotionKey = UmaDatabaseController.Instance.FaceTypeData.ToList()
|
emotionDriven.FaceDrivenKeyTarget = FaceDriven;
|
||||||
};
|
emotionDriven.FaceEmotionKey = UmaDatabaseController.Instance.FaceTypeData.ToList();
|
||||||
CurrentUMAContainer.FaceEmotionKeyTarget.Initialize();
|
emotionDriven.Initialize();
|
||||||
|
|
||||||
|
CurrentUMAContainer.HeadBone = (GameObject)CurrentUMAContainer.Body.GetComponent<AssetHolder>()._assetTable.list.FindLast(a => a.Key == "head").Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CurrentUMAContainer.MergeModel();
|
CurrentUMAContainer.MergeModel();
|
||||||
CurrentUMAContainer.LoadPhysics();
|
CurrentUMAContainer.LoadPhysics();
|
||||||
LoadAsset(UmaViewerMain.Instance.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{id}_00_idle01_loop")));
|
LoadAsset(UmaViewerMain.Instance.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{id}_00_idle01_loop")));
|
||||||
@@ -950,20 +958,65 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
|
|
||||||
CurrentUMAContainer.UmaAnimator.Play("motion_1", -1);
|
CurrentUMAContainer.UmaAnimator.Play("motion_1", -1);
|
||||||
CurrentUMAContainer.UmaAnimator.SetTrigger(needTransit ? "next_s" : "next");
|
CurrentUMAContainer.UmaAnimator.SetTrigger(needTransit ? "next_s" : "next");
|
||||||
|
|
||||||
|
CurrentUMAContainer.isAnimatorControl = false;
|
||||||
|
CurrentUMAContainer.TrackTarget = Camera.main.gameObject;
|
||||||
|
}
|
||||||
|
else if (clip.name.Contains("face"))
|
||||||
|
{
|
||||||
|
if (CurrentUMAContainer.IsMini) return;
|
||||||
|
|
||||||
|
CurrentUMAContainer.FaceDrivenKeyTarget.ResetLocator();
|
||||||
|
CurrentUMAContainer.FaceOverrideController["clip_1"] = clip;
|
||||||
|
CurrentUMAContainer.isAnimatorControl = true;
|
||||||
|
CurrentUMAContainer.UmaFaceAnimator.Play("motion_1", 0, 0);
|
||||||
|
}
|
||||||
|
else if (clip.name.Contains("cam"))
|
||||||
|
{
|
||||||
|
var overrideController = Instantiate(CameraOverrideController);
|
||||||
|
overrideController["clip_1"] = clip;
|
||||||
|
SetPreviewCamera(overrideController);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CurrentUMAContainer.UmaAnimator.Rebind();
|
||||||
CurrentUMAContainer.OverrideController["clip_1"] = CurrentUMAContainer.OverrideController["clip_2"];
|
CurrentUMAContainer.OverrideController["clip_1"] = CurrentUMAContainer.OverrideController["clip_2"];
|
||||||
var lastTime = CurrentUMAContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime;
|
var lastTime = CurrentUMAContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime;
|
||||||
CurrentUMAContainer.OverrideController["clip_2"] = clip;
|
CurrentUMAContainer.OverrideController["clip_2"] = clip;
|
||||||
|
|
||||||
// If Cut-in, play immediately without state interpolation
|
// If Cut-in, play immediately without state interpolation
|
||||||
if (clip.name.Contains("crd"))
|
if (clip.name.Contains("crd") || clip.name.Contains("res_chr"))
|
||||||
{
|
{
|
||||||
|
var facialMotion = Main.AbMotions.FirstOrDefault(a => a.Name.EndsWith(clip.name + "_face"));
|
||||||
|
var cameraMotion = Main.AbMotions.FirstOrDefault(a => a.Name.EndsWith(clip.name + "_cam"));
|
||||||
|
|
||||||
|
if (facialMotion != null)
|
||||||
|
{
|
||||||
|
RecursiveLoadAsset(facialMotion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraMotion != null)
|
||||||
|
{
|
||||||
|
RecursiveLoadAsset(cameraMotion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CurrentUMAContainer.IsMini)
|
||||||
|
{
|
||||||
|
SetPreviewCamera(null);
|
||||||
|
}
|
||||||
CurrentUMAContainer.UmaAnimator.Play("motion_2", 0, 0);
|
CurrentUMAContainer.UmaAnimator.Play("motion_2", 0, 0);
|
||||||
|
CurrentUMAContainer.OverrideController["clip_2"].wrapMode = WrapMode.Loop;
|
||||||
|
CurrentUMAContainer.TrackTarget = PreviewCamera.gameObject;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (CurrentUMAContainer.FaceDrivenKeyTarget)
|
||||||
|
{
|
||||||
|
CurrentUMAContainer.FaceDrivenKeyTarget.ResetLocator();
|
||||||
|
}
|
||||||
|
CurrentUMAContainer.isAnimatorControl = false;
|
||||||
|
CurrentUMAContainer.TrackTarget = Camera.main.gameObject;
|
||||||
|
SetPreviewCamera(null);
|
||||||
|
|
||||||
CurrentUMAContainer.UmaAnimator.Play("motion_1", 0, lastTime);
|
CurrentUMAContainer.UmaAnimator.Play("motion_1", 0, lastTime);
|
||||||
CurrentUMAContainer.UmaAnimator.SetTrigger(needTransit ? "next_s" : "next");
|
CurrentUMAContainer.UmaAnimator.SetTrigger(needTransit ? "next_s" : "next");
|
||||||
}
|
}
|
||||||
@@ -971,6 +1024,20 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void SetPreviewCamera(RuntimeAnimatorController controller)
|
||||||
|
{
|
||||||
|
if (controller)
|
||||||
|
{
|
||||||
|
PreviewCameraAnimator.runtimeAnimatorController = controller;
|
||||||
|
PreviewCamera.enabled = true;
|
||||||
|
PreviewCameraAnimator.Play("motion_1", 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PreviewCameraAnimator.runtimeAnimatorController = null;
|
||||||
|
PreviewCamera.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
|
private void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
|
||||||
{
|
{
|
||||||
@@ -1043,7 +1110,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
Destroy(CurrentUMAContainer.gameObject);
|
Destroy(CurrentUMAContainer.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearMorphs()
|
public void ClearMorphs()
|
||||||
{
|
{
|
||||||
if (CurrentUMAContainer != null && CurrentUMAContainer.FaceDrivenKeyTarget != null)
|
if (CurrentUMAContainer != null && CurrentUMAContainer.FaceDrivenKeyTarget != null)
|
||||||
@@ -1058,8 +1124,19 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
if (container.Slider != null)
|
if (container.Slider != null)
|
||||||
container.Slider.SetValueWithoutNotify(0);
|
container.Slider.SetValueWithoutNotify(0);
|
||||||
}
|
}
|
||||||
CurrentUMAContainer.FaceDrivenKeyTarget.ClearMorph();
|
if (CurrentUMAContainer.FaceDrivenKeyTarget)
|
||||||
CurrentUMAContainer.FaceDrivenKeyTarget.ChangeMorph();
|
{
|
||||||
|
CurrentUMAContainer.FaceDrivenKeyTarget.ClearMorph();
|
||||||
|
CurrentUMAContainer.FaceDrivenKeyTarget.ChangeMorph();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
if (PreviewCamera&&PreviewCamera.enabled == true)
|
||||||
|
{
|
||||||
|
PreviewCamera.fieldOfView = PreviewCamera.gameObject.transform.parent.transform.localScale.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+122
-10
@@ -33,7 +33,11 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public ScrollRect SceneList;
|
public ScrollRect SceneList;
|
||||||
|
|
||||||
public ScrollRect EmotionList;
|
public ScrollRect EmotionList;
|
||||||
public ScrollRect FacialList;
|
public Transform FacialList;
|
||||||
|
public ScrollRect EarList;
|
||||||
|
public ScrollRect EyeBrowList;
|
||||||
|
public ScrollRect EyeList;
|
||||||
|
public ScrollRect MouthList;
|
||||||
public ScrollRect LiveList;
|
public ScrollRect LiveList;
|
||||||
public ScrollRect LiveSoundList;
|
public ScrollRect LiveSoundList;
|
||||||
public ScrollRect LiveCharaSoundList;
|
public ScrollRect LiveCharaSoundList;
|
||||||
@@ -66,6 +70,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public Slider GifSlider;
|
public Slider GifSlider;
|
||||||
public Button GifButton;
|
public Button GifButton;
|
||||||
public List<GameObject> TogglablePanels = new List<GameObject>();
|
public List<GameObject> TogglablePanels = new List<GameObject>();
|
||||||
|
public List<GameObject> TogglableFacials = new List<GameObject>();
|
||||||
|
|
||||||
public GameObject UmaContainerPrefab;
|
public GameObject UmaContainerPrefab;
|
||||||
public GameObject UmaContainerSliderPrefab;
|
public GameObject UmaContainerSliderPrefab;
|
||||||
@@ -159,13 +164,21 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public void LoadModelPanels()
|
public void LoadModelPanels()
|
||||||
{
|
{
|
||||||
var container = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
|
var container = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||||
container.Name.text = container.name = "type00";
|
container.Name.text = container.name = "Generic";
|
||||||
var imageInstance = container.GetComponent<Image>();
|
var imageInstance = container.GetComponent<Image>();
|
||||||
container.Button.onClick.AddListener(() => {
|
container.Button.onClick.AddListener(() => {
|
||||||
HighlightChildImage(AnimationSetList.content, imageInstance);
|
HighlightChildImage(AnimationSetList.content, imageInstance);
|
||||||
ListAnimations(-1, false);
|
ListAnimations(-1, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
container = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||||
|
container.Name.text = container.name = "Tail";
|
||||||
|
imageInstance = container.GetComponent<Image>();
|
||||||
|
container.Button.onClick.AddListener(() => {
|
||||||
|
HighlightChildImage(AnimationSetList.content, imageInstance);
|
||||||
|
ListAnimations(-2, false);
|
||||||
|
});
|
||||||
|
|
||||||
foreach (var chara in Main.Characters.OrderBy(c => c.Id))
|
foreach (var chara in Main.Characters.OrderBy(c => c.Id))
|
||||||
{
|
{
|
||||||
var charaInstance = chara;
|
var charaInstance = chara;
|
||||||
@@ -200,17 +213,38 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InstantiateFacialPart(GameObject UmaContainerSliderPrefab, FaceDrivenKeyTarget target, List<FacialMorph> targetMorph, ScrollRect TargetList)
|
||||||
|
{
|
||||||
|
foreach (FacialMorph morph in targetMorph)
|
||||||
|
{
|
||||||
|
var container = Instantiate(UmaContainerSliderPrefab, TargetList.content).GetComponent<UmaUIContainer>();
|
||||||
|
container.Name.text = morph.name + " (" + morph.tag + ")";
|
||||||
|
container.Slider.value = morph.weight;
|
||||||
|
container.Slider.maxValue = 1;
|
||||||
|
container.Slider.minValue = 0;
|
||||||
|
container.Slider.onValueChanged.AddListener((a) => { target.ChangeMorphWeight(morph, a); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadFacialPanels(FaceDrivenKeyTarget target)
|
public void LoadFacialPanels(FaceDrivenKeyTarget target)
|
||||||
{
|
{
|
||||||
currentFaceDrivenKeyTarget = target;
|
currentFaceDrivenKeyTarget = target;
|
||||||
|
|
||||||
foreach (UmaUIContainer ui in FacialList.content.GetComponentsInChildren<UmaUIContainer>())
|
foreach (UmaUIContainer ui in FacialList.GetComponentsInChildren<UmaUIContainer>())
|
||||||
{
|
{
|
||||||
Destroy(ui.gameObject);
|
Destroy(ui.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == null) return;
|
if (target == null) return;
|
||||||
|
|
||||||
|
InstantiateFacialPart(UmaContainerSliderPrefab, target, target.EarMorphs, EarList);
|
||||||
|
InstantiateFacialPart(UmaContainerSliderPrefab, target, target.EyeBrowMorphs, EyeBrowList);
|
||||||
|
InstantiateFacialPart(UmaContainerSliderPrefab, target, target.EyeMorphs, EyeList);
|
||||||
|
InstantiateFacialPart(UmaContainerSliderPrefab, target, target.MouthMorphs, MouthList);
|
||||||
|
|
||||||
|
/*
|
||||||
List<FacialMorph> tempMorph = new List<FacialMorph>();
|
List<FacialMorph> tempMorph = new List<FacialMorph>();
|
||||||
|
tempMorph.AddRange(target.EarMorphs);
|
||||||
tempMorph.AddRange(target.EyeBrowMorphs);
|
tempMorph.AddRange(target.EyeBrowMorphs);
|
||||||
tempMorph.AddRange(target.EyeMorphs);
|
tempMorph.AddRange(target.EyeMorphs);
|
||||||
tempMorph.AddRange(target.MouthMorphs);
|
tempMorph.AddRange(target.MouthMorphs);
|
||||||
@@ -221,8 +255,9 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
container.Slider.value = morph.weight;
|
container.Slider.value = morph.weight;
|
||||||
container.Slider.maxValue = 1;
|
container.Slider.maxValue = 1;
|
||||||
container.Slider.minValue = 0;
|
container.Slider.minValue = 0;
|
||||||
container.Slider.onValueChanged.AddListener((a) => { target.ChangeMorphWeight(morph, a); });
|
container.Slider.onValueChanged.AddListener((a) => {target.ChangeMorphWeight(morph, a);});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateFacialPanels()
|
public void UpdateFacialPanels()
|
||||||
@@ -250,7 +285,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
container.Slider.value = emotion.Weight;
|
container.Slider.value = emotion.Weight;
|
||||||
container.Slider.maxValue = 1;
|
container.Slider.maxValue = 1;
|
||||||
container.Slider.minValue = 0;
|
container.Slider.minValue = 0;
|
||||||
container.Slider.onValueChanged.AddListener((a) => { emotion.Weight = a; });
|
container.Slider.onValueChanged.AddListener((a) => { target.ChangeEmotionWeight(emotion, a); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +315,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public void LoadMiniModelPanels()
|
public void LoadMiniModelPanels()
|
||||||
{
|
{
|
||||||
var container = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
|
var container = Instantiate(UmaContainerPrefab, MiniAnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||||
container.Name.text = container.name = "type00";
|
container.Name.text = container.name = "General";
|
||||||
var imageInstance = container.GetComponent<Image>();
|
var imageInstance = container.GetComponent<Image>();
|
||||||
container.Button.onClick.AddListener(() => {
|
container.Button.onClick.AddListener(() => {
|
||||||
HighlightChildImage(MiniAnimationSetList.content, imageInstance);
|
HighlightChildImage(MiniAnimationSetList.content, imageInstance);
|
||||||
@@ -495,7 +530,21 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
|
|
||||||
if (umaId == -1)
|
if (umaId == -1)
|
||||||
{
|
{
|
||||||
foreach (var entry in filteredList.Where(a=> a.Name.Contains($"/type00")))
|
foreach (var entry in filteredList.Where(a=> a.Name.Contains($"/type00") && !a.Name.Contains($"/tail")))
|
||||||
|
{
|
||||||
|
var entryInstance = entry;
|
||||||
|
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
|
||||||
|
container.Name.text = container.name = Path.GetFileName(entry.Name);
|
||||||
|
container.Button.onClick.AddListener(() => {
|
||||||
|
HighlightChildImage(animationList.content, container.GetComponent<Image>());
|
||||||
|
Builder.LoadAsset(entryInstance);
|
||||||
|
LoadedAnimation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(umaId == -2)
|
||||||
|
{
|
||||||
|
foreach (var entry in filteredList.Where(a => a.Name.Contains($"/tail")))
|
||||||
{
|
{
|
||||||
var entryInstance = entry;
|
var entryInstance = entry;
|
||||||
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
|
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
|
||||||
@@ -510,7 +559,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Common animations
|
//Common animations
|
||||||
foreach (var entry in filteredList.Where(a => a.Name.Contains($"chara/chr{umaId}")))
|
foreach (var entry in filteredList.Where(a => a.Name.Contains($"chara/chr{umaId}") && !a.Name.Contains("pose")))
|
||||||
{
|
{
|
||||||
var entryInstance = entry;
|
var entryInstance = entry;
|
||||||
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
|
var container = Instantiate(UmaContainerPrefab, animationList.content).GetComponent<UmaUIContainer>();
|
||||||
@@ -543,6 +592,8 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
AnimationSlider.SetValueWithoutNotify(0);
|
AnimationSlider.SetValueWithoutNotify(0);
|
||||||
// Reset settings by Panel
|
// Reset settings by Panel
|
||||||
Builder.CurrentUMAContainer.UmaAnimator.speed = AnimationSpeedSlider.value;
|
Builder.CurrentUMAContainer.UmaAnimator.speed = AnimationSpeedSlider.value;
|
||||||
|
if(Builder.CurrentUMAContainer.UmaFaceAnimator)
|
||||||
|
Builder.CurrentUMAContainer.UmaFaceAnimator.speed = AnimationSpeedSlider.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Toggles one object ON and all others from UI.TogglablePanels list OFF </summary>
|
/// <summary> Toggles one object ON and all others from UI.TogglablePanels list OFF </summary>
|
||||||
@@ -560,6 +611,20 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleUIFacial(GameObject go)
|
||||||
|
{
|
||||||
|
if (go.activeSelf || !TogglableFacials.Contains(go))
|
||||||
|
{
|
||||||
|
go.SetActive(!go.activeSelf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var panel in TogglableFacials)
|
||||||
|
{
|
||||||
|
panel.SetActive(panel == go);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeBackground(int index)
|
public void ChangeBackground(int index)
|
||||||
{
|
{
|
||||||
if(index == 0)
|
if(index == 0)
|
||||||
@@ -588,6 +653,25 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetEarMorphEnable(bool isOn)
|
||||||
|
{
|
||||||
|
if (Builder.CurrentUMAContainer)
|
||||||
|
{
|
||||||
|
foreach (CySpringDataContainer cySpring in Builder.CurrentUMAContainer.GetComponentsInChildren<CySpringDataContainer>())
|
||||||
|
{
|
||||||
|
cySpring.EnableEarPhysics(!isOn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEyeTrackingEnable(bool isOn)
|
||||||
|
{
|
||||||
|
if (Builder.CurrentUMAContainer)
|
||||||
|
{
|
||||||
|
Builder.CurrentUMAContainer.EnableEyeTracking = isOn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearCache()
|
public void ClearCache()
|
||||||
{
|
{
|
||||||
PlayerPrefs.DeleteAll();
|
PlayerPrefs.DeleteAll();
|
||||||
@@ -622,7 +706,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (Builder.CurrentAudioSources.Count>0)
|
if (Builder.CurrentAudioSources.Count>0)
|
||||||
{
|
{
|
||||||
AudioSource MiaiSource = Builder.CurrentAudioSources[0];
|
|
||||||
foreach (AudioSource source in Builder.CurrentAudioSources)
|
foreach (AudioSource source in Builder.CurrentAudioSources)
|
||||||
{
|
{
|
||||||
if (source.clip)
|
if (source.clip)
|
||||||
@@ -639,20 +722,35 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
if (Builder.OverrideController.animationClips.Length > 0)
|
if (Builder.OverrideController.animationClips.Length > 0)
|
||||||
{
|
{
|
||||||
var animator = Builder.CurrentUMAContainer.UmaAnimator;
|
var animator = Builder.CurrentUMAContainer.UmaAnimator;
|
||||||
|
var animator_face = Builder.CurrentUMAContainer.UmaFaceAnimator;
|
||||||
|
var animator_cam = Builder.PreviewCameraAnimator;
|
||||||
var AnimeState = animator.GetCurrentAnimatorStateInfo(0);
|
var AnimeState = animator.GetCurrentAnimatorStateInfo(0);
|
||||||
var state = animator.speed > 0f;
|
var state = animator.speed > 0f;
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
animator.speed = 0;
|
animator.speed = 0;
|
||||||
|
if (animator_face)
|
||||||
|
animator_face.speed = 0;
|
||||||
|
animator_cam.speed = 0;
|
||||||
}
|
}
|
||||||
else if (AnimeState.normalizedTime < 1f)
|
else if (AnimeState.normalizedTime < 1f)
|
||||||
{
|
{
|
||||||
animator.speed = AnimationSpeedSlider.value;
|
animator.speed = AnimationSpeedSlider.value;
|
||||||
|
animator_cam.speed = AnimationSpeedSlider.value;
|
||||||
|
if (animator_face)
|
||||||
|
animator_face.speed = AnimationSpeedSlider.value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
animator.speed = AnimationSpeedSlider.value;
|
animator.speed = AnimationSpeedSlider.value;
|
||||||
animator.Play(0, -1, 0);
|
animator.Play(0, -1, 0);
|
||||||
|
animator_cam.speed = AnimationSpeedSlider.value;
|
||||||
|
animator_cam.Play(0, -1, 0);
|
||||||
|
if (animator_face)
|
||||||
|
{
|
||||||
|
animator_face.speed = AnimationSpeedSlider.value;
|
||||||
|
animator_face.Play(0, -1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -662,13 +760,22 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (!Builder.CurrentUMAContainer || !Builder.CurrentUMAContainer.UmaAnimator) return;
|
if (!Builder.CurrentUMAContainer || !Builder.CurrentUMAContainer.UmaAnimator) return;
|
||||||
var animator = Builder.CurrentUMAContainer.UmaAnimator;
|
var animator = Builder.CurrentUMAContainer.UmaAnimator;
|
||||||
|
var animator_face = Builder.CurrentUMAContainer.UmaFaceAnimator;
|
||||||
|
var animator_cam = Builder.PreviewCameraAnimator;
|
||||||
if (animator != null)
|
if (animator != null)
|
||||||
{
|
{
|
||||||
var AnimeClip = Builder.CurrentUMAContainer.OverrideController["clip_2"];
|
var AnimeClip = Builder.CurrentUMAContainer.OverrideController["clip_2"];
|
||||||
|
|
||||||
// Pause and Seek;
|
// Pause and Seek;
|
||||||
Builder.CurrentUMAContainer.UmaAnimator.speed = 0;
|
animator.speed = 0;
|
||||||
animator.Play(0, -1, val);
|
animator.Play(0, -1, val);
|
||||||
|
animator_cam.speed = 0;
|
||||||
|
animator_cam.Play(0, -1, val);
|
||||||
|
if (animator_face)
|
||||||
|
{
|
||||||
|
animator_face.speed = 0;
|
||||||
|
animator_face.Play(0, -1, val);
|
||||||
|
}
|
||||||
|
|
||||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||||
}
|
}
|
||||||
@@ -679,6 +786,11 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
AnimationSpeedText.text = string.Format("Animation Speed: {0:F2}", val);
|
AnimationSpeedText.text = string.Format("Animation Speed: {0:F2}", val);
|
||||||
if (!Builder.CurrentUMAContainer || !Builder.CurrentUMAContainer.UmaAnimator) return;
|
if (!Builder.CurrentUMAContainer || !Builder.CurrentUMAContainer.UmaAnimator) return;
|
||||||
Builder.CurrentUMAContainer.UmaAnimator.speed = val;
|
Builder.CurrentUMAContainer.UmaAnimator.speed = val;
|
||||||
|
Builder.PreviewCameraAnimator.speed = val;
|
||||||
|
if (Builder.CurrentUMAContainer.UmaFaceAnimator)
|
||||||
|
{
|
||||||
|
Builder.CurrentUMAContainer.UmaFaceAnimator.speed = val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetAudioPlayer()
|
public void ResetAudioPlayer()
|
||||||
|
|||||||
@@ -89,14 +89,26 @@ namespace Gallop
|
|||||||
var bone = gameObjects.Find(a => { return a.name == spring._boneName; });
|
var bone = gameObjects.Find(a => { return a.name == spring._boneName; });
|
||||||
if (bone)
|
if (bone)
|
||||||
{
|
{
|
||||||
|
bool isTail = gameObject.name.Contains("tail");//The tail needs less traction
|
||||||
var dynamic = gameObject.AddComponent<DynamicBone>();
|
var dynamic = gameObject.AddComponent<DynamicBone>();
|
||||||
dynamic.m_Root = bone;
|
dynamic.m_Root = bone;
|
||||||
dynamic.m_UpdateMode = DynamicBone.UpdateMode.Normal;
|
dynamic.m_UpdateMode = DynamicBone.UpdateMode.Normal;
|
||||||
dynamic.m_Gravity = new Vector3(0, Mathf.Clamp01(-spring._gravity / 80000), 0);
|
dynamic.m_Gravity = new Vector3(0, Mathf.Clamp01(-30 / spring._gravity), 0);
|
||||||
dynamic.m_Damping = 0.2f;
|
if (isTail)
|
||||||
dynamic.m_Stiffness = Mathf.Clamp01(spring._stiffnessForce / 900);
|
{
|
||||||
dynamic.m_Elasticity = Mathf.Clamp01(spring._dragForce / 4000);
|
dynamic.m_Damping = 0.1f;
|
||||||
|
dynamic.m_Stiffness = Mathf.Clamp01(10 / spring._stiffnessForce);
|
||||||
|
dynamic.m_Elasticity = Mathf.Clamp01(10 / spring._dragForce);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dynamic.m_Damping = 0.2f;
|
||||||
|
dynamic.m_Stiffness = Mathf.Clamp01(40 / spring._stiffnessForce);
|
||||||
|
dynamic.m_Elasticity = Mathf.Clamp01(40 / spring._dragForce);
|
||||||
|
|
||||||
|
}
|
||||||
dynamic.m_Radius = spring._collisionRadius;
|
dynamic.m_Radius = spring._collisionRadius;
|
||||||
|
|
||||||
dynamic.SetupParticles();
|
dynamic.SetupParticles();
|
||||||
DynamicBones.Add(dynamic);
|
DynamicBones.Add(dynamic);
|
||||||
|
|
||||||
@@ -114,8 +126,18 @@ namespace Gallop
|
|||||||
if (tempParticle != null)
|
if (tempParticle != null)
|
||||||
{
|
{
|
||||||
tempParticle.m_Damping = 0.2f;
|
tempParticle.m_Damping = 0.2f;
|
||||||
tempParticle.m_Stiffness = Mathf.Clamp01(Childcollision._stiffnessForce / 900);
|
if (isTail)
|
||||||
tempParticle.m_Elasticity = Mathf.Clamp01(Childcollision._dragForce / 4000);
|
{
|
||||||
|
tempParticle.m_Damping = 0.1f;
|
||||||
|
tempParticle.m_Stiffness = Mathf.Clamp01(10 / spring._stiffnessForce);
|
||||||
|
tempParticle.m_Elasticity = Mathf.Clamp01(10 / spring._dragForce);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempParticle.m_Damping = 0.2f;
|
||||||
|
tempParticle.m_Stiffness = Mathf.Clamp01(40 / spring._stiffnessForce);
|
||||||
|
tempParticle.m_Elasticity = Mathf.Clamp01(40 / spring._dragForce);
|
||||||
|
}
|
||||||
tempParticle.m_Radius = Childcollision._collisionRadius;
|
tempParticle.m_Radius = Childcollision._collisionRadius;
|
||||||
foreach (string collisionName in Childcollision._collisionNameList)
|
foreach (string collisionName in Childcollision._collisionNameList)
|
||||||
{
|
{
|
||||||
@@ -136,7 +158,21 @@ namespace Gallop
|
|||||||
{
|
{
|
||||||
foreach(DynamicBone dynamic in DynamicBones)
|
foreach(DynamicBone dynamic in DynamicBones)
|
||||||
{
|
{
|
||||||
dynamic.enabled = isOn;
|
if (!dynamic.m_Root.name.Contains("Ear"))
|
||||||
|
{
|
||||||
|
dynamic.enabled = isOn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnableEarPhysics(bool isOn)
|
||||||
|
{
|
||||||
|
foreach (DynamicBone dynamic in DynamicBones)
|
||||||
|
{
|
||||||
|
if (dynamic.m_Root.name.Contains("Ear"))
|
||||||
|
{
|
||||||
|
dynamic.enabled = isOn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Gallop
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class FaceTypeSet // TypeDefIndex: 24416
|
||||||
|
{
|
||||||
|
public int[] faceType; // 0x10
|
||||||
|
public int count; // 0x18
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class EarTypeSet // TypeDefIndex: 24417
|
||||||
|
{
|
||||||
|
public EarType[] faceType; // 0x10
|
||||||
|
public int count; // 0x18
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class DrivenKeyAnimation : ScriptableObject
|
||||||
|
{
|
||||||
|
public const int FaceNumGroupDiff = 2;
|
||||||
|
public const int FaceNum = 5;
|
||||||
|
public const int EyeNum = 2;
|
||||||
|
public const int EyebrowNum = 2;
|
||||||
|
public const int MouthNum = 1;
|
||||||
|
public const int EarNum = 2;
|
||||||
|
public AnimationClip clip; // 0x18
|
||||||
|
public FaceTypeSet[] animationFaceType; // 0x20
|
||||||
|
public EarTypeSet[] animationEarType; // 0x28
|
||||||
|
[SerializeField] // RVA: 0x1EC0 Offset: 0x1EC0 VA: 0x7FFD44411EC0
|
||||||
|
private bool _isCheckEyeRange; // 0x30
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a19ef0ecc49491341b059327ecf2293b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -5,10 +5,10 @@ using UnityEngine;
|
|||||||
namespace Gallop
|
namespace Gallop
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DrivenKeyTarget : MonoBehaviour
|
public class DrivenKeyTarget : ScriptableObject
|
||||||
{
|
{
|
||||||
|
|
||||||
public List<TargetInfomation> _targetFaces { get; set; }
|
public List<TargetInfomation> _targetFaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using Gallop.Live.Cutt;
|
using Gallop.Live.Cutt;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Gallop
|
namespace Gallop
|
||||||
{
|
{
|
||||||
@@ -12,25 +10,56 @@ namespace Gallop
|
|||||||
public List<EyeTarget> _eyeTarget;
|
public List<EyeTarget> _eyeTarget;
|
||||||
public List<EyebrowTarget> _eyebrowTarget;
|
public List<EyebrowTarget> _eyebrowTarget;
|
||||||
public List<MouthTarget> _mouthTarget;
|
public List<MouthTarget> _mouthTarget;
|
||||||
|
public List<TargetInfomation> _earTarget;
|
||||||
|
|
||||||
public List<Transform> Objs;
|
public List<Transform> Objs;
|
||||||
|
private FacialMorph BaseLEarMorph, BaseREarMorph;
|
||||||
private FacialMorph BaseLEyeBrowMorph, BaseREyeBrowMorph;
|
private FacialMorph BaseLEyeBrowMorph, BaseREyeBrowMorph;
|
||||||
private FacialMorph BaseLEyeMorph, BaseREyeMorph;
|
private FacialMorph BaseLEyeMorph, BaseREyeMorph;
|
||||||
private FacialMorph BaseMouthMorph;
|
private FacialMorph BaseMouthMorph;
|
||||||
|
public FacialMorph LeftEyeXrange, LeftEyeYrange, RightEyeXrange, RightEyeYrange;
|
||||||
|
|
||||||
|
public List<FacialMorph> EarMorphs = new List<FacialMorph>();
|
||||||
public List<FacialMorph> EyeBrowMorphs = new List<FacialMorph>();
|
public List<FacialMorph> EyeBrowMorphs = new List<FacialMorph>();
|
||||||
public List<FacialMorph> EyeMorphs = new List<FacialMorph>();
|
public List<FacialMorph> EyeMorphs = new List<FacialMorph>();
|
||||||
public List<FacialMorph> MouthMorphs = new List<FacialMorph>();
|
public List<FacialMorph> MouthMorphs = new List<FacialMorph>();
|
||||||
|
|
||||||
public bool needUpdate = false;
|
public GameObject DrivenKeyLocator;
|
||||||
public bool needAllUpdate = false;
|
|
||||||
public UmaContainer Container;
|
public UmaContainer Container;
|
||||||
|
|
||||||
Dictionary<Transform, Vector3> RotationRecorder = new Dictionary<Transform, Vector3>();
|
Dictionary<Transform, Vector3> RotationRecorder = new Dictionary<Transform, Vector3>();
|
||||||
|
|
||||||
public void Initialize(List<Transform> objs)
|
public void Initialize(List<Transform> objs)
|
||||||
{
|
{
|
||||||
Objs = objs;
|
Objs = objs;
|
||||||
|
|
||||||
|
for (int i = 0; i < _earTarget.Count; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < _earTarget[i]._faceGroupInfo.Count; j++)
|
||||||
|
{
|
||||||
|
FacialMorph morph = new FacialMorph();
|
||||||
|
morph.target = this;
|
||||||
|
morph.direction = j > 0;
|
||||||
|
morph.name = "Ear_" + i + "_" + (morph.direction ? "L" : "R");
|
||||||
|
morph.tag = Enum.GetName(typeof(EarType), i);
|
||||||
|
morph.trsArray = _earTarget[i]._faceGroupInfo[j]._trsArray;
|
||||||
|
foreach (TrsArray trs in morph.trsArray)
|
||||||
|
{
|
||||||
|
trs.transform = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||||
|
}
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
if (morph.direction) BaseLEarMorph = morph;
|
||||||
|
else BaseREarMorph = morph;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EarMorphs.Add(morph);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _eyebrowTarget.Count; i++)
|
for (int i = 0; i < _eyebrowTarget.Count; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < _eyebrowTarget[i]._faceGroupInfo.Count; j++)
|
for (int j = 0; j < _eyebrowTarget[i]._faceGroupInfo.Count; j++)
|
||||||
@@ -47,8 +76,8 @@ namespace Gallop
|
|||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
if (morph.direction) BaseREyeBrowMorph = morph;
|
if (morph.direction) BaseLEyeBrowMorph = morph;
|
||||||
else BaseLEyeBrowMorph = morph;
|
else BaseREyeBrowMorph = morph;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -73,11 +102,22 @@ namespace Gallop
|
|||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
if (morph.direction) BaseREyeMorph = morph;
|
if (morph.direction) BaseLEyeMorph = morph;
|
||||||
else BaseLEyeMorph = morph;
|
else BaseREyeMorph = morph;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (i == 20)
|
||||||
|
{
|
||||||
|
if (morph.direction) LeftEyeXrange = morph;
|
||||||
|
else RightEyeXrange = morph;
|
||||||
|
}
|
||||||
|
else if (i == 21)
|
||||||
|
{
|
||||||
|
if (morph.direction) LeftEyeYrange = morph;
|
||||||
|
else RightEyeYrange = morph;
|
||||||
|
}
|
||||||
|
|
||||||
EyeMorphs.Add(morph);
|
EyeMorphs.Add(morph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,17 +149,50 @@ namespace Gallop
|
|||||||
}
|
}
|
||||||
FacialResetAll();
|
FacialResetAll();
|
||||||
ChangeMorphWeight(MouthMorphs[3], 1);
|
ChangeMorphWeight(MouthMorphs[3], 1);
|
||||||
|
SetupAnimator();
|
||||||
if (UmaViewerUI.Instance)
|
if (UmaViewerUI.Instance)
|
||||||
{
|
{
|
||||||
UmaViewerUI.Instance.LoadFacialPanels(this);
|
UmaViewerUI.Instance.LoadFacialPanels(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetupAnimator()
|
||||||
|
{
|
||||||
|
DrivenKeyLocator = new GameObject("DrivenKeyLocator");
|
||||||
|
DrivenKeyLocator.transform.SetParent(Container.transform);
|
||||||
|
SetupLocator("Eye_L_Base_Ctrl", "Eye_L__", EyeMorphs.FindAll(a => a.direction == true));
|
||||||
|
SetupLocator("Eye_R_Base_Ctrl", "Eye_R__", EyeMorphs.FindAll(a => a.direction == false));
|
||||||
|
SetupLocator("Eyebrow_L_Base_Ctrl", "Eyebrow_L__", EyeBrowMorphs.FindAll(a => a.direction == true));
|
||||||
|
SetupLocator("Eyebrow_R_Base_Ctrl", "Eyebrow_R__", EyeBrowMorphs.FindAll(a => a.direction == false));
|
||||||
|
SetupLocator("Mouth_Base_Ctrl", "Mouth__", MouthMorphs.FindAll(a => a.direction == false));
|
||||||
|
|
||||||
|
Container.UmaFaceAnimator = DrivenKeyLocator.AddComponent<Animator>();
|
||||||
|
Container.UmaFaceAnimator.avatar = AvatarBuilder.BuildGenericAvatar(DrivenKeyLocator, "DrivenKeyLocator");
|
||||||
|
Container.FaceOverrideController = Instantiate(UmaViewerBuilder.Instance.FaceOverrideController);
|
||||||
|
Container.UmaFaceAnimator.runtimeAnimatorController = Container.FaceOverrideController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupLocator(string rootName, string prefix, List<FacialMorph> morphs)
|
||||||
|
{
|
||||||
|
var root = new GameObject(rootName);
|
||||||
|
root.transform.SetParent(DrivenKeyLocator.transform);
|
||||||
|
|
||||||
|
morphs.ForEach(morph=>{
|
||||||
|
var locator = new GameObject(prefix+morph.tag);
|
||||||
|
locator.transform.SetParent(root.transform);
|
||||||
|
morph.locator = locator.transform;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeMorph()
|
public void ChangeMorph()
|
||||||
{
|
{
|
||||||
FacialResetAll();
|
FacialResetAll();
|
||||||
|
|
||||||
|
foreach (FacialMorph morph in EarMorphs)
|
||||||
|
{
|
||||||
|
ProcessMorph(morph);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (FacialMorph morph in EyeBrowMorphs)
|
foreach (FacialMorph morph in EyeBrowMorphs)
|
||||||
{
|
{
|
||||||
ProcessMorph(morph);
|
ProcessMorph(morph);
|
||||||
@@ -140,6 +213,12 @@ namespace Gallop
|
|||||||
|
|
||||||
public void ClearMorph()
|
public void ClearMorph()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
foreach (FacialMorph morph in EarMorphs)
|
||||||
|
{
|
||||||
|
morph.weight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (FacialMorph morph in EyeBrowMorphs)
|
foreach (FacialMorph morph in EyeBrowMorphs)
|
||||||
{
|
{
|
||||||
morph.weight = 0;
|
morph.weight = 0;
|
||||||
@@ -171,6 +250,8 @@ namespace Gallop
|
|||||||
|
|
||||||
public void FacialResetAll()
|
public void FacialResetAll()
|
||||||
{
|
{
|
||||||
|
FacialReset(BaseLEarMorph.trsArray);
|
||||||
|
FacialReset(BaseREarMorph.trsArray);
|
||||||
FacialReset(BaseLEyeBrowMorph.trsArray);
|
FacialReset(BaseLEyeBrowMorph.trsArray);
|
||||||
FacialReset(BaseREyeBrowMorph.trsArray);
|
FacialReset(BaseREyeBrowMorph.trsArray);
|
||||||
FacialReset(BaseLEyeMorph.trsArray);
|
FacialReset(BaseLEyeMorph.trsArray);
|
||||||
@@ -202,10 +283,66 @@ namespace Gallop
|
|||||||
|
|
||||||
public void ChangeMorphWeight(FacialMorph morph,float val)
|
public void ChangeMorphWeight(FacialMorph morph,float val)
|
||||||
{
|
{
|
||||||
|
Container.isAnimatorControl = false;
|
||||||
morph.weight = val;
|
morph.weight = val;
|
||||||
ChangeMorph();
|
ChangeMorph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetEyeRange(float lx, float ly,float rx, float ry)
|
||||||
|
{
|
||||||
|
LeftEyeXrange.weight = lx;
|
||||||
|
LeftEyeYrange.weight = ly;
|
||||||
|
RightEyeXrange.weight = rx;
|
||||||
|
RightEyeYrange.weight = ry;
|
||||||
|
ChangeMorph();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ProcessLocator()
|
||||||
|
{
|
||||||
|
EyeBrowMorphs.ForEach(morph =>
|
||||||
|
{
|
||||||
|
morph.weight = morph.locator.transform.localPosition.x * -100;
|
||||||
|
});
|
||||||
|
EyeMorphs.ForEach(morph =>
|
||||||
|
{
|
||||||
|
if (morph == LeftEyeXrange || morph == LeftEyeYrange || morph == RightEyeXrange || morph == RightEyeYrange)
|
||||||
|
{
|
||||||
|
if (!Container.EnableEyeTracking)
|
||||||
|
{
|
||||||
|
morph.weight = morph.locator.transform.localPosition.x * -100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
morph.weight = morph.locator.transform.localPosition.x * -100;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
MouthMorphs.ForEach(morph =>
|
||||||
|
{
|
||||||
|
morph.weight = morph.locator.transform.localPosition.x * -100;
|
||||||
|
});
|
||||||
|
ChangeMorph();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetLocator()
|
||||||
|
{
|
||||||
|
EyeBrowMorphs.ForEach(morph =>
|
||||||
|
{
|
||||||
|
morph.weight = 0;
|
||||||
|
morph.locator.transform.localPosition = Vector3.zero;
|
||||||
|
});
|
||||||
|
EyeMorphs.ForEach(morph =>
|
||||||
|
{
|
||||||
|
morph.weight = 0;
|
||||||
|
morph.locator.transform.localPosition = Vector3.zero;
|
||||||
|
});
|
||||||
|
MouthMorphs.ForEach(morph =>
|
||||||
|
{
|
||||||
|
morph.weight = 0;
|
||||||
|
morph.locator.transform.localPosition = Vector3.zero;
|
||||||
|
});
|
||||||
|
ChangeMorph();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ public class FaceEmotionKeyTarget : ScriptableObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeEmotionWeight(FaceTypeData emotion, float val)
|
||||||
|
{
|
||||||
|
FaceDrivenKeyTarget.Container.isAnimatorControl = false;
|
||||||
|
emotion.Weight = val;
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateAllFacialKeyTargets()
|
public void UpdateAllFacialKeyTargets()
|
||||||
{
|
{
|
||||||
if (FaceDrivenKeyTarget == null) return;
|
if (FaceDrivenKeyTarget == null) return;
|
||||||
@@ -81,9 +87,7 @@ public class FaceEmotionKeyTarget : ScriptableObject
|
|||||||
key.morph.weight += key.weight / 100 * emotion.Weight;
|
key.morph.weight += key.weight / 100 * emotion.Weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FaceDrivenKeyTarget.ChangeMorph();
|
FaceDrivenKeyTarget.ChangeMorph();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,6 @@ namespace Gallop
|
|||||||
public FaceDrivenKeyTarget target;
|
public FaceDrivenKeyTarget target;
|
||||||
public float weight;
|
public float weight;
|
||||||
public List<TrsArray> trsArray;
|
public List<TrsArray> trsArray;
|
||||||
|
public Transform locator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ PlayerSettings:
|
|||||||
16:10: 1
|
16:10: 1
|
||||||
16:9: 1
|
16:9: 1
|
||||||
Others: 1
|
Others: 1
|
||||||
bundleVersion: 2.1.1
|
bundleVersion: 2.1.2
|
||||||
preloadedAssets: []
|
preloadedAssets: []
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user