From 783ee9640ce6da1577f02393c2bcd4a3ab0d62b2 Mon Sep 17 00:00:00 2001 From: IzayoiJiichan Date: Thu, 4 May 2023 00:00:00 +0900 Subject: [PATCH] version 2.5.4 --- CHANGELOG.md | 11 + Documentation~/UniVGO/Installation.ja.md | 44 +- Documentation~/UniVGO/Installation.md | 44 +- .../Editor/Inspector/VgoBlendShapeEditor.cs | 523 ++++++++++++++++++ .../Inspector/VgoBlendShapeEditor.cs.meta | 11 + .../Editor/Inspector/VgoGeneratorEditor.cs | 8 +- UniVgo2/Editor/Inspector/VgoRightEditor.cs | 17 +- UniVgo2/Editor/Menubar/VgoMenu.cs | 1 - UniVgo2/Runtime/Behaviours/VgoBlendShape.cs | 22 +- UniVgo2/Runtime/Models/BlendShapeConfig.cs | 32 +- UniVgo2/Runtime/Models/BlendShapeContext.cs | 24 +- UniVgo2/Runtime/Models/BlendShapesContext.cs | 11 +- .../Runtime/Models/ExportMeshRendererAsset.cs | 14 +- UniVgo2/Runtime/Models/ExportModelAsset.cs | 14 +- UniVgo2/Runtime/Models/MeshAsset.cs | 23 +- UniVgo2/Runtime/Models/MeshContext.cs | 74 ++- UniVgo2/Runtime/Models/ModelAsset.cs | 56 +- UniVgo2/Runtime/Models/ParticleSystemAsset.cs | 14 +- .../Runtime/Porters/Meshes/VgoMeshExporter.cs | 10 +- .../Runtime/Porters/Meshes/VgoMeshImporter.cs | 192 +++---- UniVgo2/Runtime/Porters/VgoImporter.cs | 22 +- UniVgo2/Runtime/UniVgo2.asmdef | 4 +- UniVgo2/Runtime/VgoVersion.cs | 4 +- package.json | 4 +- 24 files changed, 937 insertions(+), 242 deletions(-) create mode 100644 UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs create mode 100644 UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index 607359b..9933915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [2.5.4] - 2023-05-04 + +- Features + - liltoon shader version 1.3.7 is now supported. + - [Editor] Blendshape indices of `Vgo Blend Shape` are now selectable in dropdown format. +- Fixes + - Fixed a setting error for lilToon in versionDefines in UniVgo2.asmdef. + - [Editor] Fixed a problem in which `ModelAsset` was not properly disposed when played in the Editor. +- Changes + - Public fields have been changed to properties. + ## [2.5.3] - 2023-04-04 - Fixes diff --git a/Documentation~/UniVGO/Installation.ja.md b/Documentation~/UniVGO/Installation.ja.md index 428530d..8c2c419 100644 --- a/Documentation~/UniVGO/Installation.ja.md +++ b/Documentation~/UniVGO/Installation.ja.md @@ -37,12 +37,12 @@ Unity 2021.1 以下のバージョンを使用する場合 |パッケージ名|所有者|リポジトリー|仕様バージョン|プログラム バージョン|リリース日| |:---|:---:|:---:|:---:|:---:|:---:| -|com.unity.nuget.newtonsoft-json|Unity Technologies|Nuget|-|3.0.2|2022年3月29日| -|VRMShaders|vrm-c|GitHub||0.85.0|2021年9月30日| -|LilToonShader.Utility|IzayoiJiichan|GitHub||1.0.1|2022年8月21日| +|com.unity.nuget.newtonsoft-json|Unity Technologies|Nuget|-|3.1.0|2023年3月13日| +|VRMShaders|vrm-c|GitHub||0.105.0|2022年10月7日| +|LilToonShader.Utility|IzayoiJiichan|GitHub||1.0.2|2023年5月3日| |UniShaders|IzayoiJiichan|GitHub||1.4.0|2022年5月20日| |VgoSpringBone|IzayoiJiichan|GitHub||1.1.2|2022年8月24日| -|UniVGO2|IzayoiJiichan|GitHub|VGO 2.5|2.5.3|2023年4月4日| +|UniVGO2|IzayoiJiichan|GitHub|VGO 2.5|2.5.4|2023年5月4日| #### 追加パッケージ @@ -50,7 +50,7 @@ Unity 2021.1 以下のバージョンを使用する場合 |パッケージ名|所有者|リポジトリー|仕様バージョン|プログラム バージョン|リリース日|備考| |:---|:---:|:---:|:---:|:---:|:---:|:---:| -|jp.lilxyzw.liltoon|lilxyzw|GitHub||1.3.1|2022年6月28日|| +|jp.lilxyzw.liltoon|lilxyzw|GitHub||1.3.7|2023年1月17日|| |com.unity.render-pipelines.universal|Unity Technologies|Unity Registry||11.0.0|2021年10月26日|URP only| |com.unity.render-pipelines.high-definition|Unity Technologies|Unity Registry||11.0.0|2021年10月26日|HDRP only| @@ -132,13 +132,13 @@ UniVGOを使用するために、以下の設定を追加してください。 ```json { "dependencies": { - "com.izayoi.liltoon.shader.utility": "https://github.com/izayoijiichan/lilToonShaderUtility.git#v1.0.1", + "com.izayoi.liltoon.shader.utility": "https://github.com/izayoijiichan/lilToonShaderUtility.git#v1.0.2", "com.izayoi.unishaders": "https://github.com/izayoijiichan/UniShaders.git#v1.4.0", - "com.izayoi.univgo": "https://github.com/izayoijiican/VGO.git#v2.5.3", + "com.izayoi.univgo": "https://github.com/izayoijiican/VGO.git#v2.5.4", "com.izayoi.vgospringbone": "https://github.com/izayoijiichan/VgoSpringBone.git#v1.1.2", - "com.unity.nuget.newtonsoft-json": "3.0.2", + "com.unity.nuget.newtonsoft-json": "3.1.0", "com.unity.ugui": "1.0.0", - "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.85.0", + "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.105.0", } } ``` @@ -150,7 +150,7 @@ lilToonを使用する場合、"jp.lilxyzw.liltoon" の行を追加してくだ ```json { "dependencies": { - "jp.lilxyzw.liltoon": "https://github.com/lilxyzw/lilToon.git?path=Assets/lilToon#1.3.1", + "jp.lilxyzw.liltoon": "https://github.com/lilxyzw/lilToon.git?path=Assets/lilToon#1.3.7", } } ``` @@ -232,9 +232,17 @@ ___ |UniVRM|UniVGO|min Unity| |:---:|:---:|:---:| -|0.100.0|2.5.3|2020.3| -|0.101.0|2.5.3|2020.3| -|0.102.0|2.5.3|2020.3| +|0.100.0|2.5.4|2020.3| +|0.101.0|2.5.4|2020.3| +|0.102.0|2.5.4|2020.3| +|0.103.2|2.5.4|2020.3| +|0.104.2|2.5.4|2020.3| +|0.105.0|2.5.4|2020.3| +|0.106.0|2.5.4|2020.3| +|0.107.2|2.5.4|2020.3| +|0.108.0|2.5.4|2020.3| +|0.109.0|2.5.4|2020.3| +|0.110.0|2.5.4|2020.3| `/Packages/package.json` に以下の記述を行います。 @@ -242,10 +250,10 @@ ___ { "dependencies": { ... - "com.vrmc.gltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.100.0", - "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.100.0", - "com.vrmc.vrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM10#v0.100.0", - "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.100.0", + "com.vrmc.gltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.105.0", + "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.105.0", + "com.vrmc.vrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM10#v0.105.0", + "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.105.0", ... } } @@ -264,7 +272,7 @@ https://github.com/izayoijiichan/VGO/wiki/How-to-use-UniVRM-and-UniVGO-together |2021.3.0f1|BRP|UniVGO + UniVRM|[Link](https://github.com/izayoijiichan/univgo2.sample.unity.project/tree/unity2021.3.brp.univrm)| ___ -最終更新日:2023年4月4日 +最終更新日:2023年5月4日 編集者:十六夜おじいちゃん *Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.* diff --git a/Documentation~/UniVGO/Installation.md b/Documentation~/UniVGO/Installation.md index a028b82..ea9adb4 100644 --- a/Documentation~/UniVGO/Installation.md +++ b/Documentation~/UniVGO/Installation.md @@ -37,12 +37,12 @@ This package is required for any Unity version. |package name|owner|Repository|specification version|program version|release date| |:---|:---:|:---:|:---:|:---:|:---:| -|com.unity.nuget.newtonsoft-json|Unity Technologies|Nuget|-|3.0.2|29 Mar, 2022| -|VRMShaders|vrm-c|GitHub|VRM 0.0|0.72.0|13 Apr, 2020| -|LilToonShader.Utility|IzayoiJiichan|GitHub||1.0.1|21 Aug, 2022| +|com.unity.nuget.newtonsoft-json|Unity Technologies|Nuget|-|3.1.0|13 Mar, 2023| +|VRMShaders|vrm-c|GitHub|VRM 0.0|0.105.0|7 Oct, 2022| +|LilToonShader.Utility|IzayoiJiichan|GitHub||1.0.2|3 May, 2023| |UniShaders|IzayoiJiichan|GitHub|-|1.4.0|20 May, 2022| |VgoSpringBone|IzayoiJiichan|GitHub|-|1.1.2|24 Aug, 2022| -|UniVGO2|IzayoiJiichan|GitHub|VGO 2.5|2.5.4|4 Apr, 2023| +|UniVGO2|IzayoiJiichan|GitHub|VGO 2.5|2.5.4|4 May, 2023| #### Additional Packages @@ -50,7 +50,7 @@ Add if necessary. |package name|owner|Repository|specification version|program version|release date|remarks| |:---|:---:|:---:|:---:|:---:|:---:|:---:| -|jp.lilxyzw.liltoon|lilxyzw|GitHub||1.3.1|28 Jun, 2022|| +|jp.lilxyzw.liltoon|lilxyzw|GitHub||1.3.7|17 Jan, 2023|| |com.unity.render-pipelines.universal|Unity Technologies|Unity Registry||11.0.0|26 Oct, 2021|URP only| |com.unity.render-pipelines.high-definition|Unity Technologies|Unity Registry||11.0.0|26 Oct, 2021|HDRP only| @@ -131,13 +131,13 @@ To use UniVGO, add the following settings. ```json { "dependencies": { - "com.izayoi.liltoon.shader.utility": "https://github.com/izayoijiichan/lilToonShaderUtility.git#v1.0.1", + "com.izayoi.liltoon.shader.utility": "https://github.com/izayoijiichan/lilToonShaderUtility.git#v1.0.2", "com.izayoi.unishaders": "https://github.com/izayoijiichan/UniShaders.git#v1.4.0", - "com.izayoi.univgo": "https://github.com/izayoijiican/VGO.git#v2.5.3", + "com.izayoi.univgo": "https://github.com/izayoijiican/VGO.git#v2.5.4", "com.izayoi.vgospringbone": "https://github.com/izayoijiichan/VgoSpringBone.git#v1.1.2", - "com.unity.nuget.newtonsoft-json": "3.0.2", + "com.unity.nuget.newtonsoft-json": "3.1.0", "com.unity.ugui": "1.0.0", - "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.85.0", + "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.105.0", } } ``` @@ -149,7 +149,7 @@ If you want to use lilToon, append the line "jp.lilxyzw.liltoon". ```json { "dependencies": { - "jp.lilxyzw.liltoon": "https://github.com/lilxyzw/lilToon.git?path=Assets/lilToon#1.3.1", + "jp.lilxyzw.liltoon": "https://github.com/lilxyzw/lilToon.git?path=Assets/lilToon#1.3.7", } } ``` @@ -230,9 +230,17 @@ The version combinations are as follows. |UniVRM|UniVGO|min Unity| |:---:|:---:|:---:| -|0.100.0|2.5.3|2020.3| -|0.101.0|2.5.3|2020.3| -|0.102.0|2.5.3|2020.3| +|0.100.0|2.5.4|2020.3| +|0.101.0|2.5.4|2020.3| +|0.102.0|2.5.4|2020.3| +|0.103.2|2.5.4|2020.3| +|0.104.2|2.5.4|2020.3| +|0.105.0|2.5.4|2020.3| +|0.106.0|2.5.4|2020.3| +|0.107.2|2.5.4|2020.3| +|0.108.0|2.5.4|2020.3| +|0.109.0|2.5.4|2020.3| +|0.110.0|2.5.4|2020.3| Write the following in ` /Packages/package.json`. @@ -240,10 +248,10 @@ Write the following in ` /Packages/package.json`. { "dependencies": { ... - "com.vrmc.gltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.100.0", - "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.100.0", - "com.vrmc.vrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM10#v0.100.0", - "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.100.0", + "com.vrmc.gltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.105.0", + "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.105.0", + "com.vrmc.vrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM10#v0.105.0", + "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.105.0", ... } } @@ -261,7 +269,7 @@ https://github.com/izayoijiichan/VGO/wiki/How-to-use-UniVRM-and-UniVGO-together |2021.3.0f1|BRP|UniVGO + UniVRM|[Link](https://github.com/izayoijiichan/univgo2.sample.unity.project/tree/unity2021.3.brp.univrm)| ___ -Last updated: 4 April, 2023 +Last updated: 4 May, 2023 Editor: Izayoi Jiichan *Copyright (C) 2020 Izayoi Jiichan. All Rights Reserved.* diff --git a/UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs b/UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs new file mode 100644 index 0000000..1cbf292 --- /dev/null +++ b/UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs @@ -0,0 +1,523 @@ +// ---------------------------------------------------------------------- +// @Namespace : UniVgo2.Editor +// @Class : VgoBlendShapeEditor +// ---------------------------------------------------------------------- +#nullable enable +namespace UniVgo2.Editor +{ + using NewtonVgo; + using System; + using System.Collections.Generic; + using UnityEditor; + using UnityEngine; + using UniVgo2; + + /// + /// VGO Blend Shape Editor + /// + [CustomEditor(typeof(VgoBlendShape))] + public class VgoBlendShapeEditor : ScriptEditorBase + { + /// + private VgoBlendShape? _Target; + + /// Blend Shape Configuration Serialized Property + private SerializedProperty? _BlendShapeConfigurationSerializedProperty; + + /// Blend Shape Configuration + private BlendShapeConfiguration? _BlendShapeConfiguration; + + /// An array of Blend Shape Index. + private int[] _BlendShapeIndices = new int[0]; + + /// An array of Blend Shape Name. + private string[] _BlendShapeNames = new string[0]; + + /// Whether face parts block is open. + private bool _FacePartsBlockIsOpen = false; + + /// Whether blinks block is open. + private bool _BlinksBlockIsOpen = false; + + /// Whether visemes block is open. + private bool _VisemesBlockIsOpen = false; + + /// Whether presets block is open. + private bool _PresetsBlockIsOpen = false; + + /// + /// This function is called when the object becomes enabled and active. + /// + protected override void OnEnable() + { + base.OnEnable(); + + if (target is VgoBlendShape vgoBlendShapeComponent) + { + // + } + else + { + throw new InvalidCastException(); + } + + if (vgoBlendShapeComponent == null) + { + return; + } + + _Target = vgoBlendShapeComponent; + + if (vgoBlendShapeComponent.TryGetComponent(out var skinnedMeshRenderer)) + { + int blendShapeCount = skinnedMeshRenderer.sharedMesh.blendShapeCount; + + if (blendShapeCount > 0) + { + _BlendShapeIndices = new int[blendShapeCount]; + _BlendShapeNames = new string[blendShapeCount]; + + for (int index = 0; index < blendShapeCount; index++) + { + _BlendShapeIndices[index] = index; + _BlendShapeNames[index] = skinnedMeshRenderer.sharedMesh.GetBlendShapeName(index); + } + } + } + + SerializedProperty? blendShapeConfigurationSerializedProperty = serializedObject.FindProperty(nameof(VgoBlendShape.BlendShapeConfiguration)); + + if (blendShapeConfigurationSerializedProperty == null) + { + return; + } + + _BlendShapeConfigurationSerializedProperty = blendShapeConfigurationSerializedProperty; + + if (blendShapeConfigurationSerializedProperty.objectReferenceValue is BlendShapeConfiguration blendShapeConfiguration) + { + // + } + else + { + return; + } + + if (blendShapeConfiguration == null) + { + return; + } + + _BlendShapeConfiguration = blendShapeConfiguration; + } + + /// + /// + /// + public override void OnInspectorGUI() + { + DrawDefaultInspector(); + + if (_Target == null) + { + return; + } + + if (_BlendShapeConfigurationSerializedProperty == null) + { + return; + } + + if (_BlendShapeConfigurationSerializedProperty.objectReferenceValue is BlendShapeConfiguration blendShapeConfiguration) + { + // + } + else + { + return; + } + + _BlendShapeConfiguration = blendShapeConfiguration; + + if (_BlendShapeConfiguration == null) + { + return; + } + + DrawKind(); + + DrawFaceParts(); + + DrawBlinks(); + + DrawVisemes(); + + DrawPresets(); + } + + /// + /// Draw kinds in the inspector. + /// + private void DrawKind() + { + if (_BlendShapeConfiguration == null) + { + return; + } + + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.PrefixLabel("Kind"); + + _BlendShapeConfiguration.kind = (VgoBlendShapeKind)EditorGUILayout.EnumPopup(_BlendShapeConfiguration.kind); + + EditorGUILayout.EndHorizontal(); + } + + /// + /// Draw face parts in the inspector. + /// + private void DrawFaceParts() + { + if (_BlendShapeConfiguration == null) + { + return; + } + + List confFaceParts = _BlendShapeConfiguration.faceParts; + + int listCount = confFaceParts.Count; + + { + EditorGUILayout.BeginHorizontal(); + + _FacePartsBlockIsOpen = EditorGUILayout.Foldout(_FacePartsBlockIsOpen, "Face Parts"); + + listCount = EditorGUILayout.IntField(string.Empty, listCount, GUILayout.Width(50)); + + EditorGUILayout.EndHorizontal(); + } + + if (confFaceParts.Count != listCount) + { + if (confFaceParts.Count < listCount) + { + confFaceParts.Add(new BlendShapeFacePart()); + } + else if (confFaceParts.Count > listCount) + { + for (int index = confFaceParts.Count - 1; index > listCount - 1; index--) + { + confFaceParts.RemoveAt(index); + } + } + } + + if (confFaceParts.Count == 0) + { + return; + } + + if (_FacePartsBlockIsOpen == false) + { + return; + } + + EditorGUI.indentLevel++; + + Color defaultBackgroundColor = GUI.backgroundColor; + + var boxStyle = new GUIStyle("Box"); + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + for (int index = 0; index < confFaceParts.Count; index++) + { + BlendShapeFacePart facePart = confFaceParts[index]; + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + facePart.index = EditorGUILayout.IntPopup("Index", facePart.index, _BlendShapeNames, _BlendShapeIndices); + + facePart.type = (VgoBlendShapeFacePartsType)EditorGUILayout.EnumPopup("Type", facePart.type); + } + } + + GUI.backgroundColor = defaultBackgroundColor; + } + + EditorGUI.indentLevel--; + } + + /// + /// Draw blinks in the inspector. + /// + private void DrawBlinks() + { + if (_BlendShapeConfiguration == null) + { + return; + } + + List confBlinks = _BlendShapeConfiguration.blinks; + + int listCount = confBlinks.Count; + + { + EditorGUILayout.BeginHorizontal(); + + _BlinksBlockIsOpen = EditorGUILayout.Foldout(_BlinksBlockIsOpen, "Blinks"); + + listCount = EditorGUILayout.IntField(string.Empty, listCount, GUILayout.Width(50)); + + EditorGUILayout.EndHorizontal(); + } + + if (confBlinks.Count != listCount) + { + if (confBlinks.Count < listCount) + { + confBlinks.Add(new BlendShapeBlink()); + } + else if (confBlinks.Count > listCount) + { + for (int index = confBlinks.Count - 1; index > listCount - 1; index--) + { + confBlinks.RemoveAt(index); + } + } + } + + if (confBlinks.Count == 0) + { + return; + } + + if (_BlinksBlockIsOpen == false) + { + return; + } + + EditorGUI.indentLevel++; + + var boxStyle = new GUIStyle("Box"); + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + for (int index = 0; index < confBlinks.Count; index++) + { + BlendShapeBlink blink = confBlinks[index]; + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + blink.type = (VgoBlendShapeBlinkType)EditorGUILayout.EnumPopup("Type", blink.type); + + blink.index = EditorGUILayout.IntPopup("Index", blink.index, _BlendShapeNames, _BlendShapeIndices); + } + } + } + + EditorGUI.indentLevel--; + } + + /// + /// Draw visemes in the inspector. + /// + private void DrawVisemes() + { + if (_BlendShapeConfiguration == null) + { + return; + } + + List confVisemes = _BlendShapeConfiguration.visemes; + + int listCount = confVisemes.Count; + + { + EditorGUILayout.BeginHorizontal(); + + _VisemesBlockIsOpen = EditorGUILayout.Foldout(_VisemesBlockIsOpen, "Visemes"); + + listCount = EditorGUILayout.IntField(string.Empty, listCount, GUILayout.Width(50)); + + EditorGUILayout.EndHorizontal(); + } + + if (confVisemes.Count != listCount) + { + if (confVisemes.Count < listCount) + { + confVisemes.Add(new BlendShapeViseme()); + } + else if (confVisemes.Count > listCount) + { + for (int index = confVisemes.Count - 1; index > listCount - 1; index--) + { + confVisemes.RemoveAt(index); + } + } + } + + if (confVisemes.Count == 0) + { + return; + } + + if (_VisemesBlockIsOpen == false) + { + return; + } + + EditorGUI.indentLevel++; + + var boxStyle = new GUIStyle("Box"); + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + for (int index = 0; index < confVisemes.Count; index++) + { + BlendShapeViseme viseme = confVisemes[index]; + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + viseme.type = (VgoBlendShapeVisemeType)EditorGUILayout.EnumPopup("Type", viseme.type); + + viseme.index = EditorGUILayout.IntPopup("Index", viseme.index, _BlendShapeNames, _BlendShapeIndices); + } + } + } + + EditorGUI.indentLevel--; + } + + /// + /// Draw presets in the inspector. + /// + private void DrawPresets() + { + if (_BlendShapeConfiguration == null) + { + return; + } + + List confPresets = _BlendShapeConfiguration.presets; + + int listCount = confPresets.Count; + + { + EditorGUILayout.BeginHorizontal(); + + _PresetsBlockIsOpen = EditorGUILayout.Foldout(_PresetsBlockIsOpen, "Presets"); + + listCount = EditorGUILayout.IntField(string.Empty, listCount, GUILayout.Width(50)); + + EditorGUILayout.EndHorizontal(); + } + + if (confPresets.Count != listCount) + { + if (confPresets.Count < listCount) + { + confPresets.Add(new VgoMeshBlendShapePreset()); + } + else if (confPresets.Count > listCount) + { + for (int index = confPresets.Count - 1; index > listCount - 1; index--) + { + confPresets.RemoveAt(index); + } + } + } + + if (confPresets.Count == 0) + { + return; + } + + if (_PresetsBlockIsOpen == false) + { + return; + } + + EditorGUI.indentLevel++; + + var boxStyle = new GUIStyle("Box"); + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + for (int index = 0; index < confPresets.Count; index++) + { + VgoMeshBlendShapePreset preset = confPresets[index]; + + using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + preset.name = EditorGUILayout.DelayedTextField("Name", preset.name); + + preset.type = (VgoBlendShapePresetType)EditorGUILayout.EnumPopup("Type", preset.type); + + DrawPresetBindings(preset.bindings); + } + } + } + + EditorGUI.indentLevel--; + } + + /// + /// Draw preset bindings in the inspector. + /// + private void DrawPresetBindings(List bindings) + { + int listCount = bindings.Count; + + { + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.LabelField("Bindings"); + + listCount = EditorGUILayout.IntField(string.Empty, listCount, GUILayout.Width(50)); + + EditorGUILayout.EndHorizontal(); + } + + if (bindings.Count != listCount) + { + if (bindings.Count < listCount) + { + bindings.Add(new VgoMeshBlendShapeBinding()); + } + else if (bindings.Count > listCount) + { + for (int index = bindings.Count - 1; index > listCount - 1; index--) + { + bindings.RemoveAt(index); + } + } + } + + if (bindings.Count == 0) + { + return; + } + + EditorGUI.indentLevel++; + + //var boxStyle = new GUIStyle("Box"); + + //using (new EditorGUILayout.VerticalScope(boxStyle, GUILayout.ExpandWidth(true))) + { + for (int index = 0; index < listCount; index++) + { + VgoMeshBlendShapeBinding binding = bindings[index]; + + binding.index = EditorGUILayout.IntPopup("Index", binding.index, _BlendShapeNames, _BlendShapeIndices); + + binding.weight = EditorGUILayout.Slider("Weight", binding.weight, 0.0f, 100.0f); + } + } + + EditorGUI.indentLevel--; + } + } +} diff --git a/UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs.meta b/UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs.meta new file mode 100644 index 0000000..223fa16 --- /dev/null +++ b/UniVgo2/Editor/Inspector/VgoBlendShapeEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fcec5214498056c4a99f2421c4dd78da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UniVgo2/Editor/Inspector/VgoGeneratorEditor.cs b/UniVgo2/Editor/Inspector/VgoGeneratorEditor.cs index d637913..7782871 100644 --- a/UniVgo2/Editor/Inspector/VgoGeneratorEditor.cs +++ b/UniVgo2/Editor/Inspector/VgoGeneratorEditor.cs @@ -13,7 +13,7 @@ namespace UniVgo2.Editor using UniVgo2; /// - /// VGO Meta Editor + /// VGO Generator Editor /// [CustomEditor(typeof(VgoGenerator))] public class VgoGeneratorEditor : ScriptEditorBase @@ -83,15 +83,15 @@ public override void OnInspectorGUI() serializedObject.Update(); - // Meta + // Generator Info if (_GeneratorInfoProperty != null) { //EditorGUILayout.LabelField(_GeneratorInfoProperty.name, EditorStyles.boldLabel); EditorGUI.BeginDisabledGroup(true); SetPropertyFields(_GeneratorInfoProperty, new string[] { - "name", - "version", + "name", + "version", }); EditorGUI.EndDisabledGroup(); } diff --git a/UniVgo2/Editor/Inspector/VgoRightEditor.cs b/UniVgo2/Editor/Inspector/VgoRightEditor.cs index e3a03a6..01bfcef 100644 --- a/UniVgo2/Editor/Inspector/VgoRightEditor.cs +++ b/UniVgo2/Editor/Inspector/VgoRightEditor.cs @@ -35,7 +35,6 @@ public override void OnInspectorGUI() // Script //base.OnInspectorGUI(); - serializedObject.Update(); // Right @@ -44,14 +43,14 @@ public override void OnInspectorGUI() //EditorGUILayout.LabelField(_RightProperty.name, EditorStyles.boldLabel); SetPropertyFields(_RightProperty, new string[] { - "title", - "author", - "organization", - "createdDate", - "updatedDate", - "version", - "distributionUrl", - "licenseUrl", + "title", + "author", + "organization", + "createdDate", + "updatedDate", + "version", + "distributionUrl", + "licenseUrl", }); } diff --git a/UniVgo2/Editor/Menubar/VgoMenu.cs b/UniVgo2/Editor/Menubar/VgoMenu.cs index e8b73e9..a379133 100644 --- a/UniVgo2/Editor/Menubar/VgoMenu.cs +++ b/UniVgo2/Editor/Menubar/VgoMenu.cs @@ -5,7 +5,6 @@ #nullable enable namespace UniVgo2.Editor { - using NewtonVgo; using UnityEditor; using UnityEngine; diff --git a/UniVgo2/Runtime/Behaviours/VgoBlendShape.cs b/UniVgo2/Runtime/Behaviours/VgoBlendShape.cs index aba12a0..34a57c2 100644 --- a/UniVgo2/Runtime/Behaviours/VgoBlendShape.cs +++ b/UniVgo2/Runtime/Behaviours/VgoBlendShape.cs @@ -52,7 +52,7 @@ public int GetVgoBlendShapeIndex(VgoBlendShapeBlinkType blinkType) return -1; } - BlendShapeBlink blendShapeBlink = BlendShapeConfiguration.blinks.Where(x => x.type == blinkType).FirstOrDefault(); + BlendShapeBlink? blendShapeBlink = BlendShapeConfiguration.blinks.FirstOrDefault(x => x.type == blinkType); if (blendShapeBlink == null) { @@ -79,7 +79,7 @@ public int GetVgoBlendShapeIndex(VgoBlendShapeVisemeType visemeType) return -1; } - BlendShapeViseme blendShapeViseme = BlendShapeConfiguration.visemes.Where(x => x.type == visemeType).FirstOrDefault(); + BlendShapeViseme? blendShapeViseme = BlendShapeConfiguration.visemes.FirstOrDefault(x => x.type == visemeType); if (blendShapeViseme == null) { @@ -136,7 +136,7 @@ public void SetBlendShapeWeight(VgoBlendShapeBlinkType blinkType, float value) return; } - BlendShapeBlink vgoBlink = BlendShapeConfiguration.blinks.Where(x => x.type == blinkType).FirstOrDefault(); + BlendShapeBlink? vgoBlink = BlendShapeConfiguration.blinks.FirstOrDefault(x => x.type == blinkType); if (vgoBlink == null) { @@ -163,7 +163,7 @@ public void SetBlendShapeWeight(VgoBlendShapeVisemeType visemeType, float value) return; } - BlendShapeViseme vgoViseme = BlendShapeConfiguration.visemes.Where(x => x.type == visemeType).FirstOrDefault(); + BlendShapeViseme? vgoViseme = BlendShapeConfiguration.visemes.FirstOrDefault(x => x.type == visemeType); if (vgoViseme == null) { @@ -191,7 +191,7 @@ public void SetBlendShapeWeight(VgoBlendShapePresetType presetType, bool ignoreE return; } - VgoMeshBlendShapePreset preset = BlendShapeConfiguration.presets.Where(x => x.type == presetType).FirstOrDefault(); + VgoMeshBlendShapePreset? preset = BlendShapeConfiguration.presets.FirstOrDefault(x => x.type == presetType); if (preset == null) { @@ -204,7 +204,7 @@ public void SetBlendShapeWeight(VgoBlendShapePresetType presetType, bool ignoreE { if (ignoreEyelid) { - var blink = BlendShapeConfiguration.blinks.Where(x => x.index == binding.index).FirstOrDefault(); + BlendShapeBlink? blink = BlendShapeConfiguration.blinks.FirstOrDefault(x => x.index == binding.index); if (blink != null) { @@ -214,7 +214,7 @@ public void SetBlendShapeWeight(VgoBlendShapePresetType presetType, bool ignoreE if (ignoreMouth) { - var visume = BlendShapeConfiguration.visemes.Where(x => x.index == binding.index).FirstOrDefault(); + BlendShapeViseme? visume = BlendShapeConfiguration.visemes.FirstOrDefault(x => x.index == binding.index); if (visume != null) { @@ -222,18 +222,18 @@ public void SetBlendShapeWeight(VgoBlendShapePresetType presetType, bool ignoreE } } - var parts = BlendShapeConfiguration.faceParts.Where(x => x.index == binding.index).FirstOrDefault(); + BlendShapeFacePart? facePart = BlendShapeConfiguration.faceParts.FirstOrDefault(x => x.index == binding.index); - if (parts != null) + if (facePart != null) { - if (parts.type == VgoBlendShapeFacePartsType.Eyelid) + if (facePart.type == VgoBlendShapeFacePartsType.Eyelid) { if (ignoreEyelid) { continue; } } - else if (parts.type == VgoBlendShapeFacePartsType.Mouth) + else if (facePart.type == VgoBlendShapeFacePartsType.Mouth) { if (ignoreMouth) { diff --git a/UniVgo2/Runtime/Models/BlendShapeConfig.cs b/UniVgo2/Runtime/Models/BlendShapeConfig.cs index 40bfb43..6aedaad 100644 --- a/UniVgo2/Runtime/Models/BlendShapeConfig.cs +++ b/UniVgo2/Runtime/Models/BlendShapeConfig.cs @@ -9,15 +9,33 @@ namespace UniVgo2 using System.Collections.Generic; /// - /// BlendShapes Context + /// BlendShape Config /// public class BlendShapeConfig { /// The name of this info. - public string? name; + private string? _Name; /// The kind of the BlendShape. - public VgoBlendShapeKind kind; + private VgoBlendShapeKind _Kind; + + /// List of face parts. + private List _FaceParts = new List(); + + /// List of blink. + private List _Blinks = new List(); + + /// Visemes. + private List _Visemes = new List(); + + /// List of preset. + private List _Presets = new List(); + + /// The name of this info. + public string? Name { get => _Name; set => _Name = value; } + + /// The kind of the BlendShape. + public VgoBlendShapeKind Kind { get => _Kind; set => _Kind = value; } /// List of face parts. /// @@ -25,15 +43,15 @@ public class BlendShapeConfig /// it becomes possible for the application to control such as ignoring changes in the eyelids and mouth when using FaceRig or microphone. /// The ones included in blinks and visemes will work without being set here. /// - public List faceParts = new List(); + public List FaceParts { get => _FaceParts; set => _FaceParts = value; } /// List of blink. - public List blinks = new List(); + public List Blinks { get => _Blinks; set => _Blinks = value; } /// Visemes. - public List visemes = new List(); + public List Visemes { get => _Visemes; set => _Visemes = value; } /// List of preset. - public List presets = new List(); + public List Presets { get => _Presets; set => _Presets = value; } } } diff --git a/UniVgo2/Runtime/Models/BlendShapeContext.cs b/UniVgo2/Runtime/Models/BlendShapeContext.cs index d40993f..d8095fa 100644 --- a/UniVgo2/Runtime/Models/BlendShapeContext.cs +++ b/UniVgo2/Runtime/Models/BlendShapeContext.cs @@ -13,16 +13,28 @@ namespace UniVgo2 public class BlendShapeContext { /// - public string name; + private readonly string _Name = string.Empty; /// - public Vector3[]? positions; + private Vector3[]? _Positions; /// - public Vector3[]? normals; + private Vector3[]? _Normals; /// - public Vector3[]? tangents; + private Vector3[]? _Tangents; + + /// + public string Name => _Name; + + /// + public Vector3[]? Positions { get => _Positions; set => _Positions = value; } + + /// + public Vector3[]? Normals { get => _Normals; set => _Normals = value; } + + /// + public Vector3[]? Tangents { get => _Tangents; set => _Tangents = value; } /// /// Create a new instance of BlendShape with name. @@ -30,7 +42,7 @@ public class BlendShapeContext /// public BlendShapeContext(string name) { - this.name = name; + _Name = name; } /// @@ -39,7 +51,7 @@ public BlendShapeContext(string name) /// A string that represents the current object. public override string ToString() { - return name ?? "{no name}"; + return _Name ?? "{no name}"; } } } diff --git a/UniVgo2/Runtime/Models/BlendShapesContext.cs b/UniVgo2/Runtime/Models/BlendShapesContext.cs index 2aa59d6..a2d2808 100644 --- a/UniVgo2/Runtime/Models/BlendShapesContext.cs +++ b/UniVgo2/Runtime/Models/BlendShapesContext.cs @@ -5,7 +5,6 @@ #nullable enable namespace UniVgo2 { - using NewtonVgo; using System.Collections.Generic; /// @@ -14,9 +13,15 @@ namespace UniVgo2 public class BlendShapesContext { /// A blend shape configuration. - public BlendShapeConfig blendShapeConfig = new BlendShapeConfig(); + private readonly BlendShapeConfig _BlendShapeConfig = new BlendShapeConfig(); /// List of blend shape context. - public List blendShapeContexts = new List(); + private List _BlendShapeContexts = new List(); + + /// A blend shape configuration. + public BlendShapeConfig BlendShapeConfig => _BlendShapeConfig; + + /// List of blend shape context. + public List BlendShapeContexts { get => _BlendShapeContexts; set => _BlendShapeContexts = value; } } } diff --git a/UniVgo2/Runtime/Models/ExportMeshRendererAsset.cs b/UniVgo2/Runtime/Models/ExportMeshRendererAsset.cs index 8619c37..af414d0 100644 --- a/UniVgo2/Runtime/Models/ExportMeshRendererAsset.cs +++ b/UniVgo2/Runtime/Models/ExportMeshRendererAsset.cs @@ -12,15 +12,21 @@ namespace UniVgo2 /// public class ExportMeshRendererAsset { + /// A renderer. + private readonly Renderer _Renderer; + + /// A mesh. + private readonly Mesh _Mesh; + /// A renderer. /// /// This is unique. /// MeshRenderer or SkinnedMeshRenderer or ParticleSystemRenderer /// - public Renderer Renderer; + public Renderer Renderer => _Renderer; /// A mesh. - public Mesh Mesh; + public Mesh Mesh => _Mesh; /// /// Create a new instance of ExportMeshRendererAsset with renderer and mesh. @@ -29,9 +35,9 @@ public class ExportMeshRendererAsset /// public ExportMeshRendererAsset(Renderer renderer, Mesh mesh) { - Renderer = renderer; + _Renderer = renderer; - Mesh = mesh; + _Mesh = mesh; } } } \ No newline at end of file diff --git a/UniVgo2/Runtime/Models/ExportModelAsset.cs b/UniVgo2/Runtime/Models/ExportModelAsset.cs index 0563dbc..ba367c7 100644 --- a/UniVgo2/Runtime/Models/ExportModelAsset.cs +++ b/UniVgo2/Runtime/Models/ExportModelAsset.cs @@ -406,14 +406,14 @@ protected virtual List GetMeshAssetList(List { BlendShapeConfiguration blendShapeConfiguration = vgoBlendShape.BlendShapeConfiguration; - meshAsset.BlendShapeConfig = new BlendShapeConfig() + meshAsset.BlendShapeConfig = new BlendShapeConfig { - name = blendShapeConfiguration.name ?? string.Empty, - kind = blendShapeConfiguration.kind, - faceParts = blendShapeConfiguration.faceParts, - blinks = blendShapeConfiguration.blinks, - visemes = blendShapeConfiguration.visemes, - presets = blendShapeConfiguration.presets, + Name = blendShapeConfiguration.name ?? string.Empty, + Kind = blendShapeConfiguration.kind, + FaceParts = blendShapeConfiguration.faceParts, + Blinks = blendShapeConfiguration.blinks, + Visemes = blendShapeConfiguration.visemes, + Presets = blendShapeConfiguration.presets, }; } } diff --git a/UniVgo2/Runtime/Models/MeshAsset.cs b/UniVgo2/Runtime/Models/MeshAsset.cs index 987622e..ff52b75 100644 --- a/UniVgo2/Runtime/Models/MeshAsset.cs +++ b/UniVgo2/Runtime/Models/MeshAsset.cs @@ -14,24 +14,37 @@ public class MeshAsset { /// A mesh. /// This is unique, if spec version is 2.5 or higher. - public Mesh Mesh; + private readonly Mesh _Mesh; + + /// An array of materials. + private Material?[]? _Materials; + + /// A renderer. + private Renderer? _Renderer; + + /// A blend shape configuration. + private BlendShapeConfig? _BlendShapeConfig; + + /// A mesh. + /// This is unique, if spec version is 2.5 or higher. + public Mesh Mesh => _Mesh; /// An array of materials. /// /// for Import. /// This field is used only in spec version between 2.0 and 2.4. /// - public Material?[]? Materials; + public Material?[]? Materials { get => _Materials; set => _Materials = value; } /// A renderer. /// /// for Export. /// This field is used only in spec version between 2.0 and 2.4. /// - public Renderer? Renderer; + public Renderer? Renderer { get => _Renderer; set => _Renderer = value; } /// A blend shape configuration. - public BlendShapeConfig? BlendShapeConfig; + public BlendShapeConfig? BlendShapeConfig { get => _BlendShapeConfig; set => _BlendShapeConfig = value; } /// /// Create a new instance of MeshAsset with mesh. @@ -39,7 +52,7 @@ public class MeshAsset /// public MeshAsset(Mesh mesh) { - Mesh = mesh; + _Mesh = mesh; } } } diff --git a/UniVgo2/Runtime/Models/MeshContext.cs b/UniVgo2/Runtime/Models/MeshContext.cs index 5ca24f0..5f28aae 100644 --- a/UniVgo2/Runtime/Models/MeshContext.cs +++ b/UniVgo2/Runtime/Models/MeshContext.cs @@ -16,46 +16,88 @@ namespace UniVgo2 public class MeshContext { /// - public string name; + private readonly string _Name = string.Empty; /// - public Vector3[]? positions; + private Vector3[]? _Positions; /// - public Vector3[]? normals; + private Vector3[]? _Normals; /// - public Vector4[]? tangents; + private Vector4[]? _Tangents; /// - public Vector2[]? uv0s; + private Vector2[]? _Uv0s; /// - public Vector2[]? uv1s; + private Vector2[]? _Uv1s; /// - public Vector2[]? uv2s; + private Vector2[]? _Uv2s; /// - public Vector2[]? uv3s; + private Vector2[]? _Uv3s; /// - public Color[]? colors; + private Color[]? _Colors; /// - public Color32[]? color32s; + private Color32[]? _Color32s; /// - public BoneWeight[]? boneWeights; + private BoneWeight[]? _BoneWeights; /// - public List? subMeshes; + private List? _SubMeshes; /// - public List? materialIndices; + private List? _MaterialIndices; /// - public BlendShapesContext? blendShapesContext; + private BlendShapesContext? _BlendShapesContext; + + /// + public string Name => _Name; + + /// + public Vector3[]? Positions { get => _Positions; set => _Positions = value; } + + /// + public Vector3[]? Normals { get => _Normals; set => _Normals = value; } + + /// + public Vector4[]? Tangents { get => _Tangents; set => _Tangents = value; } + + /// + public Vector2[]? UV0s { get => _Uv0s; set => _Uv0s = value; } + + /// + public Vector2[]? UV1s { get => _Uv1s; set => _Uv1s = value; } + + /// + public Vector2[]? UV2s { get => _Uv2s; set => _Uv2s = value; } + + /// + public Vector2[]? UV3s { get => _Uv3s; set => _Uv3s = value; } + + /// + public Color[]? Colors { get => _Colors; set => _Colors = value; } + + /// + public Color32[]? Color32s { get => _Color32s; set => _Color32s = value; } + + /// + public BoneWeight[]? BoneWeights { get => _BoneWeights; set => _BoneWeights = value; } + + /// + public List? SubMeshes { get => _SubMeshes; set => _SubMeshes = value; } + + /// + public List? MaterialIndices { get => _MaterialIndices; set => _MaterialIndices = value; } + + /// + public BlendShapesContext? BlendShapesContext { get => _BlendShapesContext; set => _BlendShapesContext = value; } /// /// Create a new instance of MeshContext with name. @@ -63,7 +105,7 @@ public class MeshContext /// public MeshContext(string name) { - this.name = name ?? throw new ArgumentNullException(nameof(name)); + _Name = name ?? throw new ArgumentNullException(nameof(name)); } /// @@ -72,7 +114,7 @@ public MeshContext(string name) /// A string that represents the current object. public override string ToString() { - return name ?? "{no name}"; + return _Name ?? "{no name}"; } } } diff --git a/UniVgo2/Runtime/Models/ModelAsset.cs b/UniVgo2/Runtime/Models/ModelAsset.cs index 47028d3..e9229e6 100644 --- a/UniVgo2/Runtime/Models/ModelAsset.cs +++ b/UniVgo2/Runtime/Models/ModelAsset.cs @@ -22,38 +22,68 @@ public class ModelAsset : IDisposable #region Fields /// A game object of root. - public GameObject? Root = null; + private GameObject? _Root = null; /// An avatar. - public Avatar? Avatar = null; + private Avatar? _Avatar = null; /// List of unity animation clip. - public List? AnimationClipList = null; + private List? _AnimationClipList = null; /// List of unity collider. - public List? ColliderList = null; + private List? _ColliderList = null; /// List of unity material. - public List? MaterialList = null; + private List? _MaterialList = null; /// List of unity mesh and renderer. - public List? MeshAssetList = null; + private List? _MeshAssetList = null; /// List of unity texture2D. - public List? Texture2dList = null; + private List? _Texture2dList = null; /// List of scriptable object. - public readonly List ScriptableObjectList = new List(); + private readonly List _ScriptableObjectList = new List(); /// Array of spring bone collider group. - public VgoSpringBone.VgoSpringBoneColliderGroup?[]? SpringBoneColliderGroupArray = null; + private VgoSpringBone.VgoSpringBoneColliderGroup?[]? _SpringBoneColliderGroupArray = null; /// A vgo layout. - public VgoLayout? Layout; + private VgoLayout? _Layout = null; /// protected bool disposed; + /// A game object of root. + public GameObject? Root { get => _Root; set => _Root = value; } + + /// An avatar. + public Avatar? Avatar { get => _Avatar; set => _Avatar = value; } + + /// List of unity animation clip. + public List? AnimationClipList { get => _AnimationClipList; set => _AnimationClipList = value; } + + /// List of unity collider. + public List? ColliderList { get => _ColliderList; set => _ColliderList = value; } + + /// List of unity material. + public List? MaterialList { get => _MaterialList; set => _MaterialList = value; } + + /// List of unity mesh and renderer. + public List? MeshAssetList { get => _MeshAssetList; set => _MeshAssetList = value; } + + /// List of unity texture2D. + public List? Texture2dList { get => _Texture2dList; set => _Texture2dList = value; } + + /// List of scriptable object. + public List ScriptableObjectList => _ScriptableObjectList; + + /// Array of spring bone collider group. + public VgoSpringBone.VgoSpringBoneColliderGroup?[]? SpringBoneColliderGroupArray { get => _SpringBoneColliderGroupArray; set => _SpringBoneColliderGroupArray = value; } + + /// A vgo layout. + public VgoLayout? Layout { get => _Layout; set => _Layout = value; } + #endregion #region Constructors @@ -192,7 +222,11 @@ public virtual void DestroyRootAndResources() /// public void DestroyRootAndResourcesForEditor() { - if (Application.isPlaying == false) + if (Application.isPlaying) + { + DestroyRootAndResources(); + } + else { if (Root != null) { diff --git a/UniVgo2/Runtime/Models/ParticleSystemAsset.cs b/UniVgo2/Runtime/Models/ParticleSystemAsset.cs index 97428af..795f6cd 100644 --- a/UniVgo2/Runtime/Models/ParticleSystemAsset.cs +++ b/UniVgo2/Runtime/Models/ParticleSystemAsset.cs @@ -13,10 +13,16 @@ namespace UniVgo2 public class ParticleSystemAsset { /// Particle System - public ParticleSystem ParticleSystem; + private readonly ParticleSystem _ParticleSystem; /// Particle System Renderer - public ParticleSystemRenderer ParticleSystemRenderer; + private readonly ParticleSystemRenderer _ParticleSystemRenderer; + + /// Particle System + public ParticleSystem ParticleSystem => _ParticleSystem; + + /// Particle System Renderer + public ParticleSystemRenderer ParticleSystemRenderer => _ParticleSystemRenderer; /// /// Create a new instance of ParticleSystemAsset with particleSystem and particleSystemRenderer. @@ -25,9 +31,9 @@ public class ParticleSystemAsset /// public ParticleSystemAsset(ParticleSystem particleSystem, ParticleSystemRenderer particleSystemRenderer) { - ParticleSystem = particleSystem; + _ParticleSystem = particleSystem; - ParticleSystemRenderer = particleSystemRenderer; + _ParticleSystemRenderer = particleSystemRenderer; } } } diff --git a/UniVgo2/Runtime/Porters/Meshes/VgoMeshExporter.cs b/UniVgo2/Runtime/Porters/Meshes/VgoMeshExporter.cs index 5f7b988..8fcd62e 100644 --- a/UniVgo2/Runtime/Porters/Meshes/VgoMeshExporter.cs +++ b/UniVgo2/Runtime/Porters/Meshes/VgoMeshExporter.cs @@ -157,21 +157,21 @@ protected virtual VgoMesh CreateVgoMesh(IVgoStorage vgoStorage, MeshAsset meshAs if (blendShapeConfig != null) { - BlendShapeFacePart facePart = blendShapeConfig.faceParts.Where(x => x.index == shapeIndex).FirstOrDefault(); + BlendShapeFacePart? facePart = blendShapeConfig.FaceParts.FirstOrDefault(x => x.index == shapeIndex); if (facePart != null) { vgoMeshBlendShape.facePartsType = facePart.type; } - BlendShapeBlink blink = blendShapeConfig.blinks.Where(x => x.index == shapeIndex).FirstOrDefault(); + BlendShapeBlink? blink = blendShapeConfig.Blinks.FirstOrDefault(x => x.index == shapeIndex); if (blink != null) { vgoMeshBlendShape.blinkType = blink.type; } - BlendShapeViseme viseme = blendShapeConfig.visemes.Where(x => x.index == shapeIndex).FirstOrDefault(); + BlendShapeViseme? viseme = blendShapeConfig.Visemes.FirstOrDefault(x => x.index == shapeIndex); if (viseme != null) { @@ -186,8 +186,8 @@ protected virtual VgoMesh CreateVgoMesh(IVgoStorage vgoStorage, MeshAsset meshAs { if (blendShapeConfig != null) { - vgoMesh.blendShapeKind = blendShapeConfig.kind; - vgoMesh.blendShapePesets = blendShapeConfig.presets; + vgoMesh.blendShapeKind = blendShapeConfig.Kind; + vgoMesh.blendShapePesets = blendShapeConfig.Presets; } } } diff --git a/UniVgo2/Runtime/Porters/Meshes/VgoMeshImporter.cs b/UniVgo2/Runtime/Porters/Meshes/VgoMeshImporter.cs index 929dcb7..cdc5e91 100644 --- a/UniVgo2/Runtime/Porters/Meshes/VgoMeshImporter.cs +++ b/UniVgo2/Runtime/Porters/Meshes/VgoMeshImporter.cs @@ -70,13 +70,13 @@ public virtual MeshAsset CreateMeshAsset(IVgoStorage vgoStorage, int meshIndex, throw new ArgumentNullException(nameof(unityMaterialList)); } - meshAsset.Materials = meshContext.materialIndices.Select(x => unityMaterialList[x]).ToArray(); + meshAsset.Materials = meshContext.MaterialIndices.Select(x => unityMaterialList[x]).ToArray(); } - if ((meshContext.blendShapesContext != null) && - (meshContext.blendShapesContext.blendShapeConfig != null)) + if ((meshContext.BlendShapesContext != null) && + (meshContext.BlendShapesContext.BlendShapeConfig != null)) { - meshAsset.BlendShapeConfig = meshContext.blendShapesContext.blendShapeConfig; + meshAsset.BlendShapeConfig = meshContext.BlendShapesContext.BlendShapeConfig; } return meshAsset; @@ -122,36 +122,36 @@ protected virtual MeshContext ReadMesh(IVgoStorage vgoStorage, int meshIndex) SetPrimitiveAttributes(vgoStorage, meshContext, vgoMesh.attributes, out int positionsCount); // SubMeshes - meshContext.subMeshes = CreateSubMeshes(vgoStorage, vgoMesh.subMeshes, positionsCount); + meshContext.SubMeshes = CreateSubMeshes(vgoStorage, vgoMesh.subMeshes, positionsCount); if (vgoStorage.IsSpecVersion_2_4_orLower) { // Materials - meshContext.materialIndices = vgoMesh.materials ?? new List(); + meshContext.MaterialIndices = vgoMesh.materials ?? new List(); - if (meshContext.materialIndices.Any() == false) + if (meshContext.MaterialIndices.Any() == false) { - meshContext.materialIndices.Add(0); + meshContext.MaterialIndices.Add(0); } } // BlendShapes - meshContext.blendShapesContext = CreateBlendShapes(vgoStorage, vgoMesh.blendShapes); + meshContext.BlendShapesContext = CreateBlendShapes(vgoStorage, vgoMesh.blendShapes); - if ((meshContext.blendShapesContext != null) && - (meshContext.blendShapesContext.blendShapeConfig != null)) + if ((meshContext.BlendShapesContext != null) && + (meshContext.BlendShapesContext.BlendShapeConfig != null)) { - BlendShapeConfig blendShapeConfig = meshContext.blendShapesContext.blendShapeConfig; + BlendShapeConfig blendShapeConfig = meshContext.BlendShapesContext.BlendShapeConfig; - blendShapeConfig.name = vgoMesh.name; + blendShapeConfig.Name = vgoMesh.name; if (vgoStorage.IsSpecVersion_2_4_orLower) { - blendShapeConfig.kind = vgoMesh.blendShapeKind; + blendShapeConfig.Kind = vgoMesh.blendShapeKind; if (vgoMesh.blendShapePesets != null) { - blendShapeConfig.presets = vgoMesh.blendShapePesets; + blendShapeConfig.Presets = vgoMesh.blendShapePesets; } } } @@ -181,16 +181,16 @@ protected virtual void SetPrimitiveAttributes(IVgoStorage vgoStorage, MeshContex if (vgoStorage.GeometryCoordinate == VgoGeometryCoordinate.RightHanded) { - meshContext.positions = new Vector3[positions.Length]; + meshContext.Positions = new Vector3[positions.Length]; for (int idx = 0; idx < positions.Length; idx++) { - meshContext.positions[idx] = positions[idx].ReverseZ(); + meshContext.Positions[idx] = positions[idx].ReverseZ(); } } else { - meshContext.positions = positions; + meshContext.Positions = positions; } positionsCount = positions.Length; @@ -203,16 +203,16 @@ protected virtual void SetPrimitiveAttributes(IVgoStorage vgoStorage, MeshContex if (vgoStorage.GeometryCoordinate == VgoGeometryCoordinate.RightHanded) { - meshContext.normals = new Vector3[normals.Length]; + meshContext.Normals = new Vector3[normals.Length]; for (int idx = 0; idx < normals.Length; idx++) { - meshContext.normals[idx] = normals[idx].ReverseZ(); + meshContext.Normals[idx] = normals[idx].ReverseZ(); } } else { - meshContext.normals = normals; + meshContext.Normals = normals; } } @@ -236,26 +236,26 @@ protected virtual void SetPrimitiveAttributes(IVgoStorage vgoStorage, MeshContex if (vgoStorage.GeometryCoordinate == VgoGeometryCoordinate.RightHanded) { - meshContext.tangents = new Vector4[tangents.Length]; + meshContext.Tangents = new Vector4[tangents.Length]; for (int idx = 0; idx < tangents.Length; idx++) { - meshContext.tangents[idx] = tangents[idx].ReverseZ(); + meshContext.Tangents[idx] = tangents[idx].ReverseZ(); } } else { - meshContext.tangents = tangents; + meshContext.Tangents = tangents; } } } // UVs { - meshContext.uv0s = ReadUV(vgoStorage, attributes.TEXCOORD_0, positionsCount); - meshContext.uv1s = ReadUV(vgoStorage, attributes.TEXCOORD_1, -1); - meshContext.uv2s = ReadUV(vgoStorage, attributes.TEXCOORD_2, -1); - meshContext.uv3s = ReadUV(vgoStorage, attributes.TEXCOORD_3, -1); + meshContext.UV0s = ReadUV(vgoStorage, attributes.TEXCOORD_0, positionsCount); + meshContext.UV1s = ReadUV(vgoStorage, attributes.TEXCOORD_1, -1); + meshContext.UV2s = ReadUV(vgoStorage, attributes.TEXCOORD_2, -1); + meshContext.UV3s = ReadUV(vgoStorage, attributes.TEXCOORD_3, -1); } // Colors @@ -268,14 +268,14 @@ protected virtual void SetPrimitiveAttributes(IVgoStorage vgoStorage, MeshContex // @notice Vector4(byte) = Color32 Color32[] colors = vgoStorage.GetAccessorArrayData(attributes.COLOR_0); - meshContext.color32s = colors; + meshContext.Color32s = colors; } else if (colorAccessor.dataType == VgoResourceAccessorDataType.Vector4Float) { // @notice Vector4(float) = Color Color[] colors = vgoStorage.GetAccessorArrayData(attributes.COLOR_0); - meshContext.colors = colors; + meshContext.Colors = colors; } else { @@ -297,13 +297,13 @@ protected virtual void SetPrimitiveAttributes(IVgoStorage vgoStorage, MeshContex joints = new Vector4Ushort[vec4byteSpan.Length]; - for (int i = 0; i < vec4byteSpan.Length; i++) + for (int idx = 0; idx < vec4byteSpan.Length; idx++) { - joints[i] = new Vector4Ushort( - vec4byteSpan[i].X, - vec4byteSpan[i].Y, - vec4byteSpan[i].Z, - vec4byteSpan[i].W); + joints[idx] = new Vector4Ushort( + vec4byteSpan[idx].X, + vec4byteSpan[idx].Y, + vec4byteSpan[idx].Z, + vec4byteSpan[idx].W); } } else if (jointsAccessor.dataType == VgoResourceAccessorDataType.Vector4UInt16) @@ -321,11 +321,11 @@ protected virtual void SetPrimitiveAttributes(IVgoStorage vgoStorage, MeshContex // BoneWeights if (joints.Length == weights.Length) { - meshContext.boneWeights = new BoneWeight[joints.Length]; + meshContext.BoneWeights = new BoneWeight[joints.Length]; for (int idx = 0; idx < joints.Length; idx++) { - meshContext.boneWeights[idx] = ConvertJointAndWeightToBoneWeight(joints[idx], weights[idx]); + meshContext.BoneWeights[idx] = ConvertJointAndWeightToBoneWeight(joints[idx], weights[idx]); } } } @@ -438,9 +438,9 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn indices = new int[indexSpan.Length]; - for (int i = 0; i < indexSpan.Length; i++) + for (int idx = 0; idx < indexSpan.Length; idx++) { - indices[i] = indexSpan[i]; + indices[idx] = indexSpan[idx]; } } break; @@ -452,9 +452,9 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn indices = new int[indexSpan.Length]; - for (int i = 0; i < indexSpan.Length; i++) + for (int idx = 0; idx < indexSpan.Length; idx++) { - indices[i] = indexSpan[i]; + indices[idx] = indexSpan[idx]; } } break; @@ -466,9 +466,9 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn indices = new int[indexSpan.Length]; - for (int i = 0; i < indexSpan.Length; i++) + for (int idx = 0; idx < indexSpan.Length; idx++) { - indices[i] = (int)indexSpan[i]; + indices[idx] = (int)indexSpan[idx]; } } break; @@ -499,7 +499,7 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn BlendShapesContext context = new BlendShapesContext() { - blendShapeContexts = new List(vgoMeshBlendShapes.Count), + BlendShapeContexts = new List(vgoMeshBlendShapes.Count), }; for (int shapeIndex = 0; shapeIndex < vgoMeshBlendShapes.Count; shapeIndex++) @@ -525,16 +525,16 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn if (vgoStorage.GeometryCoordinate == VgoGeometryCoordinate.RightHanded) { - blendShape.positions = new Vector3[positions.Length]; + blendShape.Positions = new Vector3[positions.Length]; for (int idx = 0; idx < positions.Length; idx++) { - blendShape.positions[idx] = positions[idx].ReverseZ(); + blendShape.Positions[idx] = positions[idx].ReverseZ(); } } else { - blendShape.positions = positions; + blendShape.Positions = positions; } } @@ -544,16 +544,16 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn if (vgoStorage.GeometryCoordinate == VgoGeometryCoordinate.RightHanded) { - blendShape.normals = new Vector3[normals.Length]; + blendShape.Normals = new Vector3[normals.Length]; for (int idx = 0; idx < normals.Length; idx++) { - blendShape.normals[idx] = normals[idx].ReverseZ(); + blendShape.Normals[idx] = normals[idx].ReverseZ(); } } else { - blendShape.normals = normals; + blendShape.Normals = normals; } } @@ -563,20 +563,20 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn if (vgoStorage.GeometryCoordinate == VgoGeometryCoordinate.RightHanded) { - blendShape.tangents = new Vector3[tangents.Length]; + blendShape.Tangents = new Vector3[tangents.Length]; for (int idx = 0; idx < tangents.Length; idx++) { - blendShape.tangents[idx] = tangents[idx].ReverseZ(); + blendShape.Tangents[idx] = tangents[idx].ReverseZ(); } } else { - blendShape.tangents = tangents; + blendShape.Tangents = tangents; } } - context.blendShapeContexts.Add(blendShape); + context.BlendShapeContexts.Add(blendShape); if (vgoBlendShape.facePartsType != VgoBlendShapeFacePartsType.None) { @@ -586,7 +586,7 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn type = vgoBlendShape.facePartsType, }; - context.blendShapeConfig.faceParts.Add(facePart); + context.BlendShapeConfig.FaceParts.Add(facePart); } if (vgoBlendShape.blinkType != VgoBlendShapeBlinkType.None) @@ -597,7 +597,7 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn type = vgoBlendShape.blinkType, }; - context.blendShapeConfig.blinks.Add(blink); + context.BlendShapeConfig.Blinks.Add(blink); } if (vgoBlendShape.visemeType != VgoBlendShapeVisemeType.None) @@ -608,7 +608,7 @@ protected virtual int[] GetSubMeshIndices(IVgoStorage vgoStorage, int accessorIn type = vgoBlendShape.visemeType, }; - context.blendShapeConfig.visemes.Add(viseme); + context.BlendShapeConfig.Visemes.Add(viseme); } } @@ -628,26 +628,26 @@ protected virtual Mesh BuildMesh(MeshContext meshContext) { Mesh mesh = new Mesh { - name = meshContext.name + name = meshContext.Name }; // Positions - if ((meshContext.positions != null) && meshContext.positions.Any()) + if ((meshContext.Positions != null) && meshContext.Positions.Any()) { - if (meshContext.positions.Length > UInt16.MaxValue) + if (meshContext.Positions.Length > UInt16.MaxValue) { // UNITY_2017_3_OR_NEWER mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; } - mesh.SetVertices(meshContext.positions); + mesh.SetVertices(meshContext.Positions); } // Normals bool recalculateNormals = true; - if ((meshContext.normals != null) && meshContext.normals.Any()) + if ((meshContext.Normals != null) && meshContext.Normals.Any()) { - mesh.SetNormals(meshContext.normals); + mesh.SetNormals(meshContext.Normals); recalculateNormals = false; } @@ -657,56 +657,56 @@ protected virtual Mesh BuildMesh(MeshContext meshContext) if (_Option.ImportTangents) { - if ((meshContext.tangents != null) && meshContext.tangents.Any()) + if ((meshContext.Tangents != null) && meshContext.Tangents.Any()) { - mesh.SetTangents(meshContext.tangents); + mesh.SetTangents(meshContext.Tangents); recalculateTangents = false; } } // UVs - if ((meshContext.uv0s != null) && meshContext.uv0s.Any()) + if ((meshContext.UV0s != null) && meshContext.UV0s.Any()) { - mesh.SetUVs(channel: 0, meshContext.uv0s); + mesh.SetUVs(channel: 0, meshContext.UV0s); } - if ((meshContext.uv1s != null) && meshContext.uv1s.Any()) + if ((meshContext.UV1s != null) && meshContext.UV1s.Any()) { - mesh.SetUVs(channel: 1, meshContext.uv1s); + mesh.SetUVs(channel: 1, meshContext.UV1s); } - if ((meshContext.uv2s != null) && meshContext.uv2s.Any()) + if ((meshContext.UV2s != null) && meshContext.UV2s.Any()) { - mesh.SetUVs(channel: 2, meshContext.uv2s); + mesh.SetUVs(channel: 2, meshContext.UV2s); } - if ((meshContext.uv3s != null) && meshContext.uv3s.Any()) + if ((meshContext.UV3s != null) && meshContext.UV3s.Any()) { - mesh.SetUVs(channel: 3, meshContext.uv3s); + mesh.SetUVs(channel: 3, meshContext.UV3s); } // Colors - if ((meshContext.color32s != null) && meshContext.color32s.Any()) + if ((meshContext.Color32s != null) && meshContext.Color32s.Any()) { - mesh.SetColors(meshContext.color32s); + mesh.SetColors(meshContext.Color32s); } - else if ((meshContext.colors != null) && meshContext.colors.Any()) + else if ((meshContext.Colors != null) && meshContext.Colors.Any()) { - mesh.SetColors(meshContext.colors); + mesh.SetColors(meshContext.Colors); } // BoneWeights - if ((meshContext.boneWeights != null) && meshContext.boneWeights.Any()) + if ((meshContext.BoneWeights != null) && meshContext.BoneWeights.Any()) { - mesh.boneWeights = meshContext.boneWeights; + mesh.boneWeights = meshContext.BoneWeights; } // SubMesh - if (meshContext.subMeshes != null) + if (meshContext.SubMeshes != null) { - mesh.subMeshCount = meshContext.subMeshes.Count; + mesh.subMeshCount = meshContext.SubMeshes.Count; - for (int i = 0; i < meshContext.subMeshes.Count; ++i) + for (int i = 0; i < meshContext.SubMeshes.Count; ++i) { - mesh.SetTriangles(meshContext.subMeshes[i], i); + mesh.SetTriangles(meshContext.SubMeshes[i], i); } } @@ -723,31 +723,31 @@ protected virtual Mesh BuildMesh(MeshContext meshContext) } // BlendShape - if (meshContext.blendShapesContext != null) + if (meshContext.BlendShapesContext != null) { Vector3[]? emptyVertices = null; - foreach (BlendShapeContext blendShape in meshContext.blendShapesContext.blendShapeContexts) + foreach (BlendShapeContext blendShape in meshContext.BlendShapesContext.BlendShapeContexts) { - if (blendShape.positions?.Length > 0) + if (blendShape.Positions?.Length > 0) { - if (blendShape.positions.Length == mesh.vertexCount) + if (blendShape.Positions.Length == mesh.vertexCount) { - Vector3[] deltaPositions = blendShape.positions; + Vector3[] deltaPositions = blendShape.Positions; Vector3[]? deltaNormals = null; - if ((meshContext.normals != null) && - (meshContext.normals.Length == mesh.vertexCount) && - (blendShape.normals.Count() == blendShape.positions.Count())) + if ((meshContext.Normals != null) && + (meshContext.Normals.Length == mesh.vertexCount) && + (blendShape.Normals.Count() == blendShape.Positions.Count())) { - deltaNormals = blendShape.normals; + deltaNormals = blendShape.Normals; } - mesh.AddBlendShapeFrame(blendShape.name, frameWeight: 100.0f, deltaPositions, deltaNormals, deltaTangents: null); + mesh.AddBlendShapeFrame(blendShape.Name, frameWeight: 100.0f, deltaPositions, deltaNormals, deltaTangents: null); } else { - Debug.LogWarningFormat("May be partial primitive has blendShape. Require separate mesh or extend blend shape, but not implemented: {0}", blendShape.name); + Debug.LogWarningFormat("May be partial primitive has blendShape. Require separate mesh or extend blend shape, but not implemented: {0}", blendShape.Name); } } else @@ -758,7 +758,7 @@ protected virtual Mesh BuildMesh(MeshContext meshContext) } // add empty blend shape for keep blend shape index - mesh.AddBlendShapeFrame(blendShape.name, frameWeight: 100.0f, emptyVertices, deltaNormals: null, deltaTangents: null); + mesh.AddBlendShapeFrame(blendShape.Name, frameWeight: 100.0f, emptyVertices, deltaNormals: null, deltaTangents: null); } } } diff --git a/UniVgo2/Runtime/Porters/VgoImporter.cs b/UniVgo2/Runtime/Porters/VgoImporter.cs index 6b6a9cc..dce34cb 100644 --- a/UniVgo2/Runtime/Porters/VgoImporter.cs +++ b/UniVgo2/Runtime/Porters/VgoImporter.cs @@ -1054,18 +1054,18 @@ protected virtual void AttachMeshAndRenderer(List nodes, int nodeInde } if ((meshAsset.BlendShapeConfig != null) && - (meshAsset.BlendShapeConfig.kind != VgoBlendShapeKind.None)) + (meshAsset.BlendShapeConfig.Kind != VgoBlendShapeKind.None)) { var vgoBlendShape = go.AddComponent(); BlendShapeConfiguration blendShapeConfiguration = ScriptableObject.CreateInstance(); - blendShapeConfiguration.name = meshAsset.BlendShapeConfig.name; - blendShapeConfiguration.kind = meshAsset.BlendShapeConfig.kind; - blendShapeConfiguration.faceParts = meshAsset.BlendShapeConfig.faceParts; - blendShapeConfiguration.blinks = meshAsset.BlendShapeConfig.blinks; - blendShapeConfiguration.visemes = meshAsset.BlendShapeConfig.visemes; - blendShapeConfiguration.presets = meshAsset.BlendShapeConfig.presets; + blendShapeConfiguration.name = meshAsset.BlendShapeConfig.Name; + blendShapeConfiguration.kind = meshAsset.BlendShapeConfig.Kind; + blendShapeConfiguration.faceParts = meshAsset.BlendShapeConfig.FaceParts; + blendShapeConfiguration.blinks = meshAsset.BlendShapeConfig.Blinks; + blendShapeConfiguration.visemes = meshAsset.BlendShapeConfig.Visemes; + blendShapeConfiguration.presets = meshAsset.BlendShapeConfig.Presets; vgoBlendShape.BlendShapeConfiguration = blendShapeConfiguration; @@ -1163,13 +1163,13 @@ protected virtual void AttachMeshAndRenderer(List nodes, int nodeInde BlendShapeConfiguration blendShapeConfiguration = ScriptableObject.CreateInstance(); - blendShapeConfiguration.name = meshAsset.BlendShapeConfig.name; + blendShapeConfiguration.name = meshAsset.BlendShapeConfig.Name; blendShapeConfiguration.kind = vgoMeshRenderer.blendShapeKind.Value; - blendShapeConfiguration.faceParts = meshAsset.BlendShapeConfig.faceParts; - blendShapeConfiguration.blinks = meshAsset.BlendShapeConfig.blinks; - blendShapeConfiguration.visemes = meshAsset.BlendShapeConfig.visemes; + blendShapeConfiguration.faceParts = meshAsset.BlendShapeConfig.FaceParts; + blendShapeConfiguration.blinks = meshAsset.BlendShapeConfig.Blinks; + blendShapeConfiguration.visemes = meshAsset.BlendShapeConfig.Visemes; if (vgoMeshRenderer.blendShapePesets != null && vgoMeshRenderer.blendShapePesets.Any()) diff --git a/UniVgo2/Runtime/UniVgo2.asmdef b/UniVgo2/Runtime/UniVgo2.asmdef index ada2c6f..599b1b6 100644 --- a/UniVgo2/Runtime/UniVgo2.asmdef +++ b/UniVgo2/Runtime/UniVgo2.asmdef @@ -28,12 +28,12 @@ "defineConstraints": [], "versionDefines": [ { - "name": "com.izayoi.liltoon.shader.utility", + "name": "jp.lilxyzw.liltoon", "expression": "[1.2.0,1.2.12]", "define": "LILTOON_1_2_12_OR_OLDER" }, { - "name": "com.izayoi.liltoon.shader.utility", + "name": "jp.lilxyzw.liltoon", "expression": "1.3.0", "define": "LILTOON_1_3_0_OR_NEWER" }, diff --git a/UniVgo2/Runtime/VgoVersion.cs b/UniVgo2/Runtime/VgoVersion.cs index 0cf970c..a0d36e1 100644 --- a/UniVgo2/Runtime/VgoVersion.cs +++ b/UniVgo2/Runtime/VgoVersion.cs @@ -17,9 +17,9 @@ public class VgoVersion public const int MINOR = 5; /// Patch - public const int PATCH = 3; + public const int PATCH = 4; /// Version - public const string VERSION = "2.5.3"; + public const string VERSION = "2.5.4"; } } diff --git a/package.json b/package.json index da8e960..20edfd7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.izayoi.univgo", "displayName": "UniVGO", "description": "UniVGO is a package that can handle VGO files in Unity.", - "version": "2.5.3", + "version": "2.5.4", "type": "tool", "category": "", "keywords": [ @@ -31,7 +31,7 @@ "url": "git+https://github.com/izayoijiichan/VGO.git" }, "dependencies": { - "com.izayoi.liltoon.shader.utility": "1.0.1", + "com.izayoi.liltoon.shader.utility": "1.0.2", "com.izayoi.unishaders": "1.4.0", "com.izayoi.vgospringbone": "1.1.2", "com.unity.nuget.newtonsoft-json": "3.0.0",