Refactor: Moved settings panels to their own classes (#89)
This should not affect any functionalities
This commit is contained in:
@@ -73,3 +73,4 @@ Config.json
|
|||||||
/Assets/AmplifyShaderEditor.meta
|
/Assets/AmplifyShaderEditor.meta
|
||||||
/BuildDev
|
/BuildDev
|
||||||
/UserSettings/Layouts/default-2022.dwlt
|
/UserSettings/Layouts/default-2022.dwlt
|
||||||
|
/UserSettings/EditorUserSettings.asset
|
||||||
|
|||||||
+318
-671
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class CameraOrbit : MonoBehaviour
|
public class CameraOrbit : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -19,32 +18,20 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
public EventSystem eventSystem;
|
public EventSystem eventSystem;
|
||||||
bool controlOn;
|
bool controlOn;
|
||||||
|
|
||||||
|
|
||||||
[Header("Orbit Camera")]
|
[Header("Orbit Camera")]
|
||||||
public GameObject OrbitCamSettingsTab;
|
|
||||||
public Slider OrbitCamFovSlider;
|
|
||||||
public Slider OrbitCamZoomSlider;
|
|
||||||
public Slider OrbitCamZoomSpeedSlider;
|
|
||||||
public Slider OrbitCamTargetHeightSlider;
|
|
||||||
public Slider OrbitCamHeightSlider;
|
|
||||||
public Slider OrbitCamRotationSlider;
|
|
||||||
public Slider OrbitCamSpeedSlider;
|
|
||||||
float camDistMin = 1, camDistMax = 15;
|
float camDistMin = 1, camDistMax = 15;
|
||||||
|
|
||||||
[Header("Free Camera")]
|
[Header("Free Camera")]
|
||||||
public GameObject FreeCamSettingsTab;
|
|
||||||
public Slider FreeCamFovSlider;
|
|
||||||
public Slider FreeCamRotationSlider;
|
|
||||||
public Slider FreeCamMoveSpeedSlider;
|
|
||||||
public Slider FreeCamRotateSpeedSlider;
|
|
||||||
bool FreeCamLeft = false;
|
bool FreeCamLeft = false;
|
||||||
bool FreeCamRight = false;
|
bool FreeCamRight = false;
|
||||||
private Quaternion lookRotation;
|
private Quaternion lookRotation;
|
||||||
|
|
||||||
|
private UISettingsCamera CameraSettings => UmaViewerUI.Instance.CameraSettings;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
OrbitCamZoomSlider.minValue = camDistMin;
|
CameraSettings.CameraDistance.minValue = camDistMin;
|
||||||
OrbitCamZoomSlider.maxValue = camDistMax;
|
CameraSettings.CameraDistance.maxValue = camDistMax;
|
||||||
|
|
||||||
lookRotation = transform.localRotation;
|
lookRotation = transform.localRotation;
|
||||||
instance = this;
|
instance = this;
|
||||||
@@ -54,37 +41,25 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (HandleManager.InteractionInProgress) return;
|
if (HandleManager.InteractionInProgress) return;
|
||||||
|
|
||||||
if(CameraMode != CameraModeDropdown.value)
|
bool cameraModeChanged = CameraMode != CameraSettings.CameraMode;
|
||||||
|
if (cameraModeChanged)
|
||||||
{
|
{
|
||||||
switch (CameraMode) //old
|
CameraMode = CameraSettings.CameraMode;
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
OrbitCamSettingsTab.SetActive(false);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
FreeCamSettingsTab.SetActive(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
switch (CameraModeDropdown.value) //new
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
OrbitCamSettingsTab.SetActive(true);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
FreeCamSettingsTab.SetActive(true);
|
|
||||||
lookRotation.y = transform.eulerAngles.y;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CameraMode = CameraModeDropdown.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (CameraModeDropdown.value)
|
switch (CameraMode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
OrbitAround();
|
OrbitAround();
|
||||||
OrbitLight();
|
OrbitLight();
|
||||||
break;
|
break;
|
||||||
case 1: FreeCamera(); break;
|
case 1:
|
||||||
|
if (cameraModeChanged)
|
||||||
|
{
|
||||||
|
lookRotation.y = transform.eulerAngles.y;
|
||||||
|
}
|
||||||
|
FreeCamera();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +83,7 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
{
|
{
|
||||||
TargetCenter = Vector3.zero;
|
TargetCenter = Vector3.zero;
|
||||||
|
|
||||||
Camera.main.fieldOfView = OrbitCamFovSlider.value;
|
Camera.main.fieldOfView = CameraSettings.FOV;
|
||||||
Vector3 position = transform.position;
|
Vector3 position = transform.position;
|
||||||
|
|
||||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||||
@@ -117,8 +92,8 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (Input.GetMouseButton(0) && controlOn)
|
if (Input.GetMouseButton(0) && controlOn)
|
||||||
{
|
{
|
||||||
position -= Input.GetAxis("Mouse X") * transform.right * OrbitCamSpeedSlider.value;
|
position -= Input.GetAxis("Mouse X") * transform.right * CameraSettings.MovementSpeed;
|
||||||
OrbitCamHeightSlider.value -= Input.GetAxis("Mouse Y") * OrbitCamSpeedSlider.value;
|
CameraSettings.CameraHeight -= Input.GetAxis("Mouse Y") * CameraSettings.MovementSpeed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -127,7 +102,7 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
|
|
||||||
if (!eventSystem.IsPointerOverGameObject())
|
if (!eventSystem.IsPointerOverGameObject())
|
||||||
{
|
{
|
||||||
OrbitCamZoomSlider.value -= Input.mouseScrollDelta.y * OrbitCamZoomSpeedSlider.value;
|
CameraSettings.CameraDistance.value -= Input.mouseScrollDelta.y * CameraSettings.ZoomSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Input.GetMouseButtonDown(2) || Input.GetKeyDown(KeyCode.LeftControl)) && !eventSystem.IsPointerOverGameObject())
|
if ((Input.GetMouseButtonDown(2) || Input.GetKeyDown(KeyCode.LeftControl)) && !eventSystem.IsPointerOverGameObject())
|
||||||
@@ -136,25 +111,24 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if ((Input.GetMouseButton(2) || Input.GetKey(KeyCode.LeftControl)) && CameraTargetHelper.activeSelf)
|
if ((Input.GetMouseButton(2) || Input.GetKey(KeyCode.LeftControl)) && CameraTargetHelper.activeSelf)
|
||||||
{
|
{
|
||||||
OrbitCamTargetHeightSlider.value -= Input.GetAxis("Mouse Y");
|
CameraSettings.TargetHeight -= Input.GetAxis("Mouse Y");
|
||||||
CameraTargetHelper.transform.position = OrbitCamTargetHeightSlider.value * Vector3.up;
|
CameraTargetHelper.transform.position = CameraSettings.TargetHeight * Vector3.up;
|
||||||
}
|
}
|
||||||
if (Input.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.LeftControl))
|
if (Input.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.LeftControl))
|
||||||
{
|
{
|
||||||
CameraTargetHelper.SetActive(false);
|
CameraTargetHelper.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float camDist = CameraSettings.CameraDistance.value;
|
||||||
|
CameraSettings.CameraHeightSlider.maxValue = camDist + 1 - camDist * 0.2f;
|
||||||
|
CameraSettings.CameraHeightSlider.minValue = -camDist + 1 + camDist * 0.2f;
|
||||||
|
|
||||||
float camDist = OrbitCamZoomSlider.value;
|
Vector3 target = TargetCenter + CameraSettings.TargetHeight * Vector3.up; //set target offsets
|
||||||
OrbitCamHeightSlider.maxValue = camDist + 1 - camDist * 0.2f;
|
|
||||||
OrbitCamHeightSlider.minValue = -camDist + 1 + camDist * 0.2f;
|
|
||||||
|
|
||||||
Vector3 target = TargetCenter + OrbitCamTargetHeightSlider.value * Vector3.up; //set target offsets
|
position.y = TargetCenter.y + CameraSettings.CameraHeight; //set camera height
|
||||||
|
|
||||||
position.y = TargetCenter.y + OrbitCamHeightSlider.value; //set camera height
|
|
||||||
transform.position = position; //set final position of camera at target
|
transform.position = position; //set final position of camera at target
|
||||||
transform.LookAt(target); //look at target position
|
transform.LookAt(target); //look at target position
|
||||||
transform.Rotate(0,0,OrbitCamRotationSlider.value);
|
transform.Rotate(0,0, CameraSettings.CameraRotation);
|
||||||
transform.position = target - transform.forward * camDist; //move away from target
|
transform.position = target - transform.forward * camDist; //move away from target
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,9 +137,9 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void FreeCamera()
|
void FreeCamera()
|
||||||
{
|
{
|
||||||
Camera.main.fieldOfView = FreeCamFovSlider.value;
|
Camera.main.fieldOfView = CameraSettings.FOV;
|
||||||
float moveSpeed = FreeCamMoveSpeedSlider.value;
|
float moveSpeed = CameraSettings.MovementSpeed;;
|
||||||
float rotateSpeed = FreeCamRotateSpeedSlider.value;
|
float rotateSpeed = CameraSettings.RotationSpeed;
|
||||||
|
|
||||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||||
{
|
{
|
||||||
@@ -185,7 +159,7 @@ public class CameraOrbit : MonoBehaviour
|
|||||||
{
|
{
|
||||||
FreeCamLeft = false;
|
FreeCamLeft = false;
|
||||||
}
|
}
|
||||||
transform.localRotation = Quaternion.Euler(lookRotation.x, lookRotation.y, FreeCamRotationSlider.value);
|
transform.localRotation = Quaternion.Euler(lookRotation.x, lookRotation.y, CameraSettings.CameraRotation);
|
||||||
|
|
||||||
if (Input.GetMouseButtonDown(1) && !eventSystem.IsPointerOverGameObject())
|
if (Input.GetMouseButtonDown(1) && !eventSystem.IsPointerOverGameObject())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -114,10 +114,10 @@ public class PoseManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (PoseModeOn) return;
|
if (PoseModeOn) return;
|
||||||
|
|
||||||
var ui = UmaViewerUI.Instance;
|
var modelSettings = UmaViewerUI.Instance.ModelSettings;
|
||||||
var builder = UmaViewerBuilder.Instance;
|
var builder = UmaViewerBuilder.Instance;
|
||||||
ui.SetEyeTrackingEnable(false);
|
modelSettings.SetEyeTrackingEnable(false);
|
||||||
ui.SetDynamicBoneEnable(false);
|
modelSettings.SetDynamicBoneEnable(false);
|
||||||
HandleCanvas.SetActive(true);
|
HandleCanvas.SetActive(true);
|
||||||
|
|
||||||
if (builder.CurrentUMAContainer && builder.CurrentUMAContainer.UmaAnimator)
|
if (builder.CurrentUMAContainer && builder.CurrentUMAContainer.UmaAnimator)
|
||||||
@@ -135,10 +135,10 @@ public class PoseManager : MonoBehaviour
|
|||||||
|
|
||||||
UIPoseContainer.CreateBackupFromScene();
|
UIPoseContainer.CreateBackupFromScene();
|
||||||
|
|
||||||
var ui = UmaViewerUI.Instance;
|
var modelSettings = UmaViewerUI.Instance.ModelSettings;
|
||||||
var builder = UmaViewerBuilder.Instance;
|
var builder = UmaViewerBuilder.Instance;
|
||||||
ui.SetEyeTrackingEnable(true);
|
modelSettings.SetEyeTrackingEnable(true);
|
||||||
ui.SetDynamicBoneEnable(true);
|
modelSettings.SetDynamicBoneEnable(true);
|
||||||
HandleCanvas.SetActive(false);
|
HandleCanvas.SetActive(false);
|
||||||
|
|
||||||
if (builder.CurrentUMAContainer != null && builder.CurrentUMAContainer.UmaAnimator != null)
|
if (builder.CurrentUMAContainer != null && builder.CurrentUMAContainer.UmaAnimator != null)
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ public class Screenshot : MonoBehaviour
|
|||||||
public static Screenshot Instance;
|
public static Screenshot Instance;
|
||||||
bool recording = false;
|
bool recording = false;
|
||||||
|
|
||||||
|
static UISettingsAnimation AnimationSettings => UmaViewerUI.Instance.AnimationSettings;
|
||||||
|
static UISettingsScreenshot ScreenshotSettings => UmaViewerUI.Instance.ScreenshotSettings;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@@ -20,11 +23,11 @@ public class Screenshot : MonoBehaviour
|
|||||||
public static void TakeScreenshot()
|
public static void TakeScreenshot()
|
||||||
{
|
{
|
||||||
var camera = GetActiveCamera();
|
var camera = GetActiveCamera();
|
||||||
int width = int.Parse(UmaViewerUI.Instance.SSWidth.text);
|
int width = ScreenshotSettings.Width;
|
||||||
int height = int.Parse(UmaViewerUI.Instance.SSHeight.text);
|
int height = ScreenshotSettings.Height;
|
||||||
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(camera, width, height, UmaViewerUI.Instance.SSTransparent.isOn);
|
var image = GrabFrame(camera, width, height, ScreenshotSettings.Transparent);
|
||||||
|
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
string fileDirectory = Application.persistentDataPath + "/../Screenshots/";
|
string fileDirectory = Application.persistentDataPath + "/../Screenshots/";
|
||||||
@@ -46,9 +49,8 @@ public class Screenshot : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (recording || UmaViewerBuilder.Instance.CurrentUMAContainer == null) return;
|
if (recording || UmaViewerBuilder.Instance.CurrentUMAContainer == null) return;
|
||||||
recording = true;
|
recording = true;
|
||||||
UmaViewerUI.Instance.GifButton.interactable = false;
|
ScreenshotSettings.GifButton.interactable = false;
|
||||||
UmaViewerUI.Instance.GifSlider.value = 0;
|
StartCoroutine(RecordGif(ScreenshotSettings.GifWidth, ScreenshotSettings.GifHeight, ScreenshotSettings.GifTransparent, 10)); //(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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,14 +70,14 @@ 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));
|
||||||
|
|
||||||
UmaViewerUI.Instance.AnimationSpeedChange(0);
|
|
||||||
UmaViewerUI.Instance.AnimationProgressChange(0);
|
AnimationSettings.ChangeSpeed(0);
|
||||||
|
AnimationSettings.ChangeProgress(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;
|
AnimationSettings.ChangeProgress((float)frame / clipFrameCount);
|
||||||
UmaViewerUI.Instance.AnimationProgressChange((float)frame / clipFrameCount);
|
|
||||||
yield return new WaitForEndOfFrame();
|
yield return new WaitForEndOfFrame();
|
||||||
var tex = GrabFrame(camera, width, height, transparent);
|
var tex = GrabFrame(camera, width, height, transparent);
|
||||||
CaptureToGIFCustom.Instance.Frames.Add(new Image(tex));
|
CaptureToGIFCustom.Instance.Frames.Add(new Image(tex));
|
||||||
@@ -84,12 +86,11 @@ public class Screenshot : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
recording = false;
|
recording = false;
|
||||||
UmaViewerUI.Instance.AnimationProgressChange(0);
|
AnimationSettings.ChangeProgress(0);
|
||||||
UmaViewerUI.Instance.AnimationSpeedChange(1);
|
AnimationSettings.ChangeSpeed(1);
|
||||||
ppLayer.enabled = oldPpState;
|
ppLayer.enabled = oldPpState;
|
||||||
CaptureToGIFCustom.Instance.stop = true;
|
CaptureToGIFCustom.Instance.stop = true;
|
||||||
UmaViewerUI.Instance.GifButton.interactable = true;
|
ScreenshotSettings.GifButton.interactable = true;
|
||||||
UmaViewerUI.Instance.GifSlider.value = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture2D GrabFrame(Camera cam, int width, int height, bool transparent = true)
|
public static Texture2D GrabFrame(Camera cam, int width, int height, bool transparent = true)
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8d7e1044e61c69a488a814761bd18101
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsAnimation : MonoBehaviour
|
||||||
|
{
|
||||||
|
static UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||||
|
|
||||||
|
public TextMeshProUGUI TitleText;
|
||||||
|
public TextMeshProUGUI ProgressText;
|
||||||
|
public Slider ProgressSlider;
|
||||||
|
public Button PlayButton;
|
||||||
|
public TextMeshProUGUI SpeedText;
|
||||||
|
public Slider SpeedSlider;
|
||||||
|
public Button VMDButton;
|
||||||
|
|
||||||
|
internal void UpdateAnimationInfo(UmaContainerCharacter umaContainer)
|
||||||
|
{
|
||||||
|
if (umaContainer.OverrideController["clip_2"].name != "clip_2")
|
||||||
|
{
|
||||||
|
bool isLoop = umaContainer.OverrideController["clip_2"].name.Contains("_loop");
|
||||||
|
var AnimeState = umaContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0);
|
||||||
|
var AnimeClip = umaContainer.OverrideController["clip_2"];
|
||||||
|
if (AnimeClip && umaContainer.UmaAnimator.speed != 0)
|
||||||
|
{
|
||||||
|
var normalizedTime = (isLoop) ? Mathf.Repeat(AnimeState.normalizedTime, 1) : Mathf.Min(AnimeState.normalizedTime, 1);
|
||||||
|
TitleText.text = AnimeClip.name;
|
||||||
|
ProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||||
|
ProgressSlider.SetValueWithoutNotify(normalizedTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Pause()
|
||||||
|
{
|
||||||
|
var container = Builder.CurrentUMAContainer;
|
||||||
|
if (!container || !container.UmaAnimator) return;
|
||||||
|
if (Builder.OverrideController.animationClips.Length == 0) return;
|
||||||
|
|
||||||
|
var animator = container.UmaAnimator;
|
||||||
|
var animator_face = container.UmaFaceAnimator;
|
||||||
|
var animator_cam = Builder.AnimationCameraAnimator;
|
||||||
|
var AnimeState = animator.GetCurrentAnimatorStateInfo(0);
|
||||||
|
var state = animator.speed > 0f;
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
animator.speed = 0;
|
||||||
|
if (animator_face)
|
||||||
|
animator_face.speed = 0;
|
||||||
|
animator_cam.speed = 0;
|
||||||
|
}
|
||||||
|
else if (AnimeState.normalizedTime < 1f)
|
||||||
|
{
|
||||||
|
animator.speed = SpeedSlider.value;
|
||||||
|
animator_cam.speed = SpeedSlider.value;
|
||||||
|
if (animator_face)
|
||||||
|
animator_face.speed = SpeedSlider.value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
animator.speed = SpeedSlider.value;
|
||||||
|
animator.Play(0, 0, 0);
|
||||||
|
animator.Play(0, 2, 0);
|
||||||
|
animator_cam.speed = SpeedSlider.value;
|
||||||
|
animator_cam.Play(0, -1, 0);
|
||||||
|
if (animator_face)
|
||||||
|
{
|
||||||
|
animator_face.speed = SpeedSlider.value;
|
||||||
|
animator_face.Play(0, 0, 0);
|
||||||
|
animator_face.Play(0, 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeProgress(float val)
|
||||||
|
{
|
||||||
|
var container = Builder.CurrentUMAContainer;
|
||||||
|
if (!container) return;
|
||||||
|
var animator = container.UmaAnimator;
|
||||||
|
var animator_face = container.UmaFaceAnimator;
|
||||||
|
var animator_cam = Builder.AnimationCameraAnimator;
|
||||||
|
if (animator != null)
|
||||||
|
{
|
||||||
|
var AnimeClip = container.OverrideController["clip_2"];
|
||||||
|
|
||||||
|
// Pause and Seek;
|
||||||
|
animator.speed = 0;
|
||||||
|
animator.Play(0, 0, val);
|
||||||
|
animator.Play(0, 2, val);
|
||||||
|
if (animator_cam.runtimeAnimatorController)
|
||||||
|
{
|
||||||
|
animator_cam.speed = 0;
|
||||||
|
animator_cam.Play(0, -1, val);
|
||||||
|
}
|
||||||
|
if (animator_face)
|
||||||
|
{
|
||||||
|
animator_face.speed = 0;
|
||||||
|
animator_face.Play(0, 0, val);
|
||||||
|
animator_face.Play(0, 1, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeSpeed(float val)
|
||||||
|
{
|
||||||
|
var container = Builder.CurrentUMAContainer;
|
||||||
|
SpeedText.text = string.Format("Speed: {0:F2}", val);
|
||||||
|
|
||||||
|
if (!container || !container.UmaAnimator) return;
|
||||||
|
|
||||||
|
container.UmaAnimator.speed = val;
|
||||||
|
Builder.AnimationCameraAnimator.speed = val;
|
||||||
|
if (container.UmaFaceAnimator)
|
||||||
|
{
|
||||||
|
container.UmaFaceAnimator.speed = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToFrameFormat(float time, float frameRate)
|
||||||
|
{
|
||||||
|
int frames = Mathf.FloorToInt(time % 1 * frameRate);
|
||||||
|
int seconds = (int)time;
|
||||||
|
int minute = seconds % 3600 / 60;
|
||||||
|
seconds = seconds % 3600 % 60;
|
||||||
|
return string.Format("{0:D2}m:{1:D2}s:{2:D2}f", minute, seconds, frames);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bb219ac831519664dbea3c160315d0ec
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using static PageManager;
|
||||||
|
|
||||||
|
public class UISettingsAssets : MonoBehaviour
|
||||||
|
{
|
||||||
|
private Dictionary<string, Entry> LoadedAssetEntries = new Dictionary<string, Entry>();
|
||||||
|
public PageManager LoadedAssetPageCtrl;
|
||||||
|
public ScrollRect LoadedAssetScrollRect;
|
||||||
|
|
||||||
|
public void LoadedAssetsAdd(UmaDatabaseEntry entry)
|
||||||
|
{
|
||||||
|
if (!LoadedAssetPageCtrl) return;
|
||||||
|
if (LoadedAssetEntries.ContainsKey(entry.Name)) return;
|
||||||
|
var file_name = Path.GetFileName(entry.Name);
|
||||||
|
string filePath = entry.FilePath.Replace("/", "\\");
|
||||||
|
var assetentry = new Entry()
|
||||||
|
{
|
||||||
|
Name = file_name,
|
||||||
|
FontSize = 18,
|
||||||
|
OnClick = (container) =>
|
||||||
|
{
|
||||||
|
Process.Start("explorer.exe", "/select," + filePath);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
LoadedAssetEntries.Add(entry.Name, assetentry);
|
||||||
|
LoadedAssetPageCtrl.AddEntries(assetentry);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadedAssetsClear()
|
||||||
|
{
|
||||||
|
LoadedAssetEntries.Clear();
|
||||||
|
if (LoadedAssetPageCtrl)
|
||||||
|
{
|
||||||
|
LoadedAssetPageCtrl.ResetCtrl();
|
||||||
|
LoadedAssetPageCtrl.Initialize(LoadedAssetEntries.Values.ToList(), LoadedAssetScrollRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyAllLoadedAssetsPath()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (var entry in LoadedAssetEntries.Keys)
|
||||||
|
{
|
||||||
|
if (UmaViewerMain.Instance.AbList.TryGetValue(entry, out var asset))
|
||||||
|
{
|
||||||
|
sb.AppendLine(asset.FilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUIUtility.systemCopyBuffer = sb.ToString();
|
||||||
|
UmaViewerUI.Instance.ShowMessage($"{LoadedAssetEntries.Count} Path copied", UIMessageType.Success);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 01ee252c6096dbc45a4d5bea9fc25274
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsCamera : MonoBehaviour
|
||||||
|
{
|
||||||
|
public TMPro.TMP_Dropdown AAModeDropdown;
|
||||||
|
public TMPro.TMP_Dropdown CameraModeDropdown;
|
||||||
|
|
||||||
|
[Header("Free Camera")]
|
||||||
|
public GameObject FreeCameraSettingsTab;
|
||||||
|
public Slider FOVFree;
|
||||||
|
public Slider CameraRotationFree;
|
||||||
|
public Slider MovementSpeedFree;
|
||||||
|
public Slider RotationSpeedSlider;
|
||||||
|
|
||||||
|
[Header("Orbit Camera")]
|
||||||
|
public GameObject OrbitCameraSettingsTab;
|
||||||
|
public Slider FOVOrbit;
|
||||||
|
public Slider CameraDistance;
|
||||||
|
public Slider CameraHeightSlider;
|
||||||
|
public Slider CameraRotationOrbit;
|
||||||
|
public Slider TargetHeightSlider;
|
||||||
|
public Slider ZoomSpeedSlider;
|
||||||
|
public Slider MovementSpeedOrbit;
|
||||||
|
|
||||||
|
[Space]
|
||||||
|
public Toggle UseAnimationCamera;
|
||||||
|
|
||||||
|
public int CameraMode
|
||||||
|
{
|
||||||
|
get { return CameraModeDropdown.value; }
|
||||||
|
set { CameraModeDropdown.value = value; UpdateSettingsPanel(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float FOV
|
||||||
|
{
|
||||||
|
get { return CameraMode == 0 ? FOVOrbit.value : FOVFree.value; }
|
||||||
|
set {
|
||||||
|
if (CameraMode == 0)
|
||||||
|
{
|
||||||
|
FOVOrbit.value = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FOVFree.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float CameraRotation
|
||||||
|
{
|
||||||
|
get { return CameraMode == 0 ? CameraRotationOrbit.value : CameraRotationFree.value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (CameraMode == 0)
|
||||||
|
{
|
||||||
|
CameraRotationOrbit.value = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CameraRotationFree.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float ZoomSpeed
|
||||||
|
{
|
||||||
|
get { return ZoomSpeedSlider.value; }
|
||||||
|
set { ZoomSpeedSlider.value = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float MovementSpeed
|
||||||
|
{
|
||||||
|
get { return CameraMode == 0 ? MovementSpeedOrbit.value : MovementSpeedFree.value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (CameraMode == 0)
|
||||||
|
{
|
||||||
|
MovementSpeedOrbit.value = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MovementSpeedFree.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float RotationSpeed
|
||||||
|
{
|
||||||
|
get { return RotationSpeedSlider.value; }
|
||||||
|
set { RotationSpeedSlider.value = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float CameraHeight
|
||||||
|
{
|
||||||
|
get { return CameraHeightSlider.value; }
|
||||||
|
set { CameraHeightSlider.value = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float TargetHeight
|
||||||
|
{
|
||||||
|
get { return TargetHeightSlider.value; }
|
||||||
|
set { TargetHeightSlider.value = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateSettingsPanel()
|
||||||
|
{
|
||||||
|
if (CameraMode == 0)
|
||||||
|
{
|
||||||
|
OrbitCameraSettingsTab.SetActive(true);
|
||||||
|
FreeCameraSettingsTab.SetActive(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FreeCameraSettingsTab.SetActive(true);
|
||||||
|
OrbitCameraSettingsTab.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> Converts values 1-4 to valid AA values </summary>
|
||||||
|
public void ChangeAntiAliasing(int value)
|
||||||
|
{
|
||||||
|
int[] aaValues = { 0, 2, 4, 8 };
|
||||||
|
|
||||||
|
QualitySettings.antiAliasing = aaValues[value];
|
||||||
|
|
||||||
|
if (Config.Instance.AntiAliasing != value)
|
||||||
|
{
|
||||||
|
Config.Instance.AntiAliasing = value;
|
||||||
|
Config.Instance.UpdateConfig(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d1f60c359f123945a317ebc3a71d7d3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsEnvironment : MonoBehaviour
|
||||||
|
{
|
||||||
|
public ScrollRect BackGroundList;
|
||||||
|
public PageManager BackGroundPageCtrl;
|
||||||
|
public GameObject BG_Canvas;
|
||||||
|
public GameObject BG_HSVPickerObj;
|
||||||
|
public Image BG_Image;
|
||||||
|
|
||||||
|
static UmaViewerMain Main => UmaViewerMain.Instance;
|
||||||
|
static UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||||
|
|
||||||
|
public void ChangeBackground(int index)
|
||||||
|
{
|
||||||
|
BackGroundPageCtrl.ResetCtrl();
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
Camera.main.clearFlags = CameraClearFlags.Skybox;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Camera.main.clearFlags = CameraClearFlags.SolidColor;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Camera.main.clearFlags = CameraClearFlags.SolidColor;
|
||||||
|
ListBackgrounds();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Camera.main.clearFlags = CameraClearFlags.Skybox;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
BG_HSVPickerObj.SetActive(index != 2);
|
||||||
|
BG_Canvas.SetActive(index == 2);
|
||||||
|
BackGroundPageCtrl.transform.parent.gameObject.SetActive(index == 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeBackgroundColor(Color color)
|
||||||
|
{
|
||||||
|
Camera.main.backgroundColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListBackgrounds()
|
||||||
|
{
|
||||||
|
var pageentrys = new List<PageManager.Entry>();
|
||||||
|
foreach (var entry in Main.AbList.Where(a => a.Key.StartsWith("bg/bg")))
|
||||||
|
{
|
||||||
|
var pageentry = new PageManager.Entry();
|
||||||
|
pageentry.Name = Path.GetFileName(entry.Key);
|
||||||
|
pageentry.Sprite = Builder.LoadSprite(entry.Value);
|
||||||
|
if (pageentry.Sprite == null) continue;
|
||||||
|
pageentry.OnClick = (container) =>
|
||||||
|
{
|
||||||
|
UmaViewerUI.Instance.HighlightChildImage(BackGroundList.content, container);
|
||||||
|
BG_Image.sprite = pageentry.Sprite;
|
||||||
|
BG_Image.SetVerticesDirty();
|
||||||
|
};
|
||||||
|
|
||||||
|
if (BG_Image.sprite == null)
|
||||||
|
{
|
||||||
|
BG_Image.sprite = pageentry.Sprite;
|
||||||
|
BG_Image.SetVerticesDirty();
|
||||||
|
}
|
||||||
|
pageentrys.Add(pageentry);
|
||||||
|
}
|
||||||
|
BackGroundPageCtrl.Initialize(pageentrys, BackGroundList);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 463147a12f484cc4dbe150fb97b22392
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
using SFB;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsModel : MonoBehaviour
|
||||||
|
{
|
||||||
|
static UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||||
|
|
||||||
|
[SerializeField] private Toggle _lockCharacter;
|
||||||
|
[SerializeField] private Toggle _openWithTPose;
|
||||||
|
[SerializeField] private Toggle _enablePhysics;
|
||||||
|
[SerializeField] private Toggle _lookAtCamera;
|
||||||
|
[SerializeField] private Toggle _faceOverride;
|
||||||
|
[SerializeField] private Slider _outlineWidthSlider;
|
||||||
|
|
||||||
|
public ScrollRect MaterialsList;
|
||||||
|
|
||||||
|
private bool
|
||||||
|
_isHeadFix,
|
||||||
|
_isTPose,
|
||||||
|
_dynamicBoneEnable = true,
|
||||||
|
_enableEyeTracking = true,
|
||||||
|
_enableFaceOverride = true;
|
||||||
|
|
||||||
|
private float _outlineWidth;
|
||||||
|
|
||||||
|
public bool IsHeadFix
|
||||||
|
{
|
||||||
|
get { return _isHeadFix; }
|
||||||
|
set { _lockCharacter.SetIsOnWithoutNotify(value); SetHeadFix(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTPose
|
||||||
|
{
|
||||||
|
get { return _isTPose; }
|
||||||
|
set { _openWithTPose.SetIsOnWithoutNotify(value); SetTPose(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DynamicBoneEnable
|
||||||
|
{
|
||||||
|
get { return _dynamicBoneEnable; }
|
||||||
|
set { _enablePhysics.SetIsOnWithoutNotify(value); SetDynamicBoneEnable(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EnableEyeTracking
|
||||||
|
{
|
||||||
|
get { return _enableEyeTracking; }
|
||||||
|
set { _lookAtCamera.SetIsOnWithoutNotify(value); SetEyeTrackingEnable(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EnableFaceOverride
|
||||||
|
{
|
||||||
|
get { return _enableFaceOverride; }
|
||||||
|
set { _faceOverride.SetIsOnWithoutNotify(value); SetFaceOverrideEnable(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public float OutlineWidth
|
||||||
|
{
|
||||||
|
get { return _outlineWidth; }
|
||||||
|
set { _outlineWidthSlider.value = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetHeadFix(bool value)
|
||||||
|
{
|
||||||
|
_isHeadFix = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTPose(bool value)
|
||||||
|
{
|
||||||
|
_isTPose = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDynamicBoneEnable(bool isOn)
|
||||||
|
{
|
||||||
|
_dynamicBoneEnable = isOn;
|
||||||
|
Builder.CurrentUMAContainer?.SetDynamicBoneEnable(isOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEyeTrackingEnable(bool isOn)
|
||||||
|
{
|
||||||
|
_enableEyeTracking = isOn;
|
||||||
|
Builder.CurrentUMAContainer?.SetEyeTracking(isOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFaceOverrideEnable(bool isOn)
|
||||||
|
{
|
||||||
|
_enableFaceOverride = isOn;
|
||||||
|
Builder.CurrentUMAContainer?.SetFaceOverrideData(isOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeOutlineWidth(float val)
|
||||||
|
{
|
||||||
|
_outlineWidth = val;
|
||||||
|
Shader.SetGlobalFloat("_GlobalOutlineWidth", val);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExportModel()
|
||||||
|
{
|
||||||
|
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||||
|
var container = Builder.CurrentUMAContainer;
|
||||||
|
if (container)
|
||||||
|
{
|
||||||
|
var entry = container.CharaEntry;
|
||||||
|
var path = StandaloneFileBrowser.SaveFilePanel("Save PMX File", Config.Instance.MainPath, $"{entry.Id}_{entry.GetName()}", "pmx");
|
||||||
|
if (!string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
ModelExporter.ExportModel(container, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f61fc8a1e0ca2cf49a9f794b613665f0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||||
|
using SFB;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using System.Collections;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsOther : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Button UpdateDBButton;
|
||||||
|
public TMP_Dropdown RegionDropdown;
|
||||||
|
public TMP_Dropdown WorkModeDropdown;
|
||||||
|
public TMP_Dropdown LanguageDropdown;
|
||||||
|
private IEnumerator _updateResVerCoroutine;
|
||||||
|
|
||||||
|
public void ApplySettings()
|
||||||
|
{
|
||||||
|
WorkModeDropdown.SetValueWithoutNotify((int)Config.Instance.WorkMode);
|
||||||
|
RegionDropdown.SetValueWithoutNotify((int)Config.Instance.Region);
|
||||||
|
LanguageDropdown.SetValueWithoutNotify((int)Config.Instance.Language);
|
||||||
|
UpdateDBButton.interactable = (Config.Instance.WorkMode == WorkMode.Standalone);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeLanguage(int lang)
|
||||||
|
{
|
||||||
|
if ((int)Config.Instance.Language != lang)
|
||||||
|
{
|
||||||
|
Config.Instance.Language = (Language)lang;
|
||||||
|
Config.Instance.UpdateConfig(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeRegion(int region)
|
||||||
|
{
|
||||||
|
if ((int)Config.Instance.Region != region)
|
||||||
|
{
|
||||||
|
Config.Instance.Region = (Region)region;
|
||||||
|
Config.Instance.UpdateConfig(false);
|
||||||
|
StartCoroutine(UmaViewerUI.Instance.ApplyGraphicsSettings());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeWorkMode(int mode)
|
||||||
|
{
|
||||||
|
if ((int)Config.Instance.WorkMode != mode)
|
||||||
|
{
|
||||||
|
Config.Instance.WorkMode = (WorkMode)mode;
|
||||||
|
Config.Instance.UpdateConfig(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateGameDB()
|
||||||
|
{
|
||||||
|
if (_updateResVerCoroutine != null && Config.Instance.WorkMode != WorkMode.Standalone) return;
|
||||||
|
UmaDatabaseController.Instance.CloseAllConnection();
|
||||||
|
ManifestDB dB = new ManifestDB();
|
||||||
|
_updateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg, UIMessageType type) { UmaViewerUI.Instance.ShowMessage(msg, type); });
|
||||||
|
StartCoroutine(_updateResVerCoroutine);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeDataPath()
|
||||||
|
{
|
||||||
|
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||||
|
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
|
||||||
|
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
|
||||||
|
{
|
||||||
|
if (path[0] != Config.Instance.MainPath)
|
||||||
|
{
|
||||||
|
Config.Instance.MainPath = path[0];
|
||||||
|
Config.Instance.UpdateConfig(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenConfig()
|
||||||
|
{
|
||||||
|
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||||
|
if (File.Exists(Config.configPath))
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = Config.configPath,
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnloadAllBundle() => UmaAssetManager.UnloadAllBundle(true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 49e773074de12594e9980542be5a673b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsScreenshot : MonoBehaviour
|
||||||
|
{
|
||||||
|
public TMP_InputField _width;
|
||||||
|
public TMP_InputField _height;
|
||||||
|
public Toggle _transparent;
|
||||||
|
public TMP_InputField _gifWidth;
|
||||||
|
public TMP_InputField _gifHeight;
|
||||||
|
public Toggle _gifTransparent;
|
||||||
|
public Button GifButton;
|
||||||
|
|
||||||
|
public int Width => int.Parse(_width.text);
|
||||||
|
public int Height => int.Parse(_height.text);
|
||||||
|
public bool Transparent => _transparent.isOn;
|
||||||
|
|
||||||
|
public int GifWidth => int.Parse(_gifWidth.text);
|
||||||
|
public int GifHeight => int.Parse(_gifHeight.text);
|
||||||
|
public bool GifTransparent => _gifTransparent.isOn;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0ac07fd922c37624db9cca1147588e2c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class UISettingsSound : MonoBehaviour
|
||||||
|
{
|
||||||
|
static UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||||
|
|
||||||
|
public TextMeshProUGUI TitleText;
|
||||||
|
public TextMeshProUGUI ProgressText;
|
||||||
|
public Slider ProgressSlider;
|
||||||
|
public Button PlayButton;
|
||||||
|
public Text LyricsText;
|
||||||
|
|
||||||
|
internal void UpdateTrack(AudioSource mianSource)
|
||||||
|
{
|
||||||
|
TitleText.text = mianSource.clip.name;
|
||||||
|
ProgressText.text = string.Format("{0} / {1}", ToTimeFormat(mianSource.time), ToTimeFormat(mianSource.clip.length));
|
||||||
|
ProgressSlider.SetValueWithoutNotify(mianSource.time / mianSource.clip.length);
|
||||||
|
LyricsText.text = UmaUtility.GetCurrentLyrics(mianSource.time, UmaViewerBuilder.Instance.CurrentLyrics);
|
||||||
|
LyricsText.text = LyricsText.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PauseAudio()
|
||||||
|
{
|
||||||
|
var sources = Builder.CurrentAudioSources;
|
||||||
|
if (sources.Count > 0)
|
||||||
|
{
|
||||||
|
AudioSource MainSource = sources[0];
|
||||||
|
var state = MainSource.isPlaying;
|
||||||
|
foreach (AudioSource source in sources)
|
||||||
|
{
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
source.Pause();
|
||||||
|
}
|
||||||
|
else if (source.clip)
|
||||||
|
{
|
||||||
|
source.Play();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
source.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopAudio()
|
||||||
|
{
|
||||||
|
var sources = Builder.CurrentAudioSources;
|
||||||
|
foreach (AudioSource source in sources)
|
||||||
|
{
|
||||||
|
source.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetPlayer()
|
||||||
|
{
|
||||||
|
TitleText.text = "No Audio";
|
||||||
|
ProgressText.text = "00:00:00 / 00:00:00";
|
||||||
|
ProgressSlider.SetValueWithoutNotify(0);
|
||||||
|
LyricsText.text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AudioProgressChange(float val)
|
||||||
|
{
|
||||||
|
if (Builder.CurrentAudioSources.Count > 0)
|
||||||
|
{
|
||||||
|
var time = Builder.CurrentAudioSources[0].clip.length * val;
|
||||||
|
foreach (AudioSource source in Builder.CurrentAudioSources)
|
||||||
|
{
|
||||||
|
if (source.clip)
|
||||||
|
{
|
||||||
|
source.time = Mathf.Clamp(time, 0, source.clip.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToTimeFormat(float time)
|
||||||
|
{
|
||||||
|
int seconds = (int)time;
|
||||||
|
int hour = seconds / 3600;
|
||||||
|
int minute = seconds % 3600 / 60;
|
||||||
|
seconds = seconds % 3600 % 60;
|
||||||
|
return string.Format("{0:D2}:{1:D2}:{2:D2}", hour, minute, seconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 85575792b20387a409179c22b616f5f2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -184,7 +184,7 @@ public class UmaContainerCharacter : UmaContainer
|
|||||||
{
|
{
|
||||||
Mat = mat,
|
Mat = mat,
|
||||||
Renderers = new Dictionary<Renderer, List<int>>(),
|
Renderers = new Dictionary<Renderer, List<int>>(),
|
||||||
Toggle = Instantiate(UmaViewerUI.Instance.UmaContainerTogglePrefab, UmaViewerUI.Instance.MaterialsList.content)
|
Toggle = Instantiate(UI.UmaContainerTogglePrefab, UI.ModelSettings.MaterialsList.content)
|
||||||
};
|
};
|
||||||
matHlp.Toggle.Name = mat.name;
|
matHlp.Toggle.Name = mat.name;
|
||||||
matHlp.Toggle.Toggle.onValueChanged.AddListener((value) => { Debug.Log("e"); matHlp.ToggleMaterials(value); });
|
matHlp.Toggle.Toggle.onValueChanged.AddListener((value) => { Debug.Log("e"); matHlp.ToggleMaterials(value); });
|
||||||
@@ -725,7 +725,7 @@ public class UmaContainerCharacter : UmaContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Some setting for Head
|
//Some setting for Head
|
||||||
EnableEyeTracking = UI.EnableEyeTracking;
|
EnableEyeTracking = UI.ModelSettings.EnableEyeTracking;
|
||||||
|
|
||||||
foreach (Renderer r in head.GetComponentsInChildren<Renderer>())
|
foreach (Renderer r in head.GetComponentsInChildren<Renderer>())
|
||||||
{
|
{
|
||||||
@@ -1340,7 +1340,7 @@ public class UmaContainerCharacter : UmaContainer
|
|||||||
|
|
||||||
public void SetEndAnimationCut()
|
public void SetEndAnimationCut()
|
||||||
{
|
{
|
||||||
UmaViewerUI.Instance.AnimationPause();
|
UI.AnimationSettings.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadFaceMorph(int id, string costumeId)
|
public void LoadFaceMorph(int id, string costumeId)
|
||||||
@@ -1425,7 +1425,7 @@ public class UmaContainerCharacter : UmaContainer
|
|||||||
FaceDrivenKeyTarget = faceDriven;
|
FaceDrivenKeyTarget = faceDriven;
|
||||||
FaceDrivenKeyTarget.Container = this;
|
FaceDrivenKeyTarget.Container = this;
|
||||||
FaceOverrideData = faceOverride;
|
FaceOverrideData = faceOverride;
|
||||||
faceOverride?.SetEnable(UI.EnableFaceOverride);
|
faceOverride?.SetEnable(UI.ModelSettings.EnableFaceOverride);
|
||||||
faceDriven.DrivenKeyLocator = locator.transform;
|
faceDriven.DrivenKeyLocator = locator.transform;
|
||||||
faceDriven.Initialize(UmaUtility.ConvertArrayToDictionary(firsehead.GetComponentsInChildren<Transform>()));
|
faceDriven.Initialize(UmaUtility.ConvertArrayToDictionary(firsehead.GetComponentsInChildren<Transform>()));
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
public static UmaViewerBuilder Instance;
|
public static UmaViewerBuilder Instance;
|
||||||
static UmaViewerMain Main => UmaViewerMain.Instance;
|
static UmaViewerMain Main => UmaViewerMain.Instance;
|
||||||
static UmaViewerUI UI => UmaViewerUI.Instance;
|
static UmaViewerUI UI => UmaViewerUI.Instance;
|
||||||
|
static UISettingsModel ModelSettings => UmaViewerUI.Instance.ModelSettings;
|
||||||
|
|
||||||
public List<AssetBundle> Loaded;
|
public List<AssetBundle> Loaded;
|
||||||
public List<Shader> ShaderList = new List<Shader>();
|
public List<Shader> ShaderList = new List<Shader>();
|
||||||
@@ -61,7 +62,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
umaContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
umaContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
||||||
LoadMobUma(umaContainer, chara, costumeId, loadMotion: true);
|
LoadMobUma(umaContainer, chara, costumeId, loadMotion: true);
|
||||||
}
|
}
|
||||||
else if (UI.isHeadFix && CurrentHead != null && CurrentHead.chara.IsMob)
|
else if (ModelSettings.IsHeadFix && CurrentHead != null && CurrentHead.chara.IsMob)
|
||||||
{
|
{
|
||||||
umaContainer.CharaData = UmaDatabaseController.ReadCharaData(CurrentHead.chara);
|
umaContainer.CharaData = UmaDatabaseController.ReadCharaData(CurrentHead.chara);
|
||||||
LoadMobUma(umaContainer, CurrentHead.chara, costumeId, chara.Id, true);
|
LoadMobUma(umaContainer, CurrentHead.chara, costumeId, chara.Id, true);
|
||||||
@@ -210,7 +211,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
string head_costumeId;
|
string head_costumeId;
|
||||||
int tailId = Convert.ToInt32(charaData["tail_model_id"]);
|
int tailId = Convert.ToInt32(charaData["tail_model_id"]);
|
||||||
|
|
||||||
if (UI.isHeadFix && CurrentHead != null)
|
if (ModelSettings.IsHeadFix && CurrentHead != null)
|
||||||
{
|
{
|
||||||
head_id = CurrentHead.id;
|
head_id = CurrentHead.id;
|
||||||
head_costumeId = CurrentHead.costumeId;
|
head_costumeId = CurrentHead.costumeId;
|
||||||
@@ -293,19 +294,19 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
umaContainer.LoadPhysics();
|
umaContainer.LoadPhysics();
|
||||||
umaContainer.SetDynamicBoneEnable(UI.DynamicBoneEnable);
|
umaContainer.SetDynamicBoneEnable(ModelSettings.DynamicBoneEnable);
|
||||||
umaContainer.LoadFaceMorph(id, costumeId);
|
umaContainer.LoadFaceMorph(id, costumeId);
|
||||||
umaContainer.TearControllers.ForEach(a => a.SetDir(a.CurrentDir));
|
umaContainer.TearControllers.ForEach(a => a.SetDir(a.CurrentDir));
|
||||||
umaContainer.HeadBone = (GameObject)umaContainer.Body.GetComponent<AssetHolder>()._assetTable["head"];
|
umaContainer.HeadBone = (GameObject)umaContainer.Body.GetComponent<AssetHolder>()._assetTable["head"];
|
||||||
umaContainer.EyeHeight = umaContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
umaContainer.EyeHeight = umaContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
||||||
umaContainer.MergeModel();
|
umaContainer.MergeModel();
|
||||||
umaContainer.SetHeight(-1);
|
umaContainer.SetHeight(-1);
|
||||||
umaContainer.Initialize(!UI.isTPose);
|
umaContainer.Initialize(!ModelSettings.IsTPose);
|
||||||
|
|
||||||
umaContainer.Position = umaContainer.transform.Find("Position");
|
umaContainer.Position = umaContainer.transform.Find("Position");
|
||||||
umaContainer.SetupBoneHandles();
|
umaContainer.SetupBoneHandles();
|
||||||
|
|
||||||
if (!UI.isTPose && loadMotion)
|
if (!ModelSettings.IsTPose && loadMotion)
|
||||||
{
|
{
|
||||||
if (Main.AbList.TryGetValue($"3d/motion/event/body/chara/chr{id}_00/anm_eve_chr{id}_00_idle01_loop", out UmaDatabaseEntry entry))
|
if (Main.AbList.TryGetValue($"3d/motion/event/body/chara/chr{id}_00/anm_eve_chr{id}_00_idle01_loop", out UmaDatabaseEntry entry))
|
||||||
{
|
{
|
||||||
@@ -512,7 +513,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
umaContainer.LoadPhysics(); //Need to load physics before loading FacialMorph
|
umaContainer.LoadPhysics(); //Need to load physics before loading FacialMorph
|
||||||
umaContainer.SetDynamicBoneEnable(UI.DynamicBoneEnable);
|
umaContainer.SetDynamicBoneEnable(ModelSettings.DynamicBoneEnable);
|
||||||
|
|
||||||
//Load FacialMorph
|
//Load FacialMorph
|
||||||
umaContainer.LoadFaceMorph(id, costumeId);
|
umaContainer.LoadFaceMorph(id, costumeId);
|
||||||
@@ -522,12 +523,12 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
umaContainer.EyeHeight = umaContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
umaContainer.EyeHeight = umaContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
||||||
umaContainer.MergeModel();
|
umaContainer.MergeModel();
|
||||||
umaContainer.SetHeight(-1);
|
umaContainer.SetHeight(-1);
|
||||||
umaContainer.Initialize(!UI.isTPose);
|
umaContainer.Initialize(!ModelSettings.IsTPose);
|
||||||
|
|
||||||
umaContainer.Position = umaContainer.transform.Find("Position");
|
umaContainer.Position = umaContainer.transform.Find("Position");
|
||||||
umaContainer.SetupBoneHandles();
|
umaContainer.SetupBoneHandles();
|
||||||
|
|
||||||
if (!UI.isTPose && loadMotion)
|
if (!ModelSettings.IsTPose && loadMotion)
|
||||||
{
|
{
|
||||||
if (Main.AbList.TryGetValue($"3d/motion/event/body/type00/anm_eve_type00_homestand{personality.PadLeft(2, '0')}_loop", out UmaDatabaseEntry entry))
|
if (Main.AbList.TryGetValue($"3d/motion/event/body/type00/anm_eve_type00_homestand{personality.PadLeft(2, '0')}_loop", out UmaDatabaseEntry entry))
|
||||||
{
|
{
|
||||||
@@ -795,7 +796,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
var tmp = CurrentAudioSources[0];
|
var tmp = CurrentAudioSources[0];
|
||||||
CurrentAudioSources.Clear();
|
CurrentAudioSources.Clear();
|
||||||
Destroy(tmp.gameObject);
|
Destroy(tmp.gameObject);
|
||||||
UI.ResetAudioPlayer();
|
UI.AudioSettings.ResetPlayer();
|
||||||
}
|
}
|
||||||
if (subindex == -1)
|
if (subindex == -1)
|
||||||
{
|
{
|
||||||
@@ -994,11 +995,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
if (CurrentUMAContainer != null)
|
if (CurrentUMAContainer != null)
|
||||||
{
|
{
|
||||||
//It seems that OnDestroy will executed after new model loaded, which cause new FacialPanels empty...
|
//It seems that OnDestroy will executed after new model loaded, which cause new FacialPanels empty...
|
||||||
UmaViewerUI.Instance.currentFaceDrivenKeyTarget = null;
|
UI.currentFaceDrivenKeyTarget = null;
|
||||||
UmaViewerUI.Instance.LoadEmotionPanels(null);
|
UI.LoadEmotionPanels(null);
|
||||||
UmaViewerUI.Instance.LoadFacialPanels(null);
|
UI.LoadFacialPanels(null);
|
||||||
if (UmaViewerUI.Instance.MaterialsList)
|
if (UI.ModelSettings.MaterialsList)
|
||||||
foreach (Transform t in UmaViewerUI.Instance.MaterialsList.content)
|
foreach (Transform t in UI.ModelSettings.MaterialsList.content)
|
||||||
{
|
{
|
||||||
Destroy(t.gameObject);
|
Destroy(t.gameObject);
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-494
@@ -1,21 +1,14 @@
|
|||||||
using Gallop;
|
using Gallop;
|
||||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
|
||||||
using SFB;
|
|
||||||
#endif
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using static PageManager;
|
|
||||||
using Debug = UnityEngine.Debug;
|
|
||||||
|
|
||||||
public class UmaViewerUI : MonoBehaviour
|
public class UmaViewerUI : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -47,7 +40,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public ScrollRect PropList;
|
public ScrollRect PropList;
|
||||||
public PageManager PropPageCtrl;
|
public PageManager PropPageCtrl;
|
||||||
public ScrollRect SceneList;
|
public ScrollRect SceneList;
|
||||||
public ScrollRect MaterialsList;
|
|
||||||
public PageManager ScenePageCtrl;
|
public PageManager ScenePageCtrl;
|
||||||
public ScrollRect MessageScrollRect;
|
public ScrollRect MessageScrollRect;
|
||||||
public Text MessageText;
|
public Text MessageText;
|
||||||
@@ -72,28 +64,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
[Header("pose mode")]
|
[Header("pose mode")]
|
||||||
public Transform HandlesPanel;
|
public Transform HandlesPanel;
|
||||||
|
|
||||||
[Header("audio")]
|
|
||||||
public Slider AudioSlider;
|
|
||||||
public Button AudioPlayButton;
|
|
||||||
public TextMeshProUGUI TitleText;
|
|
||||||
public TextMeshProUGUI ProgressText;
|
|
||||||
public Text LyricsText;
|
|
||||||
|
|
||||||
[Header("animations")]
|
|
||||||
public Slider AnimationSlider;
|
|
||||||
public Slider AnimationSpeedSlider;
|
|
||||||
public Button AnimationPlayButton;
|
|
||||||
public TextMeshProUGUI AnimationTitleText;
|
|
||||||
public TextMeshProUGUI AnimationSpeedText;
|
|
||||||
public TextMeshProUGUI AnimationProgressText;
|
|
||||||
|
|
||||||
[Header("backgrounds")]
|
|
||||||
public ScrollRect BackGroundList;
|
|
||||||
public PageManager BackGroundPageCtrl;
|
|
||||||
public GameObject BG_Canvas;
|
|
||||||
public GameObject BG_HSVPickerObj;
|
|
||||||
public Image BG_Image;
|
|
||||||
|
|
||||||
[Header("live settings")]
|
[Header("live settings")]
|
||||||
public Sprite CharaIconDefault;
|
public Sprite CharaIconDefault;
|
||||||
public Sprite CostumeIconDefault;
|
public Sprite CostumeIconDefault;
|
||||||
@@ -107,22 +77,13 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
private LiveEntry currentLive;
|
private LiveEntry currentLive;
|
||||||
|
|
||||||
[Header("settings")]
|
[Header("settings")]
|
||||||
public TMP_InputField SSWidth;
|
public UISettingsCamera CameraSettings;
|
||||||
public TMP_InputField SSHeight;
|
public UISettingsModel ModelSettings;
|
||||||
public Toggle SSTransparent;
|
public UISettingsSound AudioSettings;
|
||||||
public TMP_InputField GifWidth;
|
public UISettingsAnimation AnimationSettings;
|
||||||
public TMP_InputField GifHeight;
|
public UISettingsScreenshot ScreenshotSettings;
|
||||||
public Toggle GifTransparent;
|
public UISettingsAssets AssetSettings;
|
||||||
public Slider GifQuality;
|
public UISettingsOther OtherSettings;
|
||||||
public TextMeshProUGUI GifQualityLabel;
|
|
||||||
public Slider GifSlider;
|
|
||||||
public Button GifButton;
|
|
||||||
public Button VMDButton;
|
|
||||||
public Button UpdateDBButton;
|
|
||||||
public TMP_Dropdown RegionDropdown;
|
|
||||||
public TMP_Dropdown WorkModeDropdown;
|
|
||||||
public TMP_Dropdown LanguageDropdown;
|
|
||||||
public TMP_Dropdown AntialiasingDropdown;
|
|
||||||
public List<GameObject> TogglablePanels = new List<GameObject>();
|
public List<GameObject> TogglablePanels = new List<GameObject>();
|
||||||
public List<GameObject> TogglableFacials = new List<GameObject>();
|
public List<GameObject> TogglableFacials = new List<GameObject>();
|
||||||
|
|
||||||
@@ -133,17 +94,8 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public GameObject UmaContainerSliderPrefab;
|
public GameObject UmaContainerSliderPrefab;
|
||||||
public UmaUIContainer UmaContainerTogglePrefab;
|
public UmaUIContainer UmaContainerTogglePrefab;
|
||||||
|
|
||||||
private Dictionary<string, Entry> LoadedAssetEntries = new Dictionary<string, Entry>();
|
|
||||||
public PageManager LoadedAssetPageCtrl;
|
|
||||||
public ScrollRect LoadedAssetScrollRect;
|
|
||||||
|
|
||||||
public Color UIColor1, UIColor2;
|
public Color UIColor1, UIColor2;
|
||||||
|
|
||||||
public bool isHeadFix = false;
|
|
||||||
public bool isTPose = false;
|
|
||||||
public bool DynamicBoneEnable = true;
|
|
||||||
public bool EnableEyeTracking = true;
|
|
||||||
public bool EnableFaceOverride = true;
|
|
||||||
public string CurrentHeadCostumeId = string.Empty;
|
public string CurrentHeadCostumeId = string.Empty;
|
||||||
|
|
||||||
[Header("Live")]
|
[Header("Live")]
|
||||||
@@ -155,28 +107,18 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
|
|
||||||
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
|
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
|
||||||
|
|
||||||
private IEnumerator UpdateResVerCoroutine;
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
AudioPlayButton.onClick.AddListener(PauseAudio);
|
|
||||||
AudioSlider.onValueChanged.AddListener(AudioProgressChange);
|
|
||||||
AnimationPlayButton.onClick.AddListener(AnimationPause);
|
|
||||||
AnimationSlider.onValueChanged.AddListener(AnimationProgressChange);
|
|
||||||
AnimationSpeedSlider.onValueChanged.AddListener(AnimationSpeedChange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
WorkModeDropdown.SetValueWithoutNotify((int)Config.Instance.WorkMode);
|
OtherSettings.ApplySettings();
|
||||||
RegionDropdown.SetValueWithoutNotify((int)Config.Instance.Region);
|
CameraSettings.AAModeDropdown.SetValueWithoutNotify(Config.Instance.AntiAliasing);
|
||||||
LanguageDropdown.SetValueWithoutNotify((int)Config.Instance.Language);
|
AssetSettings.LoadedAssetsClear();
|
||||||
AntialiasingDropdown.SetValueWithoutNotify(Config.Instance.AntiAliasing);
|
UmaAssetManager.OnLoadedBundleUpdate += AssetSettings.LoadedAssetsAdd;
|
||||||
UpdateDBButton.interactable = (Config.Instance.WorkMode == WorkMode.Standalone);
|
UmaAssetManager.OnLoadedBundleClear += AssetSettings.LoadedAssetsClear;
|
||||||
LoadedAssetsClear();
|
|
||||||
UmaAssetManager.OnLoadedBundleUpdate += LoadedAssetsAdd;
|
|
||||||
UmaAssetManager.OnLoadedBundleClear += LoadedAssetsClear;
|
|
||||||
|
|
||||||
PoseManager.LoadLocalPoseFiles();
|
PoseManager.LoadLocalPoseFiles();
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
@@ -187,8 +129,8 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
UmaAssetManager.OnLoadedBundleUpdate -= LoadedAssetsAdd;
|
UmaAssetManager.OnLoadedBundleUpdate -= AssetSettings.LoadedAssetsAdd;
|
||||||
UmaAssetManager.OnLoadedBundleClear -= LoadedAssetsClear;
|
UmaAssetManager.OnLoadedBundleClear -= AssetSettings.LoadedAssetsClear;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@@ -198,38 +140,22 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
||||||
if (MianSource.clip)
|
if (MianSource.clip)
|
||||||
{
|
{
|
||||||
TitleText.text = MianSource.clip.name;
|
AudioSettings.UpdateTrack(MianSource);
|
||||||
ProgressText.text = string.Format("{0} / {1}", ToTimeFormat(MianSource.time), ToTimeFormat(MianSource.clip.length));
|
|
||||||
AudioSlider.SetValueWithoutNotify(MianSource.time / MianSource.clip.length);
|
|
||||||
LyricsText.text = UmaUtility.GetCurrentLyrics(MianSource.time, Builder.CurrentLyrics);
|
|
||||||
LyricsText.text = LyricsText.text;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var umaContainer = Builder.CurrentUMAContainer;
|
var umaContainer = Builder.CurrentUMAContainer;
|
||||||
if (umaContainer != null && umaContainer.OverrideController != null)
|
if (umaContainer != null && umaContainer.OverrideController != null)
|
||||||
{
|
{
|
||||||
if (umaContainer.OverrideController["clip_2"].name != "clip_2")
|
AnimationSettings.UpdateAnimationInfo(umaContainer);
|
||||||
{
|
|
||||||
bool isLoop = umaContainer.OverrideController["clip_2"].name.Contains("_loop");
|
|
||||||
var AnimeState = umaContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0);
|
|
||||||
var AnimeClip = umaContainer.OverrideController["clip_2"];
|
|
||||||
if (AnimeClip && umaContainer.UmaAnimator.speed != 0)
|
|
||||||
{
|
|
||||||
var normalizedTime = (isLoop) ? Mathf.Repeat(AnimeState.normalizedTime, 1) : Mathf.Min(AnimeState.normalizedTime, 1);
|
|
||||||
AnimationTitleText.text = AnimeClip.name;
|
|
||||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
|
||||||
AnimationSlider.SetValueWithoutNotify(normalizedTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Some settings may not be saved when set in Start()</summary>
|
/// <summary>Some settings may not be saved when set in Start()</summary>
|
||||||
private IEnumerator ApplyGraphicsSettings()
|
public IEnumerator ApplyGraphicsSettings()
|
||||||
{
|
{
|
||||||
yield return 0;
|
yield return 0;
|
||||||
ChangeAntiAliasing(Config.Instance.AntiAliasing);
|
CameraSettings.ChangeAntiAliasing(Config.Instance.AntiAliasing);
|
||||||
GraphicsSettings.renderPipelineAsset = Config.Instance.Region == Region.Global ? null : UmaViewerMain.Instance.DefaultRenderPipeline;
|
GraphicsSettings.renderPipelineAsset = Config.Instance.Region == Region.Global ? null : UmaViewerMain.Instance.DefaultRenderPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,49 +168,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadedAssetsAdd(UmaDatabaseEntry entry)
|
|
||||||
{
|
|
||||||
if (!LoadedAssetPageCtrl) return;
|
|
||||||
if (LoadedAssetEntries.ContainsKey(entry.Name)) return;
|
|
||||||
var file_name = Path.GetFileName(entry.Name);
|
|
||||||
string filePath = entry.FilePath.Replace("/", "\\");
|
|
||||||
var assetentry = new Entry()
|
|
||||||
{
|
|
||||||
Name = file_name,
|
|
||||||
FontSize = 18,
|
|
||||||
OnClick = (container) =>
|
|
||||||
{
|
|
||||||
Process.Start("explorer.exe", "/select," + filePath);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
LoadedAssetEntries.Add(entry.Name, assetentry);
|
|
||||||
LoadedAssetPageCtrl.AddEntries(assetentry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadedAssetsClear()
|
|
||||||
{
|
|
||||||
LoadedAssetEntries.Clear();
|
|
||||||
if (LoadedAssetPageCtrl)
|
|
||||||
{
|
|
||||||
LoadedAssetPageCtrl.ResetCtrl();
|
|
||||||
LoadedAssetPageCtrl.Initialize(LoadedAssetEntries.Values.ToList(), LoadedAssetScrollRect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CopyAllLoadedAssetsPath()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
foreach(var entry in LoadedAssetEntries.Keys)
|
|
||||||
{
|
|
||||||
if (Main.AbList.TryGetValue(entry, out var asset))
|
|
||||||
{
|
|
||||||
sb.AppendLine(asset.FilePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GUIUtility.systemCopyBuffer = sb.ToString();
|
|
||||||
ShowMessage($"{LoadedAssetEntries.Count} Path copied", UIMessageType.Success);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadModelPanels()
|
public void LoadModelPanels()
|
||||||
{
|
{
|
||||||
var containerG = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
|
var containerG = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||||
@@ -645,7 +528,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
if (selectlist != null)
|
if (selectlist != null)
|
||||||
{
|
{
|
||||||
LiveTime = true;
|
LiveTime = true;
|
||||||
SetEyeTrackingEnable(false);
|
ModelSettings.SetEyeTrackingEnable(false);
|
||||||
Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist));
|
Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist));
|
||||||
LiveSelectPannel.SetActive(false);
|
LiveSelectPannel.SetActive(false);
|
||||||
}
|
}
|
||||||
@@ -801,7 +684,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith("3d/chara/tail")));
|
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith("3d/chara/tail")));
|
||||||
list.Add(Main.AbList["3d/animator/drivenkeylocator"]);
|
list.Add(Main.AbList["3d/animator/drivenkeylocator"]);
|
||||||
var motion_path = $"3d/motion/event/body/chara/chr{chara.Id}_00/anm_eve_chr{chara.Id}_00_idle01_loop";
|
var motion_path = $"3d/motion/event/body/chara/chr{chara.Id}_00/anm_eve_chr{chara.Id}_00_idle01_loop";
|
||||||
if (!chara.IsMob && !isHeadFix && Main.AbList.TryGetValue(motion_path, out var motion_entry))
|
if (!chara.IsMob && !ModelSettings.IsHeadFix && Main.AbList.TryGetValue(motion_path, out var motion_entry))
|
||||||
{
|
{
|
||||||
list.Add(motion_entry);
|
list.Add(motion_entry);
|
||||||
}
|
}
|
||||||
@@ -1001,47 +884,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBackgrounds()
|
|
||||||
{
|
|
||||||
var pageentrys = new List<PageManager.Entry>();
|
|
||||||
foreach (var entry in Main.AbList.Where(a => a.Key.StartsWith("bg/bg")))
|
|
||||||
{
|
|
||||||
var pageentry = new PageManager.Entry();
|
|
||||||
pageentry.Name = Path.GetFileName(entry.Key);
|
|
||||||
pageentry.Sprite = Builder.LoadSprite(entry.Value);
|
|
||||||
if (pageentry.Sprite == null) continue;
|
|
||||||
pageentry.OnClick = (container) =>
|
|
||||||
{
|
|
||||||
HighlightChildImage(BackGroundList.content, container);
|
|
||||||
BG_Image.sprite = pageentry.Sprite;
|
|
||||||
BG_Image.SetVerticesDirty();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (BG_Image.sprite == null)
|
|
||||||
{
|
|
||||||
BG_Image.sprite = pageentry.Sprite;
|
|
||||||
BG_Image.SetVerticesDirty();
|
|
||||||
}
|
|
||||||
pageentrys.Add(pageentry);
|
|
||||||
}
|
|
||||||
BackGroundPageCtrl.Initialize(pageentrys, BackGroundList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetHeadFix(bool value)
|
|
||||||
{
|
|
||||||
isHeadFix = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetTPose(bool value)
|
|
||||||
{
|
|
||||||
isTPose = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateGifQualityLabel(float value)
|
|
||||||
{
|
|
||||||
GifQualityLabel.text = $"Quality: {(int)value} (default: 10)";
|
|
||||||
}
|
|
||||||
|
|
||||||
string getCharaName(string id)
|
string getCharaName(string id)
|
||||||
{
|
{
|
||||||
var entry = Main.Characters.FirstOrDefault(a => a.Id.ToString().Equals(id));
|
var entry = Main.Characters.FirstOrDefault(a => a.Id.ToString().Equals(id));
|
||||||
@@ -1088,12 +930,12 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
{
|
{
|
||||||
var container = Builder.CurrentUMAContainer;
|
var container = Builder.CurrentUMAContainer;
|
||||||
if (!container || !container.UmaAnimator) return;
|
if (!container || !container.UmaAnimator) return;
|
||||||
AnimationSlider.SetValueWithoutNotify(0);
|
AnimationSettings.ProgressSlider.SetValueWithoutNotify(0);
|
||||||
// Reset settings by Panel
|
// Reset settings by Panel
|
||||||
container.UmaAnimator.speed = AnimationSpeedSlider.value;
|
container.UmaAnimator.speed = AnimationSettings.SpeedSlider.value;
|
||||||
Builder.AnimationCameraAnimator.speed = AnimationSpeedSlider.value;
|
Builder.AnimationCameraAnimator.speed = AnimationSettings.SpeedSlider.value;
|
||||||
if (container.UmaFaceAnimator)
|
if (container.UmaFaceAnimator)
|
||||||
container.UmaFaceAnimator.speed = AnimationSpeedSlider.value;
|
container.UmaFaceAnimator.speed = AnimationSettings.SpeedSlider.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>
|
||||||
@@ -1126,221 +968,11 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeBackground(int index)
|
|
||||||
{
|
|
||||||
BackGroundPageCtrl.ResetCtrl();
|
|
||||||
switch (index)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
Camera.main.clearFlags = CameraClearFlags.Skybox;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Camera.main.clearFlags = CameraClearFlags.SolidColor;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Camera.main.clearFlags = CameraClearFlags.SolidColor;
|
|
||||||
ListBackgrounds();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Camera.main.clearFlags = CameraClearFlags.Skybox;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
BG_HSVPickerObj.SetActive(index != 2);
|
|
||||||
BG_Canvas.SetActive(index == 2);
|
|
||||||
BackGroundPageCtrl.transform.parent.gameObject.SetActive(index == 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeBackgroundColor(Color color)
|
|
||||||
{
|
|
||||||
Camera.main.backgroundColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetDynamicBoneEnable(bool isOn)
|
|
||||||
{
|
|
||||||
DynamicBoneEnable = isOn;
|
|
||||||
Builder.CurrentUMAContainer?.SetDynamicBoneEnable(isOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetEyeTrackingEnable(bool isOn)
|
|
||||||
{
|
|
||||||
EnableEyeTracking = isOn;
|
|
||||||
Builder.CurrentUMAContainer?.SetEyeTracking(isOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetFaceOverrideEnable(bool isOn)
|
|
||||||
{
|
|
||||||
EnableFaceOverride = isOn;
|
|
||||||
Builder.CurrentUMAContainer?.SetFaceOverrideData(isOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PauseAudio()
|
|
||||||
{
|
|
||||||
var sources = Builder.CurrentAudioSources;
|
|
||||||
if (sources.Count > 0)
|
|
||||||
{
|
|
||||||
AudioSource MainSource = sources[0];
|
|
||||||
var state = MainSource.isPlaying;
|
|
||||||
foreach (AudioSource source in sources)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
{
|
|
||||||
source.Pause();
|
|
||||||
}
|
|
||||||
else if (source.clip)
|
|
||||||
{
|
|
||||||
source.Play();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
source.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopAudio()
|
|
||||||
{
|
|
||||||
var sources = Builder.CurrentAudioSources;
|
|
||||||
foreach (AudioSource source in sources)
|
|
||||||
{
|
|
||||||
source.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AudioProgressChange(float val)
|
|
||||||
{
|
|
||||||
if (Builder.CurrentAudioSources.Count > 0)
|
|
||||||
{
|
|
||||||
var time = Builder.CurrentAudioSources[0].clip.length * val;
|
|
||||||
foreach (AudioSource source in Builder.CurrentAudioSources)
|
|
||||||
{
|
|
||||||
if (source.clip)
|
|
||||||
{
|
|
||||||
source.time = Mathf.Clamp(time, 0, source.clip.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AnimationPause()
|
|
||||||
{
|
|
||||||
var container = Builder.CurrentUMAContainer;
|
|
||||||
if (!container || !container.UmaAnimator) return;
|
|
||||||
if (Builder.OverrideController.animationClips.Length == 0) return;
|
|
||||||
|
|
||||||
var animator = container.UmaAnimator;
|
|
||||||
var animator_face = container.UmaFaceAnimator;
|
|
||||||
var animator_cam = Builder.AnimationCameraAnimator;
|
|
||||||
var AnimeState = animator.GetCurrentAnimatorStateInfo(0);
|
|
||||||
var state = animator.speed > 0f;
|
|
||||||
if (state)
|
|
||||||
{
|
|
||||||
animator.speed = 0;
|
|
||||||
if (animator_face)
|
|
||||||
animator_face.speed = 0;
|
|
||||||
animator_cam.speed = 0;
|
|
||||||
}
|
|
||||||
else if (AnimeState.normalizedTime < 1f)
|
|
||||||
{
|
|
||||||
animator.speed = AnimationSpeedSlider.value;
|
|
||||||
animator_cam.speed = AnimationSpeedSlider.value;
|
|
||||||
if (animator_face)
|
|
||||||
animator_face.speed = AnimationSpeedSlider.value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
animator.speed = AnimationSpeedSlider.value;
|
|
||||||
animator.Play(0, 0, 0);
|
|
||||||
animator.Play(0, 2, 0);
|
|
||||||
animator_cam.speed = AnimationSpeedSlider.value;
|
|
||||||
animator_cam.Play(0, -1, 0);
|
|
||||||
if (animator_face)
|
|
||||||
{
|
|
||||||
animator_face.speed = AnimationSpeedSlider.value;
|
|
||||||
animator_face.Play(0, 0, 0);
|
|
||||||
animator_face.Play(0, 1, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AnimationProgressChange(float val)
|
|
||||||
{
|
|
||||||
var container = Builder.CurrentUMAContainer;
|
|
||||||
if (!container) return;
|
|
||||||
var animator = container.UmaAnimator;
|
|
||||||
var animator_face = container.UmaFaceAnimator;
|
|
||||||
var animator_cam = Builder.AnimationCameraAnimator;
|
|
||||||
if (animator != null)
|
|
||||||
{
|
|
||||||
var AnimeClip = container.OverrideController["clip_2"];
|
|
||||||
|
|
||||||
// Pause and Seek;
|
|
||||||
animator.speed = 0;
|
|
||||||
animator.Play(0, 0, val);
|
|
||||||
animator.Play(0, 2, val);
|
|
||||||
if (animator_cam.runtimeAnimatorController)
|
|
||||||
{
|
|
||||||
animator_cam.speed = 0;
|
|
||||||
animator_cam.Play(0, -1, val);
|
|
||||||
}
|
|
||||||
if (animator_face)
|
|
||||||
{
|
|
||||||
animator_face.speed = 0;
|
|
||||||
animator_face.Play(0, 0, val);
|
|
||||||
animator_face.Play(0, 1, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AnimationSpeedChange(float val)
|
|
||||||
{
|
|
||||||
var container = Builder.CurrentUMAContainer;
|
|
||||||
AnimationSpeedText.text = string.Format("Speed: {0:F2}", val);
|
|
||||||
|
|
||||||
if (!container || !container.UmaAnimator) return;
|
|
||||||
|
|
||||||
container.UmaAnimator.speed = val;
|
|
||||||
Builder.AnimationCameraAnimator.speed = val;
|
|
||||||
if (container.UmaFaceAnimator)
|
|
||||||
{
|
|
||||||
container.UmaFaceAnimator.speed = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetAudioPlayer()
|
|
||||||
{
|
|
||||||
TitleText.text = "No Audio";
|
|
||||||
ProgressText.text = "00:00:00 / 00:00:00";
|
|
||||||
AudioSlider.SetValueWithoutNotify(0);
|
|
||||||
LyricsText.text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ToTimeFormat(float time)
|
|
||||||
{
|
|
||||||
int seconds = (int)time;
|
|
||||||
int hour = seconds / 3600;
|
|
||||||
int minute = seconds % 3600 / 60;
|
|
||||||
seconds = seconds % 3600 % 60;
|
|
||||||
return string.Format("{0:D2}:{1:D2}:{2:D2}", hour, minute, seconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ToFrameFormat(float time, float frameRate)
|
|
||||||
{
|
|
||||||
int frames = Mathf.FloorToInt(time % 1 * frameRate);
|
|
||||||
int seconds = (int)time;
|
|
||||||
int minute = seconds % 3600 / 60;
|
|
||||||
seconds = seconds % 3600 % 60;
|
|
||||||
return string.Format("{0:D2}m:{1:D2}s:{2:D2}f", minute, seconds, frames);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RecordVMD()
|
public void RecordVMD()
|
||||||
{
|
{
|
||||||
var container = Builder.CurrentUMAContainer;
|
var container = Builder.CurrentUMAContainer;
|
||||||
var camera = Builder.AnimationCamera;
|
var camera = Builder.AnimationCamera;
|
||||||
var buttonText = VMDButton.GetComponentInChildren<TextMeshProUGUI>();
|
var buttonText = AnimationSettings.VMDButton.GetComponentInChildren<TextMeshProUGUI>();
|
||||||
|
|
||||||
if (!container || container.IsMini)
|
if (!container || container.IsMini)
|
||||||
{
|
{
|
||||||
@@ -1443,91 +1075,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateGameDB()
|
|
||||||
{
|
|
||||||
if (UpdateResVerCoroutine != null && Config.Instance.WorkMode != WorkMode.Standalone) return;
|
|
||||||
UmaDatabaseController.Instance.CloseAllConnection();
|
|
||||||
ManifestDB dB = new ManifestDB();
|
|
||||||
UpdateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg, UIMessageType type) { ShowMessage(msg, type); });
|
|
||||||
StartCoroutine(UpdateResVerCoroutine);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeLanguage(int lang)
|
|
||||||
{
|
|
||||||
if ((int)Config.Instance.Language != lang)
|
|
||||||
{
|
|
||||||
Config.Instance.Language = (Language)lang;
|
|
||||||
Config.Instance.UpdateConfig(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeRegion(int region)
|
|
||||||
{
|
|
||||||
if ((int)Config.Instance.Region != region)
|
|
||||||
{
|
|
||||||
Config.Instance.Region = (Region)region;
|
|
||||||
Config.Instance.UpdateConfig(false);
|
|
||||||
StartCoroutine(ApplyGraphicsSettings());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Converts values 1-4 to valid AA values </summary>
|
|
||||||
public void ChangeAntiAliasing(int value)
|
|
||||||
{
|
|
||||||
int[] aaValues = { 0, 2, 4, 8 };
|
|
||||||
|
|
||||||
QualitySettings.antiAliasing = aaValues[value];
|
|
||||||
|
|
||||||
if (Config.Instance.AntiAliasing != value)
|
|
||||||
{
|
|
||||||
Config.Instance.AntiAliasing = value;
|
|
||||||
Config.Instance.UpdateConfig(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeWorkMode(int mode)
|
|
||||||
{
|
|
||||||
if ((int)Config.Instance.WorkMode != mode)
|
|
||||||
{
|
|
||||||
Config.Instance.WorkMode = (WorkMode)mode;
|
|
||||||
Config.Instance.UpdateConfig(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeDataPath()
|
|
||||||
{
|
|
||||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
|
||||||
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
|
|
||||||
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
|
|
||||||
{
|
|
||||||
if (path[0] != Config.Instance.MainPath)
|
|
||||||
{
|
|
||||||
Config.Instance.MainPath = path[0];
|
|
||||||
Config.Instance.UpdateConfig(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenConfig()
|
|
||||||
{
|
|
||||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
|
||||||
if (File.Exists(Config.configPath))
|
|
||||||
{
|
|
||||||
Process.Start(new ProcessStartInfo()
|
|
||||||
{
|
|
||||||
FileName = Config.configPath,
|
|
||||||
UseShellExecute = true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeOutlineWidth(float val)
|
|
||||||
{
|
|
||||||
Shader.SetGlobalFloat("_GlobalOutlineWidth", val);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetLiveRecordMode(bool val) { isRecordVMD = val; }
|
public void SetLiveRecordMode(bool val) { isRecordVMD = val; }
|
||||||
|
|
||||||
public void SetLiveRequireStage(bool val) { isRequireStage = val; }
|
public void SetLiveRequireStage(bool val) { isRequireStage = val; }
|
||||||
@@ -1547,22 +1094,6 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
MessageScrollRect.verticalNormalizedPosition = 0;
|
MessageScrollRect.verticalNormalizedPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExportModel()
|
|
||||||
{
|
|
||||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
|
||||||
var container = Builder.CurrentUMAContainer;
|
|
||||||
if (container)
|
|
||||||
{
|
|
||||||
var entry = container.CharaEntry;
|
|
||||||
var path = StandaloneFileBrowser.SaveFilePanel("Save PMX File", Config.Instance.MainPath, $"{entry.Id}_{entry.GetName()}", "pmx");
|
|
||||||
if (!string.IsNullOrEmpty(path))
|
|
||||||
{
|
|
||||||
ModelExporter.ExportModel(container, path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ToggleVisible(GameObject go)
|
public void ToggleVisible(GameObject go)
|
||||||
{
|
{
|
||||||
go.SetActive(!go.activeSelf);
|
go.SetActive(!go.activeSelf);
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ namespace uGIF
|
|||||||
{
|
{
|
||||||
bytes = null;
|
bytes = null;
|
||||||
stop = false;
|
stop = false;
|
||||||
UmaViewerUI.Instance.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Recording...";
|
UmaViewerUI.Instance.ScreenshotSettings.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Recording...";
|
||||||
yield return new WaitForSeconds(0.1f);
|
yield return new WaitForSeconds(0.1f);
|
||||||
yield return _Encode(fps, quality);
|
yield return _Encode(fps, quality);
|
||||||
UmaViewerUI.Instance.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Saving gif...";
|
UmaViewerUI.Instance.ScreenshotSettings.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Saving gif...";
|
||||||
yield return new WaitForSeconds(0.1f);
|
yield return new WaitForSeconds(0.1f);
|
||||||
yield return WaitForBytes();
|
yield return WaitForBytes();
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ namespace uGIF
|
|||||||
UmaViewerUI.Instance.ShowMessage($"GIF saved: {fullpath}", UIMessageType.Success);
|
UmaViewerUI.Instance.ShowMessage($"GIF saved: {fullpath}", UIMessageType.Success);
|
||||||
Frames.Clear();
|
Frames.Clear();
|
||||||
stop = false;
|
stop = false;
|
||||||
UmaViewerUI.Instance.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Record GIF";
|
UmaViewerUI.Instance.ScreenshotSettings.GifButton.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Record GIF";
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator _Encode (float fps, int quality)
|
public IEnumerator _Encode (float fps, int quality)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ PlayerSettings:
|
|||||||
loadStoreDebugModeEnabled: 0
|
loadStoreDebugModeEnabled: 0
|
||||||
visionOSBundleVersion: 1.0
|
visionOSBundleVersion: 1.0
|
||||||
tvOSBundleVersion: 1.0
|
tvOSBundleVersion: 1.0
|
||||||
bundleVersion: 2.1.26
|
bundleVersion: 2.1.27
|
||||||
preloadedAssets: []
|
preloadedAssets: []
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
@@ -158,6 +158,7 @@ PlayerSettings:
|
|||||||
m_ColorGamuts: 00000000
|
m_ColorGamuts: 00000000
|
||||||
targetPixelDensity: 395
|
targetPixelDensity: 395
|
||||||
resolutionScalingMode: 1
|
resolutionScalingMode: 1
|
||||||
|
resetResolutionOnWindowResize: 0
|
||||||
androidSupportedAspectRatio: 1
|
androidSupportedAspectRatio: 1
|
||||||
androidMaxAspectRatio: 2.1
|
androidMaxAspectRatio: 2.1
|
||||||
applicationIdentifier:
|
applicationIdentifier:
|
||||||
@@ -624,8 +625,11 @@ PlayerSettings:
|
|||||||
switchNetworkInterfaceManagerInitializeEnabled: 1
|
switchNetworkInterfaceManagerInitializeEnabled: 1
|
||||||
switchDisableHTCSPlayerConnection: 0
|
switchDisableHTCSPlayerConnection: 0
|
||||||
switchUseNewStyleFilepaths: 0
|
switchUseNewStyleFilepaths: 0
|
||||||
|
switchUseLegacyFmodPriorities: 0
|
||||||
switchUseMicroSleepForYield: 1
|
switchUseMicroSleepForYield: 1
|
||||||
|
switchEnableRamDiskSupport: 0
|
||||||
switchMicroSleepForYieldTime: 25
|
switchMicroSleepForYieldTime: 25
|
||||||
|
switchRamDiskSpaceSize: 12
|
||||||
ps4NPAgeRating: 12
|
ps4NPAgeRating: 12
|
||||||
ps4NPTitleSecret:
|
ps4NPTitleSecret:
|
||||||
ps4NPTrophyPackPath:
|
ps4NPTrophyPackPath:
|
||||||
@@ -818,6 +822,7 @@ PlayerSettings:
|
|||||||
metroFTAName:
|
metroFTAName:
|
||||||
metroFTAFileTypes: []
|
metroFTAFileTypes: []
|
||||||
metroProtocolName:
|
metroProtocolName:
|
||||||
|
vcxProjDefaultLanguage:
|
||||||
XboxOneProductId:
|
XboxOneProductId:
|
||||||
XboxOneUpdateKey:
|
XboxOneUpdateKey:
|
||||||
XboxOneSandboxId:
|
XboxOneSandboxId:
|
||||||
@@ -866,6 +871,7 @@ PlayerSettings:
|
|||||||
hmiCpuConfiguration:
|
hmiCpuConfiguration:
|
||||||
apiCompatibilityLevel: 6
|
apiCompatibilityLevel: 6
|
||||||
activeInputHandler: 0
|
activeInputHandler: 0
|
||||||
|
windowsGamepadBackendHint: 0
|
||||||
cloudProjectId:
|
cloudProjectId:
|
||||||
framebufferDepthMemorylessMode: 0
|
framebufferDepthMemorylessMode: 0
|
||||||
qualitySettingsNames: []
|
qualitySettingsNames: []
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!162 &1
|
|
||||||
EditorUserSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 4
|
|
||||||
m_ConfigSettings:
|
|
||||||
RecentlyUsedScenePath-0:
|
|
||||||
value: 224247031146466b011b0b2b1e30102219180c07233c2f3f23663b3aece13811c9a809cdc217100f7624cd1e2d154e10f40c1a0ee24b2f0d170bfe1a1eed5e061fcc0cdc
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-1:
|
|
||||||
value: 224247031146466b011b0b2b1e30102219180c07233c2f3f23662d26f2f0312ccfe625fde22870031d27c2133771312dfd1a471ef8021e12
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-2:
|
|
||||||
value: 224247031146466b011b0b2b1e30102219180c07233c2f3f23662d26f2f0312ccfe625fde22870031d27c21337712c3afe0f0c4bc51b020e0307fe0f1db1051d18d101
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-3:
|
|
||||||
value: 224247031146466b011b0b2b1e30102219180c07233c2f3f23662d26f2f0312ccfe625fde22870031d27c2133771313ee01e000afa4b3a021f00f40016b1051d18d101
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-4:
|
|
||||||
value: 224247031146466b011b0b2b1e30102219180c07233c2f3f23663b3aece13811c9a809cdc217100f7623e63144172a70d303044bc51c03051640e80018eb09
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-5:
|
|
||||||
value: 224247031146466b011b0b2b1e30102219180c07233c2f3f23663b3aece13811c9a809cdc217100f7634dd152f71370ddb214943de021e4b230bfc0d05f61f1d588b0dcb13dc06
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-6:
|
|
||||||
value: 22424703114646680e1c05320430102019041d651e3d282424241814ebfa3937adc22ee8ea2a33390a01ea3201701431fb1e10
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-7:
|
|
||||||
value: 22424703114646680e0b0227036c731900122b292926237e38271427fb
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-8:
|
|
||||||
value: 22424703114646680e0b0227036c6b150503563f22213229
|
|
||||||
flags: 0
|
|
||||||
RecentlyUsedScenePath-9:
|
|
||||||
value: 22424703114646680e0b0227036c691504041125227a68252320092a
|
|
||||||
flags: 0
|
|
||||||
UnityRemoteCompression:
|
|
||||||
value: 29617121
|
|
||||||
flags: 0
|
|
||||||
vcSharedLogLevel:
|
|
||||||
value: 0d5e400f0650
|
|
||||||
flags: 0
|
|
||||||
m_VCAutomaticAdd: 1
|
|
||||||
m_VCDebugCom: 0
|
|
||||||
m_VCDebugCmd: 0
|
|
||||||
m_VCDebugOut: 0
|
|
||||||
m_SemanticMergeMode: 2
|
|
||||||
m_VCShowFailedCheckout: 1
|
|
||||||
m_VCOverwriteFailedCheckoutAssets: 1
|
|
||||||
m_VCProjectOverlayIcons: 1
|
|
||||||
m_VCHierarchyOverlayIcons: 1
|
|
||||||
m_VCOtherOverlayIcons: 1
|
|
||||||
m_VCAllowAsyncUpdate: 0
|
|
||||||
Reference in New Issue
Block a user