Improve resource loading logic and performance
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class DeepCopy
|
|
||||||
{
|
|
||||||
public static void CopyValues<T>(T from, T to)
|
|
||||||
{
|
|
||||||
var json = JsonUtility.ToJson(from);
|
|
||||||
JsonUtility.FromJsonOverwrite(json, to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -104,25 +104,22 @@ public class UmaContainer : MonoBehaviour
|
|||||||
public void MergeModel()
|
public void MergeModel()
|
||||||
{
|
{
|
||||||
if (!Body) return;
|
if (!Body) return;
|
||||||
|
var bodyBones = Body.GetComponentInChildren<SkinnedMeshRenderer>().bones.ToDictionary(bone => bone.name, bone => bone.transform);
|
||||||
List<Transform> bodybones = new List<Transform>(Body.GetComponentInChildren<SkinnedMeshRenderer>().bones);
|
|
||||||
List<Transform> emptyBones = new List<Transform>();
|
List<Transform> emptyBones = new List<Transform>();
|
||||||
emptyBones.Add(Body.GetComponentInChildren<SkinnedMeshRenderer>().rootBone.Find("Tail_Ctrl"));
|
emptyBones.Add(Body.transform.Find("Position/Hip/Tail_Ctrl"));
|
||||||
while (Body.transform.childCount > 0)
|
while (Body.transform.childCount > 0)
|
||||||
{
|
{
|
||||||
var child = Body.transform.GetChild(0);
|
Body.transform.GetChild(0).SetParent(transform);
|
||||||
child.SetParent(transform);
|
|
||||||
}
|
}
|
||||||
Body.SetActive(false); //for debugging
|
Body.SetActive(false); //for debugging
|
||||||
|
|
||||||
|
|
||||||
//MergeHead
|
//MergeHead
|
||||||
if (Head)
|
if (Head)
|
||||||
{
|
{
|
||||||
var headskins = Head.GetComponentsInChildren<SkinnedMeshRenderer>();
|
var headskins = Head.GetComponentsInChildren<SkinnedMeshRenderer>();
|
||||||
foreach (SkinnedMeshRenderer headskin in headskins)
|
foreach (SkinnedMeshRenderer headskin in headskins)
|
||||||
{
|
{
|
||||||
emptyBones.AddRange(MergeBone(headskin, bodybones));
|
MergeBone(headskin, bodyBones,ref emptyBones);
|
||||||
}
|
}
|
||||||
var eyes = new GameObject("Eyes");
|
var eyes = new GameObject("Eyes");
|
||||||
eyes.transform.SetParent(transform);
|
eyes.transform.SetParent(transform);
|
||||||
@@ -139,7 +136,7 @@ public class UmaContainer : MonoBehaviour
|
|||||||
if (Tail)
|
if (Tail)
|
||||||
{
|
{
|
||||||
var tailskin = Tail.GetComponentInChildren<SkinnedMeshRenderer>();
|
var tailskin = Tail.GetComponentInChildren<SkinnedMeshRenderer>();
|
||||||
emptyBones.AddRange(MergeBone(tailskin, bodybones));
|
MergeBone(tailskin, bodyBones, ref emptyBones);
|
||||||
while (Tail.transform.childCount > 0)
|
while (Tail.transform.childCount > 0)
|
||||||
{
|
{
|
||||||
var child = Tail.transform.GetChild(0);
|
var child = Tail.transform.GetChild(0);
|
||||||
@@ -194,7 +191,7 @@ public class UmaContainer : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (!Head || !Hair) return;
|
if (!Head || !Hair) return;
|
||||||
|
|
||||||
List<Transform> bodybones = new List<Transform>(Head.GetComponentsInChildren<Transform>());
|
var bodyBones = Head.GetComponentInChildren<SkinnedMeshRenderer>().bones.ToDictionary(bone => bone.name, bone => bone.transform);
|
||||||
List<Transform> emptyBones = new List<Transform>();
|
List<Transform> emptyBones = new List<Transform>();
|
||||||
|
|
||||||
var headHolder = Head.GetComponent<AssetHolder>();
|
var headHolder = Head.GetComponent<AssetHolder>();
|
||||||
@@ -208,7 +205,7 @@ public class UmaContainer : MonoBehaviour
|
|||||||
foreach (SkinnedMeshRenderer hairskin in hairskins)
|
foreach (SkinnedMeshRenderer hairskin in hairskins)
|
||||||
{
|
{
|
||||||
hairskin.gameObject.transform.SetParent(Head.transform);
|
hairskin.gameObject.transform.SetParent(Head.transform);
|
||||||
emptyBones.AddRange(MergeBone(hairskin, bodybones));
|
MergeBone(hairskin, bodyBones ,ref emptyBones);
|
||||||
}
|
}
|
||||||
Hair.gameObject.SetActive(false);
|
Hair.gameObject.SetActive(false);
|
||||||
|
|
||||||
@@ -232,17 +229,15 @@ public class UmaContainer : MonoBehaviour
|
|||||||
transform.Find("Position").localScale = new Vector3(BodyScale, BodyScale, BodyScale);
|
transform.Find("Position").localScale = new Vector3(BodyScale, BodyScale, BodyScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Transform[] MergeBone(SkinnedMeshRenderer from, List<Transform> targetBones)
|
public void MergeBone(SkinnedMeshRenderer from, Dictionary<string, Transform> targetBones,ref List<Transform> emptyBones)
|
||||||
{
|
{
|
||||||
var rootbone = targetBones.FindLast(a => a.name.Equals(from.rootBone.name));
|
var rootbone = targetBones[from.rootBone.name];
|
||||||
if (rootbone) from.rootBone = rootbone;
|
if (rootbone) from.rootBone = rootbone;
|
||||||
|
|
||||||
List<Transform> emptyBones = new List<Transform>();
|
|
||||||
Transform[] tmpBone = new Transform[from.bones.Length];
|
Transform[] tmpBone = new Transform[from.bones.Length];
|
||||||
for (int i = 0; i < tmpBone.Length; i++)
|
for (int i = 0; i < tmpBone.Length; i++)
|
||||||
{
|
{
|
||||||
var targetbone = targetBones.FindLast(a => a.name.Equals(from.bones[i].name));
|
if (targetBones.TryGetValue(from.bones[i].name, out Transform targetbone))
|
||||||
if (targetbone)
|
|
||||||
{
|
{
|
||||||
tmpBone[i] = targetbone;
|
tmpBone[i] = targetbone;
|
||||||
from.bones[i].position = targetbone.position;
|
from.bones[i].position = targetbone.position;
|
||||||
@@ -258,22 +253,28 @@ public class UmaContainer : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
from.bones = tmpBone;
|
from.bones = tmpBone;
|
||||||
return emptyBones.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPhysics()
|
public void LoadPhysics()
|
||||||
{
|
{
|
||||||
cySpringDataContainers = new List<CySpringDataContainer>(PhysicsContainer.GetComponentsInChildren<CySpringDataContainer>());
|
cySpringDataContainers = new List<CySpringDataContainer>(PhysicsContainer.GetComponentsInChildren<CySpringDataContainer>());
|
||||||
var bones = new List<Transform>(GetComponentsInChildren<Transform>());
|
var bones = new Dictionary<string,Transform>();
|
||||||
var colliders = new List<GameObject>();
|
foreach (var bone in GetComponentsInChildren<Transform>())
|
||||||
|
|
||||||
foreach (CySpringDataContainer spring in cySpringDataContainers)
|
|
||||||
{
|
{
|
||||||
colliders.AddRange(spring.InitiallizeCollider(bones));
|
if (!bones.ContainsKey(bone.name))
|
||||||
|
bones.Add(bone.name, bone);
|
||||||
}
|
}
|
||||||
foreach (CySpringDataContainer spring in cySpringDataContainers)
|
|
||||||
|
var colliders = new Dictionary<string, Transform>();
|
||||||
|
|
||||||
|
for (int i = 0; i < cySpringDataContainers.Count; i++)
|
||||||
{
|
{
|
||||||
spring.InitializePhysics(bones, colliders);
|
colliders = UmaUtility.MergeDictionaries(colliders,cySpringDataContainers[i].InitiallizeCollider(bones));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < cySpringDataContainers.Count; i++)
|
||||||
|
{
|
||||||
|
cySpringDataContainers[i].InitializePhysics(bones, colliders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,35 +398,6 @@ public class UmaContainer : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public MeshRenderer debug;
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
//if (Input.GetMouseButtonDown(1))
|
|
||||||
//{
|
|
||||||
// var cam = Camera.main;
|
|
||||||
// var distance = Mathf.Clamp(cam.transform.InverseTransformPoint(HeadBone.transform.position).magnitude - 0.1f, 0, 2);
|
|
||||||
// var mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);
|
|
||||||
// var worldPos = cam.ScreenToWorldPoint(mousePos);
|
|
||||||
// if (Physics.Raycast(Camera.main.ScreenPointToRay(mousePos), out RaycastHit hit))
|
|
||||||
// {
|
|
||||||
// hit.rigidbody.AddForce(Camera.main.transform.forward * 50, ForceMode.Impulse);
|
|
||||||
|
|
||||||
// FaceDrivenKeyTarget.ChangeMorphWeight(FaceDrivenKeyTarget.OtherMorphs[2].BindProperties[0], 2, FaceDrivenKeyTarget.OtherMorphs[2]);
|
|
||||||
// FaceDrivenKeyTarget.ChangeMorphWeight(FaceDrivenKeyTarget.OtherMorphs[2].BindProperties[1], 1, FaceDrivenKeyTarget.OtherMorphs[2]);
|
|
||||||
// Invoke(nameof(Test), 0.3f);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
//public void Test()
|
|
||||||
//{
|
|
||||||
// FaceDrivenKeyTarget.ChangeMorphWeight(FaceDrivenKeyTarget.OtherMorphs[2].BindProperties[0], 0, FaceDrivenKeyTarget.OtherMorphs[2]);
|
|
||||||
// FaceDrivenKeyTarget.ChangeMorphWeight(FaceDrivenKeyTarget.OtherMorphs[2].BindProperties[1], 0, FaceDrivenKeyTarget.OtherMorphs[2]);
|
|
||||||
// FaceEmotionKeyTarget.FaceEmotionKey.ForEach(e => { if (e.target) e.Weight = 0; });
|
|
||||||
// var tmp = FaceEmotionKeyTarget.FaceEmotionKey[Random.Range(22, 26)];
|
|
||||||
// tmp.Weight = 1;
|
|
||||||
// FaceDrivenKeyTarget.ChangeMorph();
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void SetNextAnimationCut(string cutName)
|
public void SetNextAnimationCut(string cutName)
|
||||||
{
|
{
|
||||||
@@ -491,7 +463,6 @@ public class UmaContainer : MonoBehaviour
|
|||||||
PuppetMaster.FlattenHierarchy();
|
PuppetMaster.FlattenHierarchy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class MaterialHelper
|
public class MaterialHelper
|
||||||
{
|
{
|
||||||
public Material Mat;
|
public Material Mat;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ public class UmaDatabaseEntry
|
|||||||
public UmaFileType Type;
|
public UmaFileType Type;
|
||||||
public string Name;
|
public string Name;
|
||||||
public string Url;
|
public string Url;
|
||||||
public string Checksum;
|
|
||||||
public string Prerequisites;
|
public string Prerequisites;
|
||||||
public string FilePath
|
public string FilePath
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using Mono.Data.Sqlite;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using Assets.Scripts;
|
using Assets.Scripts;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
public class UmaDatabaseController
|
public class UmaDatabaseController
|
||||||
{
|
{
|
||||||
@@ -51,7 +53,7 @@ public class UmaDatabaseController
|
|||||||
public List<DataRow> DressData;
|
public List<DataRow> DressData;
|
||||||
|
|
||||||
/// <summary> Meta Database Connection </summary>
|
/// <summary> Meta Database Connection </summary>
|
||||||
private SqliteConnection metaDb;
|
public SqliteConnection metaDb;
|
||||||
/// <summary> Master Database Connection </summary>
|
/// <summary> Master Database Connection </summary>
|
||||||
private SqliteConnection masterDb;
|
private SqliteConnection masterDb;
|
||||||
/// <summary> Loads the file database </summary>
|
/// <summary> Loads the file database </summary>
|
||||||
@@ -72,7 +74,6 @@ public class UmaDatabaseController
|
|||||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
|
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
metaDb.Open();
|
metaDb.Open();
|
||||||
MetaEntries = ReadMeta(metaDb);
|
MetaEntries = ReadMeta(metaDb);
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@ public class UmaDatabaseController
|
|||||||
FaceTypeData = ReadFaceTypeData(masterDb);
|
FaceTypeData = ReadFaceTypeData(masterDb);
|
||||||
LiveData = ReadAllLiveData(masterDb);
|
LiveData = ReadAllLiveData(masterDb);
|
||||||
DressData = ReadAllDressData(masterDb);
|
DressData = ReadAllDressData(masterDb);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -102,7 +104,7 @@ public class UmaDatabaseController
|
|||||||
static Dictionary<string,UmaDatabaseEntry> ReadMeta(SqliteConnection conn)
|
static Dictionary<string,UmaDatabaseEntry> ReadMeta(SqliteConnection conn)
|
||||||
{
|
{
|
||||||
SqliteCommand sqlite_cmd = conn.CreateCommand();
|
SqliteCommand sqlite_cmd = conn.CreateCommand();
|
||||||
sqlite_cmd.CommandText = "SELECT m,n,h,c,d FROM a";
|
sqlite_cmd.CommandText = "SELECT m,n,h,d FROM a WHERE d IS NOT NULL";
|
||||||
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
|
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
|
||||||
Dictionary<string, UmaDatabaseEntry> meta = new Dictionary<string, UmaDatabaseEntry>();
|
Dictionary<string, UmaDatabaseEntry> meta = new Dictionary<string, UmaDatabaseEntry>();
|
||||||
while (sqlite_datareader.Read())
|
while (sqlite_datareader.Read())
|
||||||
@@ -110,18 +112,19 @@ public class UmaDatabaseController
|
|||||||
UmaDatabaseEntry entry = null;
|
UmaDatabaseEntry entry = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
entry = new UmaDatabaseEntry()
|
entry = new UmaDatabaseEntry
|
||||||
{
|
{
|
||||||
Type = (UmaFileType)Enum.Parse(typeof(UmaFileType), sqlite_datareader["m"] as string),
|
Type = (UmaFileType)Enum.Parse(typeof(UmaFileType), sqlite_datareader.GetString(0)),
|
||||||
Name = sqlite_datareader["n"] as string,
|
Name = sqlite_datareader.GetString(1),
|
||||||
Url = sqlite_datareader["h"] as string,
|
Url = sqlite_datareader.GetString(2),
|
||||||
Checksum = sqlite_datareader["c"].ToString(),
|
Prerequisites = sqlite_datareader.GetString(3)
|
||||||
Prerequisites = sqlite_datareader["d"] as string
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch(Exception e) { Debug.LogError("Error caught: " + e); }
|
catch(Exception e) { Debug.LogError("Error caught: " + e + entry.Name); }
|
||||||
|
if (entry != null) {
|
||||||
|
|
||||||
if (entry != null) meta.Add(entry.Name, entry);
|
meta.Add(entry.Name, entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
@@ -136,20 +139,21 @@ public class UmaDatabaseController
|
|||||||
return ReadMaster(conn, "SELECT * FROM mob_data");
|
return ReadMaster(conn, "SELECT * FROM mob_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<DataRow> ReadMaster(SqliteConnection conn,string sql)
|
static List<DataRow> ReadMaster(SqliteConnection conn, string sql)
|
||||||
{
|
{
|
||||||
List<DataRow> dr = new List<DataRow>();
|
List<DataRow> dr = new List<DataRow>();
|
||||||
SqliteCommand sqlite_cmd = conn.CreateCommand();
|
|
||||||
sqlite_cmd.CommandText = sql;
|
using (var sqlite_cmd = conn.CreateCommand())
|
||||||
SqliteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader();
|
|
||||||
var result = new DataTable();
|
|
||||||
result.Load(sqlite_datareader);
|
|
||||||
var temp = result.Rows.GetEnumerator();
|
|
||||||
while (temp.MoveNext())
|
|
||||||
{
|
{
|
||||||
dr.Add((DataRow)temp.Current);
|
sqlite_cmd.CommandText = sql;
|
||||||
|
using var sqlite_datareader = sqlite_cmd.ExecuteReader();
|
||||||
|
var result = new DataTable();
|
||||||
|
result.Load(sqlite_datareader);
|
||||||
|
foreach (DataRow row in result.Rows)
|
||||||
|
{
|
||||||
|
dr.Add(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlite_cmd.Dispose();
|
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,11 +204,8 @@ public class UmaDatabaseController
|
|||||||
public static DataRow ReadMobDressColor(string mobid)
|
public static DataRow ReadMobDressColor(string mobid)
|
||||||
{
|
{
|
||||||
var results= ReadMaster(instance.masterDb, $"SELECT * FROM mob_dress_color_set WHERE id LIKE {mobid}");
|
var results= ReadMaster(instance.masterDb, $"SELECT * FROM mob_dress_color_set WHERE id LIKE {mobid}");
|
||||||
foreach(var data in results)
|
|
||||||
{
|
return results.Count > 0 ? results[0] : null;
|
||||||
return data;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataRow ReadMobHairColor(string colorid)
|
public static DataRow ReadMobHairColor(string colorid)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class UmaViewerAudio
|
|||||||
{
|
{
|
||||||
Debug.Log(name);
|
Debug.Log(name);
|
||||||
UmaSoundInfo info;
|
UmaSoundInfo info;
|
||||||
info.acbPath = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb")).FilePath;
|
info.acbPath = null;
|
||||||
info.awbPath = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")).FilePath;
|
info.awbPath = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")).FilePath;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
+109
-109
@@ -5,11 +5,13 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UmaMusumeAudio;
|
using UmaMusumeAudio;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
public class UmaViewerBuilder : MonoBehaviour
|
public class UmaViewerBuilder : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -44,8 +46,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
public Animator AnimationCameraAnimator;
|
public Animator AnimationCameraAnimator;
|
||||||
public Camera AnimationCamera;
|
public Camera AnimationCamera;
|
||||||
|
|
||||||
|
|
||||||
private bool ShadersLoaded = false;
|
private bool ShadersLoaded = false;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@@ -65,17 +67,17 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
else if (chara.IsMob)
|
else if (chara.IsMob)
|
||||||
{
|
{
|
||||||
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
||||||
LoadMobUma(chara, costumeId);
|
LoadMobUma(chara, costumeId, loadMotion: true);
|
||||||
}
|
}
|
||||||
else if (UI.isHeadFix && CurrentHead != null && CurrentHead.chara.IsMob)
|
else if (UI.isHeadFix && CurrentHead != null && CurrentHead.chara.IsMob)
|
||||||
{
|
{
|
||||||
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(CurrentHead.chara);
|
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(CurrentHead.chara);
|
||||||
LoadMobUma(CurrentHead.chara, costumeId, chara.Id);
|
LoadMobUma(CurrentHead.chara, costumeId, chara.Id, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(chara);
|
||||||
LoadNormalUma(chara, costumeId);
|
LoadNormalUma(chara, costumeId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
@@ -108,7 +110,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadNormalUma(CharaEntry chara, string costumeId)
|
private void LoadNormalUma(CharaEntry chara, string costumeId, bool loadMotion = false)
|
||||||
{
|
{
|
||||||
int id = chara.Id;
|
int id = chara.Id;
|
||||||
DataRow charaData = CurrentUMAContainer.CharaData;
|
DataRow charaData = CurrentUMAContainer.CharaData;
|
||||||
@@ -141,20 +143,16 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
//
|
//
|
||||||
// Some models will naturally be missing due to how this system is designed.
|
// Some models will naturally be missing due to how this system is designed.
|
||||||
|
|
||||||
string body = "";
|
string body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{height}_{shape}_{bust}";
|
||||||
body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{height}_{shape}_{bust}";
|
UmaViewerMain.Instance.AbList.TryGetValue(body, out asset);
|
||||||
|
|
||||||
Debug.Log("Looking for " + body);
|
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == body);
|
|
||||||
}
|
}
|
||||||
else asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/pfb_bdy{id}_{costumeId}");
|
else UmaViewerMain.Instance.AbList.TryGetValue(UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/pfb_bdy{id}_{costumeId}", out asset);
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("No body, can't load!");
|
Debug.LogError("No body, can't load!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (genericCostume)
|
else if (genericCostume)
|
||||||
{
|
{
|
||||||
string texPattern1 = "", texPattern2 = "", texPattern3 = "", texPattern4 = "", texPattern5 = "";
|
string texPattern1 = "", texPattern2 = "", texPattern3 = "", texPattern4 = "", texPattern5 = "";
|
||||||
@@ -194,32 +192,23 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
//Load Body
|
//Load Body
|
||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
bool physicsloaded = false, physicsloaded2 = false;
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes")))
|
if (Main.AbList.TryGetValue(UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes/pfb_bdy{costumeIdShort}_cloth00", out _))
|
||||||
{
|
{
|
||||||
if (asset1.Name.Contains("cloth00") && asset1.Name.Contains("bust" + bust) && !physicsloaded)
|
var asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes/pfb_bdy{costumeIdShort}_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
RecursiveLoadAsset(asset1);
|
asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes/pfb_bdy{costumeIdShort}_bust{bust}_cloth00"];
|
||||||
physicsloaded = true;
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
|
||||||
else if (asset1.Name.Contains("cloth00") && !asset1.Name.Contains("bust") && !physicsloaded2)
|
|
||||||
{
|
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
physicsloaded2 = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/clothes")))
|
var asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/clothes/pfb_bdy{id}_{costumeId}_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
if (asset1.Name.Contains("cloth00"))
|
asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{id}_{costumeId}/clothes/pfb_bdy{id}_{costumeId}_bust_cloth00"];
|
||||||
RecursiveLoadAsset(asset1);
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record Head Data
|
// Record Head Data
|
||||||
@@ -248,12 +237,14 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
string head = UmaDatabaseController.HeadPath + $"chr{head_id}_{head_costumeId}/pfb_chr{head_id}_{head_costumeId}";
|
string head = UmaDatabaseController.HeadPath + $"chr{head_id}_{head_costumeId}/pfb_chr{head_id}_{head_costumeId}";
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == head);
|
asset = null;
|
||||||
|
Main.AbList.TryGetValue(head, out asset);
|
||||||
|
|
||||||
bool isDefaultHead = false;
|
bool isDefaultHead = false;
|
||||||
//Some costumes don't have custom heads
|
//Some costumes don't have custom heads
|
||||||
if (head_costumeId != "00" && asset == null)
|
if (head_costumeId != "00" && asset == null)
|
||||||
{
|
{
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == UmaDatabaseController.HeadPath + $"chr{head_id}_00/pfb_chr{head_id}_00");
|
asset = Main.AbList[UmaDatabaseController.HeadPath + $"chr{head_id}_00/pfb_chr{head_id}_00"];
|
||||||
isDefaultHead = true;
|
isDefaultHead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,25 +255,20 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
RecursiveLoadAsset(asset1);
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load Head
|
//Load Head
|
||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
if (isDefaultHead)
|
if (isDefaultHead)
|
||||||
{
|
{
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{UmaDatabaseController.HeadPath}chr{head_id}_00/clothes")))
|
var asset1 = Main.AbList[UmaDatabaseController.HeadPath + $"chr{id}_00/clothes/pfb_chr{id}_00_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
if (asset1.Name.Contains("cloth00"))
|
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{UmaDatabaseController.HeadPath}chr{head_id}_{head_costumeId}/clothes")))
|
var asset1 = Main.AbList[UmaDatabaseController.HeadPath + $"chr{id}_{costumeId}/clothes/pfb_chr{id}_{costumeId}_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
if (asset1.Name.Contains("cloth00"))
|
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,22 +277,20 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||||
string tailPath = $"3d/chara/tail/{tailName}/";
|
string tailPath = $"3d/chara/tail/{tailName}/";
|
||||||
string tailPfb = tailPath + $"pfb_{tailName}";
|
string tailPfb = tailPath + $"pfb_{tailName}";
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == tailPfb);
|
asset = null;
|
||||||
|
Main.AbList.TryGetValue(tailPfb, out asset);
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_{head_id}") || a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_0000")))
|
foreach (var asset2 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_{head_id}") || a.Name.StartsWith($"{tailPath}textures/tex_{tailName}_0000")))
|
||||||
{
|
{
|
||||||
RecursiveLoadAsset(asset1);
|
RecursiveLoadAsset(asset2);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{tailPath}clothes")))
|
var asset1 = Main.AbList[$"{tailPath}clothes/pfb_{tailName}_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
if (asset1.Name.Contains("cloth00"))
|
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -314,25 +298,25 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentUMAContainer.LoadPhysics(); //Need to load physics before loading FacialMorph
|
CurrentUMAContainer.LoadPhysics();
|
||||||
CurrentUMAContainer.SetDynamicBoneEnable(UI.DynamicBoneEnable);
|
CurrentUMAContainer.SetDynamicBoneEnable(UI.DynamicBoneEnable);
|
||||||
|
|
||||||
//Load FacialMorph
|
|
||||||
LoadFaceMorph(id, costumeId);
|
LoadFaceMorph(id, costumeId);
|
||||||
|
|
||||||
CurrentUMAContainer.TearControllers.ForEach(a => a.SetDir(a.CurrentDir));
|
CurrentUMAContainer.TearControllers.ForEach(a => a.SetDir(a.CurrentDir));
|
||||||
CurrentUMAContainer.HeadBone = (GameObject)CurrentUMAContainer.Body.GetComponent<AssetHolder>()._assetTable["head"];
|
CurrentUMAContainer.HeadBone = (GameObject)CurrentUMAContainer.Body.GetComponent<AssetHolder>()._assetTable["head"];
|
||||||
CurrentUMAContainer.EyeHeight = CurrentUMAContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
CurrentUMAContainer.EyeHeight = CurrentUMAContainer.Head.GetComponent<AssetHolder>()._assetTableValue["head_center_offset_y"];
|
||||||
CurrentUMAContainer.MergeModel();
|
CurrentUMAContainer.MergeModel();
|
||||||
CurrentUMAContainer.SetHeight(-1);
|
CurrentUMAContainer.SetHeight(-1);
|
||||||
CurrentUMAContainer.Initialize(!UI.isTPose);
|
CurrentUMAContainer.Initialize(!UI.isTPose);
|
||||||
if (!UI.isTPose)
|
if (!UI.isTPose && loadMotion)
|
||||||
{
|
{
|
||||||
LoadAsset(UmaViewerMain.Instance.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{id}_00_idle01_loop")));
|
if (Main.AbList.TryGetValue($"3d/motion/event/body/chara/chr{id}_00/anm_eve_chr{id}_00_idle01_loop", out UmaDatabaseEntry entry))
|
||||||
|
{
|
||||||
|
LoadAsset(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadMobUma(CharaEntry chara, string costumeId, int bodyid = -1)
|
private void LoadMobUma(CharaEntry chara, string costumeId, int bodyid = -1, bool loadMotion = false)
|
||||||
{
|
{
|
||||||
int id = chara.Id;
|
int id = chara.Id;
|
||||||
CurrentUMAContainer.IsMob = chara.IsMob;
|
CurrentUMAContainer.IsMob = chara.IsMob;
|
||||||
@@ -378,16 +362,15 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{height}_{shape}_{bust}";
|
body = UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/pfb_bdy{costumeId}_{height}_{shape}_{bust}";
|
||||||
|
|
||||||
Debug.Log("Looking for " + body);
|
Debug.Log("Looking for " + body);
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == body);
|
Main.AbList.TryGetValue(body, out asset);
|
||||||
}
|
}
|
||||||
else asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == UmaDatabaseController.BodyPath + $"bdy{bodyid}_{costumeId}/pfb_bdy{bodyid}_{costumeId}");
|
else Main.AbList.TryGetValue($"{UmaDatabaseController.BodyPath}bdy{bodyid}_{costumeId}/pfb_bdy{bodyid}_{costumeId}", out asset);
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("No body, can't load!");
|
Debug.LogError("No body, can't load!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (genericCostume)
|
else if (genericCostume)
|
||||||
{
|
{
|
||||||
string texPattern1 = "", texPattern2 = "", texPattern3 = "", texPattern4 = "", texPattern5 = "";
|
string texPattern1 = "", texPattern2 = "", texPattern3 = "", texPattern4 = "", texPattern5 = "";
|
||||||
@@ -424,35 +407,27 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
RecursiveLoadAsset(asset1);
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load Body
|
//Load Body
|
||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
bool physicsloaded = false, physicsloaded2 = false;
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes")))
|
if (Main.AbList.TryGetValue(UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes/pfb_bdy{costumeIdShort}_cloth00", out _))
|
||||||
{
|
{
|
||||||
if (asset1.Name.Contains("cloth00") && asset1.Name.Contains("bust" + bust) && !physicsloaded)
|
var asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes/pfb_bdy{costumeIdShort}_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
RecursiveLoadAsset(asset1);
|
asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{costumeIdShort}/clothes/pfb_bdy{costumeIdShort}_bust{bust}_cloth00"];
|
||||||
physicsloaded = true;
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
|
||||||
else if (asset1.Name.Contains("cloth00") && !asset1.Name.Contains("bust") && !physicsloaded2)
|
|
||||||
{
|
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
physicsloaded2 = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath + $"bdy{bodyid}_{costumeId}/clothes")))
|
var asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{bodyid}_{costumeId}/clothes/pfb_bdy{bodyid}_{costumeId}_cloth00"];
|
||||||
{
|
RecursiveLoadAsset(asset1);
|
||||||
if (asset1.Name.Contains("cloth00"))
|
asset1 = Main.AbList[UmaDatabaseController.BodyPath + $"bdy{bodyid}_{costumeId}/clothes/pfb_bdy{bodyid}_{costumeId}_bust_cloth00"];
|
||||||
RecursiveLoadAsset(asset1);
|
RecursiveLoadAsset(asset1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record Head Data
|
// Record Head Data
|
||||||
@@ -471,8 +446,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
var head_s = head_id.ToString().PadLeft(4, '0');
|
var head_s = head_id.ToString().PadLeft(4, '0');
|
||||||
string head = UmaDatabaseController.HeadPath + $"chr{head_s}_{head_costumeId}/pfb_chr{head_s}_{head_costumeId}_face{faceid.PadLeft(3, '0')}";
|
string head = UmaDatabaseController.HeadPath + $"chr{head_s}_{head_costumeId}/pfb_chr{head_s}_{head_costumeId}_face{faceid.PadLeft(3, '0')}";
|
||||||
string hair = UmaDatabaseController.HeadPath + $"chr{head_s}_{head_costumeId}/pfb_chr{head_s}_{head_costumeId}_hair{hairid.PadLeft(3, '0')}";
|
string hair = UmaDatabaseController.HeadPath + $"chr{head_s}_{head_costumeId}/pfb_chr{head_s}_{head_costumeId}_hair{hairid.PadLeft(3, '0')}";
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == head);
|
Main.AbList.TryGetValue(head, out asset);
|
||||||
var hairasset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == hair);
|
Main.AbList.TryGetValue(hair, out UmaDatabaseEntry hairasset);
|
||||||
bool isDefaultHead = true;
|
bool isDefaultHead = true;
|
||||||
|
|
||||||
|
|
||||||
@@ -503,13 +478,13 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
//Load Physics
|
//Load Physics
|
||||||
if (isDefaultHead)
|
if (isDefaultHead)
|
||||||
{
|
{
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{UmaDatabaseController.HeadPath}chr{head_s}_00/clothes")))
|
if (Main.AbList.TryGetValue($"{UmaDatabaseController.HeadPath}chr{head_s}_00/clothes/pfb_chr{head_s}_00_hair{hairid.PadLeft(3, '0')}_cloth00", out UmaDatabaseEntry asset1))
|
||||||
{
|
{
|
||||||
if (asset1.Name.Contains($"hair{hairid.PadLeft(3, '0')}_cloth00"))
|
RecursiveLoadAsset(asset1);
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tailId != 0)
|
if (tailId != 0)
|
||||||
{
|
{
|
||||||
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||||
@@ -526,10 +501,9 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
|
|
||||||
|
|
||||||
//Load Physics
|
//Load Physics
|
||||||
foreach (var asset1 in UmaViewerMain.Instance.AbChara.Where(a => a.Name.StartsWith($"{tailPath}clothes")))
|
if (Main.AbList.TryGetValue($"{tailPath}clothes/pfb_{tailName}_cloth00", out UmaDatabaseEntry asset2))
|
||||||
{
|
{
|
||||||
if (asset1.Name.Contains("cloth00"))
|
RecursiveLoadAsset(asset2);
|
||||||
RecursiveLoadAsset(asset1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -550,9 +524,13 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
CurrentUMAContainer.MergeModel();
|
CurrentUMAContainer.MergeModel();
|
||||||
CurrentUMAContainer.SetHeight(-1);
|
CurrentUMAContainer.SetHeight(-1);
|
||||||
CurrentUMAContainer.Initialize(!UI.isTPose);
|
CurrentUMAContainer.Initialize(!UI.isTPose);
|
||||||
if (!UI.isTPose)
|
|
||||||
|
if (!UI.isTPose && loadMotion)
|
||||||
{
|
{
|
||||||
LoadAsset(UmaViewerMain.Instance.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"homestand{personality.PadLeft(2, '0')}_loop")));
|
if (Main.AbList.TryGetValue($"3d/motion/event/body/type00/anm_eve_type00_homestand{personality.PadLeft(2, '0')}_loop", out UmaDatabaseEntry entry))
|
||||||
|
{
|
||||||
|
LoadAsset(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,9 +553,9 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
costumeIdShort = costumeId.Remove(costumeId.LastIndexOf('_'));
|
costumeIdShort = costumeId.Remove(costumeId.LastIndexOf('_'));
|
||||||
string body = $"3d/chara/mini/body/mbdy{costumeIdShort}/pfb_mbdy{costumeId}_0";
|
string body = $"3d/chara/mini/body/mbdy{costumeIdShort}/pfb_mbdy{costumeId}_0";
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == body);
|
Main.AbList.TryGetValue(body,out asset);
|
||||||
}
|
}
|
||||||
else asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == $"3d/chara/mini/body/mbdy{id}_{costumeId}/pfb_mbdy{id}_{costumeId}");
|
else Main.AbList.TryGetValue($"3d/chara/mini/body/mbdy{id}_{costumeId}/pfb_mbdy{id}_{costumeId}",out asset);
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("No body, can't load!");
|
Debug.LogError("No body, can't load!");
|
||||||
@@ -607,12 +585,13 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
RecursiveLoadAsset(asset);
|
RecursiveLoadAsset(asset);
|
||||||
|
|
||||||
string hair = $"3d/chara/mini/head/mchr{id}_{costumeId}/pfb_mchr{id}_{costumeId}_hair";
|
string hair = $"3d/chara/mini/head/mchr{id}_{costumeId}/pfb_mchr{id}_{costumeId}_hair";
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == hair);
|
Main.AbList.TryGetValue(hair, out asset);
|
||||||
if (costumeId != "00" && asset == null)
|
if (costumeId != "00" && asset == null)
|
||||||
{
|
{
|
||||||
customHead = false;
|
customHead = false;
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == $"3d/chara/mini/head/mchr{id}_00/pfb_mchr{id}_00_hair");
|
Main.AbList.TryGetValue($"3d/chara/mini/head/mchr{id}_00/pfb_mchr{id}_00_hair", out asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
//Load Hair Textures
|
//Load Hair Textures
|
||||||
@@ -636,7 +615,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
string head = $"3d/chara/mini/head/mchr0001_00/pfb_mchr0001_00_face0";
|
string head = $"3d/chara/mini/head/mchr0001_00/pfb_mchr0001_00_face0";
|
||||||
asset = UmaViewerMain.Instance.AbChara.FirstOrDefault(a => a.Name == head);
|
Main.AbList.TryGetValue(head,out asset);
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
//Load Head Textures
|
//Load Head Textures
|
||||||
@@ -655,7 +634,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
var eyebrowLmat = matList.FirstOrDefault(a => a.gameObject.name.Equals("M_Mayu_L"));
|
var eyebrowLmat = matList.FirstOrDefault(a => a.gameObject.name.Equals("M_Mayu_L"));
|
||||||
var eyebrowRmat = matList.FirstOrDefault(a => a.gameObject.name.Equals("M_Mayu_R"));
|
var eyebrowRmat = matList.FirstOrDefault(a => a.gameObject.name.Equals("M_Mayu_R"));
|
||||||
UI.LoadFacialPanelsMini(eyemat.material, eyebrowLmat.material, eyebrowRmat.material, mouthmat.material);
|
UI.LoadFacialPanelsMini(eyemat.material, eyebrowLmat.material, eyebrowRmat.material, mouthmat.material);
|
||||||
LoadAsset(UmaViewerMain.Instance.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_min_eve_chr{id}_00_idle01_loop")));
|
|
||||||
|
if(Main.AbList.TryGetValue($"3d/motion/mini/event/body/chara/chr{id}_00/anm_min_eve_chr{id}_00_idle01_loop",out asset))
|
||||||
|
{
|
||||||
|
LoadAsset(asset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadProp(UmaDatabaseEntry entry)
|
public void LoadProp(UmaDatabaseEntry entry)
|
||||||
@@ -935,7 +918,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
foreach (string prerequisite in entry.Prerequisites.Split(';'))
|
foreach (string prerequisite in entry.Prerequisites.Split(';'))
|
||||||
{
|
{
|
||||||
RecursiveLoadAsset(Main.AbList[prerequisite], true, SetParent);
|
RecursiveLoadAsset(Main.AbList[prerequisite], true, SetParent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LoadAsset(entry, IsSubAsset, SetParent);
|
LoadAsset(entry, IsSubAsset, SetParent);
|
||||||
@@ -1465,7 +1448,13 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
var eyeLocator_L = headBone.transform.Find("Eye_target_locator_L");
|
var eyeLocator_L = headBone.transform.Find("Eye_target_locator_L");
|
||||||
var eyeLocator_R = headBone.transform.Find("Eye_target_locator_R");
|
var eyeLocator_R = headBone.transform.Find("Eye_target_locator_R");
|
||||||
|
|
||||||
var mangaEntry = Main.AbEffect.FindAll(a => a.Name.StartsWith("3d/effect/charaemotion/pfb_eff_chr_emo_eye"));
|
var mangaEntry = new List<UmaDatabaseEntry>()
|
||||||
|
{
|
||||||
|
Main.AbList["3d/effect/charaemotion/pfb_eff_chr_emo_eye_000"],
|
||||||
|
Main.AbList["3d/effect/charaemotion/pfb_eff_chr_emo_eye_001"],
|
||||||
|
Main.AbList["3d/effect/charaemotion/pfb_eff_chr_emo_eye_002"],
|
||||||
|
Main.AbList["3d/effect/charaemotion/pfb_eff_chr_emo_eye_003"],
|
||||||
|
};
|
||||||
var mangaObjects = new List<GameObject>();
|
var mangaObjects = new List<GameObject>();
|
||||||
mangaEntry.ForEach(entry =>
|
mangaEntry.ForEach(entry =>
|
||||||
{
|
{
|
||||||
@@ -1487,11 +1476,16 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
CurrentUMAContainer.RightMangaObject.Add(RightObj);
|
CurrentUMAContainer.RightMangaObject.Add(RightObj);
|
||||||
});
|
});
|
||||||
|
|
||||||
var tearEntry = Main.AbChara.FindAll(a => a.Name.StartsWith("3d/chara/common/tear/") && a.Name.Contains("pfb_chr_tear"));
|
var tearEntry = new List<UmaDatabaseEntry>() {
|
||||||
|
Main.AbList["3d/chara/common/tear/tear000/pfb_chr_tear000"],
|
||||||
|
Main.AbList["3d/chara/common/tear/tear001/pfb_chr_tear001"],
|
||||||
|
};
|
||||||
|
|
||||||
if (tearEntry.Count > 0)
|
if (tearEntry.Count > 0)
|
||||||
{
|
{
|
||||||
tearEntry.ForEach(a => RecursiveLoadAsset(a));
|
tearEntry.ForEach(a => RecursiveLoadAsset(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentUMAContainer.TearPrefab_0 && CurrentUMAContainer.TearPrefab_1)
|
if (CurrentUMAContainer.TearPrefab_0 && CurrentUMAContainer.TearPrefab_1)
|
||||||
{
|
{
|
||||||
var p0 = CurrentUMAContainer.TearPrefab_0;
|
var p0 = CurrentUMAContainer.TearPrefab_0;
|
||||||
@@ -1506,7 +1500,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
var firsehead = CurrentUMAContainer.Head;
|
var firsehead = CurrentUMAContainer.Head;
|
||||||
var origin_faceDriven = firsehead.GetComponent<AssetHolder>()._assetTable["facial_target"] as FaceDrivenKeyTarget;
|
var origin_faceDriven = firsehead.GetComponent<AssetHolder>()._assetTable["facial_target"] as FaceDrivenKeyTarget;
|
||||||
var faceDriven = ScriptableObject.CreateInstance<FaceDrivenKeyTarget>();
|
var faceDriven = ScriptableObject.CreateInstance<FaceDrivenKeyTarget>();
|
||||||
DeepCopy.CopyValues(origin_faceDriven, faceDriven);
|
faceDriven._eyebrowTarget = origin_faceDriven._eyebrowTarget;
|
||||||
|
faceDriven._eyeTarget = origin_faceDriven._eyeTarget;
|
||||||
|
faceDriven._mouthTarget = origin_faceDriven._mouthTarget;
|
||||||
|
faceDriven.name = $"char{id}_{costumeId}_face_target";
|
||||||
|
|
||||||
var earDriven = firsehead.GetComponent<AssetHolder>()._assetTable["ear_target"] as DrivenKeyTarget;
|
var earDriven = firsehead.GetComponent<AssetHolder>()._assetTable["ear_target"] as DrivenKeyTarget;
|
||||||
var faceOverride = firsehead.GetComponent<AssetHolder>()._assetTable["face_override"] as FaceOverrideData;
|
var faceOverride = firsehead.GetComponent<AssetHolder>()._assetTable["face_override"] as FaceOverrideData;
|
||||||
faceDriven._earTarget = earDriven._targetFaces;
|
faceDriven._earTarget = earDriven._targetFaces;
|
||||||
@@ -1515,13 +1513,13 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
CurrentUMAContainer.FaceOverrideData = faceOverride;
|
CurrentUMAContainer.FaceOverrideData = faceOverride;
|
||||||
faceOverride?.SetEnable(UI.EnableFaceOverride);
|
faceOverride?.SetEnable(UI.EnableFaceOverride);
|
||||||
faceDriven.DrivenKeyLocator = locator.transform;
|
faceDriven.DrivenKeyLocator = locator.transform;
|
||||||
faceDriven.Initialize(firsehead.GetComponentsInChildren<Transform>().ToList());
|
faceDriven.Initialize(UmaUtility.ConvertArrayToDictionary(firsehead.GetComponentsInChildren<Transform>()));
|
||||||
|
|
||||||
var emotionDriven = ScriptableObject.CreateInstance<FaceEmotionKeyTarget>();
|
var emotionDriven = ScriptableObject.CreateInstance<FaceEmotionKeyTarget>();
|
||||||
emotionDriven.name = $"char{id}_{costumeId}_emotion_target";
|
emotionDriven.name = $"char{id}_{costumeId}_emotion_target";
|
||||||
CurrentUMAContainer.FaceEmotionKeyTarget = emotionDriven;
|
CurrentUMAContainer.FaceEmotionKeyTarget = emotionDriven;
|
||||||
emotionDriven.FaceDrivenKeyTarget = faceDriven;
|
emotionDriven.FaceDrivenKeyTarget = faceDriven;
|
||||||
emotionDriven.FaceEmotionKey = UmaDatabaseController.Instance.FaceTypeData.ToList();
|
emotionDriven.FaceEmotionKey = UmaDatabaseController.Instance.FaceTypeData;
|
||||||
emotionDriven.Initialize();
|
emotionDriven.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1657,9 +1655,9 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
if (param.Length > 4)
|
if (param.Length > 4)
|
||||||
{
|
{
|
||||||
int index = int.Parse(param[4]);
|
int index = int.Parse(param[4]);
|
||||||
if(index == 1)
|
if (index == 1)
|
||||||
{
|
{
|
||||||
foreach(var entry in Main.AbMotions.Where(a => a.Name.Contains($"{param[0]}_{param[1]}_{param[2]}_{param[3]}_")))
|
foreach (var entry in Main.AbMotions.Where(a => a.Name.Contains($"{param[0]}_{param[1]}_{param[2]}_{param[3]}_")))
|
||||||
{
|
{
|
||||||
UmaAssetManager.LoadAssetBundle(entry, isRecursive: false);
|
UmaAssetManager.LoadAssetBundle(entry, isRecursive: false);
|
||||||
}
|
}
|
||||||
@@ -1818,7 +1816,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
public Sprite LoadCharaIcon(string id)
|
public Sprite LoadCharaIcon(string id)
|
||||||
{
|
{
|
||||||
string value = $"chara/chr{id}/chr_icon_{id}";
|
string value = $"chara/chr{id}/chr_icon_{id}";
|
||||||
if (UmaViewerMain.Instance.AbList.TryGetValue(value,out UmaDatabaseEntry entry))
|
if (UmaViewerMain.Instance.AbList.TryGetValue(value, out UmaDatabaseEntry entry))
|
||||||
{
|
{
|
||||||
AssetBundle assetBundle = UmaAssetManager.LoadAssetBundle(entry, true);
|
AssetBundle assetBundle = UmaAssetManager.LoadAssetBundle(entry, true);
|
||||||
if (assetBundle.Contains($"chr_icon_{id}"))
|
if (assetBundle.Contains($"chr_icon_{id}"))
|
||||||
@@ -1835,7 +1833,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
public Sprite LoadMobCharaIcon(string id)
|
public Sprite LoadMobCharaIcon(string id)
|
||||||
{
|
{
|
||||||
string value = $"mob/mob_chr_icon_{id}_000001_01";
|
string value = $"mob/mob_chr_icon_{id}_000001_01";
|
||||||
if (UmaViewerMain.Instance.AbList.TryGetValue(value,out UmaDatabaseEntry entry)) {
|
if (UmaViewerMain.Instance.AbList.TryGetValue(value, out UmaDatabaseEntry entry))
|
||||||
|
{
|
||||||
string path = entry.FilePath;
|
string path = entry.FilePath;
|
||||||
AssetBundle assetBundle = UmaAssetManager.LoadAssetBundle(entry, true);
|
AssetBundle assetBundle = UmaAssetManager.LoadAssetBundle(entry, true);
|
||||||
if (assetBundle.Contains($"mob_chr_icon_{id}_000001_01"))
|
if (assetBundle.Contains($"mob_chr_icon_{id}_000001_01"))
|
||||||
@@ -1892,10 +1891,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
UmaViewerUI.Instance.currentFaceDrivenKeyTarget = null;
|
UmaViewerUI.Instance.currentFaceDrivenKeyTarget = null;
|
||||||
UmaViewerUI.Instance.LoadEmotionPanels(null);
|
UmaViewerUI.Instance.LoadEmotionPanels(null);
|
||||||
UmaViewerUI.Instance.LoadFacialPanels(null);
|
UmaViewerUI.Instance.LoadFacialPanels(null);
|
||||||
foreach (Transform t in UmaViewerUI.Instance.MaterialsList.content)
|
if (UmaViewerUI.Instance.MaterialsList)
|
||||||
{
|
foreach (Transform t in UmaViewerUI.Instance.MaterialsList.content)
|
||||||
Destroy(t.gameObject);
|
{
|
||||||
}
|
Destroy(t.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
if (CurrentUMAContainer.transform.parent && CurrentUMAContainer.transform.parent.name.Contains("Root"))
|
if (CurrentUMAContainer.transform.parent && CurrentUMAContainer.transform.parent.name.Contains("Root"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using UnityEngine;
|
|||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
public class UmaViewerMain : MonoBehaviour
|
public class UmaViewerMain : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -28,12 +30,15 @@ public class UmaViewerMain : MonoBehaviour
|
|||||||
Instance = this;
|
Instance = this;
|
||||||
new Config();
|
new Config();
|
||||||
Application.targetFrameRate = 120;
|
Application.targetFrameRate = 120;
|
||||||
|
|
||||||
AbList = UmaDatabaseController.Instance.MetaEntries;
|
AbList = UmaDatabaseController.Instance.MetaEntries;
|
||||||
AbChara = AbList.Where(ab => ab.Key.StartsWith(UmaDatabaseController.CharaPath)).Select(ab=>ab.Value).ToList();
|
var chara_3d = AbList.Where(ab => ab.Value.Type == UmaFileType._3d_cutt).Select(ab => ab.Value).ToList();
|
||||||
AbMotions = AbList.Where(ab => ab.Key.StartsWith(UmaDatabaseController.MotionPath)).Select(ab => ab.Value).ToList();
|
AbChara = chara_3d.FindAll(ab => ab.Name.StartsWith(UmaDatabaseController.CharaPath));
|
||||||
AbEffect = AbList.Where(ab => ab.Key.StartsWith(UmaDatabaseController.EffectPath)).Select(ab => ab.Value).ToList();
|
AbMotions = chara_3d.FindAll(ab => ab.Name.StartsWith(UmaDatabaseController.MotionPath));
|
||||||
AbSounds = AbList.Where(ab => ab.Key.EndsWith(".awb") || ab.Key.EndsWith(".acb")).Select(ab => ab.Value).ToList();
|
AbEffect = chara_3d.FindAll(ab => ab.Name.StartsWith(UmaDatabaseController.EffectPath));
|
||||||
CostumeList = AbList.Where(ab => ab.Key.StartsWith(UmaDatabaseController.CostumePath)).Select(ab => ab.Value).ToList();
|
AbSounds = AbList.Where(ab => ab.Value.Type == UmaFileType.sound).Select(ab => ab.Value).ToList();
|
||||||
|
var outgame = AbList.Where(ab => ab.Value.Type == UmaFileType.outgame).Select(ab => ab.Value).ToList();
|
||||||
|
CostumeList = outgame.FindAll(e => e.Name.StartsWith(UmaDatabaseController.CostumePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator Start()
|
private IEnumerator Start()
|
||||||
@@ -46,7 +51,6 @@ public class UmaViewerMain : MonoBehaviour
|
|||||||
if (Config.Instance.Language == Language.En)
|
if (Config.Instance.Language == Language.En)
|
||||||
{
|
{
|
||||||
loadingUI.LoadingProgressChange(0, 11, "Downloading Character Data");
|
loadingUI.LoadingProgressChange(0, 11, "Downloading Character Data");
|
||||||
yield return null;
|
|
||||||
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicCharaDataInfo", txt =>
|
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicCharaDataInfo", txt =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(txt)) return;
|
if (string.IsNullOrEmpty(txt)) return;
|
||||||
@@ -62,7 +66,6 @@ public class UmaViewerMain : MonoBehaviour
|
|||||||
|
|
||||||
//Mob names (EN & JP)
|
//Mob names (EN & JP)
|
||||||
loadingUI.LoadingProgressChange(1, 11, "Downloading Mob Data");
|
loadingUI.LoadingProgressChange(1, 11, "Downloading Mob Data");
|
||||||
yield return null;
|
|
||||||
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicMobDataInfo", txt =>
|
yield return UmaViewerDownload.DownloadText("https://www.tracenacademy.com/api/BasicMobDataInfo", txt =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(txt)) return;
|
if (string.IsNullOrEmpty(txt)) return;
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
public void LoadFacialPanels(FaceDrivenKeyTarget target)
|
public void LoadFacialPanels(FaceDrivenKeyTarget target)
|
||||||
{
|
{
|
||||||
currentFaceDrivenKeyTarget = target;
|
currentFaceDrivenKeyTarget = target;
|
||||||
|
if(FacialList)
|
||||||
foreach (UmaUIContainer ui in FacialList.GetComponentsInChildren<UmaUIContainer>(true))
|
foreach (UmaUIContainer ui in FacialList.GetComponentsInChildren<UmaUIContainer>(true))
|
||||||
{
|
{
|
||||||
Destroy(ui.gameObject);
|
Destroy(ui.gameObject);
|
||||||
@@ -549,6 +549,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
|
|
||||||
public void LoadEmotionPanels(FaceEmotionKeyTarget target)
|
public void LoadEmotionPanels(FaceEmotionKeyTarget target)
|
||||||
{
|
{
|
||||||
|
if (EmotionList)
|
||||||
foreach (UmaUIContainer ui in EmotionList.content.GetComponentsInChildren<UmaUIContainer>())
|
foreach (UmaUIContainer ui in EmotionList.content.GetComponentsInChildren<UmaUIContainer>())
|
||||||
{
|
{
|
||||||
Destroy(ui.gameObject);
|
Destroy(ui.gameObject);
|
||||||
@@ -749,7 +750,7 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.HeadPath) && a.Name.Contains(chara.Id.ToString())));
|
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.HeadPath) && a.Name.Contains(chara.Id.ToString())));
|
||||||
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"]);
|
||||||
list.Add(Main.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{chara.Id}_00_idle01_loop")));
|
list.Add(Main.AbList[$"3d/motion/event/body/chara/chr{achara.Id}_00/anm_eve_chr{achara.Id}_00_idle01_loop"]);
|
||||||
|
|
||||||
|
|
||||||
Builder.UnloadUma();
|
Builder.UnloadUma();
|
||||||
@@ -802,14 +803,14 @@ public class UmaViewerUI : MonoBehaviour
|
|||||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.HeadPath) && a.Name.Contains(chara.Id.ToString())));
|
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.HeadPath) && a.Name.Contains(chara.Id.ToString())));
|
||||||
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"]);
|
||||||
list.Add(Main.AbMotions.FirstOrDefault(a => a.Name.EndsWith($"anm_eve_chr{chara.Id}_00_idle01_loop")));
|
if(!chara.IsMob && !isHeadFix)
|
||||||
|
{
|
||||||
|
list.Add(Main.AbList[$"3d/motion/event/body/chara/chr{chara.Id}_00/anm_eve_chr{chara.Id}_00_idle01_loop"]);
|
||||||
|
}
|
||||||
|
|
||||||
Builder.UnloadUma();
|
Builder.UnloadUma();
|
||||||
//UmaAssetManager.UnloadAllBundle(true);
|
//UmaAssetManager.UnloadAllBundle(true);
|
||||||
UmaAssetManager.PreLoadAndRun(list, delegate {
|
UmaAssetManager.PreLoadAndRun(list, delegate { StartCoroutine(Builder.LoadUma(chara, costumeId, mini)); });
|
||||||
StartCoroutine(Builder.LoadUma(chara, costumeId, mini));
|
|
||||||
});
|
|
||||||
//StartCoroutine(Builder.LoadUma(achara, costumeId, mini));
|
//StartCoroutine(Builder.LoadUma(achara, costumeId, mini));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: be8344d1cb7c78742abfc99780af4230
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class UmaUtility
|
||||||
|
{
|
||||||
|
public static Dictionary<string, Transform> ConvertListToDictionary(List<Transform> transformList)
|
||||||
|
{
|
||||||
|
Dictionary<string, Transform> dict = new Dictionary<string, Transform>();
|
||||||
|
|
||||||
|
foreach (Transform transform in transformList)
|
||||||
|
{
|
||||||
|
if (!dict.ContainsKey(transform.name))
|
||||||
|
{
|
||||||
|
dict.Add(transform.name, transform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, Transform> ConvertArrayToDictionary(Transform[] transformArray)
|
||||||
|
{
|
||||||
|
Dictionary<string, Transform> dict = new Dictionary<string, Transform>();
|
||||||
|
|
||||||
|
for (int i = 0; i < transformArray.Length; i++)
|
||||||
|
{
|
||||||
|
Transform transform = transformArray[i];
|
||||||
|
if (!dict.ContainsKey(transform.name))
|
||||||
|
{
|
||||||
|
dict.Add(transform.name, transform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, T> MergeDictionaries<T>(Dictionary<string, T> dict1, Dictionary<string, T> dict2)
|
||||||
|
{
|
||||||
|
Dictionary<string, T> mergedDict = new Dictionary<string, T>(dict1);
|
||||||
|
foreach (var kvp in dict2)
|
||||||
|
{
|
||||||
|
if (!mergedDict.ContainsKey(kvp.Key))
|
||||||
|
{
|
||||||
|
mergedDict.Add(kvp.Key, kvp.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mergedDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CopyValues<T>(T from, T to)
|
||||||
|
{
|
||||||
|
var json = JsonUtility.ToJson(from);
|
||||||
|
JsonUtility.FromJsonOverwrite(json, to);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4227c56e1c9f9564591654f0d69ef04a
|
guid: 0504957ce7fa2b6489c066474e0f3ffa
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -27,14 +27,13 @@ namespace Gallop
|
|||||||
|
|
||||||
public List<DynamicBone> DynamicBones = new List<DynamicBone>();
|
public List<DynamicBone> DynamicBones = new List<DynamicBone>();
|
||||||
|
|
||||||
public List<GameObject> InitiallizeCollider(List<Transform> bones)
|
public Dictionary<string, Transform> InitiallizeCollider(Dictionary<string, Transform> bones)
|
||||||
{
|
{
|
||||||
var colliders = new List<GameObject>();
|
var colliders = new Dictionary<string, Transform>();
|
||||||
foreach (CySpringCollisionData collider in collisionParam)
|
foreach (CySpringCollisionData collider in collisionParam)
|
||||||
{
|
{
|
||||||
if (collider._isInner) continue;
|
if (collider._isInner) continue;
|
||||||
var bone = bones.Find(a => { return a.name == collider._targetObjectName; });
|
if (bones.TryGetValue(collider._targetObjectName, out Transform bone))
|
||||||
if (bone)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
var child = new GameObject(collider._collisionName);
|
var child = new GameObject(collider._collisionName);
|
||||||
@@ -42,7 +41,7 @@ namespace Gallop
|
|||||||
child.transform.localPosition = Vector3.zero;
|
child.transform.localPosition = Vector3.zero;
|
||||||
child.transform.localRotation = Quaternion.identity;
|
child.transform.localRotation = Quaternion.identity;
|
||||||
child.transform.localScale = Vector3.one;
|
child.transform.localScale = Vector3.one;
|
||||||
colliders.Add(child);
|
colliders.Add(child.name, child.transform);
|
||||||
|
|
||||||
switch (collider._type)
|
switch (collider._type)
|
||||||
{
|
{
|
||||||
@@ -78,13 +77,12 @@ namespace Gallop
|
|||||||
return colliders;
|
return colliders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitializePhysics(List<Transform> bones, List<GameObject> colliders)
|
public void InitializePhysics(Dictionary<string, Transform> bones, Dictionary<string, Transform> colliders)
|
||||||
{
|
{
|
||||||
DynamicBones.Clear();
|
DynamicBones.Clear();
|
||||||
foreach (CySpringParamDataElement spring in springParam)
|
foreach (CySpringParamDataElement spring in springParam)
|
||||||
{
|
{
|
||||||
var bone = bones.Find(a => { return a.name == spring._boneName; });
|
if (bones.TryGetValue(spring._boneName,out Transform bone))
|
||||||
if (bone)
|
|
||||||
{
|
{
|
||||||
bool isTail = gameObject.name.Contains("tail");//The tail needs less traction
|
bool isTail = gameObject.name.Contains("tail");//The tail needs less traction
|
||||||
var dynamic = bone.gameObject.AddComponent<DynamicBone>();
|
var dynamic = bone.gameObject.AddComponent<DynamicBone>();
|
||||||
@@ -113,15 +111,14 @@ namespace Gallop
|
|||||||
|
|
||||||
foreach (string collisionName in spring._collisionNameList)
|
foreach (string collisionName in spring._collisionNameList)
|
||||||
{
|
{
|
||||||
var tmp = colliders.Find(a => { return a.gameObject.name == collisionName; });
|
if (colliders.TryGetValue(collisionName,out Transform tmp))
|
||||||
if (tmp)
|
|
||||||
{
|
{
|
||||||
dynamic.Particles[0].m_Colliders.Add(tmp.GetComponent<DynamicBoneColliderBase>());
|
dynamic.Particles[0].m_Colliders.Add(tmp.GetComponent<DynamicBoneColliderBase>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CySpringParamDataChildElement Childcollision in spring._childElements)
|
foreach (CySpringParamDataChildElement Childcollision in spring._childElements)
|
||||||
{
|
{
|
||||||
|
|
||||||
var tempParticle = dynamic.Particles.Find(a => { return a.m_Transform.gameObject.name == Childcollision._boneName; });
|
var tempParticle = dynamic.Particles.Find(a => { return a.m_Transform.gameObject.name == Childcollision._boneName; });
|
||||||
if (tempParticle != null)
|
if (tempParticle != null)
|
||||||
{
|
{
|
||||||
@@ -143,8 +140,7 @@ namespace Gallop
|
|||||||
tempParticle.m_LimitAngel_Max = Childcollision._limitAngleMax;
|
tempParticle.m_LimitAngel_Max = Childcollision._limitAngleMax;
|
||||||
foreach (string collisionName in Childcollision._collisionNameList)
|
foreach (string collisionName in Childcollision._collisionNameList)
|
||||||
{
|
{
|
||||||
var tmp = colliders.Find(a => { return a.gameObject.name == collisionName; });
|
if (colliders.TryGetValue(collisionName,out Transform tmp))
|
||||||
if (tmp)
|
|
||||||
{
|
{
|
||||||
tempParticle.m_Colliders.Add(tmp.GetComponent<DynamicBoneColliderBase>());
|
tempParticle.m_Colliders.Add(tmp.GetComponent<DynamicBoneColliderBase>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Gallop
|
|||||||
public List<MouthTarget> _mouthTarget;
|
public List<MouthTarget> _mouthTarget;
|
||||||
public List<TargetInfomation> _earTarget;
|
public List<TargetInfomation> _earTarget;
|
||||||
|
|
||||||
public List<Transform> Objs;
|
public Dictionary<string, Transform> Objs;
|
||||||
private FacialMorph BaseLEarMorph, BaseREarMorph;
|
private FacialMorph BaseLEarMorph, BaseREarMorph;
|
||||||
private FacialMorph BaseLEyeBrowMorph, BaseREyeBrowMorph;
|
private FacialMorph BaseLEyeBrowMorph, BaseREyeBrowMorph;
|
||||||
private FacialMorph BaseLEyeMorph, BaseREyeMorph;
|
private FacialMorph BaseLEyeMorph, BaseREyeMorph;
|
||||||
@@ -45,16 +45,20 @@ namespace Gallop
|
|||||||
|
|
||||||
List<FacialMorph> leftEarMorph = new List<FacialMorph>();
|
List<FacialMorph> leftEarMorph = new List<FacialMorph>();
|
||||||
List<FacialMorph> rightEarMorph = new List<FacialMorph>();
|
List<FacialMorph> rightEarMorph = new List<FacialMorph>();
|
||||||
public void Initialize(List<Transform> objs)
|
public void Initialize(Dictionary<string, Transform> objs)
|
||||||
{
|
{
|
||||||
Objs = objs;
|
Objs = objs;
|
||||||
|
|
||||||
List<Particle> particles = new List<Particle>();
|
Dictionary<string, Particle> particles = new Dictionary<string, Particle>();
|
||||||
foreach (CySpringDataContainer spring in Container.cySpringDataContainers)
|
foreach (CySpringDataContainer spring in Container.cySpringDataContainers)
|
||||||
{
|
{
|
||||||
foreach (DynamicBone dynamicbone in spring.DynamicBones)
|
foreach (DynamicBone dynamicbone in spring.DynamicBones)
|
||||||
{
|
{
|
||||||
particles.AddRange(dynamicbone.Particles);
|
foreach(var particle in dynamicbone.Particles)
|
||||||
|
{
|
||||||
|
if (!particles.ContainsKey(particle.m_Transform.name))
|
||||||
|
particles.Add(particle.m_Transform.name,particle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,13 +74,12 @@ namespace Gallop
|
|||||||
morph.trsArray = _earTarget[i]._faceGroupInfo[j]._trsArray;
|
morph.trsArray = _earTarget[i]._faceGroupInfo[j]._trsArray;
|
||||||
foreach (TrsArray trs in morph.trsArray)
|
foreach (TrsArray trs in morph.trsArray)
|
||||||
{
|
{
|
||||||
var physicsParticle = particles.Find(a => a.m_Transform.name.Equals(trs._path));
|
if (particles.TryGetValue(trs._path, out Particle physicsParticle))
|
||||||
if (physicsParticle != null)
|
|
||||||
{
|
{
|
||||||
trs.isPhysics = true;
|
trs.isPhysics = true;
|
||||||
trs.physicsParticle = physicsParticle;
|
trs.physicsParticle = physicsParticle;
|
||||||
}
|
}
|
||||||
trs.transform = Objs.Find(ani => ani.name.Equals(trs._path));
|
Objs.TryGetValue(trs._path,out trs.transform);
|
||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@@ -105,7 +108,7 @@ namespace Gallop
|
|||||||
morph.trsArray = _eyebrowTarget[i]._faceGroupInfo[j]._trsArray;
|
morph.trsArray = _eyebrowTarget[i]._faceGroupInfo[j]._trsArray;
|
||||||
foreach (TrsArray trs in morph.trsArray)
|
foreach (TrsArray trs in morph.trsArray)
|
||||||
{
|
{
|
||||||
trs.transform = Objs.Find(ani => ani.name.Equals(trs._path));
|
Objs.TryGetValue(trs._path, out trs.transform);
|
||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@@ -134,7 +137,7 @@ namespace Gallop
|
|||||||
morph.trsArray = _eyeTarget[i]._faceGroupInfo[j]._trsArray;
|
morph.trsArray = _eyeTarget[i]._faceGroupInfo[j]._trsArray;
|
||||||
foreach (TrsArray trs in morph.trsArray)
|
foreach (TrsArray trs in morph.trsArray)
|
||||||
{
|
{
|
||||||
trs.transform = Objs.Find(ani => ani.name.Equals(trs._path));
|
Objs.TryGetValue(trs._path,out trs.transform);
|
||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@@ -174,7 +177,7 @@ namespace Gallop
|
|||||||
morph.trsArray = _mouthTarget[i]._faceGroupInfo[j]._trsArray;
|
morph.trsArray = _mouthTarget[i]._faceGroupInfo[j]._trsArray;
|
||||||
foreach (TrsArray trs in morph.trsArray)
|
foreach (TrsArray trs in morph.trsArray)
|
||||||
{
|
{
|
||||||
trs.transform = Objs.Find(ani => ani.name.Equals(trs._path));
|
Objs.TryGetValue(trs._path, out trs.transform);
|
||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user