Pose mode preparation.

Pose serialization, deserialization (no face)
UI handle system
This commit is contained in:
Katboi01
2023-12-14 01:42:30 +01:00
parent 28549bd653
commit f928a802d7
102 changed files with 8678 additions and 45 deletions
+52
View File
@@ -0,0 +1,52 @@
using Newtonsoft.Json;
using System;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class PoseManager : MonoBehaviour
{
public ScrollRect SavedPoseList;
public UIPoseContainer Pfb_PoseContainer;
private bool _isPoseMode = false;
public void LoadPoses()
{
foreach(var file in Directory.GetFiles($"{Application.dataPath}/../Poses/"))
{
Debug.Log(file);
try
{
var data = JsonConvert.DeserializeObject<PoseData>(File.ReadAllText(file));
if (data != null)
{
UIPoseContainer.Create(data);
}
}
catch(Exception e)
{
Debug.LogException(e);
Debug.LogError(file + " is not a valid pose file.");
}
}
}
public void SetPoseMode(bool value)
{
if (value == _isPoseMode) return;
if (UmaViewerBuilder.Instance.CurrentUMAContainer == null) return;
if (value)
{
_isPoseMode = true;
UmaViewerBuilder.Instance.CurrentUMAContainer.UmaAnimator.enabled = false;
}
else
{
_isPoseMode = false;
UmaViewerBuilder.Instance.CurrentUMAContainer.UmaAnimator.enabled = true;
}
}
}