Finishing touches
Updated Unity version. Improved animation loading performance. Added buttons for removing spawned objects. Minor fixes.
This commit is contained in:
+1781
-74
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,10 @@ public class UmaContainer : MonoBehaviour
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
if (FaceDrivenKeyTargets != null)
|
||||
{
|
||||
UmaViewerUI.Instance.LoadFacialPanels(null);
|
||||
}
|
||||
if (TryGetComponent<PuppetMaster>(out PuppetMaster t))
|
||||
{
|
||||
Destroy(this);
|
||||
|
||||
@@ -47,10 +47,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
public IEnumerator LoadUma(int id, string costumeId, bool mini)
|
||||
{
|
||||
if (CurrentUMAContainer != null)
|
||||
{
|
||||
Destroy(CurrentUMAContainer);
|
||||
}
|
||||
UnloadUma();
|
||||
CurrentUMAContainer = new GameObject($"Chara_{id}_{costumeId}").AddComponent<UmaContainer>();
|
||||
|
||||
UnloadAllBundle();
|
||||
@@ -378,10 +375,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
public void LoadProp(UmaDatabaseEntry entry)
|
||||
{
|
||||
if (CurrentOtherContainer != null)
|
||||
{
|
||||
Destroy(CurrentOtherContainer);
|
||||
}
|
||||
UnloadProp();
|
||||
UnloadAllBundle();
|
||||
|
||||
CurrentOtherContainer = new GameObject(Path.GetFileName(entry.Name)).AddComponent<UmaContainer>();
|
||||
@@ -394,10 +388,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
var BGasset = UmaViewerMain.Instance.AbList.FirstOrDefault(a => a.Name.EndsWith($"pfb_env_live{live.BackGroundId}_controller000"));
|
||||
if (asset == null|| BGasset == null) return;
|
||||
|
||||
if (CurrentLiveContainer != null)
|
||||
{
|
||||
Destroy(CurrentLiveContainer.gameObject);
|
||||
}
|
||||
UnloadLive();
|
||||
UnloadAllBundle();
|
||||
CurrentLiveContainer = new GameObject(Path.GetFileName(asset.Name)).AddComponent<UmaContainer>();
|
||||
RecursiveLoadAsset(asset);
|
||||
@@ -606,6 +597,10 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
UI.LoadedAssetsAdd(entry);
|
||||
LoadBundle(bundle, IsSubAsset);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"{entry.Name} - {filePath} does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadBundle(AssetBundle bundle, bool IsSubAsset = false)
|
||||
@@ -634,65 +629,69 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if (asset == null) { continue; }
|
||||
Debug.Log("Bundle:" + bundle.name + "/" + name + $" ({asset.GetType()})");
|
||||
Type aType = asset.GetType();
|
||||
if (aType == typeof(AnimationClip))
|
||||
switch (asset)
|
||||
{
|
||||
if (CurrentUMAContainer && CurrentUMAContainer.UmaAnimator && CurrentUMAContainer.UmaAnimator.runtimeAnimatorController)
|
||||
{
|
||||
LoadAnimation(asset as AnimationClip);
|
||||
}
|
||||
case AnimationClip aClip:
|
||||
{
|
||||
if (CurrentUMAContainer && CurrentUMAContainer.UmaAnimator && CurrentUMAContainer.UmaAnimator.runtimeAnimatorController)
|
||||
{
|
||||
LoadAnimation(aClip);
|
||||
}
|
||||
|
||||
if (!CurrentLiveContainer)
|
||||
UnloadBundle(bundle, false);
|
||||
}
|
||||
else if (aType == typeof(GameObject))
|
||||
{
|
||||
if (bundle.name.Contains("cloth"))
|
||||
{
|
||||
if (!CurrentUMAContainer.PhysicsController)
|
||||
{
|
||||
CurrentUMAContainer.PhysicsController = new GameObject("PhysicsController");
|
||||
CurrentUMAContainer.PhysicsController.transform.SetParent(CurrentUMAContainer.transform);
|
||||
if (!CurrentLiveContainer)
|
||||
UnloadBundle(bundle, false);
|
||||
break;
|
||||
}
|
||||
Instantiate(asset as GameObject, CurrentUMAContainer.PhysicsController.transform);
|
||||
}
|
||||
else if (bundle.name.Contains("/head/"))
|
||||
{
|
||||
LoadHead(asset as GameObject);
|
||||
}
|
||||
else if (bundle.name.Contains("/body/"))
|
||||
{
|
||||
LoadBody(asset as GameObject);
|
||||
}
|
||||
else if (bundle.name.Contains("/tail/"))
|
||||
{
|
||||
LoadTail(asset as GameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsSubAsset)
|
||||
case GameObject go:
|
||||
{
|
||||
LoadProp(asset as GameObject);
|
||||
if (bundle.name.Contains("cloth"))
|
||||
{
|
||||
if (!CurrentUMAContainer.PhysicsController)
|
||||
{
|
||||
CurrentUMAContainer.PhysicsController = new GameObject("PhysicsController");
|
||||
CurrentUMAContainer.PhysicsController.transform.SetParent(CurrentUMAContainer.transform);
|
||||
}
|
||||
Instantiate(go, CurrentUMAContainer.PhysicsController.transform);
|
||||
}
|
||||
else if (bundle.name.Contains("/head/"))
|
||||
{
|
||||
LoadHead(go);
|
||||
}
|
||||
else if (bundle.name.Contains("/body/"))
|
||||
{
|
||||
LoadBody(go);
|
||||
}
|
||||
else if (bundle.name.Contains("/tail/"))
|
||||
{
|
||||
LoadTail(go);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsSubAsset)
|
||||
{
|
||||
LoadProp(go);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aType == typeof(Shader))
|
||||
{
|
||||
ShaderList.Add(asset as Shader);
|
||||
}
|
||||
else if (aType == typeof(Texture2D))
|
||||
{
|
||||
if (bundle.name.Contains("/mini/head"))
|
||||
{
|
||||
CurrentUMAContainer.MiniHeadTextures.Add(asset as Texture2D);
|
||||
}
|
||||
else if (bundle.name.Contains("/tail/"))
|
||||
{
|
||||
CurrentUMAContainer.TailTextures.Add(asset as Texture2D);
|
||||
}
|
||||
else if (bundle.name.Contains("bdy0"))
|
||||
{
|
||||
CurrentUMAContainer.GenericBodyTextures.Add(asset as Texture2D);
|
||||
}
|
||||
case Shader sha:
|
||||
ShaderList.Add(sha);
|
||||
break;
|
||||
case Texture2D tex2D:
|
||||
|
||||
if (bundle.name.Contains("/mini/head"))
|
||||
{
|
||||
CurrentUMAContainer.MiniHeadTextures.Add(tex2D);
|
||||
}
|
||||
else if (bundle.name.Contains("/tail/"))
|
||||
{
|
||||
CurrentUMAContainer.TailTextures.Add(tex2D);
|
||||
}
|
||||
else if (bundle.name.Contains("bdy0"))
|
||||
{
|
||||
CurrentUMAContainer.GenericBodyTextures.Add(tex2D);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -911,8 +910,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
else if (clip.name.EndsWith("_loop"))
|
||||
{
|
||||
var motion_s = Main.AbList.FirstOrDefault(a => a.Name.EndsWith(clip.name.Replace("_loop", "_s")));
|
||||
var motion_e = Main.AbList.FirstOrDefault(a => a.Name.EndsWith(CurrentUMAContainer.OverrideController["clip_2"].name.Replace("_loop", "_e")));
|
||||
var motion_s = Main.Motions.FirstOrDefault(a => a.Name.EndsWith(clip.name.Replace("_loop", "_s")));
|
||||
var motion_e = Main.Motions.FirstOrDefault(a => a.Name.EndsWith(CurrentUMAContainer.OverrideController["clip_2"].name.Replace("_loop", "_e")));
|
||||
needTransit = (motion_s != null && motion_e != null);
|
||||
if (needTransit)
|
||||
{
|
||||
@@ -991,4 +990,27 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void UnloadProp()
|
||||
{
|
||||
if(CurrentOtherContainer != null)
|
||||
{
|
||||
Destroy(CurrentOtherContainer.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadLive()
|
||||
{
|
||||
if (CurrentLiveContainer != null)
|
||||
{
|
||||
Destroy(CurrentLiveContainer.gameObject);
|
||||
}
|
||||
}
|
||||
public void UnloadUma()
|
||||
{
|
||||
if (CurrentUMAContainer != null)
|
||||
{
|
||||
Destroy(CurrentUMAContainer.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,20 +18,18 @@ public class UmaViewerMain : MonoBehaviour
|
||||
public List<CharaEntry> Characters = new List<CharaEntry>();
|
||||
public List<LiveEntry> Lives = new List<LiveEntry>();
|
||||
public List<UmaDatabaseEntry> AbList = new List<UmaDatabaseEntry>();
|
||||
public List<UmaDatabaseEntry> Motions = new List<UmaDatabaseEntry>();
|
||||
|
||||
[Header("Asset Memory")]
|
||||
public bool ShadersLoaded = false;
|
||||
public Dictionary<string, AssetBundle> LoadedBundles = new Dictionary<string, AssetBundle>();
|
||||
|
||||
enum Test
|
||||
{
|
||||
a,b,c,d
|
||||
}
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
Application.targetFrameRate = -1;
|
||||
AbList = UmaDatabaseController.Instance.MetaEntries.ToList();
|
||||
Motions = AbList.Where(ab => ab.Name.StartsWith(UmaDatabaseController.MotionPath)).ToList();
|
||||
}
|
||||
|
||||
IEnumerator Start()
|
||||
|
||||
@@ -159,6 +159,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
{
|
||||
Destroy(ui.gameObject);
|
||||
}
|
||||
if (target == null) return;
|
||||
List<FacialMorph> tempMorph = new List<FacialMorph>();
|
||||
tempMorph.AddRange(target.EyeBrowMorphs);
|
||||
tempMorph.AddRange(target.EyeMorphs);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e3034ac770db67489c4cdfe2616296a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1953259897 &8574412962073106934
|
||||
TerrainLayer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: layer_Prototype Black3d3aba195e4d26ee
|
||||
m_DiffuseTexture: {fileID: 2800000, guid: c32a0b1f62ac42e4399935ffff09c099, type: 3}
|
||||
m_NormalMapTexture: {fileID: 0}
|
||||
m_MaskMapTexture: {fileID: 0}
|
||||
m_TileSize: {x: 15, y: 15}
|
||||
m_TileOffset: {x: 0, y: 0}
|
||||
m_Specular: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_Metallic: 0
|
||||
m_Smoothness: 0
|
||||
m_NormalScale: 1
|
||||
m_DiffuseRemapMin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_DiffuseRemapMax: {x: 1, y: 1, z: 1, w: 1}
|
||||
m_MaskMapRemapMin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_MaskMapRemapMax: {x: 1, y: 1, z: 1, w: 1}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b774f87405500984f85ec2df22e12dd8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8574412962073106934
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+12
-12
@@ -5,7 +5,7 @@
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.assetbundlebrowser": {
|
||||
"version": "https://github.com/Unity-Technologies/AssetBundles-Browser.git",
|
||||
@@ -21,14 +21,14 @@
|
||||
"dependencies": {
|
||||
"com.unity.services.core": "1.0.1"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ext.nunit": {
|
||||
"version": "1.0.6",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.formats.fbx": {
|
||||
"version": "4.1.2",
|
||||
@@ -38,7 +38,7 @@
|
||||
"com.unity.timeline": "1.5.2",
|
||||
"com.autodesk.fbx": "4.1.1"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.rider": {
|
||||
"version": "2.0.7",
|
||||
@@ -47,7 +47,7 @@
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.1"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.visualstudio": {
|
||||
"version": "2.0.16",
|
||||
@@ -56,14 +56,14 @@
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.9"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.vscode": {
|
||||
"version": "1.2.5",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.postprocessing": {
|
||||
"version": "3.2.2",
|
||||
@@ -72,7 +72,7 @@
|
||||
"dependencies": {
|
||||
"com.unity.modules.physics": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.services.core": {
|
||||
"version": "1.0.1",
|
||||
@@ -81,7 +81,7 @@
|
||||
"dependencies": {
|
||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.test-framework": {
|
||||
"version": "1.1.31",
|
||||
@@ -92,7 +92,7 @@
|
||||
"com.unity.modules.imgui": "1.0.0",
|
||||
"com.unity.modules.jsonserialize": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.textmeshpro": {
|
||||
"version": "3.0.6",
|
||||
@@ -101,7 +101,7 @@
|
||||
"dependencies": {
|
||||
"com.unity.ugui": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.timeline": {
|
||||
"version": "1.5.2",
|
||||
@@ -113,7 +113,7 @@
|
||||
"com.unity.modules.audio": "1.0.0",
|
||||
"com.unity.modules.particlesystem": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ugui": {
|
||||
"version": "1.0.0",
|
||||
|
||||
@@ -20,7 +20,7 @@ MonoBehaviour:
|
||||
m_Registries:
|
||||
- m_Id: main
|
||||
m_Name:
|
||||
m_Url: https://packages.unity.cn
|
||||
m_Url: https://packages.unity.com
|
||||
m_Scopes: []
|
||||
m_IsDefault: 1
|
||||
m_Capabilities: 7
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 2020.3.24f1c2
|
||||
m_EditorVersionWithRevision: 2020.3.24f1c2 (f3616f7ef48a)
|
||||
m_EditorVersion: 2020.3.28f1
|
||||
m_EditorVersionWithRevision: 2020.3.28f1 (f5400f52e03f)
|
||||
|
||||
Reference in New Issue
Block a user