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
|
||||
/BuildDev
|
||||
/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 UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CameraOrbit : MonoBehaviour
|
||||
{
|
||||
@@ -19,32 +18,20 @@ public class CameraOrbit : MonoBehaviour
|
||||
public EventSystem eventSystem;
|
||||
bool controlOn;
|
||||
|
||||
|
||||
[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;
|
||||
|
||||
[Header("Free Camera")]
|
||||
public GameObject FreeCamSettingsTab;
|
||||
public Slider FreeCamFovSlider;
|
||||
public Slider FreeCamRotationSlider;
|
||||
public Slider FreeCamMoveSpeedSlider;
|
||||
public Slider FreeCamRotateSpeedSlider;
|
||||
bool FreeCamLeft = false;
|
||||
bool FreeCamRight = false;
|
||||
private Quaternion lookRotation;
|
||||
|
||||
private UISettingsCamera CameraSettings => UmaViewerUI.Instance.CameraSettings;
|
||||
|
||||
void Start()
|
||||
{
|
||||
OrbitCamZoomSlider.minValue = camDistMin;
|
||||
OrbitCamZoomSlider.maxValue = camDistMax;
|
||||
CameraSettings.CameraDistance.minValue = camDistMin;
|
||||
CameraSettings.CameraDistance.maxValue = camDistMax;
|
||||
|
||||
lookRotation = transform.localRotation;
|
||||
instance = this;
|
||||
@@ -54,37 +41,25 @@ public class CameraOrbit : MonoBehaviour
|
||||
{
|
||||
if (HandleManager.InteractionInProgress) return;
|
||||
|
||||
if(CameraMode != CameraModeDropdown.value)
|
||||
bool cameraModeChanged = CameraMode != CameraSettings.CameraMode;
|
||||
if (cameraModeChanged)
|
||||
{
|
||||
switch (CameraMode) //old
|
||||
{
|
||||
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;
|
||||
CameraMode = CameraSettings.CameraMode;
|
||||
}
|
||||
|
||||
switch (CameraModeDropdown.value)
|
||||
switch (CameraMode)
|
||||
{
|
||||
case 0:
|
||||
OrbitAround();
|
||||
OrbitLight();
|
||||
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;
|
||||
|
||||
Camera.main.fieldOfView = OrbitCamFovSlider.value;
|
||||
Camera.main.fieldOfView = CameraSettings.FOV;
|
||||
Vector3 position = transform.position;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||
@@ -117,8 +92,8 @@ public class CameraOrbit : MonoBehaviour
|
||||
}
|
||||
if (Input.GetMouseButton(0) && controlOn)
|
||||
{
|
||||
position -= Input.GetAxis("Mouse X") * transform.right * OrbitCamSpeedSlider.value;
|
||||
OrbitCamHeightSlider.value -= Input.GetAxis("Mouse Y") * OrbitCamSpeedSlider.value;
|
||||
position -= Input.GetAxis("Mouse X") * transform.right * CameraSettings.MovementSpeed;
|
||||
CameraSettings.CameraHeight -= Input.GetAxis("Mouse Y") * CameraSettings.MovementSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,7 +102,7 @@ public class CameraOrbit : MonoBehaviour
|
||||
|
||||
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())
|
||||
@@ -136,25 +111,24 @@ public class CameraOrbit : MonoBehaviour
|
||||
}
|
||||
if ((Input.GetMouseButton(2) || Input.GetKey(KeyCode.LeftControl)) && CameraTargetHelper.activeSelf)
|
||||
{
|
||||
OrbitCamTargetHeightSlider.value -= Input.GetAxis("Mouse Y");
|
||||
CameraTargetHelper.transform.position = OrbitCamTargetHeightSlider.value * Vector3.up;
|
||||
CameraSettings.TargetHeight -= Input.GetAxis("Mouse Y");
|
||||
CameraTargetHelper.transform.position = CameraSettings.TargetHeight * Vector3.up;
|
||||
}
|
||||
if (Input.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.LeftControl))
|
||||
{
|
||||
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;
|
||||
OrbitCamHeightSlider.maxValue = camDist + 1 - camDist * 0.2f;
|
||||
OrbitCamHeightSlider.minValue = -camDist + 1 + camDist * 0.2f;
|
||||
Vector3 target = TargetCenter + CameraSettings.TargetHeight * Vector3.up; //set target offsets
|
||||
|
||||
Vector3 target = TargetCenter + OrbitCamTargetHeightSlider.value * Vector3.up; //set target offsets
|
||||
|
||||
position.y = TargetCenter.y + OrbitCamHeightSlider.value; //set camera height
|
||||
position.y = TargetCenter.y + CameraSettings.CameraHeight; //set camera height
|
||||
transform.position = position; //set final position of camera at target
|
||||
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
|
||||
}
|
||||
|
||||
@@ -163,9 +137,9 @@ public class CameraOrbit : MonoBehaviour
|
||||
/// </summary>
|
||||
void FreeCamera()
|
||||
{
|
||||
Camera.main.fieldOfView = FreeCamFovSlider.value;
|
||||
float moveSpeed = FreeCamMoveSpeedSlider.value;
|
||||
float rotateSpeed = FreeCamRotateSpeedSlider.value;
|
||||
Camera.main.fieldOfView = CameraSettings.FOV;
|
||||
float moveSpeed = CameraSettings.MovementSpeed;;
|
||||
float rotateSpeed = CameraSettings.RotationSpeed;
|
||||
|
||||
if (Input.GetMouseButtonDown(0) && !eventSystem.IsPointerOverGameObject())
|
||||
{
|
||||
@@ -185,7 +159,7 @@ public class CameraOrbit : MonoBehaviour
|
||||
{
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -114,10 +114,10 @@ public class PoseManager : MonoBehaviour
|
||||
{
|
||||
if (PoseModeOn) return;
|
||||
|
||||
var ui = UmaViewerUI.Instance;
|
||||
var modelSettings = UmaViewerUI.Instance.ModelSettings;
|
||||
var builder = UmaViewerBuilder.Instance;
|
||||
ui.SetEyeTrackingEnable(false);
|
||||
ui.SetDynamicBoneEnable(false);
|
||||
modelSettings.SetEyeTrackingEnable(false);
|
||||
modelSettings.SetDynamicBoneEnable(false);
|
||||
HandleCanvas.SetActive(true);
|
||||
|
||||
if (builder.CurrentUMAContainer && builder.CurrentUMAContainer.UmaAnimator)
|
||||
@@ -135,10 +135,10 @@ public class PoseManager : MonoBehaviour
|
||||
|
||||
UIPoseContainer.CreateBackupFromScene();
|
||||
|
||||
var ui = UmaViewerUI.Instance;
|
||||
var modelSettings = UmaViewerUI.Instance.ModelSettings;
|
||||
var builder = UmaViewerBuilder.Instance;
|
||||
ui.SetEyeTrackingEnable(true);
|
||||
ui.SetDynamicBoneEnable(true);
|
||||
modelSettings.SetEyeTrackingEnable(true);
|
||||
modelSettings.SetDynamicBoneEnable(true);
|
||||
HandleCanvas.SetActive(false);
|
||||
|
||||
if (builder.CurrentUMAContainer != null && builder.CurrentUMAContainer.UmaAnimator != null)
|
||||
|
||||
@@ -12,6 +12,9 @@ public class Screenshot : MonoBehaviour
|
||||
public static Screenshot Instance;
|
||||
bool recording = false;
|
||||
|
||||
static UISettingsAnimation AnimationSettings => UmaViewerUI.Instance.AnimationSettings;
|
||||
static UISettingsScreenshot ScreenshotSettings => UmaViewerUI.Instance.ScreenshotSettings;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
@@ -20,11 +23,11 @@ public class Screenshot : MonoBehaviour
|
||||
public static void TakeScreenshot()
|
||||
{
|
||||
var camera = GetActiveCamera();
|
||||
int width = int.Parse(UmaViewerUI.Instance.SSWidth.text);
|
||||
int height = int.Parse(UmaViewerUI.Instance.SSHeight.text);
|
||||
int width = ScreenshotSettings.Width;
|
||||
int height = ScreenshotSettings.Height;
|
||||
width = width == -1 ? Screen.width : width;
|
||||
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
|
||||
string fileDirectory = Application.persistentDataPath + "/../Screenshots/";
|
||||
@@ -46,9 +49,8 @@ public class Screenshot : MonoBehaviour
|
||||
{
|
||||
if (recording || UmaViewerBuilder.Instance.CurrentUMAContainer == null) return;
|
||||
recording = true;
|
||||
UmaViewerUI.Instance.GifButton.interactable = false;
|
||||
UmaViewerUI.Instance.GifSlider.value = 0;
|
||||
StartCoroutine(RecordGif(int.Parse(UmaViewerUI.Instance.GifWidth.text), int.Parse(UmaViewerUI.Instance.GifHeight.text), UmaViewerUI.Instance.GifTransparent.isOn, 10)); //(int)UmaViewerUI.Instance.GifQuality.value));
|
||||
ScreenshotSettings.GifButton.interactable = false;
|
||||
StartCoroutine(RecordGif(ScreenshotSettings.GifWidth, ScreenshotSettings.GifHeight, ScreenshotSettings.GifTransparent, 10)); //(int)UmaViewerUI.Instance.GifQuality.value));
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +70,14 @@ public class Screenshot : MonoBehaviour
|
||||
var clipFrameCount = Mathf.RoundToInt(animeClip.length * animeClip.frameRate);
|
||||
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;
|
||||
|
||||
while (frame < clipFrameCount)
|
||||
{
|
||||
UmaViewerUI.Instance.GifSlider.value = (float)frame / clipFrameCount;
|
||||
UmaViewerUI.Instance.AnimationProgressChange((float)frame / clipFrameCount);
|
||||
AnimationSettings.ChangeProgress((float)frame / clipFrameCount);
|
||||
yield return new WaitForEndOfFrame();
|
||||
var tex = GrabFrame(camera, width, height, transparent);
|
||||
CaptureToGIFCustom.Instance.Frames.Add(new Image(tex));
|
||||
@@ -84,12 +86,11 @@ public class Screenshot : MonoBehaviour
|
||||
}
|
||||
|
||||
recording = false;
|
||||
UmaViewerUI.Instance.AnimationProgressChange(0);
|
||||
UmaViewerUI.Instance.AnimationSpeedChange(1);
|
||||
AnimationSettings.ChangeProgress(0);
|
||||
AnimationSettings.ChangeSpeed(1);
|
||||
ppLayer.enabled = oldPpState;
|
||||
CaptureToGIFCustom.Instance.stop = true;
|
||||
UmaViewerUI.Instance.GifButton.interactable = true;
|
||||
UmaViewerUI.Instance.GifSlider.value = 1;
|
||||
ScreenshotSettings.GifButton.interactable = 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,
|
||||
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.Toggle.onValueChanged.AddListener((value) => { Debug.Log("e"); matHlp.ToggleMaterials(value); });
|
||||
@@ -725,7 +725,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
}
|
||||
|
||||
//Some setting for Head
|
||||
EnableEyeTracking = UI.EnableEyeTracking;
|
||||
EnableEyeTracking = UI.ModelSettings.EnableEyeTracking;
|
||||
|
||||
foreach (Renderer r in head.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
@@ -1340,7 +1340,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
public void SetEndAnimationCut()
|
||||
{
|
||||
UmaViewerUI.Instance.AnimationPause();
|
||||
UI.AnimationSettings.Pause();
|
||||
}
|
||||
|
||||
public void LoadFaceMorph(int id, string costumeId)
|
||||
@@ -1425,7 +1425,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
FaceDrivenKeyTarget = faceDriven;
|
||||
FaceDrivenKeyTarget.Container = this;
|
||||
FaceOverrideData = faceOverride;
|
||||
faceOverride?.SetEnable(UI.EnableFaceOverride);
|
||||
faceOverride?.SetEnable(UI.ModelSettings.EnableFaceOverride);
|
||||
faceDriven.DrivenKeyLocator = locator.transform;
|
||||
faceDriven.Initialize(UmaUtility.ConvertArrayToDictionary(firsehead.GetComponentsInChildren<Transform>()));
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
public static UmaViewerBuilder Instance;
|
||||
static UmaViewerMain Main => UmaViewerMain.Instance;
|
||||
static UmaViewerUI UI => UmaViewerUI.Instance;
|
||||
static UISettingsModel ModelSettings => UmaViewerUI.Instance.ModelSettings;
|
||||
|
||||
public List<AssetBundle> Loaded;
|
||||
public List<Shader> ShaderList = new List<Shader>();
|
||||
@@ -61,7 +62,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
umaContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
||||
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);
|
||||
LoadMobUma(umaContainer, CurrentHead.chara, costumeId, chara.Id, true);
|
||||
@@ -210,7 +211,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
string head_costumeId;
|
||||
int tailId = Convert.ToInt32(charaData["tail_model_id"]);
|
||||
|
||||
if (UI.isHeadFix && CurrentHead != null)
|
||||
if (ModelSettings.IsHeadFix && CurrentHead != null)
|
||||
{
|
||||
head_id = CurrentHead.id;
|
||||
head_costumeId = CurrentHead.costumeId;
|
||||
@@ -293,19 +294,19 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
|
||||
umaContainer.LoadPhysics();
|
||||
umaContainer.SetDynamicBoneEnable(UI.DynamicBoneEnable);
|
||||
umaContainer.SetDynamicBoneEnable(ModelSettings.DynamicBoneEnable);
|
||||
umaContainer.LoadFaceMorph(id, costumeId);
|
||||
umaContainer.TearControllers.ForEach(a => a.SetDir(a.CurrentDir));
|
||||
umaContainer.HeadBone = (GameObject)umaContainer.Body.GetComponent<AssetHolder>()._assetTable["head"];
|
||||
umaContainer.EyeHeight = umaContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
||||
umaContainer.MergeModel();
|
||||
umaContainer.SetHeight(-1);
|
||||
umaContainer.Initialize(!UI.isTPose);
|
||||
umaContainer.Initialize(!ModelSettings.IsTPose);
|
||||
|
||||
umaContainer.Position = umaContainer.transform.Find("Position");
|
||||
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))
|
||||
{
|
||||
@@ -512,7 +513,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
|
||||
umaContainer.LoadPhysics(); //Need to load physics before loading FacialMorph
|
||||
umaContainer.SetDynamicBoneEnable(UI.DynamicBoneEnable);
|
||||
umaContainer.SetDynamicBoneEnable(ModelSettings.DynamicBoneEnable);
|
||||
|
||||
//Load FacialMorph
|
||||
umaContainer.LoadFaceMorph(id, costumeId);
|
||||
@@ -522,12 +523,12 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
umaContainer.EyeHeight = umaContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
||||
umaContainer.MergeModel();
|
||||
umaContainer.SetHeight(-1);
|
||||
umaContainer.Initialize(!UI.isTPose);
|
||||
umaContainer.Initialize(!ModelSettings.IsTPose);
|
||||
|
||||
umaContainer.Position = umaContainer.transform.Find("Position");
|
||||
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))
|
||||
{
|
||||
@@ -795,7 +796,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
var tmp = CurrentAudioSources[0];
|
||||
CurrentAudioSources.Clear();
|
||||
Destroy(tmp.gameObject);
|
||||
UI.ResetAudioPlayer();
|
||||
UI.AudioSettings.ResetPlayer();
|
||||
}
|
||||
if (subindex == -1)
|
||||
{
|
||||
@@ -994,11 +995,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if (CurrentUMAContainer != null)
|
||||
{
|
||||
//It seems that OnDestroy will executed after new model loaded, which cause new FacialPanels empty...
|
||||
UmaViewerUI.Instance.currentFaceDrivenKeyTarget = null;
|
||||
UmaViewerUI.Instance.LoadEmotionPanels(null);
|
||||
UmaViewerUI.Instance.LoadFacialPanels(null);
|
||||
if (UmaViewerUI.Instance.MaterialsList)
|
||||
foreach (Transform t in UmaViewerUI.Instance.MaterialsList.content)
|
||||
UI.currentFaceDrivenKeyTarget = null;
|
||||
UI.LoadEmotionPanels(null);
|
||||
UI.LoadFacialPanels(null);
|
||||
if (UI.ModelSettings.MaterialsList)
|
||||
foreach (Transform t in UI.ModelSettings.MaterialsList.content)
|
||||
{
|
||||
Destroy(t.gameObject);
|
||||
}
|
||||
|
||||
+25
-494
@@ -1,21 +1,14 @@
|
||||
using Gallop;
|
||||
#if !UNITY_ANDROID || UNITY_EDITOR
|
||||
using SFB;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.UI;
|
||||
using static PageManager;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
public class UmaViewerUI : MonoBehaviour
|
||||
{
|
||||
@@ -47,7 +40,6 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public ScrollRect PropList;
|
||||
public PageManager PropPageCtrl;
|
||||
public ScrollRect SceneList;
|
||||
public ScrollRect MaterialsList;
|
||||
public PageManager ScenePageCtrl;
|
||||
public ScrollRect MessageScrollRect;
|
||||
public Text MessageText;
|
||||
@@ -72,28 +64,6 @@ public class UmaViewerUI : MonoBehaviour
|
||||
[Header("pose mode")]
|
||||
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")]
|
||||
public Sprite CharaIconDefault;
|
||||
public Sprite CostumeIconDefault;
|
||||
@@ -107,22 +77,13 @@ public class UmaViewerUI : MonoBehaviour
|
||||
private LiveEntry currentLive;
|
||||
|
||||
[Header("settings")]
|
||||
public TMP_InputField SSWidth;
|
||||
public TMP_InputField SSHeight;
|
||||
public Toggle SSTransparent;
|
||||
public TMP_InputField GifWidth;
|
||||
public TMP_InputField GifHeight;
|
||||
public Toggle GifTransparent;
|
||||
public Slider GifQuality;
|
||||
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 UISettingsCamera CameraSettings;
|
||||
public UISettingsModel ModelSettings;
|
||||
public UISettingsSound AudioSettings;
|
||||
public UISettingsAnimation AnimationSettings;
|
||||
public UISettingsScreenshot ScreenshotSettings;
|
||||
public UISettingsAssets AssetSettings;
|
||||
public UISettingsOther OtherSettings;
|
||||
public List<GameObject> TogglablePanels = new List<GameObject>();
|
||||
public List<GameObject> TogglableFacials = new List<GameObject>();
|
||||
|
||||
@@ -133,17 +94,8 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public GameObject UmaContainerSliderPrefab;
|
||||
public UmaUIContainer UmaContainerTogglePrefab;
|
||||
|
||||
private Dictionary<string, Entry> LoadedAssetEntries = new Dictionary<string, Entry>();
|
||||
public PageManager LoadedAssetPageCtrl;
|
||||
public ScrollRect LoadedAssetScrollRect;
|
||||
|
||||
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;
|
||||
|
||||
[Header("Live")]
|
||||
@@ -155,28 +107,18 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
|
||||
|
||||
private IEnumerator UpdateResVerCoroutine;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
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()
|
||||
{
|
||||
WorkModeDropdown.SetValueWithoutNotify((int)Config.Instance.WorkMode);
|
||||
RegionDropdown.SetValueWithoutNotify((int)Config.Instance.Region);
|
||||
LanguageDropdown.SetValueWithoutNotify((int)Config.Instance.Language);
|
||||
AntialiasingDropdown.SetValueWithoutNotify(Config.Instance.AntiAliasing);
|
||||
UpdateDBButton.interactable = (Config.Instance.WorkMode == WorkMode.Standalone);
|
||||
LoadedAssetsClear();
|
||||
UmaAssetManager.OnLoadedBundleUpdate += LoadedAssetsAdd;
|
||||
UmaAssetManager.OnLoadedBundleClear += LoadedAssetsClear;
|
||||
OtherSettings.ApplySettings();
|
||||
CameraSettings.AAModeDropdown.SetValueWithoutNotify(Config.Instance.AntiAliasing);
|
||||
AssetSettings.LoadedAssetsClear();
|
||||
UmaAssetManager.OnLoadedBundleUpdate += AssetSettings.LoadedAssetsAdd;
|
||||
UmaAssetManager.OnLoadedBundleClear += AssetSettings.LoadedAssetsClear;
|
||||
|
||||
PoseManager.LoadLocalPoseFiles();
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
@@ -187,8 +129,8 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
UmaAssetManager.OnLoadedBundleUpdate -= LoadedAssetsAdd;
|
||||
UmaAssetManager.OnLoadedBundleClear -= LoadedAssetsClear;
|
||||
UmaAssetManager.OnLoadedBundleUpdate -= AssetSettings.LoadedAssetsAdd;
|
||||
UmaAssetManager.OnLoadedBundleClear -= AssetSettings.LoadedAssetsClear;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -198,38 +140,22 @@ public class UmaViewerUI : MonoBehaviour
|
||||
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
||||
if (MianSource.clip)
|
||||
{
|
||||
TitleText.text = MianSource.clip.name;
|
||||
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;
|
||||
AudioSettings.UpdateTrack(MianSource);
|
||||
}
|
||||
}
|
||||
|
||||
var umaContainer = Builder.CurrentUMAContainer;
|
||||
if (umaContainer != null && umaContainer.OverrideController != null)
|
||||
{
|
||||
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);
|
||||
AnimationTitleText.text = AnimeClip.name;
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
AnimationSlider.SetValueWithoutNotify(normalizedTime);
|
||||
}
|
||||
}
|
||||
AnimationSettings.UpdateAnimationInfo(umaContainer);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Some settings may not be saved when set in Start()</summary>
|
||||
private IEnumerator ApplyGraphicsSettings()
|
||||
public IEnumerator ApplyGraphicsSettings()
|
||||
{
|
||||
yield return 0;
|
||||
ChangeAntiAliasing(Config.Instance.AntiAliasing);
|
||||
CameraSettings.ChangeAntiAliasing(Config.Instance.AntiAliasing);
|
||||
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()
|
||||
{
|
||||
var containerG = Instantiate(UmaContainerPrefab, AnimationSetList.content).GetComponent<UmaUIContainer>();
|
||||
@@ -645,7 +528,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
if (selectlist != null)
|
||||
{
|
||||
LiveTime = true;
|
||||
SetEyeTrackingEnable(false);
|
||||
ModelSettings.SetEyeTrackingEnable(false);
|
||||
Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist));
|
||||
LiveSelectPannel.SetActive(false);
|
||||
}
|
||||
@@ -801,7 +684,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith("3d/chara/tail")));
|
||||
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";
|
||||
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);
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
var entry = Main.Characters.FirstOrDefault(a => a.Id.ToString().Equals(id));
|
||||
@@ -1088,12 +930,12 @@ public class UmaViewerUI : MonoBehaviour
|
||||
{
|
||||
var container = Builder.CurrentUMAContainer;
|
||||
if (!container || !container.UmaAnimator) return;
|
||||
AnimationSlider.SetValueWithoutNotify(0);
|
||||
AnimationSettings.ProgressSlider.SetValueWithoutNotify(0);
|
||||
// Reset settings by Panel
|
||||
container.UmaAnimator.speed = AnimationSpeedSlider.value;
|
||||
Builder.AnimationCameraAnimator.speed = AnimationSpeedSlider.value;
|
||||
container.UmaAnimator.speed = AnimationSettings.SpeedSlider.value;
|
||||
Builder.AnimationCameraAnimator.speed = AnimationSettings.SpeedSlider.value;
|
||||
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>
|
||||
@@ -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()
|
||||
{
|
||||
var container = Builder.CurrentUMAContainer;
|
||||
var camera = Builder.AnimationCamera;
|
||||
var buttonText = VMDButton.GetComponentInChildren<TextMeshProUGUI>();
|
||||
var buttonText = AnimationSettings.VMDButton.GetComponentInChildren<TextMeshProUGUI>();
|
||||
|
||||
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 SetLiveRequireStage(bool val) { isRequireStage = val; }
|
||||
@@ -1547,22 +1094,6 @@ public class UmaViewerUI : MonoBehaviour
|
||||
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)
|
||||
{
|
||||
go.SetActive(!go.activeSelf);
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace uGIF
|
||||
{
|
||||
bytes = null;
|
||||
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 _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 WaitForBytes();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace uGIF
|
||||
UmaViewerUI.Instance.ShowMessage($"GIF saved: {fullpath}", UIMessageType.Success);
|
||||
Frames.Clear();
|
||||
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)
|
||||
|
||||
@@ -140,7 +140,7 @@ PlayerSettings:
|
||||
loadStoreDebugModeEnabled: 0
|
||||
visionOSBundleVersion: 1.0
|
||||
tvOSBundleVersion: 1.0
|
||||
bundleVersion: 2.1.26
|
||||
bundleVersion: 2.1.27
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
@@ -158,6 +158,7 @@ PlayerSettings:
|
||||
m_ColorGamuts: 00000000
|
||||
targetPixelDensity: 395
|
||||
resolutionScalingMode: 1
|
||||
resetResolutionOnWindowResize: 0
|
||||
androidSupportedAspectRatio: 1
|
||||
androidMaxAspectRatio: 2.1
|
||||
applicationIdentifier:
|
||||
@@ -624,8 +625,11 @@ PlayerSettings:
|
||||
switchNetworkInterfaceManagerInitializeEnabled: 1
|
||||
switchDisableHTCSPlayerConnection: 0
|
||||
switchUseNewStyleFilepaths: 0
|
||||
switchUseLegacyFmodPriorities: 0
|
||||
switchUseMicroSleepForYield: 1
|
||||
switchEnableRamDiskSupport: 0
|
||||
switchMicroSleepForYieldTime: 25
|
||||
switchRamDiskSpaceSize: 12
|
||||
ps4NPAgeRating: 12
|
||||
ps4NPTitleSecret:
|
||||
ps4NPTrophyPackPath:
|
||||
@@ -818,6 +822,7 @@ PlayerSettings:
|
||||
metroFTAName:
|
||||
metroFTAFileTypes: []
|
||||
metroProtocolName:
|
||||
vcxProjDefaultLanguage:
|
||||
XboxOneProductId:
|
||||
XboxOneUpdateKey:
|
||||
XboxOneSandboxId:
|
||||
@@ -866,6 +871,7 @@ PlayerSettings:
|
||||
hmiCpuConfiguration:
|
||||
apiCompatibilityLevel: 6
|
||||
activeInputHandler: 0
|
||||
windowsGamepadBackendHint: 0
|
||||
cloudProjectId:
|
||||
framebufferDepthMemorylessMode: 0
|
||||
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