summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/VRM
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/ThirdParty/VRM')
-rw-r--r--Assets/ThirdParty/VRM/VRM.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/CHANGELOG.md3
-rw-r--r--Assets/ThirdParty/VRM/VRM/CHANGELOG.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef3
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef15
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs24
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs200
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs38
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE21
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs95
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs150
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs47
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md66
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs252
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs9
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs102
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs52
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs42
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs101
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs91
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs41
-rw-r--r--Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/Documentation.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/Documentation/VRM.md23
-rw-r--r--Assets/ThirdParty/VRM/VRM/Documentation/VRM.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/LICENSE.md9
-rw-r--r--Assets/ThirdParty/VRM/VRM/LICENSE.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/README.md21
-rw-r--r--Assets/ThirdParty/VRM/VRM/README.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/README.url2
-rw-r--r--Assets/ThirdParty/VRM/VRM/README.url.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs51
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs115
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs61
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs152
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs17
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs112
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs198
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs329
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs21
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs36
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs224
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs129
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef15
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs724
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef18
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs45
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs86
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md21
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/README.md56
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/README.md.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader54
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader63
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader56
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs142
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs19
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs76
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs319
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs203
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs193
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs16
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs55
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs58
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs27
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs54
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs32
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs32
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs35
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs22
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs68
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs48
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs504
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs252
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs34
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs266
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs60
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs232
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs174
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs78
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs34
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs123
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs142
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs140
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs222
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs342
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs54
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs81
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs2207
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs3175
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs74
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs1128
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs316
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs316
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs414
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs868
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs15
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs215
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs123
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs186
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs201
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs93
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs207
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs315
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs348
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs258
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs51
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs435
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs385
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs85
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs372
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs52
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs17
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs100
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs422
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs151
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs352
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs1360
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef15
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs49
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md21
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs185
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs103
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md77
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset111
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs149
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity691
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs83
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity615
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat76
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs134
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs269
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs28
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs103
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs80
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs71
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs444
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs33
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs143
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs41
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs131
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs15
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs235
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs45
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs49
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs105
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs92
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs244
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs232
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs60
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs44
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs71
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs58
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs354
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs202
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs41
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs150
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs200
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs441
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs92
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs50
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs50
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs220
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs120
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs34
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs36
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs50
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs98
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs128
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs129
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef14
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs168
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE21
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/README.md138
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/README.md.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs20
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs90
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs85
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs611
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs34
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs85
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs60
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs23
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs15
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs52
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs28
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs113
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs176
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs119
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs178
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs274
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs262
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs72
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs53
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs256
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs53
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs43
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs109
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs288
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs63
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs149
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs153
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs43
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs44
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs546
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs297
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs101
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs445
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs187
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs372
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs125
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs88
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs300
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs51
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs307
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs441
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs430
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs686
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs33
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs320
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs143
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs458
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs59
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs17
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs96
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs138
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs77
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs434
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs609
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs416
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs313
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs341
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs767
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs84
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs80
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs185
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs171
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs138
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs199
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs444
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs33
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs341
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs44
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs159
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs63
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs171
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs341
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs99
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs277
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs168
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs309
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs71
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs76
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs179
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs19
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs30
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs88
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs48
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs311
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs214
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs240
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs226
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs53
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs52
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs151
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs327
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs391
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs80
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs55
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs67
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs144
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs58
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs185
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs29
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs250
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs161
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs170
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs59
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs81
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs104
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs39
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs21
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs48
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs63
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs89
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef21
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs687
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs58
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs58
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef20
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs30
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants33
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader61
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader58
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader61
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader61
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs1953
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs149
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs122
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs146
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs61
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs146
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs149
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs119
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs288
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs236
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs306
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs211
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs20
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs137
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs294
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs91
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs15
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs205
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs65
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs116
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs404
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs230
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs124
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs20
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs105
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs135
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs136
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs120
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs332
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs108
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs171
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs110
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs56
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs19
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs75
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs78
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs36
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs38
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs61
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs253
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs90
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs131
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs220
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs107
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs84
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs238
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs92
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs327
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs47
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs.meta13
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs267
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs55
-rw-r--r--Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRM/VRM.asmdef20
-rw-r--r--Assets/ThirdParty/VRM/VRM/VRM.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRM/package.json20
-rw-r--r--Assets/ThirdParty/VRM/VRM/package.json.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/Documentation.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md6
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/LICENSE.md10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/LICENSE.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE21
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs61
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs459
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader166
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc279
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc19
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc37
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat108
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat108
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat76
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat127
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat.meta10
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity1984
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs44
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs109
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs116
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs180
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs283
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/README.md11
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/MToon/README.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/README.md17
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/README.md.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs99
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs20
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs.meta11
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs52
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs34
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs27
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs64
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs67
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs16
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs67
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs27
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs26
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs159
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta12
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader101
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta9
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta8
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs153
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef3
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta7
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/package.json14
-rw-r--r--Assets/ThirdParty/VRM/VRMShaders/package.json.meta7
891 files changed, 70616 insertions, 0 deletions
diff --git a/Assets/ThirdParty/VRM/VRM.meta b/Assets/ThirdParty/VRM/VRM.meta
new file mode 100644
index 00000000..3d6c4892
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8047ecfc909c7f044bad5c7d10844e41
+folderAsset: yes
+timeCreated: 1546056800
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/CHANGELOG.md b/Assets/ThirdParty/VRM/VRM/CHANGELOG.md
new file mode 100644
index 00000000..ae216065
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/CHANGELOG.md
@@ -0,0 +1,3 @@
+# Changelog
+
+Please refer to the latest release note in [Releases](https://github.com/vrm-c/UniVRM/releases) for all notable changes.
diff --git a/Assets/ThirdParty/VRM/VRM/CHANGELOG.md.meta b/Assets/ThirdParty/VRM/VRM/CHANGELOG.md.meta
new file mode 100644
index 00000000..d2c7fa71
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/CHANGELOG.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: be63197ddd406ae4fa059b6dedd8a997
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler.meta
new file mode 100644
index 00000000..188bdd0a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e236dfbc6df5ab5469d6d6d2332442de
+folderAsset: yes
+timeCreated: 1545999482
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef
new file mode 100644
index 00000000..d73eebc4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef
@@ -0,0 +1,3 @@
+{
+ "name": "DepthFirstScheduler"
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef.meta
new file mode 100644
index 00000000..57a5b232
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/DepthFirstScheduler.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3c1b656429ea86147a4d76b21be3f0c0
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor.meta
new file mode 100644
index 00000000..d8c297a9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cc0ab91a2011fcf4d925dd94bccdb243
+folderAsset: yes
+timeCreated: 1540294739
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests.meta
new file mode 100644
index 00000000..60f4d20d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 09d89e608be4dc847bde82a73a9d2d2d
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef
new file mode 100644
index 00000000..c0a902ad
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef
@@ -0,0 +1,15 @@
+{
+ "name": "DepthFirstScheduler.Editor.Tests",
+ "references": [
+ "VRM",
+ "DepthFirstScheduler"
+ ],
+ "optionalUnityReferences": [
+ "TestAssemblies"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef.meta
new file mode 100644
index 00000000..702e17d2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.Editor.Tests.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 68dc264f14f3454489a3339633e115f9
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs
new file mode 100644
index 00000000..10141080
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs
@@ -0,0 +1,24 @@
+using NUnit.Framework;
+using System.Linq;
+
+
+namespace DepthFirstScheduler
+{
+ public class DepthFirstScheduler
+ {
+ [Test]
+ public void ScheduleTreeTest()
+ {
+ var s = Schedulable.Create();
+
+ var tasks = s.GetRoot().Traverse().ToArray();
+ Assert.AreEqual(2, tasks.Length);
+
+ var task_int = s.AddTask(Scheduler.CurrentThread, () => 0);
+ task_int = task_int.ContinueWith(Scheduler.CurrentThread, _ => 1);
+
+ var status = s.Execute();
+ Assert.AreEqual(ExecutionStatus.Done, status);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs.meta
new file mode 100644
index 00000000..8053a0ee
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Editor/Tests/DepthFirstScheduler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3003e87b5df13394eadfda925bb816e5
+timeCreated: 1540294752
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs
new file mode 100644
index 00000000..735dbbdf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs
@@ -0,0 +1,200 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace DepthFirstScheduler
+{
+ public enum ExecutionStatus
+ {
+ Unknown,
+ Done,
+ Continue, // coroutine or schedulable
+ Error,
+ }
+
+ public interface IFunctor<T>
+ {
+ T GetResult();
+ Exception GetError();
+ ExecutionStatus Execute();
+ }
+
+ #region Functor
+ public class Functor<T> : IFunctor<T>
+ {
+ T m_result;
+ public T GetResult()
+ {
+ return m_result;
+ }
+
+ Exception m_error;
+ public Exception GetError()
+ {
+ return m_error;
+ }
+
+ Action m_pred;
+ public Functor(Func<T> func)
+ {
+ m_pred = () => m_result = func();
+ }
+
+ public ExecutionStatus Execute()
+ {
+ try
+ {
+ m_pred();
+ return ExecutionStatus.Done;
+ }
+ catch (Exception ex)
+ {
+ m_error = ex;
+ return ExecutionStatus.Error;
+ }
+ }
+ }
+
+ public static class Functor
+ {
+ /// <summary>
+ /// 引数の型を隠蔽した実行器を生成する
+ /// </summary>
+ /// <typeparam name="S">引数の型</typeparam>
+ /// <typeparam name="T">結果の型</typeparam>
+ /// <param name="arg"></param>
+ /// <param name="pred"></param>
+ /// <returns></returns>
+ public static Functor<T> Create<S, T>(Func<S> arg, Func<S, T> pred)
+ {
+ return new Functor<T>(() => pred(arg()));
+ }
+ }
+ #endregion
+
+ #region CoroutineFunctor
+ public class CoroutineFunctor<T> : IFunctor<T>
+ {
+ public T GetResult()
+ {
+ if (m_last?.Current == null) return default;
+
+ try
+ {
+ return (T)m_last.Current;
+ }
+ catch
+ {
+ return default;
+ }
+ }
+
+ Exception m_error;
+ public Exception GetError()
+ {
+ return m_error;
+ }
+
+ Func<IEnumerator> m_starter;
+ Stack<IEnumerator> m_it;
+ private IEnumerator m_last;
+ public CoroutineFunctor(Func<IEnumerator> starter)
+ {
+ m_starter = starter;
+ }
+
+ public ExecutionStatus Execute()
+ {
+ if (m_it == null)
+ {
+ m_it = new Stack<IEnumerator>();
+ m_it.Push(m_starter());
+ }
+
+ try
+ {
+ if (m_it.Count!=0)
+ {
+ if (m_it.Peek().MoveNext())
+ {
+ var nested = m_it.Peek().Current as IEnumerator;
+ if (nested!=null)
+ {
+ m_it.Push(nested);
+ }
+ }
+ else
+ {
+ m_last = m_it.Pop();
+ }
+ return ExecutionStatus.Continue;
+ }
+ else
+ {
+ return ExecutionStatus.Done;
+ }
+
+ }
+ catch(Exception ex)
+ {
+ m_error = ex;
+ return ExecutionStatus.Error;
+ }
+ }
+ }
+
+ public static class CoroutineFunctor
+ {
+ /// <typeparam name="S">引数の型</typeparam>
+ /// <typeparam name="T">結果の型</typeparam>
+ public static CoroutineFunctor<T> Create<S, T>(Func<S> arg, Func<S, IEnumerator> starter)
+ {
+ return new CoroutineFunctor<T>(() => starter(arg()));
+ }
+ }
+ #endregion
+
+ /*
+ public class SchedulableFunctor<T> : IFunctor<T>
+ {
+ Schedulable<T> m_schedulable;
+ Func<Schedulable<T>> m_starter;
+ TaskChain m_chain;
+
+ public SchedulableFunctor(Func<Schedulable<T>> starter)
+ {
+ m_starter = starter;
+ }
+
+ public ExecutionStatus Execute()
+ {
+ if (m_chain == null)
+ {
+ m_schedulable = m_starter();
+ m_chain = TaskChain.Schedule(m_schedulable, ex => m_error = ex);
+ }
+
+ return m_chain.Next();
+ }
+
+ Exception m_error;
+ public Exception GetError()
+ {
+ return m_error;
+ }
+
+ public T GetResult()
+ {
+ return m_schedulable.Func.GetResult();
+ }
+ }
+
+ public static class SchedulableFunctor
+ {
+ public static SchedulableFunctor<T> Create<T>(Func<Schedulable<T>> starter)
+ {
+ return new SchedulableFunctor<T>(starter);
+ }
+ }
+ */
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs.meta
new file mode 100644
index 00000000..713019b1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Functor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c320f3f577dde634a871dc88266c2a20
+timeCreated: 1520084196
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs
new file mode 100644
index 00000000..30bd9f66
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+
+namespace
+ DepthFirstScheduler
+{
+ public static class IEnumeratorExtensions
+ {
+ [Obsolete("Use CoroutineToEnd")]
+ public static void CoroutinetoEnd(this IEnumerator coroutine)
+ {
+ CoroutineToEnd(coroutine);
+ }
+
+ public static void CoroutineToEnd(this IEnumerator coroutine)
+ {
+ var stack = new Stack<IEnumerator>();
+ stack.Push(coroutine);
+ while (stack.Count > 0)
+ {
+ if (stack.Peek().MoveNext())
+ {
+ var nested = stack.Peek().Current as IEnumerator;
+ if (nested != null)
+ {
+ stack.Push(nested);
+ }
+ }
+ else
+ {
+ stack.Pop();
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs.meta
new file mode 100644
index 00000000..b8a9f110
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/IEnumeratorExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4719fc9e6319c654b8a4818bef2c3a85
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE
new file mode 100644
index 00000000..3299d454
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 ousttrue
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE.meta
new file mode 100644
index 00000000..2ea0914d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LICENSE.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b673d33707cbc5446870804437f3cbea
+timeCreated: 1535290899
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs
new file mode 100644
index 00000000..205edb0b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs
@@ -0,0 +1,95 @@
+using System.Collections;
+using System.Collections.Generic;
+
+
+namespace DepthFirstScheduler
+{
+ public class LockQueue<T> where T : class
+ {
+ List<T> m_queue = new List<T>();
+ public int Count
+ {
+ get
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ return m_queue.Count;
+ }
+ }
+ }
+
+ public void Enqueue(T t)
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ m_queue.Add(t);
+ }
+ }
+
+ public T Dequeue(out int remain)
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ if (m_queue.Count == 0)
+ {
+ remain = 0;
+ return null;
+ }
+ var item = m_queue[0];
+ m_queue.RemoveAt(0);
+ remain = m_queue.Count;
+ return item;
+ }
+ }
+
+ public T Dequeue()
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ if (m_queue.Count == 0) return null;
+ var item = m_queue[0];
+ m_queue.RemoveAt(0);
+ return item;
+ }
+ }
+ }
+
+ public class LockQueueForValue<T> where T : struct
+ {
+ List<T> m_queue = new List<T>();
+ public int Count
+ {
+ get
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ return m_queue.Count;
+ }
+ }
+ }
+
+ public void Enqueue(T t)
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ m_queue.Add(t);
+ }
+ }
+
+ public bool TryDequeue(out T t)
+ {
+ lock (((ICollection)m_queue).SyncRoot)
+ {
+ if (m_queue.Count == 0)
+ {
+ t = default(T);
+ return false;
+ }
+
+ t = m_queue[0];
+ m_queue.RemoveAt(0);
+ return true;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs.meta
new file mode 100644
index 00000000..cc5d5cfa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/LockQueue.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f6b1eb436e400704ab6e2ad6eff29f4b
+timeCreated: 1519978475
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs
new file mode 100644
index 00000000..bb01dfff
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs
@@ -0,0 +1,150 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace DepthFirstScheduler
+{
+ /// <summary>
+ /// UniRxのMainThreadDispatcherを参考にした。
+ /// * https://github.com/neuecc/UniRx/blob/master/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs
+ /// </summary>
+ public class MainThreadDispatcher : MonoBehaviour
+ {
+
+ [Header("Debug")]
+ public int TaskCount;
+
+ IEnumerable<Transform> Ancestors(Transform t)
+ {
+ yield return t;
+
+ if (t.parent != null)
+ {
+ foreach (var x in Ancestors(t.parent))
+ {
+ yield return x;
+ }
+ }
+ }
+
+ private void Update()
+ {
+ TaskCount = Scheduler.MainThread.UpdateAndGetTaskCount();
+ }
+
+ static MainThreadDispatcher instance;
+ static bool initialized;
+ static bool isQuitting = false;
+
+ public static bool IsInitialized
+ {
+ get { return initialized && instance != null; }
+ }
+
+ [ThreadStatic]
+ static object mainThreadToken;
+
+ public static MainThreadDispatcher Instance
+ {
+ get
+ {
+ Initialize();
+ return instance;
+ }
+ }
+
+ public static void Initialize()
+ {
+ if (!initialized)
+ {
+#if UNITY_EDITOR
+ if (!Application.isPlaying)
+ {
+ return;
+ }
+#endif
+ MainThreadDispatcher dispatcher = null;
+
+ try
+ {
+ dispatcher = GameObject.FindObjectOfType<MainThreadDispatcher>();
+ }
+ catch
+ {
+ // Throw exception when calling from a worker thread.
+ var ex = new Exception(
+ "DepthFirstScheduler requires a MainThreadDispatcher component created on the main thread."
+ + " Make sure it is added to the scene before calling DepthFirstScheduler from a worker thread.");
+ UnityEngine.Debug.LogException(ex);
+ throw ex;
+ }
+
+ if (isQuitting)
+ {
+ // don't create new instance after quitting
+ // avoid "Some objects were not cleaned up when closing the scene find target" error.
+ return;
+ }
+
+ if (dispatcher == null)
+ {
+ // awake call immediately from UnityEngine
+ new GameObject("DepthFirstScheduler").AddComponent<MainThreadDispatcher>();
+ }
+ else
+ {
+ dispatcher.Awake(); // force awake
+ }
+ }
+ }
+
+ public static bool IsInMainThread
+ {
+ get
+ {
+ return (mainThreadToken != null);
+ }
+ }
+
+
+ void Awake()
+ {
+ if (instance == null)
+ {
+ Debug.Log("Initialize UniTask.MainThreadDispatcher");
+
+ instance = this;
+ mainThreadToken = new object();
+ initialized = true;
+
+ DontDestroyOnLoad(gameObject);
+ }
+ else
+ {
+ if (this != instance)
+ {
+ Debug.LogWarning("There is already a MainThreadDispatcher in the scene.");
+ }
+ }
+ }
+
+ void OnDestroy()
+ {
+ if (instance == this)
+ {
+ instance = GameObject.FindObjectOfType<MainThreadDispatcher>();
+ initialized = instance != null;
+ }
+
+ if (Scheduler.SingleWorkerThread != null)
+ {
+ Scheduler.SingleWorkerThread.Dispose();
+ }
+ }
+
+ void OnApplicationQuit()
+ {
+ isQuitting = true;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs.meta
new file mode 100644
index 00000000..5777e1ab
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MainThreadDispatcher.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b030a9507e46dd3488c080be0227b219
+timeCreated: 1519977925
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs
new file mode 100644
index 00000000..79bf9823
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+
+namespace DepthFirstScheduler
+{
+ /// <summary>
+ /// http://blogs.msdn.com/b/toub/archive/2006/04/12/blocking-queues.aspx
+ ///
+ /// 終了を通知するにはnullを投入する手が使える
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ public class MonitorQueue<T>
+ {
+ private Int32 _count = 0;
+ public Int32 Count
+ {
+ get
+ {
+ return _count;
+ }
+ }
+
+ private Queue<T> _queue = new Queue<T>();
+
+ public T Dequeue()
+ {
+ lock (_queue)
+ {
+ while (_count <= 0) Monitor.Wait(_queue);
+ _count--;
+ return _queue.Dequeue();
+ }
+ }
+
+ public void Enqueue(T data)
+ {
+ lock (_queue)
+ {
+ _queue.Enqueue(data);
+ _count++;
+ Monitor.Pulse(_queue);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs.meta
new file mode 100644
index 00000000..2b639174
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/MonitorQueue.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5e968e04ff53e1c4a9a2869b7cf76055
+timeCreated: 1519990411
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md
new file mode 100644
index 00000000..f6240894
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md
@@ -0,0 +1,66 @@
+# DepthFirstScheduler(深さ優先スケジューラー)
+Asynchronous task scheduler for Unity-5.6 or later
+
+これは、Unity5.6でTaskが無いことを補完するためのライブラリです。
+木構造にタスクを組み立てて深さ優先で消化します。
+
+* タスクの実行スケジューラー(Unityメインスレッドやスレッドプール)を指定できる
+
+# 使い方
+
+```cs
+var schedulable = new Schedulable<Unit>();
+
+schedulable
+ .AddTask(Scheduler.ThreadPool, () => // 子供のタスクを追加する
+ {
+ return glTF_VRM_Material.Parse(ctx.Json);
+ })
+ .ContinueWith(Scheduler.MainThread, gltfMaterials => // 兄弟のタスクを追加する
+ {
+ ctx.MaterialImporter = new VRMMaterialImporter(ctx, gltfMaterials);
+ })
+ .Subscribe(Scheduler.MainThread, onLoaded, onError);
+ ;
+```
+
+# Schedulable<T>
+T型の結果を返すタスク。
+
+## AddTask(IScheduler scheduler, Func<T> firstTask)
+
+子供のタスクを追加する。
+
+ToDo: 一つ目の子供に引数を渡す手段が無い
+
+## ContinueWith
+
+## ContinueWithCoroutine
+
+## OnExecute
+
+動的にタスクを追加するためのHook。
+
+中で、
+
+```
+parent.AddTask
+```
+
+することで実行時に子タスクを追加できる。
+
+## Subscribe
+タスクの実行を開始する。
+実行結果を得る。
+
+
+# Scheduler
+## StepScheduler
+Unity
+## CurrentThreadScheduler
+即時
+## ThreadPoolScheduler
+スレッド
+## ThreadScheduler
+スレッド
+
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md.meta
new file mode 100644
index 00000000..7d1cb78b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/README.md.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1231fa531fdd33f4baccc935c18c0872
+timeCreated: 1535290899
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs
new file mode 100644
index 00000000..3605c1b4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs
@@ -0,0 +1,252 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+#if ((NET_4_6 || NET_STANDARD_2_0) && UNITY_2017_1_OR_NEWER)
+using System.Threading.Tasks;
+#endif
+
+namespace DepthFirstScheduler
+{
+ public interface ISchedulable
+ {
+ /// <returns>実行が終了したか?Coroutineの実行が一回で終わらない場合がある</returns>
+ ExecutionStatus Execute();
+ Exception GetError();
+ IScheduler Scheduler { get; }
+
+ ISchedulable Parent { get; set; }
+ void AddChild(ISchedulable child);
+ IEnumerable<ISchedulable> Traverse();
+ }
+
+ public static class ISchedulableExtensions
+ {
+ public static ISchedulable GetRoot(this ISchedulable self)
+ {
+ var current = self;
+ while (current.Parent != null)
+ {
+ current = current.Parent;
+ }
+ return current;
+ }
+ }
+
+ public class NoParentException: Exception
+ {
+ public NoParentException():base("No parent task can't ContinueWith or OnExecute. First AddTask")
+ {
+ }
+ }
+
+ public class Schedulable<T> : ISchedulable
+ {
+ List<ISchedulable> m_children = new List<ISchedulable>();
+ public void AddChild(ISchedulable child)
+ {
+ child.Parent = this;
+ m_children.Add(child);
+ }
+ public IEnumerable<ISchedulable> Traverse()
+ {
+ yield return this;
+
+ foreach (var child in m_children)
+ {
+ foreach (var x in child.Traverse())
+ {
+ yield return x;
+ }
+ }
+ }
+
+ public ISchedulable Parent
+ {
+ get;
+ set;
+ }
+
+ public IScheduler Scheduler
+ {
+ get;
+ private set;
+ }
+
+ public IFunctor<T> Func
+ {
+ get;
+ private set;
+ }
+
+ public Exception GetError()
+ {
+ return Func.GetError();
+ }
+
+ public Schedulable()
+ {
+ }
+
+ public Schedulable(IScheduler scheduler, IFunctor<T> func)
+ {
+ Scheduler = scheduler;
+ Func = func;
+ }
+
+ public ExecutionStatus Execute()
+ {
+ if (Func == null)
+ {
+ return ExecutionStatus.Done;
+ }
+ return Func.Execute();
+ }
+
+ /// <summary>
+ /// スケジュールされたタスクをすべて即時に実行する
+ /// </summary>
+ public void ExecuteAll()
+ {
+ foreach (var x in this.GetRoot().Traverse())
+ {
+ while (true)
+ {
+ var status = x.Execute();
+ if (status != ExecutionStatus.Continue)
+ {
+ if (status == ExecutionStatus.Error)
+ {
+ throw x.GetError();
+ }
+ break;
+ }
+ // Coroutineタスクが継続している
+ }
+ }
+ }
+
+ public Schedulable<Unit> AddTask(IScheduler scheduler, Action pred)
+ {
+ return AddTask(scheduler, () => { pred(); return Unit.Default; });
+ }
+
+ public Schedulable<U> AddTask<U>(IScheduler scheduler, Func<U> pred)
+ {
+ var schedulable = new Schedulable<U>(scheduler, Functor.Create(() => Unit.Default, _ => pred()));
+ AddChild(schedulable);
+ return schedulable;
+ }
+
+ public Schedulable<Unit> AddCoroutine(IScheduler scheduler, Func<IEnumerator> starter)
+ {
+ var func = CoroutineFunctor.Create<Unit, Unit>(() => default(Unit), _ => starter());
+ var schedulable = new Schedulable<Unit>(scheduler, func);
+ AddChild(schedulable);
+ return schedulable;
+ }
+
+ public Schedulable<Unit> ContinueWith(IScheduler scheduler, Action<T> pred)
+ {
+ return ContinueWith(scheduler, t => { pred(t); return Unit.Default; });
+ }
+
+ public Schedulable<U> ContinueWith<U>(IScheduler scheduler, Func<T, U> pred)
+ {
+ if (Parent == null)
+ {
+ throw new NoParentException();
+ }
+
+ Func<T> getResult = null;
+ if (Func != null)
+ {
+ getResult = Func.GetResult;
+ }
+ var func = Functor.Create(getResult, pred);
+ var schedulable = new Schedulable<U>(scheduler, func);
+ Parent.AddChild(schedulable);
+ return schedulable;
+ }
+
+ public Schedulable<Unit> ContinueWithCoroutine(IScheduler scheduler, Func<IEnumerator> starter)
+ {
+ return ContinueWithCoroutine<Unit>(scheduler, _ => starter());
+ }
+
+ public Schedulable<U> ContinueWithCoroutine<U>(IScheduler scheduler, Func<T, IEnumerator> starter)
+ {
+ if (Parent == null)
+ {
+ throw new NoParentException();
+ }
+
+ Func<T> getResult = null;
+ if (Func != null)
+ {
+ getResult = Func.GetResult;
+ }
+
+ var func = CoroutineFunctor.Create<T, U>(getResult, starter);
+ var schedulable = new Schedulable<U>(scheduler, func);
+ Parent.AddChild(schedulable);
+ return schedulable;
+ }
+
+ public Schedulable<Unit> OnExecute(IScheduler scheduler, Action<Schedulable<Unit>> pred)
+ {
+ if (Parent == null)
+ {
+ throw new NoParentException();
+ }
+
+ Func<T> getResult = null;
+ if (Func != null)
+ {
+ getResult = Func.GetResult;
+ }
+
+ var schedulable = new Schedulable<Unit>();
+ schedulable.Func = Functor.Create(getResult, _ => { pred(schedulable); return Unit.Default; });
+ Parent.AddChild(schedulable);
+ return schedulable;
+ }
+ }
+
+ public static class Schedulable
+ {
+ public static Schedulable<Unit> Create()
+ {
+ return new Schedulable<Unit>().AddTask(Scheduler.CurrentThread, () =>
+ {
+ });
+ }
+ }
+
+ public static class SchedulableExtensions
+ {
+ public static void Subscribe<T>(
+ this Schedulable<T> schedulable,
+ IScheduler scheduler,
+ Action<T> onCompleted,
+ Action<Exception> onError)
+ {
+ schedulable.ContinueWith(scheduler, onCompleted);
+ TaskChain.Schedule(schedulable.GetRoot(), onError);
+ }
+
+#if ((NET_4_6 || NET_STANDARD_2_0) && UNITY_2017_1_OR_NEWER)
+ public static Task<T> ToTask<T>(this Schedulable<T> schedulable)
+ {
+ return ToTask(schedulable, Scheduler.MainThread);
+ }
+
+ public static Task<T> ToTask<T>(this Schedulable<T> schedulable, IScheduler scheduler)
+ {
+ var tcs = new TaskCompletionSource<T>();
+ schedulable.Subscribe(scheduler, r => tcs.TrySetResult(r), ex => tcs.TrySetException(ex));
+ return tcs.Task;
+ }
+#endif
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs.meta
new file mode 100644
index 00000000..439f4a26
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Schedulable.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 45e21e7db278f344fbaeffc4c4b82b1e
+timeCreated: 1519981307
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs
new file mode 100644
index 00000000..41d898fe
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace DepthFirstScheduler
+{
+ public interface IScheduler : IDisposable
+ {
+ void Enqueue(TaskChain item);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs.meta
new file mode 100644
index 00000000..38b43757
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5a160dc164df4094dbbc892055ac82ae
+timeCreated: 1520084097
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.meta
new file mode 100644
index 00000000..efdb87ba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0700fb042f010694782d238049678651
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs
new file mode 100644
index 00000000..2fa03e26
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace DepthFirstScheduler
+{
+ public static partial class Scheduler
+ {
+ private static IScheduler currentThread;
+
+ public static IScheduler CurrentThread
+ {
+ get { return currentThread ?? (currentThread = new CurrentThreadScheduler()); }
+ }
+
+ public class CurrentThreadScheduler : IScheduler
+ {
+ [ThreadStatic]
+ private static Queue<TaskChain> queue;
+
+ private static Queue<TaskChain> GetQueue()
+ {
+ return queue;
+ }
+
+ private static void SetQueue(Queue<TaskChain> newQueue)
+ {
+ queue = newQueue;
+ }
+
+ public void Enqueue(TaskChain item)
+ {
+ var q = GetQueue();
+
+ if (q == null)
+ {
+ q = new Queue<TaskChain>(5);
+ q.Enqueue(item);
+ SetQueue(q);
+
+ try
+ {
+ Trampoline.Run(q);
+ }
+ finally
+ {
+ SetQueue(null);
+ }
+ }
+ else
+ {
+ q.Enqueue(item);
+ }
+ }
+
+ #region IDisposable Support
+
+ private bool disposedValue = false;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ var queue = GetQueue();
+ if (queue != null) queue.Clear();
+ SetQueue(null);
+ }
+ disposedValue = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ #endregion
+ }
+
+ static class Trampoline
+ {
+ public static void Run(Queue<TaskChain> queue)
+ {
+ while (queue.Count > 0)
+ {
+ var chain = queue.Dequeue();
+
+ while (true)
+ {
+ var status = chain.Next();
+ if (status != ExecutionStatus.Continue)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs.meta
new file mode 100644
index 00000000..57b7907f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/CurrentThreadScheduler.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 21979cc7137a17d4ea8b6202381a02d0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs
new file mode 100644
index 00000000..e5406ebe
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs
@@ -0,0 +1,52 @@
+namespace DepthFirstScheduler
+{
+ public static partial class Scheduler
+ {
+ private static StepScheduler mainThread;
+
+ public static StepScheduler MainThread
+ {
+ get
+ {
+ if (mainThread != null) return mainThread;
+ mainThread = new StepScheduler();
+ MainThreadDispatcher.Initialize();
+ return mainThread;
+ }
+ }
+
+ public class StepScheduler : IScheduler
+ {
+ LockQueue<TaskChain> m_taskQueue = new LockQueue<TaskChain>();
+
+ public void Enqueue(TaskChain item)
+ {
+ m_taskQueue.Enqueue(item);
+ }
+
+ TaskChain m_chain;
+
+ public int UpdateAndGetTaskCount()
+ {
+ if (m_chain != null)
+ {
+ var status = m_chain.Next();
+ if (status == ExecutionStatus.Continue)
+ {
+ // m_item継続中
+ return m_taskQueue.Count;
+ }
+ m_chain = null;
+ }
+
+ int count;
+ m_chain = m_taskQueue.Dequeue(out count);
+ return count;
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs.meta
new file mode 100644
index 00000000..f5e8c092
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/StepScheduler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 84161938c020c37419bc79f021f849fb
+timeCreated: 1520062584
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs
new file mode 100644
index 00000000..6c2dbea9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs
@@ -0,0 +1,42 @@
+using System;
+
+namespace DepthFirstScheduler
+{
+ public static partial class Scheduler
+ {
+ private static IScheduler threadPool;
+
+ public static IScheduler ThreadPool
+ {
+ get { return threadPool ?? (threadPool = new ThreadPoolScheduler()); }
+ }
+
+ public class ThreadPoolScheduler : IScheduler
+ {
+ public void Enqueue(TaskChain item)
+ {
+ System.Threading.ThreadPool.QueueUserWorkItem(_ =>
+ {
+ if (item == null)
+ {
+ return;
+ }
+
+ while (true)
+ {
+ var status = item.Next();
+ if (status != ExecutionStatus.Continue)
+ {
+ break;
+ }
+ }
+
+ });
+ }
+
+ public void Dispose()
+ {
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs.meta
new file mode 100644
index 00000000..42a8066e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadPoolScheduler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d8a8d78a486bbdf4b95ae83d02b480d8
+timeCreated: 1524110819
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs
new file mode 100644
index 00000000..0c44c550
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs
@@ -0,0 +1,101 @@
+using System;
+using System.Threading;
+
+namespace DepthFirstScheduler
+{
+ public static partial class Scheduler
+ {
+ private static IScheduler singleWorkerThread;
+
+ public static IScheduler SingleWorkerThread
+ {
+ get { return singleWorkerThread ?? (singleWorkerThread = new ThreadScheduler()); }
+ }
+
+ public class ThreadScheduler : IScheduler
+ {
+ MonitorQueue<TaskChain> m_queue = new MonitorQueue<TaskChain>();
+
+ Thread m_thread;
+
+ public ThreadScheduler()
+ {
+ // start worker thread
+ m_thread = new Thread(new ParameterizedThreadStart(Worker));
+ m_thread.Start(m_queue);
+ }
+
+ static void Worker(Object arg)
+ {
+ MonitorQueue<TaskChain> queue = (MonitorQueue<TaskChain>)arg;
+ while (true)
+ {
+ var chain = queue.Dequeue();
+ if (chain == null)
+ {
+ break;
+ }
+
+ while (true)
+ {
+ var status = chain.Next();
+ if (status != ExecutionStatus.Continue)
+ {
+ break;
+ }
+ }
+ }
+
+ // end
+ }
+
+ public void Enqueue(TaskChain item)
+ {
+ m_queue.Enqueue(item);
+ }
+
+ #region IDisposable Support
+
+ private bool disposedValue = false; // 重複する呼び出しを検出するには
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ // TODO: マネージ状態を破棄します (マネージ オブジェクト)。
+ if (m_thread != null)
+ {
+ m_queue.Enqueue(null);
+ m_thread.Join();
+ m_thread = null;
+ }
+ }
+
+ // TODO: アンマネージ リソース (アンマネージ オブジェクト) を解放し、下のファイナライザーをオーバーライドします。
+ // TODO: 大きなフィールドを null に設定します。
+
+ disposedValue = true;
+ }
+ }
+
+ // TODO: 上の Dispose(bool disposing) にアンマネージ リソースを解放するコードが含まれる場合にのみ、ファイナライザーをオーバーライドします。
+ // ~ThreadScheduler() {
+ // // このコードを変更しないでください。クリーンアップ コードを上の Dispose(bool disposing) に記述します。
+ // Dispose(false);
+ // }
+
+ // このコードは、破棄可能なパターンを正しく実装できるように追加されました。
+ public void Dispose()
+ {
+ // このコードを変更しないでください。クリーンアップ コードを上の Dispose(bool disposing) に記述します。
+ Dispose(true);
+ // TODO: 上のファイナライザーがオーバーライドされる場合は、次の行のコメントを解除してください。
+ // GC.SuppressFinalize(this);
+ }
+
+ #endregion
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs.meta
new file mode 100644
index 00000000..9e4cb556
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Scheduler/ThreadScheduler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8df1de98bdc0b534bbe68e8f2f8a858f
+timeCreated: 1520062592
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs
new file mode 100644
index 00000000..7e16a94e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+
+namespace DepthFirstScheduler
+{
+ public enum ChainStatus
+ {
+ Unknown,
+ Continue,
+ Done,
+ Error,
+ }
+
+ public class TaskChain
+ {
+ public IEnumerator<ISchedulable> Enumerator;
+ public Action<Exception> OnError;
+ public ChainStatus ChainStatus;
+
+ public static TaskChain Schedule(ISchedulable schedulable, Action<Exception> onError)
+ {
+ var item = new TaskChain
+ {
+ Enumerator = schedulable.Traverse().GetEnumerator(),
+ OnError = onError
+ };
+
+ if (item.Enumerator.MoveNext())
+ {
+ if (item.Enumerator.Current.Scheduler == null)
+ {
+ // default
+ Scheduler.MainThread.Enqueue(item);
+ }
+ else
+ {
+ item.Enumerator.Current.Scheduler.Enqueue(item);
+ }
+ }
+
+ return item;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public ExecutionStatus Next()
+ {
+ if (this.ChainStatus == ChainStatus.Done
+ || this.ChainStatus== ChainStatus.Error)
+ {
+ return ExecutionStatus.Done;
+ }
+
+ {
+ var status = Enumerator.Current.Execute();
+ if (status == ExecutionStatus.Error)
+ {
+ ChainStatus = ChainStatus.Error;
+ OnError(Enumerator.Current.GetError());
+ }
+ if (status == ExecutionStatus.Continue)
+ {
+ // 中断(coroutine)
+ ChainStatus = ChainStatus.Continue;
+ return ExecutionStatus.Continue;
+ }
+ }
+
+ if (!Enumerator.MoveNext())
+ {
+ // 終了
+ ChainStatus = ChainStatus.Done;
+ return ExecutionStatus.Done;
+ }
+
+ if (Enumerator.Current.Scheduler != null)
+ {
+ // Scheduleして中断
+ ChainStatus = ChainStatus.Continue;
+ Enumerator.Current.Scheduler.Enqueue(this);
+ return ExecutionStatus.Done;
+ }
+
+ return Next();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs.meta
new file mode 100644
index 00000000..e50b9f19
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/TaskChain.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 38fc7e076ba93a847ad72d3d459d06b6
+timeCreated: 1520084019
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs
new file mode 100644
index 00000000..fed9eb64
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs
@@ -0,0 +1,41 @@
+using System;
+
+namespace DepthFirstScheduler
+{
+ [Serializable]
+ public struct Unit : IEquatable<Unit>
+ {
+ static readonly Unit @default = new Unit();
+
+ public static Unit Default { get { return @default; } }
+
+ public static bool operator ==(Unit first, Unit second)
+ {
+ return true;
+ }
+
+ public static bool operator !=(Unit first, Unit second)
+ {
+ return false;
+ }
+
+ public bool Equals(Unit other)
+ {
+ return true;
+ }
+ public override bool Equals(object obj)
+ {
+ return obj is Unit;
+ }
+
+ public override int GetHashCode()
+ {
+ return 0;
+ }
+
+ public override string ToString()
+ {
+ return "()";
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs.meta b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs.meta
new file mode 100644
index 00000000..24f0ea54
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/DepthFirstScheduler/Unit.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 98bd42f8c3a895d4bac6cbcf523878bb
+timeCreated: 1520081817
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/Documentation.meta b/Assets/ThirdParty/VRM/VRM/Documentation.meta
new file mode 100644
index 00000000..b5c51d8e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/Documentation.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c83fb6d0b872bc3418ff7c31b8599ccd
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/Documentation/VRM.md b/Assets/ThirdParty/VRM/VRM/Documentation/VRM.md
new file mode 100644
index 00000000..7988855b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/Documentation/VRM.md
@@ -0,0 +1,23 @@
+# VRM
+
+The core library for UniVRM-0.XX.
+
+## VRM/DepthFirstScheduler
+
+Asynchronous task scheduler.
+
+## VRM/UniGLTF
+
+glTF 2.0 importer and exporter.
+
+## VRM/UniHumanoid
+
+Unity humanoid utility with bvh importer.
+
+## VRM/UniJSON
+
+JSON serializer and deserializer and schema utilities.
+
+## VRM/UniVRM
+
+GLTF extension parts (BlendShape, FirstPerson, LookAt, Meta, etc.), VRMImporter, VRMExporter. \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/Documentation/VRM.md.meta b/Assets/ThirdParty/VRM/VRM/Documentation/VRM.md.meta
new file mode 100644
index 00000000..975ed71a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/Documentation/VRM.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3ddddaadf9bca764a92432d4e1216dc8
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/LICENSE.md b/Assets/ThirdParty/VRM/VRM/LICENSE.md
new file mode 100644
index 00000000..7a9585e4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/LICENSE.md
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) 2020 VRM Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/LICENSE.md.meta b/Assets/ThirdParty/VRM/VRM/LICENSE.md.meta
new file mode 100644
index 00000000..0189c400
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/LICENSE.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 42c194b69b5338046a70a62238ad8c0e
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/README.md b/Assets/ThirdParty/VRM/VRM/README.md
new file mode 100644
index 00000000..54359ffb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/README.md
@@ -0,0 +1,21 @@
+# VRM
+
+The core library for UniVRM-0.XX.
+
+## Import VRM (Unity 2019.3.4f1~)
+
+`Window` -> `Package Manager` -> `Add package from git URL` and add the followings in order:
+
+* `https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders`
+* `https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM` => depends on VRMShaders
+
+or add the package name and git URL in `Packages/manifest.json`:
+
+```json
+{
+ "dependencies": {
+ "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders",
+ "com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM",
+ }
+}
+```
diff --git a/Assets/ThirdParty/VRM/VRM/README.md.meta b/Assets/ThirdParty/VRM/VRM/README.md.meta
new file mode 100644
index 00000000..ca2d11bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/README.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 27376b07a49e57442a9c2d6a2a0805b9
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/README.url b/Assets/ThirdParty/VRM/VRM/README.url
new file mode 100644
index 00000000..e4eb70c9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/README.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/dwango/UniVRM \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/README.url.meta b/Assets/ThirdParty/VRM/VRM/README.url.meta
new file mode 100644
index 00000000..ecfdc24c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/README.url.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: b6360e0694ca54c57b83fa6a73e2261a
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF.meta
new file mode 100644
index 00000000..67e10477
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4af88ce26d18bd74fb51e2ce9db6da1d
+folderAsset: yes
+timeCreated: 1521016767
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor.meta
new file mode 100644
index 00000000..5bb625d2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d3f12e850b80b874da5050c9599b8abc
+folderAsset: yes
+timeCreated: 1521096862
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs
new file mode 100644
index 00000000..63f45045
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs
@@ -0,0 +1,51 @@
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public static class ImporterMenu
+ {
+ [MenuItem(UniGLTFVersion.MENU + "/Import", priority = 1)]
+ public static void ImportMenu()
+ {
+ var path = EditorUtility.OpenFilePanel("open gltf", "", "gltf,glb,zip");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ if (Application.isPlaying)
+ {
+ //
+ // load into scene
+ //
+ var context = new ImporterContext();
+ context.Load(path);
+ context.ShowMeshes();
+ Selection.activeGameObject = context.Root;
+ }
+ else
+ {
+ //
+ // save as asset
+ //
+ if (path.StartsWithUnityAssetPath())
+ {
+ Debug.LogWarningFormat("disallow import from folder under the Assets");
+ return;
+ }
+
+ var assetPath = EditorUtility.SaveFilePanel("save prefab", "Assets", Path.GetFileNameWithoutExtension(path), "prefab");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ // import as asset
+ gltfAssetPostprocessor.ImportAsset(path, Path.GetExtension(path).ToLower(), UnityPath.FromFullpath(assetPath));
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs.meta
new file mode 100644
index 00000000..47d70b59
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/ImporterMenu.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: ae2833922b06981439883d1e924b4cd0
+timeCreated: 1517153624
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization.meta
new file mode 100644
index 00000000..0101c4e4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 43be0cf78be61614cb840cb906de4275
+folderAsset: yes
+timeCreated: 1565252168
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs
new file mode 100644
index 00000000..0dbcf723
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs
@@ -0,0 +1,115 @@
+using System;
+using System.IO;
+
+namespace UniGLTF
+{
+ public class ArraySerialization : FunctionSerializationBase
+ {
+ IValueSerialization m_inner;
+
+ public ArraySerialization(Type t, IValueSerialization inner)
+ {
+ ValueType = t;
+ m_inner = inner;
+ }
+ public override void GenerateDeserializer(StreamWriter writer, string callName)
+ {
+ var itemCallName = callName + "_ARRAY";
+
+ writer.Write(@"
+public static $0 $2(ListTreeNode<JsonValue> parsed)
+{
+ var value = new $1[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = $3;
+ }
+ return value;
+}
+"
+.Replace("$0", UniJSON.JsonSchemaAttribute.GetTypeName(ValueType))
+.Replace("$1", m_inner.ValueType.Name)
+.Replace("$2", callName)
+.Replace("$3", m_inner.GenerateDeserializerCall(itemCallName, "x"))
+);
+
+ if (!m_inner.IsInline)
+ {
+ m_inner.GenerateDeserializer(writer, itemCallName);
+ }
+ }
+ }
+
+ public class ListSerialization : FunctionSerializationBase
+ {
+ IValueSerialization m_inner;
+
+ public ListSerialization(Type t, IValueSerialization inner)
+ {
+ ValueType = t;
+ m_inner = inner;
+ }
+ public override void GenerateDeserializer(StreamWriter writer, string callName)
+ {
+ var itemCallName = callName + "_LIST";
+ writer.Write(@"
+public static $0 $2(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<$1>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add($3);
+ }
+ return value;
+}"
+.Replace("$0", UniJSON.JsonSchemaAttribute.GetTypeName(ValueType))
+.Replace("$1", m_inner.ValueType.Name)
+.Replace("$2", callName)
+.Replace("$3", m_inner.GenerateDeserializerCall(itemCallName, "x"))
+);
+
+ if (!m_inner.IsInline)
+ {
+ m_inner.GenerateDeserializer(writer, itemCallName);
+ }
+ }
+ }
+
+ public class StringKeyDictionarySerialization : FunctionSerializationBase
+ {
+ IValueSerialization m_inner;
+
+ public StringKeyDictionarySerialization(Type t, IValueSerialization inner)
+ {
+ ValueType = t;
+ m_inner = inner;
+ }
+ public override void GenerateDeserializer(StreamWriter writer, string callName)
+ {
+ var itemCallName = callName + "_DICT";
+ writer.Write(@"
+
+public static $0 $2(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Dictionary<string, $1>();
+ foreach(var kv in parsed.ObjectItems())
+ {
+ value.Add(kv.Key.GetString(), $3);
+ }
+ return value;
+}
+"
+.Replace("$0", UniJSON.JsonSchemaAttribute.GetTypeName(ValueType))
+.Replace("$1", m_inner.ValueType.Name)
+.Replace("$2", callName)
+.Replace("$3", m_inner.GenerateDeserializerCall(itemCallName, "kv.Value"))
+);
+
+ if (!m_inner.IsInline)
+ {
+ m_inner.GenerateDeserializer(writer, itemCallName);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs.meta
new file mode 100644
index 00000000..bf9f1d2a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/CollectionSerialization.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e85f0c5204f5ac3429503462ef29cdae
+timeCreated: 1565259169
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs
new file mode 100644
index 00000000..c6bb8bba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs
@@ -0,0 +1,61 @@
+using System.IO;
+using System.Reflection;
+using System.Text;
+using UnityEditor;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public static class DeserializerGenerator
+ {
+ public const BindingFlags FIELD_FLAGS = BindingFlags.Instance | BindingFlags.Public;
+
+ static string OutPath
+ {
+ get
+ {
+ return Path.Combine(UnityEngine.Application.dataPath,
+ "VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs");
+ }
+ }
+
+ /// <summary>
+ /// AOT向けにデシリアライザを生成する
+ /// </summary>
+ [MenuItem(VRM.VRMVersion.MENU + "/Generate Deserializer")]
+ static void GenerateSerializer()
+ {
+ var info = new ObjectSerialization(typeof(glTF), "gltf");
+ Debug.Log(info);
+
+ using (var s = File.Open(OutPath, FileMode.Create))
+ using (var w = new StreamWriter(s, Encoding.UTF8))
+ {
+ // header
+ w.Write(@"
+using UniJSON;
+using System;
+using System.Collections.Generic;
+using VRM;
+using UnityEngine;
+
+namespace UniGLTF {
+
+public static class GltfDeserializer
+{
+
+");
+
+ info.GenerateDeserializer(w, "Deserialize");
+
+ // footer
+ w.Write(@"
+} // GltfDeserializer
+} // UniGLTF
+");
+
+ Debug.LogFormat("write: {0}", OutPath);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs.meta
new file mode 100644
index 00000000..0adf1465
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/DeserializerGenerator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c2f242dff8534b1409257c4e7fe8a21d
+timeCreated: 1564983410
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs
new file mode 100644
index 00000000..3ca00077
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs
@@ -0,0 +1,152 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using UniJSON;
+
+namespace UniGLTF
+{
+ public class FieldSerializationInfo
+ {
+ FieldInfo m_fi;
+ public FieldInfo FieldInfo
+ {
+ get { return m_fi; }
+ }
+
+ public string Name
+ {
+ get { return FieldInfo.Name; }
+ }
+
+ public string Path
+ {
+ get;
+ private set;
+ }
+
+ public string FunctionName
+ {
+ get
+ {
+ return "Deserialize_" + Path
+ .Replace("/", "_")
+ .Replace("[]", "_")
+ ;
+ }
+ }
+
+ JsonSchemaAttribute m_attr;
+
+ public IValueSerialization Serialization
+ {
+ get;
+ private set;
+ }
+
+ public FieldSerializationInfo(FieldInfo fi, string path)
+ {
+ m_fi = fi;
+ Path = path + "/" + fi.Name;
+ m_attr = fi.GetCustomAttributes(true).FirstOrDefault(x => x.GetType() == typeof(JsonSchemaAttribute)) as JsonSchemaAttribute;
+
+ Serialization = GetSerialization(m_fi.FieldType, Path);
+ }
+
+ static IValueSerialization GetSerialization(Type t, string path)
+ {
+ if (t.IsArray)
+ {
+ return new ArraySerialization(t,
+ GetSerialization(t.GetElementType(), path + "[]"));
+ }
+ else if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(List<>))
+ {
+ return new ListSerialization(t,
+ GetSerialization(t.GetGenericArguments()[0], path + "[]"));
+ }
+ else if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Dictionary<,>)
+ && t.GetGenericArguments()[0] == typeof(string))
+ {
+ return new StringKeyDictionarySerialization(t,
+ GetSerialization(t.GetGenericArguments()[1], path));
+ }
+
+ // GetCollectionType(fi.FieldType, out suffix, out t);
+ if (t == typeof(sbyte))
+ {
+ return new Int8Serialization();
+ }
+ else if (t == typeof(short))
+ {
+ return new Int16Serialization();
+ }
+ else if (t == typeof(int))
+ {
+ return new Int32Serialization();
+ }
+ else if (t == typeof(long))
+ {
+ return new Int64Serialization();
+ }
+ else if (t == typeof(byte))
+ {
+ return new UInt8Serialization();
+ }
+ else if (t == typeof(ushort))
+ {
+ return new UInt16Serialization();
+ }
+ else if (t == typeof(uint))
+ {
+ return new UInt32Serialization();
+ }
+ else if (t == typeof(ulong))
+ {
+ return new UInt64Serialization();
+ }
+ else if (t == typeof(float))
+ {
+ return new SingleSerialization();
+ }
+ else if (t == typeof(double))
+ {
+ return new DoubleSerialization();
+ }
+ else if (t == typeof(string))
+ {
+ return new StringSerialization();
+ }
+ else if (t == typeof(bool))
+ {
+ return new BooleanSerialization();
+ }
+ else if (t.IsEnum)
+ {
+ return new EnumIntSerialization(t);
+ }
+
+ return new ObjectSerialization(t, path);
+ }
+
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+
+ var typeName = BaseJsonSchemaAttribute.GetTypeName(m_fi.FieldType);
+
+ if (m_attr != null)
+ {
+ sb.AppendLine(string.Format("{0}: {1}", Path, m_attr.GetInfo(m_fi)));
+ }
+ else
+ {
+ sb.AppendLine(string.Format("{0}: {1}", Path, typeName));
+ }
+
+ sb.Append(Serialization.ToString());
+ return sb.ToString();
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs.meta
new file mode 100644
index 00000000..d02384d1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/FieldSerializationInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3c26deb26a3941642a30691d374199da
+timeCreated: 1565256318
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs
new file mode 100644
index 00000000..dba6d82b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs
@@ -0,0 +1,17 @@
+using System;
+using System.IO;
+
+namespace UniGLTF
+{
+ // Use this for initialization
+ public interface IValueSerialization
+ {
+ Type ValueType { get; }
+
+ bool IsInline { get; }
+
+ string GenerateDeserializerCall(string callName, string argName);
+
+ void GenerateDeserializer(StreamWriter writer, string callName);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs.meta
new file mode 100644
index 00000000..8bcb914e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/IValueSerialization.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 199c91bbade4ea043928e29946a28502
+timeCreated: 1565256001
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs
new file mode 100644
index 00000000..6f9d20da
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs
@@ -0,0 +1,112 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace UniGLTF
+{
+ public abstract class FunctionSerializationBase : IValueSerialization
+ {
+ public Type ValueType
+ {
+ get;
+ protected set;
+ }
+
+ public bool IsInline
+ {
+ get { return false; }
+ }
+
+ public abstract void GenerateDeserializer(StreamWriter writer, string callName);
+
+ public string GenerateDeserializerCall(string callName, string argName)
+ {
+ return string.Format("{0}({1})", callName, argName);
+ }
+ }
+
+ public class ObjectSerialization : FunctionSerializationBase
+ {
+ string m_path;
+ FieldSerializationInfo[] m_fsi;
+
+ public ObjectSerialization(Type t, string path)
+ {
+ ValueType = t;
+ m_path = path;
+ m_fsi = t.GetFields(DeserializerGenerator.FIELD_FLAGS)
+ .Where(x =>
+ {
+ if (x.FieldType == typeof(object))
+ {
+ // object. coannot serialize
+ return false;
+ }
+ if (x.IsLiteral && !x.IsInitOnly)
+ {
+ // const
+ return false;
+ }
+ return true;
+ })
+ .Select(x =>
+ {
+ return new FieldSerializationInfo(x, path);
+ }).ToArray();
+ }
+
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ foreach (var x in m_fsi)
+ {
+ sb.Append(x.ToString());
+ }
+ return sb.ToString();
+ }
+
+ public override void GenerateDeserializer(StreamWriter writer, string parentName)
+ {
+ writer.Write(@"
+public static $0 $2(ListTreeNode<JsonValue> parsed)
+{
+ var value = new $0();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+"
+.Replace("$0", ValueType.Name)
+.Replace("$2", parentName)
+);
+
+ foreach (var f in m_fsi)
+ {
+ writer.Write(@"
+ if(key==""$0""){
+ value.$0 = $1;
+ continue;
+ }
+"
+.Replace("$0", f.Name)
+.Replace("$1", f.Serialization.GenerateDeserializerCall(f.FunctionName, "kv.Value"))
+);
+ }
+
+ writer.Write(@"
+ }
+ return value;
+}
+");
+
+ foreach (var f in m_fsi)
+ {
+ if (!f.Serialization.IsInline)
+ {
+ f.Serialization.GenerateDeserializer(writer, f.FunctionName);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs.meta
new file mode 100644
index 00000000..7b41b751
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/ObjectSerialization.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 87a20b1fb7336e34bbc61c9d7476c6db
+timeCreated: 1565256016
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs
new file mode 100644
index 00000000..396aa483
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs
@@ -0,0 +1,198 @@
+using System;
+using System.IO;
+
+namespace UniGLTF
+{
+ public abstract class PrimitiveSerializationBase : IValueSerialization
+ {
+ public bool IsInline
+ {
+ get { return true; }
+ }
+
+ public abstract Type ValueType { get; }
+
+ public void GenerateDeserializer(StreamWriter writer, string callName)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public abstract string GenerateDeserializerCall(string callName, string argName);
+ }
+
+ public class Int8Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(SByte); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetInt8()";
+ }
+ }
+
+ public class Int16Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Int16); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetInt16()";
+ }
+ }
+
+ public class Int32Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Int32); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetInt32()";
+ }
+ }
+
+ public class Int64Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Int64); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetInt64()";
+ }
+ }
+
+ public class UInt8Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Byte); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetUInt8()";
+ }
+ }
+
+ public class UInt16Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(UInt16); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetUInt16()";
+ }
+ }
+
+ public class UInt32Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(UInt32); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetUInt32()";
+ }
+ }
+
+ public class UInt64Serialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(UInt64); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetUInt64()";
+ }
+ }
+
+ public class SingleSerialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Single); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetSingle()";
+ }
+ }
+
+ public class DoubleSerialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Double); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetDouble()";
+ }
+ }
+
+ public class BooleanSerialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(Boolean); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetBoolean()";
+ }
+ }
+
+ public class StringSerialization : PrimitiveSerializationBase
+ {
+ public override Type ValueType
+ {
+ get { return typeof(String); }
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return argName + ".GetString()";
+ }
+ }
+
+ public class EnumIntSerialization : PrimitiveSerializationBase
+ {
+ Type m_type;
+
+ public override Type ValueType
+ {
+ get { return m_type; }
+ }
+
+ public EnumIntSerialization(Type t)
+ {
+ m_type = t;
+ }
+
+ public override string GenerateDeserializerCall(string callName, string argName)
+ {
+ return string.Format("({0}){1}.GetInt32()", m_type.Name, argName);
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs.meta
new file mode 100644
index 00000000..8ee2f6f0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/PrimitiveSerialization.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8ddae9fc19efaec43a6d3aacad1c8d56
+timeCreated: 1565256889
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs
new file mode 100644
index 00000000..783afcec
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs
@@ -0,0 +1,329 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using UniJSON;
+using UnityEditor;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public static class SerializerGenerator
+ {
+ const BindingFlags FIELD_FLAGS = BindingFlags.Instance | BindingFlags.Public;
+
+ static string OutPath
+ {
+ get
+ {
+ return Path.Combine(UnityEngine.Application.dataPath,
+ "VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs");
+ }
+ }
+
+ /// <summary>
+ /// AOT向けにシリアライザを生成する
+ /// </summary>
+ [MenuItem(VRM.VRMVersion.MENU + "/Generate Serializer")]
+ static void GenerateSerializer()
+ {
+ var path = OutPath;
+
+ using (var g = new Generator(path))
+ {
+ var rootType = typeof(glTF);
+ g.Generate(rootType, "gltf");
+ }
+ }
+
+ class Generator : IDisposable
+ {
+ String m_path;
+ Stream m_s;
+ StreamWriter m_w;
+
+ static Dictionary<string, string> s_snippets = new Dictionary<string, string>
+ {
+ {"gltf/animations", "if(value.animations!=null && value.animations.Count>0)" },
+ {"gltf/cameras", "if(value.cameras!=null && value.cameras.Count>0)" },
+ {"gltf/buffers", "if(value.buffers!=null && value.buffers.Count>0)" },
+ {"gltf/bufferViews", "if(value.bufferViews!=null && value.bufferViews.Count>0)" },
+ {"gltf/bufferViews[]/byteStride", "" },
+ {"gltf/bufferViews[]/target", "if(value.target!=0)" },
+ {"gltf/animations[]/channels", "if(value.channels!=null && value.channels.Count>0)" },
+ {"gltf/animations[]/channels[]/target", "if(value!=null)" },
+ {"gltf/animations[]/samplers", "if(value.samplers!=null && value.samplers.Count>0)" },
+ {"gltf/accessors", "if(value.accessors!=null && value.accessors.Count>0)" },
+ {"gltf/accessors[]/max", "if(value.max!=null && value.max.Length>0)"},
+ {"gltf/accessors[]/min", "if(value.min!=null && value.min.Length>0)"},
+ {"gltf/accessors[]/sparse", "if(value.sparse!=null && value.sparse.count>0)"},
+ {"gltf/accessors[]/bufferView", "if(value.bufferView>=0)"},
+ {"gltf/accessors[]/byteOffset", "if(value.bufferView>=0)"},
+
+ {"gltf/images", "if(value.images!=null && value.images.Count>0)" },
+
+ {"gltf/meshes", "if(value.meshes!=null && value.meshes.Count>0)" },
+ {"gltf/meshes[]/primitives", "if(value.primitives!=null && value.primitives.Count>0)" },
+ {"gltf/meshes[]/primitives[]/targets", "if(value.targets!=null && value.targets.Count>0)" },
+
+ {"gltf/meshes[]/primitives[]/targets[]/POSITION", "if(value.POSITION!=-1)" },
+ {"gltf/meshes[]/primitives[]/targets[]/NORMAL", "if(value.NORMAL!=-1)" },
+ {"gltf/meshes[]/primitives[]/targets[]/TANGENT", "if(value.TANGENT!=-1)" },
+
+ {"gltf/meshes[]/primitives[]/attributes/POSITION", "if(value.POSITION!=-1)"},
+ {"gltf/meshes[]/primitives[]/attributes/NORMAL", "if(value.NORMAL!=-1)"},
+ {"gltf/meshes[]/primitives[]/attributes/TANGENT", "if(value.TANGENT!=-1)"},
+ {"gltf/meshes[]/primitives[]/attributes/TEXCOORD_0", "if(value.TEXCOORD_0!=-1)"},
+ {"gltf/meshes[]/primitives[]/attributes/COLOR_0", "if(value.COLOR_0!=-1)"},
+ {"gltf/meshes[]/primitives[]/attributes/JOINTS_0", "if(value.JOINTS_0!=-1)"},
+ {"gltf/meshes[]/primitives[]/attributes/WEIGHTS_0", "if(value.WEIGHTS_0!=-1)"},
+
+ {"gltf/meshes[]/primitives[]/extras", "if(value.extras!=null && value.extras.targetNames!=null && value.extras.targetNames.Count>0)"},
+ {"gltf/meshes[]/weights", "if(value.weights!=null && value.weights.Length>0)" },
+ {"gltf/materials", "if(value.materials!=null && value.materials.Count>0)" },
+ {"gltf/materials[]/alphaCutoff", "if(value.alphaMode == \"MASK\")" },
+ {"gltf/nodes", "if(value.nodes!=null && value.nodes.Count>0)" },
+ {"gltf/nodes[]/camera", "if(value.camera!=-1)"},
+ {"gltf/nodes[]/mesh", "if(value.mesh!=-1)"},
+ {"gltf/nodes[]/skin", "if(value.skin!=-1)"},
+ {"gltf/nodes[]/children", "if(value.children != null && value.children.Length>0)"},
+ {"gltf/samplers", "if(value.samplers!=null && value.samplers.Count>0)" },
+ {"gltf/scenes", "if(value.scenes!=null && value.scenes.Count>0)" },
+ {"gltf/scenes[]/nodes", "if(value.nodes!=null && value.nodes.Length>0)" },
+ {"gltf/skins", "if(value.skins!=null && value.skins.Count>0)" },
+ {"gltf/skins[]/skeleton", "if(value.skeleton!=-1)"},
+ {"gltf/skins[]/joints", "if(value.joints!=null && value.joints.Length>0)"},
+ {"gltf/extensionsUsed", "if(value.extensionsUsed!=null && value.extensionsUsed.Count>0)"}, // dummy
+ {"gltf/extensionsRequired", "if(false && value.extensionsRequired!=null && value.extensionsRequired.Count>0)"},
+ {"gltf/extensions/VRM/humanoid/humanBones[]/axisLength", "if(value.axisLength>0)"},
+ {"gltf/extensions/VRM/humanoid/humanBones[]/center", "if(value.center!=Vector3.zero)"},
+ {"gltf/extensions/VRM/humanoid/humanBones[]/max", "if(value.max!=Vector3.zero)"},
+ {"gltf/extensions/VRM/humanoid/humanBones[]/min", "if(value.min!=Vector3.zero)"},
+ {"gltf/textures", "if(value.textures!=null && value.textures.Count>0)" },
+ };
+
+ public Generator(string path)
+ {
+ m_path = path;
+ m_s = File.Open(path, FileMode.Create);
+ m_w = new StreamWriter(m_s, Encoding.UTF8);
+
+ // begin
+ m_w.Write(@"
+using System;
+using System.Collections.Generic;
+using UniJSON;
+using UnityEngine;
+using VRM;
+
+namespace UniGLTF {
+
+ static public class IFormatterExtensionsGltf
+ {
+
+");
+ }
+
+ public void Dispose()
+ {
+ // end
+ m_w.Write(@"
+ } // class
+} // namespace
+");
+
+ m_w.Dispose();
+ m_s.Dispose();
+ UnityPath.FromFullpath(m_path).ImportAsset();
+ }
+
+ HashSet<Type> m_used = new HashSet<Type>
+ {
+ typeof(object),
+ };
+
+ public void Generate(Type t, string path, int level = 0)
+ {
+ if (m_used.Contains(t))
+ {
+ // 処理済み
+ return;
+ }
+ m_used.Add(t);
+
+ // primitive
+ try
+ {
+ var mi = typeof(IFormatter).GetMethod("Value", new Type[] { t });
+ if (mi != null)
+ {
+ m_w.Write(@"
+ public static void GenSerialize(this IFormatter f, $0 value)
+ {
+ f.Value(value);
+ }
+".Replace("$0", t.Name));
+
+ return;
+ }
+ }
+ catch (AmbiguousMatchException)
+ {
+ // skip
+ }
+
+ if (t.IsEnum)
+ {
+ m_w.Write(@"
+ public static void GenSerialize(this IFormatter f, $0 value)
+ {
+ f.Value((int)value);
+ }
+".Replace("$0", t.Name));
+ }
+ else if (t.IsArray)
+ {
+ var et = t.GetElementType();
+ m_w.Write(@"
+ /// $1
+ public static void GenSerialize(this IFormatter f, $0[] value)
+ {
+ f.BeginList(value.Length);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+ "
+ .Replace("$0", et.Name)
+ .Replace("$1", path)
+ );
+ Generate(et, path + "[]", level + 1);
+ }
+ else if (t.IsGenericType)
+ {
+ if (t.GetGenericTypeDefinition() == typeof(List<>))
+ {
+ var et = t.GetGenericArguments()[0];
+ m_w.Write(@"
+ /// $1
+ public static void GenSerialize(this IFormatter f, List<$0> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+"
+.Replace("$0", et.Name)
+.Replace("$1", path));
+ Generate(et, path + "[]", level + 1);
+ }
+ else if (t.GetGenericTypeDefinition() == typeof(Dictionary<,>)
+ && t.GetGenericArguments()[0] == typeof(string))
+ {
+ var et = t.GetGenericArguments()[1];
+ m_w.Write(@"
+ /// $1
+ public static void GenSerialize(this IFormatter f, Dictionary<string, $0> value)
+ {
+ f.BeginMap(value.Count);
+ foreach (var kv in value)
+ {
+ f.Key(kv.Key);
+ f.GenSerialize(kv.Value);
+ }
+ f.EndMap();
+ }
+
+"
+.Replace("$0", et.Name)
+.Replace("$1", path));
+ Generate(et, path + "{}", level + 1);
+ }
+ else
+ {
+ Debug.LogWarningFormat("unknown type: {0}", t);
+ }
+ }
+ else
+ {
+ Debug.LogFormat("{0}({1})", path, t.Name);
+
+ m_w.Write(@"
+ /// $1
+ public static void GenSerialize(this IFormatter f, $0 value)
+ {
+ f.BeginMap(0); // dummy
+"
+.Replace("$0", t.Name)
+.Replace("$1", path)
+);
+
+ foreach (var fi in t.GetFields(FIELD_FLAGS))
+ {
+ if (fi.FieldType == typeof(object))
+ {
+ continue;
+ }
+ if (fi.IsLiteral && !fi.IsInitOnly)
+ {
+ continue;
+ }
+ if (fi.FieldType == typeof(string) || fi.FieldType.IsEnum || fi.FieldType.IsArray || fi.FieldType.IsGenericType)
+ {
+
+ }
+ else if (fi.FieldType == typeof(glTF_KHR_materials_unlit))
+ {
+
+ }
+ else if (fi.FieldType.IsClass && fi.FieldType.GetFields(FIELD_FLAGS).Length == 0)
+ {
+ continue;
+ }
+
+ var snipet = fi.FieldType.IsClass ? "if(value." + fi.Name + "!=null)" : "";
+ var value = default(string);
+ if (s_snippets.TryGetValue(path + "/" + fi.Name, out value))
+ {
+ snipet = value;
+ }
+
+ if (value == "")
+ {
+ // found, but empty
+ }
+ else
+ {
+ m_w.Write(@"
+ $1
+ {
+ f.Key(""$0""); f.GenSerialize(value.$0);
+ }
+"
+ .Replace("$0", fi.Name)
+ .Replace("$1", snipet)
+ );
+ }
+ }
+
+ m_w.Write(@"
+ f.EndMap();
+ }
+");
+
+ foreach (var fi in t.GetFields(FIELD_FLAGS))
+ {
+ Generate(fi.FieldType, path + "/" + fi.Name, level + 1);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs.meta
new file mode 100644
index 00000000..ffc8762c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Serialization/SerializerGenerator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a9c53a1e9bb8c9244927b7a7041e8e3a
+timeCreated: 1564983410
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests.meta
new file mode 100644
index 00000000..f4fb4691
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 13108e3e41e195b40a05e62715bd5a50
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs
new file mode 100644
index 00000000..a1e3a2ac
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs
@@ -0,0 +1,21 @@
+using NUnit.Framework;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class CacheEnumTest
+ {
+ [Test]
+ public void CacheEnumTestSimplePasses()
+ {
+ Assert.AreEqual(default(HumanBodyBones), CacheEnum.TryParseOrDefault<HumanBodyBones>("xxx"));
+
+#if UNITY_5_6_OR_NEWER
+ Assert.AreEqual(HumanBodyBones.UpperChest, CacheEnum.TryParseOrDefault<HumanBodyBones>("upperchest", true));
+#else
+ Assert.AreEqual(default(HumanBodyBones), CacheEnum.TryParseOrDefault<HumanBodyBones>("upperchest"));
+#endif
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs.meta
new file mode 100644
index 00000000..5b29bb58
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/CacheEnumTest.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9051db9a028cfa64bacbae8644969dd0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs
new file mode 100644
index 00000000..e056df6f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs
@@ -0,0 +1,36 @@
+using NUnit.Framework;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public class JsonDeserializeTests
+ {
+ static T deserialize<T>(string json)
+ {
+ return JsonUtility.FromJson<T>(json);
+ }
+
+ [Test]
+ public void PrimitivesExtensionsTest()
+ {
+ {
+ var r = deserialize<glTFPrimitives_extensions>("");
+ Assert.AreEqual(null, r);
+ }
+
+ {
+ var r = deserialize<glTFPrimitives_extensions>("{}");
+ Assert.NotNull(r);
+ // This is a curious behaviour of JsonUtility.
+ // TODO: We should replace a library which treats JSON from JsonUtility
+ //Assert.Null(r.KHR_draco_mesh_compression);
+ }
+
+ {
+ var r = deserialize<glTFPrimitives_extensions>("{\"KHR_draco_mesh_compression\":{}}");
+ Assert.NotNull(r);
+ //Assert.NotNull(r.KHR_draco_mesh_compression);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs.meta
new file mode 100644
index 00000000..84f6aba8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/JsonDeserializeTests.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 6dab77b78a3d45bf8c20e7dcc8046881
+timeCreated: 1547715653 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs
new file mode 100644
index 00000000..99d3a9dd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs
@@ -0,0 +1,224 @@
+using NUnit.Framework;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class MaterialTests
+ {
+
+ [Test]
+ public void TextureTransformTest()
+ {
+ var tex0 = new Texture2D(128, 128)
+ {
+ wrapMode = TextureWrapMode.Repeat,
+ filterMode = FilterMode.Bilinear,
+ };
+
+ var textureManager = new TextureExportManager(new Texture[] { tex0 });
+ var srcMaterial = new Material(Shader.Find("Standard"));
+
+ var offset = new Vector2(0.3f, 0.2f);
+ var scale = new Vector2(0.5f, 0.6f);
+
+ srcMaterial.mainTexture = tex0;
+ srcMaterial.mainTextureOffset = offset;
+ srcMaterial.mainTextureScale = scale;
+
+ var materialExporter = new MaterialExporter();
+ var gltfMaterial = materialExporter.ExportMaterial(srcMaterial, textureManager);
+
+ var shaderStore = new ShaderStore(null);
+ var materialImporter = new MaterialImporter(shaderStore, (int index) => {return null;});
+ var dstMaterial = materialImporter.CreateMaterial(0,gltfMaterial, false);
+
+ Assert.AreEqual(dstMaterial.mainTextureOffset.x, offset.x, 0.001f);
+ Assert.AreEqual(dstMaterial.mainTextureOffset.y, offset.y, 0.001f);
+ Assert.AreEqual(dstMaterial.mainTextureScale.x, scale.x, 0.001f);
+ Assert.AreEqual(dstMaterial.mainTextureScale.y, scale.y, 0.001f);
+ }
+
+ [Test]
+ public void UnlitShaderImportTest()
+ {
+ var shaderStore = new ShaderStore(null);
+
+ {
+ // OPAQUE/Color
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "OPAQUE",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1, 0, 0, 1 },
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // OPAQUE/Texture
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "OPAQUE",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // OPAQUE/Color/Texture
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "OPAQUE",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1, 0, 0, 1 },
+ baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // BLEND/Color
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "BLEND",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1, 0, 0, 1 },
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // BLEND/Texture
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "BLEND",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // BLEND/Color/Texture
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "BLEND",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1, 0, 0, 1 },
+ baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // MASK/Texture
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "MASK",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // MASK/Color/Texture
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ alphaMode = "MASK",
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1, 0, 0, 1 },
+ baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+
+ {
+ // default
+ var shader = shaderStore.GetShader(new glTFMaterial
+ {
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit { }
+ }
+ });
+ Assert.AreEqual("UniGLTF/UniUnlit", shader.name);
+ }
+ }
+
+ [Test]
+ public void MaterialImportTest()
+ {
+ var shaderStore = new ShaderStore(null);
+ var materialImporter = new MaterialImporter(shaderStore, null);
+
+ {
+ var material = materialImporter.CreateMaterial(0, new glTFMaterial { }, false);
+ Assert.AreEqual("Standard", material.shader.name);
+ }
+ }
+
+ [Test]
+ public void MaterialExportTest()
+ {
+ var material = new Material(Shader.Find("Standard"));
+ material.SetColor("_EmissionColor", new Color(0, 1, 2, 1));
+ material.EnableKeyword("_EMISSION");
+ var materialExporter = new MaterialExporter();
+ var textureExportManager = new TextureExportManager(new Texture[] { });
+ var gltfMaterial = materialExporter.ExportMaterial(material, textureExportManager);
+
+ Assert.AreEqual(gltfMaterial.emissiveFactor, new float[] { 0, 0.5f, 1 });
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs.meta
new file mode 100644
index 00000000..5e987915
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/MaterialTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 37dbc1bc37728a44f8e33ad44e407c91
+timeCreated: 1533626339
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs
new file mode 100644
index 00000000..edc28a89
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs
@@ -0,0 +1,129 @@
+using NUnit.Framework;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public class TextureTests
+ {
+ [Test]
+ public void TextureExportTest()
+ {
+ // Dummy texture
+ var tex0 = new Texture2D(128, 128)
+ {
+ wrapMode = TextureWrapMode.Clamp,
+ filterMode = FilterMode.Trilinear,
+ };
+ var textureManager = new TextureExportManager(new Texture[] {tex0});
+
+ var material = new Material(Shader.Find("Standard"));
+ material.mainTexture = tex0;
+
+ var materialExporter = new MaterialExporter();
+ materialExporter.ExportMaterial(material, textureManager);
+
+ var convTex0 = textureManager.GetExportTexture(0);
+ var sampler = TextureSamplerUtil.Export(convTex0);
+
+ Assert.AreEqual(glWrap.CLAMP_TO_EDGE, sampler.wrapS);
+ Assert.AreEqual(glWrap.CLAMP_TO_EDGE, sampler.wrapT);
+ Assert.AreEqual(glFilter.LINEAR_MIPMAP_LINEAR, sampler.minFilter);
+ Assert.AreEqual(glFilter.LINEAR_MIPMAP_LINEAR, sampler.magFilter);
+ }
+ }
+
+ public class MetallicRoughnessConverterTests
+ {
+ [Test]
+ public void ExportingColorTest()
+ {
+ {
+ var smoothness = 1.0f;
+ var conv = new MetallicRoughnessConverter(smoothness);
+ Assert.That(
+ conv.Export(new Color32(255, 255, 255, 255)),
+ // r <- 0 : (Unused)
+ // g <- 0 : ((1 - src.a(as float) * smoothness) ^ 2)(as uint8)
+ // b <- 255 : Same metallic (src.r)
+ // a <- 255 : (Unused)
+ Is.EqualTo(new Color32(0, 0, 255, 255)));
+ }
+
+ {
+ var smoothness = 0.5f;
+ var conv = new MetallicRoughnessConverter(smoothness);
+ Assert.That(
+ conv.Export(new Color32(255, 255, 255, 255)),
+ // r <- 0 : (Unused)
+ // g <- 63 : ((1 - src.a(as float) * smoothness) ^ 2)(as uint8)
+ // b <- 255 : Same metallic (src.r)
+ // a <- 255 : (Unused)
+ Is.EqualTo(new Color32(0, 63, 255, 255)));
+ }
+
+ {
+ var smoothness = 0.0f;
+ var conv = new MetallicRoughnessConverter(smoothness);
+ Assert.That(
+ conv.Export(new Color32(255, 255, 255, 255)),
+ // r <- 0 : (Unused)
+ // g <- 255 : ((1 - src.a(as float) * smoothness) ^ 2)(as uint8)
+ // b <- 255 : Same metallic (src.r)
+ // a <- 255 : (Unused)
+ Is.EqualTo(new Color32(0, 255, 255, 255)));
+ }
+ }
+
+ [Test]
+ public void ImportingColorTest()
+ {
+ {
+ var roughnessFactor = 1.0f;
+ var conv = new MetallicRoughnessConverter(roughnessFactor);
+ Assert.That(
+ conv.Import(new Color32(255, 255, 255, 255)),
+ // r <- 255 : Same metallic (src.r)
+ // g <- 0 : (Unused)
+ // b <- 0 : (Unused)
+ // a <- 0 : ((1 - sqrt(src.g(as float) * roughnessFactor)))(as uint8)
+ Is.EqualTo(new Color32(255, 0, 0, 0)));
+ }
+
+ {
+ var roughnessFactor = 1.0f;
+ var conv = new MetallicRoughnessConverter(roughnessFactor);
+ Assert.That(
+ conv.Import(new Color32(255, 63, 255, 255)),
+ // r <- 255 : Same metallic (src.r)
+ // g <- 0 : (Unused)
+ // b <- 0 : (Unused)
+ // a <- 128 : ((1 - sqrt(src.g(as float) * roughnessFactor)))(as uint8)
+ Is.EqualTo(new Color32(255, 0, 0, 128))); // smoothness 0.5 * src.a 1.0
+ }
+
+ {
+ var roughnessFactor = 0.5f;
+ var conv = new MetallicRoughnessConverter(roughnessFactor);
+ Assert.That(
+ conv.Import(new Color32(255, 255, 255, 255)),
+ // r <- 255 : Same metallic (src.r)
+ // g <- 0 : (Unused)
+ // b <- 0 : (Unused)
+ // a <- 74 : ((1 - sqrt(src.g(as float) * roughnessFactor)))(as uint8)
+ Is.EqualTo(new Color32(255, 0, 0, 74)));
+ }
+
+ {
+ var roughnessFactor = 0.0f;
+ var conv = new MetallicRoughnessConverter(roughnessFactor);
+ Assert.That(
+ conv.Import(new Color32(255, 255, 255, 255)),
+ // r <- 255 : Same metallic (src.r)
+ // g <- 0 : (Unused)
+ // b <- 0 : (Unused)
+ // a <- 255 : ((1 - sqrt(src.g(as float) * roughnessFactor)))(as uint8)
+ Is.EqualTo(new Color32(255, 0, 0, 255)));
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs.meta
new file mode 100644
index 00000000..acc8e893
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/TextureTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 195a45a1caf480e41a7af798f30520f0
+timeCreated: 1552296844
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef
new file mode 100644
index 00000000..55dedf4d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef
@@ -0,0 +1,15 @@
+{
+ "name": "UniGLTF.Editor.Tests",
+ "references": [
+ "VRM",
+ "UniJSON"
+ ],
+ "optionalUnityReferences": [
+ "TestAssemblies"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef.meta
new file mode 100644
index 00000000..812b7f5b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTF.Editor.Tests.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: defaf82877bdaee4994325c29625b5ea
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs
new file mode 100644
index 00000000..0c090fec
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs
@@ -0,0 +1,724 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniJSON;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class UniGLTFTests
+ {
+ static GameObject CreateSimpleScene()
+ {
+ var root = new GameObject("gltfRoot").transform;
+
+ var scene = new GameObject("scene0").transform;
+ scene.SetParent(root, false);
+ scene.localPosition = new Vector3(1, 2, 3);
+
+ return root.gameObject;
+ }
+
+ void AssertAreEqual(Transform go, Transform other)
+ {
+ var lt = go.Traverse().GetEnumerator();
+ var rt = go.Traverse().GetEnumerator();
+
+ while (lt.MoveNext())
+ {
+ if (!rt.MoveNext())
+ {
+ throw new Exception("rt shorter");
+ }
+
+ MonoBehaviourComparator.AssertAreEquals(lt.Current.gameObject, rt.Current.gameObject);
+ }
+
+ if (rt.MoveNext())
+ {
+ throw new Exception("rt longer");
+ }
+ }
+
+ [Test]
+ public void UniGLTFSimpleSceneTest()
+ {
+ var go = CreateSimpleScene();
+ var context = new ImporterContext();
+
+ try
+ {
+ // export
+ var gltf = new glTF();
+
+ string json = null;
+ using (var exporter = new gltfExporter(gltf))
+ {
+ exporter.Prepare(go);
+ exporter.Export(MeshExportSettings.Default);
+
+ // remove empty buffer
+ gltf.buffers.Clear();
+
+ json = gltf.ToJson();
+ }
+
+ // import
+ context.ParseJson(json, new SimpleStorage(new ArraySegment<byte>()));
+ //Debug.LogFormat("{0}", context.Json);
+ context.Load();
+
+ AssertAreEqual(go.transform, context.Root.transform);
+ }
+ finally
+ {
+ //Debug.LogFormat("Destroy, {0}", go.name);
+ GameObject.DestroyImmediate(go);
+ context.EditorDestroyRootAndAssets();
+ }
+ }
+
+ void BufferTest(int init, params int[] size)
+ {
+ var initBytes = init == 0 ? null : new byte[init];
+ var storage = new ArrayByteBuffer(initBytes);
+ var buffer = new glTFBuffer(storage);
+
+ var values = new List<byte>();
+ int offset = 0;
+ foreach (var x in size)
+ {
+ var nums = Enumerable.Range(offset, x).Select(y => (Byte)y).ToArray();
+ values.AddRange(nums);
+ var bytes = new ArraySegment<Byte>(nums);
+ offset += x;
+ buffer.Append(bytes, glBufferTarget.NONE);
+ }
+
+ Assert.AreEqual(values.Count, buffer.byteLength);
+ Assert.True(Enumerable.SequenceEqual(values, buffer.GetBytes().ToArray()));
+ }
+
+ [Test]
+ public void BufferTest()
+ {
+ BufferTest(0, 0, 100, 200);
+ BufferTest(0, 128);
+ BufferTest(0, 256);
+
+ BufferTest(1024, 0);
+ BufferTest(1024, 128);
+ BufferTest(1024, 2048);
+ BufferTest(1024, 900, 900);
+ }
+
+ [Test]
+ public void UnityPathTest()
+ {
+ var root = UnityPath.FromUnityPath(".");
+ Assert.IsFalse(root.IsNull);
+ Assert.IsFalse(root.IsUnderAssetsFolder);
+ Assert.AreEqual(UnityPath.FromUnityPath("."), root);
+
+ var assets = UnityPath.FromUnityPath("Assets");
+ Assert.IsFalse(assets.IsNull);
+ Assert.IsTrue(assets.IsUnderAssetsFolder);
+
+ var rootChild = root.Child("Assets");
+ Assert.AreEqual(assets, rootChild);
+
+ var assetsChild = assets.Child("Hoge");
+ var hoge = UnityPath.FromUnityPath("Assets/Hoge");
+ Assert.AreEqual(assetsChild, hoge);
+
+ //var children = root.TraverseDir().ToArray();
+ }
+
+ [Test]
+ public void VersionChecker()
+ {
+ Assert.False(ImporterContext.IsGeneratedUniGLTFAndOlderThan("hoge", 1, 16));
+ Assert.False(ImporterContext.IsGeneratedUniGLTFAndOlderThan("UniGLTF-1.16", 1, 16));
+ Assert.True(ImporterContext.IsGeneratedUniGLTFAndOlderThan("UniGLTF-1.15", 1, 16));
+ Assert.False(ImporterContext.IsGeneratedUniGLTFAndOlderThan("UniGLTF-11.16", 1, 16));
+ Assert.True(ImporterContext.IsGeneratedUniGLTFAndOlderThan("UniGLTF-0.16", 1, 16));
+ Assert.True(ImporterContext.IsGeneratedUniGLTFAndOlderThan("UniGLTF", 1, 16));
+ }
+
+ [Test]
+ public void MeshTest()
+ {
+ var model = new glTFMesh("mesh")
+ {
+ primitives = new List<glTFPrimitives>
+ {
+ new glTFPrimitives
+ {
+ attributes = new glTFAttributes
+ {
+ POSITION = 0,
+ }
+ }
+ },
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""name"":""mesh"",""primitives"":[{""mode"":0,""indices"":-1,""attributes"":{""POSITION"":0},""material"":0}]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFMesh>().Serialize(model, c);
+ Assert.AreEqual(@"{""name"":""mesh"",""primitives"":[{""mode"":0,""attributes"":{""POSITION"":0},""material"":0}]}", json2);
+ }
+
+ [Test]
+ public void PrimitiveTest()
+ {
+ var model = new glTFPrimitives
+ {
+ attributes = new glTFAttributes
+ {
+ POSITION = 0,
+ },
+ extras = new glTFPrimitives_extras
+ {
+ targetNames = new List<String>
+ {
+ "aaa",
+ }
+ }
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""mode"":0,""indices"":-1,""attributes"":{""POSITION"":0},""material"":0,""extras"":{""targetNames"":[""aaa""]}}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFPrimitives>().Serialize(model, c);
+ Assert.AreEqual(@"{""mode"":0,""attributes"":{""POSITION"":0},""material"":0,""extras"":{""targetNames"":[""aaa""]}}", json2);
+ }
+
+ [Test]
+ public void AttributesTest()
+ {
+ var model = new glTFAttributes
+ {
+ POSITION = 0,
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""POSITION"":0}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFAttributes>().Serialize(model, c);
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void TextureInfoTest()
+ {
+ var model = new glTFMaterialBaseColorTextureInfo()
+ {
+ index = 1,
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""index"":1,""texCoord"":0}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFMaterialBaseColorTextureInfo>().Serialize(model, c);
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void TextureInfoTestError()
+ {
+ var model = new glTFMaterialBaseColorTextureInfo();
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTFMaterialBaseColorTextureInfo>().Serialize(model, c)
+ );
+ Assert.AreEqual("[index.String] minimum: ! -1>=0", ex.Message);
+ }
+
+ [Test]
+ public void MaterialTest()
+ {
+ var model = new glTFMaterial()
+ {
+ name = "a",
+ emissiveFactor = new float[] { 0.5f, 0.5f, 0.5f },
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""name"":""a"",""pbrMetallicRoughness"":{""baseColorFactor"":[1,1,1,1],""metallicFactor"":1,""roughnessFactor"":1},""emissiveFactor"":[0.5,0.5,0.5],""doubleSided"":false}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFMaterial>().Serialize(model, c);
+ Assert.AreEqual(@"{""name"":""a"",""pbrMetallicRoughness"":{""baseColorFactor"":[1,1,1,1],""metallicFactor"":1,""roughnessFactor"":1},""emissiveFactor"":[0.5,0.5,0.5],""doubleSided"":false}", json2);
+ }
+
+ [Test]
+ public void MaterialAlphaTest()
+ {
+ var model = new glTFMaterial()
+ {
+ name = "a",
+ emissiveFactor = new float[] { 0.5f, 0.5f, 0.5f },
+ alphaMode = "MASK",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json = JsonSchema.FromType<glTFMaterial>().Serialize(model, c);
+ Assert.AreEqual(@"{""name"":""a"",""pbrMetallicRoughness"":{""baseColorFactor"":[1,1,1,1],""metallicFactor"":1,""roughnessFactor"":1},""emissiveFactor"":[0.5,0.5,0.5],""alphaMode"":""MASK"",""alphaCutoff"":0.5,""doubleSided"":false}", json);
+ }
+
+ [Test]
+ public void GlTFToJsonTest()
+ {
+ var gltf = new glTF();
+ using (var exporter = new gltfExporter(gltf))
+ {
+ exporter.Prepare(CreateSimpleScene());
+ exporter.Export(MeshExportSettings.Default);
+ }
+
+ var expected = gltf.ToJson().ParseAsJson();
+ expected.AddKey(Utf8String.From("meshes"));
+ expected.AddValue(default(ArraySegment<byte>), ValueNodeType.Array);
+ expected["meshes"].AddValue(default(ArraySegment<byte>), ValueNodeType.Object);
+
+ var mesh = expected["meshes"][0];
+ mesh.AddKey(Utf8String.From("name"));
+ mesh.AddValue(Utf8String.From(JsonString.Quote("test")).Bytes, ValueNodeType.String);
+ mesh.AddKey(Utf8String.From("primitives"));
+ mesh.AddValue(default(ArraySegment<byte>), ValueNodeType.Array);
+ mesh["primitives"].AddValue(default(ArraySegment<byte>), ValueNodeType.Object);
+
+ var primitive = mesh["primitives"][0];
+ primitive.AddKey(Utf8String.From("mode"));
+ primitive.AddValue(Utf8String.From("0").Bytes, ValueNodeType.Integer);
+ primitive.AddKey(Utf8String.From("indices"));
+ primitive.AddValue(Utf8String.From("0").Bytes, ValueNodeType.Integer);
+ primitive.AddKey(Utf8String.From("material"));
+ primitive.AddValue(Utf8String.From("0").Bytes, ValueNodeType.Integer);
+ primitive.AddKey(Utf8String.From("attributes"));
+ primitive.AddValue(default(ArraySegment<byte>), ValueNodeType.Object);
+ primitive["attributes"].AddKey(Utf8String.From("POSITION"));
+ primitive["attributes"].AddValue(Utf8String.From("0").Bytes, ValueNodeType.Integer);
+ primitive.AddKey(Utf8String.From("targets"));
+ primitive.AddValue(default(ArraySegment<byte>), ValueNodeType.Array);
+ primitive["targets"].AddValue(default(ArraySegment<byte>), ValueNodeType.Object);
+ primitive["targets"][0].AddKey(Utf8String.From("POSITION"));
+ primitive["targets"][0].AddValue(Utf8String.From("1").Bytes, ValueNodeType.Integer);
+ primitive["targets"].AddValue(default(ArraySegment<byte>), ValueNodeType.Object);
+ primitive["targets"][1].AddKey(Utf8String.From("POSITION"));
+ primitive["targets"][1].AddValue(Utf8String.From("2").Bytes, ValueNodeType.Integer);
+ primitive["targets"][1].AddKey(Utf8String.From("TANGENT"));
+ primitive["targets"][1].AddValue(Utf8String.From("0").Bytes, ValueNodeType.Integer);
+
+ gltf.meshes.Add(new glTFMesh("test")
+ {
+ primitives = new List<glTFPrimitives>
+ {
+ new glTFPrimitives
+ {
+ indices = 0,
+ attributes = new glTFAttributes
+ {
+ POSITION = 0,
+ TANGENT = -1 // should be removed
+ },
+ targets = new List<gltfMorphTarget>
+ {
+ new gltfMorphTarget
+ {
+ POSITION = 1,
+ TANGENT = -1 // should be removed
+ },
+ new gltfMorphTarget
+ {
+ POSITION = 2,
+ TANGENT = 0
+ }
+ }
+ }
+ }
+ });
+ var actual = gltf.ToJson().ParseAsJson();
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ public void MaterialTestError()
+ {
+ var model = new glTFMaterial()
+ {
+ name = "b",
+ emissiveFactor = new float[] { 1.5f, 0.5f, 0.5f },
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTFMaterial>().Serialize(model, c)
+ );
+ Assert.AreEqual("[emissiveFactor.String] maximum: ! 1.5<=1", ex.Message);
+ }
+
+ [Test]
+ public void NodeTest()
+ {
+ var model = new glTFNode()
+ {
+ name = "a",
+ skin = 0,
+ camera = -1,
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""name"":""a"",""skin"":0}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFNode>().Serialize(model, c);
+ Assert.AreEqual(@"{""name"":""a"",""extras"":{}}", json2);
+ }
+
+ [Test]
+ public void NodeMeshTest()
+ {
+ var model = new glTFNode()
+ {
+ name = "a",
+ mesh = 2,
+ skin = 0,
+ camera = -1,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json = JsonSchema.FromType<glTFNode>().Serialize(model, c);
+ Assert.AreEqual(@"{""name"":""a"",""mesh"":2,""skin"":0,""extras"":{}}", json);
+ }
+
+ [Test]
+ public void NodeTestError()
+ {
+ var model = new glTFNode()
+ {
+ name = "a",
+ camera = -2,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTFNode>().Serialize(model, c)
+ );
+ Assert.AreEqual("[camera.String] minimum: ! -2>=0", ex.Message);
+ }
+
+ [Test]
+ public void SkinTest()
+ {
+ var model = new glTFSkin()
+ {
+ name = "b",
+ joints = new int[] { 1 },
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFSkin>().Serialize(model, c);
+ Assert.AreEqual(@"{""joints"":[1],""name"":""b""}", json2);
+ }
+
+ [Test]
+ public void SkinTestEmptyName()
+ {
+ var model = new glTFSkin()
+ {
+ name = "",
+ joints = new int[] { 1 },
+ };
+
+ var json = model.ToJson();
+ // "name" = "", not excluded
+ Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFSkin>().Serialize(model, c);
+ Assert.AreEqual(@"{""joints"":[1],""name"":""""}", json2);
+ }
+
+ [Test]
+ public void SkinTestErrorNull()
+ {
+ var model = new glTFSkin()
+ {
+ name = "b",
+ joints = null,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTFSkin>().Serialize(model, c)
+ );
+ Assert.AreEqual("[joints.String] null", ex.Message);
+ }
+
+ [Test]
+ public void SkinTestError()
+ {
+ var model = new glTFSkin()
+ {
+ name = "b",
+ joints = new int[] { },
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTFSkin>().Serialize(model, c)
+ );
+ Assert.AreEqual("[joints.String] minItems", ex.Message);
+ }
+
+ [Test]
+ public void AssetsTest()
+ {
+ var model = new glTFAssets()
+ {
+ version = "0.49",
+ };
+
+ //var json = model.ToJson();
+ //Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
+ //Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTFAssets>().Serialize(model, c);
+ Assert.AreEqual(@"{""version"":""0.49""}", json2);
+ }
+
+ [Test]
+ public void AssetsTestError()
+ {
+ var model = new glTFAssets();
+
+ //var json = model.ToJson();
+ //Assert.AreEqual(@"{""inverseBindMatrices"":-1,""joints"":[1]}", json);
+ //Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTFAssets>().Serialize(model, c)
+ );
+ Assert.AreEqual("[version.String] null", ex.Message);
+ }
+
+ [Test]
+ public void GLTFTest()
+ {
+ var model = new glTF()
+ {
+ asset = new glTFAssets()
+ {
+ version = "0.49",
+ },
+ extensions = null,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF>().Serialize(model, c);
+ Assert.AreEqual(@"{""asset"":{""version"":""0.49""},""extras"":{}}", json2);
+ }
+
+ [Test]
+ public void SameMeshButDifferentMaterialExport()
+ {
+ var go = new GameObject("same_mesh");
+ try
+ {
+ var shader = Shader.Find("Unlit/Color");
+
+ var cubeA = GameObject.CreatePrimitive(PrimitiveType.Cube);
+ {
+ cubeA.transform.SetParent(go.transform);
+ var material = new Material(shader);
+ material.name = "red";
+ material.color = Color.red;
+ cubeA.GetComponent<Renderer>().sharedMaterial = material;
+ }
+
+ {
+ var cubeB = GameObject.Instantiate(cubeA);
+ cubeB.transform.SetParent(go.transform);
+ var material = new Material(shader);
+ material.color = Color.blue;
+ material.name = "blue";
+ cubeB.GetComponent<Renderer>().sharedMaterial = material;
+
+ Assert.AreEqual(cubeB.GetComponent<MeshFilter>().sharedMesh, cubeA.GetComponent<MeshFilter>().sharedMesh);
+ }
+
+ // export
+ var gltf = new glTF();
+ var json = default(string);
+ using (var exporter = new gltfExporter(gltf))
+ {
+ exporter.Prepare(go);
+ exporter.Export(UniGLTF.MeshExportSettings.Default);
+
+ json = gltf.ToJson();
+ }
+
+ Assert.AreEqual(2, gltf.meshes.Count);
+
+ var red = gltf.materials[gltf.meshes[0].primitives[0].material];
+ Assert.AreEqual(new float[] { 1, 0, 0, 1 }, red.pbrMetallicRoughness.baseColorFactor);
+
+ var blue = gltf.materials[gltf.meshes[1].primitives[0].material];
+ Assert.AreEqual(new float[] { 0, 0, 1, 1 }, blue.pbrMetallicRoughness.baseColorFactor);
+
+ Assert.AreEqual(2, gltf.nodes.Count);
+
+ Assert.AreNotEqual(gltf.nodes[0].mesh, gltf.nodes[1].mesh);
+
+ // import
+ {
+ var context = new ImporterContext();
+ context.ParseJson(json, new SimpleStorage(new ArraySegment<byte>(new byte[1024 * 1024])));
+ //Debug.LogFormat("{0}", context.Json);
+ context.Load();
+
+ var importedRed = context.Root.transform.GetChild(0);
+ var importedRedMaterial = importedRed.GetComponent<Renderer>().sharedMaterial;
+ Assert.AreEqual("red", importedRedMaterial.name);
+ Assert.AreEqual(Color.red, importedRedMaterial.color);
+
+ var importedBlue = context.Root.transform.GetChild(1);
+ var importedBlueMaterial = importedBlue.GetComponent<Renderer>().sharedMaterial;
+ Assert.AreEqual("blue", importedBlueMaterial.name);
+ Assert.AreEqual(Color.blue, importedBlueMaterial.color);
+ }
+
+ // import new version
+ {
+ var context = new ImporterContext();
+ context.ParseJson(json, new SimpleStorage(new ArraySegment<byte>(new byte[1024 * 1024])));
+ //Debug.LogFormat("{0}", context.Json);
+ context.Load();
+
+ var importedRed = context.Root.transform.GetChild(0);
+ var importedRedMaterial = importedRed.GetComponent<Renderer>().sharedMaterial;
+ Assert.AreEqual("red", importedRedMaterial.name);
+ Assert.AreEqual(Color.red, importedRedMaterial.color);
+
+ var importedBlue = context.Root.transform.GetChild(1);
+ var importedBlueMaterial = importedBlue.GetComponent<Renderer>().sharedMaterial;
+ Assert.AreEqual("blue", importedBlueMaterial.name);
+ Assert.AreEqual(Color.blue, importedBlueMaterial.color);
+ }
+ }
+ finally
+ {
+ GameObject.DestroyImmediate(go);
+ }
+ }
+
+ [Serializable]
+ class CantConstruct
+ {
+ public bool Value = true;
+
+ public CantConstruct(bool value)
+ {
+ throw new Exception();
+ }
+ }
+
+ [Serializable]
+ class Dummy
+ {
+ public CantConstruct Value = default;
+ }
+
+ [Test]
+ public void JsonUtilityTest()
+ {
+ var dummy = JsonUtility.FromJson<Dummy>("{}");
+ Assert.NotNull(dummy.Value);
+ Assert.False(dummy.Value.Value);
+ }
+
+ [Test]
+ public void UniJSONTest()
+ {
+ var dummy = default(Dummy);
+ "{}".ParseAsJson().Deserialize(ref dummy);
+ Assert.Null(dummy.Value);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs.meta
new file mode 100644
index 00000000..2c26ee50
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/Tests/UniGLTFTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 164dff9806a684447ae2c9d679ae730b
+timeCreated: 1521096875
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef
new file mode 100644
index 00000000..61ff6c4b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef
@@ -0,0 +1,18 @@
+{
+ "name": "UniGLTF.Editor",
+ "references": [
+ "VRM",
+ "ShaderProperty.Runtime",
+ "UniJSON"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": []
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef.meta
new file mode 100644
index 00000000..99c08a85
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTF.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: cabd88168fd8c5448ab52737c175806a
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs
new file mode 100644
index 00000000..20579b3d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs
@@ -0,0 +1,45 @@
+#if VRM_DEVELOP
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UnityEditor;
+
+
+namespace UniGLTF
+{
+ public static class UniGLTFVersionMenu
+ {
+ public const int MENU_PRIORITY = 99;
+ static string path = "Assets/UniGLTF/Core/Scripts/UniGLTFVersion.cs";
+
+ const string template = @"
+namespace UniGLTF
+{{
+ public static partial class UniGLTFVersion
+ {{
+ public const int MAJOR = {0};
+ public const int MINOR = {1};
+
+ public const string VERSION = ""{0}.{1}"";
+ }}
+}}
+";
+
+ [MenuItem(UniGLTFVersion.MENU + "/Increment", priority = MENU_PRIORITY)]
+ public static void IncrementVersion()
+ {
+ var source = string.Format(template, UniGLTFVersion.MAJOR, UniGLTFVersion.MINOR + 1);
+ File.WriteAllText(path, source);
+ AssetDatabase.Refresh();
+ }
+
+ [MenuItem(UniGLTFVersion.MENU + "/Decrement", priority = MENU_PRIORITY)]
+ public static void DecrementVersion()
+ {
+ var source = string.Format(template, UniGLTFVersion.MAJOR, UniGLTFVersion.MINOR - 1);
+ File.WriteAllText(path, source);
+ AssetDatabase.Refresh();
+ }
+ }
+}
+#endif
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta
new file mode 100644
index 00000000..ce8f77c7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/UniGLTFVersionMenu.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 49d23365a29018d4cb142227a01e662d
+timeCreated: 1522130550
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs
new file mode 100644
index 00000000..c1e884c0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs
@@ -0,0 +1,86 @@
+using System;
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class gltfAssetPostprocessor : AssetPostprocessor
+ {
+ static void OnPostprocessAllAssets(string[] importedAssets,
+ string[] deletedAssets,
+ string[] movedAssets,
+ string[] movedFromAssetPaths)
+ {
+ foreach (string path in importedAssets)
+ {
+ if (UnityPath.FromUnityPath(path).IsStreamingAsset)
+ {
+ Debug.LogFormat("Skip StreamingAssets: {0}", path);
+ continue;
+ }
+
+ var ext = Path.GetExtension(path).ToLower();
+ switch (ext)
+ {
+ case ".gltf":
+ case ".glb":
+ {
+ var gltfPath = UnityPath.FromUnityPath(path);
+ var prefabPath = gltfPath.Parent.Child(gltfPath.FileNameWithoutExtension + ".prefab");
+ ImportAsset(UnityPath.FromUnityPath(path).FullPath, ext, prefabPath);
+ break;
+ }
+ }
+ }
+ }
+
+ public static void ImportAsset(string src, string ext, UnityPath prefabPath)
+ {
+ if (!prefabPath.IsUnderAssetsFolder)
+ {
+ Debug.LogWarningFormat("out of asset path: {0}", prefabPath);
+ return;
+ }
+
+ var context = new ImporterContext();
+ context.Parse(src);
+
+ // Extract textures to assets folder
+ context.ExtractImages(prefabPath);
+
+ ImportDelayed(src, prefabPath, context);
+ }
+
+ static void ImportDelayed(string src, UnityPath prefabPath, ImporterContext context)
+ {
+ EditorApplication.delayCall += () =>
+ {
+ //
+ // After textures imported(To ensure TextureImporter be accessible).
+ //
+ try
+ {
+ context.Load();
+ context.SaveAsAsset(prefabPath);
+ context.EditorDestroyRoot();
+ }
+ catch (UniGLTFNotSupportedException ex)
+ {
+ Debug.LogWarningFormat("{0}: {1}",
+ src,
+ ex.Message
+ );
+ context.EditorDestroyRootAndAssets();
+ }
+ catch (Exception ex)
+ {
+ Debug.LogErrorFormat("import error: {0}", src);
+ Debug.LogErrorFormat("{0}", ex);
+ context.EditorDestroyRootAndAssets();
+ }
+ };
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs.meta
new file mode 100644
index 00000000..bf132394
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7bbb264b34e75dd438622e1f29f0f46c
+timeCreated: 1517119659
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md b/Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md
new file mode 100644
index 00000000..3299d454
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 ousttrue
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md.meta
new file mode 100644
index 00000000..fa87894c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/LICENSE.md.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 43de50058826c4b42857c7eadcc32794
+timeCreated: 1517138576
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/README.md b/Assets/ThirdParty/VRM/VRM/UniGLTF/README.md
new file mode 100644
index 00000000..e6c712d0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/README.md
@@ -0,0 +1,56 @@
+# UniGLTF
+
+[glTF](https://github.com/KhronosGroup/glTF) 2.0 importer and exporter for Unity 5.6 or later
+
+Improved material importer(UniGLTF-1.21) !
+
+Below is imported from [DamagedHelmet](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet). Using unity standard shader.
+
+![standard shader](doc/pbr_to_standard.png)
+
+
+![duck](doc/duck.png)
+![animation](doc/animation.gif)
+
+# License
+
+* [MIT license](LICENSE)
+
+# See also
+
+* https://github.com/ousttrue/UniGLTF/wiki
+
+# Sample Models
+
+* https://github.com/KhronosGroup/glTF-Sample-Models
+
+## Huge model required Unity2017.3 or later
+
+* [Mesh.IndexFormat(from 2017.3)](https://docs.unity3d.com/ScriptReference/Mesh-indexFormat.html) is required
+
+example. SciFiHelmet(70074vertices)
+
+![SciFiHelmet](doc/SciFiHelmet.png)
+
+# Download
+
+* https://github.com/ousttrue/UniGLTF/releases
+
+# Usage
+
+## Import as prefab
+
+* drop gltf folder or glb file into Assets folder
+
+![duck_prefab](doc/duck_prefab.png)
+
+or
+
+* editor mode
+* menu [UniGLTF] - [Import]
+* open gltf file(gltf, glb, zip) from out of Asset Folder
+
+## API
+
+* https://github.com/ousttrue/UniGLTF/wiki/Rutime-API
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/README.md.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/README.md.meta
new file mode 100644
index 00000000..d2802f0d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/README.md.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c97bd2ee06a25534f9947292d562aecf
+timeCreated: 1517138583
+licenseType: Free
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources.meta
new file mode 100644
index 00000000..e07979f1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: afa37238f2d665b4aba57a3e1714150d
+folderAsset: yes
+timeCreated: 1528270766
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders.meta
new file mode 100644
index 00000000..0f72a33c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cbb764710ae3737458696a3ab5a85d14
+folderAsset: yes
+timeCreated: 1528269714
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader
new file mode 100644
index 00000000..76b76f28
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader
@@ -0,0 +1,54 @@
+Shader "UniGLTF/NormalMapDecoder"
+{
+ Properties
+ {
+ _MainTex ("Texture", 2D) = "white" {}
+ }
+ SubShader
+ {
+ // No culling or depth
+ Cull Off ZWrite Off ZTest Always
+
+ Pass
+ {
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+
+ #include "UnityCG.cginc"
+
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float2 uv : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float2 uv : TEXCOORD0;
+ float4 vertex : SV_POSITION;
+ };
+
+ v2f vert (appdata v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.uv = v.uv;
+ return o;
+ }
+
+ sampler2D _MainTex;
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ half4 col = tex2D(_MainTex, i.uv);
+
+ col.xyz = (UnpackNormal(col) + 1) * 0.5;
+ col.w = 1;
+
+ return col;
+ }
+ ENDCG
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader.meta
new file mode 100644
index 00000000..d3b21087
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapDecoder.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 53762a37d0a403e42a4921e3e3b84915
+timeCreated: 1533558728
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader
new file mode 100644
index 00000000..c4d5fc6a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader
@@ -0,0 +1,63 @@
+Shader "UniGLTF/NormalMapEncoder"
+{
+ Properties
+ {
+ _MainTex("Texture", 2D) = "white" {}
+ }
+ SubShader
+ {
+ // No culling or depth
+ Cull Off ZWrite Off ZTest Always
+
+ Pass
+ {
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+
+ #include "UnityCG.cginc"
+
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float2 uv : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float2 uv : TEXCOORD0;
+ float4 vertex : SV_POSITION;
+ };
+
+ v2f vert(appdata v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.uv = v.uv;
+ return o;
+ }
+
+ sampler2D _MainTex;
+
+ fixed4 frag(v2f i) : SV_Target
+ {
+ half4 col = tex2D(_MainTex, i.uv);
+
+#if defined(UNITY_NO_DXT5nm)
+ // This is a trick from UnpackNormal in UnityCG.cginc !!!!
+ return col;
+#endif
+
+ half4 normal;
+ normal.x = 1.0;
+ normal.y = col.y;
+ normal.z = 1.0;
+ normal.w = col.x;
+
+ return normal;
+ }
+ ENDCG
+ }
+ }
+}
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader.meta
new file mode 100644
index 00000000..d0ef1002
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/NormalMapEncoder.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3e39586253f31b34f87fa7e133449b1e
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader
new file mode 100644
index 00000000..2cf04f96
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader
@@ -0,0 +1,56 @@
+// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
+
+Shader "UniGLTF/StandardVColor" {
+ Properties {
+ _Color ("Color", Color) = (1,1,1,1)
+ _MainTex ("Albedo (RGB)", 2D) = "white" {}
+ _Glossiness ("Smoothness", Range(0,1)) = 0.5
+ _Metallic ("Metallic", Range(0,1)) = 0.0
+ }
+ SubShader {
+ Tags { "RenderType"="Opaque" }
+ LOD 200
+
+ CGPROGRAM
+ // Physically based Standard lighting model, and enable shadows on all light types
+ #pragma surface surf Standard fullforwardshadows vertex:vert
+
+ // Use shader model 3.0 target, to get nicer looking lighting
+ #pragma target 3.0
+
+ sampler2D _MainTex;
+
+ struct Input {
+ float2 uv_MainTex;
+ float4 v_Color;
+ };
+
+ half _Glossiness;
+ half _Metallic;
+ fixed4 _Color;
+
+ // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
+ // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
+ // #pragma instancing_options assumeuniformscaling
+ UNITY_INSTANCING_BUFFER_START(Props)
+ // put more per-instance properties here
+ UNITY_INSTANCING_BUFFER_END(Props)
+
+ void vert(inout appdata_full v, out Input o){
+ UNITY_INITIALIZE_OUTPUT(Input, o);
+ o.v_Color = v.color;
+ }
+
+ void surf (Input IN, inout SurfaceOutputStandard o) {
+ // Albedo comes from a texture tinted by color
+ fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
+ o.Albedo = c.rgb * IN.v_Color.rgb;
+ // Metallic and smoothness come from slider variables
+ o.Metallic = _Metallic;
+ o.Smoothness = _Glossiness;
+ o.Alpha = c.a;
+ }
+ ENDCG
+ }
+ FallBack "Diffuse"
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader.meta
new file mode 100644
index 00000000..2efb7376
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Resources/Shaders/StandardVColor.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 5ef7bdb14a8f23043805e41692d10787
+timeCreated: 1528269709
+licenseType: Pro
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts.meta
new file mode 100644
index 00000000..18a2d6be
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: d0989add64612874d9cb36855d07677d
+folderAsset: yes
+timeCreated: 1517139165
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions.meta
new file mode 100644
index 00000000..6765ba93
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: bb1523b753d4a6444935951652053804
+folderAsset: yes
+timeCreated: 1514252348
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs
new file mode 100644
index 00000000..e28f4461
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs
@@ -0,0 +1,142 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+
+namespace UniGLTF
+{
+ public static class Pin
+ {
+ public static Pin<T> Create<T>(ArraySegment<T> src) where T : struct
+ {
+ return new Pin<T>(src);
+ }
+ public static Pin<T> Create<T>(T[] src) where T : struct
+ {
+ return Create(new ArraySegment<T>(src));
+ }
+ }
+ public class Pin<T> : IDisposable
+ where T : struct
+ {
+ GCHandle m_pinnedArray;
+
+ ArraySegment<T> m_src;
+
+ public int Length
+ {
+ get
+ {
+ return m_src.Count * Marshal.SizeOf(typeof(T));
+ }
+ }
+
+ public Pin(ArraySegment<T> src)
+ {
+ m_src = src;
+ m_pinnedArray = GCHandle.Alloc(src.Array, GCHandleType.Pinned);
+ }
+
+ public IntPtr Ptr
+ {
+ get
+ {
+ var ptr = m_pinnedArray.AddrOfPinnedObject();
+ return new IntPtr(ptr.ToInt64() + m_src.Offset);
+ }
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // 重複する呼び出しを検出するには
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ // TODO: マネージ状態を破棄します (マネージ オブジェクト)。
+ }
+
+ // TODO: アンマネージ リソース (アンマネージ オブジェクト) を解放し、下のファイナライザーをオーバーライドします。
+ // TODO: 大きなフィールドを null に設定します。
+ if (m_pinnedArray.IsAllocated)
+ {
+ m_pinnedArray.Free();
+ }
+
+ disposedValue = true;
+ }
+ }
+
+ // TODO: 上の Dispose(bool disposing) にアンマネージ リソースを解放するコードが含まれる場合にのみ、ファイナライザーをオーバーライドします。
+ // ~Pin() {
+ // // このコードを変更しないでください。クリーンアップ コードを上の Dispose(bool disposing) に記述します。
+ // Dispose(false);
+ // }
+
+ // このコードは、破棄可能なパターンを正しく実装できるように追加されました。
+ public void Dispose()
+ {
+ // このコードを変更しないでください。クリーンアップ コードを上の Dispose(bool disposing) に記述します。
+ Dispose(true);
+ // TODO: 上のファイナライザーがオーバーライドされる場合は、次の行のコメントを解除してください。
+ // GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+
+ public static class ArrayExtensions
+ {
+ public static int MarshalCopyTo<T>(this ArraySegment<byte> src, T[] dst) where T : struct
+ {
+ var size = dst.Length * Marshal.SizeOf(typeof(T));
+ using (var pin = Pin.Create(dst))
+ {
+ Marshal.Copy(src.Array, src.Offset, pin.Ptr, size);
+ }
+ return size;
+ }
+
+ public static Byte[] ToArray(this ArraySegment<byte> src)
+ {
+ var dst = new byte[src.Count];
+ Array.Copy(src.Array, src.Offset, dst, 0, src.Count);
+ return dst;
+ }
+
+ public static T[] SelectInplace<T>(this T[] src, Func<T, T> pred)
+ {
+ for (int i = 0; i < src.Length; ++i)
+ {
+ src[i] = pred(src[i]);
+ }
+ return src;
+ }
+
+ public static void Copy<TFrom, TTo>(ArraySegment<TFrom> src, ArraySegment<TTo> dst)
+ where TFrom: struct
+ where TTo : struct
+ {
+ var bytes = new byte[src.Count * Marshal.SizeOf(typeof(TFrom))];
+ using (var pin = Pin.Create(src))
+ {
+ Marshal.Copy(pin.Ptr, bytes, 0, bytes.Length);
+ };
+ using (var pin = Pin.Create(dst))
+ {
+ Marshal.Copy(bytes, 0, pin.Ptr, bytes.Length);
+ };
+ }
+ }
+
+ public static class ListExtensions
+ {
+ public static void Assign<T>(this List<T> dst, T[] src, Func<T, T> pred)
+ {
+ dst.Capacity = src.Length;
+ dst.AddRange(src.Select(pred));
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs.meta
new file mode 100644
index 00000000..5744a8da
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/ArrayExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a942ac1d32b5c604988565d1d5442237
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs
new file mode 100644
index 00000000..2163a420
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs
@@ -0,0 +1,19 @@
+using System.Linq;
+using UnityEngine;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public static class JsonParserExtensions
+ {
+ public static List<T> DeserializeList<T>(this ListTreeNode<JsonValue> jsonList)
+ {
+ return jsonList.ArrayItems().Select(x => {
+
+ return JsonUtility.FromJson<T>(new Utf8String(x.Value.Bytes).ToString());
+
+ }).ToList();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs.meta
new file mode 100644
index 00000000..6aa0b19a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/JsonParserExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: d0a724a200cc85b4887efa87292c6626
+timeCreated: 1515608626
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs
new file mode 100644
index 00000000..92dbdbb7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs
@@ -0,0 +1,76 @@
+using System.IO;
+using System.Text.RegularExpressions;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public static class StringExtensions
+ {
+ public static string ToLowerCamelCase(this string lower)
+ {
+ return lower.Substring(0, 1).ToLower() + lower.Substring(1);
+ }
+ public static string ToUpperCamelCase(this string lower)
+ {
+ return lower.Substring(0, 1).ToUpper() + lower.Substring(1);
+ }
+
+ static string m_unityBasePath;
+ public static string UnityBasePath
+ {
+ get
+ {
+ if (m_unityBasePath == null)
+ {
+ m_unityBasePath = Path.GetFullPath(Application.dataPath + "/..").Replace("\\", "/");
+ }
+ return m_unityBasePath;
+ }
+ }
+
+ public static string AssetPathToFullPath(this string path)
+ {
+ return UnityBasePath + "/" + path;
+ }
+
+ public static bool StartsWithUnityAssetPath(this string path)
+ {
+ return path.Replace("\\", "/").StartsWith(UnityBasePath + "/Assets");
+ }
+
+ public static string ToUnityRelativePath(this string path)
+ {
+ path = path.Replace("\\", "/");
+ if (path.StartsWith(UnityBasePath))
+ {
+ return path.Substring(UnityBasePath.Length + 1);
+ }
+
+ //Debug.LogWarningFormat("{0} is starts with {1}", path, basePath);
+ return path;
+ }
+
+ static readonly char[] EscapeChars = new char[]
+ {
+ '\\',
+ '/',
+ ':',
+ '*',
+ '?',
+ '"',
+ '<',
+ '>',
+ '|',
+ };
+ public static string EscapeFilePath(this string path)
+ {
+ path = Regex.Replace(path, @"[\u0000-\u001F\u007F]", "+");
+
+ foreach(var x in EscapeChars)
+ {
+ path = path.Replace(x, '+');
+ }
+ return path;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs.meta
new file mode 100644
index 00000000..6c068c8b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/StringExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 54b33d3e5f599eb419fae2bbf00f1613
+timeCreated: 1517471530
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs
new file mode 100644
index 00000000..7f020266
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs
@@ -0,0 +1,319 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public struct PosRot
+ {
+ public Vector3 Position;
+ public Quaternion Rotation;
+
+ public static PosRot FromGlobalTransform(Transform t)
+ {
+ return new PosRot
+ {
+ Position = t.position,
+ Rotation = t.rotation,
+ };
+ }
+ }
+
+ public class BlendShape
+ {
+ public string Name;
+
+ public BlendShape(string name)
+ {
+ Name = name;
+ }
+
+ public List<Vector3> Positions = new List<Vector3>();
+ public List<Vector3> Normals = new List<Vector3>();
+ public List<Vector3> Tangents = new List<Vector3>();
+ }
+
+ public static class UnityExtensions
+ {
+ public static Vector4 ReverseZ(this Vector4 v)
+ {
+ return new Vector4(v.x, v.y, -v.z, v.w);
+ }
+
+ public static Vector3 ReverseZ(this Vector3 v)
+ {
+ return new Vector3(v.x, v.y, -v.z);
+ }
+
+ [Obsolete]
+ public static Vector2 ReverseY(this Vector2 v)
+ {
+ return new Vector2(v.x, -v.y);
+ }
+
+ public static Vector2 ReverseUV(this Vector2 v)
+ {
+ return new Vector2(v.x, 1.0f - v.y);
+ }
+
+ public static Quaternion ReverseZ(this Quaternion q)
+ {
+ float angle;
+ Vector3 axis;
+ q.ToAngleAxis(out angle, out axis);
+ return Quaternion.AngleAxis(-angle, ReverseZ(axis));
+ }
+
+ public static Matrix4x4 Matrix4x4FromColumns(Vector4 c0, Vector4 c1, Vector4 c2, Vector4 c3)
+ {
+#if UNITY_2017_1_OR_NEWER
+ return new Matrix4x4(c0, c1, c2, c3);
+#else
+ var m = default(Matrix4x4);
+ m.SetColumn(0, c0);
+ m.SetColumn(1, c1);
+ m.SetColumn(2, c2);
+ m.SetColumn(3, c3);
+ return m;
+#endif
+ }
+
+ public static Matrix4x4 Matrix4x4FromRotation(Quaternion q)
+ {
+#if UNITY_2017_1_OR_NEWER
+ return Matrix4x4.Rotate(q);
+#else
+ var m = default(Matrix4x4);
+ m.SetTRS(Vector3.zero, q, Vector3.one);
+ return m;
+#endif
+ }
+
+ public static Matrix4x4 ReverseZ(this Matrix4x4 m)
+ {
+ m.SetTRS(m.ExtractPosition().ReverseZ(), m.ExtractRotation().ReverseZ(), m.ExtractScale());
+ return m;
+ }
+
+ public static Matrix4x4 MatrixFromArray(float[] values)
+ {
+ var m = new Matrix4x4();
+ m.m00 = values[0];
+ m.m10 = values[1];
+ m.m20 = values[2];
+ m.m30 = values[3];
+ m.m01 = values[4];
+ m.m11 = values[5];
+ m.m21 = values[6];
+ m.m31 = values[7];
+ m.m02 = values[8];
+ m.m12 = values[9];
+ m.m22 = values[10];
+ m.m32 = values[11];
+ m.m03 = values[12];
+ m.m13 = values[13];
+ m.m23 = values[14];
+ m.m33 = values[15];
+ return m;
+ }
+
+ // https://forum.unity.com/threads/how-to-assign-matrix4x4-to-transform.121966/
+ public static Quaternion ExtractRotation(this Matrix4x4 matrix)
+ {
+ Vector3 forward;
+ forward.x = matrix.m02;
+ forward.y = matrix.m12;
+ forward.z = matrix.m22;
+
+ Vector3 upwards;
+ upwards.x = matrix.m01;
+ upwards.y = matrix.m11;
+ upwards.z = matrix.m21;
+
+ return Quaternion.LookRotation(forward, upwards);
+ }
+
+ public static Vector3 ExtractPosition(this Matrix4x4 matrix)
+ {
+ Vector3 position;
+ position.x = matrix.m03;
+ position.y = matrix.m13;
+ position.z = matrix.m23;
+ return position;
+ }
+
+ public static Vector3 ExtractScale(this Matrix4x4 matrix)
+ {
+ Vector3 scale;
+ scale.x = new Vector4(matrix.m00, matrix.m10, matrix.m20, matrix.m30).magnitude;
+ scale.y = new Vector4(matrix.m01, matrix.m11, matrix.m21, matrix.m31).magnitude;
+ scale.z = new Vector4(matrix.m02, matrix.m12, matrix.m22, matrix.m32).magnitude;
+ return scale;
+ }
+
+ public static string RelativePathFrom(this Transform self, Transform root)
+ {
+ var path = new List<String>();
+ for (var current = self; current != null; current = current.parent)
+ {
+ if (current == root)
+ {
+ return String.Join("/", path.ToArray());
+ }
+
+ path.Insert(0, current.name);
+ }
+
+ throw new Exception("no RelativePath");
+ }
+
+ public static Transform GetChildByName(this Transform self, string childName)
+ {
+ foreach (Transform child in self)
+ {
+ if (child.name == childName)
+ {
+ return child;
+ }
+ }
+
+ throw new KeyNotFoundException();
+ }
+
+ public static Transform GetFromPath(this Transform self, string path)
+ {
+ var current = self;
+
+ var split = path.Split('/');
+
+ foreach (var childName in split)
+ {
+ current = current.GetChildByName(childName);
+ }
+
+ return current;
+ }
+
+ public static IEnumerable<Transform> GetChildren(this Transform self)
+ {
+ foreach (Transform child in self)
+ {
+ yield return child;
+ }
+ }
+
+ public static IEnumerable<Transform> Traverse(this Transform t)
+ {
+ yield return t;
+ foreach (Transform x in t)
+ {
+ foreach (Transform y in x.Traverse())
+ {
+ yield return y;
+ }
+ }
+ }
+
+ [Obsolete("Use FindDescendant(name)")]
+ public static Transform FindDescenedant(this Transform t, string name)
+ {
+ return FindDescendant(t, name);
+ }
+
+ public static Transform FindDescendant(this Transform t, string name)
+ {
+ return t.Traverse().First(x => x.name == name);
+ }
+
+ public static IEnumerable<Transform> Ancestors(this Transform t)
+ {
+ yield return t;
+ if (t.parent != null)
+ {
+ foreach (Transform x in t.parent.Ancestors())
+ {
+ yield return x;
+ }
+ }
+ }
+
+ public static float[] ToArray(this Quaternion q)
+ {
+ return new float[] { q.x, q.y, q.z, q.w };
+ }
+
+ public static float[] ToArray(this Vector3 v)
+ {
+ return new float[] { v.x, v.y, v.z };
+ }
+
+ public static float[] ToArray(this Vector4 v)
+ {
+ return new float[] { v.x, v.y, v.z, v.w };
+ }
+
+ public static float[] ToArray(this Color c)
+ {
+ return new float[] { c.r, c.g, c.b, c.a };
+ }
+
+ public static void ReverseZRecursive(this Transform root)
+ {
+ var globalMap = root.Traverse().ToDictionary(x => x, x => PosRot.FromGlobalTransform(x));
+
+ foreach (var x in root.Traverse())
+ {
+ x.position = globalMap[x].Position.ReverseZ();
+ x.rotation = globalMap[x].Rotation.ReverseZ();
+ }
+ }
+
+ public static Mesh GetSharedMesh(this Transform t)
+ {
+ var meshFilter = t.GetComponent<MeshFilter>();
+ if (meshFilter != null)
+ {
+ return meshFilter.sharedMesh;
+ }
+
+ var skinnedMeshRenderer = t.GetComponent<SkinnedMeshRenderer>();
+ if (skinnedMeshRenderer != null)
+ {
+ return skinnedMeshRenderer.sharedMesh;
+ }
+
+ return null;
+ }
+
+ public static Material[] GetSharedMaterials(this Transform t)
+ {
+ var renderer = t.GetComponent<Renderer>();
+ if (renderer != null)
+ {
+ return renderer.sharedMaterials;
+ }
+
+ return new Material[] { };
+ }
+
+ public static bool Has<T>(this Transform transform, T t) where T : Component
+ {
+ return transform.GetComponent<T>() == t;
+ }
+
+ public static T GetOrAddComponent<T>(this GameObject go) where T : Component
+ {
+ var c = go.GetComponent<T>();
+ if (c != null)
+ {
+ return c;
+ }
+ return go.AddComponent<T>();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs.meta
new file mode 100644
index 00000000..0421f424
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/UnityExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bbcda9130f35803408b216dbc6be05b7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs
new file mode 100644
index 00000000..ffe895ac
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs
@@ -0,0 +1,203 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)]
+ struct UShort4
+ {
+ public ushort x;
+ public ushort y;
+ public ushort z;
+ public ushort w;
+
+ public UShort4(ushort _x, ushort _y, ushort _z, ushort _w)
+ {
+ x = _x;
+ y = _y;
+ z = _z;
+ w = _w;
+ }
+ }
+
+ public static class glTFExtensions
+ {
+ struct ComponentVec
+ {
+ public glComponentType ComponentType;
+ public int ElementCount;
+
+ public ComponentVec(glComponentType componentType, int elementCount)
+ {
+ ComponentType = componentType;
+ ElementCount = elementCount;
+ }
+ }
+
+ static Dictionary<Type, ComponentVec> ComponentTypeMap = new Dictionary<Type, ComponentVec>
+ {
+ { typeof(Vector2), new ComponentVec(glComponentType.FLOAT, 2) },
+ { typeof(Vector3), new ComponentVec(glComponentType.FLOAT, 3) },
+ { typeof(Vector4), new ComponentVec(glComponentType.FLOAT, 4) },
+ { typeof(UShort4), new ComponentVec(glComponentType.UNSIGNED_SHORT, 4) },
+ { typeof(Matrix4x4), new ComponentVec(glComponentType.FLOAT, 16) },
+ { typeof(Color), new ComponentVec(glComponentType.FLOAT, 4) },
+ };
+
+ static glComponentType GetComponentType<T>()
+ {
+ var cv = default(ComponentVec);
+ if (ComponentTypeMap.TryGetValue(typeof(T), out cv))
+ {
+ return cv.ComponentType;
+ }
+ else if (typeof(T) == typeof(uint))
+ {
+ return glComponentType.UNSIGNED_INT;
+ }
+ else if (typeof(T) == typeof(float))
+ {
+ return glComponentType.FLOAT;
+ }
+ else
+ {
+ throw new NotImplementedException(typeof(T).Name);
+ }
+ }
+
+ static string GetAccessorType<T>()
+ {
+ var cv = default(ComponentVec);
+ if (ComponentTypeMap.TryGetValue(typeof(T), out cv))
+ {
+ switch (cv.ElementCount)
+ {
+ case 2: return "VEC2";
+ case 3: return "VEC3";
+ case 4: return "VEC4";
+ case 16: return "MAT4";
+ default: throw new Exception();
+ }
+ }
+ else
+ {
+ return "SCALAR";
+ }
+ }
+
+ static int GetAccessorElementCount<T>()
+ {
+ var cv = default(ComponentVec);
+ if (ComponentTypeMap.TryGetValue(typeof(T), out cv))
+ {
+ return cv.ElementCount;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ public static int ExtendBufferAndGetAccessorIndex<T>(this glTF gltf, int bufferIndex, T[] array,
+ glBufferTarget target = glBufferTarget.NONE) where T : struct
+ {
+ return gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, new ArraySegment<T>(array), target);
+ }
+
+ public static int ExtendBufferAndGetAccessorIndex<T>(this glTF gltf, int bufferIndex,
+ ArraySegment<T> array,
+ glBufferTarget target = glBufferTarget.NONE) where T : struct
+ {
+ if (array.Count == 0)
+ {
+ return -1;
+ }
+ var viewIndex = ExtendBufferAndGetViewIndex(gltf, bufferIndex, array, target);
+
+ // index buffer's byteStride is unnecessary
+ gltf.bufferViews[viewIndex].byteStride = 0;
+
+ var accessorIndex = gltf.accessors.Count;
+ gltf.accessors.Add(new glTFAccessor
+ {
+ bufferView = viewIndex,
+ byteOffset = 0,
+ componentType = GetComponentType<T>(),
+ type = GetAccessorType<T>(),
+ count = array.Count,
+ });
+ return accessorIndex;
+ }
+
+ public static int ExtendBufferAndGetViewIndex<T>(this glTF gltf, int bufferIndex,
+ T[] array,
+ glBufferTarget target = glBufferTarget.NONE) where T : struct
+ {
+ return ExtendBufferAndGetViewIndex(gltf, bufferIndex, new ArraySegment<T>(array), target);
+ }
+
+ public static int ExtendBufferAndGetViewIndex<T>(this glTF gltf, int bufferIndex,
+ ArraySegment<T> array,
+ glBufferTarget target = glBufferTarget.NONE) where T : struct
+ {
+ if (array.Count == 0)
+ {
+ return -1;
+ }
+ var view = gltf.buffers[bufferIndex].Append(array, target);
+ var viewIndex = gltf.bufferViews.Count;
+ gltf.bufferViews.Add(view);
+ return viewIndex;
+ }
+
+ public static int ExtendSparseBufferAndGetAccessorIndex<T>(this glTF gltf, int bufferIndex,
+ int accessorCount,
+ T[] sparseValues, int[] sparseIndices, int sparseViewIndex,
+ glBufferTarget target = glBufferTarget.NONE) where T : struct
+ {
+ return ExtendSparseBufferAndGetAccessorIndex(gltf, bufferIndex,
+ accessorCount,
+ new ArraySegment<T>(sparseValues), sparseIndices, sparseViewIndex,
+ target);
+ }
+
+ public static int ExtendSparseBufferAndGetAccessorIndex<T>(this glTF gltf, int bufferIndex,
+ int accessorCount,
+ ArraySegment<T> sparseValues, int[] sparseIndices, int sparseIndicesViewIndex,
+ glBufferTarget target = glBufferTarget.NONE) where T : struct
+ {
+ if (sparseValues.Count == 0)
+ {
+ return -1;
+ }
+ var sparseValuesViewIndex = ExtendBufferAndGetViewIndex(gltf, bufferIndex, sparseValues, target);
+ var accessorIndex = gltf.accessors.Count;
+ gltf.accessors.Add(new glTFAccessor
+ {
+ byteOffset = 0,
+ componentType = GetComponentType<T>(),
+ type = GetAccessorType<T>(),
+ count = accessorCount,
+
+ sparse = new glTFSparse
+ {
+ count=sparseIndices.Length,
+ indices = new glTFSparseIndices
+ {
+ bufferView = sparseIndicesViewIndex,
+ componentType = glComponentType.UNSIGNED_INT
+ },
+ values = new glTFSparseValues
+ {
+ bufferView = sparseValuesViewIndex,
+ }
+ }
+ });
+ return accessorIndex;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs.meta
new file mode 100644
index 00000000..33e94364
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Extensions/glTFExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 870cb47398900534994d90eb1cecace8
+timeCreated: 1517038417
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format.meta
new file mode 100644
index 00000000..31f52eef
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 91b71b4caaefeae4fa5ca31908b35a86
+folderAsset: yes
+timeCreated: 1516616861
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs
new file mode 100644
index 00000000..11c805fe
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs
@@ -0,0 +1,193 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+
+namespace UniGLTF
+{
+ public interface IBytesBuffer
+ {
+ string Uri { get; }
+ ArraySegment<Byte> GetBytes();
+ glTFBufferView Extend<T>(ArraySegment<T> array, glBufferTarget target) where T : struct;
+ }
+
+ public static class IBytesBufferExtensions
+ {
+ public static glTFBufferView Extend<T>(this IBytesBuffer buffer, T[] array, glBufferTarget target) where T : struct
+ {
+ return buffer.Extend(new ArraySegment<T>(array), target);
+ }
+ }
+
+ /// <summary>
+ /// for buffer with uri read
+ /// </summary>
+ public class UriByteBuffer : IBytesBuffer
+ {
+ public string Uri
+ {
+ get;
+ private set;
+ }
+
+ Byte[] m_bytes;
+ public ArraySegment<byte> GetBytes()
+ {
+ return new ArraySegment<byte>(m_bytes);
+ }
+
+ public UriByteBuffer(string baseDir, string uri)
+ {
+ Uri = uri;
+ m_bytes = ReadFromUri(baseDir, uri);
+ }
+
+ const string DataPrefix = "data:application/octet-stream;base64,";
+
+ const string DataPrefix2 = "data:application/gltf-buffer;base64,";
+
+ const string DataPrefix3 = "data:image/jpeg;base64,";
+
+ [Obsolete("Use ReadEmbedded(uri)")]
+ public static Byte[] ReadEmbeded(string uri)
+ {
+ return ReadEmbedded(uri);
+ }
+
+ public static Byte[] ReadEmbedded(string uri)
+ {
+ var pos = uri.IndexOf(";base64,");
+ if (pos < 0)
+ {
+ throw new NotImplementedException();
+ }
+ else
+ {
+ return Convert.FromBase64String(uri.Substring(pos + 8));
+ }
+ }
+
+ Byte[] ReadFromUri(string baseDir, string uri)
+ {
+ var bytes = ReadEmbedded(uri);
+ if (bytes != null)
+ {
+ return bytes;
+ }
+ else
+ {
+ // as local file path
+ return File.ReadAllBytes(Path.Combine(baseDir, uri));
+ }
+ }
+
+ public glTFBufferView Extend<T>(ArraySegment<T> array, glBufferTarget target) where T : struct
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// for glb chunk buffer read
+ /// </summary>
+ public class ArraySegmentByteBuffer : IBytesBuffer
+ {
+ ArraySegment<Byte> m_bytes;
+
+ public ArraySegmentByteBuffer(ArraySegment<Byte> bytes)
+ {
+ m_bytes = bytes;
+ }
+
+ public string Uri
+ {
+ get;
+ private set;
+ }
+
+ public glTFBufferView Extend<T>(ArraySegment<T> array, glBufferTarget target) where T : struct
+ {
+ throw new NotImplementedException();
+ }
+
+ public ArraySegment<byte> GetBytes()
+ {
+ return m_bytes;
+ }
+ }
+
+ /// <summary>
+ /// for exporter
+ /// </summary>
+ public class ArrayByteBuffer : IBytesBuffer
+ {
+ public string Uri
+ {
+ get;
+ private set;
+ }
+
+ Byte[] m_bytes;
+ int m_used;
+
+ public ArrayByteBuffer(Byte[] bytes = null)
+ {
+ Uri = "";
+ m_bytes = bytes;
+ }
+
+ public glTFBufferView Extend<T>(ArraySegment<T> array, glBufferTarget target) where T : struct
+ {
+ using (var pin = Pin.Create(array))
+ {
+ var elementSize = Marshal.SizeOf(typeof(T));
+ var view = Extend(pin.Ptr, array.Count * elementSize, elementSize, target);
+ return view;
+ }
+ }
+
+ public glTFBufferView Extend(IntPtr p, int bytesLength, int stride, glBufferTarget target)
+ {
+ var tmp = m_bytes;
+ // alignment
+ var padding = m_used % stride == 0 ? 0 : stride - m_used % stride;
+
+ if (m_bytes == null || m_used + padding + bytesLength > m_bytes.Length)
+ {
+ // recreate buffer
+ m_bytes = new Byte[m_used + padding + bytesLength];
+ if (m_used > 0)
+ {
+ Buffer.BlockCopy(tmp, 0, m_bytes, 0, m_used);
+ }
+ }
+ if (m_used + padding + bytesLength > m_bytes.Length)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ Marshal.Copy(p, m_bytes, m_used + padding, bytesLength);
+ var result=new glTFBufferView
+ {
+ buffer = 0,
+ byteLength = bytesLength,
+ byteOffset = m_used + padding,
+ byteStride = stride,
+ target = target,
+ };
+ m_used = m_used + padding + bytesLength;
+ return result;
+ }
+
+ public ArraySegment<byte> GetBytes()
+ {
+ if (m_bytes == null)
+ {
+ return new ArraySegment<byte>();
+ }
+
+ return new ArraySegment<byte>(m_bytes, 0, m_used);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs.meta
new file mode 100644
index 00000000..ca305060
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/BytesBuffer.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 33b0000c5446b7547bcad1da1e9768ed
+timeCreated: 1516730619
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras.meta
new file mode 100644
index 00000000..44b87167
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ba47ab6d00c723348b9ac86141cb7bfd
+folderAsset: yes
+timeCreated: 1533605176
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs
new file mode 100644
index 00000000..1e4b9ae4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs
@@ -0,0 +1,16 @@
+using System;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ [Serializable]
+ public partial class glTFPrimitives_extensions : ExtensionsBase<glTFPrimitives_extensions>
+ {
+ [JsonSerializeMembers]
+ void SerializeMembers_draco(GLTFJsonFormatter f)
+ {
+ //throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs.meta
new file mode 100644
index 00000000..3cdd0a83
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_draco_mesh_compression.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2d21c7591557c7744a6fa34a7acace91
+timeCreated: 1533605595
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs
new file mode 100644
index 00000000..72e28518
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs
@@ -0,0 +1,55 @@
+using System;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTF_KHR_materials_unlit : JsonSerializableBase
+ {
+ public static string ExtensionName
+ {
+ get
+ {
+ return "KHR_materials_unlit";
+ }
+ }
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ //throw new System.NotImplementedException();
+ }
+
+ public static glTFMaterial CreateDefault()
+ {
+ return new glTFMaterial
+ {
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1.0f, 1.0f, 1.0f, 1.0f },
+ roughnessFactor = 0.9f,
+ metallicFactor = 0.0f,
+ },
+ extensions = new glTFMaterial_extensions
+ {
+ KHR_materials_unlit = new glTF_KHR_materials_unlit(),
+ },
+ };
+ }
+ }
+
+ [Serializable]
+ public partial class glTFMaterial_extensions : ExtensionsBase<glTFMaterial_extensions>
+ {
+ [JsonSchema(Required = true)]
+ public glTF_KHR_materials_unlit KHR_materials_unlit;
+
+ [JsonSerializeMembers]
+ void SerializeMembers_unlit(GLTFJsonFormatter f)
+ {
+ if (KHR_materials_unlit != null)
+ {
+ f.Key("KHR_materials_unlit"); f.GLTFValue(KHR_materials_unlit);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs.meta
new file mode 100644
index 00000000..9fb27761
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_materials_unlit.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2c95b5ebe597e924fa2e7fcce3a65f76
+timeCreated: 1533606191
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs
new file mode 100644
index 00000000..8c503436
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTF_KHR_texture_transform : JsonSerializableBase
+ {
+ public static string ExtensionName
+ {
+ get
+ {
+ return "KHR_texture_transform";
+ }
+ }
+
+ [JsonSchema(MinItems = 2, MaxItems = 2)]
+ public float[] offset = new float[2] { 0.0f, 0.0f };
+
+ public float rotation;
+
+ [JsonSchema(MinItems = 2, MaxItems = 2)]
+ public float[] scale = new float[2] { 1.0f, 1.0f };
+
+ [ItemJsonSchema(Minimum = 0)]
+ public int texCoord;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => offset);
+ f.KeyValue(() => rotation);
+ f.KeyValue(() => scale);
+ f.KeyValue(() => texCoord);
+ }
+ }
+
+ [Serializable]
+ public class glTFTextureInfo_extensions : ExtensionsBase<glTFTextureInfo_extensions>
+ {
+ [JsonSchema(Required = true)]
+ public glTF_KHR_texture_transform KHR_texture_transform;
+
+ /// <summary>
+ /// リフレクションでシリアライズする時は使われない
+ /// </summary>
+ /// <param name="f"></param>
+ [JsonSerializeMembers]
+ void SerializeMembers_textureInfo(GLTFJsonFormatter f)
+ {
+ if (KHR_texture_transform != null)
+ {
+ f.KeyValue(() => KHR_texture_transform);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs.meta
new file mode 100644
index 00000000..692d123b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/KHR_texture_transform.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 04b631e1572e84d47b88aebc3631865b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs
new file mode 100644
index 00000000..f7bae366
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs
@@ -0,0 +1,27 @@
+using System;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ [Serializable]
+ [ItemJsonSchema(ValueType = ValueNodeType.Object)]
+ public partial class glTFOrthographic_extensions : ExtensionsBase<glTFOrthographic_extensions> { }
+
+ [Serializable]
+ public partial class glTFOrthographic_extras : ExtraBase<glTFOrthographic_extras> { }
+
+ [Serializable]
+ [ItemJsonSchema(ValueType = ValueNodeType.Object)]
+ public partial class glTFPerspective_extensions : ExtensionsBase<glTFPerspective_extensions> { }
+
+ [Serializable]
+ public partial class glTFPerspective_extras : ExtraBase<glTFPerspective_extras> { }
+
+ [Serializable]
+ [ItemJsonSchema(ValueType = ValueNodeType.Object)]
+ public partial class glTFCamera_extensions : ExtensionsBase<glTFCamera_extensions> { }
+
+ [Serializable]
+ public partial class glTFCamera_extras : ExtraBase<glTFCamera_extras> { }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs.meta
new file mode 100644
index 00000000..3f5c26d3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFCameraExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 38f59c64e05855b41be64595c570e366
+timeCreated: 1533605499
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs
new file mode 100644
index 00000000..20b649bc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Linq;
+using System.Reflection;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ #region Base
+ public class JsonSerializeMembersAttribute : Attribute { }
+
+ public class PartialExtensionBase<T> : JsonSerializableBase
+ {
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ foreach (var method in this.GetType().GetMethods(BindingFlags.Instance |
+ BindingFlags.Public | BindingFlags.NonPublic))
+ {
+ if (method.GetCustomAttributes(typeof(JsonSerializeMembersAttribute), true).Any())
+ {
+ method.Invoke(this, new[] { f });
+ }
+ }
+ }
+
+ public int __count
+ {
+ get
+ {
+ return typeof(T).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
+ .Where(x => x.GetCustomAttributes(typeof(JsonSerializeMembersAttribute), true).Any())
+ .Count();
+ }
+ }
+ }
+
+ [ItemJsonSchema(ValueType = ValueNodeType.Object)]
+ //[JsonSchema(MinProperties = 1)]
+ public partial class ExtensionsBase<T> : PartialExtensionBase<T>
+ {
+ }
+
+ //[JsonSchema(MinProperties = 1)]
+ public partial class ExtraBase<T> : PartialExtensionBase<T>
+ {
+ }
+ #endregion
+
+ [Serializable]
+ public partial class glTF_extensions : ExtensionsBase<glTF_extensions> { }
+
+ [Serializable]
+ public partial class gltf_extras : ExtraBase<gltf_extras> { }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs.meta
new file mode 100644
index 00000000..f1fd71ee
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 356f989283db8c848b851b82c34086d1
+timeCreated: 1532101527
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs
new file mode 100644
index 00000000..bbfc1896
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ /// <summary>
+ /// https://github.com/KhronosGroup/glTF/issues/1036
+ /// </summary>
+ [Serializable]
+ public partial class glTFPrimitives_extras : ExtraBase<glTFPrimitives_extras>
+ {
+ [JsonSchema(Required = true, MinItems = 1)]
+ public List<string> targetNames = new List<string>();
+
+ [JsonSerializeMembers]
+ void PrimitiveMembers(GLTFJsonFormatter f)
+ {
+ if (targetNames.Count > 0)
+ {
+ f.Key("targetNames");
+ f.BeginList();
+ foreach (var x in targetNames)
+ {
+ f.Value(x);
+ }
+ f.EndList();
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs.meta
new file mode 100644
index 00000000..10ec6ee5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.Primitives.extras.targetNames.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e95762d0b18d11243b32a56f21cef862
+timeCreated: 1533605545
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs
new file mode 100644
index 00000000..49e12de5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ /// <summary>
+ /// https://github.com/KhronosGroup/glTF/issues/1036
+ /// </summary>
+ [Serializable]
+ public partial class glTFMesh_extras : ExtraBase<glTFMesh_extras>
+ {
+ [JsonSchema(Required = true, MinItems = 1)]
+ public List<string> targetNames = new List<string>();
+
+ [JsonSerializeMembers]
+ void PrimitiveMembers(GLTFJsonFormatter f)
+ {
+ if (targetNames.Count > 0)
+ {
+ f.Key("targetNames");
+ f.BeginList();
+ foreach (var x in targetNames)
+ {
+ f.Value(x);
+ }
+ f.EndList();
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs.meta
new file mode 100644
index 00000000..139962cd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFMesh.extras.targetNames.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 97b77d4c1c0d44b594e9187e41b3152d
+timeCreated: 1582269878 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs
new file mode 100644
index 00000000..0c0b9825
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs
@@ -0,0 +1,11 @@
+using System;
+
+
+namespace UniGLTF
+{
+ [Serializable]
+ public partial class glTFNode_extensions : ExtensionsBase<glTFNode_extensions> { }
+
+ [Serializable]
+ public partial class glTFNode_extra : ExtraBase<glTFNode_extra> { }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs.meta
new file mode 100644
index 00000000..d68a4cd3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/ExtensionsAndExtras/glTFNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: eef0405c0c9670947ab6fa2034f0343f
+timeCreated: 1533605847
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs
new file mode 100644
index 00000000..7a6b1b06
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs
@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ public class GLTFJsonFormatter: UniJSON.JsonFormatter
+ {
+ public void GLTFValue(JsonSerializableBase s)
+ {
+ CommaCheck();
+ Store.Write(s.ToJson());
+ }
+
+ public void GLTFValue<T>(IEnumerable<T> values) where T : JsonSerializableBase
+ {
+ BeginList();
+ foreach (var value in values)
+ {
+ GLTFValue(value);
+ }
+ EndList();
+ }
+
+ public void GLTFValue(List<string> values)
+ {
+ BeginList();
+ foreach (var value in values)
+ {
+ this.Value(value);
+ }
+ EndList();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs.meta
new file mode 100644
index 00000000..eb52e7f5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/GLTFJsonFormatter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b80a7ee38e762de44a90d60d9d4ff4dd
+timeCreated: 1531806259
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs
new file mode 100644
index 00000000..3d302b1d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs
@@ -0,0 +1,22 @@
+using System;
+
+
+namespace UniGLTF
+{
+ [Serializable]
+ public abstract class JsonSerializableBase
+ {
+ protected abstract void SerializeMembers(GLTFJsonFormatter f);
+
+ public string ToJson()
+ {
+ var f = new GLTFJsonFormatter();
+ f.BeginMap();
+
+ SerializeMembers(f);
+
+ f.EndMap();
+ return f.ToString();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs.meta
new file mode 100644
index 00000000..a2142813
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/JsonSerializableBase.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d169186adbfc59b4b882611d37f0a282
+timeCreated: 1532078625
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs
new file mode 100644
index 00000000..ad50a70b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs
@@ -0,0 +1,68 @@
+using System;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public static class MonoBehaviourComparator
+ {
+ public static bool AssertAreEquals(GameObject l, GameObject r)
+ {
+ return
+ l.name == r.name
+ && AssertAreEquals<Transform>(l, r,
+ (x, y) => AssertAreEquals(x[0], y[0]))
+ && AssertAreEquals<MeshFilter>(l, r,
+ (x, y) => AssertAreEquals(x[0], y[0]))
+ && AssertAreEquals<MeshRenderer>(l, r,
+ (x, y) => AssertAreEquals(x[0], y[0]))
+ && AssertAreEquals<SkinnedMeshRenderer>(l, r,
+ (x, y) => AssertAreEquals(x[0], y[0]))
+ ;
+ }
+
+ public static bool AssertAreEquals<T>(GameObject l, GameObject r, Func<T[], T[], bool> pred) where T : Component
+ {
+ var ll = l.GetComponents<T>();
+ var rr = r.GetComponents<T>();
+ if (ll.Length != rr.Length)
+ {
+ return false;
+ }
+ if (ll.Length == 0)
+ {
+ return true;
+ }
+ return pred(ll, rr);
+ }
+
+ public static bool AssertAreEquals(Transform l, Transform r)
+ {
+ return
+ (l.localPosition == r.localPosition)
+ && (l.localRotation == r.localRotation)
+ && (l.localScale == r.localScale)
+ ;
+ }
+
+ public static bool AssertAreEquals(MeshFilter l, MeshFilter r)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static bool AssertAreEquals(MeshRenderer l, MeshRenderer r)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static bool AssertAreEquals(SkinnedMeshRenderer l, SkinnedMeshRenderer r)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static bool AssetAreEquals(Texture2D l, Texture2D r)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs.meta
new file mode 100644
index 00000000..61542297
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/MonoBehaviourComparator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7cee53236ca4f234ab42ba8e92afd178
+timeCreated: 1521104277
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs
new file mode 100644
index 00000000..fcdee080
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs
@@ -0,0 +1,9 @@
+namespace UniGLTF
+{
+ public enum SerializerTypes
+ {
+ Generated, // generated, No AOT Problem
+ JsonSerializable, // manual, Obsolete
+ UniJSON, // reflection, Obsolete
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs.meta
new file mode 100644
index 00000000..6ff72b75
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/SerializerTypes.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2b17414c7f3ba564083dbcebda778633
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs
new file mode 100644
index 00000000..1915c1d9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs
@@ -0,0 +1,48 @@
+/// <summary>
+/// https://gist.github.com/szimek/763999
+/// </summary>
+namespace UniGLTF
+{
+ public enum glComponentType : int
+ {
+ BYTE = 5120, // signed ?
+ UNSIGNED_BYTE = 5121,
+
+ SHORT = 5122,
+ UNSIGNED_SHORT = 5123,
+
+ //INT = 5124,
+ UNSIGNED_INT = 5125,
+
+ FLOAT = 5126,
+ }
+
+ public enum glBufferTarget : int
+ {
+ NONE = 0,
+ ARRAY_BUFFER = 34962,
+ ELEMENT_ARRAY_BUFFER = 34963,
+ }
+
+ public enum glFilter : int
+ {
+ NONE = 0,
+ NEAREST = 9728,
+ LINEAR = 9729,
+
+ #region for minFilter only
+ NEAREST_MIPMAP_NEAREST = 9984,
+ LINEAR_MIPMAP_NEAREST = 9985,
+ NEAREST_MIPMAP_LINEAR = 9986,
+ LINEAR_MIPMAP_LINEAR = 9987,
+ #endregion
+ }
+
+ public enum glWrap : int
+ {
+ NONE = 0,
+ CLAMP_TO_EDGE = 33071,
+ REPEAT = 10497,
+ MIRRORED_REPEAT = 33648,
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs.meta
new file mode 100644
index 00000000..d1091134
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glEnum.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 378358a997cd2e9418f180593fb04a6f
+timeCreated: 1516212452
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs
new file mode 100644
index 00000000..b9be6d1b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs
@@ -0,0 +1,504 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UniJSON;
+
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class gltfScene : JsonSerializableBase
+ {
+ [JsonSchema(MinItems = 1)]
+ [ItemJsonSchema(Minimum = 0)]
+ public int[] nodes;
+
+ public object extensions;
+ public object extras;
+ public string name;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => nodes);
+ }
+ }
+
+ [Serializable]
+ public class glTF : JsonSerializableBase, IEquatable<glTF>
+ {
+ [JsonSchema(Required = true)]
+ public glTFAssets asset = new glTFAssets();
+
+ #region Buffer
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFBuffer> buffers = new List<glTFBuffer>();
+ public int AddBuffer(IBytesBuffer bytesBuffer)
+ {
+ var index = buffers.Count;
+ buffers.Add(new glTFBuffer(bytesBuffer));
+ return index;
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFBufferView> bufferViews = new List<glTFBufferView>();
+ public int AddBufferView(glTFBufferView view)
+ {
+ var index = bufferViews.Count;
+ bufferViews.Add(view);
+ return index;
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFAccessor> accessors = new List<glTFAccessor>();
+
+ T[] GetAttrib<T>(glTFAccessor accessor, glTFBufferView view) where T : struct
+ {
+ return GetAttrib<T>(accessor.count, accessor.byteOffset, view);
+ }
+ T[] GetAttrib<T>(int count, int byteOffset, glTFBufferView view) where T : struct
+ {
+ var attrib = new T[count];
+ var segment = buffers[view.buffer].GetBytes();
+ var bytes = new ArraySegment<Byte>(segment.Array, segment.Offset + view.byteOffset + byteOffset, count * view.byteStride);
+ bytes.MarshalCopyTo(attrib);
+ return attrib;
+ }
+
+ public ArraySegment<Byte> GetViewBytes(int bufferView)
+ {
+ var view = bufferViews[bufferView];
+ var segment = buffers[view.buffer].GetBytes();
+ return new ArraySegment<byte>(segment.Array, segment.Offset + view.byteOffset, view.byteLength);
+ }
+
+ IEnumerable<int> _GetIndices(glTFAccessor accessor, out int count)
+ {
+ count = accessor.count;
+ var view = bufferViews[accessor.bufferView];
+ switch ((glComponentType)accessor.componentType)
+ {
+ case glComponentType.UNSIGNED_BYTE:
+ {
+ return GetAttrib<Byte>(accessor, view).Select(x => (int)(x));
+ }
+
+ case glComponentType.UNSIGNED_SHORT:
+ {
+ return GetAttrib<UInt16>(accessor, view).Select(x => (int)(x));
+ }
+
+ case glComponentType.UNSIGNED_INT:
+ {
+ return GetAttrib<UInt32>(accessor, view).Select(x => (int)(x));
+ }
+ }
+ throw new NotImplementedException("GetIndices: unknown componenttype: " + accessor.componentType);
+ }
+
+ IEnumerable<int> _GetIndices(glTFBufferView view, int count, int byteOffset, glComponentType componentType)
+ {
+ switch (componentType)
+ {
+ case glComponentType.UNSIGNED_BYTE:
+ {
+ return GetAttrib<Byte>(count, byteOffset, view).Select(x => (int)(x));
+ }
+
+ case glComponentType.UNSIGNED_SHORT:
+ {
+ return GetAttrib<UInt16>(count, byteOffset, view).Select(x => (int)(x));
+ }
+
+ case glComponentType.UNSIGNED_INT:
+ {
+ return GetAttrib<UInt32>(count, byteOffset, view).Select(x => (int)(x));
+ }
+ }
+ throw new NotImplementedException("GetIndices: unknown componenttype: " + componentType);
+ }
+
+ public int[] GetIndices(int accessorIndex)
+ {
+ int count;
+ var result = _GetIndices(accessors[accessorIndex], out count);
+ var indices = new int[count];
+
+ // flip triangles
+ var it = result.GetEnumerator();
+ {
+ for (int i = 0; i < count; i += 3)
+ {
+ it.MoveNext(); indices[i + 2] = it.Current;
+ it.MoveNext(); indices[i + 1] = it.Current;
+ it.MoveNext(); indices[i] = it.Current;
+ }
+ }
+
+ return indices;
+ }
+
+ public T[] GetArrayFromAccessor<T>(int accessorIndex) where T : struct
+ {
+ var vertexAccessor = accessors[accessorIndex];
+
+ if (vertexAccessor.count <= 0) return new T[] { };
+
+ var result = (vertexAccessor.bufferView != -1)
+ ? GetAttrib<T>(vertexAccessor, bufferViews[vertexAccessor.bufferView])
+ : new T[vertexAccessor.count]
+ ;
+
+ var sparse = vertexAccessor.sparse;
+ if (sparse != null && sparse.count > 0)
+ {
+ // override sparse values
+ var indices = _GetIndices(bufferViews[sparse.indices.bufferView], sparse.count, sparse.indices.byteOffset, sparse.indices.componentType);
+ var values = GetAttrib<T>(sparse.count, sparse.values.byteOffset, bufferViews[sparse.values.bufferView]);
+
+ var it = indices.GetEnumerator();
+ for (int i = 0; i < sparse.count; ++i)
+ {
+ it.MoveNext();
+ result[it.Current] = values[i];
+ }
+ }
+ return result;
+ }
+ #endregion
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFTexture> textures = new List<glTFTexture>();
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFTextureSampler> samplers = new List<glTFTextureSampler>();
+ public glTFTextureSampler GetSampler(int index)
+ {
+ if (samplers.Count == 0)
+ {
+ samplers.Add(new glTFTextureSampler()); // default sampler
+ }
+
+ return samplers[index];
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFImage> images = new List<glTFImage>();
+
+ public int GetImageIndexFromTextureIndex(int textureIndex)
+ {
+ return textures[textureIndex].source;
+ }
+
+ public glTFImage GetImageFromTextureIndex(int textureIndex)
+ {
+ return images[GetImageIndexFromTextureIndex(textureIndex)];
+ }
+
+ public glTFTextureSampler GetSamplerFromTextureIndex(int textureIndex)
+ {
+ var samplerIndex = textures[textureIndex].sampler;
+ return GetSampler(samplerIndex);
+ }
+
+ public ArraySegment<Byte> GetImageBytes(IStorage storage, int imageIndex, out string textureName)
+ {
+ var image = images[imageIndex];
+ if (string.IsNullOrEmpty(image.uri))
+ {
+ //
+ // use buffer view (GLB)
+ //
+ //m_imageBytes = ToArray(byteSegment);
+ textureName = !string.IsNullOrEmpty(image.name) ? image.name : string.Format("{0:00}#GLB", imageIndex);
+ return GetViewBytes(image.bufferView);
+ }
+ else
+ {
+ if (image.uri.StartsWith("data:"))
+ {
+ textureName = !string.IsNullOrEmpty(image.name) ? image.name : string.Format("{0:00}#Base64Embedded", imageIndex);
+ }
+ else
+ {
+ textureName = !string.IsNullOrEmpty(image.name) ? image.name : Path.GetFileNameWithoutExtension(image.uri);
+ }
+ return storage.Get(image.uri);
+ }
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFMaterial> materials = new List<glTFMaterial>();
+ public string GetUniqueMaterialName(int index)
+ {
+ if (materials.Any(x => string.IsNullOrEmpty(x.name))
+ || materials.Select(x => x.name).Distinct().Count() != materials.Count)
+ {
+ return String.Format("{0:00}_{1}", index, materials[index].name);
+ }
+ else
+ {
+ return materials[index].name;
+ }
+ }
+
+ public bool MaterialHasVertexColor(glTFMaterial material)
+ {
+ if (material == null)
+ {
+ return false;
+ }
+
+ var materialIndex = materials.IndexOf(material);
+ if (materialIndex == -1)
+ {
+ return false;
+ }
+
+ return MaterialHasVertexColor(materialIndex);
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFMesh> meshes = new List<glTFMesh>();
+
+ public bool MaterialHasVertexColor(int materialIndex)
+ {
+ if (materialIndex < 0 || materialIndex >= materials.Count)
+ {
+ return false;
+ }
+
+ var hasVertexColor = meshes.SelectMany(x => x.primitives).Any(x => x.material == materialIndex && x.HasVertexColor);
+ return hasVertexColor;
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFNode> nodes = new List<glTFNode>();
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFSkin> skins = new List<glTFSkin>();
+
+ [JsonSchema(Dependencies = new string[] { "scenes" }, Minimum = 0)]
+ public int scene;
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<gltfScene> scenes = new List<gltfScene>();
+ public int[] rootnodes
+ {
+ get
+ {
+ return scenes[scene].nodes;
+ }
+ }
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFAnimation> animations = new List<glTFAnimation>();
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<glTFCamera> cameras = new List<glTFCamera>();
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<string> extensionsUsed = new List<string>();
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ public List<string> extensionsRequired = new List<string>();
+
+ public glTF_extensions extensions = new glTF_extensions();
+ public gltf_extras extras = new gltf_extras();
+
+ public override string ToString()
+ {
+ return string.Format("{0}", asset);
+ }
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (extensionsUsed.Count > 0)
+ {
+ f.Key("extensionsUsed"); f.GLTFValue(extensionsUsed);
+ }
+ if (extensions.__count > 0)
+ {
+ f.Key("extensions"); f.GLTFValue(extensions);
+ }
+ if (extras.__count > 0)
+ {
+ f.Key("extras"); f.GLTFValue(extras);
+ }
+
+ f.Key("asset"); f.GLTFValue(asset);
+
+ // buffer
+ if (buffers.Any())
+ {
+ f.Key("buffers"); f.GLTFValue(buffers);
+ }
+ if (bufferViews.Any())
+ {
+ f.Key("bufferViews"); f.GLTFValue(bufferViews);
+ }
+ if (accessors.Any())
+ {
+ f.Key("accessors"); f.GLTFValue(accessors);
+ }
+
+ // materials
+ if (images.Any())
+ {
+ f.Key("images"); f.GLTFValue(images);
+ if (samplers.Count == 0)
+ {
+ samplers.Add(new glTFTextureSampler());
+ }
+ }
+
+ if (samplers.Any())
+ {
+ f.Key("samplers"); f.GLTFValue(samplers);
+ }
+
+ if (textures.Any())
+ {
+ f.Key("textures"); f.GLTFValue(textures);
+ }
+ if (materials.Any())
+ {
+ f.Key("materials"); f.GLTFValue(materials);
+ }
+
+ // meshes
+ if (meshes.Any())
+ {
+ f.Key("meshes"); f.GLTFValue(meshes);
+ }
+ if (skins.Any())
+ {
+ f.Key("skins"); f.GLTFValue(skins);
+ }
+
+ // scene
+ if (nodes.Any())
+ {
+ f.Key("nodes"); f.GLTFValue(nodes);
+ }
+ if (scenes.Any())
+ {
+ f.Key("scenes"); f.GLTFValue(scenes);
+ if (scene >= 0)
+ {
+ f.KeyValue(() => scene);
+ }
+ }
+
+ // animations
+ if (animations.Any())
+ {
+ f.Key("animations"); f.GLTFValue(animations);
+ }
+ }
+
+ public bool Equals(glTF other)
+ {
+ return
+ textures.SequenceEqual(other.textures)
+ && samplers.SequenceEqual(other.samplers)
+ && images.SequenceEqual(other.images)
+ && materials.SequenceEqual(other.materials)
+ && meshes.SequenceEqual(other.meshes)
+ && nodes.SequenceEqual(other.nodes)
+ && skins.SequenceEqual(other.skins)
+ && scene == other.scene
+ && scenes.SequenceEqual(other.scenes)
+ && animations.SequenceEqual(other.animations)
+ ;
+ }
+
+ bool UsedExtension(string key)
+ {
+ if (extensionsUsed.Contains(key))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ static Utf8String s_extensions = Utf8String.From("extensions");
+
+ void Traverse(ListTreeNode<JsonValue> node, JsonFormatter f, Utf8String parentKey)
+ {
+ if (node.IsMap())
+ {
+ f.BeginMap();
+ foreach (var kv in node.ObjectItems())
+ {
+ if (parentKey == s_extensions)
+ {
+ if (!UsedExtension(kv.Key.GetString()))
+ {
+ continue;
+ }
+ }
+ f.Key(kv.Key.GetUtf8String());
+ Traverse(kv.Value, f, kv.Key.GetUtf8String());
+ }
+ f.EndMap();
+ }
+ else if (node.IsArray())
+ {
+ f.BeginList();
+ foreach (var x in node.ArrayItems())
+ {
+ Traverse(x, f, default(Utf8String));
+ }
+ f.EndList();
+ }
+ else
+ {
+ f.Value(node);
+ }
+ }
+
+ string RemoveUnusedExtensions(string json)
+ {
+ var f = new JsonFormatter();
+
+ Traverse(JsonParser.Parse(json), f, default(Utf8String));
+
+ return f.ToString();
+ }
+
+ public byte[] ToGlbBytes(SerializerTypes serializer = SerializerTypes.Generated)
+ {
+ string json;
+ if (serializer == SerializerTypes.UniJSON)
+ {
+ // Obsolete
+ var c = new JsonSchemaValidationContext(this)
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ json = JsonSchema.FromType(GetType()).Serialize(this, c);
+ }
+ else if (serializer == SerializerTypes.Generated)
+ {
+ var f = new JsonFormatter();
+ f.GenSerialize(this);
+ json = f.ToString().ParseAsJson().ToString(" ");
+ }
+ else if (serializer == SerializerTypes.JsonSerializable)
+ {
+ // Obsolete
+ json = ToJson();
+ }
+ else
+ {
+ throw new Exception("[UniVRM Export Error] unknown serializer type");
+ }
+
+ RemoveUnusedExtensions(json);
+
+ return Glb.ToBytes(json, buffers[0].GetBytes());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs.meta
new file mode 100644
index 00000000..b1047895
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTF.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 317adeaa75a118a4f857721c90946933
+timeCreated: 1516618885
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs
new file mode 100644
index 00000000..3dfc1c6f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs
@@ -0,0 +1,252 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UniJSON;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFAnimationTarget : JsonSerializableBase
+ {
+ [JsonSchema(Minimum = 0)]
+ public int node;
+
+ [JsonSchema(Required = true, EnumValues = new object[] { "translation", "rotation", "scale", "weights" }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string path;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => node);
+ if (!string.IsNullOrEmpty(path))
+ {
+ f.KeyValue(() => path);
+ }
+ }
+
+ public enum Interpolations
+ {
+ LINEAR,
+ STEP,
+ CUBICSPLINE
+ }
+
+ public const string PATH_TRANSLATION = "translation";
+ public const string PATH_EULER_ROTATION = "rotation";
+ public const string PATH_ROTATION = "rotation";
+ public const string PATH_SCALE = "scale";
+ public const string PATH_WEIGHT = "weights";
+ public const string NOT_IMPLEMENTED = "NotImplemented";
+
+ [Obsolete("Use AnimationProperties")]
+ public enum AnimationPropertys
+ {
+ Translation = AnimationProperties.Translation,
+ EulerRotation = AnimationProperties.EulerRotation,
+ Rotation = AnimationProperties.Rotation,
+ Scale = AnimationProperties.Scale,
+ Weight = AnimationProperties.Weight,
+ BlendShape = AnimationProperties.BlendShape,
+
+ NotImplemented = AnimationProperties.NotImplemented
+ }
+
+ [Obsolete]
+ internal static AnimationProperties AnimationPropertysToAnimationProperties(AnimationPropertys property)
+ {
+ if (!Enum.IsDefined(typeof(AnimationProperties), property))
+ {
+ throw new InvalidCastException("Failed to convert AnimationPropertys '" + property + "' to AnimationProperties");
+ }
+ return (AnimationProperties)property;
+ }
+
+ public enum AnimationProperties
+ {
+ Translation,
+ EulerRotation,
+ Rotation,
+ Scale,
+ Weight,
+ BlendShape,
+
+ NotImplemented
+ }
+
+ [Obsolete]
+ public static string GetPathName(AnimationPropertys property)
+ {
+ return GetPathName(AnimationPropertysToAnimationProperties(property));
+ }
+
+ public static string GetPathName(AnimationProperties property)
+ {
+ switch (property)
+ {
+ case AnimationProperties.Translation:
+ return PATH_TRANSLATION;
+ case AnimationProperties.EulerRotation:
+ case AnimationProperties.Rotation:
+ return PATH_ROTATION;
+ case AnimationProperties.Scale:
+ return PATH_SCALE;
+ case AnimationProperties.BlendShape:
+ return PATH_WEIGHT;
+ default: throw new NotImplementedException();
+ }
+ }
+
+ public static AnimationProperties GetAnimationProperty(string path)
+ {
+ switch (path)
+ {
+ case PATH_TRANSLATION:
+ return AnimationProperties.Translation;
+ case PATH_ROTATION:
+ return AnimationProperties.Rotation;
+ case PATH_SCALE:
+ return AnimationProperties.Scale;
+ case PATH_WEIGHT:
+ return AnimationProperties.BlendShape;
+ default: throw new NotImplementedException();
+ }
+ }
+
+ [Obsolete]
+ public static int GetElementCount(AnimationPropertys property)
+ {
+ return GetElementCount(AnimationPropertysToAnimationProperties(property));
+ }
+
+ public static int GetElementCount(AnimationProperties property)
+ {
+ switch (property)
+ {
+ case AnimationProperties.Translation: return 3;
+ case AnimationProperties.EulerRotation: return 3;
+ case AnimationProperties.Rotation: return 4;
+ case AnimationProperties.Scale: return 3;
+ case AnimationProperties.BlendShape: return 1;
+ default: throw new NotImplementedException();
+ }
+ }
+
+ public static int GetElementCount(string path)
+ {
+ return GetElementCount(GetAnimationProperty(path));
+ }
+ }
+
+ [Serializable]
+ public class glTFAnimationChannel : JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int sampler = -1;
+
+ [JsonSchema(Required = true)]
+ public glTFAnimationTarget target;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => sampler);
+ f.Key("target"); f.GLTFValue(target);
+ }
+ }
+
+ [Serializable]
+ public class glTFAnimationSampler : JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int input = -1;
+
+ [JsonSchema(EnumValues = new object[] { "LINEAR", "STEP", "CUBICSPLINE" }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string interpolation;
+
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int output = -1;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => input);
+ if (!string.IsNullOrEmpty(interpolation))
+ {
+ f.KeyValue(() => interpolation);
+ }
+ f.KeyValue(() => output);
+ }
+ }
+
+ [Serializable]
+ public class glTFAnimation : JsonSerializableBase
+ {
+ public string name = "";
+
+ [JsonSchema(Required = true, MinItems = 1)]
+ public List<glTFAnimationChannel> channels = new List<glTFAnimationChannel>();
+
+ [JsonSchema(Required = true, MinItems = 1)]
+ public List<glTFAnimationSampler> samplers = new List<glTFAnimationSampler>();
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (!string.IsNullOrEmpty(name))
+ {
+ f.KeyValue(() => name);
+ }
+
+ f.Key("channels"); f.GLTFValue(channels);
+ f.Key("samplers"); f.GLTFValue(samplers);
+ }
+
+ [Obsolete]
+ public int AddChannelAndGetSampler(int nodeIndex, glTFAnimationTarget.AnimationPropertys property)
+ {
+ return AddChannelAndGetSampler(nodeIndex, glTFAnimationTarget.AnimationPropertysToAnimationProperties(property));
+ }
+
+ public int AddChannelAndGetSampler(int nodeIndex, glTFAnimationTarget.AnimationProperties property)
+ {
+ // find channel
+ var channel = channels.FirstOrDefault(x => x.target.node == nodeIndex && x.target.path == glTFAnimationTarget.GetPathName(property));
+ if (channel != null)
+ {
+ return channel.sampler;
+ }
+
+ // not found. create new
+ var samplerIndex = samplers.Count;
+ var sampler = new glTFAnimationSampler();
+ samplers.Add(sampler);
+
+ channel = new glTFAnimationChannel
+ {
+ sampler = samplerIndex,
+ target = new glTFAnimationTarget
+ {
+ node = nodeIndex,
+ path = glTFAnimationTarget.GetPathName(property),
+ },
+ };
+ channels.Add(channel);
+
+ return samplerIndex;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs.meta
new file mode 100644
index 00000000..4ca7197c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAnimation.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: f571aa160b9de354c8f5fcc6a38e41f1
+timeCreated: 1515833098
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs
new file mode 100644
index 00000000..bf691fc8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs
@@ -0,0 +1,34 @@
+using System;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFAssets : JsonSerializableBase
+ {
+ public string generator;
+
+ [JsonSchema(Required = true, Pattern = "^[0-9]+\\.[0-9]+$")]
+ public string version;
+
+ public string copyright;
+
+ [JsonSchema(Pattern = "^[0-9]+\\.[0-9]+$")]
+ public string minVersion;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.Key("generator"); f.Value(generator);
+ f.Key("version"); f.Value(version);
+ }
+
+ public override string ToString()
+ {
+ return string.Format("GLTF-{0} generated by {1}", version, generator);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs.meta
new file mode 100644
index 00000000..3e851a19
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFAssets.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 1b759a27457c3cb49adea3fba807e447
+timeCreated: 1516618004
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs
new file mode 100644
index 00000000..14f2cd7a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs
@@ -0,0 +1,266 @@
+using System;
+using System.Linq;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFBuffer : JsonSerializableBase
+ {
+ IBytesBuffer Storage;
+
+ public void OpenStorage(IStorage storage)
+ {
+ Storage = new ArraySegmentByteBuffer(storage.Get(uri));
+ /*
+ if (string.IsNullOrEmpty(uri))
+ {
+ Storage = (glbDataBytes);
+ }
+ else
+ {
+ Storage = new UriByteBuffer(baseDir, uri);
+ }
+ */
+ }
+
+ public glTFBuffer()
+ {
+
+ }
+
+ public glTFBuffer(IBytesBuffer storage)
+ {
+ Storage = storage;
+ }
+
+ public string uri;
+
+ [JsonSchema(Required = true, Minimum = 1)]
+ public int byteLength;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+ public string name;
+
+ public glTFBufferView Append<T>(T[] array, glBufferTarget target) where T : struct
+ {
+ return Append(new ArraySegment<T>(array), target);
+ }
+ public glTFBufferView Append<T>(ArraySegment<T> segment, glBufferTarget target) where T : struct
+ {
+ var view = Storage.Extend(segment, target);
+ byteLength = Storage.GetBytes().Count;
+ return view;
+ }
+
+ public ArraySegment<Byte> GetBytes()
+ {
+ return Storage.GetBytes();
+ }
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (!string.IsNullOrEmpty(uri))
+ {
+ f.KeyValue(() => uri);
+ }
+ f.KeyValue(() => byteLength);
+ }
+ }
+
+ [Serializable]
+ public class glTFBufferView : JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int buffer;
+
+ [JsonSchema(Minimum = 0)]
+ public int byteOffset;
+
+ [JsonSchema(Required = true, Minimum = 1)]
+ public int byteLength;
+
+ [JsonSchema(Minimum = 4, Maximum = 252, MultipleOf = 4)]
+ public int byteStride;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt, EnumExcludes = new object[] { glBufferTarget.NONE })]
+ public glBufferTarget target;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+ public string name;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => buffer);
+ f.KeyValue(() => byteOffset);
+ f.KeyValue(() => byteLength);
+ if (target != glBufferTarget.NONE)
+ {
+ f.Key("target"); f.Value((int)target);
+ }
+ /* When this is not defined, data is tightly packed. When two or more accessors use the same bufferView, this field must be defined.
+ if (byteStride >= 4)
+ {
+ f.KeyValue(() => byteStride);
+ }
+ */
+ }
+ }
+
+ [Serializable]
+ public class glTFSparseIndices : JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int bufferView = -1;
+
+ [JsonSchema(Minimum = 0)]
+ public int byteOffset;
+
+ [JsonSchema(Required = true, EnumValues = new object[] { 5121, 5123, 5125 })]
+ public glComponentType componentType;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => bufferView);
+ f.KeyValue(() => byteOffset);
+ f.Key("componentType"); f.Value((int)componentType);
+ }
+ }
+
+ [Serializable]
+ public class glTFSparseValues : JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int bufferView = -1;
+
+ [JsonSchema(Minimum = 0)]
+ public int byteOffset;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => bufferView);
+ f.KeyValue(() => byteOffset);
+ }
+ }
+
+ [Serializable]
+ public class glTFSparse : JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 1)]
+ public int count;
+
+ [JsonSchema(Required = true)]
+ public glTFSparseIndices indices;
+
+ [JsonSchema(Required = true)]
+ public glTFSparseValues values;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => count);
+ f.Key("indices"); f.GLTFValue(indices);
+ f.Key("values"); f.GLTFValue(values);
+ }
+ }
+
+ [Serializable]
+ public class glTFAccessor : JsonSerializableBase
+ {
+ [JsonSchema(Minimum = 0)]
+ public int bufferView = -1;
+
+ [JsonSchema(Minimum = 0, Dependencies = new string[] { "bufferView" })]
+ public int byteOffset;
+
+ [JsonSchema(Required = true, EnumValues = new object[] { "SCALAR", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", "MAT4" }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string type;
+
+ public int TypeCount
+ {
+ get
+ {
+ switch (type)
+ {
+ case "SCALAR":
+ return 1;
+ case "VEC2":
+ return 2;
+ case "VEC3":
+ return 3;
+ case "VEC4":
+ case "MAT2":
+ return 4;
+ case "MAT3":
+ return 9;
+ case "MAT4":
+ return 16;
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ [JsonSchema(Required = true, EnumSerializationType = EnumSerializationType.AsInt)]
+ public glComponentType componentType;
+
+ [JsonSchema(Required = true, Minimum = 1)]
+ public int count;
+
+ [JsonSchema(MinItems = 1, MaxItems = 16)]
+ public float[] max;
+
+ [JsonSchema(MinItems = 1, MaxItems = 16)]
+ public float[] min;
+
+ public bool normalized;
+ public glTFSparse sparse;
+
+ // empty schemas
+ public string name;
+
+ public object extensions;
+
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => bufferView);
+ f.KeyValue(() => byteOffset);
+ f.KeyValue(() => type);
+ f.Key("componentType"); f.Value((int)componentType);
+ f.KeyValue(() => count);
+ if (max != null && max.Any())
+ {
+ f.KeyValue(() => max);
+ }
+ if (min != null && min.Any())
+ {
+ f.KeyValue(() => min);
+ }
+
+ if (sparse != null && sparse.count > 0)
+ {
+ f.Key("sparse"); f.GLTFValue(sparse);
+ }
+
+ f.KeyValue(() => normalized);
+ f.KeyValue(() => name);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs.meta
new file mode 100644
index 00000000..876e42e6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFBuffer.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 50888f361f18c3140a23e9bfdcf43557
+timeCreated: 1515832638
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs
new file mode 100644
index 00000000..87de30c1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs
@@ -0,0 +1,60 @@
+using System;
+using UniJSON;
+
+namespace UniGLTF
+{
+ public enum ProjectionType
+ {
+ Perspective,
+ Orthographic
+ }
+
+ [Serializable]
+ public class glTFOrthographic
+ {
+ [JsonSchema(Required = true)]
+ public float xmag;
+ [JsonSchema(Required = true)]
+ public float ymag;
+ [JsonSchema(Required = true, Minimum = 0.0f, ExclusiveMinimum = true)]
+ public float zfar;
+ [JsonSchema(Required = true, Minimum = 0.0f)]
+ public float znear;
+
+ [JsonSchema(MinProperties = 1)]
+ public glTFOrthographic_extensions extensions;
+ [JsonSchema(MinProperties = 1)]
+ public glTFOrthographic_extras extras;
+ }
+
+ [Serializable]
+ public class glTFPerspective
+ {
+ [JsonSchema(Minimum = 0.0f, ExclusiveMinimum = true)]
+ public float aspectRatio;
+ [JsonSchema(Required = true, Minimum = 0.0f, ExclusiveMinimum = true)]
+ public float yfov;
+ [JsonSchema(Minimum = 0.0f, ExclusiveMinimum = true)]
+ public float zfar;
+ [JsonSchema(Required = true, Minimum = 0.0f, ExclusiveMinimum = true)]
+ public float znear;
+
+ public glTFPerspective_extensions extensions;
+ public glTFPerspective_extras extras;
+ }
+
+ [Serializable]
+ public class glTFCamera
+ {
+ public glTFOrthographic orthographic;
+ public glTFPerspective perspective;
+
+ [JsonSchema(Required = true, EnumSerializationType = EnumSerializationType.AsLowerString)]
+ public ProjectionType type;
+
+ public string name;
+
+ public glTFCamera_extensions extensions;
+ public glTFCamera_extras extras;
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs.meta
new file mode 100644
index 00000000..2ecc5007
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFCamera.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a4ff02eb93400b142a5ff47d1067bd8b
+timeCreated: 1531635880
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs
new file mode 100644
index 00000000..ef0be0dc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs
@@ -0,0 +1,232 @@
+using System;
+using UniJSON;
+
+namespace UniGLTF
+{
+ public enum glTFTextureTypes
+ {
+ BaseColor,
+ Metallic,
+ Normal,
+ Occlusion,
+ Emissive,
+ Unknown
+ }
+
+ public interface IglTFTextureinfo
+ {
+ glTFTextureTypes TextureType { get; }
+ }
+
+ [Serializable]
+ public abstract class glTFTextureInfo : JsonSerializableBase, IglTFTextureinfo
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int index = -1;
+
+ [JsonSchema(Minimum = 0)]
+ public int texCoord;
+
+ // empty schemas
+ public glTFTextureInfo_extensions extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => index);
+ f.KeyValue(() => texCoord);
+ if (extensions != null)
+ {
+ f.KeyValue(() => extensions);
+ }
+ }
+
+ public abstract glTFTextureTypes TextureType { get; }
+ }
+
+
+ [Serializable]
+ public class glTFMaterialBaseColorTextureInfo : glTFTextureInfo
+ {
+ public override glTFTextureTypes TextureType
+ {
+ get { return glTFTextureTypes.BaseColor; }
+ }
+ }
+
+ [Serializable]
+ public class glTFMaterialMetallicRoughnessTextureInfo : glTFTextureInfo
+ {
+ public override glTFTextureTypes TextureType
+ {
+ get { return glTFTextureTypes.Metallic; }
+ }
+ }
+
+ [Serializable]
+ public class glTFMaterialNormalTextureInfo : glTFTextureInfo
+ {
+ public float scale = 1.0f;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => scale);
+ base.SerializeMembers(f);
+ }
+
+ public override glTFTextureTypes TextureType
+ {
+ get { return glTFTextureTypes.Normal; }
+ }
+ }
+
+ [Serializable]
+ public class glTFMaterialOcclusionTextureInfo : glTFTextureInfo
+ {
+ [JsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public float strength = 1.0f;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => strength);
+ base.SerializeMembers(f);
+ }
+
+ public override glTFTextureTypes TextureType
+ {
+ get { return glTFTextureTypes.Occlusion; }
+ }
+ }
+
+ [Serializable]
+ public class glTFMaterialEmissiveTextureInfo : glTFTextureInfo
+ {
+ public override glTFTextureTypes TextureType
+ {
+ get { return glTFTextureTypes.Emissive; }
+ }
+ }
+
+ [Serializable]
+ public class glTFPbrMetallicRoughness : JsonSerializableBase
+ {
+ public glTFMaterialBaseColorTextureInfo baseColorTexture = null;
+
+ [JsonSchema(MinItems = 4, MaxItems = 4)]
+ [ItemJsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public float[] baseColorFactor;
+
+ public glTFMaterialMetallicRoughnessTextureInfo metallicRoughnessTexture = null;
+
+ [JsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public float metallicFactor = 1.0f;
+
+ [JsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public float roughnessFactor = 1.0f;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (baseColorTexture != null)
+ {
+ f.Key("baseColorTexture"); f.GLTFValue(baseColorTexture);
+ }
+ if (baseColorFactor != null)
+ {
+ f.KeyValue(() => baseColorFactor);
+ }
+ if (metallicRoughnessTexture != null)
+ {
+ f.Key("metallicRoughnessTexture"); f.GLTFValue(metallicRoughnessTexture);
+ }
+ f.KeyValue(() => metallicFactor);
+ f.KeyValue(() => roughnessFactor);
+ }
+ }
+
+ [Serializable]
+ public class glTFMaterial : JsonSerializableBase
+ {
+ public string name;
+ public glTFPbrMetallicRoughness pbrMetallicRoughness = new glTFPbrMetallicRoughness
+ {
+ baseColorFactor = new float[] { 1.0f, 1.0f, 1.0f, 1.0f },
+ };
+ public glTFMaterialNormalTextureInfo normalTexture = null;
+
+ public glTFMaterialOcclusionTextureInfo occlusionTexture = null;
+
+ public glTFMaterialEmissiveTextureInfo emissiveTexture = null;
+
+ [JsonSchema(MinItems = 3, MaxItems = 3)]
+ [ItemJsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public float[] emissiveFactor;
+
+ [JsonSchema(EnumValues = new object[] { "OPAQUE", "MASK", "BLEND" }, EnumSerializationType = EnumSerializationType.AsUpperString)]
+ public string alphaMode;
+
+ [JsonSchema(Dependencies = new string[] { "alphaMode" }, Minimum = 0.0)]
+ public float alphaCutoff = 0.5f;
+
+ public bool doubleSided;
+
+ [JsonSchema(SkipSchemaComparison = true)]
+ public glTFMaterial_extensions extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (!String.IsNullOrEmpty(name))
+ {
+ f.Key("name"); f.Value(name);
+ }
+ if (pbrMetallicRoughness != null)
+ {
+ f.Key("pbrMetallicRoughness"); f.GLTFValue(pbrMetallicRoughness);
+ }
+ if (normalTexture != null)
+ {
+ f.Key("normalTexture"); f.GLTFValue(normalTexture);
+ }
+ if (occlusionTexture != null)
+ {
+ f.Key("occlusionTexture"); f.GLTFValue(occlusionTexture);
+ }
+ if (emissiveTexture != null)
+ {
+ f.Key("emissiveTexture"); f.GLTFValue(emissiveTexture);
+ }
+ if (emissiveFactor != null)
+ {
+ f.Key("emissiveFactor"); f.Serialize(emissiveFactor);
+ }
+
+ f.KeyValue(() => doubleSided);
+
+ if (!string.IsNullOrEmpty(alphaMode))
+ {
+ f.KeyValue(() => alphaMode);
+ }
+
+ if (extensions != null)
+ {
+ f.Key("extensions"); f.GLTFValue(extensions);
+ }
+ }
+
+ public glTFTextureInfo[] GetTextures()
+ {
+ return new glTFTextureInfo[]
+ {
+ (pbrMetallicRoughness != null)?pbrMetallicRoughness.baseColorTexture:null,
+ (pbrMetallicRoughness != null)?pbrMetallicRoughness.metallicRoughnessTexture:null,
+ normalTexture,
+ occlusionTexture,
+ emissiveTexture
+ };
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs.meta
new file mode 100644
index 00000000..69c4328e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMaterial.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: f6315a9155238724c9b221c155c73f68
+timeCreated: 1515601872
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs
new file mode 100644
index 00000000..c2d11a46
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs
@@ -0,0 +1,174 @@
+using System;
+using System.Collections.Generic;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFAttributes : JsonSerializableBase
+ {
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int POSITION = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int NORMAL = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int TANGENT = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int TEXCOORD_0 = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int COLOR_0 = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int JOINTS_0 = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int WEIGHTS_0 = -1;
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as glTFAttributes;
+ if (rhs == null)
+ {
+ return base.Equals(obj);
+ }
+
+ return POSITION == rhs.POSITION
+ && NORMAL == rhs.NORMAL
+ && TANGENT == rhs.TANGENT
+ && TEXCOORD_0 == rhs.TEXCOORD_0
+ && COLOR_0 == rhs.COLOR_0
+ && JOINTS_0 == rhs.JOINTS_0
+ && WEIGHTS_0 == rhs.WEIGHTS_0
+ ;
+ }
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => POSITION);
+ if (NORMAL != -1) f.KeyValue(() => NORMAL);
+ if (TANGENT != -1) f.KeyValue(() => TANGENT);
+ if (TEXCOORD_0 != -1) f.KeyValue(() => TEXCOORD_0);
+ if (COLOR_0 != -1) f.KeyValue(() => COLOR_0);
+ if (JOINTS_0 != -1) f.KeyValue(() => JOINTS_0);
+ if (WEIGHTS_0 != -1) f.KeyValue(() => WEIGHTS_0);
+ }
+ }
+
+ [Serializable]
+ public class gltfMorphTarget : JsonSerializableBase
+ {
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int POSITION = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int NORMAL = -1;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int TANGENT = -1;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => POSITION);
+ if (NORMAL >= 0) f.KeyValue(() => NORMAL);
+ if (TANGENT >= 0) f.KeyValue(() => TANGENT);
+ }
+ }
+
+ /// <summary>
+ /// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/mesh.primitive.schema.json
+ /// </summary>
+ [Serializable]
+ public class glTFPrimitives : JsonSerializableBase
+ {
+ [JsonSchema(EnumValues = new object[] { 0, 1, 2, 3, 4, 5, 6 })]
+ public int mode;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int indices = -1;
+
+ [JsonSchema(Required = true, SkipSchemaComparison = true)]
+ public glTFAttributes attributes;
+
+ public bool HasVertexColor
+ {
+ get
+ {
+ return attributes.COLOR_0 != -1;
+ }
+ }
+
+ [JsonSchema(Minimum = 0)]
+ public int material;
+
+ [JsonSchema(MinItems = 1, ExplicitIgnorableItemLength = 0)]
+ [ItemJsonSchema(SkipSchemaComparison = true)]
+ public List<gltfMorphTarget> targets = new List<gltfMorphTarget>();
+
+ public glTFPrimitives_extras extras = new glTFPrimitives_extras();
+
+ [JsonSchema(SkipSchemaComparison = true)]
+ public glTFPrimitives_extensions extensions = null;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => mode);
+ f.KeyValue(() => indices);
+ f.Key("attributes"); f.GLTFValue(attributes);
+ f.KeyValue(() => material);
+ if (targets != null && targets.Count > 0)
+ {
+ f.Key("targets"); f.GLTFValue(targets);
+ }
+ if (extras.targetNames.Count > 0)
+ {
+ f.Key("extras"); f.GLTFValue(extras);
+ }
+ }
+ }
+
+ [Serializable]
+ public class glTFMesh : JsonSerializableBase
+ {
+ public string name;
+
+ [JsonSchema(Required = true, MinItems = 1)]
+ public List<glTFPrimitives> primitives = new List<glTFPrimitives>();
+
+ [JsonSchema(MinItems = 1)]
+ public float[] weights;
+
+ [JsonSchema(SkipSchemaComparison = true)]
+ public glTFMesh_extras extras = null;
+
+ // empty schemas
+ public object extensions;
+
+ public glTFMesh()
+ {
+ }
+
+ public glTFMesh(string _name)
+ {
+ name = _name;
+ }
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => name);
+ f.Key("primitives"); f.GLTFValue(primitives);
+ if (weights != null && weights.Length > 0)
+ {
+ f.KeyValue(() => weights);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs.meta
new file mode 100644
index 00000000..5d8622c5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFMesh.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 20634c83ea30c99449cd85ef46368b13
+timeCreated: 1516622346
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs
new file mode 100644
index 00000000..edef688f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Linq;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFNode : JsonSerializableBase
+ {
+ // TODO: need an empty string?
+ public string name;
+
+ [JsonSchema(MinItems = 1)]
+ [ItemJsonSchema(Minimum = 0)]
+ public int[] children;
+
+ [JsonSchema(MinItems = 16, MaxItems = 16)]
+ public float[] matrix;
+
+ [JsonSchema(MinItems = 3, MaxItems = 3)]
+ public float[] translation;
+
+ [JsonSchema(MinItems = 4, MaxItems = 4)]
+ [ItemJsonSchema(Minimum = -1.0, Maximum = 1.0)]
+ public float[] rotation;
+
+ [JsonSchema(MinItems = 3, MaxItems = 3)]
+ public float[] scale;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int mesh = -1;
+
+ [JsonSchema(Dependencies = new string[] { "mesh" }, Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int skin = -1;
+
+ [JsonSchema(Dependencies = new string[] { "mesh" }, MinItems = 1)]
+ public float[] weights;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int camera = -1;
+
+ // empty schemas
+ public glTFNode_extensions extensions;
+
+ public glTFNode_extra extras = new glTFNode_extra();
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (children != null && children.Any())
+ {
+ f.Key("children"); f.BeginList();
+ foreach (var child in children)
+ {
+ f.Value(child);
+ }
+ f.EndList();
+ }
+
+ if (!string.IsNullOrEmpty(name)) f.KeyValue(() => name);
+ if (matrix != null) f.KeyValue(() => matrix);
+ if (translation != null) f.KeyValue(() => translation);
+ if (rotation != null) f.KeyValue(() => rotation);
+ if (scale != null) f.KeyValue(() => scale);
+
+ if (mesh >= 0) f.KeyValue(() => mesh);
+ if (camera >= 0) f.KeyValue(() => camera);
+ if (skin >= 0)
+ {
+ f.KeyValue(() => skin);
+
+ if (extras.__count > 0)
+ {
+ f.Key("extras"); f.GLTFValue(extras);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs.meta
new file mode 100644
index 00000000..b973253a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFNode.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 655775a9435baed4281c569519829362
+timeCreated: 1515833011
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs
new file mode 100644
index 00000000..aebffb10
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs
@@ -0,0 +1,34 @@
+using System;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFSkin : JsonSerializableBase
+ {
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int inverseBindMatrices = -1;
+
+ [JsonSchema(Required = true, MinItems = 1)]
+ [ItemJsonSchema(Minimum = 0)]
+ public int[] joints;
+
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int skeleton = -1;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+ public string name;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => inverseBindMatrices);
+ f.KeyValue(() => joints);
+ if (skeleton >= 0)
+ {
+ f.KeyValue(() => skeleton);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs.meta
new file mode 100644
index 00000000..3d20b395
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFSkin.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 592c03928131f494f99dca5ef46a8ba0
+timeCreated: 1516722509
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs
new file mode 100644
index 00000000..199846b9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs
@@ -0,0 +1,123 @@
+using System;
+using System.IO;
+using UniJSON;
+
+namespace UniGLTF
+{
+ [Serializable]
+ public class glTFTextureSampler : JsonSerializableBase
+ {
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt,
+ EnumExcludes = new object[] {
+ glFilter.NONE,
+ glFilter.NEAREST_MIPMAP_NEAREST,
+ glFilter.LINEAR_MIPMAP_NEAREST,
+ glFilter.NEAREST_MIPMAP_LINEAR,
+ glFilter.LINEAR_MIPMAP_LINEAR,
+ })]
+ public glFilter magFilter = glFilter.NEAREST;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt,
+ EnumExcludes = new object[] { glFilter.NONE })]
+ public glFilter minFilter = glFilter.NEAREST;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt,
+ EnumExcludes = new object[] { glWrap.NONE })]
+ public glWrap wrapS = glWrap.REPEAT;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt,
+ EnumExcludes = new object[] { glWrap.NONE })]
+ public glWrap wrapT = glWrap.REPEAT;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+ public string name;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.Key("magFilter"); f.Value((int)magFilter);
+ f.Key("minFilter"); f.Value((int)minFilter);
+ f.Key("wrapS"); f.Value((int)wrapS);
+ f.Key("wrapT"); f.Value((int)wrapT);
+ }
+ }
+
+ [Serializable]
+ public class glTFImage : JsonSerializableBase
+ {
+ public string name;
+ public string uri;
+
+ [JsonSchema(Dependencies = new string[] { "mimeType" }, Minimum = 0)]
+ public int bufferView;
+
+ [JsonSchema(EnumValues = new object[] { "image/jpeg", "image/png" }, EnumSerializationType =EnumSerializationType.AsString)]
+ public string mimeType;
+
+ public string GetExt()
+ {
+ switch (mimeType)
+ {
+ case "image/png":
+ return ".png";
+
+ case "image/jpeg":
+ return ".jpg";
+
+ default:
+ if (uri.StartsWith("data:image/jpeg;"))
+ {
+ return ".jpg";
+ }
+ else if (uri.StartsWith("data:image/png;"))
+ {
+ return ".png";
+ }
+ else
+ {
+ return Path.GetExtension(uri).ToLower();
+ }
+ }
+ }
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => name);
+ if (!string.IsNullOrEmpty(uri))
+ {
+ f.KeyValue(() => uri);
+ }
+ else
+ {
+ f.KeyValue(() => bufferView);
+ f.KeyValue(() => mimeType);
+ }
+ }
+ }
+
+ [Serializable]
+ public class glTFTexture : JsonSerializableBase
+ {
+ [JsonSchema(Minimum = 0)]
+ public int sampler;
+
+ [JsonSchema(Minimum = 0)]
+ public int source;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+ public string name;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => sampler);
+ f.KeyValue(() => source);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs.meta
new file mode 100644
index 00000000..b38c9e72
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glTFTexture.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 5eabe858953de424787a21d633fedda0
+timeCreated: 1515832646
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs
new file mode 100644
index 00000000..a876b541
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs
@@ -0,0 +1,142 @@
+using System;
+using System.IO;
+using System.Text;
+
+namespace UniGLTF
+{
+ public enum GlbChunkType : uint
+ {
+ JSON = 0x4E4F534A,
+ BIN = 0x004E4942,
+ }
+
+ public struct GlbHeader
+ {
+ public static void WriteTo(Stream s)
+ {
+ s.WriteByte((Byte)'g');
+ s.WriteByte((Byte)'l');
+ s.WriteByte((Byte)'T');
+ s.WriteByte((Byte)'F');
+ var bytes = BitConverter.GetBytes((UInt32)2);
+ s.Write(bytes, 0, bytes.Length);
+ }
+ }
+
+ public struct GlbChunk
+ {
+ public GlbChunkType ChunkType;
+ public ArraySegment<Byte> Bytes;
+
+ public GlbChunk(string json) : this(
+ GlbChunkType.JSON,
+ new ArraySegment<byte>(Encoding.UTF8.GetBytes(json))
+ )
+ {
+ }
+
+ public GlbChunk(ArraySegment<Byte> bytes) : this(
+ GlbChunkType.BIN,
+ bytes
+ )
+ {
+ }
+
+ public GlbChunk(GlbChunkType type, ArraySegment<Byte> bytes)
+ {
+ ChunkType = type;
+ Bytes = bytes;
+ }
+
+ byte GetPaddingByte()
+ {
+ // chunk type
+ switch (ChunkType)
+ {
+ case GlbChunkType.JSON:
+ return 0x20;
+
+ case GlbChunkType.BIN:
+ return 0x00;
+
+ default:
+ throw new Exception("unknown chunk type: " + ChunkType);
+ }
+ }
+
+ public int WriteTo(Stream s)
+ {
+ // padding
+ var paddingValue = Bytes.Count % 4;
+ var padding = (paddingValue > 0) ? 4 - paddingValue : 0;
+
+ // size
+ var bytes = BitConverter.GetBytes((int)(Bytes.Count + padding));
+ s.Write(bytes, 0, bytes.Length);
+
+ // chunk type
+ switch (ChunkType)
+ {
+ case GlbChunkType.JSON:
+ s.WriteByte((byte)'J');
+ s.WriteByte((byte)'S');
+ s.WriteByte((byte)'O');
+ s.WriteByte((byte)'N');
+ break;
+
+ case GlbChunkType.BIN:
+ s.WriteByte((byte)'B');
+ s.WriteByte((byte)'I');
+ s.WriteByte((byte)'N');
+ s.WriteByte((byte)0);
+ break;
+
+ default:
+ throw new Exception("unknown chunk type: " + ChunkType);
+ }
+
+ // body
+ s.Write(Bytes.Array, Bytes.Offset, Bytes.Count);
+
+ // 4byte align
+ var pad = GetPaddingByte();
+ for(int i=0; i<padding; ++i)
+ {
+ s.WriteByte(pad);
+ }
+
+ return 4 + 4 + Bytes.Count + padding;
+ }
+ }
+
+ public static class Glb
+ {
+ public static byte[] ToBytes(string json, ArraySegment<byte> body)
+ {
+ using (var s = new MemoryStream())
+ {
+ GlbHeader.WriteTo(s);
+
+ var pos = s.Position;
+ s.Position += 4; // skip total size
+
+ int size = 12;
+
+ {
+ var chunk = new GlbChunk(json);
+ size += chunk.WriteTo(s);
+ }
+ {
+ var chunk = new GlbChunk(body);
+ size += chunk.WriteTo(s);
+ }
+
+ s.Position = pos;
+ var bytes = BitConverter.GetBytes(size);
+ s.Write(bytes, 0, bytes.Length);
+
+ return s.ToArray();
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs.meta
new file mode 100644
index 00000000..fdc70e48
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Format/glbTypes.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 9238dc0c44df9484bbdca85d818c9b73
+timeCreated: 1516616871
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO.meta
new file mode 100644
index 00000000..1081f515
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: a7addf524d7f84841b039527f0273bfa
+folderAsset: yes
+timeCreated: 1517139195
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs
new file mode 100644
index 00000000..86016420
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs
@@ -0,0 +1,140 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ class AnimationCurveData
+ {
+#if UNITY_EDITOR
+ public AnimationUtility.TangentMode TangentMode { get; private set; }
+ public glTFAnimationTarget.AnimationProperties AnimationProperty { get; private set; }
+ public int SamplerIndex { get; private set; }
+ public int ElementCount { get; private set; }
+ public readonly List<AnimationKeyframeData> Keyframes = new List<AnimationKeyframeData>();
+
+ [Obsolete]
+ public AnimationCurveData(AnimationUtility.TangentMode tangentMode, glTFAnimationTarget.AnimationPropertys property, int samplerIndex, int elementCount)
+ : this(tangentMode, glTFAnimationTarget.AnimationPropertysToAnimationProperties(property), samplerIndex, elementCount)
+ {
+ }
+
+ public AnimationCurveData(AnimationUtility.TangentMode tangentMode, glTFAnimationTarget.AnimationProperties property, int samplerIndex, int elementCount)
+ {
+ TangentMode = tangentMode;
+ AnimationProperty = property;
+ SamplerIndex = samplerIndex;
+ ElementCount = elementCount;
+ }
+
+ public string GetInterpolation()
+ {
+ switch (TangentMode)
+ {
+ case AnimationUtility.TangentMode.Linear:
+ return glTFAnimationTarget.Interpolations.LINEAR.ToString();
+ case AnimationUtility.TangentMode.Constant:
+ return glTFAnimationTarget.Interpolations.STEP.ToString();
+ default:
+ return glTFAnimationTarget.Interpolations.LINEAR.ToString();
+ }
+ }
+
+ /// <summary>
+ /// キーフレームのデータを入力する
+ /// </summary>
+ /// <param name="time"></param>
+ /// <param name="value"></param>
+ /// <param name="valueOffset"></param>
+ public void SetKeyframeData(float time, float value, int valueOffset)
+ {
+ var existKeyframe = Keyframes.FirstOrDefault(x => x.Time == time);
+ if (existKeyframe != null)
+ {
+ existKeyframe.SetValue(value, valueOffset);
+ }
+ else
+ {
+ var newKeyframe = GetKeyframeData(AnimationProperty, ElementCount);
+ newKeyframe.Time = time;
+ newKeyframe.SetValue(value, valueOffset);
+ Keyframes.Add(newKeyframe);
+ }
+ }
+
+ /// <summary>
+ /// キー情報がなかった要素に対して直前のキーの値を入力する
+ /// </summary>
+ public void RecountEmptyKeyframe()
+ {
+ if (Keyframes.Count == 0)
+ {
+ return;
+ }
+
+ Keyframes.Sort((x, y) => (x.Time < y.Time) ? -1 : 1);
+
+ for (int i = 1; i < Keyframes.Count; i++)
+ {
+ var current = Keyframes[i];
+ var last = Keyframes[i - 1];
+ for (int j = 0; j < current.EnterValues.Length; j++)
+ {
+ if (!current.EnterValues[j])
+ {
+ Keyframes[i].SetValue(last.Values[j], j);
+ }
+ }
+
+ }
+ }
+
+ /// <summary>
+ /// アニメーションプロパティに対応したキーフレームを挿入する
+ /// </summary>
+ /// <param name="property"></param>
+ /// <returns></returns>
+ [Obsolete]
+ private static AnimationKeyframeData GetKeyframeData(glTFAnimationTarget.AnimationPropertys property,
+ int elementCount)
+ {
+ return GetKeyframeData(glTFAnimationTarget.AnimationPropertysToAnimationProperties(property), elementCount);
+ }
+
+ /// <summary>
+ /// アニメーションプロパティに対応したキーフレームを挿入する
+ /// </summary>
+ /// <param name="property"></param>
+ /// <returns></returns>
+ private static AnimationKeyframeData GetKeyframeData(glTFAnimationTarget.AnimationProperties property, int elementCount)
+ {
+ switch (property)
+ {
+ case glTFAnimationTarget.AnimationProperties.Translation:
+ return new AnimationKeyframeData(elementCount, (values) =>
+ {
+ var temp = new Vector3(values[0], values[1], values[2]);
+ return temp.ReverseZ().ToArray();
+ });
+ case glTFAnimationTarget.AnimationProperties.Rotation:
+ return new AnimationKeyframeData(elementCount, (values) =>
+ {
+ var temp = new Quaternion(values[0], values[1], values[2], values[3]);
+ return temp.ReverseZ().ToArray();
+ });
+ case glTFAnimationTarget.AnimationProperties.Scale:
+ return new AnimationKeyframeData(elementCount, null);
+ case glTFAnimationTarget.AnimationProperties.BlendShape:
+ return new AnimationKeyframeData(elementCount, null);
+ default:
+ return null;
+ }
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs.meta
new file mode 100644
index 00000000..a6b2101b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationCurveData.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 1af21722605d44f58deebfcfca642b32
+timeCreated: 1537442711 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs
new file mode 100644
index 00000000..d30c2137
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs
@@ -0,0 +1,222 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+
+ public static class AnimationExporter
+ {
+ public class InputOutputValues
+ {
+ public float[] Input;
+ public float[] Output;
+ }
+
+ public class AnimationWithSampleCurves
+ {
+ public glTFAnimation Animation;
+ public Dictionary<int, InputOutputValues> SamplerMap = new Dictionary<int, InputOutputValues>();
+ }
+
+#if UNITY_EDITOR
+ public static List<AnimationClip> GetAnimationClips(Animation animation)
+ {
+ var clips = new List<AnimationClip>();
+ foreach (AnimationState state in animation)
+ {
+ clips.Add(state.clip);
+ }
+ return clips;
+ }
+
+ public static List<AnimationClip> GetAnimationClips(Animator animator)
+ {
+ var clips = new List<AnimationClip>();
+
+ RuntimeAnimatorController runtimeAnimatorController = animator.runtimeAnimatorController;
+ UnityEditor.Animations.AnimatorController animationController = runtimeAnimatorController as UnityEditor.Animations.AnimatorController;
+
+ if (animationController == null)
+ {
+ return clips;
+ }
+
+ foreach (var layer in animationController.layers)
+ {
+ foreach (var state in layer.stateMachine.states)
+ {
+ clips.Add(state.state.motion as AnimationClip);
+ }
+ }
+ return clips;
+ }
+
+ static int GetNodeIndex(Transform root, List<Transform> nodes, string path)
+ {
+ var descendant = root.GetFromPath(path);
+ return nodes.IndexOf(descendant);
+ }
+
+ public static glTFAnimationTarget.AnimationProperties PropertyToTarget(string property)
+ {
+ if (property.StartsWith("m_LocalPosition."))
+ {
+ return glTFAnimationTarget.AnimationProperties.Translation;
+ }
+ else if (property.StartsWith("localEulerAnglesRaw."))
+ {
+ return glTFAnimationTarget.AnimationProperties.EulerRotation;
+ }
+ else if (property.StartsWith("m_LocalRotation."))
+ {
+ return glTFAnimationTarget.AnimationProperties.Rotation;
+ }
+ else if (property.StartsWith("m_LocalScale."))
+ {
+ return glTFAnimationTarget.AnimationProperties.Scale;
+ }
+ else if (property.StartsWith("blendShape."))
+ {
+ return glTFAnimationTarget.AnimationProperties.BlendShape;
+ }
+ else
+ {
+ return glTFAnimationTarget.AnimationProperties.NotImplemented;
+ }
+ }
+
+ public static int GetElementOffset(string property)
+ {
+ if (property.EndsWith(".x"))
+ {
+ return 0;
+ }
+ if (property.EndsWith(".y") || property.StartsWith("blendShape."))
+ {
+ return 1;
+ }
+ if (property.EndsWith(".z"))
+ {
+ return 2;
+ }
+ if (property.EndsWith(".w"))
+ {
+ return 3;
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public static AnimationWithSampleCurves Export(AnimationClip clip, Transform root, List<Transform> nodes)
+ {
+ var animation = new AnimationWithSampleCurves
+ {
+ Animation = new glTFAnimation(),
+ };
+
+#if UNITY_5_6_OR_NEWER
+ List<AnimationCurveData> curveDatum = new List<AnimationCurveData>();
+
+ foreach (var binding in AnimationUtility.GetCurveBindings(clip))
+ {
+ var curve = AnimationUtility.GetEditorCurve(clip, binding);
+
+ var property = AnimationExporter.PropertyToTarget(binding.propertyName);
+ if (property == glTFAnimationTarget.AnimationProperties.NotImplemented)
+ {
+ Debug.LogWarning("Not Implemented keyframe property : " + binding.propertyName);
+ continue;
+ }
+ if (property == glTFAnimationTarget.AnimationProperties.EulerRotation)
+ {
+ Debug.LogWarning("Interpolation setting of AnimationClip should be Quaternion");
+ continue;
+ }
+
+ var nodeIndex = GetNodeIndex(root, nodes, binding.path);
+ var samplerIndex = animation.Animation.AddChannelAndGetSampler(nodeIndex, property);
+ var elementCount = 0;
+ if (property == glTFAnimationTarget.AnimationProperties.BlendShape)
+ {
+ var mesh = nodes[nodeIndex].GetComponent<SkinnedMeshRenderer>().sharedMesh;
+ elementCount = mesh.blendShapeCount;
+ }
+ else
+ {
+ elementCount = glTFAnimationTarget.GetElementCount(property);
+ }
+
+ // 同一のsamplerIndexが割り当てられているcurveDataがある場合はそれを使用し、無ければ作る
+ var curveData = curveDatum.FirstOrDefault(x => x.SamplerIndex == samplerIndex);
+ if (curveData == null)
+ {
+ curveData = new AnimationCurveData(AnimationUtility.GetKeyRightTangentMode(curve, 0), property, samplerIndex, elementCount);
+ curveDatum.Add(curveData);
+ }
+
+ // 全てのキーフレームを回収
+ int elementOffset = 0;
+ float valueFactor = 1.0f;
+ if (property == glTFAnimationTarget.AnimationProperties.BlendShape)
+ {
+ var mesh = nodes[nodeIndex].GetComponent<SkinnedMeshRenderer>().sharedMesh;
+ var blendShapeName = binding.propertyName.Replace("blendShape.", "");
+ elementOffset = mesh.GetBlendShapeIndex(blendShapeName);
+ valueFactor = 0.01f;
+ }
+ else
+ {
+ elementOffset = AnimationExporter.GetElementOffset(binding.propertyName);
+ }
+
+ if (elementOffset >= 0 && elementOffset < elementCount)
+ {
+ for (int i = 0; i < curve.keys.Length; i++)
+ {
+ curveData.SetKeyframeData(curve.keys[i].time, curve.keys[i].value * valueFactor, elementOffset);
+ }
+ }
+ }
+
+ //キー挿入
+ foreach (var curve in curveDatum)
+ {
+ if (curve.Keyframes.Count == 0)
+ continue;
+
+ curve.RecountEmptyKeyframe();
+
+ var elementNum = curve.Keyframes.First().Values.Length;
+ var values = default(InputOutputValues);
+ if (!animation.SamplerMap.TryGetValue(curve.SamplerIndex, out values))
+ {
+ values = new InputOutputValues();
+ values.Input = new float[curve.Keyframes.Count];
+ values.Output = new float[curve.Keyframes.Count * elementNum];
+ animation.SamplerMap[curve.SamplerIndex] = values;
+ animation.Animation.samplers[curve.SamplerIndex].interpolation = curve.GetInterpolation();
+ }
+
+ int keyframeIndex = 0;
+ foreach (var keyframe in curve.Keyframes)
+ {
+ values.Input[keyframeIndex] = keyframe.Time;
+ Buffer.BlockCopy(keyframe.GetRightHandCoordinate(), 0, values.Output, keyframeIndex * elementNum * sizeof(float), elementNum * sizeof(float));
+ keyframeIndex++;
+ }
+ }
+#endif
+
+ return animation;
+ }
+#endif
+ }
+ } \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs.meta
new file mode 100644
index 00000000..6603cc13
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationExporter.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 015ae41bf6cb4428b8257ead79772908
+timeCreated: 1537443293 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs
new file mode 100644
index 00000000..0af09dfd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs
@@ -0,0 +1,342 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public static class AnimationImporter
+ {
+ private enum TangentMode
+ {
+ Linear,
+ Constant,
+ Cubicspline
+ }
+
+ private static TangentMode GetTangentMode(string interpolation)
+ {
+ if (interpolation == glTFAnimationTarget.Interpolations.LINEAR.ToString())
+ {
+ return TangentMode.Linear;
+ }
+ else if (interpolation == glTFAnimationTarget.Interpolations.STEP.ToString())
+ {
+ return TangentMode.Constant;
+ }
+ else if (interpolation == glTFAnimationTarget.Interpolations.CUBICSPLINE.ToString())
+ {
+ return TangentMode.Cubicspline;
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ private static void CalculateTangent(List<Keyframe> keyframes, int current)
+ {
+ int back = current - 1;
+ if (back < 0)
+ {
+ return;
+ }
+ if (current < keyframes.Count)
+ {
+ var rightTangent = (keyframes[current].value - keyframes[back].value) / (keyframes[current].time - keyframes[back].time);
+ keyframes[back] = new Keyframe(keyframes[back].time, keyframes[back].value, keyframes[back].inTangent, rightTangent);
+
+ var leftTangent = (keyframes[back].value - keyframes[current].value) / (keyframes[back].time - keyframes[current].time);
+ keyframes[current] = new Keyframe(keyframes[current].time, keyframes[current].value, leftTangent, 0);
+ }
+ }
+
+ public static Quaternion GetShortest(Quaternion last, Quaternion rot)
+ {
+ if (Quaternion.Dot(last, rot) > 0.0)
+ {
+ return rot;
+ }
+ else
+ {
+ return new Quaternion(-rot.x, -rot.y, -rot.z, -rot.w);
+ }
+
+ }
+
+ public delegate float[] ReverseZ(float[] current, float[] last);
+ public static void SetAnimationCurve(
+ AnimationClip targetClip,
+ string relativePath,
+ string[] propertyNames,
+ float[] input,
+ float[] output,
+ string interpolation,
+ Type curveType,
+ ReverseZ reverse)
+ {
+ var tangentMode = GetTangentMode(interpolation);
+
+ var curveCount = propertyNames.Length;
+ AnimationCurve[] curves = new AnimationCurve[curveCount];
+ List<Keyframe>[] keyframes = new List<Keyframe>[curveCount];
+
+ int elementNum = curveCount;
+ int inputIndex = 0;
+ //Quaternion用
+ float[] last = new float[curveCount];
+ if (last.Length == 4)
+ {
+ last[3] = 1.0f;
+ }
+ for (inputIndex = 0; inputIndex < input.Length; ++inputIndex)
+ {
+ var time = input[inputIndex];
+ var outputIndex = 0;
+ if (tangentMode == TangentMode.Cubicspline)
+ {
+ outputIndex = inputIndex * elementNum * 3;
+ var value = new float[curveCount];
+ for (int i = 0; i < value.Length; i++)
+ {
+ value[i] = output[outputIndex + elementNum + i];
+ }
+ var reversed = reverse(value, last);
+ last = reversed;
+ for (int i = 0; i < keyframes.Length; i++)
+ {
+ if (keyframes[i] == null)
+ keyframes[i] = new List<Keyframe>();
+ keyframes[i].Add(new Keyframe(
+ time,
+ reversed[i],
+ output[outputIndex + i],
+ output[outputIndex + i + elementNum * 2]));
+ }
+ }
+ else
+ {
+ outputIndex = inputIndex * elementNum;
+ var value = new float[curveCount];
+ for (int i = 0; i < value.Length; i++)
+ {
+ value[i] = output[outputIndex + i];
+ }
+ var reversed = reverse(value, last);
+ last = reversed;
+
+ for (int i = 0; i < keyframes.Length; i++)
+ {
+ if (keyframes[i] == null)
+ keyframes[i] = new List<Keyframe>();
+ if (tangentMode == TangentMode.Linear)
+ {
+ keyframes[i].Add(new Keyframe(time, reversed[i], 0, 0));
+ if (keyframes[i].Count > 0)
+ {
+ CalculateTangent(keyframes[i], keyframes[i].Count - 1);
+ }
+ }
+ else if (tangentMode == TangentMode.Constant)
+ keyframes[i].Add(new Keyframe(time, reversed[i], 0, float.PositiveInfinity));
+ }
+ }
+ }
+
+ for (int i = 0; i < curves.Length; i++)
+ {
+ curves[i] = new AnimationCurve();
+ for (int j = 0; j < keyframes[i].Count; j++)
+ {
+ curves[i].AddKey(keyframes[i][j]);
+ }
+
+ targetClip.SetCurve(relativePath, curveType, propertyNames[i], curves[i]);
+ }
+ }
+
+ public static List<AnimationClip> ImportAnimationClip(ImporterContext ctx)
+ {
+ List<AnimationClip> animationClips = new List<AnimationClip>();
+ for (int i = 0; i < ctx.GLTF.animations.Count; ++i)
+ {
+ var clip = new AnimationClip();
+ clip.ClearCurves();
+ clip.legacy = true;
+ clip.name = ctx.GLTF.animations[i].name;
+ if (string.IsNullOrEmpty(clip.name))
+ {
+ clip.name = "legacy_" + i;
+ }
+ clip.wrapMode = WrapMode.Loop;
+
+ var animation = ctx.GLTF.animations[i];
+ if (string.IsNullOrEmpty(animation.name))
+ {
+ animation.name = string.Format("animation:{0}", i);
+ }
+
+ foreach (var channel in animation.channels)
+ {
+ var targetTransform = ctx.Nodes[channel.target.node];
+ var relativePath = targetTransform.RelativePathFrom(ctx.Root.transform);
+ switch (channel.target.path)
+ {
+ case glTFAnimationTarget.PATH_TRANSLATION:
+ {
+ var sampler = animation.samplers[channel.sampler];
+ var input = ctx.GLTF.GetArrayFromAccessor<float>(sampler.input);
+ var outputVector = ctx.GLTF.GetArrayFromAccessor<Vector3>(sampler.output);
+ var output = new float[outputVector.Count() * 3];
+ ArrayExtensions.Copy<Vector3, float>(
+ new ArraySegment<Vector3>(outputVector),
+ new ArraySegment<float>(output));
+
+ AnimationImporter.SetAnimationCurve(
+ clip,
+ relativePath,
+ new string[] { "localPosition.x", "localPosition.y", "localPosition.z" },
+ input,
+ output,
+ sampler.interpolation,
+ typeof(Transform),
+ (values, last) =>
+ {
+ Vector3 temp = new Vector3(values[0], values[1], values[2]);
+ return temp.ReverseZ().ToArray();
+ }
+ );
+ }
+ break;
+
+ case glTFAnimationTarget.PATH_ROTATION:
+ {
+ var sampler = animation.samplers[channel.sampler];
+ var input = ctx.GLTF.GetArrayFromAccessor<float>(sampler.input);
+ var outputVector = ctx.GLTF.GetArrayFromAccessor<Vector4>(sampler.output);
+ var output = new float[outputVector.Count() * 4];
+ ArrayExtensions.Copy<Vector4, float>(
+ new ArraySegment<Vector4>(outputVector),
+ new ArraySegment<float>(output));
+
+ AnimationImporter.SetAnimationCurve(
+ clip,
+ relativePath,
+ new string[] { "localRotation.x", "localRotation.y", "localRotation.z", "localRotation.w" },
+ input,
+ output,
+ sampler.interpolation,
+ typeof(Transform),
+ (values, last) =>
+ {
+ Quaternion currentQuaternion = new Quaternion(values[0], values[1], values[2], values[3]);
+ Quaternion lastQuaternion = new Quaternion(last[0], last[1], last[2], last[3]);
+ return AnimationImporter.GetShortest(lastQuaternion, currentQuaternion.ReverseZ()).ToArray();
+ }
+ );
+
+ clip.EnsureQuaternionContinuity();
+ }
+ break;
+
+ case glTFAnimationTarget.PATH_SCALE:
+ {
+ var sampler = animation.samplers[channel.sampler];
+ var input = ctx.GLTF.GetArrayFromAccessor<float>(sampler.input);
+ var outputVector = ctx.GLTF.GetArrayFromAccessor<Vector3>(sampler.output);
+ var output = new float[outputVector.Count() * 3];
+ ArrayExtensions.Copy<Vector3, float>(
+ new ArraySegment<Vector3>(outputVector),
+ new ArraySegment<float>(output));
+
+ AnimationImporter.SetAnimationCurve(
+ clip,
+ relativePath,
+ new string[] { "localScale.x", "localScale.y", "localScale.z" },
+ input,
+ output,
+ sampler.interpolation,
+ typeof(Transform),
+ (values, last) => values);
+ }
+ break;
+
+ case glTFAnimationTarget.PATH_WEIGHT:
+ {
+ var node = ctx.GLTF.nodes[channel.target.node];
+ var mesh = ctx.GLTF.meshes[node.mesh];
+ //var primitive = mesh.primitives.FirstOrDefault();
+ //var targets = primitive.targets;
+
+ List<string> blendShapeNames = new List<string>();
+ var transform = ctx.Nodes[channel.target.node];
+ var skinnedMeshRenderer = transform.GetComponent<SkinnedMeshRenderer>();
+ if (skinnedMeshRenderer == null)
+ {
+ continue;
+ }
+
+ for (int j = 0; j < skinnedMeshRenderer.sharedMesh.blendShapeCount; j++)
+ {
+ blendShapeNames.Add(skinnedMeshRenderer.sharedMesh.GetBlendShapeName(j));
+ }
+
+ var keyNames = blendShapeNames
+ .Where(x => !string.IsNullOrEmpty(x))
+ .Select(x => "blendShape." + x)
+ .ToArray();
+
+ var sampler = animation.samplers[channel.sampler];
+ var input = ctx.GLTF.GetArrayFromAccessor<float>(sampler.input);
+ var output = ctx.GLTF.GetArrayFromAccessor<float>(sampler.output);
+ AnimationImporter.SetAnimationCurve(
+ clip,
+ relativePath,
+ keyNames,
+ input,
+ output,
+ sampler.interpolation,
+ typeof(SkinnedMeshRenderer),
+ (values, last) =>
+ {
+ for (int j = 0; j < values.Length; j++)
+ {
+ values[j] *= 100.0f;
+ }
+ return values;
+ });
+
+ }
+ break;
+
+ default:
+ Debug.LogWarningFormat("unknown path: {0}", channel.target.path);
+ break;
+ }
+ }
+ animationClips.Add(clip);
+ }
+
+ return animationClips;
+ }
+
+ public static void ImportAnimation(ImporterContext ctx)
+ {
+ // animation
+ if (ctx.GLTF.animations != null && ctx.GLTF.animations.Any())
+ {
+ var animation = ctx.Root.AddComponent<Animation>();
+ ctx.AnimationClips = ImportAnimationClip(ctx);
+ foreach (var clip in ctx.AnimationClips)
+ {
+ animation.AddClip(clip, clip.name);
+ }
+ if (ctx.AnimationClips.Count > 0)
+ {
+ animation.clip = ctx.AnimationClips.First();
+ }
+ }
+ }
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs.meta
new file mode 100644
index 00000000..8f83fec2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationImporter.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: d602384685dd4f179350052013659720
+timeCreated: 1537445972 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs
new file mode 100644
index 00000000..1de683bf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs
@@ -0,0 +1,54 @@
+namespace UniGLTF
+{
+ class AnimationKeyframeData
+ {
+#if UNITY_EDITOR
+ public float Time { get; set; }
+ public delegate float[] ConverterFunc(float[] values);
+ private ConverterFunc _converter;
+ private float[] _values;
+ public float[] Values
+ {
+ get { return _values; }
+ }
+
+ private bool[] _enterValues;
+ public bool[] EnterValues
+ {
+ get { return _enterValues; }
+ }
+
+ public AnimationKeyframeData(int elementCount, ConverterFunc converter)
+ {
+ _values = new float[elementCount];
+ _enterValues = new bool[elementCount];
+ for (int i = 0; i < _enterValues.Length; i++)
+ {
+ _enterValues[i] = false;
+ }
+ _converter = converter;
+ }
+
+ public void SetValue(float src, int offset)
+ {
+ if (_values.Length > offset)
+ {
+ _values[offset] = src;
+ _enterValues[offset] = true;
+ }
+ }
+
+ public virtual float[] GetRightHandCoordinate()
+ {
+ if (_converter != null)
+ {
+ return _converter(_values);
+ }
+ else
+ {
+ return _values;
+ }
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs.meta
new file mode 100644
index 00000000..06d8ca4a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/AnimationKeyframeData.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: e27ef4fb768e49f591c2bb5eadd3b19b
+timeCreated: 1537442737 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs
new file mode 100644
index 00000000..d3e8e58a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+
+namespace UniGLTF
+{
+ public class BytesReader
+ {
+ Byte[] m_bytes;
+ int m_pos;
+
+ public BytesReader(Byte[] bytes, int pos=0)
+ {
+ m_bytes = bytes;
+ m_pos = pos;
+ }
+
+ public string ReadString(int count, Encoding encoding)
+ {
+ var s = encoding.GetString(m_bytes, m_pos, count);
+ m_pos += count;
+ return s;
+ }
+
+ public float ReadSingle()
+ {
+ var n = BitConverter.ToSingle(m_bytes, m_pos);
+ m_pos += 4;
+ return n;
+ }
+
+ public byte ReadUInt8()
+ {
+ return m_bytes[m_pos++];
+ }
+
+ public UInt16 ReadUInt16()
+ {
+ var n = BitConverter.ToUInt16(m_bytes, m_pos);
+ m_pos += 2;
+ return n;
+ }
+
+ public sbyte ReadInt8()
+ {
+ return (sbyte)m_bytes[m_pos++];
+ }
+
+ public Int16 ReadInt16()
+ {
+ var n = BitConverter.ToInt16(m_bytes, m_pos);
+ m_pos += 2;
+ return n;
+ }
+
+ public int ReadInt32()
+ {
+ var n = BitConverter.ToInt32(m_bytes, m_pos);
+ m_pos += 4;
+ return n;
+ }
+
+ public void ReadToArray<T>(T[] dst) where T : struct
+ {
+ var size = new ArraySegment<Byte>(m_bytes, m_pos, m_bytes.Length - m_pos).MarshalCopyTo(dst);
+ m_pos += size;
+ }
+
+ public T ReadStruct<T>() where T : struct
+ {
+ var size = Marshal.SizeOf(typeof(T));
+ using (var pin = Pin.Create(new ArraySegment<Byte>(m_bytes, m_pos, m_bytes.Length - m_pos)))
+ {
+ var s = (T)Marshal.PtrToStructure(pin.Ptr, typeof(T));
+ m_pos += size;
+ return s;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs.meta
new file mode 100644
index 00000000..da1f45dd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/BytesReader.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: ecae7b7664269624ba8e03025a53819e
+timeCreated: 1514252306
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs
new file mode 100644
index 00000000..7bd0d6a4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs
@@ -0,0 +1,2207 @@
+
+using System;
+using System.Collections.Generic;
+using UniJSON;
+using UnityEngine;
+using VRM;
+
+namespace UniGLTF {
+
+ static public class IFormatterExtensionsGltf
+ {
+
+
+ /// gltf
+ public static void GenSerialize(this IFormatter f, glTF value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.asset!=null)
+ {
+ f.Key("asset"); f.GenSerialize(value.asset);
+ }
+
+ if(value.buffers!=null && value.buffers.Count>0)
+ {
+ f.Key("buffers"); f.GenSerialize(value.buffers);
+ }
+
+ if(value.bufferViews!=null && value.bufferViews.Count>0)
+ {
+ f.Key("bufferViews"); f.GenSerialize(value.bufferViews);
+ }
+
+ if(value.accessors!=null && value.accessors.Count>0)
+ {
+ f.Key("accessors"); f.GenSerialize(value.accessors);
+ }
+
+ if(value.textures!=null && value.textures.Count>0)
+ {
+ f.Key("textures"); f.GenSerialize(value.textures);
+ }
+
+ if(value.samplers!=null && value.samplers.Count>0)
+ {
+ f.Key("samplers"); f.GenSerialize(value.samplers);
+ }
+
+ if(value.images!=null && value.images.Count>0)
+ {
+ f.Key("images"); f.GenSerialize(value.images);
+ }
+
+ if(value.materials!=null && value.materials.Count>0)
+ {
+ f.Key("materials"); f.GenSerialize(value.materials);
+ }
+
+ if(value.meshes!=null && value.meshes.Count>0)
+ {
+ f.Key("meshes"); f.GenSerialize(value.meshes);
+ }
+
+ if(value.nodes!=null && value.nodes.Count>0)
+ {
+ f.Key("nodes"); f.GenSerialize(value.nodes);
+ }
+
+ if(value.skins!=null && value.skins.Count>0)
+ {
+ f.Key("skins"); f.GenSerialize(value.skins);
+ }
+
+
+ {
+ f.Key("scene"); f.GenSerialize(value.scene);
+ }
+
+ if(value.scenes!=null && value.scenes.Count>0)
+ {
+ f.Key("scenes"); f.GenSerialize(value.scenes);
+ }
+
+ if(value.animations!=null && value.animations.Count>0)
+ {
+ f.Key("animations"); f.GenSerialize(value.animations);
+ }
+
+ if(value.cameras!=null && value.cameras.Count>0)
+ {
+ f.Key("cameras"); f.GenSerialize(value.cameras);
+ }
+
+ if(value.extensionsUsed!=null && value.extensionsUsed.Count>0)
+ {
+ f.Key("extensionsUsed"); f.GenSerialize(value.extensionsUsed);
+ }
+
+ if(false && value.extensionsRequired!=null && value.extensionsRequired.Count>0)
+ {
+ f.Key("extensionsRequired"); f.GenSerialize(value.extensionsRequired);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/asset
+ public static void GenSerialize(this IFormatter f, glTFAssets value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.generator!=null)
+ {
+ f.Key("generator"); f.GenSerialize(value.generator);
+ }
+
+ if(value.version!=null)
+ {
+ f.Key("version"); f.GenSerialize(value.version);
+ }
+
+ if(value.copyright!=null)
+ {
+ f.Key("copyright"); f.GenSerialize(value.copyright);
+ }
+
+ if(value.minVersion!=null)
+ {
+ f.Key("minVersion"); f.GenSerialize(value.minVersion);
+ }
+
+ f.EndMap();
+ }
+
+ public static void GenSerialize(this IFormatter f, String value)
+ {
+ f.Value(value);
+ }
+
+ /// gltf/buffers
+ public static void GenSerialize(this IFormatter f, List<glTFBuffer> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/buffers[]
+ public static void GenSerialize(this IFormatter f, glTFBuffer value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.uri!=null)
+ {
+ f.Key("uri"); f.GenSerialize(value.uri);
+ }
+
+
+ {
+ f.Key("byteLength"); f.GenSerialize(value.byteLength);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ public static void GenSerialize(this IFormatter f, Int32 value)
+ {
+ f.Value(value);
+ }
+
+ /// gltf/bufferViews
+ public static void GenSerialize(this IFormatter f, List<glTFBufferView> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/bufferViews[]
+ public static void GenSerialize(this IFormatter f, glTFBufferView value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("buffer"); f.GenSerialize(value.buffer);
+ }
+
+
+ {
+ f.Key("byteOffset"); f.GenSerialize(value.byteOffset);
+ }
+
+
+ {
+ f.Key("byteLength"); f.GenSerialize(value.byteLength);
+ }
+
+ if(value.target!=0)
+ {
+ f.Key("target"); f.GenSerialize(value.target);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ public static void GenSerialize(this IFormatter f, glBufferTarget value)
+ {
+ f.Value((int)value);
+ }
+
+ /// gltf/accessors
+ public static void GenSerialize(this IFormatter f, List<glTFAccessor> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/accessors[]
+ public static void GenSerialize(this IFormatter f, glTFAccessor value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.bufferView>=0)
+ {
+ f.Key("bufferView"); f.GenSerialize(value.bufferView);
+ }
+
+ if(value.bufferView>=0)
+ {
+ f.Key("byteOffset"); f.GenSerialize(value.byteOffset);
+ }
+
+ if(value.type!=null)
+ {
+ f.Key("type"); f.GenSerialize(value.type);
+ }
+
+
+ {
+ f.Key("componentType"); f.GenSerialize(value.componentType);
+ }
+
+
+ {
+ f.Key("count"); f.GenSerialize(value.count);
+ }
+
+ if(value.max!=null && value.max.Length>0)
+ {
+ f.Key("max"); f.GenSerialize(value.max);
+ }
+
+ if(value.min!=null && value.min.Length>0)
+ {
+ f.Key("min"); f.GenSerialize(value.min);
+ }
+
+
+ {
+ f.Key("normalized"); f.GenSerialize(value.normalized);
+ }
+
+ if(value.sparse!=null && value.sparse.count>0)
+ {
+ f.Key("sparse"); f.GenSerialize(value.sparse);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ public static void GenSerialize(this IFormatter f, glComponentType value)
+ {
+ f.Value((int)value);
+ }
+
+ /// gltf/accessors[]/max
+ public static void GenSerialize(this IFormatter f, Single[] value)
+ {
+ f.BeginList(value.Length);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ public static void GenSerialize(this IFormatter f, Single value)
+ {
+ f.Value(value);
+ }
+
+ public static void GenSerialize(this IFormatter f, Boolean value)
+ {
+ f.Value(value);
+ }
+
+ /// gltf/accessors[]/sparse
+ public static void GenSerialize(this IFormatter f, glTFSparse value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("count"); f.GenSerialize(value.count);
+ }
+
+ if(value.indices!=null)
+ {
+ f.Key("indices"); f.GenSerialize(value.indices);
+ }
+
+ if(value.values!=null)
+ {
+ f.Key("values"); f.GenSerialize(value.values);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/accessors[]/sparse/indices
+ public static void GenSerialize(this IFormatter f, glTFSparseIndices value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("bufferView"); f.GenSerialize(value.bufferView);
+ }
+
+
+ {
+ f.Key("byteOffset"); f.GenSerialize(value.byteOffset);
+ }
+
+
+ {
+ f.Key("componentType"); f.GenSerialize(value.componentType);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/accessors[]/sparse/values
+ public static void GenSerialize(this IFormatter f, glTFSparseValues value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("bufferView"); f.GenSerialize(value.bufferView);
+ }
+
+
+ {
+ f.Key("byteOffset"); f.GenSerialize(value.byteOffset);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/textures
+ public static void GenSerialize(this IFormatter f, List<glTFTexture> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/textures[]
+ public static void GenSerialize(this IFormatter f, glTFTexture value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("sampler"); f.GenSerialize(value.sampler);
+ }
+
+
+ {
+ f.Key("source"); f.GenSerialize(value.source);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/samplers
+ public static void GenSerialize(this IFormatter f, List<glTFTextureSampler> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/samplers[]
+ public static void GenSerialize(this IFormatter f, glTFTextureSampler value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("magFilter"); f.GenSerialize(value.magFilter);
+ }
+
+
+ {
+ f.Key("minFilter"); f.GenSerialize(value.minFilter);
+ }
+
+
+ {
+ f.Key("wrapS"); f.GenSerialize(value.wrapS);
+ }
+
+
+ {
+ f.Key("wrapT"); f.GenSerialize(value.wrapT);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ public static void GenSerialize(this IFormatter f, glFilter value)
+ {
+ f.Value((int)value);
+ }
+
+ public static void GenSerialize(this IFormatter f, glWrap value)
+ {
+ f.Value((int)value);
+ }
+
+ /// gltf/images
+ public static void GenSerialize(this IFormatter f, List<glTFImage> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/images[]
+ public static void GenSerialize(this IFormatter f, glTFImage value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.uri!=null)
+ {
+ f.Key("uri"); f.GenSerialize(value.uri);
+ }
+
+
+ {
+ f.Key("bufferView"); f.GenSerialize(value.bufferView);
+ }
+
+ if(value.mimeType!=null)
+ {
+ f.Key("mimeType"); f.GenSerialize(value.mimeType);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials
+ public static void GenSerialize(this IFormatter f, List<glTFMaterial> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/materials[]
+ public static void GenSerialize(this IFormatter f, glTFMaterial value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.pbrMetallicRoughness!=null)
+ {
+ f.Key("pbrMetallicRoughness"); f.GenSerialize(value.pbrMetallicRoughness);
+ }
+
+ if(value.normalTexture!=null)
+ {
+ f.Key("normalTexture"); f.GenSerialize(value.normalTexture);
+ }
+
+ if(value.occlusionTexture!=null)
+ {
+ f.Key("occlusionTexture"); f.GenSerialize(value.occlusionTexture);
+ }
+
+ if(value.emissiveTexture!=null)
+ {
+ f.Key("emissiveTexture"); f.GenSerialize(value.emissiveTexture);
+ }
+
+ if(value.emissiveFactor!=null)
+ {
+ f.Key("emissiveFactor"); f.GenSerialize(value.emissiveFactor);
+ }
+
+ if(value.alphaMode!=null)
+ {
+ f.Key("alphaMode"); f.GenSerialize(value.alphaMode);
+ }
+
+ if(value.alphaMode == "MASK")
+ {
+ f.Key("alphaCutoff"); f.GenSerialize(value.alphaCutoff);
+ }
+
+
+ {
+ f.Key("doubleSided"); f.GenSerialize(value.doubleSided);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/pbrMetallicRoughness
+ public static void GenSerialize(this IFormatter f, glTFPbrMetallicRoughness value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.baseColorTexture!=null)
+ {
+ f.Key("baseColorTexture"); f.GenSerialize(value.baseColorTexture);
+ }
+
+ if(value.baseColorFactor!=null)
+ {
+ f.Key("baseColorFactor"); f.GenSerialize(value.baseColorFactor);
+ }
+
+ if(value.metallicRoughnessTexture!=null)
+ {
+ f.Key("metallicRoughnessTexture"); f.GenSerialize(value.metallicRoughnessTexture);
+ }
+
+
+ {
+ f.Key("metallicFactor"); f.GenSerialize(value.metallicFactor);
+ }
+
+
+ {
+ f.Key("roughnessFactor"); f.GenSerialize(value.roughnessFactor);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/pbrMetallicRoughness/baseColorTexture
+ public static void GenSerialize(this IFormatter f, glTFMaterialBaseColorTextureInfo value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("index"); f.GenSerialize(value.index);
+ }
+
+
+ {
+ f.Key("texCoord"); f.GenSerialize(value.texCoord);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/pbrMetallicRoughness/baseColorTexture/extensions
+ public static void GenSerialize(this IFormatter f, glTFTextureInfo_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.KHR_texture_transform!=null)
+ {
+ f.Key("KHR_texture_transform"); f.GenSerialize(value.KHR_texture_transform);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform
+ public static void GenSerialize(this IFormatter f, glTF_KHR_texture_transform value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.offset!=null)
+ {
+ f.Key("offset"); f.GenSerialize(value.offset);
+ }
+
+
+ {
+ f.Key("rotation"); f.GenSerialize(value.rotation);
+ }
+
+ if(value.scale!=null)
+ {
+ f.Key("scale"); f.GenSerialize(value.scale);
+ }
+
+
+ {
+ f.Key("texCoord"); f.GenSerialize(value.texCoord);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/pbrMetallicRoughness/metallicRoughnessTexture
+ public static void GenSerialize(this IFormatter f, glTFMaterialMetallicRoughnessTextureInfo value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("index"); f.GenSerialize(value.index);
+ }
+
+
+ {
+ f.Key("texCoord"); f.GenSerialize(value.texCoord);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/normalTexture
+ public static void GenSerialize(this IFormatter f, glTFMaterialNormalTextureInfo value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("scale"); f.GenSerialize(value.scale);
+ }
+
+
+ {
+ f.Key("index"); f.GenSerialize(value.index);
+ }
+
+
+ {
+ f.Key("texCoord"); f.GenSerialize(value.texCoord);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/occlusionTexture
+ public static void GenSerialize(this IFormatter f, glTFMaterialOcclusionTextureInfo value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("strength"); f.GenSerialize(value.strength);
+ }
+
+
+ {
+ f.Key("index"); f.GenSerialize(value.index);
+ }
+
+
+ {
+ f.Key("texCoord"); f.GenSerialize(value.texCoord);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/emissiveTexture
+ public static void GenSerialize(this IFormatter f, glTFMaterialEmissiveTextureInfo value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("index"); f.GenSerialize(value.index);
+ }
+
+
+ {
+ f.Key("texCoord"); f.GenSerialize(value.texCoord);
+ }
+
+ if(value.extensions!=null)
+ {
+ f.Key("extensions"); f.GenSerialize(value.extensions);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/extensions
+ public static void GenSerialize(this IFormatter f, glTFMaterial_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.KHR_materials_unlit!=null)
+ {
+ f.Key("KHR_materials_unlit"); f.GenSerialize(value.KHR_materials_unlit);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/materials[]/extensions/KHR_materials_unlit
+ public static void GenSerialize(this IFormatter f, glTF_KHR_materials_unlit value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes
+ public static void GenSerialize(this IFormatter f, List<glTFMesh> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/meshes[]
+ public static void GenSerialize(this IFormatter f, glTFMesh value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.primitives!=null && value.primitives.Count>0)
+ {
+ f.Key("primitives"); f.GenSerialize(value.primitives);
+ }
+
+ if(value.weights!=null && value.weights.Length>0)
+ {
+ f.Key("weights"); f.GenSerialize(value.weights);
+ }
+
+ if(value.extras!=null)
+ {
+ f.Key("extras"); f.GenSerialize(value.extras);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes[]/primitives
+ public static void GenSerialize(this IFormatter f, List<glTFPrimitives> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/meshes[]/primitives[]
+ public static void GenSerialize(this IFormatter f, glTFPrimitives value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("mode"); f.GenSerialize(value.mode);
+ }
+
+
+ {
+ f.Key("indices"); f.GenSerialize(value.indices);
+ }
+
+ if(value.attributes!=null)
+ {
+ f.Key("attributes"); f.GenSerialize(value.attributes);
+ }
+
+
+ {
+ f.Key("material"); f.GenSerialize(value.material);
+ }
+
+ if(value.targets!=null && value.targets.Count>0)
+ {
+ f.Key("targets"); f.GenSerialize(value.targets);
+ }
+
+ if(value.extras!=null && value.extras.targetNames!=null && value.extras.targetNames.Count>0)
+ {
+ f.Key("extras"); f.GenSerialize(value.extras);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes[]/primitives[]/attributes
+ public static void GenSerialize(this IFormatter f, glTFAttributes value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.POSITION!=-1)
+ {
+ f.Key("POSITION"); f.GenSerialize(value.POSITION);
+ }
+
+ if(value.NORMAL!=-1)
+ {
+ f.Key("NORMAL"); f.GenSerialize(value.NORMAL);
+ }
+
+ if(value.TANGENT!=-1)
+ {
+ f.Key("TANGENT"); f.GenSerialize(value.TANGENT);
+ }
+
+ if(value.TEXCOORD_0!=-1)
+ {
+ f.Key("TEXCOORD_0"); f.GenSerialize(value.TEXCOORD_0);
+ }
+
+ if(value.COLOR_0!=-1)
+ {
+ f.Key("COLOR_0"); f.GenSerialize(value.COLOR_0);
+ }
+
+ if(value.JOINTS_0!=-1)
+ {
+ f.Key("JOINTS_0"); f.GenSerialize(value.JOINTS_0);
+ }
+
+ if(value.WEIGHTS_0!=-1)
+ {
+ f.Key("WEIGHTS_0"); f.GenSerialize(value.WEIGHTS_0);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes[]/primitives[]/targets
+ public static void GenSerialize(this IFormatter f, List<gltfMorphTarget> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/meshes[]/primitives[]/targets[]
+ public static void GenSerialize(this IFormatter f, gltfMorphTarget value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.POSITION!=-1)
+ {
+ f.Key("POSITION"); f.GenSerialize(value.POSITION);
+ }
+
+ if(value.NORMAL!=-1)
+ {
+ f.Key("NORMAL"); f.GenSerialize(value.NORMAL);
+ }
+
+ if(value.TANGENT!=-1)
+ {
+ f.Key("TANGENT"); f.GenSerialize(value.TANGENT);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes[]/primitives[]/extras
+ public static void GenSerialize(this IFormatter f, glTFPrimitives_extras value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.targetNames!=null)
+ {
+ f.Key("targetNames"); f.GenSerialize(value.targetNames);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes[]/primitives[]/extras/targetNames
+ public static void GenSerialize(this IFormatter f, List<String> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/meshes[]/primitives[]/extensions
+ public static void GenSerialize(this IFormatter f, glTFPrimitives_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/meshes[]/extras
+ public static void GenSerialize(this IFormatter f, glTFMesh_extras value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.targetNames!=null)
+ {
+ f.Key("targetNames"); f.GenSerialize(value.targetNames);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/nodes
+ public static void GenSerialize(this IFormatter f, List<glTFNode> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/nodes[]
+ public static void GenSerialize(this IFormatter f, glTFNode value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.children != null && value.children.Length>0)
+ {
+ f.Key("children"); f.GenSerialize(value.children);
+ }
+
+ if(value.matrix!=null)
+ {
+ f.Key("matrix"); f.GenSerialize(value.matrix);
+ }
+
+ if(value.translation!=null)
+ {
+ f.Key("translation"); f.GenSerialize(value.translation);
+ }
+
+ if(value.rotation!=null)
+ {
+ f.Key("rotation"); f.GenSerialize(value.rotation);
+ }
+
+ if(value.scale!=null)
+ {
+ f.Key("scale"); f.GenSerialize(value.scale);
+ }
+
+ if(value.mesh!=-1)
+ {
+ f.Key("mesh"); f.GenSerialize(value.mesh);
+ }
+
+ if(value.skin!=-1)
+ {
+ f.Key("skin"); f.GenSerialize(value.skin);
+ }
+
+ if(value.weights!=null)
+ {
+ f.Key("weights"); f.GenSerialize(value.weights);
+ }
+
+ if(value.camera!=-1)
+ {
+ f.Key("camera"); f.GenSerialize(value.camera);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/nodes[]/children
+ public static void GenSerialize(this IFormatter f, Int32[] value)
+ {
+ f.BeginList(value.Length);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/nodes[]/extensions
+ public static void GenSerialize(this IFormatter f, glTFNode_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/nodes[]/extras
+ public static void GenSerialize(this IFormatter f, glTFNode_extra value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/skins
+ public static void GenSerialize(this IFormatter f, List<glTFSkin> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/skins[]
+ public static void GenSerialize(this IFormatter f, glTFSkin value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("inverseBindMatrices"); f.GenSerialize(value.inverseBindMatrices);
+ }
+
+ if(value.joints!=null && value.joints.Length>0)
+ {
+ f.Key("joints"); f.GenSerialize(value.joints);
+ }
+
+ if(value.skeleton!=-1)
+ {
+ f.Key("skeleton"); f.GenSerialize(value.skeleton);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/scenes
+ public static void GenSerialize(this IFormatter f, List<gltfScene> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/scenes[]
+ public static void GenSerialize(this IFormatter f, gltfScene value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.nodes!=null && value.nodes.Length>0)
+ {
+ f.Key("nodes"); f.GenSerialize(value.nodes);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/animations
+ public static void GenSerialize(this IFormatter f, List<glTFAnimation> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/animations[]
+ public static void GenSerialize(this IFormatter f, glTFAnimation value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.channels!=null && value.channels.Count>0)
+ {
+ f.Key("channels"); f.GenSerialize(value.channels);
+ }
+
+ if(value.samplers!=null && value.samplers.Count>0)
+ {
+ f.Key("samplers"); f.GenSerialize(value.samplers);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/animations[]/channels
+ public static void GenSerialize(this IFormatter f, List<glTFAnimationChannel> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/animations[]/channels[]
+ public static void GenSerialize(this IFormatter f, glTFAnimationChannel value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("sampler"); f.GenSerialize(value.sampler);
+ }
+
+ if(value!=null)
+ {
+ f.Key("target"); f.GenSerialize(value.target);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/animations[]/channels[]/target
+ public static void GenSerialize(this IFormatter f, glTFAnimationTarget value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("node"); f.GenSerialize(value.node);
+ }
+
+ if(value.path!=null)
+ {
+ f.Key("path"); f.GenSerialize(value.path);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/animations[]/samplers
+ public static void GenSerialize(this IFormatter f, List<glTFAnimationSampler> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/animations[]/samplers[]
+ public static void GenSerialize(this IFormatter f, glTFAnimationSampler value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("input"); f.GenSerialize(value.input);
+ }
+
+ if(value.interpolation!=null)
+ {
+ f.Key("interpolation"); f.GenSerialize(value.interpolation);
+ }
+
+
+ {
+ f.Key("output"); f.GenSerialize(value.output);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras
+ public static void GenSerialize(this IFormatter f, List<glTFCamera> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/cameras[]
+ public static void GenSerialize(this IFormatter f, glTFCamera value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.orthographic!=null)
+ {
+ f.Key("orthographic"); f.GenSerialize(value.orthographic);
+ }
+
+ if(value.perspective!=null)
+ {
+ f.Key("perspective"); f.GenSerialize(value.perspective);
+ }
+
+
+ {
+ f.Key("type"); f.GenSerialize(value.type);
+ }
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/orthographic
+ public static void GenSerialize(this IFormatter f, glTFOrthographic value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("xmag"); f.GenSerialize(value.xmag);
+ }
+
+
+ {
+ f.Key("ymag"); f.GenSerialize(value.ymag);
+ }
+
+
+ {
+ f.Key("zfar"); f.GenSerialize(value.zfar);
+ }
+
+
+ {
+ f.Key("znear"); f.GenSerialize(value.znear);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/orthographic/extensions
+ public static void GenSerialize(this IFormatter f, glTFOrthographic_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/orthographic/extras
+ public static void GenSerialize(this IFormatter f, glTFOrthographic_extras value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/perspective
+ public static void GenSerialize(this IFormatter f, glTFPerspective value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("aspectRatio"); f.GenSerialize(value.aspectRatio);
+ }
+
+
+ {
+ f.Key("yfov"); f.GenSerialize(value.yfov);
+ }
+
+
+ {
+ f.Key("zfar"); f.GenSerialize(value.zfar);
+ }
+
+
+ {
+ f.Key("znear"); f.GenSerialize(value.znear);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/perspective/extensions
+ public static void GenSerialize(this IFormatter f, glTFPerspective_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/perspective/extras
+ public static void GenSerialize(this IFormatter f, glTFPerspective_extras value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ public static void GenSerialize(this IFormatter f, ProjectionType value)
+ {
+ f.Value((int)value);
+ }
+
+ /// gltf/cameras[]/extensions
+ public static void GenSerialize(this IFormatter f, glTFCamera_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/cameras[]/extras
+ public static void GenSerialize(this IFormatter f, glTFCamera_extras value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions
+ public static void GenSerialize(this IFormatter f, glTF_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.VRM!=null)
+ {
+ f.Key("VRM"); f.GenSerialize(value.VRM);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM
+ public static void GenSerialize(this IFormatter f, glTF_VRM_extensions value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.exporterVersion!=null)
+ {
+ f.Key("exporterVersion"); f.GenSerialize(value.exporterVersion);
+ }
+
+ if(value.specVersion!=null)
+ {
+ f.Key("specVersion"); f.GenSerialize(value.specVersion);
+ }
+
+ if(value.meta!=null)
+ {
+ f.Key("meta"); f.GenSerialize(value.meta);
+ }
+
+ if(value.humanoid!=null)
+ {
+ f.Key("humanoid"); f.GenSerialize(value.humanoid);
+ }
+
+ if(value.firstPerson!=null)
+ {
+ f.Key("firstPerson"); f.GenSerialize(value.firstPerson);
+ }
+
+ if(value.blendShapeMaster!=null)
+ {
+ f.Key("blendShapeMaster"); f.GenSerialize(value.blendShapeMaster);
+ }
+
+ if(value.secondaryAnimation!=null)
+ {
+ f.Key("secondaryAnimation"); f.GenSerialize(value.secondaryAnimation);
+ }
+
+ if(value.materialProperties!=null)
+ {
+ f.Key("materialProperties"); f.GenSerialize(value.materialProperties);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/meta
+ public static void GenSerialize(this IFormatter f, glTF_VRM_Meta value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.title!=null)
+ {
+ f.Key("title"); f.GenSerialize(value.title);
+ }
+
+ if(value.version!=null)
+ {
+ f.Key("version"); f.GenSerialize(value.version);
+ }
+
+ if(value.author!=null)
+ {
+ f.Key("author"); f.GenSerialize(value.author);
+ }
+
+ if(value.contactInformation!=null)
+ {
+ f.Key("contactInformation"); f.GenSerialize(value.contactInformation);
+ }
+
+ if(value.reference!=null)
+ {
+ f.Key("reference"); f.GenSerialize(value.reference);
+ }
+
+
+ {
+ f.Key("texture"); f.GenSerialize(value.texture);
+ }
+
+ if(value.allowedUserName!=null)
+ {
+ f.Key("allowedUserName"); f.GenSerialize(value.allowedUserName);
+ }
+
+ if(value.violentUssageName!=null)
+ {
+ f.Key("violentUssageName"); f.GenSerialize(value.violentUssageName);
+ }
+
+ if(value.sexualUssageName!=null)
+ {
+ f.Key("sexualUssageName"); f.GenSerialize(value.sexualUssageName);
+ }
+
+ if(value.commercialUssageName!=null)
+ {
+ f.Key("commercialUssageName"); f.GenSerialize(value.commercialUssageName);
+ }
+
+ if(value.otherPermissionUrl!=null)
+ {
+ f.Key("otherPermissionUrl"); f.GenSerialize(value.otherPermissionUrl);
+ }
+
+ if(value.licenseName!=null)
+ {
+ f.Key("licenseName"); f.GenSerialize(value.licenseName);
+ }
+
+ if(value.otherLicenseUrl!=null)
+ {
+ f.Key("otherLicenseUrl"); f.GenSerialize(value.otherLicenseUrl);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/humanoid
+ public static void GenSerialize(this IFormatter f, glTF_VRM_Humanoid value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.humanBones!=null)
+ {
+ f.Key("humanBones"); f.GenSerialize(value.humanBones);
+ }
+
+
+ {
+ f.Key("armStretch"); f.GenSerialize(value.armStretch);
+ }
+
+
+ {
+ f.Key("legStretch"); f.GenSerialize(value.legStretch);
+ }
+
+
+ {
+ f.Key("upperArmTwist"); f.GenSerialize(value.upperArmTwist);
+ }
+
+
+ {
+ f.Key("lowerArmTwist"); f.GenSerialize(value.lowerArmTwist);
+ }
+
+
+ {
+ f.Key("upperLegTwist"); f.GenSerialize(value.upperLegTwist);
+ }
+
+
+ {
+ f.Key("lowerLegTwist"); f.GenSerialize(value.lowerLegTwist);
+ }
+
+
+ {
+ f.Key("feetSpacing"); f.GenSerialize(value.feetSpacing);
+ }
+
+
+ {
+ f.Key("hasTranslationDoF"); f.GenSerialize(value.hasTranslationDoF);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/humanoid/humanBones
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_HumanoidBone> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/humanoid/humanBones[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_HumanoidBone value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.bone!=null)
+ {
+ f.Key("bone"); f.GenSerialize(value.bone);
+ }
+
+
+ {
+ f.Key("node"); f.GenSerialize(value.node);
+ }
+
+
+ {
+ f.Key("useDefaultValues"); f.GenSerialize(value.useDefaultValues);
+ }
+
+ if(value.min!=Vector3.zero)
+ {
+ f.Key("min"); f.GenSerialize(value.min);
+ }
+
+ if(value.max!=Vector3.zero)
+ {
+ f.Key("max"); f.GenSerialize(value.max);
+ }
+
+ if(value.center!=Vector3.zero)
+ {
+ f.Key("center"); f.GenSerialize(value.center);
+ }
+
+ if(value.axisLength>0)
+ {
+ f.Key("axisLength"); f.GenSerialize(value.axisLength);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/humanoid/humanBones[]/min
+ public static void GenSerialize(this IFormatter f, Vector3 value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("x"); f.GenSerialize(value.x);
+ }
+
+
+ {
+ f.Key("y"); f.GenSerialize(value.y);
+ }
+
+
+ {
+ f.Key("z"); f.GenSerialize(value.z);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/firstPerson
+ public static void GenSerialize(this IFormatter f, glTF_VRM_Firstperson value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("firstPersonBone"); f.GenSerialize(value.firstPersonBone);
+ }
+
+
+ {
+ f.Key("firstPersonBoneOffset"); f.GenSerialize(value.firstPersonBoneOffset);
+ }
+
+ if(value.meshAnnotations!=null)
+ {
+ f.Key("meshAnnotations"); f.GenSerialize(value.meshAnnotations);
+ }
+
+ if(value.lookAtTypeName!=null)
+ {
+ f.Key("lookAtTypeName"); f.GenSerialize(value.lookAtTypeName);
+ }
+
+ if(value.lookAtHorizontalInner!=null)
+ {
+ f.Key("lookAtHorizontalInner"); f.GenSerialize(value.lookAtHorizontalInner);
+ }
+
+ if(value.lookAtHorizontalOuter!=null)
+ {
+ f.Key("lookAtHorizontalOuter"); f.GenSerialize(value.lookAtHorizontalOuter);
+ }
+
+ if(value.lookAtVerticalDown!=null)
+ {
+ f.Key("lookAtVerticalDown"); f.GenSerialize(value.lookAtVerticalDown);
+ }
+
+ if(value.lookAtVerticalUp!=null)
+ {
+ f.Key("lookAtVerticalUp"); f.GenSerialize(value.lookAtVerticalUp);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/firstPerson/meshAnnotations
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_MeshAnnotation> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/firstPerson/meshAnnotations[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_MeshAnnotation value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("mesh"); f.GenSerialize(value.mesh);
+ }
+
+ if(value.firstPersonFlag!=null)
+ {
+ f.Key("firstPersonFlag"); f.GenSerialize(value.firstPersonFlag);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/firstPerson/lookAtHorizontalInner
+ public static void GenSerialize(this IFormatter f, glTF_VRM_DegreeMap value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.curve!=null)
+ {
+ f.Key("curve"); f.GenSerialize(value.curve);
+ }
+
+
+ {
+ f.Key("xRange"); f.GenSerialize(value.xRange);
+ }
+
+
+ {
+ f.Key("yRange"); f.GenSerialize(value.yRange);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster
+ public static void GenSerialize(this IFormatter f, glTF_VRM_BlendShapeMaster value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.blendShapeGroups!=null)
+ {
+ f.Key("blendShapeGroups"); f.GenSerialize(value.blendShapeGroups);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster/blendShapeGroups
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_BlendShapeGroup> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster/blendShapeGroups[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_BlendShapeGroup value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.presetName!=null)
+ {
+ f.Key("presetName"); f.GenSerialize(value.presetName);
+ }
+
+ if(value.binds!=null)
+ {
+ f.Key("binds"); f.GenSerialize(value.binds);
+ }
+
+ if(value.materialValues!=null)
+ {
+ f.Key("materialValues"); f.GenSerialize(value.materialValues);
+ }
+
+
+ {
+ f.Key("isBinary"); f.GenSerialize(value.isBinary);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster/blendShapeGroups[]/binds
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_BlendShapeBind> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster/blendShapeGroups[]/binds[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_BlendShapeBind value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("mesh"); f.GenSerialize(value.mesh);
+ }
+
+
+ {
+ f.Key("index"); f.GenSerialize(value.index);
+ }
+
+
+ {
+ f.Key("weight"); f.GenSerialize(value.weight);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster/blendShapeGroups[]/materialValues
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_MaterialValueBind> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/blendShapeMaster/blendShapeGroups[]/materialValues[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_MaterialValueBind value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.materialName!=null)
+ {
+ f.Key("materialName"); f.GenSerialize(value.materialName);
+ }
+
+ if(value.propertyName!=null)
+ {
+ f.Key("propertyName"); f.GenSerialize(value.propertyName);
+ }
+
+ if(value.targetValue!=null)
+ {
+ f.Key("targetValue"); f.GenSerialize(value.targetValue);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation
+ public static void GenSerialize(this IFormatter f, glTF_VRM_SecondaryAnimation value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.boneGroups!=null)
+ {
+ f.Key("boneGroups"); f.GenSerialize(value.boneGroups);
+ }
+
+ if(value.colliderGroups!=null)
+ {
+ f.Key("colliderGroups"); f.GenSerialize(value.colliderGroups);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation/boneGroups
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_SecondaryAnimationGroup> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation/boneGroups[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_SecondaryAnimationGroup value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.comment!=null)
+ {
+ f.Key("comment"); f.GenSerialize(value.comment);
+ }
+
+
+ {
+ f.Key("stiffiness"); f.GenSerialize(value.stiffiness);
+ }
+
+
+ {
+ f.Key("gravityPower"); f.GenSerialize(value.gravityPower);
+ }
+
+
+ {
+ f.Key("gravityDir"); f.GenSerialize(value.gravityDir);
+ }
+
+
+ {
+ f.Key("dragForce"); f.GenSerialize(value.dragForce);
+ }
+
+
+ {
+ f.Key("center"); f.GenSerialize(value.center);
+ }
+
+
+ {
+ f.Key("hitRadius"); f.GenSerialize(value.hitRadius);
+ }
+
+ if(value.bones!=null)
+ {
+ f.Key("bones"); f.GenSerialize(value.bones);
+ }
+
+ if(value.colliderGroups!=null)
+ {
+ f.Key("colliderGroups"); f.GenSerialize(value.colliderGroups);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation/colliderGroups
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_SecondaryAnimationColliderGroup> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation/colliderGroups[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_SecondaryAnimationColliderGroup value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("node"); f.GenSerialize(value.node);
+ }
+
+ if(value.colliders!=null)
+ {
+ f.Key("colliders"); f.GenSerialize(value.colliders);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation/colliderGroups[]/colliders
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_SecondaryAnimationCollider> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/secondaryAnimation/colliderGroups[]/colliders[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_SecondaryAnimationCollider value)
+ {
+ f.BeginMap(0); // dummy
+
+
+ {
+ f.Key("offset"); f.GenSerialize(value.offset);
+ }
+
+
+ {
+ f.Key("radius"); f.GenSerialize(value.radius);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/materialProperties
+ public static void GenSerialize(this IFormatter f, List<glTF_VRM_Material> value)
+ {
+ f.BeginList(value.Count);
+ foreach (var x in value)
+ {
+ f.GenSerialize(x);
+ }
+ f.EndList();
+ }
+
+ /// gltf/extensions/VRM/materialProperties[]
+ public static void GenSerialize(this IFormatter f, glTF_VRM_Material value)
+ {
+ f.BeginMap(0); // dummy
+
+ if(value.name!=null)
+ {
+ f.Key("name"); f.GenSerialize(value.name);
+ }
+
+ if(value.shader!=null)
+ {
+ f.Key("shader"); f.GenSerialize(value.shader);
+ }
+
+
+ {
+ f.Key("renderQueue"); f.GenSerialize(value.renderQueue);
+ }
+
+ if(value.floatProperties!=null)
+ {
+ f.Key("floatProperties"); f.GenSerialize(value.floatProperties);
+ }
+
+ if(value.vectorProperties!=null)
+ {
+ f.Key("vectorProperties"); f.GenSerialize(value.vectorProperties);
+ }
+
+ if(value.textureProperties!=null)
+ {
+ f.Key("textureProperties"); f.GenSerialize(value.textureProperties);
+ }
+
+ if(value.keywordMap!=null)
+ {
+ f.Key("keywordMap"); f.GenSerialize(value.keywordMap);
+ }
+
+ if(value.tagMap!=null)
+ {
+ f.Key("tagMap"); f.GenSerialize(value.tagMap);
+ }
+
+ f.EndMap();
+ }
+
+ /// gltf/extensions/VRM/materialProperties[]/floatProperties
+ public static void GenSerialize(this IFormatter f, Dictionary<string, Single> value)
+ {
+ f.BeginMap(value.Count);
+ foreach (var kv in value)
+ {
+ f.Key(kv.Key);
+ f.GenSerialize(kv.Value);
+ }
+ f.EndMap();
+ }
+
+
+ /// gltf/extensions/VRM/materialProperties[]/vectorProperties
+ public static void GenSerialize(this IFormatter f, Dictionary<string, Single[]> value)
+ {
+ f.BeginMap(value.Count);
+ foreach (var kv in value)
+ {
+ f.Key(kv.Key);
+ f.GenSerialize(kv.Value);
+ }
+ f.EndMap();
+ }
+
+
+ /// gltf/extensions/VRM/materialProperties[]/textureProperties
+ public static void GenSerialize(this IFormatter f, Dictionary<string, Int32> value)
+ {
+ f.BeginMap(value.Count);
+ foreach (var kv in value)
+ {
+ f.Key(kv.Key);
+ f.GenSerialize(kv.Value);
+ }
+ f.EndMap();
+ }
+
+
+ /// gltf/extensions/VRM/materialProperties[]/keywordMap
+ public static void GenSerialize(this IFormatter f, Dictionary<string, Boolean> value)
+ {
+ f.BeginMap(value.Count);
+ foreach (var kv in value)
+ {
+ f.Key(kv.Key);
+ f.GenSerialize(kv.Value);
+ }
+ f.EndMap();
+ }
+
+
+ /// gltf/extensions/VRM/materialProperties[]/tagMap
+ public static void GenSerialize(this IFormatter f, Dictionary<string, String> value)
+ {
+ f.BeginMap(value.Count);
+ foreach (var kv in value)
+ {
+ f.Key(kv.Key);
+ f.GenSerialize(kv.Value);
+ }
+ f.EndMap();
+ }
+
+
+ /// gltf/extras
+ public static void GenSerialize(this IFormatter f, gltf_extras value)
+ {
+ f.BeginMap(0); // dummy
+
+ f.EndMap();
+ }
+
+ } // class
+} // namespace
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs.meta
new file mode 100644
index 00000000..71ef3c0a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/FormatterExtensionsGltf.g.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 972f1c538db788042863a4ac753dbc04
+timeCreated: 1564987956
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs
new file mode 100644
index 00000000..a2bf59bb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs
@@ -0,0 +1,3175 @@
+
+using UniJSON;
+using System;
+using System.Collections.Generic;
+using VRM;
+using UnityEngine;
+
+namespace UniGLTF {
+
+public static class GltfDeserializer
+{
+
+
+public static glTF Deserialize(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="asset"){
+ value.asset = Deserialize_gltf_asset(kv.Value);
+ continue;
+ }
+
+ if(key=="buffers"){
+ value.buffers = Deserialize_gltf_buffers(kv.Value);
+ continue;
+ }
+
+ if(key=="bufferViews"){
+ value.bufferViews = Deserialize_gltf_bufferViews(kv.Value);
+ continue;
+ }
+
+ if(key=="accessors"){
+ value.accessors = Deserialize_gltf_accessors(kv.Value);
+ continue;
+ }
+
+ if(key=="textures"){
+ value.textures = Deserialize_gltf_textures(kv.Value);
+ continue;
+ }
+
+ if(key=="samplers"){
+ value.samplers = Deserialize_gltf_samplers(kv.Value);
+ continue;
+ }
+
+ if(key=="images"){
+ value.images = Deserialize_gltf_images(kv.Value);
+ continue;
+ }
+
+ if(key=="materials"){
+ value.materials = Deserialize_gltf_materials(kv.Value);
+ continue;
+ }
+
+ if(key=="meshes"){
+ value.meshes = Deserialize_gltf_meshes(kv.Value);
+ continue;
+ }
+
+ if(key=="nodes"){
+ value.nodes = Deserialize_gltf_nodes(kv.Value);
+ continue;
+ }
+
+ if(key=="skins"){
+ value.skins = Deserialize_gltf_skins(kv.Value);
+ continue;
+ }
+
+ if(key=="scene"){
+ value.scene = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="scenes"){
+ value.scenes = Deserialize_gltf_scenes(kv.Value);
+ continue;
+ }
+
+ if(key=="animations"){
+ value.animations = Deserialize_gltf_animations(kv.Value);
+ continue;
+ }
+
+ if(key=="cameras"){
+ value.cameras = Deserialize_gltf_cameras(kv.Value);
+ continue;
+ }
+
+ if(key=="extensionsUsed"){
+ value.extensionsUsed = Deserialize_gltf_extensionsUsed(kv.Value);
+ continue;
+ }
+
+ if(key=="extensionsRequired"){
+ value.extensionsRequired = Deserialize_gltf_extensionsRequired(kv.Value);
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_extensions(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_extras(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFAssets Deserialize_gltf_asset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAssets();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="generator"){
+ value.generator = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="version"){
+ value.version = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="copyright"){
+ value.copyright = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="minVersion"){
+ value.minVersion = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFBuffer> Deserialize_gltf_buffers(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFBuffer>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_buffers_LIST(x));
+ }
+ return value;
+}
+public static glTFBuffer Deserialize_gltf_buffers_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFBuffer();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="uri"){
+ value.uri = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="byteLength"){
+ value.byteLength = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFBufferView> Deserialize_gltf_bufferViews(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFBufferView>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_bufferViews_LIST(x));
+ }
+ return value;
+}
+public static glTFBufferView Deserialize_gltf_bufferViews_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFBufferView();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="buffer"){
+ value.buffer = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="byteOffset"){
+ value.byteOffset = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="byteLength"){
+ value.byteLength = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="byteStride"){
+ value.byteStride = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="target"){
+ value.target = (glBufferTarget)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFAccessor> Deserialize_gltf_accessors(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFAccessor>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_accessors_LIST(x));
+ }
+ return value;
+}
+public static glTFAccessor Deserialize_gltf_accessors_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAccessor();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="bufferView"){
+ value.bufferView = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="byteOffset"){
+ value.byteOffset = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="type"){
+ value.type = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="componentType"){
+ value.componentType = (glComponentType)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="count"){
+ value.count = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="max"){
+ value.max = Deserialize_gltf_accessors__max(kv.Value);
+ continue;
+ }
+
+ if(key=="min"){
+ value.min = Deserialize_gltf_accessors__min(kv.Value);
+ continue;
+ }
+
+ if(key=="normalized"){
+ value.normalized = kv.Value.GetBoolean();
+ continue;
+ }
+
+ if(key=="sparse"){
+ value.sparse = Deserialize_gltf_accessors__sparse(kv.Value);
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_accessors__max(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_accessors__min(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFSparse Deserialize_gltf_accessors__sparse(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFSparse();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="count"){
+ value.count = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="indices"){
+ value.indices = Deserialize_gltf_accessors__sparse_indices(kv.Value);
+ continue;
+ }
+
+ if(key=="values"){
+ value.values = Deserialize_gltf_accessors__sparse_values(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFSparseIndices Deserialize_gltf_accessors__sparse_indices(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFSparseIndices();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="bufferView"){
+ value.bufferView = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="byteOffset"){
+ value.byteOffset = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="componentType"){
+ value.componentType = (glComponentType)kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFSparseValues Deserialize_gltf_accessors__sparse_values(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFSparseValues();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="bufferView"){
+ value.bufferView = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="byteOffset"){
+ value.byteOffset = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFTexture> Deserialize_gltf_textures(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFTexture>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_textures_LIST(x));
+ }
+ return value;
+}
+public static glTFTexture Deserialize_gltf_textures_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTexture();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="sampler"){
+ value.sampler = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="source"){
+ value.source = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFTextureSampler> Deserialize_gltf_samplers(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFTextureSampler>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_samplers_LIST(x));
+ }
+ return value;
+}
+public static glTFTextureSampler Deserialize_gltf_samplers_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTextureSampler();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="magFilter"){
+ value.magFilter = (glFilter)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="minFilter"){
+ value.minFilter = (glFilter)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="wrapS"){
+ value.wrapS = (glWrap)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="wrapT"){
+ value.wrapT = (glWrap)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFImage> Deserialize_gltf_images(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFImage>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_images_LIST(x));
+ }
+ return value;
+}
+public static glTFImage Deserialize_gltf_images_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFImage();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="uri"){
+ value.uri = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="bufferView"){
+ value.bufferView = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="mimeType"){
+ value.mimeType = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFMaterial> Deserialize_gltf_materials(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFMaterial>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_materials_LIST(x));
+ }
+ return value;
+}
+public static glTFMaterial Deserialize_gltf_materials_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterial();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="pbrMetallicRoughness"){
+ value.pbrMetallicRoughness = Deserialize_gltf_materials__pbrMetallicRoughness(kv.Value);
+ continue;
+ }
+
+ if(key=="normalTexture"){
+ value.normalTexture = Deserialize_gltf_materials__normalTexture(kv.Value);
+ continue;
+ }
+
+ if(key=="occlusionTexture"){
+ value.occlusionTexture = Deserialize_gltf_materials__occlusionTexture(kv.Value);
+ continue;
+ }
+
+ if(key=="emissiveTexture"){
+ value.emissiveTexture = Deserialize_gltf_materials__emissiveTexture(kv.Value);
+ continue;
+ }
+
+ if(key=="emissiveFactor"){
+ value.emissiveFactor = Deserialize_gltf_materials__emissiveFactor(kv.Value);
+ continue;
+ }
+
+ if(key=="alphaMode"){
+ value.alphaMode = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="alphaCutoff"){
+ value.alphaCutoff = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="doubleSided"){
+ value.doubleSided = kv.Value.GetBoolean();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_materials__extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFPbrMetallicRoughness Deserialize_gltf_materials__pbrMetallicRoughness(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPbrMetallicRoughness();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="baseColorTexture"){
+ value.baseColorTexture = Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture(kv.Value);
+ continue;
+ }
+
+ if(key=="baseColorFactor"){
+ value.baseColorFactor = Deserialize_gltf_materials__pbrMetallicRoughness_baseColorFactor(kv.Value);
+ continue;
+ }
+
+ if(key=="metallicRoughnessTexture"){
+ value.metallicRoughnessTexture = Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture(kv.Value);
+ continue;
+ }
+
+ if(key=="metallicFactor"){
+ value.metallicFactor = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="roughnessFactor"){
+ value.roughnessFactor = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFMaterialBaseColorTextureInfo Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterialBaseColorTextureInfo();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="index"){
+ value.index = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFTextureInfo_extensions Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTextureInfo_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="KHR_texture_transform"){
+ value.KHR_texture_transform = Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions_KHR_texture_transform(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_KHR_texture_transform Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions_KHR_texture_transform(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_KHR_texture_transform();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="offset"){
+ value.offset = Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions_KHR_texture_transform_offset(kv.Value);
+ continue;
+ }
+
+ if(key=="rotation"){
+ value.rotation = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="scale"){
+ value.scale = Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions_KHR_texture_transform_scale(kv.Value);
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions_KHR_texture_transform_offset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__pbrMetallicRoughness_baseColorTexture_extensions_KHR_texture_transform_scale(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__pbrMetallicRoughness_baseColorFactor(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFMaterialMetallicRoughnessTextureInfo Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterialMetallicRoughnessTextureInfo();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="index"){
+ value.index = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFTextureInfo_extensions Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTextureInfo_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="KHR_texture_transform"){
+ value.KHR_texture_transform = Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions_KHR_texture_transform(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_KHR_texture_transform Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions_KHR_texture_transform(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_KHR_texture_transform();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="offset"){
+ value.offset = Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions_KHR_texture_transform_offset(kv.Value);
+ continue;
+ }
+
+ if(key=="rotation"){
+ value.rotation = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="scale"){
+ value.scale = Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions_KHR_texture_transform_scale(kv.Value);
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions_KHR_texture_transform_offset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__pbrMetallicRoughness_metallicRoughnessTexture_extensions_KHR_texture_transform_scale(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFMaterialNormalTextureInfo Deserialize_gltf_materials__normalTexture(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterialNormalTextureInfo();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="scale"){
+ value.scale = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="index"){
+ value.index = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_materials__normalTexture_extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFTextureInfo_extensions Deserialize_gltf_materials__normalTexture_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTextureInfo_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="KHR_texture_transform"){
+ value.KHR_texture_transform = Deserialize_gltf_materials__normalTexture_extensions_KHR_texture_transform(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_KHR_texture_transform Deserialize_gltf_materials__normalTexture_extensions_KHR_texture_transform(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_KHR_texture_transform();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="offset"){
+ value.offset = Deserialize_gltf_materials__normalTexture_extensions_KHR_texture_transform_offset(kv.Value);
+ continue;
+ }
+
+ if(key=="rotation"){
+ value.rotation = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="scale"){
+ value.scale = Deserialize_gltf_materials__normalTexture_extensions_KHR_texture_transform_scale(kv.Value);
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__normalTexture_extensions_KHR_texture_transform_offset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__normalTexture_extensions_KHR_texture_transform_scale(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFMaterialOcclusionTextureInfo Deserialize_gltf_materials__occlusionTexture(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterialOcclusionTextureInfo();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="strength"){
+ value.strength = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="index"){
+ value.index = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_materials__occlusionTexture_extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFTextureInfo_extensions Deserialize_gltf_materials__occlusionTexture_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTextureInfo_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="KHR_texture_transform"){
+ value.KHR_texture_transform = Deserialize_gltf_materials__occlusionTexture_extensions_KHR_texture_transform(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_KHR_texture_transform Deserialize_gltf_materials__occlusionTexture_extensions_KHR_texture_transform(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_KHR_texture_transform();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="offset"){
+ value.offset = Deserialize_gltf_materials__occlusionTexture_extensions_KHR_texture_transform_offset(kv.Value);
+ continue;
+ }
+
+ if(key=="rotation"){
+ value.rotation = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="scale"){
+ value.scale = Deserialize_gltf_materials__occlusionTexture_extensions_KHR_texture_transform_scale(kv.Value);
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__occlusionTexture_extensions_KHR_texture_transform_offset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__occlusionTexture_extensions_KHR_texture_transform_scale(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFMaterialEmissiveTextureInfo Deserialize_gltf_materials__emissiveTexture(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterialEmissiveTextureInfo();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="index"){
+ value.index = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_materials__emissiveTexture_extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFTextureInfo_extensions Deserialize_gltf_materials__emissiveTexture_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFTextureInfo_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="KHR_texture_transform"){
+ value.KHR_texture_transform = Deserialize_gltf_materials__emissiveTexture_extensions_KHR_texture_transform(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_KHR_texture_transform Deserialize_gltf_materials__emissiveTexture_extensions_KHR_texture_transform(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_KHR_texture_transform();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="offset"){
+ value.offset = Deserialize_gltf_materials__emissiveTexture_extensions_KHR_texture_transform_offset(kv.Value);
+ continue;
+ }
+
+ if(key=="rotation"){
+ value.rotation = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="scale"){
+ value.scale = Deserialize_gltf_materials__emissiveTexture_extensions_KHR_texture_transform_scale(kv.Value);
+ continue;
+ }
+
+ if(key=="texCoord"){
+ value.texCoord = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__emissiveTexture_extensions_KHR_texture_transform_offset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__emissiveTexture_extensions_KHR_texture_transform_scale(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_materials__emissiveFactor(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFMaterial_extensions Deserialize_gltf_materials__extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMaterial_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="KHR_materials_unlit"){
+ value.KHR_materials_unlit = Deserialize_gltf_materials__extensions_KHR_materials_unlit(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_KHR_materials_unlit Deserialize_gltf_materials__extensions_KHR_materials_unlit(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_KHR_materials_unlit();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFMesh> Deserialize_gltf_meshes(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFMesh>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_meshes_LIST(x));
+ }
+ return value;
+}
+public static glTFMesh Deserialize_gltf_meshes_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMesh();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="primitives"){
+ value.primitives = Deserialize_gltf_meshes__primitives(kv.Value);
+ continue;
+ }
+
+ if(key=="weights"){
+ value.weights = Deserialize_gltf_meshes__weights(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_meshes__extras(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFPrimitives> Deserialize_gltf_meshes__primitives(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFPrimitives>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_meshes__primitives_LIST(x));
+ }
+ return value;
+}
+public static glTFPrimitives Deserialize_gltf_meshes__primitives_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPrimitives();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="mode"){
+ value.mode = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="indices"){
+ value.indices = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="attributes"){
+ value.attributes = Deserialize_gltf_meshes__primitives__attributes(kv.Value);
+ continue;
+ }
+
+ if(key=="material"){
+ value.material = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="targets"){
+ value.targets = Deserialize_gltf_meshes__primitives__targets(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_meshes__primitives__extras(kv.Value);
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_meshes__primitives__extensions(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFAttributes Deserialize_gltf_meshes__primitives__attributes(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAttributes();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="POSITION"){
+ value.POSITION = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="NORMAL"){
+ value.NORMAL = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="TANGENT"){
+ value.TANGENT = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="TEXCOORD_0"){
+ value.TEXCOORD_0 = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="COLOR_0"){
+ value.COLOR_0 = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="JOINTS_0"){
+ value.JOINTS_0 = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="WEIGHTS_0"){
+ value.WEIGHTS_0 = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.gltfMorphTarget> Deserialize_gltf_meshes__primitives__targets(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<gltfMorphTarget>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_meshes__primitives__targets_LIST(x));
+ }
+ return value;
+}
+public static gltfMorphTarget Deserialize_gltf_meshes__primitives__targets_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new gltfMorphTarget();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="POSITION"){
+ value.POSITION = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="NORMAL"){
+ value.NORMAL = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="TANGENT"){
+ value.TANGENT = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFPrimitives_extras Deserialize_gltf_meshes__primitives__extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPrimitives_extras();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="targetNames"){
+ value.targetNames = Deserialize_gltf_meshes__primitives__extras_targetNames(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<System.String> Deserialize_gltf_meshes__primitives__extras_targetNames(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<String>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(x.GetString());
+ }
+ return value;
+}
+public static glTFPrimitives_extensions Deserialize_gltf_meshes__primitives__extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPrimitives_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_meshes__weights(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFMesh_extras Deserialize_gltf_meshes__extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFMesh_extras();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="targetNames"){
+ value.targetNames = Deserialize_gltf_meshes__extras_targetNames(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<System.String> Deserialize_gltf_meshes__extras_targetNames(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<String>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(x.GetString());
+ }
+ return value;
+}
+public static List<UniGLTF.glTFNode> Deserialize_gltf_nodes(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFNode>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_nodes_LIST(x));
+ }
+ return value;
+}
+public static glTFNode Deserialize_gltf_nodes_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFNode();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="children"){
+ value.children = Deserialize_gltf_nodes__children(kv.Value);
+ continue;
+ }
+
+ if(key=="matrix"){
+ value.matrix = Deserialize_gltf_nodes__matrix(kv.Value);
+ continue;
+ }
+
+ if(key=="translation"){
+ value.translation = Deserialize_gltf_nodes__translation(kv.Value);
+ continue;
+ }
+
+ if(key=="rotation"){
+ value.rotation = Deserialize_gltf_nodes__rotation(kv.Value);
+ continue;
+ }
+
+ if(key=="scale"){
+ value.scale = Deserialize_gltf_nodes__scale(kv.Value);
+ continue;
+ }
+
+ if(key=="mesh"){
+ value.mesh = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="skin"){
+ value.skin = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="weights"){
+ value.weights = Deserialize_gltf_nodes__weights(kv.Value);
+ continue;
+ }
+
+ if(key=="camera"){
+ value.camera = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_nodes__extensions(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_nodes__extras(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Int32[] Deserialize_gltf_nodes__children(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Int32[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetInt32();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_nodes__matrix(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_nodes__translation(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_nodes__rotation(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_nodes__scale(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_nodes__weights(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTFNode_extensions Deserialize_gltf_nodes__extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFNode_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static glTFNode_extra Deserialize_gltf_nodes__extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFNode_extra();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFSkin> Deserialize_gltf_skins(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFSkin>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_skins_LIST(x));
+ }
+ return value;
+}
+public static glTFSkin Deserialize_gltf_skins_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFSkin();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="inverseBindMatrices"){
+ value.inverseBindMatrices = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="joints"){
+ value.joints = Deserialize_gltf_skins__joints(kv.Value);
+ continue;
+ }
+
+ if(key=="skeleton"){
+ value.skeleton = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Int32[] Deserialize_gltf_skins__joints(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Int32[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetInt32();
+ }
+ return value;
+}
+
+public static List<UniGLTF.gltfScene> Deserialize_gltf_scenes(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<gltfScene>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_scenes_LIST(x));
+ }
+ return value;
+}
+public static gltfScene Deserialize_gltf_scenes_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new gltfScene();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="nodes"){
+ value.nodes = Deserialize_gltf_scenes__nodes(kv.Value);
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Int32[] Deserialize_gltf_scenes__nodes(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Int32[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetInt32();
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFAnimation> Deserialize_gltf_animations(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFAnimation>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_animations_LIST(x));
+ }
+ return value;
+}
+public static glTFAnimation Deserialize_gltf_animations_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAnimation();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="channels"){
+ value.channels = Deserialize_gltf_animations__channels(kv.Value);
+ continue;
+ }
+
+ if(key=="samplers"){
+ value.samplers = Deserialize_gltf_animations__samplers(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFAnimationChannel> Deserialize_gltf_animations__channels(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFAnimationChannel>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_animations__channels_LIST(x));
+ }
+ return value;
+}
+public static glTFAnimationChannel Deserialize_gltf_animations__channels_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAnimationChannel();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="sampler"){
+ value.sampler = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="target"){
+ value.target = Deserialize_gltf_animations__channels__target(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFAnimationTarget Deserialize_gltf_animations__channels__target(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAnimationTarget();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="node"){
+ value.node = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="path"){
+ value.path = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFAnimationSampler> Deserialize_gltf_animations__samplers(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFAnimationSampler>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_animations__samplers_LIST(x));
+ }
+ return value;
+}
+public static glTFAnimationSampler Deserialize_gltf_animations__samplers_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFAnimationSampler();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="input"){
+ value.input = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="interpolation"){
+ value.interpolation = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="output"){
+ value.output = kv.Value.GetInt32();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<UniGLTF.glTFCamera> Deserialize_gltf_cameras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTFCamera>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_cameras_LIST(x));
+ }
+ return value;
+}
+public static glTFCamera Deserialize_gltf_cameras_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFCamera();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="orthographic"){
+ value.orthographic = Deserialize_gltf_cameras__orthographic(kv.Value);
+ continue;
+ }
+
+ if(key=="perspective"){
+ value.perspective = Deserialize_gltf_cameras__perspective(kv.Value);
+ continue;
+ }
+
+ if(key=="type"){
+ value.type = (ProjectionType)kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_cameras__extensions(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_cameras__extras(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFOrthographic Deserialize_gltf_cameras__orthographic(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFOrthographic();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="xmag"){
+ value.xmag = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="ymag"){
+ value.ymag = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="zfar"){
+ value.zfar = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="znear"){
+ value.znear = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_cameras__orthographic_extensions(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_cameras__orthographic_extras(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFOrthographic_extensions Deserialize_gltf_cameras__orthographic_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFOrthographic_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static glTFOrthographic_extras Deserialize_gltf_cameras__orthographic_extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFOrthographic_extras();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static glTFPerspective Deserialize_gltf_cameras__perspective(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPerspective();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="aspectRatio"){
+ value.aspectRatio = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="yfov"){
+ value.yfov = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="zfar"){
+ value.zfar = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="znear"){
+ value.znear = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="extensions"){
+ value.extensions = Deserialize_gltf_cameras__perspective_extensions(kv.Value);
+ continue;
+ }
+
+ if(key=="extras"){
+ value.extras = Deserialize_gltf_cameras__perspective_extras(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTFPerspective_extensions Deserialize_gltf_cameras__perspective_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPerspective_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static glTFPerspective_extras Deserialize_gltf_cameras__perspective_extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFPerspective_extras();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static glTFCamera_extensions Deserialize_gltf_cameras__extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFCamera_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static glTFCamera_extras Deserialize_gltf_cameras__extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTFCamera_extras();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+public static List<System.String> Deserialize_gltf_extensionsUsed(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<String>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(x.GetString());
+ }
+ return value;
+}
+public static List<System.String> Deserialize_gltf_extensionsRequired(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<String>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(x.GetString());
+ }
+ return value;
+}
+public static glTF_extensions Deserialize_gltf_extensions(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="VRM"){
+ value.VRM = Deserialize_gltf_extensions_VRM(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_VRM_extensions Deserialize_gltf_extensions_VRM(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_extensions();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="exporterVersion"){
+ value.exporterVersion = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="specVersion"){
+ value.specVersion = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="meta"){
+ value.meta = Deserialize_gltf_extensions_VRM_meta(kv.Value);
+ continue;
+ }
+
+ if(key=="humanoid"){
+ value.humanoid = Deserialize_gltf_extensions_VRM_humanoid(kv.Value);
+ continue;
+ }
+
+ if(key=="firstPerson"){
+ value.firstPerson = Deserialize_gltf_extensions_VRM_firstPerson(kv.Value);
+ continue;
+ }
+
+ if(key=="blendShapeMaster"){
+ value.blendShapeMaster = Deserialize_gltf_extensions_VRM_blendShapeMaster(kv.Value);
+ continue;
+ }
+
+ if(key=="secondaryAnimation"){
+ value.secondaryAnimation = Deserialize_gltf_extensions_VRM_secondaryAnimation(kv.Value);
+ continue;
+ }
+
+ if(key=="materialProperties"){
+ value.materialProperties = Deserialize_gltf_extensions_VRM_materialProperties(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_VRM_Meta Deserialize_gltf_extensions_VRM_meta(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_Meta();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="title"){
+ value.title = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="version"){
+ value.version = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="author"){
+ value.author = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="contactInformation"){
+ value.contactInformation = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="reference"){
+ value.reference = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="texture"){
+ value.texture = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="allowedUserName"){
+ value.allowedUserName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="violentUssageName"){
+ value.violentUssageName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="sexualUssageName"){
+ value.sexualUssageName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="commercialUssageName"){
+ value.commercialUssageName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="otherPermissionUrl"){
+ value.otherPermissionUrl = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="licenseName"){
+ value.licenseName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="otherLicenseUrl"){
+ value.otherLicenseUrl = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_VRM_Humanoid Deserialize_gltf_extensions_VRM_humanoid(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_Humanoid();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="humanBones"){
+ value.humanBones = Deserialize_gltf_extensions_VRM_humanoid_humanBones(kv.Value);
+ continue;
+ }
+
+ if(key=="armStretch"){
+ value.armStretch = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="legStretch"){
+ value.legStretch = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="upperArmTwist"){
+ value.upperArmTwist = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="lowerArmTwist"){
+ value.lowerArmTwist = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="upperLegTwist"){
+ value.upperLegTwist = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="lowerLegTwist"){
+ value.lowerLegTwist = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="feetSpacing"){
+ value.feetSpacing = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="hasTranslationDoF"){
+ value.hasTranslationDoF = kv.Value.GetBoolean();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_HumanoidBone> Deserialize_gltf_extensions_VRM_humanoid_humanBones(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_HumanoidBone>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_humanoid_humanBones_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_HumanoidBone Deserialize_gltf_extensions_VRM_humanoid_humanBones_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_HumanoidBone();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="bone"){
+ value.bone = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="node"){
+ value.node = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="useDefaultValues"){
+ value.useDefaultValues = kv.Value.GetBoolean();
+ continue;
+ }
+
+ if(key=="min"){
+ value.min = Deserialize_gltf_extensions_VRM_humanoid_humanBones__min(kv.Value);
+ continue;
+ }
+
+ if(key=="max"){
+ value.max = Deserialize_gltf_extensions_VRM_humanoid_humanBones__max(kv.Value);
+ continue;
+ }
+
+ if(key=="center"){
+ value.center = Deserialize_gltf_extensions_VRM_humanoid_humanBones__center(kv.Value);
+ continue;
+ }
+
+ if(key=="axisLength"){
+ value.axisLength = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Vector3 Deserialize_gltf_extensions_VRM_humanoid_humanBones__min(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Vector3();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="x"){
+ value.x = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="y"){
+ value.y = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="z"){
+ value.z = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Vector3 Deserialize_gltf_extensions_VRM_humanoid_humanBones__max(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Vector3();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="x"){
+ value.x = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="y"){
+ value.y = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="z"){
+ value.z = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Vector3 Deserialize_gltf_extensions_VRM_humanoid_humanBones__center(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Vector3();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="x"){
+ value.x = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="y"){
+ value.y = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="z"){
+ value.z = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_VRM_Firstperson Deserialize_gltf_extensions_VRM_firstPerson(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_Firstperson();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="firstPersonBone"){
+ value.firstPersonBone = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="firstPersonBoneOffset"){
+ value.firstPersonBoneOffset = Deserialize_gltf_extensions_VRM_firstPerson_firstPersonBoneOffset(kv.Value);
+ continue;
+ }
+
+ if(key=="meshAnnotations"){
+ value.meshAnnotations = Deserialize_gltf_extensions_VRM_firstPerson_meshAnnotations(kv.Value);
+ continue;
+ }
+
+ if(key=="lookAtTypeName"){
+ value.lookAtTypeName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="lookAtHorizontalInner"){
+ value.lookAtHorizontalInner = Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalInner(kv.Value);
+ continue;
+ }
+
+ if(key=="lookAtHorizontalOuter"){
+ value.lookAtHorizontalOuter = Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalOuter(kv.Value);
+ continue;
+ }
+
+ if(key=="lookAtVerticalDown"){
+ value.lookAtVerticalDown = Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalDown(kv.Value);
+ continue;
+ }
+
+ if(key=="lookAtVerticalUp"){
+ value.lookAtVerticalUp = Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalUp(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Vector3 Deserialize_gltf_extensions_VRM_firstPerson_firstPersonBoneOffset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Vector3();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="x"){
+ value.x = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="y"){
+ value.y = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="z"){
+ value.z = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_MeshAnnotation> Deserialize_gltf_extensions_VRM_firstPerson_meshAnnotations(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_MeshAnnotation>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_firstPerson_meshAnnotations_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_MeshAnnotation Deserialize_gltf_extensions_VRM_firstPerson_meshAnnotations_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_MeshAnnotation();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="mesh"){
+ value.mesh = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="firstPersonFlag"){
+ value.firstPersonFlag = kv.Value.GetString();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static glTF_VRM_DegreeMap Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalInner(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_DegreeMap();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="curve"){
+ value.curve = Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalInner_curve(kv.Value);
+ continue;
+ }
+
+ if(key=="xRange"){
+ value.xRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="yRange"){
+ value.yRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalInner_curve(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTF_VRM_DegreeMap Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalOuter(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_DegreeMap();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="curve"){
+ value.curve = Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalOuter_curve(kv.Value);
+ continue;
+ }
+
+ if(key=="xRange"){
+ value.xRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="yRange"){
+ value.yRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_extensions_VRM_firstPerson_lookAtHorizontalOuter_curve(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTF_VRM_DegreeMap Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalDown(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_DegreeMap();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="curve"){
+ value.curve = Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalDown_curve(kv.Value);
+ continue;
+ }
+
+ if(key=="xRange"){
+ value.xRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="yRange"){
+ value.yRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalDown_curve(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTF_VRM_DegreeMap Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalUp(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_DegreeMap();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="curve"){
+ value.curve = Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalUp_curve(kv.Value);
+ continue;
+ }
+
+ if(key=="xRange"){
+ value.xRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="yRange"){
+ value.yRange = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_extensions_VRM_firstPerson_lookAtVerticalUp_curve(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTF_VRM_BlendShapeMaster Deserialize_gltf_extensions_VRM_blendShapeMaster(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_BlendShapeMaster();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="blendShapeGroups"){
+ value.blendShapeGroups = Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_BlendShapeGroup> Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_BlendShapeGroup>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_BlendShapeGroup Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_BlendShapeGroup();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="presetName"){
+ value.presetName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="binds"){
+ value.binds = Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__binds(kv.Value);
+ continue;
+ }
+
+ if(key=="materialValues"){
+ value.materialValues = Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__materialValues(kv.Value);
+ continue;
+ }
+
+ if(key=="isBinary"){
+ value.isBinary = kv.Value.GetBoolean();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_BlendShapeBind> Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__binds(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_BlendShapeBind>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__binds_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_BlendShapeBind Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__binds_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_BlendShapeBind();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="mesh"){
+ value.mesh = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="index"){
+ value.index = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="weight"){
+ value.weight = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_MaterialValueBind> Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__materialValues(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_MaterialValueBind>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__materialValues_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_MaterialValueBind Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__materialValues_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_MaterialValueBind();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="materialName"){
+ value.materialName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="propertyName"){
+ value.propertyName = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="targetValue"){
+ value.targetValue = Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__materialValues__targetValue(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_extensions_VRM_blendShapeMaster_blendShapeGroups__materialValues__targetValue(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+public static glTF_VRM_SecondaryAnimation Deserialize_gltf_extensions_VRM_secondaryAnimation(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_SecondaryAnimation();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="boneGroups"){
+ value.boneGroups = Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups(kv.Value);
+ continue;
+ }
+
+ if(key=="colliderGroups"){
+ value.colliderGroups = Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_SecondaryAnimationGroup> Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_SecondaryAnimationGroup>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_SecondaryAnimationGroup Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_SecondaryAnimationGroup();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="comment"){
+ value.comment = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="stiffiness"){
+ value.stiffiness = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="gravityPower"){
+ value.gravityPower = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="gravityDir"){
+ value.gravityDir = Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups__gravityDir(kv.Value);
+ continue;
+ }
+
+ if(key=="dragForce"){
+ value.dragForce = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="center"){
+ value.center = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="hitRadius"){
+ value.hitRadius = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="bones"){
+ value.bones = Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups__bones(kv.Value);
+ continue;
+ }
+
+ if(key=="colliderGroups"){
+ value.colliderGroups = Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups__colliderGroups(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Vector3 Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups__gravityDir(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Vector3();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="x"){
+ value.x = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="y"){
+ value.y = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="z"){
+ value.z = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Int32[] Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups__bones(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Int32[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetInt32();
+ }
+ return value;
+}
+
+public static Int32[] Deserialize_gltf_extensions_VRM_secondaryAnimation_boneGroups__colliderGroups(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Int32[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetInt32();
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_SecondaryAnimationColliderGroup> Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_SecondaryAnimationColliderGroup>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_SecondaryAnimationColliderGroup Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_SecondaryAnimationColliderGroup();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="node"){
+ value.node = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="colliders"){
+ value.colliders = Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups__colliders(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_SecondaryAnimationCollider> Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups__colliders(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_SecondaryAnimationCollider>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups__colliders_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_SecondaryAnimationCollider Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups__colliders_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_SecondaryAnimationCollider();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="offset"){
+ value.offset = Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups__colliders__offset(kv.Value);
+ continue;
+ }
+
+ if(key=="radius"){
+ value.radius = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static Vector3 Deserialize_gltf_extensions_VRM_secondaryAnimation_colliderGroups__colliders__offset(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Vector3();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="x"){
+ value.x = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="y"){
+ value.y = kv.Value.GetSingle();
+ continue;
+ }
+
+ if(key=="z"){
+ value.z = kv.Value.GetSingle();
+ continue;
+ }
+
+ }
+ return value;
+}
+
+public static List<VRM.glTF_VRM_Material> Deserialize_gltf_extensions_VRM_materialProperties(ListTreeNode<JsonValue> parsed)
+{
+ var value = new List<glTF_VRM_Material>();
+ foreach(var x in parsed.ArrayItems())
+ {
+ value.Add(Deserialize_gltf_extensions_VRM_materialProperties_LIST(x));
+ }
+ return value;
+}
+public static glTF_VRM_Material Deserialize_gltf_extensions_VRM_materialProperties_LIST(ListTreeNode<JsonValue> parsed)
+{
+ var value = new glTF_VRM_Material();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ if(key=="name"){
+ value.name = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="shader"){
+ value.shader = kv.Value.GetString();
+ continue;
+ }
+
+ if(key=="renderQueue"){
+ value.renderQueue = kv.Value.GetInt32();
+ continue;
+ }
+
+ if(key=="floatProperties"){
+ value.floatProperties = Deserialize_gltf_extensions_VRM_materialProperties__floatProperties(kv.Value);
+ continue;
+ }
+
+ if(key=="vectorProperties"){
+ value.vectorProperties = Deserialize_gltf_extensions_VRM_materialProperties__vectorProperties(kv.Value);
+ continue;
+ }
+
+ if(key=="textureProperties"){
+ value.textureProperties = Deserialize_gltf_extensions_VRM_materialProperties__textureProperties(kv.Value);
+ continue;
+ }
+
+ if(key=="keywordMap"){
+ value.keywordMap = Deserialize_gltf_extensions_VRM_materialProperties__keywordMap(kv.Value);
+ continue;
+ }
+
+ if(key=="tagMap"){
+ value.tagMap = Deserialize_gltf_extensions_VRM_materialProperties__tagMap(kv.Value);
+ continue;
+ }
+
+ }
+ return value;
+}
+
+
+public static Dictionary<String, Single> Deserialize_gltf_extensions_VRM_materialProperties__floatProperties(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Dictionary<string, Single>();
+ foreach(var kv in parsed.ObjectItems())
+ {
+ value.Add(kv.Key.GetString(), kv.Value.GetSingle());
+ }
+ return value;
+}
+
+
+public static Dictionary<String, Single[]> Deserialize_gltf_extensions_VRM_materialProperties__vectorProperties(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Dictionary<string, Single[]>();
+ foreach(var kv in parsed.ObjectItems())
+ {
+ value.Add(kv.Key.GetString(), Deserialize_gltf_extensions_VRM_materialProperties__vectorProperties_DICT(kv.Value));
+ }
+ return value;
+}
+
+public static Single[] Deserialize_gltf_extensions_VRM_materialProperties__vectorProperties_DICT(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Single[parsed.GetArrayCount()];
+ int i=0;
+ foreach(var x in parsed.ArrayItems())
+ {
+ value[i++] = x.GetSingle();
+ }
+ return value;
+}
+
+
+public static Dictionary<String, Int32> Deserialize_gltf_extensions_VRM_materialProperties__textureProperties(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Dictionary<string, Int32>();
+ foreach(var kv in parsed.ObjectItems())
+ {
+ value.Add(kv.Key.GetString(), kv.Value.GetInt32());
+ }
+ return value;
+}
+
+
+public static Dictionary<String, Boolean> Deserialize_gltf_extensions_VRM_materialProperties__keywordMap(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Dictionary<string, Boolean>();
+ foreach(var kv in parsed.ObjectItems())
+ {
+ value.Add(kv.Key.GetString(), kv.Value.GetBoolean());
+ }
+ return value;
+}
+
+
+public static Dictionary<String, String> Deserialize_gltf_extensions_VRM_materialProperties__tagMap(ListTreeNode<JsonValue> parsed)
+{
+ var value = new Dictionary<string, String>();
+ foreach(var kv in parsed.ObjectItems())
+ {
+ value.Add(kv.Key.GetString(), kv.Value.GetString());
+ }
+ return value;
+}
+
+public static gltf_extras Deserialize_gltf_extras(ListTreeNode<JsonValue> parsed)
+{
+ var value = new gltf_extras();
+
+ foreach(var kv in parsed.ObjectItems())
+ {
+ var key = kv.Key.GetString();
+
+ }
+ return value;
+}
+
+} // GltfDeserializer
+} // UniGLTF
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs.meta
new file mode 100644
index 00000000..557bd37b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/GltfDeserializer.g.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: fd51f973e67cbb448bab93da7ea596a8
+timeCreated: 1565245501
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs
new file mode 100644
index 00000000..58543932
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs
@@ -0,0 +1,74 @@
+using System;
+using System.IO;
+
+
+namespace UniGLTF
+{
+ public interface IStorage
+ {
+ ArraySegment<Byte> Get(string url);
+
+ /// <summary>
+ /// Get original filepath if exists
+ /// </summary>
+ /// <param name="url"></param>
+ /// <returns></returns>
+ string GetPath(string url);
+ }
+
+ public class SimpleStorage : IStorage
+ {
+ ArraySegment<Byte> m_bytes;
+
+ public SimpleStorage():this(new ArraySegment<byte>())
+ {
+ }
+
+ public SimpleStorage(ArraySegment<Byte> bytes)
+ {
+ m_bytes = bytes;
+ }
+
+ public ArraySegment<byte> Get(string url)
+ {
+ return m_bytes;
+ }
+
+ public string GetPath(string url)
+ {
+ return null;
+ }
+ }
+
+ public class FileSystemStorage : IStorage
+ {
+ string m_root;
+
+ public FileSystemStorage(string root)
+ {
+ m_root = Path.GetFullPath(root);
+ }
+
+ public ArraySegment<byte> Get(string url)
+ {
+ var bytes =
+ (url.StartsWith("data:"))
+ ? UriByteBuffer.ReadEmbedded(url)
+ : File.ReadAllBytes(Path.Combine(m_root, url))
+ ;
+ return new ArraySegment<byte>(bytes);
+ }
+
+ public string GetPath(string url)
+ {
+ if (url.StartsWith("data:"))
+ {
+ return null;
+ }
+ else
+ {
+ return Path.Combine(m_root, url).Replace("\\", "/");
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs.meta
new file mode 100644
index 00000000..0eb53f3c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/IStorage.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9cb8b6f878e36a74f90d172daee60bed
+timeCreated: 1529327531
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs
new file mode 100644
index 00000000..0da87dba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs
@@ -0,0 +1,1128 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UnityEngine;
+using System.IO;
+using System.Text;
+using System.Collections;
+using DepthFirstScheduler;
+using UniJSON;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+#if ((NET_4_6 || NET_STANDARD_2_0) && UNITY_2017_1_OR_NEWER)
+using System.Threading.Tasks;
+#endif
+
+
+namespace UniGLTF
+{
+ /// <summary>
+ /// GLTF importer
+ /// </summary>
+ public class ImporterContext : IDisposable
+ {
+ #region MeasureTime
+ bool m_showSpeedLog
+#if VRM_DEVELOP
+ = true
+#endif
+ ;
+ public bool ShowSpeedLog
+ {
+ set { m_showSpeedLog = value; }
+ }
+
+ public struct KeyElapsed
+ {
+ public string Key;
+ public TimeSpan Elapsed;
+ public KeyElapsed(string key, TimeSpan elapsed)
+ {
+ Key = key;
+ Elapsed = elapsed;
+ }
+ }
+
+ public struct MeasureScope : IDisposable
+ {
+ Action m_onDispose;
+ public MeasureScope(Action onDispose)
+ {
+ m_onDispose = onDispose;
+ }
+ public void Dispose()
+ {
+ m_onDispose();
+ }
+ }
+
+ public List<KeyElapsed> m_speedReports = new List<KeyElapsed>();
+
+ public IDisposable MeasureTime(string key)
+ {
+ var sw = System.Diagnostics.Stopwatch.StartNew();
+ return new MeasureScope(() =>
+ {
+ m_speedReports.Add(new KeyElapsed(key, sw.Elapsed));
+ });
+ }
+
+ public string GetSpeedLog()
+ {
+ var total = TimeSpan.Zero;
+
+ var sb = new StringBuilder();
+ sb.AppendLine("【SpeedLog】");
+ foreach (var kv in m_speedReports)
+ {
+ sb.AppendLine(string.Format("{0}: {1}ms", kv.Key, (int)kv.Elapsed.TotalMilliseconds));
+ total += kv.Elapsed;
+ }
+ sb.AppendLine(string.Format("total: {0}ms", (int)total.TotalMilliseconds));
+
+ return sb.ToString();
+ }
+ #endregion
+
+ IShaderStore m_shaderStore;
+ public IShaderStore ShaderStore
+ {
+ get
+ {
+ if (m_shaderStore == null)
+ {
+ m_shaderStore = new ShaderStore(this);
+ }
+ return m_shaderStore;
+ }
+ }
+
+ IMaterialImporter m_materialImporter;
+ protected void SetMaterialImporter(IMaterialImporter importer)
+ {
+ m_materialImporter = importer;
+ }
+ public IMaterialImporter MaterialImporter
+ {
+ get
+ {
+ if (m_materialImporter == null)
+ {
+ m_materialImporter = new MaterialImporter(ShaderStore, (int index) => this.GetTexture(index));
+ }
+ return m_materialImporter;
+ }
+ }
+
+ public ImporterContext(IShaderStore shaderStore)
+ {
+ m_shaderStore = shaderStore;
+ }
+
+ public ImporterContext(IMaterialImporter materialImporter)
+ {
+ m_materialImporter = materialImporter;
+ }
+
+ public ImporterContext()
+ {
+ }
+
+ #region Source
+
+ /// <summary>
+ /// JSON source
+ /// </summary>
+ public String Json;
+
+ /// <summary>
+ /// GLTF parsed from JSON
+ /// </summary>
+ public glTF GLTF; // parsed
+
+ public static bool IsGeneratedUniGLTFAndOlderThan(string generatorVersion, int major, int minor)
+ {
+ if (string.IsNullOrEmpty(generatorVersion)) return false;
+ if (generatorVersion == "UniGLTF") return true;
+ if (!generatorVersion.StartsWith("UniGLTF-")) return false;
+
+ try
+ {
+ var index = generatorVersion.IndexOf('.');
+ var generatorMajor = int.Parse(generatorVersion.Substring(8, index - 8));
+ var generatorMinor = int.Parse(generatorVersion.Substring(index + 1));
+
+ if (generatorMajor < major)
+ {
+ return true;
+ }
+ else
+ {
+ if (generatorMinor >= minor)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.LogWarningFormat("{0}: {1}", generatorVersion, ex);
+ return false;
+ }
+ }
+
+ public bool IsGeneratedUniGLTFAndOlder(int major, int minor)
+ {
+ if (GLTF == null) return false;
+ if (GLTF.asset == null) return false;
+ return IsGeneratedUniGLTFAndOlderThan(GLTF.asset.generator, major, minor);
+ }
+
+ /// <summary>
+ /// URI access
+ /// </summary>
+ public IStorage Storage;
+ #endregion
+
+ #region Parse
+ public void Parse(string path)
+ {
+ Parse(path, File.ReadAllBytes(path));
+ }
+
+ /// <summary>
+ /// Parse gltf json or Parse json chunk of glb
+ /// </summary>
+ /// <param name="path"></param>
+ /// <param name="bytes"></param>
+ public virtual void Parse(string path, Byte[] bytes)
+ {
+ var ext = Path.GetExtension(path).ToLower();
+ switch (ext)
+ {
+ case ".gltf":
+ ParseJson(Encoding.UTF8.GetString(bytes), new FileSystemStorage(Path.GetDirectoryName(path)));
+ break;
+
+ case ".zip":
+ {
+ var zipArchive = Zip.ZipArchiveStorage.Parse(bytes);
+ var gltf = zipArchive.Entries.FirstOrDefault(x => x.FileName.ToLower().EndsWith(".gltf"));
+ if (gltf == null)
+ {
+ throw new Exception("no gltf in archive");
+ }
+ var jsonBytes = zipArchive.Extract(gltf);
+ var json = Encoding.UTF8.GetString(jsonBytes);
+ ParseJson(json, zipArchive);
+ }
+ break;
+
+ case ".glb":
+ ParseGlb(bytes);
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="bytes"></param>
+ public void ParseGlb(Byte[] bytes)
+ {
+ var chunks = glbImporter.ParseGlbChunks(bytes);
+
+ if (chunks.Count != 2)
+ {
+ throw new Exception("unknown chunk count: " + chunks.Count);
+ }
+
+ if (chunks[0].ChunkType != GlbChunkType.JSON)
+ {
+ throw new Exception("chunk 0 is not JSON");
+ }
+
+ if (chunks[1].ChunkType != GlbChunkType.BIN)
+ {
+ throw new Exception("chunk 1 is not BIN");
+ }
+
+ try
+ {
+ var jsonBytes = chunks[0].Bytes;
+ ParseJson(Encoding.UTF8.GetString(jsonBytes.Array, jsonBytes.Offset, jsonBytes.Count),
+ new SimpleStorage(chunks[1].Bytes));
+ }
+ catch (StackOverflowException ex)
+ {
+ throw new Exception("[UniVRM Import Error] json parsing failed, nesting is too deep.\n" + ex);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ private SerializerTypes _serializerType = SerializerTypes.Generated;
+ public SerializerTypes SerializerType { get { return _serializerType; } set { _serializerType = value; } }
+
+ public virtual void ParseJson(string json, IStorage storage)
+ {
+ Json = json;
+ Storage = storage;
+
+ if (_serializerType == SerializerTypes.UniJSON)
+ {
+ // Obsolete
+ Json.ParseAsJson().Deserialize(ref GLTF);
+ }
+ else if (_serializerType == SerializerTypes.Generated)
+ {
+ GLTF = GltfDeserializer.Deserialize(json.ParseAsJson());
+ }
+ else if (_serializerType == SerializerTypes.JsonSerializable)
+ {
+ // Obsolete
+ GLTF = JsonUtility.FromJson<glTF>(Json);
+ }
+
+ if (GLTF.asset.version != "2.0")
+ {
+ throw new UniGLTFException("unknown gltf version {0}", GLTF.asset.version);
+ }
+
+ // Version Compatibility
+ RestoreOlderVersionValues();
+
+ FixUnique();
+
+ // parepare byte buffer
+ //GLTF.baseDir = System.IO.Path.GetDirectoryName(Path);
+ foreach (var buffer in GLTF.buffers)
+ {
+ buffer.OpenStorage(storage);
+ }
+ }
+
+ static string MakeUniqueName(string name, HashSet<string> used)
+ {
+ for (var i = 0; i < 100; ++i)
+ {
+ name = $"{name}_{i}";
+ if (!used.Contains(name))
+ {
+ return name;
+ }
+ }
+
+ throw new Exception("hobo arienai");
+ }
+
+ void FixUnique()
+ {
+ var used = new HashSet<string>();
+ foreach (var mesh in GLTF.meshes)
+ {
+ if (string.IsNullOrEmpty(mesh.name))
+ {
+ mesh.name = Guid.NewGuid().ToString();
+ }
+ var lname = mesh.name.ToLower();
+ if (used.Contains(lname))
+ {
+ // rename
+ var uname = MakeUniqueName(lname, used);
+ Debug.LogWarning($"same name: {lname} => {uname}");
+ mesh.name = uname;
+ lname = uname;
+ }
+
+ used.Add(lname);
+ }
+ }
+
+ void RestoreOlderVersionValues()
+ {
+ var parsed = UniJSON.JsonParser.Parse(Json);
+ for (int i = 0; i < GLTF.images.Count; ++i)
+ {
+ if (string.IsNullOrEmpty(GLTF.images[i].name))
+ {
+ try
+ {
+ var extraName = parsed["images"][i]["extra"]["name"].Value.GetString();
+ if (!string.IsNullOrEmpty(extraName))
+ {
+ //Debug.LogFormat("restore texturename: {0}", extraName);
+ GLTF.images[i].name = extraName;
+ }
+ }
+ catch (Exception)
+ {
+ // do nothing
+ }
+ }
+ }
+ for (int i = 0; i < GLTF.meshes.Count; ++i)
+ {
+ var mesh = GLTF.meshes[i];
+ try
+ {
+ for (int j = 0; j < mesh.primitives.Count; ++j)
+ {
+ var primitive = mesh.primitives[j];
+ for (int k = 0; k < primitive.targets.Count; ++k)
+ {
+ var extraName = parsed["meshes"][i]["primitives"][j]["targets"][k]["extra"]["name"].Value.GetString();
+ //Debug.LogFormat("restore morphName: {0}", extraName);
+ primitive.extras.targetNames.Add(extraName);
+ }
+ }
+ }
+ catch (Exception)
+ {
+ // do nothing
+ }
+ }
+#if false
+ for (int i = 0; i < GLTF.nodes.Count; ++i)
+ {
+ var node = GLTF.nodes[i];
+ try
+ {
+ var extra = parsed["nodes"][i]["extra"]["skinRootBone"].AsInt;
+ //Debug.LogFormat("restore extra: {0}", extra);
+ //node.extras.skinRootBone = extra;
+ }
+ catch (Exception)
+ {
+ // do nothing
+ }
+ }
+#endif
+ }
+ #endregion
+
+ #region Load. Build unity objects
+
+ public bool EnableLoadBalancing;
+
+ /// <summary>
+ /// ReadAllBytes, Parse, Create GameObject
+ /// </summary>
+ /// <param name="path">allbytes</param>
+ public void Load(string path)
+ {
+ var bytes = File.ReadAllBytes(path);
+ Load(path, bytes);
+ }
+
+ /// <summary>
+ /// Parse, Create GameObject
+ /// </summary>
+ /// <param name="path">gltf or glb path</param>
+ /// <param name="bytes">allbytes</param>
+ public void Load(string path, byte[] bytes)
+ {
+ Parse(path, bytes);
+ Load();
+ Root.name = Path.GetFileNameWithoutExtension(path);
+ }
+
+ public virtual ITextureLoader CreateTextureLoader(int index)
+ {
+#if UNIGLTF_USE_WEBREQUEST_TEXTURELOADER
+ return new UnityWebRequestTextureLoader(index);
+#else
+ return new TextureLoader(index);
+#endif
+ }
+
+ public void CreateTextureItems(UnityPath imageBaseDir = default(UnityPath))
+ {
+ if (m_textures.Any())
+ {
+ return;
+ }
+
+ for (int i = 0; i < GLTF.textures.Count; ++i)
+ {
+
+ TextureItem item = null;
+#if UNITY_EDITOR
+ var image = GLTF.GetImageFromTextureIndex(i);
+ if (imageBaseDir.IsUnderAssetsFolder
+ && !string.IsNullOrEmpty(image.uri)
+ && !image.uri.StartsWith("data:")
+ )
+ {
+ ///
+ /// required SaveTexturesAsPng or SetTextureBaseDir
+ ///
+ var assetPath = imageBaseDir.Child(image.uri);
+ var textureName = !string.IsNullOrEmpty(image.name) ? image.name : Path.GetFileNameWithoutExtension(image.uri);
+ item = new TextureItem(i, assetPath, textureName);
+ }
+ else
+#endif
+ {
+ item = new TextureItem(i, CreateTextureLoader(i));
+ }
+
+ AddTexture(item);
+ }
+ }
+
+ /// <summary>
+ /// Build unity objects from parsed gltf
+ /// </summary>
+ public void Load()
+ {
+ var schedulable = LoadAsync();
+ schedulable.ExecuteAll();
+ }
+
+ [Obsolete("Action<Unit> to Action")]
+ public IEnumerator LoadCoroutine(Action<Unit> onLoaded, Action<Exception> onError = null)
+ {
+ return LoadCoroutine(() => onLoaded(Unit.Default), onError);
+ }
+
+ public IEnumerator LoadCoroutine(Action<Exception> onError = null)
+ {
+ return LoadCoroutine(() => { }, onError);
+ }
+
+ public IEnumerator LoadCoroutine(Action onLoaded, Action<Exception> onError = null)
+ {
+ if (onLoaded == null)
+ {
+ onLoaded = () => { };
+ }
+
+ if (onError == null)
+ {
+ onError = Debug.LogError;
+ }
+
+ var schedulable = LoadAsync();
+ foreach (var x in schedulable.GetRoot().Traverse())
+ {
+ while (true)
+ {
+ var status = x.Execute();
+ if (status != ExecutionStatus.Continue)
+ {
+ break;
+ }
+ yield return null;
+ }
+ }
+
+ onLoaded();
+ }
+
+ [Obsolete("Action<Unit> to Action")]
+ public void LoadAsync(Action<Unit> onLoaded, Action<Exception> onError = null)
+ {
+ LoadAsync(() => onLoaded(Unit.Default), onError);
+ }
+
+ public void LoadAsync(Action onLoaded, Action<Exception> onError = null)
+ {
+ if (onError == null)
+ {
+ onError = Debug.LogError;
+ }
+
+ LoadAsync()
+ .Subscribe(Scheduler.MainThread,
+ _ => onLoaded(),
+ onError
+ );
+ }
+
+#if ((NET_4_6 || NET_STANDARD_2_0) && UNITY_2017_1_OR_NEWER && !UNITY_WEBGL)
+ public async Task<GameObject> LoadAsyncTask()
+ {
+ await LoadAsync().ToTask();
+ return Root;
+ }
+#endif
+
+ protected virtual Schedulable<Unit> LoadAsync()
+ {
+ return
+ Schedulable.Create()
+ .AddTask(Scheduler.ThreadPool, () =>
+ {
+ if (m_textures.Count == 0)
+ {
+ //
+ // runtime
+ //
+ CreateTextureItems();
+ }
+ else
+ {
+ //
+ // already CreateTextures(by assetPostProcessor or editor menu)
+ //
+ }
+ })
+ .ContinueWithCoroutine(Scheduler.ThreadPool, TexturesProcessOnAnyThread)
+ .ContinueWithCoroutine(Scheduler.MainThread, TexturesProcessOnMainThread)
+ .ContinueWithCoroutine(Scheduler.MainThread, LoadMaterials)
+ .OnExecute(Scheduler.ThreadPool, parent =>
+ {
+ // UniGLTF does not support draco
+ // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md#conformance
+ if (GLTF.extensionsRequired.Contains("KHR_draco_mesh_compression"))
+ {
+ throw new UniGLTFNotSupportedException("draco is not supported");
+ }
+
+ // meshes
+ var meshImporter = new MeshImporter();
+ for (int i = 0; i < GLTF.meshes.Count; ++i)
+ {
+ var index = i;
+ parent.AddTask(Scheduler.ThreadPool,
+ () =>
+ {
+ using (MeasureTime("ReadMesh"))
+ {
+ return meshImporter.ReadMesh(this, index);
+ }
+ })
+ .ContinueWithCoroutine<MeshWithMaterials>(Scheduler.MainThread, x => BuildMesh(x, index))
+ .ContinueWith(Scheduler.ThreadPool, x => Meshes.Add(x))
+ ;
+ }
+ })
+ .ContinueWithCoroutine(Scheduler.MainThread, LoadNodes)
+ .ContinueWithCoroutine(Scheduler.MainThread, BuildHierarchy)
+ .ContinueWith(Scheduler.MainThread, _ =>
+ {
+ using (MeasureTime("AnimationImporter"))
+ {
+ AnimationImporter.ImportAnimation(this);
+ }
+ })
+ .ContinueWithCoroutine(Scheduler.MainThread, OnLoadModel)
+ .ContinueWith(Scheduler.CurrentThread,
+ _ =>
+ {
+ if (m_showSpeedLog)
+ {
+ Debug.Log(GetSpeedLog());
+ }
+ return Unit.Default;
+ });
+ }
+
+ protected virtual IEnumerator OnLoadModel()
+ {
+ Root.name = "GLTF";
+ yield break;
+ }
+
+ IEnumerator TexturesProcessOnAnyThread()
+ {
+ using (MeasureTime("TexturesProcessOnAnyThread"))
+ {
+ foreach (var x in GetTextures())
+ {
+ x.ProcessOnAnyThread(GLTF, Storage);
+ yield return null;
+ }
+ }
+ }
+
+ IEnumerator TexturesProcessOnMainThread()
+ {
+ using (MeasureTime("TexturesProcessOnMainThread"))
+ {
+ foreach (var x in GetTextures())
+ {
+ yield return x.ProcessOnMainThreadCoroutine(GLTF);
+ }
+ }
+ }
+
+ IEnumerator LoadMaterials()
+ {
+ using (MeasureTime("LoadMaterials"))
+ {
+ if (GLTF.materials == null || !GLTF.materials.Any())
+ {
+ AddMaterial(MaterialImporter.CreateMaterial(0, null, false));
+ }
+ else
+ {
+ for (int i = 0; i < GLTF.materials.Count; ++i)
+ {
+ AddMaterial(MaterialImporter.CreateMaterial(i, GLTF.materials[i], GLTF.MaterialHasVertexColor(i)));
+ }
+ }
+ }
+ yield return null;
+ }
+
+ IEnumerator BuildMesh(MeshImporter.MeshContext x, int i)
+ {
+ using (MeasureTime("BuildMesh"))
+ {
+ MeshWithMaterials meshWithMaterials;
+ if (EnableLoadBalancing)
+ {
+ var buildMesh = MeshImporter.BuildMeshCoroutine(this, x);
+ yield return buildMesh;
+ meshWithMaterials = buildMesh.Current as MeshWithMaterials;
+ }
+ else
+ {
+ meshWithMaterials = MeshImporter.BuildMesh(this, x);
+ }
+
+ var mesh = meshWithMaterials.Mesh;
+
+ // mesh name
+ if (string.IsNullOrEmpty(mesh.name))
+ {
+ mesh.name = string.Format("UniGLTF import#{0}", i);
+ }
+ var originalName = mesh.name;
+ for (int j = 1; Meshes.Any(y => y.Mesh.name == mesh.name); ++j)
+ {
+ mesh.name = string.Format("{0}({1})", originalName, j);
+ }
+
+ yield return meshWithMaterials;
+ }
+ }
+
+ IEnumerator LoadMeshes()
+ {
+ var meshImporter = new MeshImporter();
+ for (int i = 0; i < GLTF.meshes.Count; ++i)
+ {
+ var meshContext = meshImporter.ReadMesh(this, i);
+ var meshWithMaterials = MeshImporter.BuildMesh(this, meshContext);
+ var mesh = meshWithMaterials.Mesh;
+ if (string.IsNullOrEmpty(mesh.name))
+ {
+ mesh.name = string.Format("UniGLTF import#{0}", i);
+ }
+ Meshes.Add(meshWithMaterials);
+
+ yield return null;
+ }
+ }
+
+ IEnumerator LoadNodes()
+ {
+ using (MeasureTime("LoadNodes"))
+ {
+ for (int i = 0; i < GLTF.nodes.Count; i++)
+ {
+ Nodes.Add(NodeImporter.ImportNode(GLTF.nodes[i], i).transform);
+ }
+ }
+
+ yield return null;
+ }
+
+ IEnumerator BuildHierarchy()
+ {
+ using (MeasureTime("BuildHierarchy"))
+ {
+ var nodes = new List<NodeImporter.TransformWithSkin>();
+ for (int i = 0; i < Nodes.Count; ++i)
+ {
+ nodes.Add(NodeImporter.BuildHierarchy(this, i));
+ }
+
+ NodeImporter.FixCoordinate(this, nodes);
+
+ // skinning
+ for (int i = 0; i < nodes.Count; ++i)
+ {
+ NodeImporter.SetupSkinning(this, nodes, i);
+ }
+
+ // connect root
+ if (Root == null)
+ {
+ Root = new GameObject("_root_");
+ }
+ foreach (var x in GLTF.rootnodes)
+ {
+ var t = nodes[x].Transform;
+ t.SetParent(Root.transform, false);
+ }
+ }
+
+ yield return null;
+ }
+ #endregion
+
+ #region Imported
+ public GameObject Root;
+ public List<Transform> Nodes = new List<Transform>();
+
+ List<TextureItem> m_textures = new List<TextureItem>();
+ public IList<TextureItem> GetTextures()
+ {
+ return m_textures;
+ }
+ public TextureItem GetTexture(int i)
+ {
+ if (i < 0 || i >= m_textures.Count)
+ {
+ return null;
+ }
+ return m_textures[i];
+ }
+ public void AddTexture(TextureItem item)
+ {
+ m_textures.Add(item);
+ }
+
+ List<Material> m_materials = new List<Material>();
+ public void AddMaterial(Material material)
+ {
+ var originalName = material.name;
+ int j = 2;
+ while (m_materials.Any(x => x.name == material.name))
+ {
+ material.name = string.Format("{0}({1})", originalName, j++);
+ }
+ m_materials.Add(material);
+ }
+ public IList<Material> GetMaterials()
+ {
+ return m_materials;
+ }
+ public Material GetMaterial(int index)
+ {
+ if (index < 0) return null;
+ if (index >= m_materials.Count) return null;
+ return m_materials[index];
+ }
+
+ public List<MeshWithMaterials> Meshes = new List<MeshWithMaterials>();
+ public void ShowMeshes()
+ {
+ foreach (var x in Meshes)
+ {
+ foreach (var y in x.Renderers)
+ {
+ y.enabled = true;
+ }
+ }
+ }
+
+ public void EnableUpdateWhenOffscreen()
+ {
+ foreach (var x in Meshes)
+ {
+ foreach (var r in x.Renderers)
+ {
+ var skinnedMeshRenderer = r as SkinnedMeshRenderer;
+ if (skinnedMeshRenderer != null)
+ {
+ skinnedMeshRenderer.updateWhenOffscreen = true;
+ }
+ }
+ }
+ }
+
+ public List<AnimationClip> AnimationClips = new List<AnimationClip>();
+ #endregion
+
+ protected virtual IEnumerable<UnityEngine.Object> ObjectsForSubAsset()
+ {
+ HashSet<Texture2D> textures = new HashSet<Texture2D>();
+ foreach (var x in m_textures.SelectMany(y => y.GetTexturesForSaveAssets()))
+ {
+ if (!textures.Contains(x))
+ {
+ textures.Add(x);
+ }
+ }
+ foreach (var x in textures) { yield return x; }
+ foreach (var x in m_materials) { yield return x; }
+ foreach (var x in Meshes) { yield return x.Mesh; }
+ foreach (var x in AnimationClips) { yield return x; }
+ }
+
+#if UNITY_EDITOR
+ #region Assets
+ public bool MeshAsSubAsset = false;
+
+ protected virtual UnityPath GetAssetPath(UnityPath prefabPath, UnityEngine.Object o)
+ {
+ if (o is Material)
+ {
+ var materialDir = prefabPath.GetAssetFolder(".Materials");
+ var materialPath = materialDir.Child(o.name.EscapeFilePath() + ".asset");
+ return materialPath;
+ }
+ else if (o is Texture2D)
+ {
+ var textureDir = prefabPath.GetAssetFolder(".Textures");
+ var texturePath = textureDir.Child(o.name.EscapeFilePath() + ".asset");
+ return texturePath;
+ }
+ else if (o is Mesh && !MeshAsSubAsset)
+ {
+ var meshDir = prefabPath.GetAssetFolder(".Meshes");
+ var meshPath = meshDir.Child(o.name.EscapeFilePath() + ".asset");
+ return meshPath;
+ }
+ else
+ {
+ return default(UnityPath);
+ }
+ }
+
+ public virtual bool AvoidOverwriteAndLoad(UnityPath assetPath, UnityEngine.Object o)
+ {
+ if (o is Material)
+ {
+ var loaded = assetPath.LoadAsset<Material>();
+
+ // replace component reference
+ foreach (var mesh in Meshes)
+ {
+ foreach (var r in mesh.Renderers)
+ {
+ for (int i = 0; i < r.sharedMaterials.Length; ++i)
+ {
+ if (r.sharedMaterials.Contains(o))
+ {
+ r.sharedMaterials = r.sharedMaterials.Select(x => x == o ? loaded : x).ToArray();
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public void SaveAsAsset(UnityPath prefabPath)
+ {
+ ShowMeshes();
+
+ //var prefabPath = PrefabPath;
+ if (prefabPath.IsFileExists)
+ {
+ // clear SubAssets
+ foreach (var x in prefabPath.GetSubAssets().Where(x => !(x is GameObject) && !(x is Component)))
+ {
+ GameObject.DestroyImmediate(x, true);
+ }
+ }
+
+ //
+ // save sub assets
+ //
+ var paths = new List<UnityPath>(){
+ prefabPath
+ };
+ foreach (var o in ObjectsForSubAsset())
+ {
+ if (o == null) continue;
+
+ var assetPath = GetAssetPath(prefabPath, o);
+ if (!assetPath.IsNull)
+ {
+ if (assetPath.IsFileExists)
+ {
+ if (AvoidOverwriteAndLoad(assetPath, o))
+ {
+ // 上書きせずに既存のアセットからロードして置き換えた
+ continue;
+ }
+ }
+
+ // アセットとして書き込む
+ assetPath.Parent.EnsureFolder();
+ assetPath.CreateAsset(o);
+ paths.Add(assetPath);
+ }
+ else
+ {
+ // save as subasset
+ prefabPath.AddObjectToAsset(o);
+ }
+ }
+
+ // Create or update Main Asset
+ if (prefabPath.IsFileExists)
+ {
+ Debug.LogFormat("replace prefab: {0}", prefabPath);
+ var prefab = prefabPath.LoadAsset<GameObject>();
+#if UNITY_2018_3_OR_NEWER
+ PrefabUtility.SaveAsPrefabAssetAndConnect(Root, prefabPath.Value, InteractionMode.AutomatedAction);
+#else
+ PrefabUtility.ReplacePrefab(Root, prefab, ReplacePrefabOptions.ReplaceNameBased);
+#endif
+
+ }
+ else
+ {
+ Debug.LogFormat("create prefab: {0}", prefabPath);
+#if UNITY_2018_3_OR_NEWER
+ PrefabUtility.SaveAsPrefabAssetAndConnect(Root, prefabPath.Value, InteractionMode.AutomatedAction);
+#else
+ PrefabUtility.CreatePrefab(prefabPath.Value, Root);
+#endif
+ }
+ foreach (var x in paths)
+ {
+ x.ImportAsset();
+ }
+ }
+
+ [Obsolete("Use ExtractImages(prefabPath)")]
+ public void ExtranctImages(UnityPath prefabPath)
+ {
+ ExtractImages(prefabPath);
+ }
+
+ /// <summary>
+ /// Extract images from glb or gltf out of Assets folder.
+ /// </summary>
+ /// <param name="prefabPath"></param>
+ public void ExtractImages(UnityPath prefabPath)
+ {
+ var prefabParentDir = prefabPath.Parent;
+
+ // glb buffer
+ var folder = prefabPath.GetAssetFolder(".Textures");
+
+ //
+ // https://answers.unity.com/questions/647615/how-to-update-import-settings-for-newly-created-as.html
+ //
+ int created = 0;
+ //for (int i = 0; i < GLTF.textures.Count; ++i)
+ for (int i = 0; i < GLTF.images.Count; ++i)
+ {
+ folder.EnsureFolder();
+
+ //var x = GLTF.textures[i];
+ var image = GLTF.images[i];
+ var src = Storage.GetPath(image.uri);
+ if (UnityPath.FromFullpath(src).IsUnderAssetsFolder)
+ {
+ // asset is exists.
+ }
+ else
+ {
+ string textureName;
+ var byteSegment = GLTF.GetImageBytes(Storage, i, out textureName);
+
+ // path
+ var dst = folder.Child(textureName + image.GetExt());
+ File.WriteAllBytes(dst.FullPath, byteSegment.ToArray());
+ dst.ImportAsset();
+
+ // make relative path from PrefabParentDir
+ image.uri = dst.Value.Substring(prefabParentDir.Value.Length + 1);
+ ++created;
+ }
+ }
+
+ if (created > 0)
+ {
+ AssetDatabase.Refresh();
+ }
+
+ CreateTextureItems(prefabParentDir);
+ }
+ #endregion
+#endif
+
+ /// <summary>
+ /// This function is used for clean up after create assets.
+ /// </summary>
+ /// <param name="destroySubAssets">Ambiguous arguments</param>
+ [Obsolete("Use Dispose for runtime loader resource management")]
+ public void Destroy(bool destroySubAssets)
+ {
+ if (Root != null) GameObject.DestroyImmediate(Root);
+ if (destroySubAssets)
+ {
+#if UNITY_EDITOR
+ foreach (var o in ObjectsForSubAsset())
+ {
+ UnityEngine.Object.DestroyImmediate(o, true);
+ }
+#endif
+ }
+ }
+
+ public void Dispose()
+ {
+ DestroyRootAndResources();
+ }
+
+ /// <summary>
+ /// Destroy resources that created ImporterContext for runtime load.
+ /// </summary>
+ public void DestroyRootAndResources()
+ {
+ if (!Application.isPlaying)
+ {
+ Debug.LogWarningFormat("Dispose called in editor mode. This function is for runtime");
+ }
+
+ // Remove hierarchy
+ if (Root != null) GameObject.Destroy(Root);
+
+ // Remove resources. materials, textures meshes etc...
+ foreach (var o in ObjectsForSubAsset())
+ {
+ UnityEngine.Object.DestroyImmediate(o, true);
+ }
+ }
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// Destroy the GameObject that became the basis of Prefab
+ /// </summary>
+ public void EditorDestroyRoot()
+ {
+ if (Root != null) GameObject.DestroyImmediate(Root);
+ }
+
+ /// <summary>
+ /// Destroy assets that created ImporterContext. This function is clean up for importer error.
+ /// </summary>
+ public void EditorDestroyRootAndAssets()
+ {
+ // Remove hierarchy
+ if (Root != null) GameObject.DestroyImmediate(Root);
+
+ // Remove resources. materials, textures meshes etc...
+ foreach (var o in ObjectsForSubAsset())
+ {
+ UnityEngine.Object.DestroyImmediate(o, true);
+ }
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs.meta
new file mode 100644
index 00000000..00359b62
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ImporterContext.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 8d2d07b67753fb0489decee9926ab2da
+timeCreated: 1517123236
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs
new file mode 100644
index 00000000..1e8b1475
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs
@@ -0,0 +1,316 @@
+using UniGLTF.UniUnlit;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public enum glTFBlendMode
+ {
+ OPAQUE,
+ MASK,
+ BLEND
+ }
+
+ public interface IMaterialExporter
+ {
+ glTFMaterial ExportMaterial(Material m, TextureExportManager textureManager);
+ }
+
+ public class MaterialExporter : IMaterialExporter
+ {
+ public virtual glTFMaterial ExportMaterial(Material m, TextureExportManager textureManager)
+ {
+ var material = CreateMaterial(m);
+
+ // common params
+ material.name = m.name;
+ Export_Color(m, textureManager, material);
+ Export_Metallic(m, textureManager, material);
+ Export_Normal(m, textureManager, material);
+ Export_Occlusion(m, textureManager, material);
+ Export_Emission(m, textureManager, material);
+
+ return material;
+ }
+
+ static void Export_Color(Material m, TextureExportManager textureManager, glTFMaterial material)
+ {
+ if (m.HasProperty("_Color"))
+ {
+ material.pbrMetallicRoughness.baseColorFactor = m.color.linear.ToArray();
+ }
+
+ if (m.HasProperty("_MainTex"))
+ {
+ var index = textureManager.CopyAndGetIndex(m.GetTexture("_MainTex"), RenderTextureReadWrite.sRGB);
+ if (index != -1)
+ {
+ material.pbrMetallicRoughness.baseColorTexture = new glTFMaterialBaseColorTextureInfo()
+ {
+ index = index,
+ };
+
+ Export_MainTextureTransform(m, material.pbrMetallicRoughness.baseColorTexture);
+ }
+ }
+ }
+
+ static void Export_Metallic(Material m, TextureExportManager textureManager, glTFMaterial material)
+ {
+ int index = -1;
+ if (m.HasProperty("_MetallicGlossMap"))
+ {
+ float smoothness = 0.0f;
+ if (m.HasProperty("_GlossMapScale"))
+ {
+ smoothness = m.GetFloat("_GlossMapScale");
+ }
+
+ // Bake smoothness values into a texture.
+ var converter = new MetallicRoughnessConverter(smoothness);
+ index = textureManager.ConvertAndGetIndex(m.GetTexture("_MetallicGlossMap"), converter);
+ if (index != -1)
+ {
+ material.pbrMetallicRoughness.metallicRoughnessTexture =
+ new glTFMaterialMetallicRoughnessTextureInfo()
+ {
+ index = index,
+ };
+
+ Export_MainTextureTransform(m, material.pbrMetallicRoughness.metallicRoughnessTexture);
+ }
+ }
+
+ if (index != -1)
+ {
+ material.pbrMetallicRoughness.metallicFactor = 1.0f;
+ // Set 1.0f as hard-coded. See: https://github.com/dwango/UniVRM/issues/212.
+ material.pbrMetallicRoughness.roughnessFactor = 1.0f;
+ }
+ else
+ {
+ if (m.HasProperty("_Metallic"))
+ {
+ material.pbrMetallicRoughness.metallicFactor = m.GetFloat("_Metallic");
+ }
+
+ if (m.HasProperty("_Glossiness"))
+ {
+ material.pbrMetallicRoughness.roughnessFactor = 1.0f - m.GetFloat("_Glossiness");
+ }
+ }
+ }
+
+ static void Export_Normal(Material m, TextureExportManager textureManager, glTFMaterial material)
+ {
+ if (m.HasProperty("_BumpMap"))
+ {
+ var index = textureManager.ConvertAndGetIndex(m.GetTexture("_BumpMap"), new NormalConverter());
+ if (index != -1)
+ {
+ material.normalTexture = new glTFMaterialNormalTextureInfo()
+ {
+ index = index,
+ };
+
+ Export_MainTextureTransform(m, material.normalTexture);
+ }
+
+ if (index != -1 && m.HasProperty("_BumpScale"))
+ {
+ material.normalTexture.scale = m.GetFloat("_BumpScale");
+ }
+ }
+ }
+
+ static void Export_Occlusion(Material m, TextureExportManager textureManager, glTFMaterial material)
+ {
+ if (m.HasProperty("_OcclusionMap"))
+ {
+ var index = textureManager.ConvertAndGetIndex(m.GetTexture("_OcclusionMap"), new OcclusionConverter());
+ if (index != -1)
+ {
+ material.occlusionTexture = new glTFMaterialOcclusionTextureInfo()
+ {
+ index = index,
+ };
+
+ Export_MainTextureTransform(m, material.occlusionTexture);
+ }
+
+ if (index != -1 && m.HasProperty("_OcclusionStrength"))
+ {
+ material.occlusionTexture.strength = m.GetFloat("_OcclusionStrength");
+ }
+ }
+ }
+
+ static void Export_Emission(Material m, TextureExportManager textureManager, glTFMaterial material)
+ {
+ if (m.IsKeywordEnabled("_EMISSION") == false)
+ return;
+
+ if (m.HasProperty("_EmissionColor"))
+ {
+ var color = m.GetColor("_EmissionColor");
+ if (color.maxColorComponent > 1)
+ {
+ color /= color.maxColorComponent;
+ }
+ material.emissiveFactor = new float[] { color.r, color.g, color.b };
+ }
+
+ if (m.HasProperty("_EmissionMap"))
+ {
+ var index = textureManager.CopyAndGetIndex(m.GetTexture("_EmissionMap"), RenderTextureReadWrite.sRGB);
+ if (index != -1)
+ {
+ material.emissiveTexture = new glTFMaterialEmissiveTextureInfo()
+ {
+ index = index,
+ };
+
+ Export_MainTextureTransform(m, material.emissiveTexture);
+ }
+ }
+ }
+
+ static void Export_MainTextureTransform(Material m, glTFTextureInfo textureInfo)
+ {
+ Export_TextureTransform(m, textureInfo, "_MainTex");
+ }
+
+ static void Export_TextureTransform(Material m, glTFTextureInfo textureInfo, string propertyName)
+ {
+ if (textureInfo != null && m.HasProperty(propertyName))
+ {
+ var offset = m.GetTextureOffset(propertyName);
+ var scale = m.GetTextureScale(propertyName);
+ offset.y = (offset.y + scale.y - 1) * -1.0f;
+
+ textureInfo.extensions = new glTFTextureInfo_extensions
+ {
+ KHR_texture_transform = new glTF_KHR_texture_transform()
+ {
+ offset = new float[] { offset.x, offset.y },
+ scale = new float[] { scale.x, scale.y },
+ }
+ };
+ }
+ }
+
+ protected virtual glTFMaterial CreateMaterial(Material m)
+ {
+ switch (m.shader.name)
+ {
+ case "Unlit/Color":
+ return Export_UnlitColor(m);
+
+ case "Unlit/Texture":
+ return Export_UnlitTexture(m);
+
+ case "Unlit/Transparent":
+ return Export_UnlitTransparent(m);
+
+ case "Unlit/Transparent Cutout":
+ return Export_UnlitCutout(m);
+
+ case "UniGLTF/UniUnlit":
+ return Export_UniUnlit(m);
+
+ default:
+ return Export_Standard(m);
+ }
+ }
+
+ static glTFMaterial Export_UnlitColor(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = glTFBlendMode.OPAQUE.ToString();
+ return material;
+ }
+
+ static glTFMaterial Export_UnlitTexture(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = glTFBlendMode.OPAQUE.ToString();
+ return material;
+ }
+
+ static glTFMaterial Export_UnlitTransparent(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = glTFBlendMode.BLEND.ToString();
+ return material;
+ }
+
+ static glTFMaterial Export_UnlitCutout(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = glTFBlendMode.MASK.ToString();
+ material.alphaCutoff = m.GetFloat("_Cutoff");
+ return material;
+ }
+
+ private glTFMaterial Export_UniUnlit(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+
+ var renderMode = UniUnlit.Utils.GetRenderMode(m);
+ if (renderMode == UniUnlitRenderMode.Opaque)
+ {
+ material.alphaMode = glTFBlendMode.OPAQUE.ToString();
+ }
+ else if (renderMode == UniUnlitRenderMode.Transparent)
+ {
+ material.alphaMode = glTFBlendMode.BLEND.ToString();
+ }
+ else if (renderMode == UniUnlitRenderMode.Cutout)
+ {
+ material.alphaMode = glTFBlendMode.MASK.ToString();
+ }
+ else
+ {
+ material.alphaMode = glTFBlendMode.OPAQUE.ToString();
+ }
+
+ var cullMode = UniUnlit.Utils.GetCullMode(m);
+ if (cullMode == UniUnlitCullMode.Off)
+ {
+ material.doubleSided = true;
+ }
+ else
+ {
+ material.doubleSided = false;
+ }
+
+ return material;
+ }
+
+ static glTFMaterial Export_Standard(Material m)
+ {
+ var material = new glTFMaterial
+ {
+ pbrMetallicRoughness = new glTFPbrMetallicRoughness(),
+ };
+
+ switch (m.GetTag("RenderType", true))
+ {
+ case "Transparent":
+ material.alphaMode = glTFBlendMode.BLEND.ToString();
+ break;
+
+ case "TransparentCutout":
+ material.alphaMode = glTFBlendMode.MASK.ToString();
+ material.alphaCutoff = m.GetFloat("_Cutoff");
+ break;
+
+ default:
+ material.alphaMode = glTFBlendMode.OPAQUE.ToString();
+ break;
+ }
+
+ return material;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs.meta
new file mode 100644
index 00000000..e441123c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 99662edfbf59e8f458bcba3b62b13050
+timeCreated: 1533622882
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs
new file mode 100644
index 00000000..13ad61ae
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs
@@ -0,0 +1,316 @@
+using UnityEngine;
+using System;
+using UnityEngine.Rendering;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public interface IMaterialImporter
+ {
+ Material CreateMaterial(int i, glTFMaterial src, bool hasVertexColor);
+ }
+
+ public class MaterialImporter : IMaterialImporter
+ {
+ IShaderStore m_shaderStore;
+
+ protected Func<int, TextureItem> GetTextureFunc;
+
+ public MaterialImporter(IShaderStore shaderStore, Func<int, TextureItem> getTextureFunc)
+ {
+ m_shaderStore = shaderStore;
+ GetTextureFunc = getTextureFunc;
+ }
+
+ private enum BlendMode
+ {
+ Opaque,
+ Cutout,
+ Fade,
+ Transparent
+ }
+
+ /// StandardShader variables
+ ///
+ /// _Color
+ /// _MainTex
+ /// _Cutoff
+ /// _Glossiness
+ /// _Metallic
+ /// _MetallicGlossMap
+ /// _BumpScale
+ /// _BumpMap
+ /// _Parallax
+ /// _ParallaxMap
+ /// _OcclusionStrength
+ /// _OcclusionMap
+ /// _EmissionColor
+ /// _EmissionMap
+ /// _DetailMask
+ /// _DetailAlbedoMap
+ /// _DetailNormalMapScale
+ /// _DetailNormalMap
+ /// _UVSec
+ /// _EmissionScaleUI
+ /// _EmissionColorUI
+ /// _Mode
+ /// _SrcBlend
+ /// _DstBlend
+ /// _ZWrite
+ public virtual Material CreateMaterial(int i, glTFMaterial x, bool hasVertexColor)
+ {
+ var shader = m_shaderStore.GetShader(x);
+ //Debug.LogFormat("[{0}]{1}", i, shader.name);
+ var material = new Material(shader);
+#if UNITY_EDITOR
+ // textureImporter.SaveAndReimport(); may destroy this material
+ material.hideFlags = HideFlags.DontUnloadUnusedAsset;
+#endif
+
+ material.name = (x == null || string.IsNullOrEmpty(x.name))
+ ? string.Format("material_{0:00}", i)
+ : x.name
+ ;
+
+ if (x == null)
+ {
+ Debug.LogWarning("glTFMaterial is empty");
+ return material;
+ }
+
+ // unlit material
+ if (x.extensions != null && x.extensions.KHR_materials_unlit != null)
+ {
+ // texture
+ if (x.pbrMetallicRoughness.baseColorTexture != null)
+ {
+ var texture = GetTextureFunc(x.pbrMetallicRoughness.baseColorTexture.index);
+ if (texture != null)
+ {
+ material.mainTexture = texture.Texture;
+ }
+
+ // Texture Offset and Scale
+ SetTextureOffsetAndScale(material, x.pbrMetallicRoughness.baseColorTexture, "_MainTex");
+ }
+
+ // color
+ if (x.pbrMetallicRoughness.baseColorFactor != null && x.pbrMetallicRoughness.baseColorFactor.Length == 4)
+ {
+ var color = x.pbrMetallicRoughness.baseColorFactor;
+ material.color = (new Color(color[0], color[1], color[2], color[3])).gamma;
+ }
+
+ //renderMode
+ if (x.alphaMode == "OPAQUE")
+ {
+ UniUnlit.Utils.SetRenderMode(material, UniUnlit.UniUnlitRenderMode.Opaque);
+ }
+ else if (x.alphaMode == "BLEND")
+ {
+ UniUnlit.Utils.SetRenderMode(material, UniUnlit.UniUnlitRenderMode.Transparent);
+ }
+ else if(x.alphaMode == "MASK")
+ {
+ UniUnlit.Utils.SetRenderMode(material, UniUnlit.UniUnlitRenderMode.Cutout);
+ }
+ else
+ {
+ // default OPAQUE
+ UniUnlit.Utils.SetRenderMode(material, UniUnlit.UniUnlitRenderMode.Opaque);
+ }
+
+ // culling
+ if (x.doubleSided)
+ {
+ UniUnlit.Utils.SetCullMode(material, UniUnlit.UniUnlitCullMode.Off);
+ }
+ else
+ {
+ UniUnlit.Utils.SetCullMode(material, UniUnlit.UniUnlitCullMode.Back);
+ }
+
+ // VColor
+ if (hasVertexColor)
+ {
+ UniUnlit.Utils.SetVColBlendMode(material, UniUnlit.UniUnlitVertexColorBlendOp.Multiply);
+ }
+
+ UniUnlit.Utils.ValidateProperties(material, true);
+
+ return material;
+ }
+
+ // PBR material
+ if (x.pbrMetallicRoughness != null)
+ {
+ if (x.pbrMetallicRoughness.baseColorFactor != null && x.pbrMetallicRoughness.baseColorFactor.Length == 4)
+ {
+ var color = x.pbrMetallicRoughness.baseColorFactor;
+ material.color = (new Color(color[0], color[1], color[2], color[3])).gamma;
+ }
+
+ if (x.pbrMetallicRoughness.baseColorTexture != null && x.pbrMetallicRoughness.baseColorTexture.index != -1)
+ {
+ var texture = GetTextureFunc(x.pbrMetallicRoughness.baseColorTexture.index);
+ if (texture != null)
+ {
+ material.mainTexture = texture.Texture;
+ }
+
+ // Texture Offset and Scale
+ SetTextureOffsetAndScale(material, x.pbrMetallicRoughness.baseColorTexture, "_MainTex");
+ }
+
+ if (x.pbrMetallicRoughness.metallicRoughnessTexture != null && x.pbrMetallicRoughness.metallicRoughnessTexture.index != -1)
+ {
+ material.EnableKeyword("_METALLICGLOSSMAP");
+ var texture = GetTextureFunc(x.pbrMetallicRoughness.metallicRoughnessTexture.index);
+ if (texture != null)
+ {
+ var prop = "_MetallicGlossMap";
+ // Bake roughnessFactor values into a texture.
+ material.SetTexture(prop, texture.ConvertTexture(prop, x.pbrMetallicRoughness.roughnessFactor));
+ }
+
+ material.SetFloat("_Metallic", 1.0f);
+ // Set 1.0f as hard-coded. See: https://github.com/dwango/UniVRM/issues/212.
+ material.SetFloat("_GlossMapScale", 1.0f);
+
+ // Texture Offset and Scale
+ SetTextureOffsetAndScale(material, x.pbrMetallicRoughness.metallicRoughnessTexture, "_MetallicGlossMap");
+ }
+ else
+ {
+ material.SetFloat("_Metallic", x.pbrMetallicRoughness.metallicFactor);
+ material.SetFloat("_Glossiness", 1.0f - x.pbrMetallicRoughness.roughnessFactor);
+ }
+ }
+
+ if (x.normalTexture != null && x.normalTexture.index != -1)
+ {
+ material.EnableKeyword("_NORMALMAP");
+ var texture = GetTextureFunc(x.normalTexture.index);
+ if (texture != null)
+ {
+ var prop = "_BumpMap";
+ material.SetTexture(prop, texture.ConvertTexture(prop));
+ material.SetFloat("_BumpScale", x.normalTexture.scale);
+ }
+
+ // Texture Offset and Scale
+ SetTextureOffsetAndScale(material, x.normalTexture, "_BumpMap");
+ }
+
+ if (x.occlusionTexture != null && x.occlusionTexture.index != -1)
+ {
+ var texture = GetTextureFunc(x.occlusionTexture.index);
+ if (texture != null)
+ {
+ var prop = "_OcclusionMap";
+ material.SetTexture(prop, texture.ConvertTexture(prop));
+ material.SetFloat("_OcclusionStrength", x.occlusionTexture.strength);
+ }
+
+ // Texture Offset and Scale
+ SetTextureOffsetAndScale(material, x.occlusionTexture, "_OcclusionMap");
+ }
+
+ if (x.emissiveFactor != null
+ || (x.emissiveTexture != null && x.emissiveTexture.index != -1))
+ {
+ material.EnableKeyword("_EMISSION");
+ material.globalIlluminationFlags &= ~MaterialGlobalIlluminationFlags.EmissiveIsBlack;
+
+ if (x.emissiveFactor != null && x.emissiveFactor.Length == 3)
+ {
+ material.SetColor("_EmissionColor", new Color(x.emissiveFactor[0], x.emissiveFactor[1], x.emissiveFactor[2]));
+ }
+
+ if (x.emissiveTexture != null && x.emissiveTexture.index != -1)
+ {
+ var texture = GetTextureFunc(x.emissiveTexture.index);
+ if (texture != null)
+ {
+ material.SetTexture("_EmissionMap", texture.Texture);
+ }
+
+ // Texture Offset and Scale
+ SetTextureOffsetAndScale(material, x.emissiveTexture, "_EmissionMap");
+ }
+ }
+
+ BlendMode blendMode = BlendMode.Opaque;
+ // https://forum.unity.com/threads/standard-material-shader-ignoring-setfloat-property-_mode.344557/#post-2229980
+ switch (x.alphaMode)
+ {
+ case "BLEND":
+ blendMode = BlendMode.Fade;
+ material.SetOverrideTag("RenderType", "Transparent");
+ material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
+ material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
+ material.SetInt("_ZWrite", 0);
+ material.DisableKeyword("_ALPHATEST_ON");
+ material.EnableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+ material.renderQueue = 3000;
+ break;
+
+ case "MASK":
+ blendMode = BlendMode.Cutout;
+ material.SetOverrideTag("RenderType", "TransparentCutout");
+ material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
+ material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
+ material.SetInt("_ZWrite", 1);
+ material.SetFloat("_Cutoff", x.alphaCutoff);
+ material.EnableKeyword("_ALPHATEST_ON");
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+ material.renderQueue = 2450;
+
+ break;
+
+ default: // OPAQUE
+ blendMode = BlendMode.Opaque;
+ material.SetOverrideTag("RenderType", "");
+ material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
+ material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
+ material.SetInt("_ZWrite", 1);
+ material.DisableKeyword("_ALPHATEST_ON");
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
+ material.renderQueue = -1;
+ break;
+ }
+
+ material.SetFloat("_Mode", (float)blendMode);
+ return material;
+ }
+
+ private static void SetTextureOffsetAndScale(Material material, glTFTextureInfo textureInfo, string propertyName)
+ {
+ if (textureInfo.extensions != null && textureInfo.extensions.KHR_texture_transform != null)
+ {
+ var textureTransform = textureInfo.extensions.KHR_texture_transform;
+ Vector2 offset = new Vector2(0, 0);
+ Vector2 scale = new Vector2(1, 1);
+ if (textureTransform.offset != null && textureTransform.offset.Length == 2)
+ {
+ offset = new Vector2(textureTransform.offset[0], textureTransform.offset[1]);
+ }
+ if (textureTransform.scale != null && textureTransform.scale.Length == 2)
+ {
+ scale = new Vector2(textureTransform.scale[0], textureTransform.scale[1]);
+ }
+
+ offset.y = (offset.y + scale.y - 1.0f) * -1.0f;
+
+ material.SetTextureOffset(propertyName, offset);
+ material.SetTextureScale(propertyName, scale);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs.meta
new file mode 100644
index 00000000..20f93ed0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7ce22d10dc7cdc647b05c0449173ce71
+timeCreated: 1533624185
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs
new file mode 100644
index 00000000..de44ec80
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs
@@ -0,0 +1,414 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnityEngine;
+
+namespace UniGLTF
+{
+ public struct MeshWithRenderer
+ {
+ public Mesh Mesh;
+ [Obsolete("Use Renderer")]
+ public Renderer Rendererer { get { return Renderer; } set { Renderer = value; } }
+ public Renderer Renderer;
+ }
+
+ [Serializable]
+ public struct MeshExportInfo
+ {
+ public Renderer Renderer;
+ public Mesh Mesh;
+ public bool IsRendererActive;
+ public bool Skinned;
+
+ public bool HasNormal => Mesh != null && Mesh.normals != null && Mesh.normals.Length == Mesh.vertexCount;
+ public bool HasUV => Mesh != null && Mesh.uv != null && Mesh.uv.Length == Mesh.vertexCount;
+
+ public bool HasVertexColor => Mesh.colors != null && Mesh.colors.Length == Mesh.vertexCount
+ && VertexColor == VertexColorState.ExistsAndIsUsed
+ || VertexColor == VertexColorState.ExistsAndMixed // Export する
+ ;
+
+ public bool HasSkinning => Mesh.boneWeights != null && Mesh.boneWeights.Length == Mesh.vertexCount;
+
+ /// <summary>
+ /// Mesh に頂点カラーが含まれているか。
+ /// 含まれている場合にマテリアルは Unlit.VColorMultiply になっているか?
+ /// </summary>
+ public enum VertexColorState
+ {
+ // VColorが存在しない
+ None,
+ // VColorが存在して使用している(UnlitはすべてVColorMultiply)
+ ExistsAndIsUsed,
+ // VColorが存在するが使用していない(UnlitはすべてVColorNone。もしくはUnlitが存在しない)
+ ExistsButNotUsed,
+ // VColorが存在して、Unlit.Multiply と Unlit.NotMultiply が混在している。 Unlit.NotMultiply を MToon か Standardに変更した方がよい
+ ExistsAndMixed,
+ }
+ public VertexColorState VertexColor;
+
+ static bool MaterialUseVertexColor(Material m)
+ {
+ if (m == null)
+ {
+ return false;
+ }
+ if (m.shader.name != UniGLTF.UniUnlit.Utils.ShaderName)
+ {
+ return false;
+ }
+ if (UniGLTF.UniUnlit.Utils.GetVColBlendMode(m) != UniGLTF.UniUnlit.UniUnlitVertexColorBlendOp.Multiply)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public static VertexColorState DetectVertexColor(Mesh mesh, Material[] materials)
+ {
+ if (mesh != null && mesh.colors != null && mesh.colors.Length == mesh.vertexCount)
+ {
+ // mesh が 頂点カラーを保持している
+ VertexColorState? state = default;
+ if (materials != null)
+ {
+ foreach (var m in materials)
+ {
+ var currentState = MaterialUseVertexColor(m)
+ ? UniGLTF.MeshExportInfo.VertexColorState.ExistsAndIsUsed
+ : UniGLTF.MeshExportInfo.VertexColorState.ExistsButNotUsed
+ ;
+ if (state.HasValue)
+ {
+ if (state.Value != currentState)
+ {
+ state = UniGLTF.MeshExportInfo.VertexColorState.ExistsAndMixed;
+ break;
+ }
+ }
+ else
+ {
+ state = currentState;
+ }
+ }
+ }
+ return state.GetValueOrDefault(VertexColorState.None);
+ }
+ else
+ {
+ return VertexColorState.None;
+ }
+ }
+
+ public int VertexCount;
+
+ /// <summary>
+ /// Position, UV, Normal
+ /// [Color]
+ /// [SkinningWeight]
+ /// </summary>
+ public int ExportVertexSize;
+
+ public int IndexCount;
+
+ // int 決め打ち
+ public int IndicesSize => IndexCount * 4;
+
+ public int ExportBlendShapeVertexSize;
+
+ public int TotalBlendShapeCount;
+
+ public int ExportBlendShapeCount;
+
+ public int ExportByteSize => ExportVertexSize * VertexCount + IndicesSize + ExportBlendShapeCount * ExportBlendShapeVertexSize * VertexCount;
+
+ public string Summary;
+ }
+
+ public struct MeshExportSettings
+ {
+ // MorphTarget に Sparse Accessor を使う
+ public bool UseSparseAccessorForMorphTarget;
+
+ // MorphTarget を Position だけにする(normal とか捨てる)
+ public bool ExportOnlyBlendShapePosition;
+
+ public static MeshExportSettings Default => new MeshExportSettings
+ {
+ UseSparseAccessorForMorphTarget = false,
+ ExportOnlyBlendShapePosition = false,
+ };
+ }
+
+ public static class MeshExporter
+ {
+ static glTFMesh ExportPrimitives(glTF gltf, int bufferIndex,
+ string rendererName,
+ Mesh mesh, Material[] materials,
+ List<Material> unityMaterials)
+ {
+ var positions = mesh.vertices.Select(y => y.ReverseZ()).ToArray();
+ var positionAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, positions, glBufferTarget.ARRAY_BUFFER);
+ gltf.accessors[positionAccessorIndex].min = positions.Aggregate(positions[0], (a, b) => new Vector3(Mathf.Min(a.x, b.x), Math.Min(a.y, b.y), Mathf.Min(a.z, b.z))).ToArray();
+ gltf.accessors[positionAccessorIndex].max = positions.Aggregate(positions[0], (a, b) => new Vector3(Mathf.Max(a.x, b.x), Math.Max(a.y, b.y), Mathf.Max(a.z, b.z))).ToArray();
+
+ var normalAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, mesh.normals.Select(y => y.normalized.ReverseZ()).ToArray(), glBufferTarget.ARRAY_BUFFER);
+#if GLTF_EXPORT_TANGENTS
+ var tangentAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, mesh.tangents.Select(y => y.ReverseZ()).ToArray(), glBufferTarget.ARRAY_BUFFER);
+#endif
+ var uvAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, mesh.uv.Select(y => y.ReverseUV()).ToArray(), glBufferTarget.ARRAY_BUFFER);
+
+ var colorAccessorIndex = -1;
+
+ var vColorState = MeshExportInfo.DetectVertexColor(mesh, materials);
+ if (vColorState == MeshExportInfo.VertexColorState.ExistsAndIsUsed // VColor使っている
+ || vColorState == MeshExportInfo.VertexColorState.ExistsAndMixed // VColorを使っているところと使っていないところが混在(とりあえずExportする)
+ )
+ {
+ // UniUnlit で Multiply 設定になっている
+ colorAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, mesh.colors, glBufferTarget.ARRAY_BUFFER);
+ }
+
+ var boneweights = mesh.boneWeights;
+ var weightAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, boneweights.Select(y => new Vector4(y.weight0, y.weight1, y.weight2, y.weight3)).ToArray(), glBufferTarget.ARRAY_BUFFER);
+ var jointsAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, boneweights.Select(y => new UShort4((ushort)y.boneIndex0, (ushort)y.boneIndex1, (ushort)y.boneIndex2, (ushort)y.boneIndex3)).ToArray(), glBufferTarget.ARRAY_BUFFER);
+
+ var attributes = new glTFAttributes
+ {
+ POSITION = positionAccessorIndex,
+ };
+ if (normalAccessorIndex != -1)
+ {
+ attributes.NORMAL = normalAccessorIndex;
+ }
+#if GLTF_EXPORT_TANGENTS
+ if (tangentAccessorIndex != -1)
+ {
+ attributes.TANGENT = tangentAccessorIndex;
+ }
+#endif
+ if (uvAccessorIndex != -1)
+ {
+ attributes.TEXCOORD_0 = uvAccessorIndex;
+ }
+ if (colorAccessorIndex != -1)
+ {
+ attributes.COLOR_0 = colorAccessorIndex;
+ }
+ if (weightAccessorIndex != -1)
+ {
+ attributes.WEIGHTS_0 = weightAccessorIndex;
+ }
+ if (jointsAccessorIndex != -1)
+ {
+ attributes.JOINTS_0 = jointsAccessorIndex;
+ }
+
+ var gltfMesh = new glTFMesh(mesh.name);
+ for (int j = 0; j < mesh.subMeshCount; ++j)
+ {
+ var indices = TriangleUtil.FlipTriangle(mesh.GetIndices(j)).Select(y => (uint)y).ToArray();
+ var indicesAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex, indices, glBufferTarget.ELEMENT_ARRAY_BUFFER);
+
+ if (j >= materials.Length)
+ {
+ Debug.LogWarningFormat("{0}.materials is not enough", rendererName);
+ break;
+ }
+
+ gltfMesh.primitives.Add(new glTFPrimitives
+ {
+ attributes = attributes,
+ indices = indicesAccessorIndex,
+ mode = 4, // triangles ?
+ material = unityMaterials.IndexOf(materials[j])
+ });
+ }
+ return gltfMesh;
+ }
+
+ static bool UseSparse(
+ bool usePosition, Vector3 position,
+ bool useNormal, Vector3 normal,
+ bool useTangent, Vector3 tangent
+ )
+ {
+ var useSparse =
+ (usePosition && position != Vector3.zero)
+ || (useNormal && normal != Vector3.zero)
+ || (useTangent && tangent != Vector3.zero)
+ ;
+ return useSparse;
+ }
+
+ static gltfMorphTarget ExportMorphTarget(glTF gltf, int bufferIndex,
+ Mesh mesh, int j,
+ bool useSparseAccessorForMorphTarget,
+ bool exportOnlyBlendShapePosition)
+ {
+ var blendShapeVertices = mesh.vertices;
+ var usePosition = blendShapeVertices != null && blendShapeVertices.Length > 0;
+
+ var blendShapeNormals = mesh.normals;
+ var useNormal = usePosition && blendShapeNormals != null && blendShapeNormals.Length == blendShapeVertices.Length;
+ // var useNormal = usePosition && blendShapeNormals != null && blendShapeNormals.Length == blendShapeVertices.Length && !exportOnlyBlendShapePosition;
+
+ var blendShapeTangents = mesh.tangents.Select(y => (Vector3)y).ToArray();
+ //var useTangent = usePosition && blendShapeTangents != null && blendShapeTangents.Length == blendShapeVertices.Length;
+ var useTangent = false;
+
+ var frameCount = mesh.GetBlendShapeFrameCount(j);
+ mesh.GetBlendShapeFrameVertices(j, frameCount - 1, blendShapeVertices, blendShapeNormals, null);
+
+ var blendShapePositionAccessorIndex = -1;
+ var blendShapeNormalAccessorIndex = -1;
+ var blendShapeTangentAccessorIndex = -1;
+ if (useSparseAccessorForMorphTarget)
+ {
+ var accessorCount = blendShapeVertices.Length;
+ var sparseIndices = Enumerable.Range(0, blendShapeVertices.Length)
+ .Where(x => UseSparse(
+ usePosition, blendShapeVertices[x],
+ useNormal, blendShapeNormals[x],
+ useTangent, blendShapeTangents[x]))
+ .ToArray()
+ ;
+
+ if (sparseIndices.Length == 0)
+ {
+ usePosition = false;
+ useNormal = false;
+ useTangent = false;
+ }
+ else
+ {
+ Debug.LogFormat("Sparse {0}/{1}", sparseIndices.Length, mesh.vertexCount);
+ }
+ /*
+ var vertexSize = 12;
+ if (useNormal) vertexSize += 12;
+ if (useTangent) vertexSize += 24;
+ var sparseBytes = (4 + vertexSize) * sparseIndices.Length;
+ var fullBytes = (vertexSize) * blendShapeVertices.Length;
+ Debug.LogFormat("Export sparse: {0}/{1}bytes({2}%)",
+ sparseBytes, fullBytes, (int)((float)sparseBytes / fullBytes)
+ );
+ */
+
+ var sparseIndicesViewIndex = -1;
+ if (usePosition)
+ {
+ sparseIndicesViewIndex = gltf.ExtendBufferAndGetViewIndex(bufferIndex, sparseIndices);
+
+ blendShapeVertices = sparseIndices.Select(x => blendShapeVertices[x].ReverseZ()).ToArray();
+ blendShapePositionAccessorIndex = gltf.ExtendSparseBufferAndGetAccessorIndex(bufferIndex, accessorCount,
+ blendShapeVertices,
+ sparseIndices, sparseIndicesViewIndex,
+ glBufferTarget.ARRAY_BUFFER);
+ }
+
+ if (useNormal)
+ {
+ blendShapeNormals = sparseIndices.Select(x => blendShapeNormals[x].ReverseZ()).ToArray();
+ blendShapeNormalAccessorIndex = gltf.ExtendSparseBufferAndGetAccessorIndex(bufferIndex, accessorCount,
+ blendShapeNormals,
+ sparseIndices, sparseIndicesViewIndex,
+ glBufferTarget.ARRAY_BUFFER);
+ }
+
+ if (useTangent)
+ {
+ blendShapeTangents = sparseIndices.Select(x => blendShapeTangents[x].ReverseZ()).ToArray();
+ blendShapeTangentAccessorIndex = gltf.ExtendSparseBufferAndGetAccessorIndex(bufferIndex, accessorCount,
+ blendShapeTangents, sparseIndices, sparseIndicesViewIndex,
+ glBufferTarget.ARRAY_BUFFER);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < blendShapeVertices.Length; ++i) blendShapeVertices[i] = blendShapeVertices[i].ReverseZ();
+ if (usePosition)
+ {
+ blendShapePositionAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex,
+ blendShapeVertices,
+ glBufferTarget.ARRAY_BUFFER);
+ }
+
+ if (useNormal)
+ {
+ for (int i = 0; i < blendShapeNormals.Length; ++i) blendShapeNormals[i] = blendShapeNormals[i].ReverseZ();
+ blendShapeNormalAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex,
+ blendShapeNormals,
+ glBufferTarget.ARRAY_BUFFER);
+ }
+
+ if (useTangent)
+ {
+ for (int i = 0; i < blendShapeTangents.Length; ++i) blendShapeTangents[i] = blendShapeTangents[i].ReverseZ();
+ blendShapeTangentAccessorIndex = gltf.ExtendBufferAndGetAccessorIndex(bufferIndex,
+ blendShapeTangents,
+ glBufferTarget.ARRAY_BUFFER);
+ }
+ }
+
+ if (blendShapePositionAccessorIndex != -1)
+ {
+ gltf.accessors[blendShapePositionAccessorIndex].min = blendShapeVertices.Aggregate(blendShapeVertices[0], (a, b) => new Vector3(Mathf.Min(a.x, b.x), Math.Min(a.y, b.y), Mathf.Min(a.z, b.z))).ToArray();
+ gltf.accessors[blendShapePositionAccessorIndex].max = blendShapeVertices.Aggregate(blendShapeVertices[0], (a, b) => new Vector3(Mathf.Max(a.x, b.x), Math.Max(a.y, b.y), Mathf.Max(a.z, b.z))).ToArray();
+ }
+
+ return new gltfMorphTarget
+ {
+ POSITION = blendShapePositionAccessorIndex,
+ NORMAL = blendShapeNormalAccessorIndex,
+ TANGENT = blendShapeTangentAccessorIndex,
+ };
+ }
+
+ public static IEnumerable<(Mesh, glTFMesh, Dictionary<int, int>)> ExportMeshes(glTF gltf, int bufferIndex,
+ List<MeshWithRenderer> unityMeshes, List<Material> unityMaterials,
+ MeshExportSettings settings)
+ {
+ for (int i = 0; i < unityMeshes.Count; ++i)
+ {
+ var x = unityMeshes[i];
+ var mesh = x.Mesh;
+ var materials = x.Renderer.sharedMaterials;
+
+ var gltfMesh = ExportPrimitives(gltf, bufferIndex,
+ x.Renderer.name,
+ mesh, materials, unityMaterials);
+
+ var blendShapeIndexMap = new Dictionary<int, int>();
+ int exportBlendShapes = 0;
+ for (int j = 0; j < mesh.blendShapeCount; ++j)
+ {
+ var morphTarget = ExportMorphTarget(gltf, bufferIndex,
+ mesh, j,
+ settings.UseSparseAccessorForMorphTarget,
+ settings.ExportOnlyBlendShapePosition);
+ if (morphTarget.POSITION < 0 && morphTarget.NORMAL < 0 && morphTarget.TANGENT < 0)
+ {
+ continue;
+ }
+
+ // maybe skip
+ blendShapeIndexMap.Add(j, exportBlendShapes++);
+
+ //
+ // all primitive has same blendShape
+ //
+ for (int k = 0; k < gltfMesh.primitives.Count; ++k)
+ {
+ gltfMesh.primitives[k].targets.Add(morphTarget);
+ gltfMesh.primitives[k].extras.targetNames.Add(mesh.GetBlendShapeName(j));
+ }
+ }
+
+ yield return (mesh, gltfMesh, blendShapeIndexMap);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs.meta
new file mode 100644
index 00000000..7ca52c72
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshExporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9b5d31a97e5221e43b16cfb4213a4a79
+timeCreated: 1545139997
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs
new file mode 100644
index 00000000..ad73e582
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs
@@ -0,0 +1,868 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class MeshImporter
+ {
+ const float FRAME_WEIGHT = 100.0f;
+
+
+ // mesh is sharing morph targets.
+ private static MeshContext _ImportMeshSharingMorphTarget(ImporterContext ctx, glTFMesh gltfMesh)
+ {
+ var positions = new List<Vector3>();
+ var normals = new List<Vector3>();
+ var tangents = new List<Vector4>();
+ var uv = new List<Vector2>();
+ var colors = new List<Color>();
+ var blendShapes = new List<BlendShape>();
+ var meshContext = new MeshContext();
+
+ // blendshapes
+ var targetNames = gltfMesh.extras.targetNames;
+ for (int i = 1; i < gltfMesh.primitives.Count; ++i)
+ {
+ if (gltfMesh.primitives[i].targets.Count != targetNames.Count)
+ {
+ throw new FormatException(string.Format("different targets length: {0} with targetNames length.",
+ gltfMesh.primitives[i]));
+ }
+ }
+ for (var i = 0; i < targetNames.Count; i++)
+ {
+ var blendShape = new BlendShape(!string.IsNullOrEmpty(targetNames[i]) ? targetNames[i] : i.ToString());
+ blendShapes.Add(blendShape);
+ }
+
+ foreach (var prim in gltfMesh.primitives)
+ {
+ var indexOffset = positions.Count;
+ var indexBuffer = prim.indices;
+
+ var positionCount = positions.Count;
+ positions.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.POSITION).Select(x => x.ReverseZ()));
+ positionCount = positions.Count - positionCount;
+
+ // normal
+ if (prim.attributes.NORMAL != -1)
+ {
+ normals.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.NORMAL).Select(x => x.ReverseZ()));
+ }
+
+ if (prim.attributes.TANGENT != -1)
+ {
+ tangents.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector4>(prim.attributes.TANGENT).Select(x => x.ReverseZ()));
+ }
+
+ // uv
+ if (prim.attributes.TEXCOORD_0 != -1)
+ {
+ if (ctx.IsGeneratedUniGLTFAndOlder(1, 16))
+ {
+#pragma warning disable 0612
+ // backward compatibility
+ uv.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector2>(prim.attributes.TEXCOORD_0).Select(x => x.ReverseY()));
+#pragma warning restore 0612
+ }
+ else
+ {
+ uv.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector2>(prim.attributes.TEXCOORD_0).Select(x => x.ReverseUV()));
+ }
+ }
+ else
+ {
+ // for inconsistent attributes in primitives
+ uv.AddRange(new Vector2[positionCount]);
+ }
+
+ // color
+ if (prim.attributes.COLOR_0 != -1)
+ {
+ colors.AddRange(ctx.GLTF.GetArrayFromAccessor<Color>(prim.attributes.COLOR_0));
+ }
+
+ // skin
+ if (prim.attributes.JOINTS_0 != -1 && prim.attributes.WEIGHTS_0 != -1)
+ {
+ var joints0 = ctx.GLTF.GetArrayFromAccessor<UShort4>(prim.attributes.JOINTS_0); // uint4
+ var weights0 = ctx.GLTF.GetArrayFromAccessor<Float4>(prim.attributes.WEIGHTS_0).Select(x => x.One()).ToArray();
+
+ for (int j = 0; j < joints0.Length; ++j)
+ {
+ var bw = new BoneWeight();
+
+ bw.boneIndex0 = joints0[j].x;
+ bw.weight0 = weights0[j].x;
+
+ bw.boneIndex1 = joints0[j].y;
+ bw.weight1 = weights0[j].y;
+
+ bw.boneIndex2 = joints0[j].z;
+ bw.weight2 = weights0[j].z;
+
+ bw.boneIndex3 = joints0[j].w;
+ bw.weight3 = weights0[j].w;
+
+ meshContext.boneWeights.Add(bw);
+ }
+ }
+
+ // blendshape
+ if (prim.targets != null && prim.targets.Count > 0)
+ {
+ for (int i = 0; i < prim.targets.Count; ++i)
+ {
+ var primTarget = prim.targets[i];
+ if (primTarget.POSITION != -1)
+ {
+ blendShapes[i].Positions.AddRange(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.POSITION).Select(x => x.ReverseZ()).ToArray());
+ }
+ if (primTarget.NORMAL != -1)
+ {
+ blendShapes[i].Normals.AddRange(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.NORMAL).Select(x => x.ReverseZ()).ToArray());
+ }
+ if (primTarget.TANGENT != -1)
+ {
+ blendShapes[i].Tangents.AddRange(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.TANGENT).Select(x => x.ReverseZ()).ToArray());
+ }
+ }
+ }
+
+ var indices =
+ (indexBuffer >= 0)
+ ? ctx.GLTF.GetIndices(indexBuffer)
+ : TriangleUtil.FlipTriangle(Enumerable.Range(0, meshContext.positions.Length)).ToArray() // without index array
+ ;
+ for (int i = 0; i < indices.Length; ++i)
+ {
+ indices[i] += indexOffset;
+ }
+
+ meshContext.subMeshes.Add(indices);
+
+ // material
+ meshContext.materialIndices.Add(prim.material);
+ }
+
+ meshContext.positions = positions.ToArray();
+ meshContext.normals = normals.ToArray();
+ meshContext.tangents = tangents.ToArray();
+ meshContext.uv = uv.ToArray();
+ meshContext.blendShapes = blendShapes;
+
+ return meshContext;
+ }
+
+ // multiple submMesh is not sharing a VertexBuffer.
+ // each subMesh use a independent VertexBuffer.
+ private static MeshContext _ImportMeshIndependentVertexBuffer(ImporterContext ctx, glTFMesh gltfMesh)
+ {
+ //Debug.LogWarning("_ImportMeshIndependentVertexBuffer");
+
+ var targets = gltfMesh.primitives[0].targets;
+ for (int i = 1; i < gltfMesh.primitives.Count; ++i)
+ {
+ if (!gltfMesh.primitives[i].targets.SequenceEqual(targets))
+ {
+ throw new NotImplementedException(string.Format("different targets: {0} with {1}",
+ gltfMesh.primitives[i],
+ targets));
+ }
+ }
+
+ var positions = new List<Vector3>();
+ var normals = new List<Vector3>();
+ var tangents = new List<Vector4>();
+ var uv = new List<Vector2>();
+ var colors = new List<Color>();
+ var meshContext = new MeshContext();
+ foreach (var prim in gltfMesh.primitives)
+ {
+ var indexOffset = positions.Count;
+ var indexBuffer = prim.indices;
+
+ var positionCount = positions.Count;
+ positions.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.POSITION).Select(x => x.ReverseZ()));
+ positionCount = positions.Count - positionCount;
+
+ // normal
+ if (prim.attributes.NORMAL != -1)
+ {
+ normals.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.NORMAL).Select(x => x.ReverseZ()));
+ }
+
+ if (prim.attributes.TANGENT != -1)
+ {
+ tangents.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector4>(prim.attributes.TANGENT).Select(x => x.ReverseZ()));
+ }
+
+ // uv
+ if (prim.attributes.TEXCOORD_0 != -1)
+ {
+ if (ctx.IsGeneratedUniGLTFAndOlder(1, 16))
+ {
+#pragma warning disable 0612
+ // backward compatibility
+ uv.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector2>(prim.attributes.TEXCOORD_0).Select(x => x.ReverseY()));
+#pragma warning restore 0612
+ }
+ else
+ {
+ uv.AddRange(ctx.GLTF.GetArrayFromAccessor<Vector2>(prim.attributes.TEXCOORD_0).Select(x => x.ReverseUV()));
+ }
+ }
+ else
+ {
+ // for inconsistent attributes in primitives
+ uv.AddRange(new Vector2[positionCount]);
+ }
+
+ // color
+ if (prim.attributes.COLOR_0 != -1)
+ {
+ colors.AddRange(ctx.GLTF.GetArrayFromAccessor<Color>(prim.attributes.COLOR_0));
+ }
+
+ // skin
+ if (prim.attributes.JOINTS_0 != -1 && prim.attributes.WEIGHTS_0 != -1)
+ {
+ var joints0 = ctx.GLTF.GetArrayFromAccessor<UShort4>(prim.attributes.JOINTS_0); // uint4
+ var weights0 = ctx.GLTF.GetArrayFromAccessor<Float4>(prim.attributes.WEIGHTS_0).Select(x => x.One()).ToArray();
+
+ for (int j = 0; j < joints0.Length; ++j)
+ {
+ var bw = new BoneWeight();
+
+ bw.boneIndex0 = joints0[j].x;
+ bw.weight0 = weights0[j].x;
+
+ bw.boneIndex1 = joints0[j].y;
+ bw.weight1 = weights0[j].y;
+
+ bw.boneIndex2 = joints0[j].z;
+ bw.weight2 = weights0[j].z;
+
+ bw.boneIndex3 = joints0[j].w;
+ bw.weight3 = weights0[j].w;
+
+ meshContext.boneWeights.Add(bw);
+ }
+ }
+
+ // blendshape
+ if (prim.targets != null && prim.targets.Count > 0)
+ {
+ for (int i = 0; i < prim.targets.Count; ++i)
+ {
+ //var name = string.Format("target{0}", i++);
+ var primTarget = prim.targets[i];
+ var blendShape = new BlendShape(!string.IsNullOrEmpty(prim.extras.targetNames[i])
+ ? prim.extras.targetNames[i]
+ : i.ToString())
+ ;
+ if (primTarget.POSITION != -1)
+ {
+ blendShape.Positions.AddRange(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.POSITION).Select(x => x.ReverseZ()).ToArray());
+ }
+ if (primTarget.NORMAL != -1)
+ {
+ blendShape.Normals.AddRange(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.NORMAL).Select(x => x.ReverseZ()).ToArray());
+ }
+ if (primTarget.TANGENT != -1)
+ {
+ blendShape.Tangents.AddRange(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.TANGENT).Select(x => x.ReverseZ()).ToArray());
+ }
+ meshContext.blendShapes.Add(blendShape);
+ }
+ }
+
+ var indices =
+ (indexBuffer >= 0)
+ ? ctx.GLTF.GetIndices(indexBuffer)
+ : TriangleUtil.FlipTriangle(Enumerable.Range(0, meshContext.positions.Length)).ToArray() // without index array
+ ;
+ for (int i = 0; i < indices.Length; ++i)
+ {
+ indices[i] += indexOffset;
+ }
+
+ meshContext.subMeshes.Add(indices);
+
+ // material
+ meshContext.materialIndices.Add(prim.material);
+ }
+
+ meshContext.positions = positions.ToArray();
+ meshContext.normals = normals.ToArray();
+ meshContext.tangents = tangents.ToArray();
+ meshContext.uv = uv.ToArray();
+
+ return meshContext;
+ }
+
+
+ // multiple submesh sharing same VertexBuffer
+ private static MeshContext _ImportMeshSharingVertexBuffer(ImporterContext ctx, glTFMesh gltfMesh)
+ {
+ var context = new MeshContext();
+
+ {
+ var prim = gltfMesh.primitives.First();
+ context.positions = ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.POSITION).SelectInplace(x => x.ReverseZ());
+
+ // normal
+ if (prim.attributes.NORMAL != -1)
+ {
+ context.normals = ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.NORMAL).SelectInplace(x => x.ReverseZ());
+ }
+
+ // tangent
+ if (prim.attributes.TANGENT != -1)
+ {
+ context.tangents = ctx.GLTF.GetArrayFromAccessor<Vector4>(prim.attributes.TANGENT).SelectInplace(x => x.ReverseZ());
+ }
+
+ // uv
+ if (prim.attributes.TEXCOORD_0 != -1)
+ {
+ if (ctx.IsGeneratedUniGLTFAndOlder(1, 16))
+ {
+#pragma warning disable 0612
+ // backward compatibility
+ context.uv = ctx.GLTF.GetArrayFromAccessor<Vector2>(prim.attributes.TEXCOORD_0).SelectInplace(x => x.ReverseY());
+#pragma warning restore 0612
+ }
+ else
+ {
+ context.uv = ctx.GLTF.GetArrayFromAccessor<Vector2>(prim.attributes.TEXCOORD_0).SelectInplace(x => x.ReverseUV());
+ }
+ }
+ else
+ {
+ // for inconsistent attributes in primitives
+ context.uv = new Vector2[context.positions.Length];
+ }
+
+ // color
+ if (prim.attributes.COLOR_0 != -1)
+ {
+ if (ctx.GLTF.accessors[prim.attributes.COLOR_0].TypeCount == 3)
+ {
+ var vec3Color = ctx.GLTF.GetArrayFromAccessor<Vector3>(prim.attributes.COLOR_0);
+ context.colors = new Color[vec3Color.Length];
+
+ for (int i = 0; i < vec3Color.Length; i++)
+ {
+ Vector3 color = vec3Color[i];
+ context.colors[i] = new Color(color.x, color.y, color.z);
+ }
+ }
+ else if (ctx.GLTF.accessors[prim.attributes.COLOR_0].TypeCount == 4)
+ {
+ context.colors = ctx.GLTF.GetArrayFromAccessor<Color>(prim.attributes.COLOR_0);
+ }
+ else
+ {
+ throw new NotImplementedException(string.Format("unknown color type {0}", ctx.GLTF.accessors[prim.attributes.COLOR_0].type));
+ }
+ }
+
+ // skin
+ if (prim.attributes.JOINTS_0 != -1 && prim.attributes.WEIGHTS_0 != -1)
+ {
+ var joints0 = ctx.GLTF.GetArrayFromAccessor<UShort4>(prim.attributes.JOINTS_0); // uint4
+ var weights0 = ctx.GLTF.GetArrayFromAccessor<Float4>(prim.attributes.WEIGHTS_0);
+ for (int i = 0; i < weights0.Length; ++i)
+ {
+ weights0[i] = weights0[i].One();
+ }
+
+ for (int j = 0; j < joints0.Length; ++j)
+ {
+ var bw = new BoneWeight();
+
+ bw.boneIndex0 = joints0[j].x;
+ bw.weight0 = weights0[j].x;
+
+ bw.boneIndex1 = joints0[j].y;
+ bw.weight1 = weights0[j].y;
+
+ bw.boneIndex2 = joints0[j].z;
+ bw.weight2 = weights0[j].z;
+
+ bw.boneIndex3 = joints0[j].w;
+ bw.weight3 = weights0[j].w;
+
+ context.boneWeights.Add(bw);
+ }
+ }
+
+ // blendshape
+ if (prim.targets != null && prim.targets.Count > 0)
+ {
+ context.blendShapes.AddRange(prim.targets.Select((x, i) => new BlendShape(
+ i < prim.extras.targetNames.Count && !string.IsNullOrEmpty(prim.extras.targetNames[i])
+ ? prim.extras.targetNames[i]
+ : i.ToString())));
+ for (int i = 0; i < prim.targets.Count; ++i)
+ {
+ //var name = string.Format("target{0}", i++);
+ var primTarget = prim.targets[i];
+ var blendShape = context.blendShapes[i];
+
+ if (primTarget.POSITION != -1)
+ {
+ blendShape.Positions.Assign(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.POSITION), x => x.ReverseZ());
+ }
+ if (primTarget.NORMAL != -1)
+ {
+ blendShape.Normals.Assign(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.NORMAL), x => x.ReverseZ());
+ }
+ if (primTarget.TANGENT != -1)
+ {
+ blendShape.Tangents.Assign(
+ ctx.GLTF.GetArrayFromAccessor<Vector3>(primTarget.TANGENT), x => x.ReverseZ());
+ }
+ }
+ }
+ }
+
+ foreach (var prim in gltfMesh.primitives)
+ {
+ if (prim.indices == -1)
+ {
+ context.subMeshes.Add(TriangleUtil.FlipTriangle(Enumerable.Range(0, context.positions.Length)).ToArray());
+ }
+ else
+ {
+ var indices = ctx.GLTF.GetIndices(prim.indices);
+ context.subMeshes.Add(indices);
+ }
+
+ // material
+ context.materialIndices.Add(prim.material);
+ }
+
+ return context;
+ }
+
+
+ [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)]
+ struct Float4
+ {
+ public float x;
+ public float y;
+ public float z;
+ public float w;
+
+ public Float4 One()
+ {
+ var sum = x + y + z + w;
+ var f = 1.0f / sum;
+ return new Float4
+ {
+ x = x * f,
+ y = y * f,
+ z = z * f,
+ w = w * f,
+ };
+ }
+ }
+
+
+ public class MeshContext
+ {
+ public string name;
+ public Vector3[] positions;
+ public Vector3[] normals;
+ public Vector4[] tangents;
+ public Vector2[] uv;
+ public Color[] colors;
+ public List<BoneWeight> boneWeights = new List<BoneWeight>();
+ public List<int[]> subMeshes = new List<int[]>();
+ public List<int> materialIndices = new List<int>();
+ public List<BlendShape> blendShapes = new List<BlendShape>();
+ }
+
+
+ public MeshContext ReadMesh(ImporterContext ctx, int meshIndex)
+ {
+ var gltfMesh = ctx.GLTF.meshes[meshIndex];
+
+ bool sharedMorphTarget = gltfMesh.extras != null && gltfMesh.extras.targetNames.Count > 0;
+ MeshContext meshContext;
+ if (sharedMorphTarget)
+ {
+ meshContext = _ImportMeshSharingMorphTarget(ctx, gltfMesh);
+ }
+ else
+ {
+ glTFAttributes lastAttributes = null;
+ var sharedAttributes = true;
+ foreach (var prim in gltfMesh.primitives)
+ {
+ if (lastAttributes != null && !prim.attributes.Equals(lastAttributes))
+ {
+ sharedAttributes = false;
+ break;
+ }
+
+ lastAttributes = prim.attributes;
+ }
+
+ meshContext = sharedAttributes
+ ? _ImportMeshSharingVertexBuffer(ctx, gltfMesh)
+ : _ImportMeshIndependentVertexBuffer(ctx, gltfMesh);
+ }
+
+ meshContext.name = gltfMesh.name;
+ if (string.IsNullOrEmpty(meshContext.name))
+ {
+ meshContext.name = string.Format("UniGLTF import#{0}", meshIndex);
+ }
+
+ return meshContext;
+ }
+
+
+ public static MeshWithMaterials BuildMesh(ImporterContext ctx, MeshImporter.MeshContext meshContext)
+ {
+ if (!meshContext.materialIndices.Any())
+ {
+ meshContext.materialIndices.Add(0);
+ }
+
+ //Debug.Log(prims.ToJson());
+ var mesh = new Mesh();
+ mesh.name = meshContext.name;
+
+ if (meshContext.positions.Length > UInt16.MaxValue)
+ {
+#if UNITY_2017_3_OR_NEWER
+ mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
+#else
+ Debug.LogWarningFormat("vertices {0} exceed 65535. not implemented. Unity2017.3 supports large mesh",
+ meshContext.positions.Length);
+#endif
+ }
+
+ mesh.vertices = meshContext.positions;
+ bool recalculateNormals = false;
+ if (meshContext.normals != null && meshContext.normals.Length > 0)
+ {
+ mesh.normals = meshContext.normals;
+ }
+ else
+ {
+ recalculateNormals = true;
+ }
+
+ if (meshContext.uv != null && meshContext.uv.Length > 0)
+ {
+ mesh.uv = meshContext.uv;
+ }
+
+ bool recalculateTangents = true;
+#if UNIGLTF_IMPORT_TANGENTS
+ if (meshContext.tangents != null && meshContext.tangents.Length > 0)
+ {
+ mesh.tangents = meshContext.tangents;
+ recalculateTangents = false;
+ }
+#endif
+
+ if (meshContext.colors != null && meshContext.colors.Length > 0)
+ {
+ mesh.colors = meshContext.colors;
+ }
+ if (meshContext.boneWeights != null && meshContext.boneWeights.Count > 0)
+ {
+ mesh.boneWeights = meshContext.boneWeights.ToArray();
+ }
+ mesh.subMeshCount = meshContext.subMeshes.Count;
+ for (int i = 0; i < meshContext.subMeshes.Count; ++i)
+ {
+ mesh.SetTriangles(meshContext.subMeshes[i], i);
+ }
+
+ if (recalculateNormals)
+ {
+ mesh.RecalculateNormals();
+ }
+ if (recalculateTangents)
+ {
+#if UNITY_5_6_OR_NEWER
+ mesh.RecalculateTangents();
+#else
+ CalcTangents(mesh);
+#endif
+ }
+
+ var result = new MeshWithMaterials
+ {
+ Mesh = mesh,
+ Materials = meshContext.materialIndices.Select(x => ctx.GetMaterial(x)).ToArray()
+ };
+
+ if (meshContext.blendShapes != null)
+ {
+ Vector3[] emptyVertices = null;
+ foreach (var blendShape in meshContext.blendShapes)
+ {
+ if (blendShape.Positions.Count > 0)
+ {
+ if (blendShape.Positions.Count == mesh.vertexCount)
+ {
+ mesh.AddBlendShapeFrame(blendShape.Name, FRAME_WEIGHT,
+ blendShape.Positions.ToArray(),
+ (meshContext.normals != null && meshContext.normals.Length == mesh.vertexCount && blendShape.Normals.Count() == blendShape.Positions.Count()) ? blendShape.Normals.ToArray() : null,
+ null
+ );
+ }
+ else
+ {
+ Debug.LogWarningFormat("May be partial primitive has blendShape. Require separate mesh or extend blend shape, but not implemented: {0}", blendShape.Name);
+ }
+ }
+ else
+ {
+ if (emptyVertices == null)
+ {
+ emptyVertices = new Vector3[mesh.vertexCount];
+ }
+ // Debug.LogFormat("empty blendshape: {0}.{1}", mesh.name, blendShape.Name);
+ // add empty blend shape for keep blend shape index
+ mesh.AddBlendShapeFrame(blendShape.Name, FRAME_WEIGHT,
+ emptyVertices,
+ null,
+ null
+ );
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public static IEnumerator BuildMeshCoroutine(ImporterContext ctx, MeshImporter.MeshContext meshContext)
+ {
+ if (!meshContext.materialIndices.Any())
+ {
+ meshContext.materialIndices.Add(0);
+ }
+
+ var mesh = new Mesh();
+ mesh.name = meshContext.name;
+
+ if (meshContext.positions.Length > UInt16.MaxValue)
+ {
+#if UNITY_2017_3_OR_NEWER
+ mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
+#else
+ Debug.LogWarningFormat("vertices {0} exceed 65535. not implemented. Unity2017.3 supports large mesh",
+ meshContext.positions.Length);
+#endif
+ }
+
+
+ mesh.vertices = meshContext.positions;
+ bool recalculateNormals = false;
+ if (meshContext.normals != null && meshContext.normals.Length > 0)
+ {
+
+ mesh.normals = meshContext.normals;
+ }
+ else
+ {
+ recalculateNormals = true;
+ }
+
+ if (meshContext.uv != null && meshContext.uv.Length > 0)
+ {
+
+ mesh.uv = meshContext.uv;
+ }
+
+ bool recalculateTangents = true;
+#if UNIGLTF_IMPORT_TANGENTS
+ if (meshContext.tangents != null && meshContext.tangents.Length > 0)
+ {
+ mesh.tangents = meshContext.tangents;
+ recalculateTangents = false;
+ }
+#endif
+
+ if (meshContext.colors != null && meshContext.colors.Length > 0)
+ {
+
+ mesh.colors = meshContext.colors;
+ }
+ if (meshContext.boneWeights != null && meshContext.boneWeights.Count > 0)
+ {
+ mesh.boneWeights = meshContext.boneWeights.ToArray();
+ }
+ mesh.subMeshCount = meshContext.subMeshes.Count;
+ for (int i = 0; i < meshContext.subMeshes.Count; ++i)
+ {
+ mesh.SetTriangles(meshContext.subMeshes[i], i);
+ }
+
+ if (recalculateNormals)
+ {
+ mesh.RecalculateNormals();
+ }
+ if (recalculateTangents)
+ {
+#if UNITY_5_6_OR_NEWER
+ yield return null;
+ mesh.RecalculateTangents();
+ yield return null;
+#else
+ CalcTangents(mesh);
+#endif
+ }
+
+ var result = new MeshWithMaterials
+ {
+ Mesh = mesh,
+ Materials = meshContext.materialIndices.Select(x => ctx.GetMaterial(x)).ToArray()
+ };
+
+ yield return null;
+ if (meshContext.blendShapes != null)
+ {
+ Vector3[] emptyVertices = null;
+
+ foreach (var blendShape in meshContext.blendShapes)
+ {
+ if (blendShape.Positions.Count > 0)
+ {
+ if (blendShape.Positions.Count == mesh.vertexCount)
+ {
+ mesh.AddBlendShapeFrame(blendShape.Name, FRAME_WEIGHT,
+ blendShape.Positions.ToArray(),
+ (meshContext.normals != null && meshContext.normals.Length == mesh.vertexCount && blendShape.Normals.Count() == blendShape.Positions.Count()) ? blendShape.Normals.ToArray() : null,
+ null
+ );
+ yield return null;
+ }
+ else
+ {
+ Debug.LogWarningFormat("May be partial primitive has blendShape. Require separate mesh or extend blend shape, but not implemented: {0}", blendShape.Name);
+ }
+ }
+ else
+ {
+ if (emptyVertices == null)
+ {
+ emptyVertices = new Vector3[mesh.vertexCount];
+ }
+ // Debug.LogFormat("empty blendshape: {0}.{1}", mesh.name, blendShape.Name);
+ // add empty blend shape for keep blend shape index
+ mesh.AddBlendShapeFrame(blendShape.Name, FRAME_WEIGHT,
+ emptyVertices,
+ null,
+ null
+ );
+ yield return null;
+ }
+ }
+ }
+
+ yield return result;
+ }
+
+ /// <summary>
+ /// Meshの法線を元にタンジェントを計算する。
+ /// </summary>
+ /// <param name="mesh">メッシュ</param>
+ /// <returns>タンジェント</returns>
+ public static void CalcTangents(Mesh mesh)
+ {
+ int vertexCount = mesh.vertexCount;
+ Vector3[] vertices = mesh.vertices;
+ Vector3[] normals = mesh.normals;
+ Vector2[] texcoords = mesh.uv;
+ int[] triangles = mesh.triangles;
+ int triangleCount = triangles.Length / 3;
+
+ Vector4[] tangents = new Vector4[vertexCount];
+ Vector3[] tan1 = new Vector3[vertexCount];
+ Vector3[] tan2 = new Vector3[vertexCount];
+
+ int tri = 0;
+
+ for (int i = 0; i < (triangleCount); i++)
+ {
+ int i1 = triangles[tri];
+ int i2 = triangles[tri + 1];
+ int i3 = triangles[tri + 2];
+
+ Vector3 v1 = vertices[i1];
+ Vector3 v2 = vertices[i2];
+ Vector3 v3 = vertices[i3];
+
+ Vector2 w1 = texcoords[i1];
+ Vector2 w2 = texcoords[i2];
+ Vector2 w3 = texcoords[i3];
+
+ float x1 = v2.x - v1.x;
+ float x2 = v3.x - v1.x;
+ float y1 = v2.y - v1.y;
+ float y2 = v3.y - v1.y;
+ float z1 = v2.z - v1.z;
+ float z2 = v3.z - v1.z;
+
+ float s1 = w2.x - w1.x;
+ float s2 = w3.x - w1.x;
+ float t1 = w2.y - w1.y;
+ float t2 = w3.y - w1.y;
+
+ float r = 1.0f / (s1 * t2 - s2 * t1);
+ Vector3 sdir = new Vector3((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r);
+ Vector3 tdir = new Vector3((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r);
+
+ tan1[i1] += sdir;
+ tan1[i2] += sdir;
+ tan1[i3] += sdir;
+
+ tan2[i1] += tdir;
+ tan2[i2] += tdir;
+ tan2[i3] += tdir;
+
+ tri += 3;
+ }
+
+ for (int i = 0; i < (vertexCount); i++)
+ {
+ Vector3 n = normals[i];
+ Vector3 t = tan1[i];
+
+ // Gram-Schmidt orthogonalize
+ Vector3.OrthoNormalize(ref n, ref t);
+ tangents[i].x = t.x;
+ tangents[i].y = t.y;
+ tangents[i].z = t.z;
+
+ // Calculate handedness
+ tangents[i].w = (Vector3.Dot(Vector3.Cross(n, t), tan2[i]) < 0.0f) ? -1.0f : 1.0f;
+ }
+
+ mesh.tangents = tangents;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs.meta
new file mode 100644
index 00000000..e01d5bdb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshImporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: cbd062b14ca5eba4da4a5653b85e2151
+timeCreated: 1535177327
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs
new file mode 100644
index 00000000..42c2e11d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class MeshWithMaterials
+ {
+ public Mesh Mesh;
+ public Material[] Materials;
+
+ // 複数のノードから参照されうる
+ public List<Renderer> Renderers=new List<Renderer>(); // SkinnedMeshRenderer or MeshRenderer
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs.meta
new file mode 100644
index 00000000..7c853811
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/MeshWithMaterials.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 04f2758551c076e4e9060e3117817e29
+timeCreated: 1517335903
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs
new file mode 100644
index 00000000..b0782b1f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs
@@ -0,0 +1,215 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public static class NodeImporter
+ {
+ public static GameObject ImportNode(glTFNode node, int nodeIndex)
+ {
+ var nodeName = node.name;
+ if (!string.IsNullOrEmpty(nodeName) && nodeName.Contains("/"))
+ {
+ Debug.LogWarningFormat("node {0} contains /. replace _", node.name);
+ nodeName = nodeName.Replace("/", "_");
+ }
+ if(string.IsNullOrEmpty(nodeName))
+ {
+ nodeName = string.Format("nodeIndex_{0}", nodeIndex);
+ }
+ var go = new GameObject(nodeName);
+
+ //
+ // transform
+ //
+ if (node.translation != null && node.translation.Length > 0)
+ {
+ go.transform.localPosition = new Vector3(
+ node.translation[0],
+ node.translation[1],
+ node.translation[2]);
+ }
+ if (node.rotation != null && node.rotation.Length > 0)
+ {
+ go.transform.localRotation = new Quaternion(
+ node.rotation[0],
+ node.rotation[1],
+ node.rotation[2],
+ node.rotation[3]);
+ }
+ if (node.scale != null && node.scale.Length > 0)
+ {
+ go.transform.localScale = new Vector3(
+ node.scale[0],
+ node.scale[1],
+ node.scale[2]);
+ }
+ if (node.matrix != null && node.matrix.Length > 0)
+ {
+ var m = UnityExtensions.MatrixFromArray(node.matrix);
+ go.transform.localRotation = m.ExtractRotation();
+ go.transform.localPosition = m.ExtractPosition();
+ go.transform.localScale = m.ExtractScale();
+ }
+ return go;
+ }
+
+ public class TransformWithSkin
+ {
+ public Transform Transform;
+ public GameObject GameObject { get { return Transform.gameObject; } }
+ public int? SkinIndex;
+ }
+
+ public static TransformWithSkin BuildHierarchy(ImporterContext context, int i)
+ {
+ var go = context.Nodes[i].gameObject;
+ if (string.IsNullOrEmpty(go.name))
+ {
+ go.name = string.Format("node{0:000}", i);
+ }
+
+ var nodeWithSkin = new TransformWithSkin
+ {
+ Transform = go.transform,
+ };
+
+ //
+ // build hierarchy
+ //
+ var node = context.GLTF.nodes[i];
+ if (node.children != null)
+ {
+ foreach (var child in node.children)
+ {
+ context.Nodes[child].transform.SetParent(context.Nodes[i].transform,
+ false // node has local transform
+ );
+ }
+ }
+
+ //
+ // attach mesh
+ //
+ if (node.mesh != -1)
+ {
+ var mesh = context.Meshes[node.mesh];
+ if (mesh.Mesh.blendShapeCount == 0 && node.skin == -1)
+ {
+ // without blendshape and bone skinning
+ var filter = go.AddComponent<MeshFilter>();
+ filter.sharedMesh = mesh.Mesh;
+ var renderer = go.AddComponent<MeshRenderer>();
+ renderer.sharedMaterials = mesh.Materials;
+ // invisible in loading
+ renderer.enabled = false;
+ mesh.Renderers.Add(renderer);
+ }
+ else
+ {
+ var renderer = go.AddComponent<SkinnedMeshRenderer>();
+
+ if (node.skin != -1)
+ {
+ nodeWithSkin.SkinIndex = node.skin;
+ }
+
+ renderer.sharedMesh = mesh.Mesh;
+ renderer.sharedMaterials = mesh.Materials;
+ // invisible in loading
+ renderer.enabled = false;
+ mesh.Renderers.Add(renderer);
+ }
+ }
+
+ return nodeWithSkin;
+ }
+
+ //
+ // fix node's coordinate. z-back to z-forward
+ //
+ public static void FixCoordinate(ImporterContext context, List<TransformWithSkin> nodes)
+ {
+ var globalTransformMap = nodes.ToDictionary(x => x.Transform, x => new PosRot
+ {
+ Position = x.Transform.position,
+ Rotation = x.Transform.rotation,
+ });
+ foreach (var x in context.GLTF.rootnodes)
+ {
+ // fix nodes coordinate
+ // reverse Z in global
+ var t = nodes[x].Transform;
+ //t.SetParent(root.transform, false);
+
+ foreach (var transform in t.Traverse())
+ {
+ var g = globalTransformMap[transform];
+ transform.position = g.Position.ReverseZ();
+ transform.rotation = g.Rotation.ReverseZ();
+ }
+ }
+ }
+
+ public static void SetupSkinning(ImporterContext context, List<TransformWithSkin> nodes, int i)
+ {
+ var x = nodes[i];
+ var skinnedMeshRenderer = x.Transform.GetComponent<SkinnedMeshRenderer>();
+ if (skinnedMeshRenderer != null)
+ {
+ var mesh = skinnedMeshRenderer.sharedMesh;
+ if (x.SkinIndex.HasValue)
+ {
+ if (mesh == null) throw new Exception();
+ if (skinnedMeshRenderer == null) throw new Exception();
+
+ if (x.SkinIndex.Value < context.GLTF.skins.Count)
+ {
+ // calculate internal values(boundingBox etc...) when sharedMesh assigned ?
+ skinnedMeshRenderer.sharedMesh = null;
+
+ var skin = context.GLTF.skins[x.SkinIndex.Value];
+ var joints = skin.joints.Select(y => nodes[y].Transform).ToArray();
+ if (joints.Any())
+ {
+ // have bones
+ skinnedMeshRenderer.bones = joints;
+
+ if (skin.inverseBindMatrices != -1)
+ {
+ var bindPoses = context.GLTF.GetArrayFromAccessor<Matrix4x4>(skin.inverseBindMatrices)
+ .Select(y => y.ReverseZ())
+ .ToArray()
+ ;
+ mesh.bindposes = bindPoses;
+ }
+ else
+ {
+ //
+ // calc default matrices
+ // https://docs.unity3d.com/ScriptReference/Mesh-bindposes.html
+ //
+ var meshCoords = skinnedMeshRenderer.transform; // ?
+ var calculatedBindPoses = joints.Select(y => y.worldToLocalMatrix * meshCoords.localToWorldMatrix).ToArray();
+ mesh.bindposes = calculatedBindPoses;
+ }
+ }
+ else
+ {
+ // BlendShape only ?
+ }
+
+ skinnedMeshRenderer.sharedMesh = mesh;
+ if (skin.skeleton >= 0 && skin.skeleton < nodes.Count)
+ {
+ skinnedMeshRenderer.rootBone = nodes[skin.skeleton].Transform;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs.meta
new file mode 100644
index 00000000..6ceb399a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/NodeImporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: dcc3725a84dcf7f49960c89f1f68534c
+timeCreated: 1537534443
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs
new file mode 100644
index 00000000..c6e810b1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs
@@ -0,0 +1,123 @@
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public interface IShaderStore
+ {
+ Shader GetShader(glTFMaterial material);
+ }
+
+ public class ShaderStore : IShaderStore
+ {
+ readonly string m_defaultShaderName = "Standard";
+ Shader m_default;
+ Shader Default
+ {
+ get
+ {
+ if (m_default == null)
+ {
+ m_default = Shader.Find(m_defaultShaderName);
+ }
+ return m_default;
+ }
+ }
+
+ Shader m_vcolor;
+ Shader VColor
+ {
+ get
+ {
+ if (m_vcolor == null) m_vcolor = Shader.Find("UniGLTF/StandardVColor");
+ return m_vcolor;
+ }
+ }
+
+ Shader m_uniUnlit;
+ Shader UniUnlit
+ {
+ get
+ {
+ if (m_uniUnlit == null) m_uniUnlit = Shader.Find("UniGLTF/UniUnlit");
+ return m_uniUnlit;
+ }
+ }
+
+ Shader m_unlitTexture;
+ Shader UnlitTexture
+ {
+ get
+ {
+ if (m_unlitTexture == null) m_unlitTexture = Shader.Find("Unlit/Texture");
+ return m_unlitTexture;
+ }
+ }
+
+ Shader m_unlitColor;
+ Shader UnlitColor
+ {
+ get
+ {
+ if (m_unlitColor == null) m_unlitColor = Shader.Find("Unlit/Color");
+ return m_unlitColor;
+ }
+ }
+
+ Shader m_unlitTransparent;
+ Shader UnlitTransparent
+ {
+ get
+ {
+ if (m_unlitTransparent == null) m_unlitTransparent = Shader.Find("Unlit/Transparent");
+ return m_unlitTransparent;
+ }
+ }
+
+ Shader m_unlitCutout;
+ Shader UnlitCutout
+ {
+ get
+ {
+ if (m_unlitCutout == null) m_unlitCutout = Shader.Find("Unlit/Transparent Cutout");
+ return m_unlitCutout;
+ }
+ }
+
+ //ImporterContext m_context;
+ public ShaderStore(ImporterContext _)
+ {
+ //m_context = context;
+ }
+
+ public static bool IsWhite(float[] color)
+ {
+ if (color == null) return false;
+ if(color.Length!=4)return false;
+ if(color[0]!=1
+ || color[1]!=1
+ || color[2]!=1
+ || color[3] != 1)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public Shader GetShader(glTFMaterial material)
+ {
+ if (material == null)
+ {
+ return Default;
+ }
+
+ if (material.extensions != null && material.extensions.KHR_materials_unlit != null)
+ {
+ return UniUnlit;
+ }
+
+ // standard
+ return Default;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs.meta
new file mode 100644
index 00000000..def6e660
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ShaderStore.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 75aae8e866422d24180458afaacb2c1d
+timeCreated: 1529327427
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs
new file mode 100644
index 00000000..3bcff4a6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs
@@ -0,0 +1,186 @@
+using System.Collections.Generic;
+using UnityEngine;
+using System.IO;
+using System.Linq;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public static class StaticMeshIntegrator
+ {
+ const string ASSET_SUFFIX = ".mesh.asset";
+
+ class Integrator
+ {
+ List<Vector3> m_positions = new List<Vector3>();
+ List<Vector3> m_normals = new List<Vector3>();
+ List<Vector2> m_uv = new List<Vector2>();
+ /*
+ List<Vector2> m_uv2 = new List<Vector2>(); // ToDo
+ List<Vector2> m_uv3 = new List<Vector2>(); // ToDo
+ List<Vector2> m_uv4 = new List<Vector2>(); // ToDo
+ List<Color> m_colors = new List<Color>(); // ToDo
+ */
+
+ List<int[]> m_subMeshes = new List<int[]>();
+
+ List<Material> m_materials = new List<Material>();
+ public List<Material> Materials
+ {
+ get { return m_materials; }
+ }
+
+ public void Push(Matrix4x4 localToRoot, Mesh mesh, Material[] materials)
+ {
+ var offset = m_positions.Count;
+
+ var hasNormal = m_normals.Count == m_positions.Count;
+ var hasUv = m_uv.Count == m_positions.Count;
+
+ // attributes
+ m_positions.AddRange(mesh.vertices.Select(x => localToRoot.MultiplyPoint(x)));
+ if(mesh.normals!=null && mesh.normals.Length == mesh.vertexCount)
+ {
+ if (!hasNormal) for (int i = m_normals.Count; i < m_positions.Count; ++i) m_normals.Add(Vector3.zero);
+ m_normals.AddRange(mesh.normals.Select(x => localToRoot.MultiplyVector(x)));
+ }
+ if (mesh.uv != null && mesh.uv.Length == mesh.vertexCount)
+ {
+ if (!hasUv) for (int i = m_uv.Count; i < m_positions.Count; ++i) m_uv.Add(Vector2.zero);
+ m_uv.AddRange(mesh.uv);
+ }
+
+ // indices
+ for (int i = 0; i < mesh.subMeshCount; ++i)
+ {
+ m_subMeshes.Add(mesh.GetIndices(i).Select(x => offset + x).ToArray());
+ }
+
+ // materials
+ m_materials.AddRange(materials);
+ }
+
+ public Mesh ToMesh()
+ {
+ var mesh = new Mesh();
+ mesh.name = "integrated";
+
+ mesh.vertices = m_positions.ToArray();
+ if (m_normals.Count > 0)
+ {
+ if (m_normals.Count < m_positions.Count) for (int i = m_normals.Count; i < m_positions.Count; ++i) m_normals.Add(Vector3.zero);
+ mesh.normals = m_normals.ToArray();
+ }
+ if (m_uv.Count > 0)
+ {
+ if (m_uv.Count < m_positions.Count) for (int i = m_uv.Count; i < m_positions.Count; ++i) m_uv.Add(Vector2.zero);
+ mesh.uv = m_uv.ToArray();
+ }
+
+ mesh.subMeshCount = m_subMeshes.Count;
+ for(int i=0; i<m_subMeshes.Count; ++i)
+ {
+ mesh.SetIndices(m_subMeshes[i], MeshTopology.Triangles, i);
+ }
+
+ return mesh;
+ }
+ }
+
+ public struct MeshWithMaterials
+ {
+ public Mesh Mesh;
+ public Material[] Materials;
+ }
+
+ public static MeshWithMaterials Integrate(Transform root)
+ {
+ var integrator = new Integrator();
+
+ foreach (var t in root.Traverse())
+ {
+ var renderer = t.GetComponent<MeshRenderer>();
+ var filter = t.GetComponent<MeshFilter>();
+ if (renderer != null && filter != null && filter.sharedMesh != null
+ && renderer.sharedMaterials!=null && renderer.sharedMaterials.Length == filter.sharedMesh.subMeshCount)
+ {
+ integrator.Push(root.worldToLocalMatrix * t.localToWorldMatrix, filter.sharedMesh, renderer.sharedMaterials);
+ }
+ }
+
+ return new MeshWithMaterials
+ {
+ Mesh = integrator.ToMesh(),
+ Materials = integrator.Materials.ToArray(),
+ };
+ }
+
+#if UNITY_EDITOR
+ [MenuItem("Mesh Utility/Integrate Static Mesh", validate = true)]
+ public static bool CanIntegrateSelected()
+ {
+ return Selection.activeObject != null && Selection.activeObject is GameObject;
+ }
+
+ [MenuItem("Mesh Utility/Integrate Static Mesh", priority = 3)]
+ public static void IntegrateSelected()
+ {
+ var go = Selection.activeObject as GameObject;
+ var meshWithMaterials = Integrate(go.transform);
+
+ // save as asset
+ var assetPath = "";
+#if UNITY_2018_2_OR_NEWER
+ var prefab = PrefabUtility.GetCorrespondingObjectFromSource(go);
+#else
+ var prefab = PrefabUtility.GetPrefabParent(go);
+#endif
+ if (prefab != null)
+ {
+ var prefabPath = AssetDatabase.GetAssetPath(prefab);
+ assetPath = string.Format("{0}/{1}_{2}{3}",
+ Path.GetDirectoryName(prefabPath),
+ Path.GetFileNameWithoutExtension(prefabPath),
+ go.name,
+ ASSET_SUFFIX
+ );
+ }
+ else
+ {
+ var path = EditorUtility.SaveFilePanel(
+ "Save mesh",
+ "Assets",
+ go.name+".asset",
+ "asset");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+ assetPath = UnityPath.FromFullpath(path).Value;
+ }
+
+ assetPath = AssetDatabase.GenerateUniqueAssetPath(assetPath);
+ Debug.LogFormat("CreateAsset: {0}", assetPath);
+ AssetDatabase.CreateAsset(meshWithMaterials.Mesh, assetPath);
+
+ // add component
+ var meshObject = new GameObject(go.name + ".integrated");
+ if (go.transform.parent != null)
+ {
+ meshObject.transform.SetParent(go.transform.parent, false);
+ }
+ meshObject.transform.localPosition = go.transform.localPosition;
+ meshObject.transform.localRotation = go.transform.localRotation;
+ meshObject.transform.localScale = go.transform.localScale;
+
+ var filter = meshObject.AddComponent<MeshFilter>();
+ filter.sharedMesh = meshWithMaterials.Mesh;
+ var renderer = meshObject.AddComponent<MeshRenderer>();
+ renderer.sharedMaterials = meshWithMaterials.Materials;
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs.meta
new file mode 100644
index 00000000..b9b730e0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/StaticMeshIntegrator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5d049a3daed1255499aaec8b6d1a2afe
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs
new file mode 100644
index 00000000..d6323588
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs
@@ -0,0 +1,201 @@
+using System;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public interface ITextureConverter
+ {
+ Texture2D GetImportTexture(Texture2D texture);
+ Texture2D GetExportTexture(Texture2D texture);
+ }
+
+ public static class TextureConverter
+ {
+ public delegate Color32 ColorConversion(Color32 color);
+
+ public static Texture2D Convert(Texture2D texture, glTFTextureTypes textureType, ColorConversion colorConversion, Material convertMaterial)
+ {
+ var copyTexture = TextureItem.CopyTexture(texture, TextureIO.GetColorSpace(textureType), convertMaterial);
+ if (colorConversion != null)
+ {
+ copyTexture.SetPixels32(copyTexture.GetPixels32().Select(x => colorConversion(x)).ToArray());
+ copyTexture.Apply();
+ }
+ copyTexture.name = texture.name;
+ return copyTexture;
+ }
+
+ public static void AppendTextureExtension(Texture texture, string extension)
+ {
+ if (!texture.name.EndsWith(extension))
+ {
+ texture.name = texture.name + extension;
+ }
+ }
+
+ public static void RemoveTextureExtension(Texture texture, string extension)
+ {
+ if (texture.name.EndsWith(extension))
+ {
+ texture.name = texture.name.Replace(extension, "");
+ }
+ }
+ }
+
+ public class MetallicRoughnessConverter : ITextureConverter
+ {
+ private const string m_extension = ".metallicRoughness";
+
+ private float _smoothnessOrRoughness;
+
+ public MetallicRoughnessConverter(float smoothnessOrRoughness)
+ {
+ _smoothnessOrRoughness = smoothnessOrRoughness;
+ }
+
+ public Texture2D GetImportTexture(Texture2D texture)
+ {
+ var converted = TextureConverter.Convert(texture, glTFTextureTypes.Metallic, Import, null);
+ TextureConverter.AppendTextureExtension(converted, m_extension);
+ return converted;
+ }
+
+ public Texture2D GetExportTexture(Texture2D texture)
+ {
+ var converted = TextureConverter.Convert(texture, glTFTextureTypes.Metallic, Export, null);
+ TextureConverter.RemoveTextureExtension(converted, m_extension);
+ return converted;
+ }
+
+ public Color32 Import(Color32 src)
+ {
+ // Roughness(glTF): dst.g -> Smoothness(Unity): src.a (with conversion)
+ // Metallic(glTF) : dst.b -> Metallic(Unity) : src.r
+
+ var pixelRoughnessFactor = (src.g * _smoothnessOrRoughness) / 255.0f; // roughness
+ var pixelSmoothness = 1.0f - Mathf.Sqrt(pixelRoughnessFactor);
+
+ return new Color32
+ {
+ r = src.b,
+ g = 0,
+ b = 0,
+ // Bake roughness values into a texture.
+ // See: https://github.com/dwango/UniVRM/issues/212.
+ a = (byte)Mathf.Clamp(pixelSmoothness * 255, 0, 255),
+ };
+ }
+
+ public Color32 Export(Color32 src)
+ {
+ // Smoothness(Unity): src.a -> Roughness(glTF): dst.g (with conversion)
+ // Metallic(Unity) : src.r -> Metallic(glTF) : dst.b
+
+ var pixelSmoothness = (src.a * _smoothnessOrRoughness) / 255.0f; // smoothness
+ // https://blogs.unity3d.com/jp/2016/01/25/ggx-in-unity-5-3/
+ var pixelRoughnessFactorSqrt = (1.0f - pixelSmoothness);
+ var pixelRoughnessFactor = pixelRoughnessFactorSqrt * pixelRoughnessFactorSqrt;
+
+ return new Color32
+ {
+ r = 0,
+ // Bake smoothness values into a texture.
+ // See: https://github.com/dwango/UniVRM/issues/212.
+ g = (byte)Mathf.Clamp(pixelRoughnessFactor * 255, 0, 255),
+ b = src.r,
+ a = 255,
+ };
+ }
+ }
+
+ public class NormalConverter : ITextureConverter
+ {
+ private const string m_extension = ".normal";
+
+ private Material m_decoder;
+ private Material GetDecoder()
+ {
+ if (m_decoder == null)
+ {
+ m_decoder = new Material(Shader.Find("UniGLTF/NormalMapDecoder"));
+ }
+ return m_decoder;
+ }
+
+ private Material m_encoder;
+ private Material GetEncoder()
+ {
+ if (m_encoder == null)
+ {
+ m_encoder = new Material(Shader.Find("UniGLTF/NormalMapEncoder"));
+ }
+ return m_encoder;
+ }
+
+ // GLTF data to Unity texture
+ // ConvertToNormalValueFromRawColorWhenCompressionIsRequired
+ public Texture2D GetImportTexture(Texture2D texture)
+ {
+ var mat = GetEncoder();
+ var converted = TextureConverter.Convert(texture, glTFTextureTypes.Normal, null, mat);
+ TextureConverter.AppendTextureExtension(converted, m_extension);
+ return converted;
+ }
+
+ // Unity texture to GLTF data
+ // ConvertToRawColorWhenNormalValueIsCompressed
+ public Texture2D GetExportTexture(Texture2D texture)
+ {
+ var mat = GetDecoder();
+ var converted = TextureConverter.Convert(texture, glTFTextureTypes.Normal, null, mat);
+ TextureConverter.RemoveTextureExtension(converted, m_extension);
+ return converted;
+ }
+ }
+
+ public class OcclusionConverter : ITextureConverter
+ {
+ private const string m_extension = ".occlusion";
+
+ public Texture2D GetImportTexture(Texture2D texture)
+ {
+ var converted = TextureConverter.Convert(texture, glTFTextureTypes.Occlusion, Import, null);
+ TextureConverter.AppendTextureExtension(converted, m_extension);
+ return converted;
+ }
+
+ public Texture2D GetExportTexture(Texture2D texture)
+ {
+ var converted = TextureConverter.Convert(texture, glTFTextureTypes.Occlusion, Export, null);
+ TextureConverter.RemoveTextureExtension(converted, m_extension);
+ return converted;
+ }
+
+ public Color32 Import(Color32 src)
+ {
+ return new Color32
+ {
+ r = 0,
+ g = src.r,
+ b = 0,
+ a = 255,
+ };
+ }
+
+ public Color32 Export(Color32 src)
+ {
+ return new Color32
+ {
+ r = src.g,
+ g = 0,
+ b = 0,
+ a = 255,
+ };
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs.meta
new file mode 100644
index 00000000..1c3a1df2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureConverter.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 5d2d27884d6c4780b08c745e5cc5c5b5
+timeCreated: 1537261040 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs
new file mode 100644
index 00000000..6a1baad9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs
@@ -0,0 +1,93 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public class TextureExportManager
+ {
+ List<Texture> m_textures;
+ public List<Texture> Textures
+ {
+ get { return m_textures; }
+ }
+
+ List<Texture> m_exportTextures;
+ public Texture GetExportTexture(int index)
+ {
+ if (index < 0 || index >= m_exportTextures.Count)
+ {
+ return null;
+ }
+ if (m_exportTextures[index] != null)
+ {
+ // コピー変換済み
+ return m_exportTextures[index];
+ }
+
+ // オリジナル
+ return m_textures[index];
+ }
+
+ public TextureExportManager(IEnumerable<Texture> textures)
+ {
+ /*
+ if (textures == null)
+ {
+ throw new System.ArgumentNullException();
+ }
+ */
+ m_textures = textures.ToList();
+ m_exportTextures = new List<Texture>(Enumerable.Repeat<Texture>(null, m_textures.Count));
+ }
+
+ public int CopyAndGetIndex(Texture texture, RenderTextureReadWrite readWrite)
+ {
+ if (texture == null)
+ {
+ return -1;
+ }
+
+ var index = m_textures.IndexOf(texture);
+ if (index == -1)
+ {
+ // ありえない?
+ return -1;
+ }
+
+#if UNITY_EDITOR
+ if (!string.IsNullOrEmpty(UnityEditor.AssetDatabase.GetAssetPath(texture)))
+ {
+ m_exportTextures[index] = texture;
+ return index;
+ }
+#endif
+
+ // ToDo: may already exists
+ m_exportTextures[index] = TextureItem.CopyTexture(texture, readWrite, null);
+
+ return index;
+ }
+
+ public int ConvertAndGetIndex(Texture texture, ITextureConverter converter)
+ {
+ if (texture == null)
+ {
+ return -1;
+ }
+
+ var index = m_textures.IndexOf(texture);
+ if (index == -1)
+ {
+ // ありえない?
+ return -1;
+ }
+
+ m_exportTextures[index] = converter.GetExportTexture(texture as Texture2D);
+
+ return index;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs.meta
new file mode 100644
index 00000000..5048e047
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 435499f173753ac418331fe0f967b789
+timeCreated: 1541561421
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs
new file mode 100644
index 00000000..bf1fc890
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs
@@ -0,0 +1,207 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using System.Reflection;
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public static class TextureIO
+ {
+ public static RenderTextureReadWrite GetColorSpace(glTFTextureTypes textureType)
+ {
+ switch (textureType)
+ {
+ case glTFTextureTypes.Metallic:
+ case glTFTextureTypes.Normal:
+ case glTFTextureTypes.Occlusion:
+ return RenderTextureReadWrite.Linear;
+ case glTFTextureTypes.BaseColor:
+ case glTFTextureTypes.Emissive:
+ return RenderTextureReadWrite.sRGB;
+ default:
+ return RenderTextureReadWrite.sRGB;
+ }
+ }
+
+ public static glTFTextureTypes GetglTFTextureType(string shaderName, string propName)
+ {
+ switch (propName)
+ {
+ case "_Color":
+ return glTFTextureTypes.BaseColor;
+ case "_MetallicGlossMap":
+ return glTFTextureTypes.Metallic;
+ case "_BumpMap":
+ return glTFTextureTypes.Normal;
+ case "_OcclusionMap":
+ return glTFTextureTypes.Occlusion;
+ case "_EmissionMap":
+ return glTFTextureTypes.Emissive;
+ default:
+ return glTFTextureTypes.Unknown;
+ }
+ }
+
+ public static glTFTextureTypes GetglTFTextureType(glTF glTf, int textureIndex)
+ {
+ foreach (var material in glTf.materials)
+ {
+ var textureInfo = material.GetTextures().FirstOrDefault(x => (x!=null) && x.index == textureIndex);
+ if (textureInfo != null)
+ {
+ return textureInfo.TextureType;
+ }
+ }
+ return glTFTextureTypes.Unknown;
+ }
+
+#if UNITY_EDITOR
+ public static void MarkTextureAssetAsNormalMap(string assetPath)
+ {
+ if (string.IsNullOrEmpty(assetPath))
+ {
+ return;
+ }
+
+ var textureImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;
+ if (null == textureImporter)
+ {
+ return;
+ }
+
+ //Debug.LogFormat("[MarkTextureAssetAsNormalMap] {0}", assetPath);
+ textureImporter.textureType = TextureImporterType.NormalMap;
+ textureImporter.SaveAndReimport();
+ }
+#endif
+
+ public struct TextureExportItem
+ {
+ public Texture Texture;
+ public glTFTextureTypes TextureType;
+
+ public TextureExportItem(Texture texture, glTFTextureTypes textureType)
+ {
+ Texture = texture;
+ TextureType = textureType;
+ }
+ }
+
+ public static IEnumerable<TextureExportItem> GetTextures(Material m)
+ {
+ var props = ShaderPropExporter.PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
+ if (props == null)
+ {
+ yield return new TextureExportItem(m.mainTexture, glTFTextureTypes.BaseColor);
+ }
+
+ foreach (var prop in props.Properties)
+ {
+
+ if (prop.ShaderPropertyType == ShaderPropExporter.ShaderPropertyType.TexEnv)
+ {
+ yield return new TextureExportItem(m.GetTexture(prop.Key), GetglTFTextureType(m.shader.name, prop.Key));
+ }
+ }
+ }
+
+
+ struct BytesWithMime
+ {
+ public Byte[] Bytes;
+ public string Mime;
+ }
+
+ static BytesWithMime GetBytesWithMime(Texture texture, glTFTextureTypes textureType)
+ {
+#if UNITY_EDITOR
+ var path = UnityPath.FromAsset(texture);
+ if (path.IsUnderAssetsFolder)
+ {
+ var textureImporter = (TextureImporter) AssetImporter.GetAtPath(path.Value);
+ var getSizeMethod = typeof(TextureImporter).GetMethod("GetWidthAndHeight", BindingFlags.NonPublic | BindingFlags.Instance);
+ if (textureImporter != null && getSizeMethod != null)
+ {
+ var args = new object[2] {0, 0};
+ getSizeMethod.Invoke(textureImporter, args);
+ var originalWidth = (int) args[0];
+ var originalHeight = (int) args[1];
+
+ var originalSize = Mathf.Max(originalWidth, originalHeight);
+ var requiredMaxSize = textureImporter.maxTextureSize;
+
+ // Resized exporting if MaxSize setting value is smaller than original image size.
+ if (originalSize > requiredMaxSize)
+ {
+ return new BytesWithMime
+ {
+ Bytes = TextureItem.CopyTexture(texture, GetColorSpace(textureType), null).EncodeToPNG(),
+ Mime = "image/png",
+ };
+ }
+ }
+
+ if (path.Extension == ".png")
+ {
+ return new BytesWithMime
+ {
+ Bytes = System.IO.File.ReadAllBytes(path.FullPath),
+ Mime = "image/png",
+ };
+ }
+ if (path.Extension == ".jpg")
+ {
+ return new BytesWithMime
+ {
+ Bytes = System.IO.File.ReadAllBytes(path.FullPath),
+ Mime = "image/jpeg",
+ };
+ }
+ }
+#endif
+
+ return new BytesWithMime
+ {
+ Bytes = TextureItem.CopyTexture(texture, TextureIO.GetColorSpace(textureType), null).EncodeToPNG(),
+ Mime = "image/png",
+ };
+ }
+
+ public static int ExportTexture(glTF gltf, int bufferIndex, Texture texture, glTFTextureTypes textureType)
+ {
+ var bytesWithMime = GetBytesWithMime(texture, textureType); ;
+
+ // add view
+ var view = gltf.buffers[bufferIndex].Append(bytesWithMime.Bytes, glBufferTarget.NONE);
+ var viewIndex = gltf.AddBufferView(view);
+
+ // add image
+ var imageIndex = gltf.images.Count;
+ gltf.images.Add(new glTFImage
+ {
+ name = texture.name,
+ bufferView = viewIndex,
+ mimeType = bytesWithMime.Mime,
+ });
+
+ // add sampler
+ var samplerIndex = gltf.samplers.Count;
+ var sampler = TextureSamplerUtil.Export(texture);
+ gltf.samplers.Add(sampler);
+
+ // add texture
+ gltf.textures.Add(new glTFTexture
+ {
+ sampler = samplerIndex,
+ source = imageIndex,
+ });
+
+ return imageIndex;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs.meta
new file mode 100644
index 00000000..2b85d8e5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureIO.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: eca1330a83e17a14eb99fc6ea1697922
+timeCreated: 1533533316
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs
new file mode 100644
index 00000000..cc03b6cb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs
@@ -0,0 +1,315 @@
+using UnityEngine;
+using System.Linq;
+using System.Collections.Generic;
+using System.Collections;
+using System.IO;
+using System;
+using DepthFirstScheduler;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public class TextureItem
+ {
+ private int m_textureIndex;
+ public Texture2D Texture
+ {
+ get
+ {
+ return m_textureLoader.Texture;
+ }
+ }
+
+ #region Texture converter
+ private Dictionary<string, Texture2D> m_converts = new Dictionary<string, Texture2D>();
+ public Dictionary<string, Texture2D> Converts
+ {
+ get { return m_converts; }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="prop"></param>
+ /// <param name="smoothness">used only when converting MetallicRoughness maps</param>
+ /// <returns></returns>
+ public Texture2D ConvertTexture(string prop, float smoothnessOrRoughness = 1.0f)
+ {
+ var convertedTexture = Converts.FirstOrDefault(x => x.Key == prop);
+ if (convertedTexture.Value != null)
+ return convertedTexture.Value;
+
+ if (prop == "_BumpMap")
+ {
+ if (Application.isPlaying)
+ {
+ var converted = new NormalConverter().GetImportTexture(Texture);
+ m_converts.Add(prop, converted);
+ return converted;
+ }
+ else
+ {
+#if UNITY_EDITOR
+ var textureAssetPath = AssetDatabase.GetAssetPath(Texture);
+ if (!string.IsNullOrEmpty(textureAssetPath))
+ {
+ TextureIO.MarkTextureAssetAsNormalMap(textureAssetPath);
+ }
+ else
+ {
+ Debug.LogWarningFormat("no asset for {0}", Texture);
+ }
+#endif
+ return Texture;
+ }
+ }
+
+ if (prop == "_MetallicGlossMap")
+ {
+ var converted = new MetallicRoughnessConverter(smoothnessOrRoughness).GetImportTexture(Texture);
+ m_converts.Add(prop, converted);
+ return converted;
+ }
+
+ if (prop == "_OcclusionMap")
+ {
+ var converted = new OcclusionConverter().GetImportTexture(Texture);
+ m_converts.Add(prop, converted);
+ return converted;
+ }
+
+ return null;
+ }
+ #endregion
+
+ public bool IsAsset
+ {
+ private set;
+ get;
+ }
+
+ public IEnumerable<Texture2D> GetTexturesForSaveAssets()
+ {
+ if (!IsAsset)
+ {
+ yield return Texture;
+ }
+ if (m_converts.Any())
+ {
+ foreach (var texture in m_converts)
+ {
+ yield return texture.Value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Texture from buffer
+ /// </summary>
+ /// <param name="index"></param>
+ public TextureItem(int index, ITextureLoader textureLoader)
+ {
+ m_textureIndex = index;
+ m_textureLoader = textureLoader;
+
+ if(m_textureLoader == null)
+ {
+ throw new Exception("ITextureLoader is null.");
+ }
+ }
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// Texture from asset
+ /// </summary>
+ /// <param name="index"></param>
+ /// <param name="assetPath"></param>
+ /// <param name="textureName"></param>
+ public TextureItem(int index, UnityPath assetPath, string textureName)
+ {
+ m_textureIndex = index;
+ IsAsset = true;
+ m_textureLoader = new AssetTextureLoader(assetPath, textureName);
+ }
+#endif
+
+ #region Process
+ ITextureLoader m_textureLoader;
+
+ public void Process(glTF gltf, IStorage storage)
+ {
+ ProcessOnAnyThread(gltf, storage);
+ ProcessOnMainThreadCoroutine(gltf).CoroutineToEnd();
+ }
+
+ public IEnumerator ProcessCoroutine(glTF gltf, IStorage storage)
+ {
+ ProcessOnAnyThread(gltf, storage);
+ yield return ProcessOnMainThreadCoroutine(gltf);
+ }
+
+ public void ProcessOnAnyThread(glTF gltf, IStorage storage)
+ {
+ m_textureLoader.ProcessOnAnyThread(gltf, storage);
+ }
+
+ public IEnumerator ProcessOnMainThreadCoroutine(glTF gltf)
+ {
+ using (m_textureLoader)
+ {
+ var textureType = TextureIO.GetglTFTextureType(gltf, m_textureIndex);
+ var colorSpace = TextureIO.GetColorSpace(textureType);
+ var isLinear = colorSpace == RenderTextureReadWrite.Linear;
+ yield return m_textureLoader.ProcessOnMainThread(isLinear, gltf.GetSamplerFromTextureIndex(m_textureIndex));
+ }
+ }
+ #endregion
+
+ struct ColorSpaceScope : IDisposable
+ {
+ bool m_sRGBWrite;
+
+ public ColorSpaceScope(RenderTextureReadWrite colorSpace)
+ {
+ m_sRGBWrite = GL.sRGBWrite;
+ switch (colorSpace)
+ {
+ case RenderTextureReadWrite.Linear:
+ GL.sRGBWrite = false;
+ break;
+
+ case RenderTextureReadWrite.sRGB:
+ default:
+ GL.sRGBWrite = true;
+ break;
+ }
+ }
+ public ColorSpaceScope(bool sRGBWrite)
+ {
+ m_sRGBWrite = GL.sRGBWrite;
+ GL.sRGBWrite = sRGBWrite;
+ }
+
+ public void Dispose()
+ {
+ GL.sRGBWrite = m_sRGBWrite;
+ }
+ }
+
+#if UNITY_EDITOR && VRM_DEVELOP
+ [MenuItem("Assets/CopySRGBWrite", true)]
+ static bool CopySRGBWriteIsEnable()
+ {
+ return Selection.activeObject is Texture;
+ }
+
+ [MenuItem("Assets/CopySRGBWrite")]
+ static void CopySRGBWrite()
+ {
+ CopySRGBWrite(true);
+ }
+
+ [MenuItem("Assets/CopyNotSRGBWrite", true)]
+ static bool CopyNotSRGBWriteIsEnable()
+ {
+ return Selection.activeObject is Texture;
+ }
+
+ [MenuItem("Assets/CopyNotSRGBWrite")]
+ static void CopyNotSRGBWrite()
+ {
+ CopySRGBWrite(false);
+ }
+
+ static string AddPath(string path, string add)
+ {
+ return string.Format("{0}/{1}{2}{3}",
+ Path.GetDirectoryName(path),
+ Path.GetFileNameWithoutExtension(path),
+ add,
+ Path.GetExtension(path));
+ }
+
+ static void CopySRGBWrite(bool isSRGB)
+ {
+ var src = Selection.activeObject as Texture;
+ var texturePath = UnityPath.FromAsset(src);
+
+ var path = EditorUtility.SaveFilePanel("save prefab", "Assets",
+ Path.GetFileNameWithoutExtension(AddPath(texturePath.FullPath, ".sRGB")), "prefab");
+ var assetPath = UnityPath.FromFullpath(path);
+ if (!assetPath.IsUnderAssetsFolder)
+ {
+ return;
+ }
+ Debug.LogFormat("[CopySRGBWrite] {0} => {1}", texturePath, assetPath);
+
+ var renderTexture = new RenderTexture(src.width, src.height, 0,
+ RenderTextureFormat.ARGB32,
+ RenderTextureReadWrite.sRGB);
+ using (var scope = new ColorSpaceScope(isSRGB))
+ {
+ Graphics.Blit(src, renderTexture);
+ }
+
+ var dst = new Texture2D(src.width, src.height, TextureFormat.ARGB32, false,
+ RenderTextureReadWrite.sRGB == RenderTextureReadWrite.Linear);
+ dst.ReadPixels(new Rect(0, 0, src.width, src.height), 0, 0);
+ dst.Apply();
+
+ RenderTexture.active = null;
+
+ assetPath.CreateAsset(dst);
+
+ GameObject.DestroyImmediate(renderTexture);
+ }
+#endif
+
+ public static Texture2D CopyTexture(Texture src, RenderTextureReadWrite colorSpace, Material material)
+ {
+ Texture2D dst = null;
+
+ var renderTexture = new RenderTexture(src.width, src.height, 0, RenderTextureFormat.ARGB32, colorSpace);
+
+ using (var scope = new ColorSpaceScope(colorSpace))
+ {
+ if (material != null)
+ {
+ Graphics.Blit(src, renderTexture, material);
+ }
+ else
+ {
+ Graphics.Blit(src, renderTexture);
+ }
+ }
+
+ dst = new Texture2D(src.width, src.height, TextureFormat.ARGB32, false, colorSpace == RenderTextureReadWrite.Linear);
+ dst.ReadPixels(new Rect(0, 0, src.width, src.height), 0, 0);
+ dst.name = src.name;
+ dst.anisoLevel = src.anisoLevel;
+ dst.filterMode = src.filterMode;
+ dst.mipMapBias = src.mipMapBias;
+ dst.wrapMode = src.wrapMode;
+#if UNITY_2017_1_OR_NEWER
+ dst.wrapModeU = src.wrapModeU;
+ dst.wrapModeV = src.wrapModeV;
+ dst.wrapModeW = src.wrapModeW;
+#endif
+ dst.Apply();
+
+ RenderTexture.active = null;
+ if (Application.isEditor)
+ {
+ GameObject.DestroyImmediate(renderTexture);
+ }
+ else
+ {
+ GameObject.Destroy(renderTexture);
+ }
+ return dst;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs.meta
new file mode 100644
index 00000000..88041194
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureItem.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 09cdeb503b1e8234faf528b6ae134e7a
+timeCreated: 1519799583
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs
new file mode 100644
index 00000000..ee4ecf66
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs
@@ -0,0 +1,348 @@
+using System;
+using System.Collections;
+using System.IO;
+using UnityEngine;
+using UnityEngine.Networking;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public interface ITextureLoader : IDisposable
+ {
+ Texture2D Texture { get; }
+
+ /// <summary>
+ /// Call from any thread
+ /// </summary>
+ /// <param name="gltf"></param>
+ /// <param name="storage"></param>
+ void ProcessOnAnyThread(glTF gltf, IStorage storage);
+
+ /// <summary>
+ /// Call from unity main thread
+ /// </summary>
+ /// <param name="isLinear"></param>
+ /// <param name="sampler"></param>
+ /// <returns></returns>
+ IEnumerator ProcessOnMainThread(bool isLinear, glTFTextureSampler sampler);
+ }
+
+#if UNITY_EDITOR
+ public class AssetTextureLoader : ITextureLoader
+ {
+ public Texture2D Texture
+ {
+ private set;
+ get;
+ }
+
+ UnityPath m_assetPath;
+
+ public AssetTextureLoader(UnityPath assetPath, string _)
+ {
+ m_assetPath = assetPath;
+ }
+
+ public void Dispose()
+ {
+ }
+
+ public void ProcessOnAnyThread(glTF gltf, IStorage storage)
+ {
+ }
+
+ public IEnumerator ProcessOnMainThread(bool isLinear, glTFTextureSampler sampler)
+ {
+ //
+ // texture from assets
+ //
+ m_assetPath.ImportAsset();
+ var importer = m_assetPath.GetImporter<TextureImporter>();
+ if (importer == null)
+ {
+ Debug.LogWarningFormat("fail to get TextureImporter: {0}", m_assetPath);
+ }
+ importer.maxTextureSize = 8192;
+ importer.sRGBTexture = !isLinear;
+
+ importer.SaveAndReimport();
+
+ Texture = m_assetPath.LoadAsset<Texture2D>();
+
+ //Texture.name = m_textureName;
+ if (Texture == null)
+ {
+ Debug.LogWarningFormat("fail to Load Texture2D: {0}", m_assetPath);
+ }
+
+ else
+ {
+ var maxSize = Mathf.Max(Texture.width, Texture.height);
+
+ importer.maxTextureSize
+ = maxSize > 4096 ? 8192 :
+ maxSize > 2048 ? 4096 :
+ maxSize > 1024 ? 2048 :
+ maxSize > 512 ? 1024 :
+ 512;
+
+ importer.SaveAndReimport();
+ }
+
+ if (sampler != null)
+ {
+ TextureSamplerUtil.SetSampler(Texture, sampler);
+ }
+
+ yield break;
+ }
+ }
+#endif
+
+ public class TextureLoader : ITextureLoader
+ {
+ int m_textureIndex;
+ public TextureLoader(int textureIndex)
+ {
+ m_textureIndex = textureIndex;
+ }
+
+ public Texture2D Texture
+ {
+ private set;
+ get;
+ }
+
+ public void Dispose()
+ {
+ }
+
+ static Byte[] ToArray(ArraySegment<byte> bytes)
+ {
+ if (bytes.Array == null)
+ {
+ return new byte[] { };
+ }
+ else if (bytes.Offset == 0 && bytes.Count == bytes.Array.Length)
+ {
+ return bytes.Array;
+ }
+ else
+ {
+ Byte[] result = new byte[bytes.Count];
+ Buffer.BlockCopy(bytes.Array, bytes.Offset, result, 0, result.Length);
+ return result;
+ }
+ }
+
+ Byte[] m_imageBytes;
+ string m_textureName;
+ public void ProcessOnAnyThread(glTF gltf, IStorage storage)
+ {
+ var imageIndex = gltf.GetImageIndexFromTextureIndex(m_textureIndex);
+ var segments = gltf.GetImageBytes(storage, imageIndex, out m_textureName);
+ m_imageBytes = ToArray(segments);
+ }
+
+ public IEnumerator ProcessOnMainThread(bool isLinear, glTFTextureSampler sampler)
+ {
+ //
+ // texture from image(png etc) bytes
+ //
+ Texture = new Texture2D(2, 2, TextureFormat.ARGB32, false, isLinear);
+ Texture.name = m_textureName;
+ if (m_imageBytes != null)
+ {
+ Texture.LoadImage(m_imageBytes);
+ }
+ if (sampler != null)
+ {
+ TextureSamplerUtil.SetSampler(Texture, sampler);
+ }
+ yield break;
+ }
+ }
+
+ public class UnityWebRequestTextureLoader : ITextureLoader
+ {
+ public Texture2D Texture
+ {
+ private set;
+ get;
+ }
+
+ int m_textureIndex;
+
+ public UnityWebRequestTextureLoader(int textureIndex)
+ {
+ m_textureIndex = textureIndex;
+ }
+
+ UnityWebRequest m_uwr;
+ public void Dispose()
+ {
+ if (m_uwr != null)
+ {
+ m_uwr.Dispose();
+ m_uwr = null;
+ }
+ }
+
+ ArraySegment<Byte> m_segments;
+ string m_textureName;
+ public void ProcessOnAnyThread(glTF gltf, IStorage storage)
+ {
+ var imageIndex = gltf.GetImageIndexFromTextureIndex(m_textureIndex);
+ m_segments = gltf.GetImageBytes(storage, imageIndex, out m_textureName);
+ }
+
+#if false
+ HttpHost m_http;
+ class HttpHost : IDisposable
+ {
+ TcpListener m_listener;
+ Socket m_connection;
+
+ public HttpHost(int port)
+ {
+ m_listener = new TcpListener(IPAddress.Loopback, port);
+ m_listener.Start();
+ m_listener.BeginAcceptSocket(OnAccepted, m_listener);
+ }
+
+ void OnAccepted(IAsyncResult ar)
+ {
+ var l = ar.AsyncState as TcpListener;
+ if (l == null) return;
+ m_connection = l.EndAcceptSocket(ar);
+ // 次の接続受付はしない
+
+ BeginRead(m_connection, new byte[8192]);
+ }
+
+ void BeginRead(Socket c, byte[] buffer)
+ {
+ AsyncCallback callback = ar =>
+ {
+ var s = ar.AsyncState as Socket;
+ if (s == null) return;
+ var size = s.EndReceive(ar);
+ if (size > 0)
+ {
+ OnRead(buffer, size);
+ }
+ BeginRead(s, buffer);
+ };
+ m_connection.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, callback, m_connection);
+ }
+
+ List<Byte> m_buffer = new List<byte>();
+ void OnRead(byte[] buffer, int len)
+ {
+ m_buffer.AddRange(buffer.Take(len));
+ }
+
+ public string Url
+ {
+ get
+ {
+
+ }
+ }
+
+ public void Dispose()
+ {
+ if (m_connection != null)
+ {
+ m_connection.Dispose();
+ m_connection = null;
+ }
+ if(m_listener != null)
+ {
+ m_listener.Stop();
+ m_listener = null;
+ }
+ }
+ }
+#endif
+
+ class Deleter : IDisposable
+ {
+ string m_path;
+ public Deleter(string path)
+ {
+ m_path = path;
+ }
+ public void Dispose()
+ {
+ if (File.Exists(m_path))
+ {
+ File.Delete(m_path);
+ }
+ }
+ }
+
+ public IEnumerator ProcessOnMainThread(bool isLinear, glTFTextureSampler sampler)
+ {
+ // tmp file
+ var tmp = Path.GetTempFileName();
+ using (var f = new FileStream(tmp, FileMode.Create))
+ {
+ f.Write(m_segments.Array, m_segments.Offset, m_segments.Count);
+ }
+
+ using (var d = new Deleter(tmp))
+ {
+ var url = "file:///" + tmp.Replace("\\", "/");
+ Debug.LogFormat("UnityWebRequest: {0}", url);
+#if UNITY_2017_1_OR_NEWER
+ using (var m_uwr = UnityWebRequestTexture.GetTexture(url, true))
+ {
+ yield return m_uwr.SendWebRequest();
+
+ if (m_uwr.isNetworkError || m_uwr.isHttpError)
+ {
+ Debug.LogWarning(m_uwr.error);
+ }
+ else
+ {
+ // Get downloaded asset bundle
+ Texture = ((DownloadHandlerTexture)m_uwr.downloadHandler).texture;
+ Texture.name = m_textureName;
+ }
+ }
+#elif UNITY_5
+ using (var m_uwr = new WWW(url))
+ {
+ yield return m_uwr;
+
+ // wait for request
+ while (!m_uwr.isDone)
+ {
+ yield return null;
+ }
+
+ if (!string.IsNullOrEmpty(m_uwr.error))
+ {
+ Debug.Log(m_uwr.error);
+ yield break;
+ }
+
+ // Get downloaded asset bundle
+ Texture = m_uwr.textureNonReadable;
+ Texture.name = m_textureName;
+ }
+#else
+#error Unsupported Unity version
+#endif
+ }
+ if (sampler != null)
+ {
+ TextureSamplerUtil.SetSampler(Texture, sampler);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs.meta
new file mode 100644
index 00000000..a1aa6bbf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureLoader.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4ffd8b31d371e024593b9aff2cf2495b
+timeCreated: 1540300073
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs
new file mode 100644
index 00000000..63bd0429
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs
@@ -0,0 +1,258 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public static class TextureSamplerUtil
+ {
+ #region WrapMode
+ public enum TextureWrapType
+ {
+ All,
+#if UNITY_2017_1_OR_NEWER
+ U,
+ V,
+ W,
+#endif
+ }
+
+ public static KeyValuePair<TextureWrapType, TextureWrapMode> TypeWithMode(TextureWrapType type, TextureWrapMode mode)
+ {
+ return new KeyValuePair<TextureWrapType, TextureWrapMode>(type, mode);
+ }
+
+ public static IEnumerable<KeyValuePair<TextureWrapType, TextureWrapMode>> GetUnityWrapMode(glTFTextureSampler sampler)
+ {
+#if UNITY_2017_1_OR_NEWER
+ if (sampler.wrapS == sampler.wrapT)
+ {
+ switch (sampler.wrapS)
+ {
+ case glWrap.NONE: // default
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.CLAMP_TO_EDGE:
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Clamp);
+ break;
+
+ case glWrap.REPEAT:
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.MIRRORED_REPEAT:
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Mirror);
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ else
+ {
+ switch (sampler.wrapS)
+ {
+ case glWrap.NONE: // default
+ yield return TypeWithMode(TextureWrapType.U, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.CLAMP_TO_EDGE:
+ yield return TypeWithMode(TextureWrapType.U, TextureWrapMode.Clamp);
+ break;
+
+ case glWrap.REPEAT:
+ yield return TypeWithMode(TextureWrapType.U, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.MIRRORED_REPEAT:
+ yield return TypeWithMode(TextureWrapType.U, TextureWrapMode.Mirror);
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+ switch (sampler.wrapT)
+ {
+ case glWrap.NONE: // default
+ yield return TypeWithMode(TextureWrapType.V, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.CLAMP_TO_EDGE:
+ yield return TypeWithMode(TextureWrapType.V, TextureWrapMode.Clamp);
+ break;
+
+ case glWrap.REPEAT:
+ yield return TypeWithMode(TextureWrapType.V, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.MIRRORED_REPEAT:
+ yield return TypeWithMode(TextureWrapType.V, TextureWrapMode.Mirror);
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+#else
+ // Unity2017.1より前
+ // * wrapSとwrapTの区別が無くてwrapしかない
+ // * Mirrorが無い
+
+ switch (sampler.wrapS)
+ {
+ case glWrap.NONE: // default
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Repeat);
+ break;
+
+ case glWrap.CLAMP_TO_EDGE:
+ case glWrap.MIRRORED_REPEAT:
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Clamp);
+ break;
+
+ case glWrap.REPEAT:
+ yield return TypeWithMode(TextureWrapType.All, TextureWrapMode.Repeat);
+ break;
+
+ default:
+ throw new NotImplementedException();
+#endif
+ }
+ }
+ #endregion
+
+ public static FilterMode ImportFilterMode(glFilter filterMode)
+ {
+ switch (filterMode)
+ {
+ case glFilter.NEAREST:
+ case glFilter.NEAREST_MIPMAP_LINEAR:
+ case glFilter.NEAREST_MIPMAP_NEAREST:
+ return FilterMode.Point;
+
+ case glFilter.NONE:
+ case glFilter.LINEAR:
+ case glFilter.LINEAR_MIPMAP_NEAREST:
+ return FilterMode.Bilinear;
+
+ case glFilter.LINEAR_MIPMAP_LINEAR:
+ return FilterMode.Trilinear;
+
+ default:
+ throw new NotImplementedException();
+
+ }
+ }
+
+ public static void SetSampler(Texture2D texture, glTFTextureSampler sampler)
+ {
+ if (texture == null)
+ {
+ return;
+ }
+
+ foreach (var kv in GetUnityWrapMode(sampler))
+ {
+ switch (kv.Key)
+ {
+ case TextureWrapType.All:
+ texture.wrapMode = kv.Value;
+ break;
+
+#if UNITY_2017_1_OR_NEWER
+ case TextureWrapType.U:
+ texture.wrapModeU = kv.Value;
+ break;
+
+ case TextureWrapType.V:
+ texture.wrapModeV = kv.Value;
+ break;
+
+ case TextureWrapType.W:
+ texture.wrapModeW = kv.Value;
+ break;
+#endif
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ texture.filterMode = ImportFilterMode(sampler.minFilter);
+ }
+
+ #region Export
+ public static glFilter ExportFilterMode(Texture texture)
+ {
+ switch (texture.filterMode)
+ {
+ case FilterMode.Point:
+ return glFilter.NEAREST;
+
+ case FilterMode.Bilinear:
+ return glFilter.LINEAR;
+
+ case FilterMode.Trilinear:
+ return glFilter.LINEAR_MIPMAP_LINEAR;
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ public static TextureWrapMode GetWrapS(Texture texture)
+ {
+#if UNITY_2017_1_OR_NEWER
+ return texture.wrapModeU;
+#else
+ return texture.wrapMode;
+#endif
+ }
+
+ public static TextureWrapMode GetWrapT(Texture texture)
+ {
+#if UNITY_2017_1_OR_NEWER
+ return texture.wrapModeV;
+#else
+ return texture.wrapMode;
+#endif
+ }
+
+ public static glWrap ExportWrapMode(TextureWrapMode wrapMode)
+ {
+ switch (wrapMode)
+ {
+ case TextureWrapMode.Clamp:
+ return glWrap.CLAMP_TO_EDGE;
+
+ case (TextureWrapMode)(-1):
+ case TextureWrapMode.Repeat:
+ return glWrap.REPEAT;
+
+#if UNITY_2017_1_OR_NEWER
+ case TextureWrapMode.Mirror:
+ case TextureWrapMode.MirrorOnce:
+ return glWrap.MIRRORED_REPEAT;
+#endif
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ public static glTFTextureSampler Export(Texture texture)
+ {
+ var filter = ExportFilterMode(texture);
+ var wrapS = ExportWrapMode(GetWrapS(texture));
+ var wrapT = ExportWrapMode(GetWrapT(texture));
+ return new glTFTextureSampler
+ {
+ magFilter = filter,
+ minFilter = filter,
+ wrapS = wrapS,
+ wrapT = wrapT,
+ };
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs.meta
new file mode 100644
index 00000000..f30e2fb6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TextureSamplerUtil.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f3929edbda61f9346906bfab93411b98
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs
new file mode 100644
index 00000000..b5b93596
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+
+public static class TriangleUtil
+{
+ public static IEnumerable<int> FlipTriangle(IEnumerable<Byte> src)
+ {
+ return FlipTriangle(src.Select(x => (Int32)x));
+ }
+
+ public static IEnumerable<int> FlipTriangle(IEnumerable<UInt16> src)
+ {
+ return FlipTriangle(src.Select(x => (Int32)x));
+ }
+
+ public static IEnumerable<int> FlipTriangle(IEnumerable<UInt32> src)
+ {
+ return FlipTriangle(src.Select(x => (Int32)x));
+ }
+
+ public static IEnumerable<int> FlipTriangle(IEnumerable<Int32> src)
+ {
+ var it = src.GetEnumerator();
+ while (true)
+ {
+ if (!it.MoveNext())
+ {
+ yield break;
+ }
+ var i0 = it.Current;
+
+ if (!it.MoveNext())
+ {
+ yield break;
+ }
+ var i1 = it.Current;
+
+ if (!it.MoveNext())
+ {
+ yield break;
+ }
+ var i2 = it.Current;
+
+ yield return i2;
+ yield return i1;
+ yield return i0;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs.meta
new file mode 100644
index 00000000..5505bdb2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/TriangleUtil.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 3d3209540c7379646b36b389bea94f6f
+timeCreated: 1517037932
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs
new file mode 100644
index 00000000..bc04c4ba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs
@@ -0,0 +1,435 @@
+using System;
+using System.IO;
+using UnityEngine;
+using System.Collections.Generic;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ /// <summary>
+ /// relative path from Unity project root.
+ /// For AssetDatabase.
+ /// </summary>
+ public struct UnityPath
+ {
+ #region UnityPath
+ public string Value
+ {
+ get;
+ private set;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("unity://{0}", Value);
+ }
+
+ public bool IsNull
+ {
+ get { return Value == null; }
+ }
+
+ public bool IsUnderAssetsFolder
+ {
+ get
+ {
+ if (IsNull)
+ {
+ return false;
+ }
+ return Value == "Assets" || Value.StartsWith("Assets/");
+ }
+ }
+
+ public bool IsStreamingAsset
+ {
+ get
+ {
+ if (IsNull)
+ {
+ return false;
+ }
+
+ return FullPath.StartsWith(Application.streamingAssetsPath + "/");
+ }
+ }
+
+ public string FileName
+ {
+ get { return Path.GetFileName(Value); }
+ }
+
+ public string FileNameWithoutExtension
+ {
+ get { return Path.GetFileNameWithoutExtension(Value); }
+ }
+
+ public string Extension
+ {
+ get { return Path.GetExtension(Value); }
+ }
+
+ public UnityPath Parent
+ {
+ get
+ {
+ if (IsNull)
+ {
+ return default(UnityPath);
+ }
+
+ return new UnityPath(Path.GetDirectoryName(Value));
+ }
+ }
+
+ public bool HasParent
+ {
+ get
+ {
+ return !string.IsNullOrEmpty(Value);
+ }
+ }
+
+ static readonly char[] EscapeChars = new char[]
+ {
+ '\\',
+ '/',
+ ':',
+ '*',
+ '?',
+ '"',
+ '<',
+ '>',
+ '|',
+ };
+
+ static string EscapeFilePath(string path)
+ {
+ foreach (var x in EscapeChars)
+ {
+ path = path.Replace(x, '+');
+ }
+ return path;
+ }
+
+ public UnityPath Child(string name)
+ {
+ if (IsNull)
+ {
+ throw new NotImplementedException();
+ }
+ else if (Value == "")
+ {
+ return new UnityPath(name);
+ }
+ else
+ {
+ return new UnityPath(Value + "/" + name);
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ if (IsNull)
+ {
+ return 0;
+ }
+ return Value.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj is UnityPath)
+ {
+ var rhs = (UnityPath)obj;
+ if(Value==null && rhs.Value == null)
+ {
+ return true;
+ }
+ else if (Value == null)
+ {
+ return false;
+ }
+ else if (rhs.Value == null)
+ {
+ return false;
+ }
+ else
+ {
+ return Value == rhs.Value;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Remove extension and add suffix
+ /// </summary>
+ /// <param name="prefabPath"></param>
+ /// <param name="suffix"></param>
+ /// <returns></returns>
+ public UnityPath GetAssetFolder(string suffix)
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ return new UnityPath(
+ string.Format("{0}/{1}{2}",
+ Parent.Value,
+ FileNameWithoutExtension,
+ suffix
+ ));
+ }
+
+ UnityPath(string value) : this()
+ {
+ Value = value.Replace("\\", "/");
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="unityPath">Relative from unity current path. GetParent(Application.dataPath)</param>
+ /// <returns></returns>
+ public static UnityPath FromUnityPath(string unityPath)
+ {
+ if (String.IsNullOrEmpty(unityPath))
+ {
+ return new UnityPath
+ {
+ Value=""
+ };
+ }
+ return FromFullpath(Path.GetFullPath(unityPath));
+ }
+ #endregion
+
+ #region FullPath
+ static string s_basePath;
+ static string BaseFullPath
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(s_basePath))
+ {
+ s_basePath = Path.GetFullPath(Application.dataPath + "/..").Replace("\\", "/");
+ }
+ return s_basePath;
+ }
+ }
+
+ static string AssetFullPath
+ {
+ get
+ {
+ return BaseFullPath + "/Assets";
+ }
+ }
+
+ public string FullPath
+ {
+ get
+ {
+ if (IsNull)
+ {
+ throw new NotImplementedException();
+ }
+ return Path.Combine(BaseFullPath, Value).Replace("\\", "/");
+ }
+ }
+
+ public bool IsFileExists
+ {
+ get { return File.Exists(FullPath); }
+ }
+
+ public bool IsDirectoryExists
+ {
+ get { return Directory.Exists(FullPath); }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="fullPath">C:/path/to/file</param>
+ /// <returns></returns>
+ public static UnityPath FromFullpath(string fullPath)
+ {
+ if(fullPath == null)
+ {
+ fullPath = "";
+ }
+ fullPath = fullPath.Replace("\\", "/");
+
+ if (fullPath == BaseFullPath) {
+ return new UnityPath
+ {
+ Value=""
+ };
+ }
+ else if(fullPath.StartsWith(BaseFullPath + "/"))
+ {
+ return new UnityPath(fullPath.Substring(BaseFullPath.Length + 1));
+ }
+ else
+ {
+ return default(UnityPath);
+ }
+ }
+
+ public static bool IsUnderAssetFolder(string fullPath)
+ {
+ return fullPath.Replace("\\", "/").StartsWith(AssetFullPath);
+ }
+ #endregion
+
+ [Obsolete("Use TraverseDir()")]
+ public IEnumerable<UnityPath> TravserseDir()
+ {
+ return TraverseDir();
+ }
+
+ public IEnumerable<UnityPath> TraverseDir()
+ {
+ if (IsDirectoryExists)
+ {
+ yield return this;
+
+ foreach(var child in ChildDirs)
+ {
+ foreach(var x in child.TraverseDir())
+ {
+ yield return x;
+ }
+ }
+ }
+ }
+
+ public IEnumerable<UnityPath> ChildDirs
+ {
+ get
+ {
+ foreach(var x in Directory.GetDirectories(FullPath))
+ {
+ yield return UnityPath.FromFullpath(x);
+ }
+ }
+ }
+
+ public IEnumerable<UnityPath> ChildFiles
+ {
+ get
+ {
+ foreach (var x in Directory.GetFiles(FullPath))
+ {
+ yield return UnityPath.FromFullpath(x);
+ }
+ }
+ }
+
+#if UNITY_EDITOR
+ public T GetImporter<T>() where T : AssetImporter
+ {
+ return AssetImporter.GetAtPath(Value) as T;
+ }
+
+ public static UnityPath FromAsset(UnityEngine.Object asset)
+ {
+ return new UnityPath(AssetDatabase.GetAssetPath(asset));
+ }
+
+ public void ImportAsset()
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+ AssetDatabase.ImportAsset(Value);
+ }
+
+ public void EnsureFolder()
+ {
+ if (IsNull)
+ {
+ throw new NotImplementedException();
+ }
+
+ if (HasParent)
+ {
+ Parent.EnsureFolder();
+ }
+
+ if (!IsDirectoryExists)
+ {
+ var parent = Parent;
+ // ensure parent
+ parent.ImportAsset();
+ // create
+ AssetDatabase.CreateFolder(
+ parent.Value,
+ Path.GetFileName(Value)
+ );
+ ImportAsset();
+ }
+ }
+
+ public UnityEngine.Object[] GetSubAssets()
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ return AssetDatabase.LoadAllAssetsAtPath(Value);
+ }
+
+ public void CreateAsset(UnityEngine.Object o)
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ AssetDatabase.CreateAsset(o, Value);
+ }
+
+ public void AddObjectToAsset(UnityEngine.Object o)
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ AssetDatabase.AddObjectToAsset(o, Value);
+ }
+
+ public T LoadAsset<T>() where T : UnityEngine.Object
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ return AssetDatabase.LoadAssetAtPath<T>(Value);
+ }
+
+ public UnityPath GenerateUniqueAssetPath()
+ {
+ if (!IsUnderAssetsFolder)
+ {
+ throw new NotImplementedException();
+ }
+
+ return new UnityPath(AssetDatabase.GenerateUniqueAssetPath(Value));
+ }
+ #endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs.meta
new file mode 100644
index 00000000..1de43e29
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/UnityPath.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3386db594e76066409ddf28bad123839
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs
new file mode 100644
index 00000000..ea05e92b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs
@@ -0,0 +1,385 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Linq;
+using System.IO.Compression;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// https://en.wikipedia.org/wiki/Zip_(file_format)
+/// </summary>
+namespace UniGLTF.Zip
+{
+
+ enum CompressionMethod : ushort
+ {
+ Stored = 0, // The file is stored (no compression)
+ Shrink = 1, // The file is Shrunk
+ Reduced1 = 2, // The file is Reduced with compression factor 1
+ Reduced2 = 3, // The file is Reduced with compression factor 2
+ Reduced3 = 4, // The file is Reduced with compression factor 3
+ Reduced4 = 5, // The file is Reduced with compression factor 4
+ Imploded = 6, // The file is Imploded
+ Reserved = 7, // Reserved for Tokenizing compression algorithm
+ Deflated = 8, // The file is Deflated
+ }
+
+ class ZipParseException : Exception
+ {
+ public ZipParseException(string msg) : base(msg)
+ { }
+ }
+
+ class EOCD
+ {
+ public ushort NumberOfThisDisk;
+ public ushort DiskWhereCentralDirectoryStarts;
+ public ushort NumberOfCentralDirectoryRecordsOnThisDisk;
+ public ushort TotalNumberOfCentralDirectoryRecords;
+ public int SizeOfCentralDirectoryBytes;
+ public int OffsetOfStartOfCentralDirectory;
+ public string Comment;
+
+ public override string ToString()
+ {
+ return string.Format("<EOCD records: {0}, offset: {1}, '{2}'>",
+ NumberOfCentralDirectoryRecordsOnThisDisk,
+ OffsetOfStartOfCentralDirectory,
+ Comment
+ );
+ }
+
+ static int FindEOCD(byte[] bytes)
+ {
+ for (int i = bytes.Length - 22; i >= 0; --i)
+ {
+ if (bytes[i] == 0x50
+ && bytes[i + 1] == 0x4b
+ && bytes[i + 2] == 0x05
+ && bytes[i + 3] == 0x06)
+ {
+ return i;
+ }
+ }
+
+ throw new ZipParseException("EOCD is not found");
+ }
+
+ public static EOCD Parse(Byte[] bytes)
+ {
+ var pos = FindEOCD(bytes);
+ using (var ms = new MemoryStream(bytes, pos, bytes.Length - pos, false))
+ using (var r = new BinaryReader(ms))
+ {
+ var sig = r.ReadInt32();
+ if (sig != 0x06054b50) throw new ZipParseException("invalid eocd signature: " + sig);
+
+ var eocd = new EOCD
+ {
+ NumberOfThisDisk = r.ReadUInt16(),
+ DiskWhereCentralDirectoryStarts = r.ReadUInt16(),
+ NumberOfCentralDirectoryRecordsOnThisDisk = r.ReadUInt16(),
+ TotalNumberOfCentralDirectoryRecords = r.ReadUInt16(),
+ SizeOfCentralDirectoryBytes = r.ReadInt32(),
+ OffsetOfStartOfCentralDirectory = r.ReadInt32(),
+ };
+
+ var commentLength = r.ReadUInt16();
+ var commentBytes = r.ReadBytes(commentLength);
+ eocd.Comment = Encoding.ASCII.GetString(commentBytes);
+
+ return eocd;
+ }
+ }
+ }
+
+ abstract class CommonHeader
+ {
+ public Encoding Encoding = Encoding.UTF8;
+ public Byte[] Bytes;
+ public int Offset;
+ public abstract int Signature
+ {
+ get;
+ }
+ protected CommonHeader(Byte[] bytes, int offset)
+ {
+ var sig = BitConverter.ToInt32(bytes, offset);
+ if (sig != Signature)
+ {
+ throw new ZipParseException("invalid central directory file signature: " + sig);
+ }
+ Bytes = bytes;
+ Offset = offset;
+
+ var start = offset + 4;
+ using (var ms = new MemoryStream(bytes, start, bytes.Length - start, false))
+ using (var r = new BinaryReader(ms))
+ {
+ ReadBefore(r);
+ Read(r);
+ ReadAfter(r);
+ }
+ }
+
+ public UInt16 VersionNeededToExtract;
+ public UInt16 GeneralPurposeBitFlag;
+ public CompressionMethod CompressionMethod;
+ public UInt16 FileLastModificationTime;
+ public UInt16 FileLastModificationDate;
+ public Int32 CRC32;
+ public Int32 CompressedSize;
+ public Int32 UncompressedSize;
+ public UInt16 FileNameLength;
+ public UInt16 ExtraFieldLength;
+
+ public abstract int FixedFieldLength
+ {
+ get;
+ }
+
+ public abstract int Length
+ {
+ get;
+ }
+
+ public string FileName
+ {
+ get
+ {
+ return Encoding.GetString(Bytes,
+ Offset + FixedFieldLength,
+ FileNameLength);
+ }
+ }
+
+ public ArraySegment<Byte> ExtraField
+ {
+ get
+ {
+ return new ArraySegment<byte>(Bytes,
+ Offset + FixedFieldLength + FileNameLength,
+ ExtraFieldLength);
+ }
+ }
+
+ public override string ToString()
+ {
+ return string.Format("<file {0}({1}/{2} {3})>",
+ FileName,
+ CompressedSize,
+ UncompressedSize,
+ CompressionMethod
+ );
+ }
+
+ public abstract void ReadBefore(BinaryReader r);
+
+ public void Read(BinaryReader r)
+ {
+ VersionNeededToExtract = r.ReadUInt16();
+ GeneralPurposeBitFlag = r.ReadUInt16();
+ CompressionMethod = (CompressionMethod)r.ReadUInt16();
+ FileLastModificationTime = r.ReadUInt16();
+ FileLastModificationDate = r.ReadUInt16();
+ CRC32 = r.ReadInt32();
+ CompressedSize = r.ReadInt32();
+ UncompressedSize = r.ReadInt32();
+ FileNameLength = r.ReadUInt16();
+ ExtraFieldLength = r.ReadUInt16();
+ }
+
+ public abstract void ReadAfter(BinaryReader r);
+ }
+
+ class CentralDirectoryFileHeader : CommonHeader
+ {
+ public override int Signature
+ {
+ get
+ {
+ return 0x02014b50;
+ }
+ }
+
+ public CentralDirectoryFileHeader(Byte[] bytes, int offset) : base(bytes, offset) { }
+
+ public UInt16 VersionMadeBy;
+ public UInt16 FileCommentLength;
+ public UInt16 DiskNumberWhereFileStarts;
+ public UInt16 InternalFileAttributes;
+ public Int32 ExternalFileAttributes;
+ public Int32 RelativeOffsetOfLocalFileHeader;
+
+ public override int FixedFieldLength
+ {
+ get
+ {
+ return 46;
+ }
+ }
+
+ public string FileComment
+ {
+ get
+ {
+ return Encoding.GetString(Bytes,
+ Offset + 46 + FileNameLength + ExtraFieldLength,
+ FileCommentLength);
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedFieldLength + FileNameLength + ExtraFieldLength + FileCommentLength;
+ }
+ }
+
+ public override void ReadBefore(BinaryReader r)
+ {
+ VersionMadeBy = r.ReadUInt16();
+ }
+
+ public override void ReadAfter(BinaryReader r)
+ {
+ FileCommentLength = r.ReadUInt16();
+ DiskNumberWhereFileStarts = r.ReadUInt16();
+ InternalFileAttributes = r.ReadUInt16();
+ ExternalFileAttributes = r.ReadInt32();
+ RelativeOffsetOfLocalFileHeader = r.ReadInt32();
+ }
+ }
+
+ class LocalFileHeader : CommonHeader
+ {
+ public override int FixedFieldLength
+ {
+ get
+ {
+ return 30;
+ }
+ }
+
+ public override int Signature
+ {
+ get
+ {
+ return 0x04034b50;
+ }
+ }
+
+ public override int Length
+ {
+ get
+ {
+ return FixedFieldLength + FileNameLength + ExtraFieldLength;
+ }
+ }
+
+ public LocalFileHeader(Byte[] bytes, int offset) : base(bytes, offset)
+ {
+ }
+
+ public override void ReadBefore(BinaryReader r)
+ {
+ }
+
+ public override void ReadAfter(BinaryReader r)
+ {
+ }
+ }
+
+ class ZipArchiveStorage : IStorage
+ {
+ public override string ToString()
+ {
+ return string.Format("<ZIPArchive\n{0}>", String.Join("", Entries.Select(x => x.ToString() + "\n").ToArray()));
+ }
+
+ public List<CentralDirectoryFileHeader> Entries = new List<CentralDirectoryFileHeader>();
+
+ public static ZipArchiveStorage Parse(byte[] bytes)
+ {
+ var eocd = EOCD.Parse(bytes);
+ var archive = new ZipArchiveStorage();
+
+ var pos = eocd.OffsetOfStartOfCentralDirectory;
+ for (int i = 0; i < eocd.NumberOfCentralDirectoryRecordsOnThisDisk; ++i)
+ {
+ var file = new CentralDirectoryFileHeader(bytes, pos);
+ archive.Entries.Add(file);
+ pos += file.Length;
+ }
+
+ return archive;
+ }
+
+ public Byte[] Extract(CentralDirectoryFileHeader header)
+ {
+ var local = new LocalFileHeader(header.Bytes, header.RelativeOffsetOfLocalFileHeader);
+ var pos = local.Offset + local.Length;
+
+ var dst = new Byte[local.UncompressedSize];
+
+#if true
+ using (var s = new MemoryStream(header.Bytes, pos, local.CompressedSize, false))
+ using (var deflateStream = new DeflateStream(s, CompressionMode.Decompress))
+ {
+ int dst_pos = 0;
+ for (int remain = dst.Length; remain > 0;)
+ {
+ var readSize = deflateStream.Read(dst, dst_pos, remain);
+ dst_pos += readSize;
+ remain -= readSize;
+ }
+ }
+#else
+ var size=RawInflate.RawInflateImport.RawInflate(dst, 0, dst.Length,
+ header.Bytes, pos, header.CompressedSize);
+#endif
+
+ return dst;
+ }
+
+ public string ExtractToString(CentralDirectoryFileHeader header, Encoding encoding)
+ {
+ var local = new LocalFileHeader(header.Bytes, header.RelativeOffsetOfLocalFileHeader);
+ var pos = local.Offset + local.Length;
+
+ using (var s = new MemoryStream(header.Bytes, pos, local.CompressedSize, false))
+ using (var deflateStream = new DeflateStream(s, CompressionMode.Decompress))
+ using (var r = new StreamReader(deflateStream, encoding))
+ {
+ return r.ReadToEnd();
+ }
+ }
+
+ public ArraySegment<byte> Get(string url)
+ {
+ var found = Entries.FirstOrDefault(x => x.FileName == url);
+ if (found == null)
+ {
+ throw new FileNotFoundException("[ZipArchive]" + url);
+ }
+
+ switch (found.CompressionMethod)
+ {
+ case CompressionMethod.Deflated:
+ return new ArraySegment<byte>(Extract(found));
+
+ case CompressionMethod.Stored:
+ return new ArraySegment<byte>(found.Bytes, found.RelativeOffsetOfLocalFileHeader, found.CompressedSize);
+ }
+
+ throw new NotImplementedException(found.CompressionMethod.ToString());
+ }
+
+ public string GetPath(string url)
+ {
+ return null;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs.meta
new file mode 100644
index 00000000..303fb3c2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/ZipArchiveStorage.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b5aadac20fc53d04abe0492399479ce5
+timeCreated: 1528580594
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs
new file mode 100644
index 00000000..93417ea8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public static class glbImporter
+ {
+ public const string GLB_MAGIC = "glTF";
+ public const float GLB_VERSION = 2.0f;
+
+ public static GlbChunkType ToChunkType(string src)
+ {
+ switch(src)
+ {
+ case "BIN":
+ return GlbChunkType.BIN;
+
+ case "JSON":
+ return GlbChunkType.JSON;
+
+ default:
+ throw new FormatException("unknown chunk type: " + src);
+ }
+ }
+
+ [Obsolete("Use ParseGlbChunks(bytes)")]
+ public static List<GlbChunk> ParseGlbChanks(Byte[] bytes)
+ {
+ return ParseGlbChunks(bytes);
+ }
+
+ public static List<GlbChunk> ParseGlbChunks(Byte[] bytes)
+ {
+ if (bytes.Length == 0)
+ {
+ throw new Exception("empty bytes");
+ }
+
+ int pos = 0;
+ if (Encoding.ASCII.GetString(bytes, 0, 4) != GLB_MAGIC)
+ {
+ throw new Exception("invalid magic");
+ }
+ pos += 4;
+
+ var version = BitConverter.ToUInt32(bytes, pos);
+ if (version != GLB_VERSION)
+ {
+ Debug.LogWarningFormat("unknown version: {0}", version);
+ return null;
+ }
+ pos += 4;
+
+ //var totalLength = BitConverter.ToUInt32(bytes, pos);
+ pos += 4;
+
+ var chunks = new List<GlbChunk>();
+ while (pos < bytes.Length)
+ {
+ var chunkDataSize = BitConverter.ToInt32(bytes, pos);
+ pos += 4;
+
+ //var type = (GlbChunkType)BitConverter.ToUInt32(bytes, pos);
+ var chunkTypeBytes = bytes.Skip(pos).Take(4).Where(x => x != 0).ToArray();
+ var chunkTypeStr = Encoding.ASCII.GetString(chunkTypeBytes);
+ var type = ToChunkType(chunkTypeStr);
+ pos += 4;
+
+ chunks.Add(new GlbChunk
+ {
+ ChunkType = type,
+ Bytes = new ArraySegment<byte>(bytes, (int)pos, (int)chunkDataSize)
+ });
+
+ pos += chunkDataSize;
+ }
+
+ return chunks;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs.meta
new file mode 100644
index 00000000..4246fe47
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/glbImporter.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 4a51e78bfa249be4c88e7612ed05eb6f
+timeCreated: 1514252170
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs
new file mode 100644
index 00000000..68cc36eb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs
@@ -0,0 +1,372 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF
+{
+ public class gltfExporter : IDisposable
+ {
+ const string CONVERT_HUMANOID_KEY = UniGLTFVersion.MENU + "/Export";
+
+#if UNITY_EDITOR
+ [MenuItem(CONVERT_HUMANOID_KEY, true, 1)]
+ private static bool ExportValidate()
+ {
+ return Selection.activeObject != null && Selection.activeObject is GameObject;
+ }
+
+ [MenuItem(CONVERT_HUMANOID_KEY, false, 1)]
+ private static void ExportFromMenu()
+ {
+ var go = Selection.activeObject as GameObject;
+
+ if (go.transform.position == Vector3.zero &&
+ go.transform.rotation == Quaternion.identity &&
+ go.transform.localScale == Vector3.one)
+ {
+ var path = EditorUtility.SaveFilePanel(
+ "Save glb", "", go.name + ".glb", "glb");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ var gltf = new glTF();
+ using (var exporter = new gltfExporter(gltf))
+ {
+ exporter.Prepare(go);
+ exporter.Export(MeshExportSettings.Default);
+ }
+ var bytes = gltf.ToGlbBytes();
+ File.WriteAllBytes(path, bytes);
+
+ if (path.StartsWithUnityAssetPath())
+ {
+ AssetDatabase.ImportAsset(path.ToUnityRelativePath());
+ AssetDatabase.Refresh();
+ }
+ }
+ else
+ {
+ EditorUtility.DisplayDialog("Error", "The Root transform should have Default translation, rotation and scale.", "ok");
+ }
+ }
+#endif
+
+ protected glTF glTF;
+
+ public GameObject Copy
+ {
+ get;
+ protected set;
+ }
+
+ public List<Mesh> Meshes
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Mesh毎に、元のBlendShapeIndex => ExportされたBlendShapeIndex の対応を記録する
+ ///
+ /// BlendShape が空の場合にスキップするので
+ /// </summary>
+ /// <value></value>
+ public Dictionary<Mesh, Dictionary<int, int>> MeshBlendShapeIndexMap
+ {
+ get;
+ private set;
+ }
+
+ public List<Transform> Nodes
+ {
+ get;
+ private set;
+ }
+
+ public List<Material> Materials
+ {
+ get;
+ private set;
+ }
+
+ public TextureExportManager TextureManager;
+
+ protected virtual IMaterialExporter CreateMaterialExporter()
+ {
+ return new MaterialExporter();
+ }
+
+ /// <summary>
+ /// このエクスポーターがサポートするExtension
+ /// </summary>
+ protected virtual IEnumerable<string> ExtensionUsed
+ {
+ get
+ {
+ yield return glTF_KHR_materials_unlit.ExtensionName;
+ yield return glTF_KHR_texture_transform.ExtensionName;
+ }
+ }
+
+ public gltfExporter(glTF gltf)
+ {
+ glTF = gltf;
+
+ glTF.extensionsUsed.AddRange(ExtensionUsed);
+
+ glTF.asset = new glTFAssets
+ {
+ generator = "UniGLTF-" + UniGLTFVersion.VERSION,
+ version = "2.0",
+ };
+ }
+
+ public virtual void Prepare(GameObject go)
+ {
+ // コピーを作って、Z軸を反転することで左手系を右手系に変換する
+ Copy = GameObject.Instantiate(go);
+ Copy.transform.ReverseZRecursive();
+ }
+
+ public void Dispose()
+ {
+ if (Application.isEditor)
+ {
+ GameObject.DestroyImmediate(Copy);
+ }
+ else
+ {
+ GameObject.Destroy(Copy);
+ }
+ }
+
+ #region Export
+ static glTFNode ExportNode(Transform x, List<Transform> nodes, List<Renderer> renderers, List<SkinnedMeshRenderer> skins)
+ {
+ var node = new glTFNode
+ {
+ name = x.name,
+ children = x.transform.GetChildren().Select(y => nodes.IndexOf(y)).ToArray(),
+ rotation = x.transform.localRotation.ToArray(),
+ translation = x.transform.localPosition.ToArray(),
+ scale = x.transform.localScale.ToArray(),
+ };
+
+ if (x.gameObject.activeInHierarchy)
+ {
+ var meshRenderer = x.GetComponent<MeshRenderer>();
+ if (meshRenderer != null)
+ {
+ node.mesh = renderers.IndexOf(meshRenderer);
+ }
+
+ var skinnedMeshRenderer = x.GetComponent<SkinnedMeshRenderer>();
+ if (skinnedMeshRenderer != null)
+ {
+ node.mesh = renderers.IndexOf(skinnedMeshRenderer);
+ node.skin = skins.IndexOf(skinnedMeshRenderer);
+ }
+ }
+
+ return node;
+ }
+
+ public virtual void Export(MeshExportSettings meshExportSettings)
+ {
+ var bytesBuffer = new ArrayByteBuffer(new byte[50 * 1024 * 1024]);
+ var bufferIndex = glTF.AddBuffer(bytesBuffer);
+
+ GameObject tmpParent = null;
+ if (Copy.transform.childCount == 0)
+ {
+ tmpParent = new GameObject("tmpParent");
+ Copy.transform.SetParent(tmpParent.transform, true);
+ Copy = tmpParent;
+ }
+
+ try
+ {
+ Nodes = Copy.transform.Traverse()
+ .Skip(1) // exclude root object for the symmetry with the importer
+ .ToList();
+
+ #region Materials and Textures
+ Materials = Nodes.SelectMany(x => x.GetSharedMaterials()).Where(x => x != null).Distinct().ToList();
+ var unityTextures = Materials.SelectMany(x => TextureIO.GetTextures(x)).Where(x => x.Texture != null).Distinct().ToList();
+
+ TextureManager = new TextureExportManager(unityTextures.Select(x => x.Texture));
+
+ var materialExporter = CreateMaterialExporter();
+ glTF.materials = Materials.Select(x => materialExporter.ExportMaterial(x, TextureManager)).ToList();
+
+ for (int i = 0; i < unityTextures.Count; ++i)
+ {
+ var unityTexture = unityTextures[i];
+ TextureIO.ExportTexture(glTF, bufferIndex, TextureManager.GetExportTexture(i), unityTexture.TextureType);
+ }
+ #endregion
+
+ #region Meshes
+ var unityMeshes = Nodes
+ .Select(x => new MeshWithRenderer
+ {
+ Mesh = x.GetSharedMesh(),
+ Renderer = x.GetComponent<Renderer>(),
+ })
+ .Where(x =>
+ {
+ if (x.Mesh == null)
+ {
+ return false;
+ }
+ if (x.Renderer.sharedMaterials == null
+ || x.Renderer.sharedMaterials.Length == 0)
+ {
+ return false;
+ }
+
+ return true;
+ })
+ .ToList();
+
+ MeshBlendShapeIndexMap = new Dictionary<Mesh, Dictionary<int, int>>();
+ foreach (var (mesh, gltfMesh, blendShapeIndexMap) in MeshExporter.ExportMeshes(
+ glTF, bufferIndex, unityMeshes, Materials, meshExportSettings))
+ {
+ glTF.meshes.Add(gltfMesh);
+ if (!MeshBlendShapeIndexMap.ContainsKey(mesh))
+ {
+ // 同じmeshが複数回現れた
+ MeshBlendShapeIndexMap.Add(mesh, blendShapeIndexMap);
+ }
+ }
+ Meshes = unityMeshes.Select(x => x.Mesh).ToList();
+ #endregion
+
+ #region Nodes and Skins
+ var unitySkins = Nodes
+ .Select(x => x.GetComponent<SkinnedMeshRenderer>()).Where(x =>
+ x != null
+ && x.bones != null
+ && x.bones.Length > 0)
+ .ToList();
+ glTF.nodes = Nodes.Select(x => ExportNode(x, Nodes, unityMeshes.Select(y => y.Renderer).ToList(), unitySkins)).ToList();
+ glTF.scenes = new List<gltfScene>
+ {
+ new gltfScene
+ {
+ nodes = Copy.transform.GetChildren().Select(x => Nodes.IndexOf(x)).ToArray(),
+ }
+ };
+
+ foreach (var x in unitySkins)
+ {
+ var matrices = x.sharedMesh.bindposes.Select(y => y.ReverseZ()).ToArray();
+ var accessor = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, matrices, glBufferTarget.NONE);
+
+ var skin = new glTFSkin
+ {
+ inverseBindMatrices = accessor,
+ joints = x.bones.Select(y => Nodes.IndexOf(y)).ToArray(),
+ skeleton = Nodes.IndexOf(x.rootBone),
+ };
+ var skinIndex = glTF.skins.Count;
+ glTF.skins.Add(skin);
+
+ foreach (var z in Nodes.Where(y => y.Has(x)))
+ {
+ var nodeIndex = Nodes.IndexOf(z);
+ var node = glTF.nodes[nodeIndex];
+ node.skin = skinIndex;
+ }
+ }
+ #endregion
+
+#if UNITY_EDITOR
+ #region Animations
+
+ var clips = new List<AnimationClip>();
+ var animator = Copy.GetComponent<Animator>();
+ var animation = Copy.GetComponent<Animation>();
+ if (animator != null)
+ {
+ clips = AnimationExporter.GetAnimationClips(animator);
+ }
+ else if (animation != null)
+ {
+ clips = AnimationExporter.GetAnimationClips(animation);
+ }
+
+ if (clips.Any())
+ {
+ foreach (AnimationClip clip in clips)
+ {
+ var animationWithCurve = AnimationExporter.Export(clip, Copy.transform, Nodes);
+
+ foreach (var kv in animationWithCurve.SamplerMap)
+ {
+ var sampler = animationWithCurve.Animation.samplers[kv.Key];
+
+ var inputAccessorIndex = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, kv.Value.Input);
+ sampler.input = inputAccessorIndex;
+
+ var outputAccessorIndex = glTF.ExtendBufferAndGetAccessorIndex(bufferIndex, kv.Value.Output);
+ sampler.output = outputAccessorIndex;
+
+ // modify accessors
+ var outputAccessor = glTF.accessors[outputAccessorIndex];
+ var channel = animationWithCurve.Animation.channels.First(x => x.sampler == kv.Key);
+ switch (glTFAnimationTarget.GetElementCount(channel.target.path))
+ {
+ case 1:
+ outputAccessor.type = "SCALAR";
+ //outputAccessor.count = ;
+ break;
+ case 3:
+ outputAccessor.type = "VEC3";
+ outputAccessor.count /= 3;
+ break;
+
+ case 4:
+ outputAccessor.type = "VEC4";
+ outputAccessor.count /= 4;
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ animationWithCurve.Animation.name = clip.name;
+ glTF.animations.Add(animationWithCurve.Animation);
+ }
+ }
+ #endregion
+#endif
+ }
+ finally
+ {
+ if (tmpParent != null)
+ {
+ tmpParent.transform.GetChild(0).SetParent(null);
+ if (Application.isPlaying)
+ {
+ GameObject.Destroy(tmpParent);
+ }
+ else
+ {
+ GameObject.DestroyImmediate(tmpParent);
+ }
+ }
+ }
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs.meta
new file mode 100644
index 00000000..5b972c8f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfExporter.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: a82bf73539bdd2d4c81595b5108819ce
+timeCreated: 1516612766
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs
new file mode 100644
index 00000000..2629574e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs
@@ -0,0 +1,52 @@
+using System;
+using UnityEngine;
+
+
+namespace UniGLTF
+{
+ public static class gltfImporter
+ {
+ [Obsolete("Use ImporterContext.Load(path)")]
+ public static ImporterContext Load(string path)
+ {
+ var context = new ImporterContext();
+ context.Load(path);
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ return context;
+ }
+
+ [Obsolete("Use ImporterContext.Parse(path, bytes)")]
+ public static ImporterContext Parse(string path, Byte[] bytes)
+ {
+ var context = new ImporterContext();
+ context.Load(path);
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ return context;
+ }
+
+ [Obsolete("use ImporterContext.Load()")]
+ public static void Load(ImporterContext context)
+ {
+ context.Load();
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ }
+
+ public static void LoadVrmAsync(string path, Byte[] bytes, Action<GameObject> onLoaded, Action<Exception> onError = null, bool show = true)
+ {
+ var context = new ImporterContext();
+ context.Parse(path, bytes);
+ context.LoadAsync(() =>
+ {
+ if (show)
+ {
+ context.ShowMeshes();
+ }
+ onLoaded(context.Root);
+ },
+ onError);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs.meta
new file mode 100644
index 00000000..c8cc5daf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/IO/gltfImporter.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 31723631f70a88f47ba90c044e220849
+timeCreated: 1514252170
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs
new file mode 100644
index 00000000..fde2faaf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs
@@ -0,0 +1,17 @@
+using System;
+
+
+namespace UniGLTF
+{
+ public class UniGLTFException : Exception
+ {
+ public UniGLTFException(string fmt, params object[] args) : this(string.Format(fmt, args)) { }
+ public UniGLTFException(string msg) : base(msg) { }
+ }
+
+ public class UniGLTFNotSupportedException : UniGLTFException
+ {
+ public UniGLTFNotSupportedException(string fmt, params object[] args) : this(string.Format(fmt, args)) { }
+ public UniGLTFNotSupportedException(string msg) : base(msg) { }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs.meta
new file mode 100644
index 00000000..2e76c7ba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFException.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 34c865b003bc1f44abcdb95dc99979cf
+timeCreated: 1520500184
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs
new file mode 100644
index 00000000..6cc57706
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs
@@ -0,0 +1,11 @@
+
+namespace UniGLTF
+{
+ public static partial class UniGLTFVersion
+ {
+ public const int MAJOR = 1;
+ public const int MINOR = 28;
+
+ public const string VERSION = "1.28";
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs.meta
new file mode 100644
index 00000000..edbe6d45
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: caf06572635c12c4cb85d6ee09ab8f5e
+timeCreated: 1524584066
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs
new file mode 100644
index 00000000..aff790da
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs
@@ -0,0 +1,8 @@
+namespace UniGLTF
+{
+ public static partial class UniGLTFVersion
+ {
+ public const string UNIGLTF_VERSION = "UniGLTF-" + VERSION;
+ public const string MENU = "VRM/" + UNIGLTF_VERSION;
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs.meta
new file mode 100644
index 00000000..448a601c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/UniGLTFVersion_partial.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 40d707af2901e3f4781e20d8326723e8
+timeCreated: 1524584066
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util.meta
new file mode 100644
index 00000000..d519486c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 980062d19c06cb347b7a8874479d90b7
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs
new file mode 100644
index 00000000..5c90f628
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace UniGLTF
+{
+ public sealed class CacheEnum
+ {
+ public static T Parse<T>(string name, bool ignoreCase = false) where T : struct, Enum
+ {
+ if(ignoreCase)
+ {
+ return CacheParse<T>.ParseIgnoreCase(name);
+ }
+ else
+ {
+ return CacheParse<T>.Parse(name);
+ }
+ }
+
+ public static T TryParseOrDefault<T>(string name, bool ignoreCase = false, T defaultValue=default(T)) where T : struct, Enum
+ {
+ try
+ {
+ if(ignoreCase)
+ {
+ return CacheParse<T>.ParseIgnoreCase(name);
+ }
+ else
+ {
+ return CacheParse<T>.Parse(name);
+ }
+ }
+ catch
+ {
+ return defaultValue;
+ }
+ }
+
+ public static T[] GetValues<T>() where T : struct, Enum
+ {
+ return CacheValues<T>.Values;
+ }
+
+ private static class CacheParse<T> where T : struct, Enum
+ {
+ private static Dictionary<string, T> _values = new Dictionary<string, T>();
+ private static Dictionary<string, T> _ignoreCaseValues = new Dictionary<string, T>(StringComparer.OrdinalIgnoreCase);
+
+ static CacheParse()
+ {
+ }
+
+ public static T ParseIgnoreCase(string name)
+ {
+ if(_ignoreCaseValues.TryGetValue(name, out var value))
+ {
+ return value;
+ }
+ else
+ {
+ T result;
+ value = Enum.TryParse<T>(name, true, out result)
+ ? result
+ : throw new ArgumentException(nameof(result));
+ _ignoreCaseValues.Add(name, value);
+ return value;
+ }
+ }
+
+ public static T Parse(string name)
+ {
+ if(_values.TryGetValue(name, out var value))
+ {
+ return value;
+ }
+ else
+ {
+ T result;
+ value = Enum.TryParse<T>(name, false, out result)
+ ? result
+ : throw new ArgumentException(nameof(result));
+ _values.Add(name, value);
+ return value;
+ }
+ }
+ }
+
+ private static class CacheValues<T> where T : struct, Enum
+ {
+ public static readonly T[] Values;
+
+ static CacheValues()
+ {
+ Values = Enum.GetValues(typeof(T)) as T[];
+ }
+ }
+ }
+}
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs.meta b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs.meta
new file mode 100644
index 00000000..523c7313
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniGLTF/Scripts/Util/CacheEnum.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 517a813d69d7a774f8277f39bfde8a76
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid.meta
new file mode 100644
index 00000000..67270dc2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 42aed961be744fc4b9d423ac4c29f3c9
+folderAsset: yes
+timeCreated: 1545999482
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor.meta
new file mode 100644
index 00000000..700ef71e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6dfa46c173ff021418df4bada32ddfe9
+folderAsset: yes
+timeCreated: 1517655448
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs
new file mode 100644
index 00000000..d94a21aa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs
@@ -0,0 +1,422 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ [CustomEditor(typeof(BoneMapping))]
+ public class BoneMappingEditor : Editor
+ {
+ BoneMapping m_target;
+
+ void OnEnable()
+ {
+ m_target = (BoneMapping)target;
+
+ var animator = m_target.GetComponent<Animator>();
+ if (animator != null)
+ {
+ m_bones = EachBoneDefs.Select(x => new Bone(
+animator.GetBoneTransform(x.Head), animator.GetBoneTransform(x.Tail)))
+.Where(x => x.Head != null && x.Tail != null)
+.ToArray();
+ }
+ }
+
+ static GameObject ObjectField(GameObject obj)
+ {
+ return (GameObject)EditorGUILayout.ObjectField(obj, typeof(GameObject), true);
+ }
+
+ static GameObject ObjectField(string label, GameObject obj)
+ {
+ return (GameObject)EditorGUILayout.ObjectField(label, obj, typeof(GameObject), true);
+ }
+
+ const int LABEL_WIDTH = 100;
+
+ static void BoneField(HumanBodyBones bone, GameObject[] bones)
+ {
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField(bone.ToString(), GUILayout.Width(LABEL_WIDTH));
+ bones[(int)bone] = ObjectField(bones[(int)bone]);
+ EditorGUILayout.EndHorizontal();
+ }
+
+ static void BoneField(HumanBodyBones left, HumanBodyBones right, GameObject[] bones)
+ {
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField(left.ToString().Substring(4), GUILayout.Width(LABEL_WIDTH)); // skip left
+ bones[(int)left] = ObjectField(bones[(int)left]);
+ bones[(int)right] = ObjectField(bones[(int)right]);
+ EditorGUILayout.EndHorizontal();
+ }
+
+ bool m_handFoldout;
+ bool m_settingsFoldout;
+
+ public override void OnInspectorGUI()
+ {
+ var bones = m_target.Bones;
+ if (bones == null)
+ {
+ return;
+ }
+
+ BoneField(HumanBodyBones.Hips, bones);
+
+ if (bones[(int)HumanBodyBones.Hips] == null)
+ {
+ EditorGUILayout.HelpBox(@"First, you set hips", MessageType.Warning);
+ }
+ else
+ {
+ if (GUILayout.Button("Guess bone mapping"))
+ {
+ m_target.GuessBoneMapping();
+ }
+ EditorGUILayout.HelpBox(@"Guess bones from hips", MessageType.Info);
+
+ if (GUILayout.Button("Ensure T-Pose"))
+ {
+ m_target.EnsureTPose();
+ }
+ EditorGUILayout.HelpBox(@"Arms to Horizontal", MessageType.Info);
+
+ if (GUILayout.Button("Create avatar"))
+ {
+ var description = AvatarDescription.Create(m_target.Description);
+ BoneMapping.SetBonesToDescription(m_target, description);
+ var avatar = description.CreateAvatarAndSetup(m_target.transform);
+ if (avatar != null)
+ {
+ avatar.name = "avatar";
+#if UNITY_2018_2_OR_NEWER
+ var prefabRoot = PrefabUtility.GetCorrespondingObjectFromSource(m_target.gameObject);
+#else
+ var prefabRoot = PrefabUtility.GetPrefabParent(m_target.gameObject);
+#endif
+ var prefabPath = AssetDatabase.GetAssetPath(prefabRoot);
+
+ var path = (string.IsNullOrEmpty(prefabPath))
+ ? string.Format("Assets/{0}.asset", avatar.name)
+ : string.Format("{0}/{1}.asset", Path.GetDirectoryName(prefabPath), Path.GetFileNameWithoutExtension(prefabPath))
+ ;
+ path = EditorUtility.SaveFilePanel(
+ "Save avatar",
+ Path.GetDirectoryName(path),
+ string.Format("{0}.avatar.asset", serializedObject.targetObject.name),
+ "asset");
+ var assetPath = HumanPoseTransferEditor.ToAssetPath(path);
+ if (!string.IsNullOrEmpty(assetPath))
+ {
+ AssetDatabase.CreateAsset(description, assetPath); // overwrite
+ AssetDatabase.AddObjectToAsset(avatar, assetPath);
+
+ Debug.LogFormat("Create avatar {0}", path);
+ AssetDatabase.ImportAsset(assetPath);
+ Selection.activeObject = avatar;
+ }
+ else
+ {
+ Debug.LogWarning("fail to CreateAvatar");
+ }
+ }
+ }
+ EditorGUILayout.HelpBox(@"before create,
+
+1. Model root transform should reset(origin without rotation)
+2. Model forward to Z+(rotate child of model root)
+3. Required bones filled
+", MessageType.Info);
+ }
+
+ /*
+ m_settingsFoldout = EditorGUILayout.Foldout(m_settingsFoldout, "AvatarSettings");
+ if (m_settingsFoldout)
+ {
+ EditorGUILayout.FloatField("armStretch", m_target.armStretch);
+ EditorGUILayout.FloatField("legStretch", m_target.legStretch);
+ EditorGUILayout.FloatField("upperArmTwist", m_target.upperArmTwist);
+ EditorGUILayout.FloatField("lowerArmTwist", m_target.lowerArmTwist);
+ EditorGUILayout.FloatField("upperLegTwist", m_target.upperLegTwist);
+ EditorGUILayout.FloatField("lowerLegTwist", m_target.lowerLegTwist);
+ EditorGUILayout.FloatField("feetSpacing", m_target.feetSpacing);
+ EditorGUILayout.Toggle("hasTranslationDoF", m_target.hasTranslationDoF);
+ //public BoneLimit[] human;
+ }
+ */
+
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Arm", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftShoulder, HumanBodyBones.RightShoulder, bones);
+ BoneField(HumanBodyBones.LeftUpperArm, HumanBodyBones.RightUpperArm, bones);
+ BoneField(HumanBodyBones.LeftLowerArm, HumanBodyBones.RightLowerArm, bones);
+ BoneField(HumanBodyBones.LeftHand, HumanBodyBones.RightHand, bones);
+
+ EditorGUILayout.LabelField("Body and Head", EditorStyles.boldLabel);
+ BoneField(HumanBodyBones.Spine, bones);
+ BoneField(HumanBodyBones.Chest, bones);
+#if UNITY_5_6_OR_NEWER
+ BoneField(HumanBodyBones.UpperChest, bones);
+#endif
+ BoneField(HumanBodyBones.Neck, bones);
+ BoneField(HumanBodyBones.Head, bones);
+ BoneField(HumanBodyBones.Jaw, bones);
+ BoneField(HumanBodyBones.LeftEye, HumanBodyBones.RightEye, bones);
+
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Leg", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftUpperLeg, HumanBodyBones.RightUpperLeg, bones);
+ BoneField(HumanBodyBones.LeftLowerLeg, HumanBodyBones.RightLowerLeg, bones);
+ BoneField(HumanBodyBones.LeftFoot, HumanBodyBones.RightFoot, bones);
+ BoneField(HumanBodyBones.LeftToes, HumanBodyBones.RightToes, bones);
+
+ m_handFoldout = EditorGUILayout.Foldout(m_handFoldout, "Hand");
+ if (m_handFoldout)
+ {
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Thumb", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftThumbProximal, HumanBodyBones.RightThumbProximal, bones);
+ BoneField(HumanBodyBones.LeftThumbIntermediate, HumanBodyBones.RightThumbIntermediate, bones);
+ BoneField(HumanBodyBones.LeftThumbDistal, HumanBodyBones.RightThumbDistal, bones);
+
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Index", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftIndexProximal, HumanBodyBones.RightIndexProximal, bones);
+ BoneField(HumanBodyBones.LeftIndexIntermediate, HumanBodyBones.RightIndexIntermediate, bones);
+ BoneField(HumanBodyBones.LeftIndexDistal, HumanBodyBones.RightIndexDistal, bones);
+
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Middle", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftMiddleProximal, HumanBodyBones.RightMiddleProximal, bones);
+ BoneField(HumanBodyBones.LeftMiddleIntermediate, HumanBodyBones.RightMiddleIntermediate, bones);
+ BoneField(HumanBodyBones.LeftMiddleDistal, HumanBodyBones.RightMiddleDistal, bones);
+
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Ring", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftRingProximal, HumanBodyBones.RightRingProximal, bones);
+ BoneField(HumanBodyBones.LeftRingIntermediate, HumanBodyBones.RightRingIntermediate, bones);
+ BoneField(HumanBodyBones.LeftRingDistal, HumanBodyBones.RightRingDistal, bones);
+
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.LabelField("Little", EditorStyles.boldLabel, GUILayout.Width(LABEL_WIDTH));
+ EditorGUILayout.LabelField("Left", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Right", EditorStyles.boldLabel, GUILayout.Width(40));
+ EditorGUILayout.EndHorizontal();
+ BoneField(HumanBodyBones.LeftLittleProximal, HumanBodyBones.RightLittleProximal, bones);
+ BoneField(HumanBodyBones.LeftLittleIntermediate, HumanBodyBones.RightLittleIntermediate, bones);
+ BoneField(HumanBodyBones.LeftLittleDistal, HumanBodyBones.RightLittleDistal, bones);
+ }
+
+ EditorUtility.SetDirty(m_target);
+ }
+
+ struct Bone
+ {
+ public Transform Head;
+ public Transform Tail;
+
+ public Bone(Transform head, Transform tail)
+ {
+ Head = head;
+ Tail = tail;
+ }
+
+ public void Draw()
+ {
+ Handles.DrawLine(Head.transform.position, Tail.transform.position);
+ }
+ }
+
+ Bone[] m_bones;
+
+ struct BoneDef
+ {
+ public HumanBodyBones Head;
+ public HumanBodyBones Tail;
+
+ public BoneDef(HumanBodyBones head, HumanBodyBones tail)
+ {
+ Head = head;
+ Tail = tail;
+ }
+ }
+ static readonly HumanBodyBones[][] BoneDefs =
+ {
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.Hips,
+ HumanBodyBones.Spine,
+ HumanBodyBones.Chest,
+ HumanBodyBones.Neck,
+ HumanBodyBones.Head,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.Chest,
+ HumanBodyBones.LeftShoulder,
+ HumanBodyBones.LeftUpperArm,
+ HumanBodyBones.LeftLowerArm,
+ HumanBodyBones.LeftHand,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.Chest,
+ HumanBodyBones.RightShoulder,
+ HumanBodyBones.RightUpperArm,
+ HumanBodyBones.RightLowerArm,
+ HumanBodyBones.RightHand,
+ },
+
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.LeftThumbProximal,
+ HumanBodyBones.LeftThumbIntermediate,
+ HumanBodyBones.LeftThumbDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.LeftIndexProximal,
+ HumanBodyBones.LeftIndexIntermediate,
+ HumanBodyBones.LeftIndexDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.LeftMiddleProximal,
+ HumanBodyBones.LeftMiddleIntermediate,
+ HumanBodyBones.LeftMiddleDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.LeftRingProximal,
+ HumanBodyBones.LeftRingIntermediate,
+ HumanBodyBones.LeftRingDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.LeftLittleProximal,
+ HumanBodyBones.LeftLittleIntermediate,
+ HumanBodyBones.LeftLittleDistal,
+ },
+
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.RightThumbProximal,
+ HumanBodyBones.RightThumbIntermediate,
+ HumanBodyBones.RightThumbDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.RightIndexProximal,
+ HumanBodyBones.RightIndexIntermediate,
+ HumanBodyBones.RightIndexDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.RightMiddleProximal,
+ HumanBodyBones.RightMiddleIntermediate,
+ HumanBodyBones.RightMiddleDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.RightRingProximal,
+ HumanBodyBones.RightRingIntermediate,
+ HumanBodyBones.RightRingDistal,
+ },
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.RightLittleProximal,
+ HumanBodyBones.RightLittleIntermediate,
+ HumanBodyBones.RightLittleDistal,
+ },
+
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.LeftUpperLeg,
+ HumanBodyBones.LeftLowerLeg,
+ HumanBodyBones.LeftFoot,
+ },
+
+ new HumanBodyBones[]
+ {
+ HumanBodyBones.RightUpperLeg,
+ HumanBodyBones.RightLowerLeg,
+ HumanBodyBones.RightFoot,
+ },
+ };
+ static IEnumerable<BoneDef> EachBoneDefs
+ {
+ get
+ {
+ foreach (var x in BoneDefs)
+ {
+ var count = x.Length - 1;
+ for (int i = 0; i < count; ++i)
+ {
+ yield return new BoneDef(x[i], x[i + 1]);
+ }
+ }
+ }
+ }
+
+ void DrawBone(HumanBodyBones bone, GameObject go)
+ {
+ if (go == null)
+ {
+ return;
+ }
+
+ Handles.Label(go.transform.position,
+ go.name + "\n(" + bone.ToString() + ")");
+ }
+
+ private void OnSceneGUI()
+ {
+ var bones = m_target.Bones;
+ if (bones != null)
+ {
+ for (int i = 0; i < bones.Length; ++i)
+ {
+ DrawBone((HumanBodyBones)i, bones[i]);
+ }
+ if (m_bones != null)
+ {
+ foreach (var x in m_bones)
+ {
+ x.Draw();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs.meta
new file mode 100644
index 00000000..d6a1c6db
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/BoneMappingEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 06b3418a97f8c204da34a849fa86a7c0
+timeCreated: 1516520481
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs
new file mode 100644
index 00000000..6a8489a4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs
@@ -0,0 +1,151 @@
+using System;
+using System.IO;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ [CustomEditor(typeof(HumanPoseTransfer))]
+ public class HumanPoseTransferEditor : Editor
+ {
+ //HumanPoseTransfer m_target;
+ SerializedProperty m_avatarProp;
+ SerializedProperty m_typeProp;
+ SerializedProperty m_clipProp;
+ SerializedProperty m_transferProp;
+
+ static string[] SOURCE_TYPES = ((HumanPoseTransfer.HumanPoseTransferSourceType[])
+ Enum.GetValues(typeof(HumanPoseTransfer.HumanPoseTransferSourceType)))
+ .Select(x => x.ToString())
+ .ToArray();
+
+ private void OnEnable()
+ {
+ //m_target = (HumanPoseTransfer)target;
+ m_typeProp = serializedObject.FindProperty("SourceType");
+ m_clipProp = serializedObject.FindProperty("PoseClip");
+ m_avatarProp = serializedObject.FindProperty("Avatar");
+ m_transferProp = serializedObject.FindProperty("Source");
+ }
+
+ public override void OnInspectorGUI()
+ {
+ //base.OnInspectorGUI();
+ serializedObject.Update();
+
+ EditorGUILayout.PropertyField(m_avatarProp);
+
+ /*
+ m_typeProp.intValue =
+ GUILayout.Toolbar(m_typeProp.intValue, SOURCE_TYPES);
+ */
+ m_typeProp.intValue =
+ EditorGUILayout.Popup("SourceType", m_typeProp.intValue, SOURCE_TYPES);
+
+ switch ((HumanPoseTransfer.HumanPoseTransferSourceType)m_typeProp.intValue)
+ {
+ case HumanPoseTransfer.HumanPoseTransferSourceType.None:
+ serializedObject.ApplyModifiedProperties();
+ break;
+
+ case HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseClip:
+ PoseClipInspector();
+ break;
+
+ case HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer:
+ PoseHandler();
+ break;
+ }
+ GUILayout.Space(20);
+
+ // CreatePose
+ if (GUILayout.Button("Pose to HumanPoseClip"))
+ {
+ var path = EditorUtility.SaveFilePanel(
+ "Save humanpose",
+ Application.dataPath,
+ string.Format("{0}.pose.asset", serializedObject.targetObject.name),
+ "asset");
+ var assetPath = ToAssetPath(path);
+ if (!string.IsNullOrEmpty(path))
+ {
+ var pose = ((HumanPoseTransfer)serializedObject.targetObject).CreatePose();
+
+ var clip = ScriptableObject.CreateInstance<HumanPoseClip>();
+ clip.ApplyPose(ref pose);
+
+ AssetDatabase.CreateAsset(clip, assetPath);
+ Selection.activeObject = clip;
+ }
+ }
+
+ // CreatePose
+ if (GUILayout.Button("Pose to AnimationClip"))
+ {
+ var path = EditorUtility.SaveFilePanel(
+ "Save animationClip",
+ Application.dataPath,
+ string.Format("{0}.pose.anim", serializedObject.targetObject.name),
+ "anim");
+ var assetPath = ToAssetPath(path);
+ if (!string.IsNullOrEmpty(path))
+ {
+ var pose = ((HumanPoseTransfer)serializedObject.targetObject).CreatePose();
+ var clip = AnimationClipUtility.CreateAnimationClipFromHumanPose(pose);
+ AssetDatabase.CreateAsset(clip, assetPath);
+ Selection.activeObject = clip;
+ }
+ }
+ }
+
+ public static string ToAssetPath(string src)
+ {
+ src = src.Replace("\\", "/");
+ var basePath = Path.GetFullPath(Application.dataPath + "/..").Replace("\\", "/");
+ if (!src.StartsWith(basePath))
+ {
+ return null;
+ }
+ return src.Substring(basePath.Length + 1);
+ }
+
+ void PoseClipInspector()
+ {
+ var old = (HumanPoseClip)m_clipProp.objectReferenceValue;
+ EditorGUILayout.PropertyField(m_clipProp);
+ serializedObject.ApplyModifiedProperties();
+
+ var _target = (HumanPoseTransfer)target;
+ if (_target.PoseClip != old)
+ {
+ //Debug.Log("clip != old");
+ if (_target.PoseClip != null)
+ {
+ var pose = _target.PoseClip.GetPose();
+ _target.SetPose(pose);
+ }
+ }
+
+#if false
+ if (_target.PoseClip != null)
+ {
+ if (GUILayout.Button("Apply PoseClip"))
+ {
+ Debug.Log("apply");
+ var pose = default(HumanPose);
+ _target.PoseClip.GetPose(out pose);
+ _target.SetPose(pose);
+ }
+ }
+#endif
+ }
+
+ void PoseHandler()
+ {
+ EditorGUILayout.PropertyField(m_transferProp);
+ serializedObject.ApplyModifiedProperties();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs.meta
new file mode 100644
index 00000000..0e206056
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/HumanPoseTransferEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: d51cc8ca343beb647bc6d8e23600dd66
+timeCreated: 1519366120
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs
new file mode 100644
index 00000000..c48010c6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs
@@ -0,0 +1,352 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEditor;
+using UnityEditor.IMGUI.Controls;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ class BoneNode : IEnumerable<BoneNode>
+ {
+ public HumanBodyBones Bone { get; private set; }
+
+ public List<BoneNode> Children = new List<BoneNode>();
+
+ public int[] Muscles;
+
+ public BoneNode(HumanBodyBones bone, params int[] muscles)
+ {
+ Bone = bone;
+ Muscles = muscles;
+ }
+
+ public IEnumerator<BoneNode> GetEnumerator()
+ {
+ throw new NotImplementedException();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Add(BoneNode child)
+ {
+ Children.Add(child);
+ }
+ }
+
+ class BoneTreeViewItem : TreeViewItem
+ {
+ //HumanBodyBones m_bone;
+
+ public BoneTreeViewItem(int id, int depth, HumanBodyBones bone) : base(id, depth, bone.ToString())
+ {
+ //m_bone = bone;
+ }
+ }
+
+ class MuscleTreeViewItem : TreeViewItem
+ {
+ public int Muscle
+ {
+ get;
+ private set;
+ }
+
+ public MuscleTreeViewItem(int id, int depth, int muscle) : base(id, depth, HumanTrait.MuscleName[muscle])
+ {
+ Muscle = muscle;
+ }
+ }
+
+ class BoneTreeView : TreeView
+ {
+ static BoneNode Skeleton = new BoneNode(HumanBodyBones.Hips)
+ {
+ new BoneNode(HumanBodyBones.Spine, 0, 1, 2){
+ new BoneNode(HumanBodyBones.Chest, 3, 4, 5){
+ new BoneNode(HumanBodyBones.UpperChest, 6, 7, 8){
+ new BoneNode(HumanBodyBones.Neck, 9, 10, 11){
+ new BoneNode(HumanBodyBones.Head, 12, 13, 14){
+ new BoneNode(HumanBodyBones.LeftEye, 15, 16),
+ new BoneNode(HumanBodyBones.RightEye, 17, 18)
+ }
+ },
+ new BoneNode(HumanBodyBones.LeftShoulder, 37, 38){
+ new BoneNode(HumanBodyBones.LeftUpperArm, 39, 40, 41){
+ new BoneNode(HumanBodyBones.LeftLowerArm, 42, 43){
+ new BoneNode(HumanBodyBones.LeftHand, 44, 45)
+ }
+ }
+ },
+ new BoneNode(HumanBodyBones.RightShoulder, 46, 47){
+ new BoneNode(HumanBodyBones.RightUpperArm, 48, 49, 50){
+ new BoneNode(HumanBodyBones.RightLowerArm, 51, 52){
+ new BoneNode(HumanBodyBones.RightHand, 53, 54)
+ }
+ }
+ }
+ }
+ }
+ },
+ new BoneNode(HumanBodyBones.LeftUpperLeg, 21, 22, 23){
+ new BoneNode(HumanBodyBones.LeftLowerLeg, 24, 25){
+ new BoneNode(HumanBodyBones.LeftFoot, 26, 27){
+ new BoneNode(HumanBodyBones.LeftToes, 28)
+ }
+ }
+ },
+ new BoneNode(HumanBodyBones.RightUpperLeg, 29, 30, 31){
+ new BoneNode(HumanBodyBones.RightLowerLeg, 32, 33){
+ new BoneNode(HumanBodyBones.RightFoot, 34, 35){
+ new BoneNode(HumanBodyBones.RightToes, 36)
+ }
+ }
+ }
+ };
+
+ //Animator m_animator;
+ HumanPoseHandler m_handler;
+ HumanPose m_pose;
+
+ bool m_updated;
+
+ public void Begin()
+ {
+ m_handler.GetHumanPose(ref m_pose);
+ }
+
+ public void End()
+ {
+ if (m_updated)
+ {
+ m_handler.SetHumanPose(ref m_pose);
+ }
+ m_updated = false;
+ }
+
+ public BoneTreeView(TreeViewState treeViewState, MultiColumnHeader header, HumanPoseHandler handler)
+ : base(treeViewState, header)
+ {
+ m_handler = handler;
+ Reload();
+ }
+
+ protected override TreeViewItem BuildRoot()
+ {
+ return new TreeViewItem { id = 0, depth = -1 };
+ }
+
+ protected override IList<TreeViewItem> BuildRows(TreeViewItem root)
+ {
+ var rows = GetRows() ?? new List<TreeViewItem>(200);
+
+ // We use the GameObject instanceIDs as ids for items as we want to
+ // select the game objects and not the transform components.
+ rows.Clear();
+
+ var item = CreateTreeViewItemForBone(HumanBodyBones.Hips);
+ root.AddChild(item);
+ rows.Add(item);
+
+ if (IsExpanded(item.id))
+ {
+ AddChildrenRecursive(Skeleton, item, rows);
+ }
+ else
+ {
+ item.children = CreateChildListForCollapsedParent();
+ }
+
+ SetupDepthsFromParentsAndChildren(root);
+
+ return rows;
+ }
+
+ void AddChildrenRecursive(BoneNode bone, TreeViewItem item, IList<TreeViewItem> rows)
+ {
+ int childCount = bone.Children.Count;
+ item.children = new List<TreeViewItem>(childCount);
+ if (bone.Muscles != null)
+ {
+ foreach (var muscle in bone.Muscles)
+ {
+ var childItem = new MuscleTreeViewItem(muscle + 20000, -1, muscle);
+ item.AddChild(childItem);
+ rows.Add(childItem);
+ }
+ }
+
+ foreach (var child in bone.Children)
+ {
+ var childItem = CreateTreeViewItemForBone(child.Bone);
+ item.AddChild(childItem);
+ rows.Add(childItem);
+
+ //if (child.Children.Count > 0)
+ {
+ if (IsExpanded(childItem.id))
+ {
+ AddChildrenRecursive(child, childItem, rows);
+ }
+ else
+ {
+ childItem.children = CreateChildListForCollapsedParent();
+ }
+ }
+ }
+ }
+
+ static TreeViewItem CreateTreeViewItemForBone(HumanBodyBones bone)
+ {
+ return new TreeViewItem((int)bone, -1, Enum.GetName(typeof(HumanBodyBones), bone));
+ }
+
+ protected override void RowGUI(RowGUIArgs args)
+ {
+ for (int i = 0; i < args.GetNumVisibleColumns(); ++i)
+ {
+ CellGUI(args.GetCellRect(i), args.GetColumn(i), ref args);
+ }
+ }
+
+ void CellGUI(Rect cellRect, int index, ref RowGUIArgs args)
+ {
+ // Center cell rect vertically (makes it easier to place controls, icons etc in the cells)
+ CenterRectUsingSingleLineHeight(ref cellRect);
+
+ switch (index)
+ {
+ case 0:
+ {
+ // Default icon and label
+ args.rowRect = cellRect;
+ base.RowGUI(args);
+ }
+ break;
+
+ case 1:
+ {
+ var muscleItem = args.item as MuscleTreeViewItem;
+ if (muscleItem != null)
+ {
+ var muscleIndex = muscleItem.Muscle;
+ var muscles = m_pose.muscles;
+ var value = EditorGUI.Slider(cellRect, GUIContent.none, muscles[muscleIndex], -1f, 1f);
+ if (value != muscles[muscleIndex])
+ {
+ muscles[muscleIndex] = value;
+ m_updated = true;
+ }
+ }
+ else
+ {
+
+ }
+ }
+ break;
+ }
+ }
+
+ public static MultiColumnHeaderState CreateDefaultMultiColumnHeaderState()
+ {
+ var columns = new[]
+ {
+ new MultiColumnHeaderState.Column
+ {
+ headerContent = new GUIContent("Name"),
+ headerTextAlignment = TextAlignment.Left,
+ width = 250,
+ minWidth = 60,
+ autoResize = false,
+ allowToggleVisibility = false
+ },
+ new MultiColumnHeaderState.Column
+ {
+ headerContent = new GUIContent("Muscle value"),
+ headerTextAlignment = TextAlignment.Left,
+ width = 110,
+ minWidth = 60,
+ autoResize = true
+ },
+ };
+ return new MultiColumnHeaderState(columns);
+ }
+ }
+
+
+ [CustomEditor(typeof(MuscleInspector))]
+ public class MuscleInspectorEditor : Editor
+ {
+ [NonSerialized] bool m_Initialized;
+ [SerializeField] TreeViewState m_TreeViewState; // Serialized in the window layout file so it survives assembly reloading
+ //[SerializeField] MultiColumnHeaderState m_MultiColumnHeaderState;
+ SearchField m_SearchField;
+ BoneTreeView m_TreeView;
+
+ MuscleInspector m_target;
+ HumanPoseHandler m_handler;
+
+
+ MultiColumnHeader GetHeaderState()
+ {
+ //bool firstInit = m_MultiColumnHeaderState == null;
+
+ var headerState = BoneTreeView.CreateDefaultMultiColumnHeaderState();
+ /*
+ if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState))
+ {
+ MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState);
+ }
+ m_MultiColumnHeaderState = headerState;
+ */
+ var multiColumnHeader = new MultiColumnHeader(headerState);
+ multiColumnHeader.ResizeToFit();
+ return multiColumnHeader;
+ }
+
+ void OnEnable()
+ {
+ var mi = this.target as MuscleInspector;
+ var animator = mi.GetComponent<Animator>();
+ if (animator != null
+ && animator.avatar != null
+ && animator.avatar.isValid
+ && animator.avatar.isHuman
+ )
+ {
+ Debug.LogFormat("MuscleInspectorEditor.OnEnable");
+ m_handler = new HumanPoseHandler(animator.avatar, animator.transform);
+
+ m_TreeView = new BoneTreeView(new TreeViewState(), GetHeaderState(), m_handler);
+ }
+ }
+
+ void OnDisable()
+ {
+ if (m_handler != null)
+ {
+ m_handler.Dispose();
+ m_handler = null;
+ }
+ }
+
+ public override void OnInspectorGUI()
+ {
+ if (m_TreeView == null)
+ {
+ EditorGUILayout.HelpBox("Animator required", MessageType.Error);
+ return;
+ }
+
+ var rect = GUILayoutUtility.GetRect(0, 10000, 0, m_TreeView.totalHeight);
+ m_TreeView.Begin();
+ m_TreeView.OnGUI(rect);
+ m_TreeView.End();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs.meta
new file mode 100644
index 00000000..101761ba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/MuscleInspectorEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0d2c3401d1adf41488c19ec4d47386a0
+timeCreated: 1541840728
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests.meta
new file mode 100644
index 00000000..3b873064
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fcdf450ca966f85428c238046e51c2ca
+folderAsset: yes
+timeCreated: 1534750149
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs
new file mode 100644
index 00000000..b85976b8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs
@@ -0,0 +1,1360 @@
+using NUnit.Framework;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+#if UNITY_5_6_OR_NEWER
+ public class BvhLoaderTests
+ {
+ #region LOUICE
+ /// <summary>
+ /// https://github.com/wspr/bvh-matlab/blob/master/louise.bvh
+ /// </summary>
+ const string bvh_louise = @"HIERARCHY
+ROOT Hips
+{
+ OFFSET 0.000000 0.000000 0.000000
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
+ JOINT Chest
+ {
+ OFFSET -0.000000 30.833075 -0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Neck
+ {
+ OFFSET -0.000000 23.115997 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Head
+ {
+ OFFSET -0.000000 10.266666 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 15.866669 0.000000
+ }
+ }
+ }
+ JOINT LeftCollar
+ {
+ OFFSET -0.000000 23.115997 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftShoulder
+ {
+ OFFSET 18.666668 -0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftElbow
+ {
+ OFFSET 25.298601 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftWrist
+ {
+ OFFSET 27.056377 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0.000000 -14.000002 0.000000
+ }
+ }
+ }
+ }
+ }
+ JOINT RightCollar
+ {
+ OFFSET -0.000000 23.115997 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightShoulder
+ {
+ OFFSET -18.666668 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightElbow
+ {
+ OFFSET -25.298601 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightWrist
+ {
+ OFFSET -27.056377 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 -14.000002 0.000000
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT LeftHip
+ {
+ OFFSET 11.200000 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftKnee
+ {
+ OFFSET -0.000000 -43.871983 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftAnkle
+ {
+ OFFSET -0.000000 -44.488350 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 -4.666667 15.866669
+ }
+ }
+ }
+ }
+ JOINT RightHip
+ {
+ OFFSET -11.200000 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightKnee
+ {
+ OFFSET -0.000000 -43.871983 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightAnkle
+ {
+ OFFSET -0.000000 -44.488350 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 -4.666667 15.866669
+ }
+ }
+ }
+ }
+}
+";
+
+ [Test]
+ public void GuessBoneMapping_louise()
+ {
+ var bvh = Bvh.Parse(bvh_louise);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual(0, skeleton.GetBoneIndex(HumanBodyBones.Hips));
+
+ Assert.AreEqual("Hips", skeleton.GetBoneName(HumanBodyBones.Hips));
+ Assert.AreEqual("Chest", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.IsNull(skeleton.GetBoneName(HumanBodyBones.Chest));
+ Assert.AreEqual("Neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("Head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("LeftCollar", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("LeftShoulder", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("LeftElbow", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("LeftWrist", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("RightCollar", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("RightShoulder", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("RightElbow", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("RightWrist", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("LeftHip", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("LeftKnee", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("LeftAnkle", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+ Assert.IsNull(skeleton.GetBoneName(HumanBodyBones.LeftToes));
+
+ Assert.AreEqual("RightHip", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("RightKnee", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("RightAnkle", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ Assert.IsNull(skeleton.GetBoneName(HumanBodyBones.RightToes));
+ }
+ #endregion
+
+ #region cgspeed
+ /// <summary>
+ /// https://sites.google.com/a/cgspeed.com/cgspeed/motion-capture
+ /// </summary>
+ const string bvh_cgspeed = @"HIERARCHY
+ROOT Hips
+{
+ OFFSET 0.00000 0.00000 0.00000
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation
+ JOINT LHipJoint
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftUpLeg
+ {
+ OFFSET 1.64549 -1.70879 0.84566
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftLeg
+ {
+ OFFSET 2.24963 -6.18082 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftFoot
+ {
+ OFFSET 2.71775 -7.46697 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftToeBase
+ {
+ OFFSET 0.18768 -0.51564 2.24737
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET 0.00000 -0.00000 1.15935
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT RHipJoint
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightUpLeg
+ {
+ OFFSET -1.58830 -1.70879 0.84566
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightLeg
+ {
+ OFFSET -2.25006 -6.18201 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightFoot
+ {
+ OFFSET -2.72829 -7.49593 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightToeBase
+ {
+ OFFSET -0.21541 -0.59185 2.10643
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET -0.00000 -0.00000 1.09838
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT LowerBack
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT Spine
+ {
+ OFFSET 0.03142 2.10496 -0.11038
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT Spine1
+ {
+ OFFSET -0.01863 2.10897 -0.06956
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT Neck
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT Neck1
+ {
+ OFFSET -0.02267 1.73238 0.00451
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT Head
+ {
+ OFFSET -0.05808 1.54724 -0.61749
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET -0.01396 1.71468 -0.21082
+ }
+ }
+ }
+ }
+ JOINT LeftShoulder
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftArm
+ {
+ OFFSET 3.44898 0.50298 0.21920
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftForeArm
+ {
+ OFFSET 5.41917 -0.00000 -0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftHand
+ {
+ OFFSET 2.44373 -0.00000 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftFingerBase
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT LeftHandIndex1
+ {
+ OFFSET 0.72750 -0.00000 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET 0.58653 -0.00000 0.00000
+ }
+ }
+ }
+ JOINT LThumb
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET 0.59549 -0.00000 0.59549
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT RightShoulder
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightArm
+ {
+ OFFSET -3.23015 0.55830 0.31051
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightForeArm
+ {
+ OFFSET -5.58976 -0.00010 0.00014
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightHand
+ {
+ OFFSET -2.48060 -0.00000 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightFingerBase
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ JOINT RightHandIndex1
+ {
+ OFFSET -0.81601 -0.00000 0.00000
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET -0.65789 -0.00000 0.00000
+ }
+ }
+ }
+ JOINT RThumb
+ {
+ OFFSET 0 0 0
+ CHANNELS 3 Zrotation Yrotation Xrotation
+ End Site
+ {
+ OFFSET -0.66793 -0.00000 0.66793
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}"
+;
+ [Test]
+ public void GuessBoneMapping_cgspeed()
+ {
+ var bvh = Bvh.Parse(bvh_cgspeed);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual(0, skeleton.GetBoneIndex(HumanBodyBones.Hips));
+
+ Assert.AreEqual("Hips", skeleton.GetBoneName(HumanBodyBones.Hips));
+ Assert.AreEqual("LowerBack", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.AreEqual("Spine", skeleton.GetBoneName(HumanBodyBones.Chest));
+#if UNITY_5_6_OR_NEWER
+ Assert.AreEqual("Spine1", skeleton.GetBoneName(HumanBodyBones.UpperChest));
+#endif
+ Assert.AreEqual("Neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("Head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("LeftShoulder", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("LeftArm", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("LeftForeArm", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("LeftHand", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("RightShoulder", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("RightArm", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("RightForeArm", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("RightHand", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("LeftUpLeg", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("LeftLeg", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("LeftFoot", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+ Assert.AreEqual("LeftToeBase", skeleton.GetBoneName(HumanBodyBones.LeftToes));
+
+ Assert.AreEqual("RightUpLeg", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("RightLeg", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("RightFoot", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ Assert.AreEqual("RightToeBase", skeleton.GetBoneName(HumanBodyBones.RightToes));
+ }
+ #endregion
+
+ #region mocap
+ const string bvh_mocap = @"HIERARCHY
+ROOT Hips
+{
+ OFFSET 0.000000 0.000000 0.000000
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
+ JOINT Spine
+ {
+ OFFSET -0.000000 7.509519 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Spine1
+ {
+ OFFSET -0.000000 18.393364 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Neck
+ {
+ OFFSET -0.000000 20.224955 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Head
+ {
+ OFFSET -0.000000 14.194822 1.831590
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 18.315899 0.000000
+ }
+ }
+ }
+ JOINT LeftShoulder
+ {
+ OFFSET 3.663486 15.569419 -0.490481
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftArm
+ {
+ OFFSET 14.246625 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftForeArm
+ {
+ OFFSET 25.567986 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftHand
+ {
+ OFFSET 29.965693 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 13.736924 0.000000 0.000000
+ }
+ }
+ }
+ }
+ }
+ JOINT RightShoulder
+ {
+ OFFSET -3.661042 15.569419 -0.490481
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightArm
+ {
+ OFFSET -14.246625 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightForeArm
+ {
+ OFFSET -25.567986 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightHand
+ {
+ OFFSET -29.965693 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -13.736924 0.000000 0.000000
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT LeftUpLeg
+ {
+ OFFSET 9.157949 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftLeg
+ {
+ OFFSET -0.000000 -40.189121 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftFoot
+ {
+ OFFSET -0.000000 -39.816978 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftToeBase
+ {
+ OFFSET -0.000000 -5.952667 13.736924
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 0.000000 3.663180
+ }
+ }
+ }
+ }
+ }
+ JOINT RightUpLeg
+ {
+ OFFSET -9.157949 0.000000 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightLeg
+ {
+ OFFSET -0.000000 -40.189121 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightFoot
+ {
+ OFFSET -0.000000 -39.816978 0.000000
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightToeBase
+ {
+ OFFSET -0.000000 -5.952667 13.736924
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -0.000000 0.000000 3.663180
+ }
+ }
+ }
+ }
+ }
+}
+";
+
+ [Test]
+ public void GuessBoneMapping_mocap()
+ {
+ var bvh = Bvh.Parse(bvh_mocap);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual(0, skeleton.GetBoneIndex(HumanBodyBones.Hips));
+
+ Assert.AreEqual("Hips", skeleton.GetBoneName(HumanBodyBones.Hips));
+ Assert.AreEqual("Spine", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.AreEqual("Spine1", skeleton.GetBoneName(HumanBodyBones.Chest));
+
+ Assert.AreEqual(null, skeleton.GetBoneName(HumanBodyBones.UpperChest));
+
+ Assert.AreEqual("Neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("Head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("LeftShoulder", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("LeftArm", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("LeftForeArm", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("LeftHand", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("RightShoulder", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("RightArm", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("RightForeArm", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("RightHand", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("LeftUpLeg", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("LeftLeg", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("LeftFoot", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+ Assert.AreEqual("LeftToeBase", skeleton.GetBoneName(HumanBodyBones.LeftToes));
+
+ Assert.AreEqual("RightUpLeg", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("RightLeg", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("RightFoot", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ Assert.AreEqual("RightToeBase", skeleton.GetBoneName(HumanBodyBones.RightToes));
+ }
+ #endregion
+
+ #region mocap2
+ const string bvh_mocap2 = @"HIERARCHY
+ROOT Hips
+{
+ OFFSET 0.000000 0.000000 0.000000
+ CHANNELS 6 Xposition Yposition Zposition Yrotation Xrotation Zrotation
+ JOINT Chest
+ {
+ OFFSET 0.000000 10.678932 0.006280
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT Chest2
+ {
+ OFFSET 0.000000 10.491159 -0.011408
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT Chest3
+ {
+ OFFSET 0.000000 9.479342 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT Chest4
+ {
+ OFFSET 0.000000 9.479342 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT Neck
+ {
+ OFFSET 0.000000 13.535332 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT Head
+ {
+ OFFSET 0.000000 8.819083 -0.027129
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ End Site
+ {
+ OFFSET 0.000000 16.966594 -0.014170
+ }
+ }
+ }
+ JOINT RightCollar
+ {
+ OFFSET -3.012546 7.545150 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT RightShoulder
+ {
+ OFFSET -13.683099 0.000000 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT RightElbow
+ {
+ OFFSET -26.359998 0.000000 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT RightWrist
+ {
+ OFFSET -21.746691 0.000000 0.008601
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ End Site
+ {
+ OFFSET -16.348058 0.000000 0.000000
+ }
+ }
+ }
+ }
+ }
+ JOINT LeftCollar
+ {
+ OFFSET 3.012546 7.545150 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT LeftShoulder
+ {
+ OFFSET 13.683099 0.000000 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT LeftElbow
+ {
+ OFFSET 26.359998 0.000000 0.000000
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT LeftWrist
+ {
+ OFFSET 21.746691 0.000000 0.008601
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ End Site
+ {
+ OFFSET 16.348058 0.000000 0.000000
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT RightHip
+ {
+ OFFSET -8.622479 -0.030774 -0.003140
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT RightKnee
+ {
+ OFFSET 0.000000 -37.209160 -0.002630
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT RightAnkle
+ {
+ OFFSET 0.000000 -37.343279 -0.058479
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT RightToe
+ {
+ OFFSET 0.000000 -8.903465 15.088070
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ End Site
+ {
+ OFFSET 0.000000 -1.471739 6.884388
+ }
+ }
+ }
+ }
+ }
+ JOINT LeftHip
+ {
+ OFFSET 8.622479 -0.030774 -0.003140
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT LeftKnee
+ {
+ OFFSET 0.000000 -37.209160 -0.002630
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT LeftAnkle
+ {
+ OFFSET 0.000000 -37.343279 -0.058479
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ JOINT LeftToe
+ {
+ OFFSET 0.000000 -8.903465 15.088070
+ CHANNELS 3 Yrotation Xrotation Zrotation
+ End Site
+ {
+ OFFSET 0.000000 -1.471739 6.884388
+ }
+ }
+ }
+ }
+ }
+}
+";
+
+ [Test]
+ public void GuessBoneMapping_mocap2()
+ {
+ var bvh = Bvh.Parse(bvh_mocap2);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual(0, skeleton.GetBoneIndex(HumanBodyBones.Hips));
+
+ Assert.AreEqual("Hips", skeleton.GetBoneName(HumanBodyBones.Hips));
+
+ Assert.AreEqual("Chest", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.AreEqual("Chest2", skeleton.GetBoneName(HumanBodyBones.Chest));
+ Assert.AreEqual("Chest4", skeleton.GetBoneName(HumanBodyBones.UpperChest));
+
+ Assert.AreEqual("Neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("Head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("LeftCollar", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("LeftShoulder", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("LeftElbow", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("LeftWrist", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("RightCollar", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("RightShoulder", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("RightElbow", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("RightWrist", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("LeftHip", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("LeftKnee", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("LeftAnkle", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+ Assert.AreEqual("LeftToe", skeleton.GetBoneName(HumanBodyBones.LeftToes));
+
+ Assert.AreEqual("RightHip", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("RightKnee", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("RightAnkle", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ Assert.AreEqual("RightToe", skeleton.GetBoneName(HumanBodyBones.RightToes));
+ }
+ #endregion
+
+ #region mocapdata.com
+ const string mocapdata_com_hierarchy = @"HIERARCHY
+ROOT Hips
+{
+ OFFSET 17.1116 39.7036 -3.684
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
+ JOINT LeftHip
+ {
+ OFFSET 3.43 2.84217e-014 -2.22045e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftKnee
+ {
+ OFFSET 6.75016e-014 -18.47 4.4853e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftAnkle
+ {
+ OFFSET 1.52767e-013 -17.95 6.98996e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -3.12 0
+ }
+ }
+ }
+ }
+ JOINT RightHip
+ {
+ OFFSET -3.43 7.10543e-015 -1.11022e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightKnee
+ {
+ OFFSET -1.35003e-013 -18.47 -7.10543e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightAnkle
+ {
+ OFFSET -2.92122e-012 -17.95 -3.606e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -3.12 0
+ }
+ }
+ }
+ }
+ JOINT Chest
+ {
+ OFFSET 7.10543e-015 4.57 -9.32587e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Chest2
+ {
+ OFFSET 3.55271e-015 6.57 0
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftCollar
+ {
+ OFFSET 1.06 4.19 1.76
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftShoulder
+ {
+ OFFSET 5.81 -2.84217e-014 -1.17684e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftElbow
+ {
+ OFFSET 1.7053e-013 -12.08 2.13163e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftWrist
+ {
+ OFFSET 5.96856e-013 -9.82 -6.39488e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -7.37 0
+ }
+ }
+ }
+ }
+ }
+ JOINT RightCollar
+ {
+ OFFSET -1.06 4.19 1.76
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightShoulder
+ {
+ OFFSET -6.06 -2.13163e-014 -5.32907e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightElbow
+ {
+ OFFSET -1.42109e-013 -11.08 1.59872e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightWrist
+ {
+ OFFSET -5.32907e-013 -9.82 -1.28342e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -7.14001 0
+ }
+ }
+ }
+ }
+ }
+ JOINT Neck
+ {
+ OFFSET 0 4.05 -7.54952e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Head
+ {
+ OFFSET -3.55271e-015 5.19 -1.95399e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 4.14001 0
+ }
+ }
+ }
+ }
+ }
+}
+";
+ [Test]
+ public void GuessBoneMapping_mocapdatacom()
+ {
+ var bvh = Bvh.Parse(mocapdata_com_hierarchy);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual(0, skeleton.GetBoneIndex(HumanBodyBones.Hips));
+
+ Assert.AreEqual("Hips", skeleton.GetBoneName(HumanBodyBones.Hips));
+ Assert.AreEqual("Chest", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.AreEqual("Chest2", skeleton.GetBoneName(HumanBodyBones.Chest));
+
+ Assert.AreEqual("Neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("Head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("LeftCollar", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("LeftShoulder", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("LeftElbow", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("LeftWrist", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("RightCollar", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("RightShoulder", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("RightElbow", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("RightWrist", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("LeftHip", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("LeftKnee", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("LeftAnkle", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+
+ Assert.AreEqual("RightHip", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("RightKnee", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("RightAnkle", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ }
+
+ const string mocapdatacom_hierarchy_2 = @"HIERARCHY
+ROOT reference
+{
+ OFFSET 0 0 0
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
+ JOINT Hips
+ {
+ OFFSET 18.0689 39.8301 -3.56659
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftHip
+ {
+ OFFSET 3.43 0 -2.22045e-016
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftKnee
+ {
+ OFFSET 6.03961e-014 -18.47 -2.24487e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftAnkle
+ {
+ OFFSET 3.90443e-012 -17.95 -2.54197e-012
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -3.12 0
+ }
+ }
+ }
+ }
+ JOINT RightHip
+ {
+ OFFSET -3.43 -2.84217e-014 -1.11022e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightKnee
+ {
+ OFFSET 2.16716e-013 -18.47 2.24709e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightAnkle
+ {
+ OFFSET 5.25446e-012 -17.95 3.2685e-012
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -3.12 0
+ }
+ }
+ }
+ }
+ JOINT Chest
+ {
+ OFFSET 0 4.57 -2.22045e-016
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Chest2
+ {
+ OFFSET -7.10543e-015 6.57 0
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftCollar
+ {
+ OFFSET 1.06 4.19 1.76
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftShoulder
+ {
+ OFFSET 5.81 2.13163e-014 7.54952e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftElbow
+ {
+ OFFSET 2.13163e-014 -12.08 8.34888e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT LeftWrist
+ {
+ OFFSET 2.98428e-013 -9.82 1.61648e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -7.37 0
+ }
+ }
+ }
+ }
+ }
+ JOINT RightCollar
+ {
+ OFFSET -1.06 4.19 1.76
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightShoulder
+ {
+ OFFSET -6.06 2.13163e-014 5.77316e-015
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightElbow
+ {
+ OFFSET 1.42109e-013 -11.08 -9.05942e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT RightWrist
+ {
+ OFFSET 5.7554e-013 -9.82 -1.98952e-013
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 -7.14001 0
+ }
+ }
+ }
+ }
+ }
+ JOINT Neck
+ {
+ OFFSET 0 4.05 8.88178e-016
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT Head
+ {
+ OFFSET -3.55271e-015 5.19 1.06581e-014
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 4.14001 0
+ }
+ }
+ }
+ }
+ }
+ }
+}
+";
+
+ [Test]
+ public void GuessBoneMapping_mocapdatacom_2()
+ {
+ var bvh = Bvh.Parse(mocapdatacom_hierarchy_2);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual("Hips", skeleton.GetBoneName(HumanBodyBones.Hips));
+ Assert.AreEqual("Chest", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.AreEqual("Chest2", skeleton.GetBoneName(HumanBodyBones.Chest));
+
+ Assert.AreEqual("Neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("Head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("LeftCollar", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("LeftShoulder", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("LeftElbow", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("LeftWrist", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("RightCollar", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("RightShoulder", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("RightElbow", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("RightWrist", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("LeftHip", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("LeftKnee", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("LeftAnkle", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+
+ Assert.AreEqual("RightHip", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("RightKnee", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("RightAnkle", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ }
+ #endregion
+
+ #region daz_friendly
+ const string daz_friendly_hierarchy = @"HIERARCHY
+ROOT hip
+{
+ OFFSET 0 0 0
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation
+ JOINT abdomen
+ {
+ OFFSET 0 20.6881 -0.73152
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT chest
+ {
+ OFFSET 0 11.7043 -0.48768
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT neck
+ {
+ OFFSET 0 22.1894 -2.19456
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT head
+ {
+ OFFSET -0.24384 7.07133 1.2192
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT leftEye
+ {
+ OFFSET 4.14528 8.04674 8.04672
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 1 0 0
+ }
+ }
+ JOINT rightEye
+ {
+ OFFSET -3.6576 8.04674 8.04672
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 1 0 0
+ }
+ }
+ }
+ }
+ JOINT rCollar
+ {
+ OFFSET -2.68224 19.2634 -4.8768
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rShldr
+ {
+ OFFSET -8.77824 -1.95073 1.46304
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rForeArm
+ {
+ OFFSET -28.1742 -1.7115 0.48768
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rHand
+ {
+ OFFSET -22.5879 0.773209 7.07136
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rThumb1
+ {
+ OFFSET -1.2192 -0.487915 3.41376
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rThumb2
+ {
+ OFFSET -3.37035 -0.52449 3.41376
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -1.78271 -1.18214 1.43049
+ }
+ }
+ }
+ JOINT rIndex1
+ {
+ OFFSET -7.75947 0.938293 5.60832
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rIndex2
+ {
+ OFFSET -2.54057 -0.884171 1.56538
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -1.62519 -0.234802 1.16502
+ }
+ }
+ }
+ JOINT rMid1
+ {
+ OFFSET -8.24714 1.18213 3.41376
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rMid2
+ {
+ OFFSET -3.10165 -0.590103 1.0647
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -2.48547 -0.328903 0.83742
+ }
+ }
+ }
+ JOINT rRing1
+ {
+ OFFSET -8.82822 0.546677 1.51678
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rRing2
+ {
+ OFFSET -2.60934 -0.819778 -0.0198488
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -2.33842 -0.294052 0.168128
+ }
+ }
+ }
+ JOINT rPinky1
+ {
+ OFFSET -8.27202 -0.0477905 -0.4584
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rPinky2
+ {
+ OFFSET -1.82734 -0.647385 -0.700984
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -1.69225 -0.51767 -0.607171
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT lCollar
+ {
+ OFFSET 2.68224 19.2634 -4.8768
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lShldr
+ {
+ OFFSET 8.77824 -1.95073 1.46304
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lForeArm
+ {
+ OFFSET 28.1742 -1.7115 0.48768
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lHand
+ {
+ OFFSET 22.5879 0.773209 7.07136
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lThumb1
+ {
+ OFFSET 1.2192 -0.487915 3.41376
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lThumb2
+ {
+ OFFSET 3.37035 -0.52449 3.41376
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 1.78271 -1.18214 1.43049
+ }
+ }
+ }
+ JOINT lIndex1
+ {
+ OFFSET 7.75947 0.938293 5.60832
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lIndex2
+ {
+ OFFSET 2.54057 -0.884171 1.56538
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 1.62519 -0.234802 1.16502
+ }
+ }
+ }
+ JOINT lMid1
+ {
+ OFFSET 8.24714 1.18213 3.41376
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lMid2
+ {
+ OFFSET 3.10165 -0.590103 1.0647
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 2.48547 -0.328903 0.83742
+ }
+ }
+ }
+ JOINT lRing1
+ {
+ OFFSET 8.82822 0.546677 1.51678
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lRing2
+ {
+ OFFSET 2.60934 -0.819778 -0.0198488
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 2.33842 -0.294052 0.168128
+ }
+ }
+ }
+ JOINT lPinky1
+ {
+ OFFSET 8.27202 -0.0477905 -0.4584
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lPinky2
+ {
+ OFFSET 1.82734 -0.647385 -0.700984
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 1.69225 -0.51767 -0.607171
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ JOINT rButtock
+ {
+ OFFSET -8.77824 4.35084 1.2192
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rThigh
+ {
+ OFFSET 0 -1.70687 -2.19456
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rShin
+ {
+ OFFSET 0 -36.8199 0.73152
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT rFoot
+ {
+ OFFSET 0.73152 -45.1104 -5.12064
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET -1.1221 -3.69964 12.103
+ }
+ }
+ }
+ }
+ }
+ JOINT lButtock
+ {
+ OFFSET 8.77824 4.35084 1.2192
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lThigh
+ {
+ OFFSET 0 -1.70687 -2.19456
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lShin
+ {
+ OFFSET 0 -36.8199 0.73152
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ JOINT lFoot
+ {
+ OFFSET -0.73152 -45.1104 -5.12064
+ CHANNELS 3 Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 1.1221 -3.69964 12.103
+ }
+ }
+ }
+ }
+ }
+}";
+
+ [Test]
+ public void GuessBoneMapping_daz_friendly()
+ {
+ var bvh = Bvh.Parse(daz_friendly_hierarchy);
+ var detector = new BvhSkeletonEstimator();
+ var skeleton = detector.Detect(bvh);
+
+ Assert.AreEqual("hip", skeleton.GetBoneName(HumanBodyBones.Hips));
+ Assert.AreEqual("abdomen", skeleton.GetBoneName(HumanBodyBones.Spine));
+ Assert.AreEqual("chest", skeleton.GetBoneName(HumanBodyBones.Chest));
+
+ Assert.AreEqual("neck", skeleton.GetBoneName(HumanBodyBones.Neck));
+ Assert.AreEqual("head", skeleton.GetBoneName(HumanBodyBones.Head));
+
+ Assert.AreEqual("lCollar", skeleton.GetBoneName(HumanBodyBones.LeftShoulder));
+ Assert.AreEqual("lShldr", skeleton.GetBoneName(HumanBodyBones.LeftUpperArm));
+ Assert.AreEqual("lForeArm", skeleton.GetBoneName(HumanBodyBones.LeftLowerArm));
+ Assert.AreEqual("lHand", skeleton.GetBoneName(HumanBodyBones.LeftHand));
+
+ Assert.AreEqual("rCollar", skeleton.GetBoneName(HumanBodyBones.RightShoulder));
+ Assert.AreEqual("rShldr", skeleton.GetBoneName(HumanBodyBones.RightUpperArm));
+ Assert.AreEqual("rForeArm", skeleton.GetBoneName(HumanBodyBones.RightLowerArm));
+ Assert.AreEqual("rHand", skeleton.GetBoneName(HumanBodyBones.RightHand));
+
+ Assert.AreEqual("lThigh", skeleton.GetBoneName(HumanBodyBones.LeftUpperLeg));
+ Assert.AreEqual("lShin", skeleton.GetBoneName(HumanBodyBones.LeftLowerLeg));
+ Assert.AreEqual("lFoot", skeleton.GetBoneName(HumanBodyBones.LeftFoot));
+
+ Assert.AreEqual("rThigh", skeleton.GetBoneName(HumanBodyBones.RightUpperLeg));
+ Assert.AreEqual("rShin", skeleton.GetBoneName(HumanBodyBones.RightLowerLeg));
+ Assert.AreEqual("rFoot", skeleton.GetBoneName(HumanBodyBones.RightFoot));
+ }
+ #endregion
+ }
+#endif
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs.meta
new file mode 100644
index 00000000..31c5676b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/BvhLoaderTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 568764cb60017fc44ad4361d5a18b478
+timeCreated: 1534750164
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef
new file mode 100644
index 00000000..6ca95782
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef
@@ -0,0 +1,15 @@
+{
+ "name": "UniHumanoid.Editor.Tests",
+ "references": [
+ "VRM",
+ "UniHumanoid"
+ ],
+ "optionalUnityReferences": [
+ "TestAssemblies"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef.meta
new file mode 100644
index 00000000..d28a564e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/Tests/UniHumanoid.Editor.Tests.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a76492d20b4f8464894b3a249f0759af
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef
new file mode 100644
index 00000000..0acc8574
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef
@@ -0,0 +1,13 @@
+{
+ "name": "UniHumanoid.Editor",
+ "references": [
+ "VRM",
+ "UniHumanoid"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef.meta
new file mode 100644
index 00000000..597f702e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/UniHumanoid.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 1bd512e806d329b4c9f7fe1abe65e9db
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs
new file mode 100644
index 00000000..4f08f26a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs
@@ -0,0 +1,49 @@
+using System;
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class bvhAssetPostprocessor : AssetPostprocessor
+ {
+ static bool IsStreamingAsset(string path)
+ {
+ var baseFullPath = Path.GetFullPath(Application.dataPath + "/..").Replace("\\", "/");
+ path = Path.Combine(baseFullPath, path).Replace("\\", "/");
+ return path.StartsWith(Application.streamingAssetsPath + "/");
+ }
+
+ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
+ {
+ foreach (string path in importedAssets)
+ {
+ if (IsStreamingAsset(path))
+ {
+ Debug.LogFormat("Skip StreamingAssets: {0}", path);
+ continue;
+ }
+
+ var ext = Path.GetExtension(path).ToLower();
+ if (ext == ".bvh")
+ {
+ Debug.LogFormat("ImportBvh: {0}", path);
+ var context = new BvhImporterContext();
+ try
+ {
+ context.Parse(path);
+ context.Load();
+ context.SaveAsAsset();
+ context.Destroy(false);
+ }
+ catch(Exception ex)
+ {
+ Debug.LogError(ex);
+ context.Destroy(true);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs.meta
new file mode 100644
index 00000000..3a58175b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4283558adf39c194cb6c5d66d5a348de
+timeCreated: 1517166107
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md b/Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md
new file mode 100644
index 00000000..3299d454
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 ousttrue
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md.meta
new file mode 100644
index 00000000..24df7cd3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/LICENSE.md.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3ea85fd858590174f98cc2cd4c3e083f
+timeCreated: 1522228320
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier.meta
new file mode 100644
index 00000000..2ecc6b90
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a90ca020c7788804ea91e172fa5efd1a
+folderAsset: yes
+timeCreated: 1524224672
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs
new file mode 100644
index 00000000..5c94664e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs
@@ -0,0 +1,185 @@
+using System;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class HandPoseModifier : IPoseModifier
+ {
+ public class HandPose
+ {
+ [Obsolete("Use ThumbStretch")]
+ public float ThumbStrech { get { return ThumbStretch; } set { ThumbStretch = value; } }
+ public float ThumbStretch;
+ public float ThumbSpread;
+
+ [Obsolete("Use IndexStretch")]
+ public float IndexStrech { get { return IndexStretch; } set { IndexStretch = value; } }
+ public float IndexStretch;
+ public float IndexSpread;
+
+ [Obsolete("Use MiddleStretch")]
+ public float MiddleStrech { get { return MiddleStretch; } set { MiddleStretch = value; } }
+ public float MiddleStretch;
+ public float MiddleSpread;
+
+ [Obsolete("Use RingStretch")]
+ public float RingStrech { get { return RingStretch; } set { RingStretch = value; } }
+ public float RingStretch;
+ public float RingSpread;
+
+ [Obsolete("Use LittleStretch")]
+ public float LittleStrech { get { return LittleStretch; } set { LittleStretch = value; } }
+ public float LittleStretch;
+ public float LittleSpread;
+ }
+ public HandPose LeftHandPose
+ {
+ get;
+ set;
+ }
+ public HandPose RightHandPose
+ {
+ get;
+ set;
+ }
+
+ int LeftThumb1Stretched;
+ int LeftThumb2Stretched;
+ int LeftThumb3Stretched;
+ int LeftIndex1Stretched;
+ int LeftIndex2Stretched;
+ int LeftIndex3Stretched;
+ int LeftMiddle1Stretched;
+ int LeftMiddle2Stretched;
+ int LeftMiddle3Stretched;
+ int LeftRing1Stretched;
+ int LeftRing2Stretched;
+ int LeftRing3Stretched;
+ int LeftLittle1Stretched;
+ int LeftLittle2Stretched;
+ int LeftLittle3Stretched;
+ int LeftThumbSpread;
+ int LeftIndexSpread;
+ int LeftMiddleSpread;
+ int LeftRingSpread;
+ int LeftLittleSpread;
+
+ int RightThumb1Stretched;
+ int RightThumb2Stretched;
+ int RightThumb3Stretched;
+ int RightIndex1Stretched;
+ int RightIndex2Stretched;
+ int RightIndex3Stretched;
+ int RightMiddle1Stretched;
+ int RightMiddle2Stretched;
+ int RightMiddle3Stretched;
+ int RightRing1Stretched;
+ int RightRing2Stretched;
+ int RightRing3Stretched;
+ int RightLittle1Stretched;
+ int RightLittle2Stretched;
+ int RightLittle3Stretched;
+ int RightThumbSpread;
+ int RightIndexSpread;
+ int RightMiddleSpread;
+ int RightRingSpread;
+ int RightLittleSpread;
+
+ public HandPoseModifier()
+ {
+ LeftThumb1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Thumb 1 Stretched");
+ LeftThumb2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Thumb 2 Stretched");
+ LeftThumb3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Thumb 3 Stretched");
+ LeftIndex1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Index 1 Stretched");
+ LeftIndex2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Index 2 Stretched");
+ LeftIndex3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Index 3 Stretched");
+ LeftMiddle1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Middle 1 Stretched");
+ LeftMiddle2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Middle 2 Stretched");
+ LeftMiddle3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Middle 3 Stretched");
+ LeftRing1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Ring 1 Stretched");
+ LeftRing2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Ring 2 Stretched");
+ LeftRing3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Ring 3 Stretched");
+ LeftLittle1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Little 1 Stretched");
+ LeftLittle2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Little 2 Stretched");
+ LeftLittle3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Left Little 3 Stretched");
+ LeftThumbSpread = Array.IndexOf(HumanTrait.MuscleName, "Left Thumb Spread");
+ LeftIndexSpread = Array.IndexOf(HumanTrait.MuscleName, "Left Index Spread");
+ LeftMiddleSpread = Array.IndexOf(HumanTrait.MuscleName, "Left Middle Spread");
+ LeftRingSpread = Array.IndexOf(HumanTrait.MuscleName, "Left Ring Spread");
+ LeftLittleSpread = Array.IndexOf(HumanTrait.MuscleName, "Left Little Spread");
+
+ RightThumb1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Thumb 1 Stretched");
+ RightThumb2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Thumb 2 Stretched");
+ RightThumb3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Thumb 3 Stretched");
+ RightIndex1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Index 1 Stretched");
+ RightIndex2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Index 2 Stretched");
+ RightIndex3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Index 3 Stretched");
+ RightMiddle1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Middle 1 Stretched");
+ RightMiddle2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Middle 2 Stretched");
+ RightMiddle3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Middle 3 Stretched");
+ RightRing1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Ring 1 Stretched");
+ RightRing2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Ring 2 Stretched");
+ RightRing3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Ring 3 Stretched");
+ RightLittle1Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Little 1 Stretched");
+ RightLittle2Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Little 2 Stretched");
+ RightLittle3Stretched = Array.IndexOf(HumanTrait.MuscleName, "Right Little 3 Stretched");
+ RightThumbSpread = Array.IndexOf(HumanTrait.MuscleName, "Right Thumb Spread");
+ RightIndexSpread = Array.IndexOf(HumanTrait.MuscleName, "Right Index Spread");
+ RightMiddleSpread = Array.IndexOf(HumanTrait.MuscleName, "Right Middle Spread");
+ RightRingSpread = Array.IndexOf(HumanTrait.MuscleName, "Right Ring Spread");
+ RightLittleSpread = Array.IndexOf(HumanTrait.MuscleName, "Right Little Spread");
+ }
+
+ public void Modify(ref HumanPose pose)
+ {
+ if (LeftHandPose != null)
+ {
+ pose.muscles[this.LeftThumb1Stretched] = LeftHandPose.ThumbStretch;
+ pose.muscles[this.LeftThumb2Stretched] = LeftHandPose.ThumbStretch;
+ pose.muscles[this.LeftThumb3Stretched] = LeftHandPose.ThumbStretch;
+ pose.muscles[this.LeftIndex1Stretched] = LeftHandPose.IndexStretch;
+ pose.muscles[this.LeftIndex2Stretched] = LeftHandPose.IndexStretch;
+ pose.muscles[this.LeftIndex3Stretched] = LeftHandPose.IndexStretch;
+ pose.muscles[this.LeftMiddle1Stretched] = LeftHandPose.MiddleStretch;
+ pose.muscles[this.LeftMiddle2Stretched] = LeftHandPose.MiddleStretch;
+ pose.muscles[this.LeftMiddle3Stretched] = LeftHandPose.MiddleStretch;
+ pose.muscles[this.LeftRing1Stretched] = LeftHandPose.RingStretch;
+ pose.muscles[this.LeftRing2Stretched] = LeftHandPose.RingStretch;
+ pose.muscles[this.LeftRing3Stretched] = LeftHandPose.RingStretch;
+ pose.muscles[this.LeftLittle1Stretched] = LeftHandPose.LittleStretch;
+ pose.muscles[this.LeftLittle2Stretched] = LeftHandPose.LittleStretch;
+ pose.muscles[this.LeftLittle3Stretched] = LeftHandPose.LittleStretch;
+ pose.muscles[this.LeftThumbSpread] = LeftHandPose.ThumbSpread;
+ pose.muscles[this.LeftIndexSpread] = LeftHandPose.IndexSpread;
+ pose.muscles[this.LeftMiddleSpread] = LeftHandPose.MiddleSpread;
+ pose.muscles[this.LeftRingSpread] = LeftHandPose.RingSpread;
+ pose.muscles[this.LeftLittleSpread] = LeftHandPose.LittleSpread;
+ }
+
+ if (RightHandPose != null)
+ {
+ pose.muscles[this.RightThumb1Stretched] = RightHandPose.ThumbStretch;
+ pose.muscles[this.RightThumb2Stretched] = RightHandPose.ThumbStretch;
+ pose.muscles[this.RightThumb3Stretched] = RightHandPose.ThumbStretch;
+ pose.muscles[this.RightIndex1Stretched] = RightHandPose.IndexStretch;
+ pose.muscles[this.RightIndex2Stretched] = RightHandPose.IndexStretch;
+ pose.muscles[this.RightIndex3Stretched] = RightHandPose.IndexStretch;
+ pose.muscles[this.RightMiddle1Stretched] = RightHandPose.MiddleStretch;
+ pose.muscles[this.RightMiddle2Stretched] = RightHandPose.MiddleStretch;
+ pose.muscles[this.RightMiddle3Stretched] = RightHandPose.MiddleStretch;
+ pose.muscles[this.RightRing1Stretched] = RightHandPose.RingStretch;
+ pose.muscles[this.RightRing2Stretched] = RightHandPose.RingStretch;
+ pose.muscles[this.RightRing3Stretched] = RightHandPose.RingStretch;
+ pose.muscles[this.RightLittle1Stretched] = RightHandPose.LittleStretch;
+ pose.muscles[this.RightLittle2Stretched] = RightHandPose.LittleStretch;
+ pose.muscles[this.RightLittle3Stretched] = RightHandPose.LittleStretch;
+ pose.muscles[this.RightThumbSpread] = RightHandPose.ThumbSpread;
+ pose.muscles[this.RightIndexSpread] = RightHandPose.IndexSpread;
+ pose.muscles[this.RightMiddleSpread] = RightHandPose.MiddleSpread;
+ pose.muscles[this.RightRingSpread] = RightHandPose.RingSpread;
+ pose.muscles[this.RightLittleSpread] = RightHandPose.LittleSpread;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs.meta
new file mode 100644
index 00000000..a6b02c99
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandPose.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 14d18bc5a296a894eb7154d3f5f0e18b
+timeCreated: 1523606797
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs
new file mode 100644
index 00000000..aa3a65fa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs
@@ -0,0 +1,103 @@
+using UnityEngine;
+using UnityEngine.Serialization;
+
+
+namespace UniHumanoid
+{
+ public class HandRig : MonoBehaviour
+ {
+ [SerializeField]
+ Animator m_animator;
+ public Animator Animator
+ {
+ get { return m_animator; }
+ }
+
+ [FormerlySerializedAs("LeftStrech")]
+ [SerializeField, Range(-1, 1)]
+ public float LeftStretch;
+
+ [SerializeField, Range(-1, 1)]
+ public float LeftSpread;
+
+ [FormerlySerializedAs("RightStrech")]
+ [SerializeField, Range(-1, 1)]
+ public float RightStretch;
+
+ [SerializeField, Range(-1, 1)]
+ public float RightSpread;
+
+ private void Reset()
+ {
+ m_animator = GetComponent<Animator>();
+ }
+
+ HumanPoseHandler m_handler;
+ public static HumanPoseHandler GetHandler(Animator animator)
+ {
+ if (animator == null)
+ {
+ return null;
+ }
+ if (animator.avatar == null)
+ {
+ return null;
+ }
+ if (!animator.avatar.isValid
+ || !animator.avatar.isHuman)
+ {
+ return null;
+ }
+ return new HumanPoseHandler(animator.avatar, animator.transform);
+ }
+
+ HandPoseModifier m_updater;
+
+ private void Awake()
+ {
+ m_handler = GetHandler(m_animator);
+ if (m_handler == null)
+ {
+ enabled = false;
+ return;
+ }
+ m_updater = new HandPoseModifier();
+ }
+
+ HandPoseModifier.HandPose m_leftHand = new HandPoseModifier.HandPose();
+ HandPoseModifier.HandPose m_rightHand = new HandPoseModifier.HandPose();
+ HumanPose m_pose;
+
+ private void Update()
+ {
+ m_leftHand.ThumbStretch = LeftStretch;
+ m_leftHand.ThumbSpread = LeftSpread;
+ m_leftHand.IndexStretch = LeftStretch;
+ m_leftHand.IndexSpread = LeftSpread;
+ m_leftHand.MiddleStretch = LeftStretch;
+ m_leftHand.MiddleSpread = LeftSpread;
+ m_leftHand.RingStretch = LeftStretch;
+ m_leftHand.RingSpread = LeftSpread;
+ m_leftHand.LittleStretch = LeftStretch;
+ m_leftHand.LittleSpread = LeftSpread;
+
+ m_rightHand.ThumbStretch = RightStretch;
+ m_rightHand.ThumbSpread = RightSpread;
+ m_rightHand.IndexStretch = RightStretch;
+ m_rightHand.IndexSpread = RightSpread;
+ m_rightHand.MiddleStretch = RightStretch;
+ m_rightHand.MiddleSpread = RightSpread;
+ m_rightHand.RingStretch = RightStretch;
+ m_rightHand.RingSpread = RightSpread;
+ m_rightHand.LittleStretch = RightStretch;
+ m_rightHand.LittleSpread = RightSpread;
+
+ m_updater.LeftHandPose = m_leftHand;
+ m_updater.RightHandPose = m_rightHand;
+
+ m_handler.GetHumanPose(ref m_pose);
+ m_updater.Modify(ref m_pose);
+ m_handler.SetHumanPose(ref m_pose);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs.meta
new file mode 100644
index 00000000..2a5cb41f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/HandRig.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 45d55d80a64783c41ace70d5d81db454
+timeCreated: 1523602613
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs
new file mode 100644
index 00000000..bcc178dd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs
@@ -0,0 +1,10 @@
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public interface IPoseModifier
+ {
+ void Modify(ref HumanPose pose);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs.meta
new file mode 100644
index 00000000..4e4b1d9d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/PoseModifier/IPoseModifier.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 973f36da309a48d4ea3c5526a51e957f
+timeCreated: 1523606728
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md b/Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md
new file mode 100644
index 00000000..2b155952
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md
@@ -0,0 +1,77 @@
+# UniHumanoid
+
+Unity humanoid utility with bvh importer.
+
+# License
+
+* [MIT](./LICENSE.md)
+
+# BVH runtime loader
+
+```cs
+var context = new BvhImporterContext();
+context.Parse(path);
+context.Load(); // create Skeleton hierarchy and mesh for visualize
+GameObject root = context.Root;
+```
+
+## RuntimeLoader
+* Scenes/RuntimeBvhLoader.unity
+
+## RuntimeLoader and PoseTransfer
+Load BVH and transfer pose to any model with humanoid avatar.
+
+* Scenes/PoseTransfer.unity
+
+![humanpose transfer target](doc/humanpose_transfer_inspector.png)
+
+![humanpose transfer](doc/humanpose_transfer.png)
+
+# Load bvh and create prefab with AnimationClip
+
+Drop bvh file to Assets folder.
+Then, AssetPostprocessor import bvh file.
+
+* create a hierarchy prefab
+* create a humanoid Avatar
+* create a legacy mode AnimationClip
+* create a skinned mesh for preview
+
+![bvh prefab](doc/assets.png)
+
+Instanciate prefab to scene.
+
+![bvh gameobject](doc/mesh.png)
+
+That object can play.
+
+# BoneMapping
+
+This script help create human avatar from exist GameObject hierarchy.
+First, attach this script to root GameObject that has Animator.
+
+Next, setup below.
+
+* model position is origin
+* model look at +z orientation
+* model root node rotation is Quatenion.identity
+* Set hips bone.
+
+press Guess bone mapping.
+If fail to guess bone mapping, you can set bones manually.
+
+Optional, press Ensure T-Pose.
+Create avatar.
+
+![bvh bone mapping](doc/bvh_bonemapping.png)
+
+These humanoids imported by [UniGLTF](https://github.com/ousttrue/UniGLTF) and created human avatar by BoneMapping.
+
+![humanoid](doc/humanoid.gif)
+
+# Download BVH files
+
+* https://sites.google.com/a/cgspeed.com/cgspeed/motion-capture
+* http://mocapdata.com/
+* http://www.thetrailerspark.com/download/Mocap/Packed/EYES-JAPAN/BVH/
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md.meta
new file mode 100644
index 00000000..832294e8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/README.md.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: be513cfaa8530114d85f1e8e0f29708a
+timeCreated: 1517370218
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources.meta
new file mode 100644
index 00000000..2285cdc6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: c61106d290c827b49b7a6e3f6497bd3f
+folderAsset: yes
+timeCreated: 1519379142
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset
new file mode 100644
index 00000000..d6a055f2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset
@@ -0,0 +1,111 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &11400000
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4fdf4ef744a103a4ca01657c00d7fec2, type: 3}
+ m_Name: T-Pose.pose
+ m_EditorClassIdentifier:
+ bodyPosition: {x: 0.0024022944, y: 1.000028, z: 0.0019842784}
+ bodyRotation: {x: -0, y: 0.000000014901161, z: 0.000000014901161, w: 1}
+ muscles:
+ - -0.000000010672161
+ - -6.3611094e-16
+ - 6.3611094e-16
+ - -0.00000055495286
+ - 0.00000026851825
+ - -0.0000000012914859
+ - 0
+ - 0
+ - 0
+ - 0.00000029369042
+ - -0.0000005362765
+ - 0.00000026918045
+ - 0.00000052293626
+ - 0.00000012148932
+ - 0.0000003683441
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0.5957687
+ - -0.018923696
+ - 0.2105892
+ - 1.0025908
+ - -0.13775763
+ - -0.002854546
+ - -0.020644147
+ - -0.0000060816024
+ - 0.5957681
+ - -0.01892539
+ - 0.2106165
+ - 1.0025909
+ - -0.13777769
+ - -0.0028554748
+ - -0.020645387
+ - -2.0029848e-12
+ - 0.0000003415094
+ - -0.00000011383648
+ - 0.39829093
+ - 0.3004907
+ - -0.030618805
+ - 0.999798
+ - 0.03679788
+ - -0.0025310651
+ - 0.00030608202
+ - 6.7851816e-15
+ - -0.00000045534588
+ - 0.39829168
+ - 0.3004914
+ - -0.030611247
+ - 0.9997984
+ - 0.03679079
+ - -0.0025303008
+ - 0.00030552692
+ - -0.68517876
+ - 0.4567073
+ - 0.64590156
+ - 0.6459016
+ - 0.66896635
+ - -0.40027583
+ - 0.8113421
+ - 0.81134295
+ - 0.66770303
+ - -0.62352574
+ - 0.8111324
+ - 0.811132
+ - 0.6683899
+ - -0.5698266
+ - 0.8116428
+ - 0.8116354
+ - 0.6692385
+ - -0.44004643
+ - 0.8082721
+ - 0.8082728
+ - -0.68401676
+ - 0.45769995
+ - 0.6457741
+ - 0.64577323
+ - 0.6689646
+ - -0.40025005
+ - 0.81134063
+ - 0.81134117
+ - 0.6677078
+ - -0.62352294
+ - 0.81113243
+ - 0.8111291
+ - 0.6683884
+ - -0.5698764
+ - 0.81164306
+ - 0.8116342
+ - 0.66924673
+ - -0.44011596
+ - 0.808278
+ - 0.8082771
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset.meta
new file mode 100644
index 00000000..bbcce4e8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Resources/T-Pose.pose.asset.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 879e332f84a378c4da3b87af13da3e85
+timeCreated: 1519376738
+licenseType: Free
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 11400000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes.meta
new file mode 100644
index 00000000..dbc08374
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9edc7cfd64210934e817c98db16bdaea
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs
new file mode 100644
index 00000000..6c81c802
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs
@@ -0,0 +1,149 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ [RequireComponent(typeof(Animator))]
+ public class HumanBuilderTest : MonoBehaviour
+ {
+ [SerializeField]
+ Material m_material;
+
+ class SkeletonBuilder
+ {
+ Dictionary<HumanBodyBones, Transform> m_skeleton = new Dictionary<HumanBodyBones, Transform>();
+ public IDictionary<HumanBodyBones, Transform> Skeleton
+ {
+ get { return m_skeleton; }
+ }
+
+ Dictionary<HumanBodyBones, Vector3> m_boneTail = new Dictionary<HumanBodyBones, Vector3>();
+ Transform m_root;
+
+ public SkeletonBuilder(Transform root)
+ {
+ m_root = root;
+ }
+
+ void Add(HumanBodyBones key, Transform parent, Vector3 headPosition, Vector3 tailPosition)
+ {
+ var bone = new GameObject(key.ToString()).transform;
+ bone.SetParent(parent, false);
+ bone.localPosition = headPosition;
+ m_skeleton[key] = bone;
+ m_boneTail[key] = tailPosition;
+ }
+
+ void Add(HumanBodyBones key, HumanBodyBones parentKey, Vector3 tailPosition)
+ {
+ Add(key, m_skeleton[parentKey], m_boneTail[parentKey], tailPosition);
+ }
+
+ #region Spine
+ public void AddHips(float height, float len)
+ {
+ Add(HumanBodyBones.Hips, m_root, new Vector3(0, height, 0), new Vector3(0, len, 0));
+ }
+
+ public void AddSpine(float len)
+ {
+ Add(HumanBodyBones.Spine, HumanBodyBones.Hips, new Vector3(0, len, 0));
+ }
+
+ public void AddChest(float len)
+ {
+ Add(HumanBodyBones.Chest, HumanBodyBones.Spine, new Vector3(0, len, 0));
+ }
+
+ public void AddNeck(float len)
+ {
+ Add(HumanBodyBones.Neck, HumanBodyBones.Chest, new Vector3(0, len, 0));
+ }
+
+ public void AddHead(float len)
+ {
+ Add(HumanBodyBones.Head, HumanBodyBones.Neck, new Vector3(0, len, 0));
+ }
+ #endregion
+
+ public void AddArm(float shoulder, float upper, float lower, float hand)
+ {
+ Add(HumanBodyBones.LeftShoulder, HumanBodyBones.Chest, new Vector3(-shoulder, 0, 0));
+ Add(HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftShoulder, new Vector3(-upper, 0, 0));
+ Add(HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftUpperArm, new Vector3(-lower, 0, 0));
+ Add(HumanBodyBones.LeftHand, HumanBodyBones.LeftLowerArm, new Vector3(-hand, 0, 0));
+
+ Add(HumanBodyBones.RightShoulder, HumanBodyBones.Chest, new Vector3(shoulder, 0, 0));
+ Add(HumanBodyBones.RightUpperArm, HumanBodyBones.RightShoulder, new Vector3(upper, 0, 0));
+ Add(HumanBodyBones.RightLowerArm, HumanBodyBones.RightUpperArm, new Vector3(lower, 0, 0));
+ Add(HumanBodyBones.RightHand, HumanBodyBones.RightLowerArm, new Vector3(hand, 0, 0));
+ }
+
+ public void AddLeg(float distance, float upper, float lower, float foot, float toe)
+ {
+ Add(HumanBodyBones.LeftUpperLeg, m_skeleton[HumanBodyBones.Hips], new Vector3(-distance, 0, 0), new Vector3(0, -upper, 0));
+ Add(HumanBodyBones.LeftLowerLeg, HumanBodyBones.LeftUpperLeg, new Vector3(0, -lower, 0));
+ Add(HumanBodyBones.LeftFoot, HumanBodyBones.LeftLowerLeg, new Vector3(0, -foot, foot));
+ Add(HumanBodyBones.LeftToes, HumanBodyBones.LeftFoot, new Vector3(0, 0, toe));
+
+ Add(HumanBodyBones.RightUpperLeg, m_skeleton[HumanBodyBones.Hips], new Vector3(distance, 0, 0), new Vector3(0, -upper, 0));
+ Add(HumanBodyBones.RightLowerLeg, HumanBodyBones.RightUpperLeg, new Vector3(0, -lower, 0));
+ Add(HumanBodyBones.RightFoot, HumanBodyBones.RightLowerLeg, new Vector3(0, -foot, foot));
+ Add(HumanBodyBones.RightToes, HumanBodyBones.RightFoot, new Vector3(0, 0, toe));
+ }
+ }
+
+ void OnEnable()
+ {
+ BuildSkeleton(transform);
+ }
+
+ private void BuildSkeleton(Transform root)
+ {
+ var position = root.position;
+ root.position = Vector3.zero;
+
+ try
+ {
+ // hips -> spine -> chest
+ var builder = new SkeletonBuilder(root);
+ builder.AddHips(0.8f, 0.2f);
+ builder.AddSpine(0.1f);
+ builder.AddChest(0.2f);
+ builder.AddNeck(0.1f);
+ builder.AddHead(0.2f);
+ builder.AddArm(0.1f, 0.3f, 0.3f, 0.1f);
+ builder.AddLeg(0.1f, 0.3f, 0.4f, 0.1f, 0.1f);
+
+ var description = AvatarDescription.Create(builder.Skeleton);
+ var animator = GetComponent<Animator>();
+ animator.avatar = description.CreateAvatar(root);
+
+ // create SkinnedMesh for bone visualize
+ var renderer = SkeletonMeshUtility.CreateRenderer(animator);
+
+ if (m_material == null)
+ {
+ m_material = new Material(Shader.Find("Standard"));
+ }
+ renderer.sharedMaterial = m_material;
+ //root.gameObject.AddComponent<BoneMapping>();
+
+ var transfer = GetComponent<HumanPoseTransfer>();
+ if (transfer != null)
+ {
+ transfer.Avatar = animator.avatar;
+ transfer.Setup();
+ }
+ }
+ finally
+ {
+ // restore position
+ root.position = position;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs.meta
new file mode 100644
index 00000000..420a63cd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/HumanBuilderTest.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dfdcf658d2da05649974b59b849de74c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity
new file mode 100644
index 00000000..f9507a2b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity
@@ -0,0 +1,691 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 11
+ m_GIWorkflowMode: 0
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_TemporalCoherenceThreshold: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_LightmapEditorSettings:
+ serializedVersion: 10
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 500
+ m_PVRBounces: 2
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringMode: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
+ m_LightingDataAsset: {fileID: 0}
+ m_UseShadowmask: 1
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &406922205
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 406922208}
+ - component: {fileID: 406922207}
+ - component: {fileID: 406922206}
+ m_Layer: 0
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!81 &406922206
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 406922205}
+ m_Enabled: 1
+--- !u!20 &406922207
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 406922205}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 1
+ m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!4 &406922208
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 406922205}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 1, z: -10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &540606465
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 540606468}
+ - component: {fileID: 540606467}
+ - component: {fileID: 540606466}
+ m_Layer: 0
+ m_Name: EventSystem
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &540606466
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 540606465}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalAxis: Horizontal
+ m_VerticalAxis: Vertical
+ m_SubmitButton: Submit
+ m_CancelButton: Cancel
+ m_InputActionsPerSecond: 10
+ m_RepeatDelay: 0.5
+ m_ForceModuleActive: 0
+--- !u!114 &540606467
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 540606465}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_FirstSelected: {fileID: 0}
+ m_sendNavigationEvents: 1
+ m_DragThreshold: 10
+--- !u!4 &540606468
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 540606465}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &745406201
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 745406206}
+ - component: {fileID: 745406205}
+ - component: {fileID: 745406204}
+ - component: {fileID: 745406203}
+ - component: {fileID: 745406202}
+ m_Layer: 5
+ m_Name: Canvas
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &745406202
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 7b994e1476323bf4fbe1ae28bea164f2, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_openButton: {fileID: 860463875}
+ m_dst: {fileID: 948407063}
+--- !u!114 &745406203
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &745406204
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 0
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+--- !u!223 &745406205
+Canvas:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 0}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 0
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 0
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+ m_TargetDisplay: 0
+--- !u!224 &745406206
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0, y: 0, z: 0}
+ m_Children:
+ - {fileID: 860463874}
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0, y: 0}
+--- !u!1 &860463873
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 860463874}
+ - component: {fileID: 860463877}
+ - component: {fileID: 860463876}
+ - component: {fileID: 860463875}
+ m_Layer: 5
+ m_Name: Button
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &860463874
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 2080820046}
+ m_Father: {fileID: 745406206}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 160, y: 30}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &860463875
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 860463876}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
+ Culture=neutral, PublicKeyToken=null
+--- !u!114 &860463876
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
+ Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+ m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+--- !u!222 &860463877
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_CullTransparentMesh: 0
+--- !u!1 &948407059
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 948407062}
+ - component: {fileID: 948407061}
+ - component: {fileID: 948407060}
+ - component: {fileID: 948407063}
+ m_Layer: 0
+ m_Name: Target
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &948407060
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 948407059}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: dfdcf658d2da05649974b59b849de74c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_material: {fileID: 2100000, guid: 94b4b45712e88334c9e7c5ecc53c50e6, type: 2}
+--- !u!95 &948407061
+Animator:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 948407059}
+ m_Enabled: 1
+ m_Avatar: {fileID: 0}
+ m_Controller: {fileID: 0}
+ m_CullingMode: 0
+ m_UpdateMode: 0
+ m_ApplyRootMotion: 0
+ m_LinearVelocityBlending: 0
+ m_WarningMessage:
+ m_HasTransformHierarchy: 1
+ m_AllowConstantClipSamplingOptimization: 1
+ m_KeepAnimatorControllerStateOnDisable: 0
+--- !u!4 &948407062
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 948407059}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -1, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &948407063
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 948407059}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: e5548e4785b76854cbbf3f6d9a8e9c1d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ SourceType: 0
+ Avatar: {fileID: 0}
+ Source: {fileID: 0}
+ PoseClip: {fileID: 0}
+--- !u!1 &1536726113
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1536726115}
+ - component: {fileID: 1536726114}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!108 &1536726114
+Light:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1536726113}
+ m_Enabled: 1
+ serializedVersion: 8
+ m_Type: 1
+ m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
+ m_Intensity: 1
+ m_Range: 10
+ m_SpotAngle: 30
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 2
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_Lightmapping: 4
+ m_LightShadowCasterMode: 0
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &1536726115
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1536726113}
+ m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
+ m_LocalPosition: {x: 0, y: 3, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!1 &2080820045
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2080820046}
+ - component: {fileID: 2080820048}
+ - component: {fileID: 2080820047}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &2080820046
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2080820045}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 860463874}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &2080820047
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2080820045}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
+ Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+ m_FontData:
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_FontSize: 14
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Open
+--- !u!222 &2080820048
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2080820045}
+ m_CullTransparentMesh: 0
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity.meta
new file mode 100644
index 00000000..04c014c8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/PoseTransfer.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ae847f673eb3e6f4a95f61b4658b806a
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs
new file mode 100644
index 00000000..afc3727c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs
@@ -0,0 +1,83 @@
+using UnityEngine;
+using UnityEngine.Events;
+using UnityEngine.UI;
+using UniHumanoid;
+using System.IO;
+using System;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniHumanoid
+{
+ public class RuntimeBvhLoader : MonoBehaviour
+ {
+ [SerializeField]
+ Button m_openButton = default;
+
+ [SerializeField]
+ HumanPoseTransfer m_dst = default;
+
+ UnityAction m_onClick;
+
+ private void Awake()
+ {
+ m_onClick = new UnityEngine.Events.UnityAction(OnClick);
+ }
+
+ private void OnEnable()
+ {
+ m_openButton.onClick.AddListener(m_onClick);
+ }
+
+ private void OnDisable()
+ {
+ m_openButton.onClick.RemoveListener(m_onClick);
+ }
+
+ static string m_lastDir;
+
+ public void OnClick()
+ {
+#if UNITY_EDITOR
+ var path = EditorUtility.OpenFilePanel("open bvh", m_lastDir, "bvh");
+ if (String.IsNullOrEmpty(path))
+ {
+ return;
+ }
+ m_lastDir = Path.GetDirectoryName(path);
+#else
+ string path=null;
+#endif
+
+#pragma warning disable 4014
+ Open(path);
+#pragma warning restore 4014
+ }
+
+ BvhImporterContext m_context;
+
+ void Open(string path)
+ {
+ Debug.LogFormat("Open: {0}", path);
+ if (m_context != null)
+ {
+ m_context.Destroy(true);
+ m_context = null;
+ }
+
+ m_context = new BvhImporterContext();
+ m_context.Parse(path);
+ m_context.Load();
+
+ var src = m_context.Root.AddComponent<HumanPoseTransfer>();
+
+ if (m_dst != null)
+ {
+ m_dst.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;
+ m_dst.Source = src;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs.meta
new file mode 100644
index 00000000..0fae39bc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7b994e1476323bf4fbe1ae28bea164f2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity
new file mode 100644
index 00000000..c1e610d8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity
@@ -0,0 +1,615 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 11
+ m_GIWorkflowMode: 0
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_TemporalCoherenceThreshold: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_LightmapEditorSettings:
+ serializedVersion: 10
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 500
+ m_PVRBounces: 2
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringMode: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
+ m_LightingDataAsset: {fileID: 0}
+ m_UseShadowmask: 1
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &406922205
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 406922208}
+ - component: {fileID: 406922207}
+ - component: {fileID: 406922206}
+ m_Layer: 0
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!81 &406922206
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 406922205}
+ m_Enabled: 1
+--- !u!20 &406922207
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 406922205}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 1
+ m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!4 &406922208
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 406922205}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 1, z: -10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &540606465
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 540606468}
+ - component: {fileID: 540606467}
+ - component: {fileID: 540606466}
+ m_Layer: 0
+ m_Name: EventSystem
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &540606466
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 540606465}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalAxis: Horizontal
+ m_VerticalAxis: Vertical
+ m_SubmitButton: Submit
+ m_CancelButton: Cancel
+ m_InputActionsPerSecond: 10
+ m_RepeatDelay: 0.5
+ m_ForceModuleActive: 0
+--- !u!114 &540606467
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 540606465}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_FirstSelected: {fileID: 0}
+ m_sendNavigationEvents: 1
+ m_DragThreshold: 10
+--- !u!4 &540606468
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 540606465}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &745406201
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 745406206}
+ - component: {fileID: 745406205}
+ - component: {fileID: 745406204}
+ - component: {fileID: 745406203}
+ - component: {fileID: 745406202}
+ m_Layer: 5
+ m_Name: Canvas
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &745406202
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 7b994e1476323bf4fbe1ae28bea164f2, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_openButton: {fileID: 860463875}
+ m_dst: {fileID: 0}
+--- !u!114 &745406203
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &745406204
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 0
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+--- !u!223 &745406205
+Canvas:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 0}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 0
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 0
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+ m_TargetDisplay: 0
+--- !u!224 &745406206
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 745406201}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0, y: 0, z: 0}
+ m_Children:
+ - {fileID: 860463874}
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0, y: 0}
+--- !u!1 &860463873
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 860463874}
+ - component: {fileID: 860463877}
+ - component: {fileID: 860463876}
+ - component: {fileID: 860463875}
+ m_Layer: 5
+ m_Name: Button
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &860463874
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 2080820046}
+ m_Father: {fileID: 745406206}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 160, y: 30}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &860463875
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 860463876}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
+ Culture=neutral, PublicKeyToken=null
+--- !u!114 &860463876
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
+ Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+ m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+--- !u!222 &860463877
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860463873}
+ m_CullTransparentMesh: 0
+--- !u!1 &1536726113
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1536726115}
+ - component: {fileID: 1536726114}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!108 &1536726114
+Light:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1536726113}
+ m_Enabled: 1
+ serializedVersion: 8
+ m_Type: 1
+ m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
+ m_Intensity: 1
+ m_Range: 10
+ m_SpotAngle: 30
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 2
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_Lightmapping: 4
+ m_LightShadowCasterMode: 0
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &1536726115
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1536726113}
+ m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
+ m_LocalPosition: {x: 0, y: 3, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!1 &2080820045
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2080820046}
+ - component: {fileID: 2080820048}
+ - component: {fileID: 2080820047}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &2080820046
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2080820045}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 860463874}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &2080820047
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2080820045}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
+ Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+ m_FontData:
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_FontSize: 14
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Open
+--- !u!222 &2080820048
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2080820045}
+ m_CullTransparentMesh: 0
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity.meta
new file mode 100644
index 00000000..2a3f1964
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/RuntimeBvhLoader.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 99665560be9c32e4d9f7813b076c92ee
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat
new file mode 100644
index 00000000..1136c07c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat
@@ -0,0 +1,76 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: target
+ m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _BumpScale: 1
+ - _Cutoff: 0.5
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _Metallic: 0
+ - _Mode: 0
+ - _OcclusionStrength: 1
+ - _Parallax: 0.02
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _UVSec: 0
+ - _ZWrite: 1
+ m_Colors:
+ - _Color: {r: 0.60773194, g: 0.8584906, b: 0.14983091, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat.meta
new file mode 100644
index 00000000..133fed93
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scenes/target.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 94b4b45712e88334c9e7c5ecc53c50e6
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts.meta
new file mode 100644
index 00000000..a7876e5e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 64819743741f38e43b64a7d6add8cea9
+folderAsset: yes
+timeCreated: 1517166088
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs
new file mode 100644
index 00000000..5d06e5f6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs
@@ -0,0 +1,134 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public static class AnimationClipUtility
+ {
+ static Dictionary<string, string> TraitPropMap = new Dictionary<string, string>
+{
+{"Left Thumb 1 Stretched", "LeftHand.Thumb.1 Stretched"},
+{"Left Thumb Spread", "LeftHand.Thumb Spread"},
+{"Left Thumb 2 Stretched", "LeftHand.Thumb.2 Stretched"},
+{"Left Thumb 3 Stretched", "LeftHand.Thumb.3 Stretched"},
+{"Left Index 1 Stretched", "LeftHand.Index.1 Stretched"},
+{"Left Index Spread", "LeftHand.Index Spread"},
+{"Left Index 2 Stretched", "LeftHand.Index.2 Stretched"},
+{"Left Index 3 Stretched", "LeftHand.Index.3 Stretched"},
+{"Left Middle 1 Stretched", "LeftHand.Middle.1 Stretched"},
+{"Left Middle Spread", "LeftHand.Middle Spread"},
+{"Left Middle 2 Stretched", "LeftHand.Middle.2 Stretched"},
+{"Left Middle 3 Stretched", "LeftHand.Middle.3 Stretched"},
+{"Left Ring 1 Stretched", "LeftHand.Ring.1 Stretched"},
+{"Left Ring Spread", "LeftHand.Ring Spread"},
+{"Left Ring 2 Stretched", "LeftHand.Ring.2 Stretched"},
+{"Left Ring 3 Stretched", "LeftHand.Ring.3 Stretched"},
+{"Left Little 1 Stretched", "LeftHand.Little.1 Stretched"},
+{"Left Little Spread", "LeftHand.Little Spread"},
+{"Left Little 2 Stretched", "LeftHand.Little.2 Stretched"},
+{"Left Little 3 Stretched", "LeftHand.Little.3 Stretched"},
+{"Right Thumb 1 Stretched", "RightHand.Thumb.1 Stretched"},
+{"Right Thumb Spread", "RightHand.Thumb Spread"},
+{"Right Thumb 2 Stretched", "RightHand.Thumb.2 Stretched"},
+{"Right Thumb 3 Stretched", "RightHand.Thumb.3 Stretched"},
+{"Right Index 1 Stretched", "RightHand.Index.1 Stretched"},
+{"Right Index Spread", "RightHand.Index Spread"},
+{"Right Index 2 Stretched", "RightHand.Index.2 Stretched"},
+{"Right Index 3 Stretched", "RightHand.Index.3 Stretched"},
+{"Right Middle 1 Stretched", "RightHand.Middle.1 Stretched"},
+{"Right Middle Spread", "RightHand.Middle Spread"},
+{"Right Middle 2 Stretched", "RightHand.Middle.2 Stretched"},
+{"Right Middle 3 Stretched", "RightHand.Middle.3 Stretched"},
+{"Right Ring 1 Stretched", "RightHand.Ring.1 Stretched"},
+{"Right Ring Spread", "RightHand.Ring Spread"},
+{"Right Ring 2 Stretched", "RightHand.Ring.2 Stretched"},
+{"Right Ring 3 Stretched", "RightHand.Ring.3 Stretched"},
+{"Right Little 1 Stretched", "RightHand.Little.1 Stretched"},
+{"Right Little Spread", "RightHand.Little Spread"},
+{"Right Little 2 Stretched", "RightHand.Little.2 Stretched"},
+{"Right Little 3 Stretched", "RightHand.Little.3 Stretched"},
+};
+
+ public static AnimationClip CreateAnimationClipFromHumanPose(HumanPose pose)
+ {
+ var clip = new AnimationClip();
+
+ // pos
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyPosition.x),
+ });
+ var muscle = "RootT.x";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyPosition.y),
+ });
+ var muscle = "RootT.y";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyPosition.z),
+ });
+ var muscle = "RootT.z";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+
+ // rot
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyRotation.x),
+ });
+ var muscle = "RootQ.x";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyRotation.y),
+ });
+ var muscle = "RootQ.y";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyRotation.z),
+ });
+ var muscle = "RootQ.z";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.bodyRotation.w),
+ });
+ var muscle = "RootQ.w";
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+
+ // muscles
+ for (int i = 0; i < HumanTrait.MuscleCount; ++i)
+ {
+ var curve = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(0, pose.muscles[i]),
+ });
+ var muscle = HumanTrait.MuscleName[i];
+ if (TraitPropMap.ContainsKey(muscle))
+ {
+ muscle = TraitPropMap[muscle];
+ }
+ clip.SetCurve(null, typeof(Animator), muscle, curve);
+ }
+ return clip;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs.meta
new file mode 100644
index 00000000..54fb7ef2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AnimationClipUtility.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: e13984a5449ddb843b03e21c3409df67
+timeCreated: 1516590895
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs
new file mode 100644
index 00000000..05a3abd6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs
@@ -0,0 +1,269 @@
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+using UnityEngine;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+
+namespace UniHumanoid
+{
+ [Serializable]
+ public struct BoneLimit
+ {
+ public HumanBodyBones humanBone;
+ public string boneName;
+ public bool useDefaultValues;
+ public Vector3 min;
+ public Vector3 max;
+ public Vector3 center;
+ public float axisLength;
+ private static string[] cashedHumanTraitBoneName = null;
+
+ public static BoneLimit From(HumanBone bone)
+ {
+ return new BoneLimit
+ {
+ humanBone = (HumanBodyBones) Enum.Parse(typeof(HumanBodyBones), bone.humanName.Replace(" ", ""), true),
+ boneName = bone.boneName,
+ useDefaultValues = bone.limit.useDefaultValues,
+ min = bone.limit.min,
+ max = bone.limit.max,
+ center = bone.limit.center,
+ axisLength = bone.limit.axisLength,
+ };
+ }
+
+ public static String ToHumanBoneName(HumanBodyBones b)
+ {
+ // 呼び出し毎にGCが発生するのでキャッシュする
+ if (cashedHumanTraitBoneName == null)
+ {
+ cashedHumanTraitBoneName = HumanTrait.BoneName;
+ }
+
+ foreach (var x in cashedHumanTraitBoneName)
+ {
+ if (x.Replace(" ", "") == b.ToString())
+ {
+ return x;
+ }
+ }
+
+ throw new KeyNotFoundException();
+ }
+
+ public HumanBone ToHumanBone()
+ {
+ return new HumanBone
+ {
+ boneName = boneName,
+ humanName = ToHumanBoneName(humanBone),
+ limit = new HumanLimit
+ {
+ useDefaultValues = useDefaultValues,
+ axisLength = axisLength,
+ center = center,
+ max = max,
+ min = min
+ },
+ };
+ }
+ }
+
+ [Serializable]
+ public class AvatarDescription : ScriptableObject
+ {
+ public float armStretch = 0.05f;
+ public float legStretch = 0.05f;
+ public float upperArmTwist = 0.5f;
+ public float lowerArmTwist = 0.5f;
+ public float upperLegTwist = 0.5f;
+ public float lowerLegTwist = 0.5f;
+ public float feetSpacing = 0;
+ public bool hasTranslationDoF;
+ public BoneLimit[] human;
+
+ public HumanDescription ToHumanDescription(Transform root)
+ {
+ var transforms = root.GetComponentsInChildren<Transform>();
+ var skeletonBones = new SkeletonBone[transforms.Length];
+ var index = 0;
+ foreach (var t in transforms)
+ {
+ skeletonBones[index] = t.ToSkeletonBone();
+ index++;
+ }
+
+ var humanBones = new HumanBone[human.Length];
+ index = 0;
+ foreach (var bonelimit in human)
+ {
+ humanBones[index] = bonelimit.ToHumanBone();
+ index++;
+ }
+
+
+ return new HumanDescription
+ {
+ skeleton = skeletonBones,
+ human = humanBones,
+ armStretch = armStretch,
+ legStretch = legStretch,
+ upperArmTwist = upperArmTwist,
+ lowerArmTwist = lowerArmTwist,
+ upperLegTwist = upperLegTwist,
+ lowerLegTwist = lowerLegTwist,
+ feetSpacing = feetSpacing,
+ hasTranslationDoF = hasTranslationDoF,
+ };
+ }
+
+ public Avatar CreateAvatar(Transform root)
+ {
+ return AvatarBuilder.BuildHumanAvatar(root.gameObject, ToHumanDescription(root));
+ }
+
+ public Avatar CreateAvatarAndSetup(Transform root)
+ {
+ var avatar = CreateAvatar(root);
+ avatar.name = name;
+
+ var animator = root.GetComponent<Animator>();
+ if (animator != null)
+ {
+ var positionMap = root.Traverse().ToDictionary(x => x, x => x.position);
+ animator.avatar = avatar;
+ foreach (var x in root.Traverse())
+ {
+ x.position = positionMap[x];
+ }
+ }
+
+ var transfer = root.GetComponent<HumanPoseTransfer>();
+ if (transfer != null)
+ {
+ transfer.Avatar = avatar;
+ }
+
+ return avatar;
+ }
+
+#if UNITY_EDITOR
+ public static AvatarDescription CreateFrom(Avatar avatar)
+ {
+ var description = default(HumanDescription);
+ if (!GetHumanDescription(avatar, ref description))
+ {
+ return null;
+ }
+
+ return CreateFrom(description);
+ }
+#endif
+
+ public static AvatarDescription CreateFrom(HumanDescription description)
+ {
+ var avatarDescription = ScriptableObject.CreateInstance<AvatarDescription>();
+ avatarDescription.name = "AvatarDescription";
+ avatarDescription.armStretch = description.armStretch;
+ avatarDescription.legStretch = description.legStretch;
+ avatarDescription.feetSpacing = description.feetSpacing;
+ avatarDescription.hasTranslationDoF = description.hasTranslationDoF;
+ avatarDescription.lowerArmTwist = description.lowerArmTwist;
+ avatarDescription.lowerLegTwist = description.lowerLegTwist;
+ avatarDescription.upperArmTwist = description.upperArmTwist;
+ avatarDescription.upperLegTwist = description.upperLegTwist;
+ avatarDescription.human = description.human.Select(BoneLimit.From).ToArray();
+ return avatarDescription;
+ }
+
+ public static AvatarDescription Create(AvatarDescription src = null)
+ {
+ var avatarDescription = ScriptableObject.CreateInstance<AvatarDescription>();
+ avatarDescription.name = "AvatarDescription";
+ if (src != null)
+ {
+ avatarDescription.armStretch = src.armStretch;
+ avatarDescription.legStretch = src.legStretch;
+ avatarDescription.feetSpacing = src.feetSpacing;
+ avatarDescription.upperArmTwist = src.upperArmTwist;
+ avatarDescription.lowerArmTwist = src.lowerArmTwist;
+ avatarDescription.upperLegTwist = src.upperLegTwist;
+ avatarDescription.lowerLegTwist = src.lowerLegTwist;
+ }
+ else
+ {
+ avatarDescription.armStretch = 0.05f;
+ avatarDescription.legStretch = 0.05f;
+ avatarDescription.feetSpacing = 0.0f;
+ avatarDescription.lowerArmTwist = 0.5f;
+ avatarDescription.upperArmTwist = 0.5f;
+ avatarDescription.upperLegTwist = 0.5f;
+ avatarDescription.lowerLegTwist = 0.5f;
+ }
+
+ return avatarDescription;
+ }
+
+ public static AvatarDescription Create(Transform[] boneTransforms, Skeleton skeleton)
+ {
+ return Create(skeleton.Bones.Select(
+ x => new KeyValuePair<HumanBodyBones, Transform>(x.Key, boneTransforms[x.Value])));
+ }
+
+ public static AvatarDescription Create(IEnumerable<KeyValuePair<HumanBodyBones, Transform>> skeleton)
+ {
+ var description = Create();
+ description.SetHumanBones(skeleton);
+ return description;
+ }
+
+ public void SetHumanBones(IEnumerable<KeyValuePair<HumanBodyBones, Transform>> skeleton)
+ {
+ human = skeleton.Select(x =>
+ {
+ return new BoneLimit
+ {
+ humanBone = x.Key,
+ boneName = x.Value.name,
+ useDefaultValues = true,
+ };
+ }).ToArray();
+ }
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// * https://answers.unity.com/questions/612177/how-can-i-access-human-avatar-bone-and-muscle-valu.html
+ /// </summary>
+ /// <param name="target"></param>
+ /// <param name="des"></param>
+ /// <returns></returns>
+ public static bool GetHumanDescription(UnityEngine.Object target, ref HumanDescription des)
+ {
+ if (target != null)
+ {
+ var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(target));
+ if (importer != null)
+ {
+ Debug.Log("AssetImporter Type: " + importer.GetType());
+ ModelImporter modelImporter = importer as ModelImporter;
+ if (modelImporter != null)
+ {
+ des = modelImporter.humanDescription;
+ Debug.Log("## Cool stuff data by ModelImporter ##");
+ return true;
+ }
+ else
+ {
+ Debug.LogWarning("## Please Select Imported Model in Project View not prefab or other things ##");
+ }
+ }
+ }
+
+ return false;
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs.meta
new file mode 100644
index 00000000..3da5dea9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/AvatarDescription.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 976e99d37c093ce4c9b249c81c2cbdd5
+timeCreated: 1520401720
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs
new file mode 100644
index 00000000..66fb10d8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs
@@ -0,0 +1,28 @@
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class BoneGizmoDrawer : MonoBehaviour
+ {
+ const float size = 0.03f;
+ readonly Vector3 SIZE = new Vector3(size, size, size);
+
+ [SerializeField]
+ public bool Draw = true;
+
+ void OnDrawGizmos()
+ {
+#if UNITY_EDITOR
+ if (Draw && transform.parent != null)
+ {
+ Gizmos.color = Color.yellow;
+ Gizmos.DrawCube(transform.position, SIZE);
+ Gizmos.DrawLine(transform.parent.position, transform.position);
+
+ UnityEditor.Handles.Label(transform.position, name);
+ }
+#endif
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs.meta
new file mode 100644
index 00000000..12ebe910
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneGizmoDrawer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 677492d2843780e40aa2a6c7a6ae8fe6
+timeCreated: 1517332124
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs
new file mode 100644
index 00000000..f9233e66
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs
@@ -0,0 +1,103 @@
+using UnityEngine;
+using System.Linq;
+using System;
+
+namespace UniHumanoid
+{
+ public class BoneMapping : MonoBehaviour
+ {
+ [SerializeField]
+ public GameObject[] Bones = new GameObject[(int)HumanBodyBones.LastBone];
+
+ [SerializeField]
+ public AvatarDescription Description;
+
+ private void Reset()
+ {
+ GetBones();
+ }
+
+ private void GetBones()
+ {
+ Bones = new GameObject[(int)HumanBodyBones.LastBone];
+
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ if (animator.avatar != null)
+ {
+ foreach (HumanBodyBones key in Enum.GetValues(typeof(HumanBodyBones)))
+ {
+ if (key == HumanBodyBones.LastBone)
+ {
+ break;
+ }
+ var transform = animator.GetBoneTransform(key);
+ if (transform != null)
+ {
+ Bones[(int)key] = transform.gameObject;
+ }
+ }
+ }
+ }
+ }
+
+ public void GuessBoneMapping()
+ {
+ var hips = Bones[(int)HumanBodyBones.Hips];
+ if (hips == null)
+ {
+ Debug.LogWarning("require hips");
+ return;
+ }
+
+ var estimator = new BvhSkeletonEstimator();
+ var skeleton = estimator.Detect(hips.transform);
+ var bones = hips.transform.Traverse().ToArray();
+ for (int i = 0; i < (int)HumanBodyBones.LastBone; ++i)
+ {
+ var index = skeleton.GetBoneIndex((HumanBodyBones)i);
+ if (index >= 0)
+ {
+ Bones[i] = bones[index].gameObject;
+ }
+ }
+ }
+
+ public void EnsureTPose()
+ {
+ var map = Bones
+ .Select((x, i) => new { i, x })
+ .Where(x => x.x != null)
+ .ToDictionary(x => (HumanBodyBones)x.i, x => x.x.transform)
+ ;
+ {
+ var left = (map[HumanBodyBones.LeftLowerArm].position - map[HumanBodyBones.LeftUpperArm].position).normalized;
+ map[HumanBodyBones.LeftUpperArm].rotation = Quaternion.FromToRotation(left, Vector3.left) * map[HumanBodyBones.LeftUpperArm].rotation;
+ }
+ {
+ var right = (map[HumanBodyBones.RightLowerArm].position - map[HumanBodyBones.RightUpperArm].position).normalized;
+ map[HumanBodyBones.RightUpperArm].rotation = Quaternion.FromToRotation(right, Vector3.right) * map[HumanBodyBones.RightUpperArm].rotation;
+ }
+ }
+
+ public static void SetBonesToDescription(BoneMapping mapping, AvatarDescription description)
+ {
+ var map = mapping.Bones
+ .Select((x, i) => new { i, x })
+ .Where(x => x.x != null)
+ .ToDictionary(x => (HumanBodyBones)x.i, x => x.x.transform)
+ ;
+ description.SetHumanBones(map);
+ }
+
+ private void Awake()
+ {
+ if (Bones == null
+ || Bones.All(x => x==null))
+ {
+ GetBones();
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs.meta
new file mode 100644
index 00000000..d7f97711
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BoneMapping.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 44f5895a2095a2848ba2c9627a5c1ad9
+timeCreated: 1516520420
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs
new file mode 100644
index 00000000..8278c217
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs
@@ -0,0 +1,80 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class BvhBone : IBone
+ {
+ public string Name
+ {
+ private set;
+ get;
+ }
+
+ public Vector3 SkeletonLocalPosition
+ {
+ private set;
+ get;
+ }
+
+ public BvhBone(string name, Vector3 position)
+ {
+ Name = name;
+ SkeletonLocalPosition = position;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("<BvhBone: {0}>", Name);
+ }
+
+ public IBone Parent
+ {
+ private set;
+ get;
+ }
+
+ List<IBone> _children = new List<IBone>();
+ public IList<IBone> Children
+ {
+ get { return _children; }
+ }
+
+ public void Build(Transform t)
+ {
+ foreach (Transform child in t)
+ {
+ var childBone = new BvhBone(child.name, SkeletonLocalPosition + child.localPosition);
+ childBone.Parent = this;
+ _children.Add(childBone);
+
+ childBone.Build(child);
+ }
+ }
+
+ public void Build(BvhNode node)
+ {
+ foreach (var child in node.Children)
+ {
+ var childBone = new BvhBone(child.Name, SkeletonLocalPosition + child.Offset.ToXReversedVector3());
+ childBone.Parent = this;
+ _children.Add(childBone);
+
+ childBone.Build(child);
+ }
+ }
+
+ public IEnumerable<BvhBone> Traverse()
+ {
+ yield return this;
+ foreach (var child in Children)
+ {
+ foreach (var x in child.Traverse())
+ {
+ yield return (BvhBone)x;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs.meta
new file mode 100644
index 00000000..a3578e4a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/BvhBone.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c1a88b26726f137419428078debd253f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions.meta
new file mode 100644
index 00000000..e559e8cb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a08328e411d14d8419fc89356b6ddbc4
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs
new file mode 100644
index 00000000..8ae5d2df
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs
@@ -0,0 +1,71 @@
+using UnityEngine;
+
+namespace UniHumanoid
+{
+ public static class EnumExtensions
+ {
+ public static string ToStringFromEnum(this HumanBodyBones val, bool compareBoneTrait = false)
+ {
+ switch (val)
+ {
+ case HumanBodyBones.Hips: return "Hips";
+ case HumanBodyBones.LeftUpperLeg: return "LeftUpperLeg";
+ case HumanBodyBones.RightUpperLeg: return "RightUpperLeg";
+ case HumanBodyBones.LeftLowerLeg: return "LeftLowerLeg";
+ case HumanBodyBones.RightLowerLeg: return "RightLowerLeg";
+ case HumanBodyBones.LeftFoot: return "LeftFoot";
+ case HumanBodyBones.RightFoot: return "RightFoot";
+ case HumanBodyBones.Spine: return "Spine";
+ case HumanBodyBones.Chest: return "Chest";
+ case HumanBodyBones.Neck: return "Neck";
+ case HumanBodyBones.Head: return "Head";
+ case HumanBodyBones.LeftShoulder: return "LeftShoulder";
+ case HumanBodyBones.RightShoulder: return "RightShoulder";
+ case HumanBodyBones.LeftUpperArm: return "LeftUpperArm";
+ case HumanBodyBones.RightUpperArm: return "RightUpperArm";
+ case HumanBodyBones.LeftLowerArm: return "LeftLowerArm";
+ case HumanBodyBones.RightLowerArm: return "RightLowerArm";
+ case HumanBodyBones.LeftHand: return "LeftHand";
+ case HumanBodyBones.RightHand: return "RightHand";
+ case HumanBodyBones.LeftToes: return "LeftToes";
+ case HumanBodyBones.RightToes: return "RightToes";
+ case HumanBodyBones.LeftEye: return "LeftEye";
+ case HumanBodyBones.RightEye: return "RightEye";
+ case HumanBodyBones.Jaw: return "Jaw";
+ case HumanBodyBones.LeftThumbProximal: return compareBoneTrait ? "Left Thumb Proximal" : "LeftThumbProximal";
+ case HumanBodyBones.LeftThumbIntermediate: return compareBoneTrait ? "Left Thumb Intermediate" : "LeftThumbIntermediate";
+ case HumanBodyBones.LeftThumbDistal: return compareBoneTrait ? "Left Thumb Distal" : "LeftThumbDistal";
+ case HumanBodyBones.LeftIndexProximal: return compareBoneTrait ? "Left Index Proximal" : "LeftIndexProximal";
+ case HumanBodyBones.LeftIndexIntermediate: return compareBoneTrait ? "Left Index Intermediate" : "LeftIndexIntermediate";
+ case HumanBodyBones.LeftIndexDistal: return compareBoneTrait ? "Left Index Distal" : "LeftIndexDistal";
+ case HumanBodyBones.LeftMiddleProximal: return compareBoneTrait ? "Left Middle Proximal" : "LeftMiddleProximal";
+ case HumanBodyBones.LeftMiddleIntermediate: return compareBoneTrait ? "Left Middle Intermediate" : "LeftMiddleIntermediate";
+ case HumanBodyBones.LeftMiddleDistal: return compareBoneTrait ? "Left Middle Distal" : "LeftMiddleDistal";
+ case HumanBodyBones.LeftRingProximal: return compareBoneTrait ? "Left Ring Proximal" : "LeftRingProximal";
+ case HumanBodyBones.LeftRingIntermediate: return compareBoneTrait ? "Left Ring Intermediate" : "LeftRingIntermediate";
+ case HumanBodyBones.LeftRingDistal: return compareBoneTrait ? "Left Ring Distal" : "LeftRingDistal";
+ case HumanBodyBones.LeftLittleProximal: return compareBoneTrait ? "Left Little Proximal" : "LeftLittleProximal";
+ case HumanBodyBones.LeftLittleIntermediate: return compareBoneTrait ? "Left Little Intermediate" : "LeftLittleIntermediate";
+ case HumanBodyBones.LeftLittleDistal: return compareBoneTrait ? "Left Little Distal" : "LeftLittleDistal";
+ case HumanBodyBones.RightThumbProximal: return compareBoneTrait ? "Right Thumb Proximal" : "RightThumbProximal";
+ case HumanBodyBones.RightThumbIntermediate: return compareBoneTrait ? "Right Thumb Intermediate" : "RightThumbIntermediate";
+ case HumanBodyBones.RightThumbDistal: return compareBoneTrait ? "Right Thumb Distal" : "RightThumbDistal";
+ case HumanBodyBones.RightIndexProximal: return compareBoneTrait ? "Right Index Proximal" : "RightIndexProximal";
+ case HumanBodyBones.RightIndexIntermediate: return compareBoneTrait ? "Right Index Intermediate" : "RightIndexIntermediate";
+ case HumanBodyBones.RightIndexDistal: return compareBoneTrait ? "Right Index Distal" : "RightIndexDistal";
+ case HumanBodyBones.RightMiddleProximal: return compareBoneTrait ? "Right Middle Proximal" : "RightMiddleProximal";
+ case HumanBodyBones.RightMiddleIntermediate: return compareBoneTrait ? "Right Middle Intermediate" : "RightMiddleIntermediate";
+ case HumanBodyBones.RightMiddleDistal: return compareBoneTrait ? "Right Middle Distal" : "RightMiddleDistal";
+ case HumanBodyBones.RightRingProximal: return compareBoneTrait ? "Right Ring Proximal" : "RightRingProximal";
+ case HumanBodyBones.RightRingIntermediate: return compareBoneTrait ? "Right Ring Intermediate" : "RightRingIntermediate";
+ case HumanBodyBones.RightRingDistal: return compareBoneTrait ? "Right Ring Distal" : "RightRingDistal";
+ case HumanBodyBones.RightLittleProximal: return compareBoneTrait ? "Right Little Proximal" : "RightLittleProximal";
+ case HumanBodyBones.RightLittleIntermediate: return compareBoneTrait ? "Right Little Intermediate" : "RightLittleIntermediate";
+ case HumanBodyBones.RightLittleDistal: return compareBoneTrait ? "Right Little Distal" : "RightLittleDistal";
+ case HumanBodyBones.UpperChest: return "UpperChest";
+ case HumanBodyBones.LastBone: return "LastBone";
+ default: throw new System.InvalidOperationException();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs.meta
new file mode 100644
index 00000000..e9fc631d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Extensions/EnumExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 04d0b56405dbe18439be5a95598deb36
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format.meta
new file mode 100644
index 00000000..3ee3d5db
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fc31477377367fb48bc85f0864fe33eb
+folderAsset: yes
+timeCreated: 1517655048
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs
new file mode 100644
index 00000000..6c39c3b8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs
@@ -0,0 +1,444 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+
+namespace UniHumanoid
+{
+ public class BvhException : Exception
+ {
+ public BvhException(string msg) : base(msg) { }
+ }
+
+ public enum Channel
+ {
+ Xposition,
+ Yposition,
+ Zposition,
+ Xrotation,
+ Yrotation,
+ Zrotation,
+ }
+ public static class ChannelExtensions
+ {
+ public static string ToProperty(this Channel ch)
+ {
+ switch (ch)
+ {
+ case Channel.Xposition: return "localPosition.x";
+ case Channel.Yposition: return "localPosition.y";
+ case Channel.Zposition: return "localPosition.z";
+ case Channel.Xrotation: return "localEulerAnglesBaked.x";
+ case Channel.Yrotation: return "localEulerAnglesBaked.y";
+ case Channel.Zrotation: return "localEulerAnglesBaked.z";
+ }
+
+ throw new BvhException("no property for " + ch);
+ }
+
+ public static bool IsLocation(this Channel ch)
+ {
+ switch (ch)
+ {
+ case Channel.Xposition:
+ case Channel.Yposition:
+ case Channel.Zposition: return true;
+ case Channel.Xrotation:
+ case Channel.Yrotation:
+ case Channel.Zrotation: return false;
+ }
+
+ throw new BvhException("no property for " + ch);
+ }
+ }
+
+ public struct Single3
+ {
+ public Single x;
+ public Single y;
+ public Single z;
+
+ public Single3(Single _x, Single _y, Single _z)
+ {
+ x = _x;
+ y = _y;
+ z = _z;
+ }
+ }
+
+ public class BvhNode
+ {
+ public String Name
+ {
+ get;
+ private set;
+ }
+
+ public Single3 Offset
+ {
+ get;
+ private set;
+ }
+
+ public Channel[] Channels
+ {
+ get;
+ private set;
+ }
+
+ public List<BvhNode> Children
+ {
+ get;
+ private set;
+ }
+
+ public BvhNode(string name)
+ {
+ Name = name;
+ Children = new List<BvhNode>();
+ }
+
+ public virtual void Parse(StringReader r)
+ {
+ Offset = ParseOffset(r.ReadLine());
+
+ Channels = ParseChannel(r.ReadLine());
+ }
+
+ static Single3 ParseOffset(string line)
+ {
+ var split = line.Trim().Split();
+ if (split[0] != "OFFSET")
+ {
+ throw new BvhException("OFFSET is not found");
+ }
+
+ var offset = split.Skip(1).Where(x => !string.IsNullOrEmpty(x)).Select(x => float.Parse(x, System.Globalization.CultureInfo.InvariantCulture)).ToArray();
+ return new Single3(offset[0], offset[1], offset[2]);
+ }
+
+ static Channel[] ParseChannel(string line)
+ {
+ var split = line.Trim().Split();
+ if (split[0] != "CHANNELS")
+ {
+ throw new BvhException("CHANNELS is not found");
+ }
+ var count = int.Parse(split[1]);
+ if (count + 2 != split.Length)
+ {
+ throw new BvhException("channel count is not match with split count");
+ }
+ return split.Skip(2).Select(x => (Channel)Enum.Parse(typeof(Channel), x)).ToArray();
+ }
+
+ public IEnumerable<BvhNode> Traverse()
+ {
+ yield return this;
+
+ foreach (var child in Children)
+ {
+ foreach (var descendant in child.Traverse())
+ {
+ yield return descendant;
+ }
+ }
+ }
+ }
+
+ public class EndSite : BvhNode
+ {
+ public EndSite(): base("")
+ {
+ }
+
+ public override void Parse(StringReader r)
+ {
+ r.ReadLine(); // offset
+ }
+ }
+
+ public class ChannelCurve
+ {
+ public float[] Keys
+ {
+ get;
+ private set;
+ }
+
+ public ChannelCurve(int frameCount)
+ {
+ Keys = new float[frameCount];
+ }
+
+ public void SetKey(int frame, float value)
+ {
+ Keys[frame] = value;
+ }
+ }
+
+ public class Bvh
+ {
+ public BvhNode Root
+ {
+ get;
+ private set;
+ }
+
+ public TimeSpan FrameTime
+ {
+ get;
+ private set;
+ }
+
+ public ChannelCurve[] Channels
+ {
+ get;
+ private set;
+ }
+
+ int m_frames;
+ public int FrameCount
+ {
+ get { return m_frames; }
+ }
+
+ public struct PathWithProperty
+ {
+ public string Path;
+ public string Property;
+ public bool IsLocation;
+ }
+
+ public bool TryGetPathWithPropertyFromChannel(ChannelCurve channel, out PathWithProperty pathWithProp)
+ {
+ var index = Channels.ToList().IndexOf(channel);
+ if (index == -1)
+ {
+ pathWithProp = default(PathWithProperty);
+ return false;
+ }
+
+ foreach(var node in Root.Traverse())
+ {
+ for(int i=0; i<node.Channels.Length; ++i, --index)
+ {
+ if (index == 0)
+ {
+ pathWithProp = new PathWithProperty
+ {
+ Path=GetPath(node),
+ Property=node.Channels[i].ToProperty(),
+ IsLocation=node.Channels[i].IsLocation(),
+ };
+ return true;
+ }
+ }
+ }
+
+ throw new BvhException("channel is not found");
+ }
+
+ public string GetPath(BvhNode node)
+ {
+ var list = new List<string>() { node.Name };
+
+ var current = node;
+ while (current!=null)
+ {
+ current = GetParent(current);
+ if (current != null)
+ {
+ list.Insert(0, current.Name);
+ }
+ }
+
+ return String.Join("/", list.ToArray());
+ }
+
+ BvhNode GetParent(BvhNode node)
+ {
+ foreach(var x in Root.Traverse())
+ {
+ if (x.Children.Contains(node))
+ {
+ return x;
+ }
+ }
+
+ return null;
+ }
+
+ public ChannelCurve GetChannel(BvhNode target, Channel channel)
+ {
+ var index = 0;
+ foreach (var node in Root.Traverse())
+ {
+ for (int i = 0; i < node.Channels.Length; ++i, ++index)
+ {
+ if(node==target && node.Channels[i] == channel)
+ {
+ return Channels[index];
+ }
+ }
+ }
+
+ throw new BvhException("channel is not found");
+ }
+
+ public override string ToString()
+ {
+ return string.Format("{0}nodes, {1}channels, {2}frames, {3:0.00}seconds"
+ , Root.Traverse().Count()
+ , Channels.Length
+ , m_frames
+ , m_frames * FrameTime.TotalSeconds);
+ }
+
+ public Bvh(BvhNode root, int frames, float seconds)
+ {
+ Root = root;
+ FrameTime = TimeSpan.FromSeconds(seconds);
+ m_frames = frames;
+ var channelCount = Root.Traverse()
+ .Where(x => x.Channels!=null)
+ .Select(x => x.Channels.Length)
+ .Sum();
+ Channels = Enumerable.Range(0, channelCount)
+ .Select(x => new ChannelCurve(frames))
+ .ToArray()
+ ;
+ }
+
+ public void ParseFrame(int frame, string line)
+ {
+ var split = line.Trim().Split().Where(x => !string.IsNullOrEmpty(x)).ToArray();
+ if (split.Length != Channels.Length)
+ {
+ throw new BvhException("frame key count is not match channel count");
+ }
+ for(int i=0; i<Channels.Length; ++i)
+ {
+ Channels[i].SetKey(frame, float.Parse(split[i], System.Globalization.CultureInfo.InvariantCulture));
+ }
+ }
+
+ public static Bvh Parse(string src)
+ {
+ using (var r = new StringReader(src))
+ {
+ if (r.ReadLine() != "HIERARCHY")
+ {
+ throw new BvhException("not start with HIERARCHY");
+ }
+
+ var root = ParseNode(r);
+ if (root == null)
+ {
+ return null;
+ }
+
+ var frames = 0;
+ var frameTime = 0.0f;
+ if (r.ReadLine() == "MOTION")
+ {
+ var frameSplit = r.ReadLine().Split(':');
+ if (frameSplit[0] != "Frames")
+ {
+ throw new BvhException("Frames is not found");
+ }
+ frames = int.Parse(frameSplit[1]);
+
+ var frameTimeSplit = r.ReadLine().Split(':');
+ if (frameTimeSplit[0] != "Frame Time")
+ {
+ throw new BvhException("Frame Time is not found");
+ }
+ frameTime = float.Parse(frameTimeSplit[1], System.Globalization.CultureInfo.InvariantCulture);
+ }
+
+ var bvh = new Bvh(root, frames, frameTime);
+
+ for(int i=0; i<frames; ++i)
+ {
+ var line = r.ReadLine();
+ bvh.ParseFrame(i, line);
+ }
+
+ return bvh;
+ }
+ }
+
+ static BvhNode ParseNode(StringReader r, int level = 0)
+ {
+ var firstline = r.ReadLine().Trim();
+ var split = firstline.Split();
+ if (split.Length != 2)
+ {
+ if (split.Length == 1)
+ {
+ if(split[0] == "}")
+ {
+ return null;
+ }
+ }
+ throw new BvhException(String.Format("split to {0}({1})", split.Length, firstline));
+ }
+
+ BvhNode node = null;
+ if (split[0] == "ROOT")
+ {
+ if (level != 0)
+ {
+ throw new BvhException("nested ROOT");
+ }
+ node = new BvhNode(split[1]);
+ }
+ else if (split[0] == "JOINT")
+ {
+ if (level == 0)
+ {
+ throw new BvhException("should ROOT, but JOINT");
+ }
+ node = new BvhNode(split[1]);
+ }
+ else if (split[0] == "End")
+ {
+ if (level == 0)
+ {
+ throw new BvhException("End in level 0");
+ }
+ node = new EndSite();
+ }
+ else
+ {
+ throw new BvhException("unknown type: " + split[0]);
+ }
+
+ if(r.ReadLine().Trim() != "{")
+ {
+ throw new BvhException("'{' is not found");
+ }
+
+ node.Parse(r);
+
+ // child nodes
+ while (true)
+ {
+ var child = ParseNode(r, level + 1);
+ if (child == null)
+ {
+ break;
+ }
+
+ if(!(child is EndSite))
+ {
+ node.Children.Add(child);
+ }
+ }
+
+ return node;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs.meta
new file mode 100644
index 00000000..c0b63aa8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Format/Bvh.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2e7bf08c7b7056e4ea1f50b1e008cb7e
+timeCreated: 1517166478
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs
new file mode 100644
index 00000000..bed31795
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs
@@ -0,0 +1,33 @@
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class HumanPoseClip : ScriptableObject
+ {
+ public const string TPoseResourcePath = "T-Pose.pose";
+
+ public Vector3 bodyPosition;
+
+ public Quaternion bodyRotation;
+
+ public float[] muscles;
+
+ public HumanPose GetPose()
+ {
+ return new HumanPose
+ {
+ bodyPosition = bodyPosition,
+ bodyRotation = bodyRotation,
+ muscles = muscles
+ };
+ }
+
+ public void ApplyPose(ref HumanPose pose)
+ {
+ bodyPosition = pose.bodyPosition;
+ bodyRotation = pose.bodyRotation;
+ muscles = (float[])pose.muscles.Clone();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs.meta
new file mode 100644
index 00000000..3d120849
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseClip.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 4fdf4ef744a103a4ca01657c00d7fec2
+timeCreated: 1517760105
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs
new file mode 100644
index 00000000..8597a27b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs
@@ -0,0 +1,143 @@
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class HumanPoseTransfer : MonoBehaviour
+ {
+ public enum HumanPoseTransferSourceType
+ {
+ None,
+ HumanPoseTransfer,
+ HumanPoseClip,
+ }
+
+ [SerializeField]
+ public HumanPoseTransferSourceType SourceType;
+
+ [SerializeField]
+ public Avatar Avatar;
+
+ #region Standalone
+ public HumanPose CreatePose()
+ {
+ var handler = new HumanPoseHandler(Avatar, transform);
+ var pose = default(HumanPose);
+ handler.GetHumanPose(ref pose);
+ return pose;
+ }
+ public void SetPose(HumanPose pose)
+ {
+ SetPose(Avatar, transform, pose);
+ }
+ public static void SetPose(Avatar avatar, Transform transform, HumanPose pose)
+ {
+ var handler = new HumanPoseHandler(avatar, transform);
+ handler.SetHumanPose(ref pose);
+ }
+ public static void SetTPose(Avatar avatar, Transform transform)
+ {
+ var humanPoseClip = Resources.Load<HumanPoseClip>(HumanPoseClip.TPoseResourcePath);
+ var pose = humanPoseClip.GetPose();
+ HumanPoseTransfer.SetPose(avatar, transform, pose);
+ }
+ #endregion
+
+ private void Reset()
+ {
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ Avatar = animator.avatar;
+ }
+ }
+
+ [SerializeField]
+ public HumanPoseTransfer Source;
+
+ [SerializeField]
+ public HumanPoseClip PoseClip;
+
+ [ContextMenu("Set T-Pose")]
+ void SetTPose()
+ {
+ if (Avatar == null) return;
+ SetTPose(Avatar, transform);
+ }
+
+ HumanPoseHandler m_handler;
+ public void OnEnable()
+ {
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ Avatar = animator.avatar;
+ }
+
+ Setup();
+ }
+
+ public void Setup()
+ {
+ if (Avatar == null)
+ {
+ return;
+ }
+ m_handler = new HumanPoseHandler(Avatar, transform);
+ }
+
+ HumanPose m_pose;
+
+ int m_lastFrameCount = -1;
+
+ public bool GetPose(int frameCount, ref HumanPose pose)
+ {
+ if (PoseClip != null)
+ {
+ pose = PoseClip.GetPose();
+ return true;
+ }
+
+ if (m_handler == null)
+ {
+ pose = m_pose;
+ return false;
+ }
+
+ if (frameCount != m_lastFrameCount)
+ {
+ m_handler.GetHumanPose(ref m_pose);
+ m_lastFrameCount = frameCount;
+ }
+ pose = m_pose;
+ return true;
+ }
+
+ private void Update()
+ {
+ switch (SourceType)
+ {
+ case HumanPoseTransferSourceType.None:
+ break;
+
+ case HumanPoseTransferSourceType.HumanPoseTransfer:
+ if (Source != null && m_handler != null)
+ {
+ if (Source.GetPose(Time.frameCount, ref m_pose))
+ {
+ m_handler.SetHumanPose(ref m_pose);
+ }
+ }
+ break;
+
+ case HumanPoseTransferSourceType.HumanPoseClip:
+ if (PoseClip != null)
+ {
+ var pose = PoseClip.GetPose();
+ m_handler.SetHumanPose(ref pose);
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs.meta
new file mode 100644
index 00000000..d1dbf424
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/HumanPoseTransfer.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: e5548e4785b76854cbbf3f6d9a8e9c1d
+timeCreated: 1517666226
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs
new file mode 100644
index 00000000..4d038a86
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs
@@ -0,0 +1,41 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public interface IBone
+ {
+ string Name { get; }
+ Vector3 SkeletonLocalPosition { get; }
+ IBone Parent { get; }
+ IList<IBone> Children { get; }
+ }
+
+ public static class IBoneExtensions
+ {
+ public static IEnumerable<IBone> Traverse(this IBone self)
+ {
+ yield return self;
+ foreach (var child in self.Children)
+ {
+ foreach (var x in child.Traverse())
+ {
+ yield return x;
+ }
+ }
+ }
+
+ public static Vector3 CenterOfDescendant(this IBone self)
+ {
+ var sum = Vector3.zero;
+ int i = 0;
+ foreach (var x in self.Traverse())
+ {
+ sum += x.SkeletonLocalPosition;
+ ++i;
+ }
+ return sum / i;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs.meta
new file mode 100644
index 00000000..4a8df933
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IBone.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c9c2e3ee9fe29a84cb902e54a90c5dec
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO.meta
new file mode 100644
index 00000000..9a8d776b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e07bcccfa1de56943ab8e18f8791740d
+folderAsset: yes
+timeCreated: 1517655053
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs
new file mode 100644
index 00000000..ea644f5c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public static class BvhAnimation
+ {
+ class CurveSet
+ {
+ BvhNode Node;
+ Func<float, float, float, Quaternion> EulerToRotation;
+ public CurveSet(BvhNode node)
+ {
+ Node = node;
+ }
+
+ public ChannelCurve PositionX;
+ public ChannelCurve PositionY;
+ public ChannelCurve PositionZ;
+ public Vector3 GetPosition(int i)
+ {
+ return new Vector3(
+ PositionX.Keys[i],
+ PositionY.Keys[i],
+ PositionZ.Keys[i]);
+ }
+
+ public ChannelCurve RotationX;
+ public ChannelCurve RotationY;
+ public ChannelCurve RotationZ;
+ public Quaternion GetRotation(int i)
+ {
+ if (EulerToRotation == null)
+ {
+ EulerToRotation = Node.GetEulerToRotation();
+ }
+ return EulerToRotation(
+ RotationX.Keys[i],
+ RotationY.Keys[i],
+ RotationZ.Keys[i]
+ );
+ }
+
+ static void AddCurve(Bvh bvh, AnimationClip clip, ChannelCurve ch, float scaling)
+ {
+ if (ch == null) return;
+ var pathWithProp = default(Bvh.PathWithProperty);
+ bvh.TryGetPathWithPropertyFromChannel(ch, out pathWithProp);
+ var curve = new AnimationCurve();
+ for (int i = 0; i < bvh.FrameCount; ++i)
+ {
+ var time = (float)(i * bvh.FrameTime.TotalSeconds);
+ var value = ch.Keys[i] * scaling;
+ curve.AddKey(time, value);
+ }
+ clip.SetCurve(pathWithProp.Path, typeof(Transform), pathWithProp.Property, curve);
+ }
+
+ public void AddCurves(Bvh bvh, AnimationClip clip, float scaling)
+ {
+ AddCurve(bvh, clip, PositionX, -scaling);
+ AddCurve(bvh, clip, PositionY, scaling);
+ AddCurve(bvh, clip, PositionZ, scaling);
+
+ var pathWithProp = default(Bvh.PathWithProperty);
+ bvh.TryGetPathWithPropertyFromChannel(RotationX, out pathWithProp);
+
+ // rotation
+ var curveX = new AnimationCurve();
+ var curveY = new AnimationCurve();
+ var curveZ = new AnimationCurve();
+ var curveW = new AnimationCurve();
+ for (int i = 0; i < bvh.FrameCount; ++i)
+ {
+ var time = (float)(i * bvh.FrameTime.TotalSeconds);
+ var q = GetRotation(i).ReverseX();
+ curveX.AddKey(time, q.x);
+ curveY.AddKey(time, q.y);
+ curveZ.AddKey(time, q.z);
+ curveW.AddKey(time, q.w);
+ }
+ clip.SetCurve(pathWithProp.Path, typeof(Transform), "localRotation.x", curveX);
+ clip.SetCurve(pathWithProp.Path, typeof(Transform), "localRotation.y", curveY);
+ clip.SetCurve(pathWithProp.Path, typeof(Transform), "localRotation.z", curveZ);
+ clip.SetCurve(pathWithProp.Path, typeof(Transform), "localRotation.w", curveW);
+ }
+ }
+
+ public static AnimationClip CreateAnimationClip(Bvh bvh, float scaling)
+ {
+ var clip = new AnimationClip();
+ clip.legacy = true;
+
+ var curveMap = new Dictionary<BvhNode, CurveSet>();
+
+ int j = 0;
+ foreach (var node in bvh.Root.Traverse())
+ {
+ var set = new CurveSet(node);
+ curveMap[node] = set;
+
+ for (int i = 0; i < node.Channels.Length; ++i, ++j)
+ {
+ var curve = bvh.Channels[j];
+ switch (node.Channels[i])
+ {
+ case Channel.Xposition: set.PositionX = curve; break;
+ case Channel.Yposition: set.PositionY = curve; break;
+ case Channel.Zposition: set.PositionZ = curve; break;
+ case Channel.Xrotation: set.RotationX = curve; break;
+ case Channel.Yrotation: set.RotationY = curve; break;
+ case Channel.Zrotation: set.RotationZ = curve; break;
+ default: throw new Exception();
+ }
+ }
+ }
+
+ foreach (var set in curveMap)
+ {
+ set.Value.AddCurves(bvh, clip, scaling);
+ }
+
+ clip.EnsureQuaternionContinuity();
+
+ return clip;
+ }
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs.meta
new file mode 100644
index 00000000..0348a6a9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhAnimationClip.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 45951aadbd5e6b34282cd17ee163f58b
+timeCreated: 1517655805
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs
new file mode 100644
index 00000000..488b10a6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs
@@ -0,0 +1,15 @@
+using System;
+
+
+namespace UniHumanoid
+{
+ public static class BvhImporter
+ {
+ [Obsolete("use BvhImporter.Parse(path), then BvhImporter.Load()")]
+ public static void Import(BvhImporterContext context)
+ {
+ context.Parse(context.Path);
+ context.Load();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs.meta
new file mode 100644
index 00000000..335ced19
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: da8ccd6cbe1692448872063195e5c71b
+timeCreated: 1517655539
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs
new file mode 100644
index 00000000..f7acb3a1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs
@@ -0,0 +1,235 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UnityEngine;
+using System.IO;
+using System.Text;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniHumanoid
+{
+ [Obsolete("use BvhImporterContext")]
+ public class ImporterContext: BvhImporterContext
+ {
+ }
+
+ public class BvhImporterContext
+ {
+ #region Source
+ String m_path;
+ public String Path
+ {
+ get { return m_path; }
+ set
+ {
+ if (m_path == value) return;
+ m_path = value;
+ }
+ }
+ public String Source; // source
+ public Bvh Bvh;
+ #endregion
+
+ #region Imported
+ public GameObject Root;
+ public List<Transform> Nodes = new List<Transform>();
+ public AnimationClip Animation;
+ public AvatarDescription AvatarDescription;
+ public Avatar Avatar;
+ public Mesh Mesh;
+ public Material Material;
+ #endregion
+
+ #region Load
+ [Obsolete("use Load(path)")]
+ public void Parse()
+ {
+ Parse(Path);
+ }
+
+ public void Parse(string path)
+ {
+ Path = path;
+ Source = File.ReadAllText(Path, Encoding.UTF8);
+ Bvh = Bvh.Parse(Source);
+ }
+
+ public void Load()
+ {
+ //
+ // build hierarchy
+ //
+ Root = new GameObject(System.IO.Path.GetFileNameWithoutExtension(Path));
+ var hips = BuildHierarchy(Root.transform, Bvh.Root, 1.0f);
+ var skeleton = Skeleton.Estimate(hips);
+ var description = AvatarDescription.Create(hips.Traverse().ToArray(), skeleton);
+
+ //
+ // scaling. reposition
+ //
+ float scaling = 1.0f;
+ {
+ //var foot = animator.GetBoneTransform(HumanBodyBones.LeftFoot);
+ var foot = hips.Traverse().Skip(skeleton.GetBoneIndex(HumanBodyBones.LeftFoot)).First();
+ var hipHeight = hips.position.y - foot.position.y;
+ // hips height to a meter
+ scaling = 1.0f / hipHeight;
+ foreach (var x in Root.transform.Traverse())
+ {
+ x.localPosition *= scaling;
+ }
+
+ var scaledHeight = hipHeight * scaling;
+ hips.position = new Vector3(0, scaledHeight, 0); // foot to ground
+ }
+
+ //
+ // avatar
+ //
+ Avatar = description.CreateAvatar(Root.transform);
+ Avatar.name = "Avatar";
+ AvatarDescription = description;
+ var animator = Root.AddComponent<Animator>();
+ animator.avatar = Avatar;
+
+ //
+ // create AnimationClip
+ //
+ Animation = BvhAnimation.CreateAnimationClip(Bvh, scaling);
+ Animation.name = Root.name;
+ Animation.legacy = true;
+ Animation.wrapMode = WrapMode.Loop;
+
+ var animation = Root.AddComponent<Animation>();
+ animation.AddClip(Animation, Animation.name);
+ animation.clip = Animation;
+ animation.Play();
+
+ var humanPoseTransfer = Root.AddComponent<HumanPoseTransfer>();
+ humanPoseTransfer.Avatar = Avatar;
+
+ // create SkinnedMesh for bone visualize
+ var renderer = SkeletonMeshUtility.CreateRenderer(animator);
+ Material = new Material(Shader.Find("Standard"));
+ renderer.sharedMaterial = Material;
+ Mesh = renderer.sharedMesh;
+ Mesh.name = "box-man";
+ }
+
+ static Transform BuildHierarchy(Transform parent, BvhNode node, float toMeter)
+ {
+ var go = new GameObject(node.Name);
+ go.transform.localPosition = node.Offset.ToXReversedVector3() * toMeter;
+ go.transform.SetParent(parent, false);
+
+ //var gizmo = go.AddComponent<BoneGizmoDrawer>();
+ //gizmo.Draw = true;
+
+ foreach (var child in node.Children)
+ {
+ BuildHierarchy(go.transform, child, toMeter);
+ }
+
+ return go.transform;
+ }
+ #endregion
+
+#if UNITY_EDITOR
+ protected virtual string GetPrefabPath()
+ {
+ var dir = System.IO.Path.GetDirectoryName(Path);
+ var name = System.IO.Path.GetFileNameWithoutExtension(Path);
+ var prefabPath = string.Format("{0}/{1}.prefab", dir, name);
+ if (!Application.isPlaying && File.Exists(prefabPath))
+ {
+ // already exists
+ if (IsOwn(prefabPath))
+ {
+ //Debug.LogFormat("already exist. own: {0}", prefabPath);
+ }
+ else
+ {
+ // but unknown prefab
+ var unique = AssetDatabase.GenerateUniqueAssetPath(prefabPath);
+ //Debug.LogFormat("already exist: {0} => {1}", prefabPath, unique);
+ prefabPath = unique;
+ }
+ }
+ return prefabPath;
+ }
+
+ #region Assets
+ IEnumerable<UnityEngine.Object> GetSubAssets(string path)
+ {
+ return AssetDatabase.LoadAllAssetsAtPath(path);
+ }
+
+ protected virtual bool IsOwn(string path)
+ {
+ foreach (var x in GetSubAssets(path))
+ {
+ //if (x is Transform) continue;
+ if (x is GameObject) continue;
+ if (x is Component) continue;
+ if (AssetDatabase.IsSubAsset(x))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ IEnumerable<UnityEngine.Object> ObjectsForSubAsset()
+ {
+ if (Animation != null) yield return Animation;
+ if (AvatarDescription != null) yield return AvatarDescription;
+ if (Avatar != null) yield return Avatar;
+ if (Mesh != null) yield return Mesh;
+ if (Material != null) yield return Material;
+ }
+
+ public void SaveAsAsset()
+ {
+ var path = GetPrefabPath();
+ if (File.Exists(path))
+ {
+ // clear SubAssets
+ foreach (var x in GetSubAssets(path).Where(x => !(x is GameObject) && !(x is Component)))
+ {
+ GameObject.DestroyImmediate(x, true);
+ }
+ }
+
+ // Add SubAsset
+ foreach (var o in ObjectsForSubAsset())
+ {
+ AssetDatabase.AddObjectToAsset(o, path);
+ }
+
+ // Create or update Main Asset
+ Debug.LogFormat("create prefab: {0}", path);
+ PrefabUtility.SaveAsPrefabAssetAndConnect(Root, path, InteractionMode.AutomatedAction);
+
+ AssetDatabase.ImportAsset(path);
+ }
+ #endregion
+#endif
+
+ public void Destroy(bool destroySubAssets)
+ {
+ if (Root != null) GameObject.DestroyImmediate(Root);
+ if (destroySubAssets)
+ {
+#if UNITY_EDITOR
+ foreach (var o in ObjectsForSubAsset())
+ {
+ UnityEngine.Object.DestroyImmediate(o, true);
+ }
+#endif
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs.meta
new file mode 100644
index 00000000..79a8c6e7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/BvhImporterContext.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6c6231d0aafc9554ca596f35e8f395c4
+timeCreated: 1521112950
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions.meta
new file mode 100644
index 00000000..69f5a007
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9f2cfbad0949d5840879540d0fce61fe
+folderAsset: yes
+timeCreated: 1517655230
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs
new file mode 100644
index 00000000..2b80293f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Linq;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public static class BvhExtensions
+ {
+ public static Func<float, float, float, Quaternion> GetEulerToRotation(this BvhNode bvh)
+ {
+ var order = bvh.Channels.Where(x => x == Channel.Xrotation || x == Channel.Yrotation || x == Channel.Zrotation).ToArray();
+
+ return (x, y, z) =>
+ {
+ var xRot = Quaternion.Euler(x, 0, 0);
+ var yRot = Quaternion.Euler(0, y, 0);
+ var zRot = Quaternion.Euler(0, 0, z);
+
+ var r = Quaternion.identity;
+ foreach (var ch in order)
+ {
+ switch (ch)
+ {
+ case Channel.Xrotation: r = r * xRot; break;
+ case Channel.Yrotation: r = r * yRot; break;
+ case Channel.Zrotation: r = r * zRot; break;
+ default: throw new BvhException("no rotation");
+ }
+ }
+ return r;
+ };
+ }
+
+ public static Vector3 ToVector3(this Single3 s3)
+ {
+ return new Vector3(s3.x, s3.y, s3.z);
+ }
+
+ public static Vector3 ToXReversedVector3(this Single3 s3)
+ {
+ return new Vector3(-s3.x, s3.y, s3.z);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs.meta
new file mode 100644
index 00000000..a078ba97
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/BvhExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 30d4db9a01d6aee4db9a77d762e608f6
+timeCreated: 1517655238
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs
new file mode 100644
index 00000000..413918d3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs
@@ -0,0 +1,49 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public static class UnityExtensions
+ {
+ public static Quaternion ReverseX(this Quaternion quaternion)
+ {
+ float angle;
+ Vector3 axis;
+ quaternion.ToAngleAxis(out angle, out axis);
+
+ return Quaternion.AngleAxis(-angle, new Vector3(-axis.x, axis.y, axis.z));
+ }
+
+ public static IEnumerable<Transform> GetChildren(this Transform parent)
+ {
+ foreach (Transform child in parent)
+ {
+ yield return child;
+ }
+ }
+
+ public static IEnumerable<Transform> Traverse(this Transform parent)
+ {
+ yield return parent;
+
+ foreach (Transform child in parent)
+ {
+ foreach (Transform descendant in Traverse(child))
+ {
+ yield return descendant;
+ }
+ }
+ }
+
+ public static SkeletonBone ToSkeletonBone(this Transform t)
+ {
+ var sb = new SkeletonBone();
+ sb.name = t.name;
+ sb.position = t.localPosition;
+ sb.rotation = t.localRotation;
+ sb.scale = t.localScale;
+ return sb;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs.meta
new file mode 100644
index 00000000..918c91cd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/IO/Extensions/UnityExtensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 6c4a2b80b74e499428637f36774bbdcf
+timeCreated: 1517666834
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs
new file mode 100644
index 00000000..b03b9dd2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Linq;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniHumanoid
+{
+ public class MuscleDebug : MonoBehaviour
+ {
+ Avatar GetAvatar()
+ {
+ var animator = GetComponent<Animator>();
+ if (animator != null && animator.avatar != null)
+ {
+ return animator.avatar;
+ }
+
+ var transfer = GetComponent<HumanPoseTransfer>();
+ if (transfer != null && transfer.Avatar != null)
+ {
+ return transfer.Avatar;
+ }
+
+ return null;
+ }
+
+ HumanPoseHandler m_handler;
+
+ public HumanPose m_pose;
+
+ [Serializable]
+ public struct Muscle
+ {
+ public int Index;
+ public string Name;
+ public float Value;
+ }
+
+ public Vector3 BodyPosition;
+
+ public Muscle[] Muscles;
+
+ private void OnEnable()
+ {
+ var avatar = GetAvatar();
+ if (avatar == null)
+ {
+ enabled = false;
+ return;
+ }
+
+ m_handler = new HumanPoseHandler(avatar, transform);
+
+ Muscles = HumanTrait.MuscleName.Select((x, i) =>
+ {
+ return new Muscle
+ {
+ Index = i,
+ Name = x,
+ };
+ })
+ .ToArray()
+ ;
+ }
+
+ private void OnDisable()
+ {
+ }
+
+ private void Update()
+ {
+ m_handler.GetHumanPose(ref m_pose);
+
+ BodyPosition = m_pose.bodyPosition;
+
+ for (int i = 0; i < m_pose.muscles.Length; ++i)
+ {
+ Muscles[i].Value = m_pose.muscles[i];
+ }
+ }
+ }
+
+#if UNITY_EDITOR
+ [CustomPropertyDrawer(typeof(MuscleDebug.Muscle))]
+ public class MuscleDrawer : PropertyDrawer
+ {
+ public override void OnGUI(Rect position,
+ SerializedProperty property, GUIContent label)
+ {
+ var nameProp = property.FindPropertyRelative("Name");
+ var valueProp = property.FindPropertyRelative("Value");
+ /*
+ var label = string.Format("{0}: {1}",
+ nameProp.stringValue,
+ valueProp.floatValue
+ );
+ */
+ EditorGUI.LabelField(position, nameProp.stringValue, string.Format("{0:0.00}", valueProp.floatValue));
+ }
+ }
+#endif
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs.meta
new file mode 100644
index 00000000..0740b686
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleDebug.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 14aaa52c3da53004ea85dbb38e9e4698
+timeCreated: 1521114691
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs
new file mode 100644
index 00000000..181fa3ee
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs
@@ -0,0 +1,11 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public class MuscleInspector : MonoBehaviour
+ {
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs.meta
new file mode 100644
index 00000000..e952b54f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/MuscleInspector.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d2cc8a27b7978e54d9226bc91e53a502
+timeCreated: 1541840537
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs
new file mode 100644
index 00000000..7680d464
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs
@@ -0,0 +1,92 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ /// <summary>
+ /// Mapping HumanBodyBones to BoneIndex
+ /// </summary>
+ public struct Skeleton
+ {
+ Dictionary<HumanBodyBones, int> m_indexMap;
+ public Dictionary<HumanBodyBones, int> Bones
+ {
+ get { return m_indexMap; }
+ }
+ public int GetBoneIndex(HumanBodyBones bone)
+ {
+ int index;
+ if (m_indexMap.TryGetValue(bone, out index))
+ {
+ return index;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+#if UNITY_EDITOR
+ /// <summary>
+ /// For UnitTest
+ /// </summary>
+ Dictionary<HumanBodyBones, string> m_nameMap;
+ /// <summary>
+ /// ForTest
+ /// </summary>
+ /// <param name="bone"></param>
+ /// <returns></returns>
+ public string GetBoneName(HumanBodyBones bone)
+ {
+ string name;
+ if (m_nameMap.TryGetValue(bone, out name))
+ {
+ return name;
+ }
+ else
+ {
+ return null;
+ }
+ }
+#endif
+
+ public static Skeleton Estimate(Transform hips)
+ {
+ var estimator = new BvhSkeletonEstimator();
+ return estimator.Detect(hips);
+ }
+
+ /// <summary>
+ /// Register bone's HumanBodyBones
+ /// </summary>
+ /// <param name="bone"></param>
+ /// <param name="bones"></param>
+ /// <param name="b"></param>
+ public void Set(HumanBodyBones bone, IList<IBone> bones, IBone b)
+ {
+ if (b != null)
+ {
+ Set(bone, bones.IndexOf(b), b.Name);
+ }
+ }
+
+ public void Set(HumanBodyBones bone, int index, string name)
+ {
+ if (m_indexMap == null)
+ {
+ m_indexMap = new Dictionary<HumanBodyBones, int>();
+ }
+ m_indexMap[bone] = index;
+
+#if UNITY_EDITOR
+ if (m_nameMap == null)
+ {
+ m_nameMap = new Dictionary<HumanBodyBones, string>();
+ }
+ m_nameMap[bone] = name;
+#endif
+ }
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs.meta
new file mode 100644
index 00000000..292da5e2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/Skeleton.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 883d8b6e07cbda24384ce65d613d128e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs
new file mode 100644
index 00000000..850212ed
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs
@@ -0,0 +1,244 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public interface ISkeletonDetector
+ {
+ Skeleton Detect(IList<IBone> bones);
+ }
+
+
+ public class BvhSkeletonEstimator : ISkeletonDetector
+ {
+ static IBone GetRoot(IList<IBone> bones)
+ {
+ var hips = bones.Where(x => x.Parent == null).ToArray();
+ if (hips.Length != 1)
+ {
+ throw new System.Exception("Require unique root");
+ }
+ return hips[0];
+ }
+
+ static IBone SelectBone(Func<IBone, IBone, IBone> selector, IList<IBone> bones)
+ {
+ if (bones == null || bones.Count == 0) throw new Exception("no bones");
+ var current = bones[0];
+ for (var i = 1; i < bones.Count; ++i)
+ {
+ current = selector(current, bones[i]);
+ }
+ return current;
+ }
+
+ static void GetSpineAndHips(IBone hips, out IBone spine, out IBone leg_L, out IBone leg_R)
+ {
+ if (hips.Children.Count != 3) throw new System.Exception("Hips require 3 children");
+ spine = SelectBone((l, r) => l.CenterOfDescendant().y > r.CenterOfDescendant().y ? l : r, hips.Children);
+ leg_L = SelectBone((l, r) => l.CenterOfDescendant().x < r.CenterOfDescendant().x ? l : r, hips.Children);
+ leg_R = SelectBone((l, r) => l.CenterOfDescendant().x > r.CenterOfDescendant().x ? l : r, hips.Children);
+ }
+
+ static void GetNeckAndArms(IBone chest, out IBone neck, out IBone arm_L, out IBone arm_R)
+ {
+ if (chest.Children.Count != 3) throw new System.Exception("Chest require 3 children");
+ neck = SelectBone((l, r) => l.CenterOfDescendant().y > r.CenterOfDescendant().y ? l : r, chest.Children);
+ arm_L = SelectBone((l, r) => l.CenterOfDescendant().x < r.CenterOfDescendant().x ? l : r, chest.Children);
+ arm_R = SelectBone((l, r) => l.CenterOfDescendant().x > r.CenterOfDescendant().x ? l : r, chest.Children);
+ }
+
+ struct Arm
+ {
+ public IBone Shoulder;
+ public IBone UpperArm;
+ public IBone LowerArm;
+ public IBone Hand;
+ }
+
+ Arm GetArm(IBone shoulder)
+ {
+ var bones = shoulder.Traverse().ToArray();
+ switch (bones.Length)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ throw new NotImplementedException();
+
+ default:
+ return new Arm
+ {
+ Shoulder = bones[0],
+ UpperArm = bones[1],
+ LowerArm = bones[2],
+ Hand = bones[3],
+ };
+ }
+ }
+
+ struct Leg
+ {
+ public IBone UpperLeg;
+ public IBone LowerLeg;
+ public IBone Foot;
+ public IBone Toes;
+ }
+
+ Leg GetLeg(IBone leg)
+ {
+ var bones = leg.Traverse().Where(x => !x.Name.ToLower().Contains("buttock")).ToArray();
+ switch (bones.Length)
+ {
+ case 0:
+ case 1:
+ case 2:
+ throw new NotImplementedException();
+
+ case 3:
+ return new Leg
+ {
+ UpperLeg = bones[0],
+ LowerLeg = bones[1],
+ Foot = bones[2],
+ };
+
+ default:
+ return new Leg
+ {
+ UpperLeg = bones[bones.Length - 4],
+ LowerLeg = bones[bones.Length - 3],
+ Foot = bones[bones.Length - 2],
+ Toes = bones[bones.Length - 1],
+ };
+ }
+ }
+
+ public Skeleton Detect(IList<IBone> bones)
+ {
+ //
+ // search bones
+ //
+ var root = GetRoot(bones);
+ var hips = root.Traverse().First(x => x.Children.Count == 3);
+
+ IBone spine, hip_L, hip_R;
+ GetSpineAndHips(hips, out spine, out hip_L, out hip_R);
+ var legLeft = GetLeg(hip_L);
+ var legRight = GetLeg(hip_R);
+
+ var spineToChest = new List<IBone>();
+ foreach(var x in spine.Traverse())
+ {
+ spineToChest.Add(x);
+ if (x.Children.Count == 3) break;
+ }
+
+ IBone neck, shoulder_L, shoulder_R;
+ GetNeckAndArms(spineToChest.Last(), out neck, out shoulder_L, out shoulder_R);
+ var armLeft = GetArm(shoulder_L);
+ var armRight = GetArm(shoulder_R);
+
+ var neckToHead = neck.Traverse().ToArray();
+
+ //
+ // set result
+ //
+ var skeleton = new Skeleton();
+ skeleton.Set(HumanBodyBones.Hips, bones, hips);
+
+ switch (spineToChest.Count)
+ {
+ case 0:
+ throw new Exception();
+
+ case 1:
+ skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
+ break;
+
+ case 2:
+ skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
+ skeleton.Set(HumanBodyBones.Chest, bones, spineToChest[1]);
+ break;
+
+#if UNITY_5_6_OR_NEWER
+ case 3:
+ skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
+ skeleton.Set(HumanBodyBones.Chest, bones, spineToChest[1]);
+ skeleton.Set(HumanBodyBones.UpperChest, bones, spineToChest[2]);
+ break;
+#endif
+
+ default:
+ skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
+#if UNITY_5_6_OR_NEWER
+ skeleton.Set(HumanBodyBones.Chest, bones, spineToChest[1]);
+ skeleton.Set(HumanBodyBones.UpperChest, bones, spineToChest.Last());
+#else
+ skeleton.Set(HumanBodyBones.Chest, bones, spineToChest.Last());
+#endif
+ break;
+ }
+
+ switch (neckToHead.Length)
+ {
+ case 0:
+ throw new Exception();
+
+ case 1:
+ skeleton.Set(HumanBodyBones.Head, bones, neckToHead[0]);
+ break;
+
+ case 2:
+ skeleton.Set(HumanBodyBones.Neck, bones, neckToHead[0]);
+ skeleton.Set(HumanBodyBones.Head, bones, neckToHead[1]);
+ break;
+
+ default:
+ skeleton.Set(HumanBodyBones.Neck, bones, neckToHead[0]);
+ skeleton.Set(HumanBodyBones.Head, bones, neckToHead.Where(x => x.Parent.Children.Count==1).Last());
+ break;
+ }
+
+ skeleton.Set(HumanBodyBones.LeftUpperLeg, bones, legLeft.UpperLeg);
+ skeleton.Set(HumanBodyBones.LeftLowerLeg, bones, legLeft.LowerLeg);
+ skeleton.Set(HumanBodyBones.LeftFoot, bones, legLeft.Foot);
+ skeleton.Set(HumanBodyBones.LeftToes, bones, legLeft.Toes);
+
+ skeleton.Set(HumanBodyBones.RightUpperLeg, bones, legRight.UpperLeg);
+ skeleton.Set(HumanBodyBones.RightLowerLeg, bones, legRight.LowerLeg);
+ skeleton.Set(HumanBodyBones.RightFoot, bones, legRight.Foot);
+ skeleton.Set(HumanBodyBones.RightToes, bones, legRight.Toes);
+
+ skeleton.Set(HumanBodyBones.LeftShoulder, bones, armLeft.Shoulder);
+ skeleton.Set(HumanBodyBones.LeftUpperArm, bones, armLeft.UpperArm);
+ skeleton.Set(HumanBodyBones.LeftLowerArm, bones, armLeft.LowerArm);
+ skeleton.Set(HumanBodyBones.LeftHand, bones, armLeft.Hand);
+
+ skeleton.Set(HumanBodyBones.RightShoulder, bones, armRight.Shoulder);
+ skeleton.Set(HumanBodyBones.RightUpperArm, bones, armRight.UpperArm);
+ skeleton.Set(HumanBodyBones.RightLowerArm, bones, armRight.LowerArm);
+ skeleton.Set(HumanBodyBones.RightHand, bones, armRight.Hand);
+
+ return skeleton;
+ }
+
+ public Skeleton Detect(Bvh bvh)
+ {
+ var root = new BvhBone(bvh.Root.Name, Vector3.zero);
+ root.Build(bvh.Root);
+ return Detect(root.Traverse().Select(x => (IBone)x).ToList());
+ }
+
+ public Skeleton Detect(Transform t)
+ {
+ var root = new BvhBone(t.name, Vector3.zero);
+ root.Build(t);
+ return Detect(root.Traverse().Select(x => (IBone)x).ToList());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs.meta
new file mode 100644
index 00000000..6969f98f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonEstimator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4f0d2728cd7343f4ab2e7f7c2b961d5c
+timeCreated: 1534751085
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs
new file mode 100644
index 00000000..053a36dd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs
@@ -0,0 +1,232 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+
+namespace UniHumanoid
+{
+ public static class SkeletonMeshUtility
+ {
+ class MeshBuilder
+ {
+ List<Vector3> m_positions = new List<Vector3>();
+ List<int> m_indices = new List<int>();
+ List<BoneWeight> m_boneWeights = new List<BoneWeight>();
+
+ public void AddBone(Vector3 head, Vector3 tail, int boneIndex, float xWidth, float zWidth)
+ {
+ var dir = (tail - head).normalized;
+ Vector3 xaxis;
+ Vector3 zaxis;
+ if (Vector3.Dot(dir, Vector3.forward) >= 1.0f - float.Epsilon)
+ {
+ xaxis = Vector3.right;
+ zaxis = Vector3.down;
+ }
+ else
+ {
+ xaxis = Vector3.Cross(dir, Vector3.forward).normalized;
+ zaxis = Vector3.forward;
+ }
+ AddBox((head+tail)*0.5f,
+ xaxis*xWidth,
+ (tail-head)*0.5f,
+ zaxis*zWidth,
+ boneIndex);
+ }
+
+ void AddBox(Vector3 center, Vector3 xaxis, Vector3 yaxis, Vector3 zaxis, int boneIndex)
+ {
+ AddQuad(
+ center - yaxis - xaxis - zaxis,
+ center - yaxis + xaxis - zaxis,
+ center - yaxis + xaxis + zaxis,
+ center - yaxis - xaxis + zaxis,
+ boneIndex);
+ AddQuad(
+ center + yaxis - xaxis - zaxis,
+ center + yaxis + xaxis - zaxis,
+ center + yaxis + xaxis + zaxis,
+ center + yaxis - xaxis + zaxis,
+ boneIndex, true);
+ AddQuad(
+ center - xaxis - yaxis - zaxis,
+ center - xaxis + yaxis - zaxis,
+ center - xaxis + yaxis + zaxis,
+ center - xaxis - yaxis + zaxis,
+ boneIndex, true);
+ AddQuad(
+ center + xaxis - yaxis - zaxis,
+ center + xaxis + yaxis - zaxis,
+ center + xaxis + yaxis + zaxis,
+ center + xaxis - yaxis + zaxis,
+ boneIndex);
+ AddQuad(
+ center - zaxis - xaxis - yaxis,
+ center - zaxis + xaxis - yaxis,
+ center - zaxis + xaxis + yaxis,
+ center - zaxis - xaxis + yaxis,
+ boneIndex, true);
+ AddQuad(
+ center + zaxis - xaxis - yaxis,
+ center + zaxis + xaxis - yaxis,
+ center + zaxis + xaxis + yaxis,
+ center + zaxis - xaxis + yaxis,
+ boneIndex);
+ }
+
+ void AddQuad(Vector3 v0, Vector3 v1, Vector3 v2, Vector3 v3, int boneIndex, bool reverse=false)
+ {
+ var i = m_positions.Count;
+ m_positions.Add(v0);
+ m_positions.Add(v1);
+ m_positions.Add(v2);
+ m_positions.Add(v3);
+
+ var bw = new BoneWeight
+ {
+ boneIndex0=boneIndex,
+ weight0=1.0f,
+ };
+ m_boneWeights.Add(bw);
+ m_boneWeights.Add(bw);
+ m_boneWeights.Add(bw);
+ m_boneWeights.Add(bw);
+
+ if (reverse)
+ {
+ m_indices.Add(i + 3);
+ m_indices.Add(i + 2);
+ m_indices.Add(i + 1);
+
+ m_indices.Add(i + 1);
+ m_indices.Add(i);
+ m_indices.Add(i + 3);
+ }
+ else
+ {
+ m_indices.Add(i);
+ m_indices.Add(i + 1);
+ m_indices.Add(i + 2);
+
+ m_indices.Add(i + 2);
+ m_indices.Add(i + 3);
+ m_indices.Add(i);
+ }
+ }
+
+ public Mesh CreateMesh()
+ {
+ var mesh = new Mesh();
+ mesh.SetVertices(m_positions);
+ mesh.boneWeights = m_boneWeights.ToArray();
+ mesh.triangles = m_indices.ToArray();
+ mesh.RecalculateNormals();
+ mesh.RecalculateBounds();
+ return mesh;
+ }
+ }
+
+ struct BoneHeadTail
+ {
+ public HumanBodyBones Head;
+ public HumanBodyBones Tail;
+ public Vector3 TailOffset;
+ public float XWidth;
+ public float ZWidth;
+
+ public BoneHeadTail(HumanBodyBones head, HumanBodyBones tail, float xWidth = 0.05f, float zWidth = 0.05f)
+ {
+ Head = head;
+ Tail = tail;
+ TailOffset = Vector3.zero;
+ XWidth = xWidth;
+ ZWidth = zWidth;
+ }
+
+ public BoneHeadTail(HumanBodyBones head, Vector3 tailOffset, float xWidth = 0.05f, float zWidth = 0.05f)
+ {
+ Head = head;
+ Tail = HumanBodyBones.LastBone;
+ TailOffset = tailOffset;
+ XWidth = xWidth;
+ ZWidth = zWidth;
+ }
+ }
+
+ static BoneHeadTail[] Bones = new BoneHeadTail[]
+ {
+ new BoneHeadTail(HumanBodyBones.Hips, HumanBodyBones.Spine, 0.1f, 0.06f),
+ new BoneHeadTail(HumanBodyBones.Spine, HumanBodyBones.Chest),
+ new BoneHeadTail(HumanBodyBones.Chest, HumanBodyBones.Neck, 0.1f, 0.06f),
+ new BoneHeadTail(HumanBodyBones.Neck, HumanBodyBones.Head, 0.03f, 0.03f),
+ new BoneHeadTail(HumanBodyBones.Head, new Vector3(0, 0.1f, 0), 0.1f, 0.1f),
+
+ new BoneHeadTail(HumanBodyBones.LeftShoulder, HumanBodyBones.LeftUpperArm),
+ new BoneHeadTail(HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftLowerArm),
+ new BoneHeadTail(HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftHand),
+ new BoneHeadTail(HumanBodyBones.LeftHand, new Vector3(-0.1f, 0, 0)),
+
+ new BoneHeadTail(HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftLowerLeg),
+ new BoneHeadTail(HumanBodyBones.LeftLowerLeg, HumanBodyBones.LeftFoot),
+ new BoneHeadTail(HumanBodyBones.LeftFoot, HumanBodyBones.LeftToes),
+ new BoneHeadTail(HumanBodyBones.LeftToes, new Vector3(0, 0, 0.1f)),
+
+ new BoneHeadTail(HumanBodyBones.RightShoulder, HumanBodyBones.RightUpperArm),
+ new BoneHeadTail(HumanBodyBones.RightUpperArm, HumanBodyBones.RightLowerArm),
+ new BoneHeadTail(HumanBodyBones.RightLowerArm, HumanBodyBones.RightHand),
+ new BoneHeadTail(HumanBodyBones.RightHand, new Vector3(0.1f, 0, 0)),
+
+ new BoneHeadTail(HumanBodyBones.RightUpperLeg, HumanBodyBones.RightLowerLeg),
+ new BoneHeadTail(HumanBodyBones.RightLowerLeg, HumanBodyBones.RightFoot),
+ new BoneHeadTail(HumanBodyBones.RightFoot, HumanBodyBones.RightToes),
+ new BoneHeadTail(HumanBodyBones.RightToes, new Vector3(0, 0, 0.1f)),
+ };
+
+ public static SkinnedMeshRenderer CreateRenderer(Animator animator)
+ {
+ //var bodyBones = (HumanBodyBones[])Enum.GetValues(typeof(HumanBodyBones));
+ var bones = animator.transform.Traverse().ToList();
+
+ var builder = new MeshBuilder();
+ foreach(var headTail in Bones)
+ {
+ var head = animator.GetBoneTransform(headTail.Head);
+ if (head!=null)
+ {
+ Transform tail = null;
+ if(headTail.Tail!= HumanBodyBones.LastBone)
+ {
+ tail = animator.GetBoneTransform(headTail.Tail);
+ }
+
+ if (tail != null)
+ {
+ builder.AddBone(head.position, tail.position, bones.IndexOf(head), headTail.XWidth, headTail.ZWidth);
+ }
+ else
+ {
+ builder.AddBone(head.position, head.position + headTail.TailOffset, bones.IndexOf(head), headTail.XWidth, headTail.ZWidth);
+ }
+ }
+ else
+ {
+ Debug.LogWarningFormat("{0} not found", headTail.Head);
+ }
+ }
+
+ var mesh = builder.CreateMesh();
+ mesh.name = "box-man";
+ mesh.bindposes = bones.Select(x =>
+ x.worldToLocalMatrix * animator.transform.localToWorldMatrix).ToArray();
+ var renderer = animator.gameObject.AddComponent<SkinnedMeshRenderer>();
+ renderer.bones = bones.ToArray();
+ renderer.rootBone = animator.GetBoneTransform(HumanBodyBones.Hips);
+ renderer.sharedMesh = mesh;
+ //var bounds = new Bounds(Vector3.zero, mesh.bounds.size);
+ //renderer.localBounds = bounds;
+ return renderer;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs.meta
new file mode 100644
index 00000000..a3cf3125
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/Scripts/SkeletonMeshUtility.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 92bf6005e8d6db94b8b55c67caea9ddd
+timeCreated: 1522346056
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef b/Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef
new file mode 100644
index 00000000..444db545
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef
@@ -0,0 +1,3 @@
+{
+ "name": "UniHumanoid"
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef.meta
new file mode 100644
index 00000000..495819e5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniHumanoid/UniHumanoid.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: b7aa47b240b57de44a4b2021c143c9bf
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON.meta b/Assets/ThirdParty/VRM/VRM/UniJSON.meta
new file mode 100644
index 00000000..d922262f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 47d19c13efe508f4aa9da50723805710
+folderAsset: yes
+timeCreated: 1545997158
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor.meta
new file mode 100644
index 00000000..32892f94
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8feecbeea973dde4f944d365dc93e92c
+folderAsset: yes
+timeCreated: 1540820131
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests.meta
new file mode 100644
index 00000000..64bd6510
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: d7288f19b28ff044ba00cefdb6458340
+folderAsset: yes
+timeCreated: 1526055787
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs
new file mode 100644
index 00000000..a27c4a4d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs
@@ -0,0 +1,60 @@
+using UnityEngine;
+using NUnit.Framework;
+using System.Collections;
+using System;
+
+
+namespace UniJSON
+{
+ public class GenericCallUtilityTests
+ {
+ class Sample
+ {
+ public int Value
+ {
+ get;
+ private set;
+ }
+
+ public void Set(int value)
+ {
+ Value = value;
+ }
+
+ public int Get(int _)
+ {
+ return Value;
+ }
+ }
+
+
+
+ [Test]
+ public void GenericCallUtilityTestsSimplePasses()
+ {
+ var s = new Sample();
+
+
+ {
+ var mi = s.GetType().GetMethod("Set");
+ var action = GenericInvokeCallFactory.OpenAction<Sample, int>(mi);
+ action(s, 1);
+ Assert.AreEqual(1, s.Value);
+ }
+
+ {
+ var mi = s.GetType().GetMethod("Get");
+ var func = GenericInvokeCallFactory.OpenFunc<Sample, int, int>(mi);
+ /*var value =*/ func(s, 1);
+ Assert.AreEqual(1, s.Value);
+ }
+
+ {
+ var mi = s.GetType().GetMethod("Set");
+ var action = GenericExpressionCallFactory.Create<Sample, int>(mi);
+ action(s, 2);
+ Assert.AreEqual(2, s.Value);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs.meta
new file mode 100644
index 00000000..f5816048
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/GenericCallUtilityTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 961cb5c87e54b5d4685e7447783259e7
+timeCreated: 1548657517
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs
new file mode 100644
index 00000000..12ae9570
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs
@@ -0,0 +1,44 @@
+using NUnit.Framework;
+using UniJSON;
+using System.Linq;
+using System.Text;
+using System;
+
+namespace UniJSON
+{
+ public class StoreTests
+ {
+ [Test]
+ public void StringBuilderStoreTest()
+ {
+ var sb = new StringBuilder();
+ var stream = new StringBuilderStore(sb);
+
+ stream.Write("abc");
+ Assert.AreEqual("abc", sb.ToString());
+
+ stream.Write("d");
+ Assert.AreEqual("abcd", sb.ToString());
+
+ stream.Clear();
+ stream.Write("e");
+ Assert.AreEqual("e", sb.ToString());
+ }
+
+ [Test]
+ public void ArrayStoreTest()
+ {
+ var store = new BytesStore(1);
+
+ store.WriteValues(1, 2, 3);
+ Assert.True(new Byte[] { 1, 2, 3 }.SequenceEqual(store.Bytes.ToEnumerable()));
+
+ store.Write(4);
+ Assert.True(new Byte[] { 1, 2, 3, 4 }.SequenceEqual(store.Bytes.ToEnumerable()));
+
+ store.Clear();
+ store.Write(5);
+ Assert.True(new Byte[] { 5 }.SequenceEqual(store.Bytes.ToEnumerable()));
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs.meta
new file mode 100644
index 00000000..9b0920c0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/IWriteStreamTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bda1e03d682e63749a6b114fd6cc0add
+timeCreated: 1495517080
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json.meta
new file mode 100644
index 00000000..b1d1c9c5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7467ac74a97f50646b5e954a34682bae
+folderAsset: yes
+timeCreated: 1543250519
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs
new file mode 100644
index 00000000..bdb01864
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs
@@ -0,0 +1,71 @@
+using NUnit.Framework;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public class JsonDiffTests
+ {
+ [Test]
+ public void PathTest()
+ {
+ var json=@"
+{
+ ""a"": [
+ {
+ ""aa"": 1
+ }
+ ]
+}
+";
+ var root = JsonParser.Parse(json);
+
+ {
+ var it = root.Traverse().GetEnumerator();
+ it.MoveNext(); Assert.AreEqual("/", it.Current.Pointer().ToString());
+ it.MoveNext(); Assert.AreEqual("/a", it.Current.Pointer().ToString());
+ it.MoveNext(); Assert.AreEqual("/a/0", it.Current.Pointer().ToString());
+ it.MoveNext(); Assert.AreEqual("/a/0/aa", it.Current.Pointer().ToString());
+ Assert.False(it.MoveNext());
+ }
+
+ {
+ var it = root.Traverse().GetEnumerator();
+
+ var f = new JsonFormatter();
+ f.Serialize("JsonPath");
+
+ root.SetValue(Utf8String.From("/a"), f.GetStoreBytes());
+ it.MoveNext(); Assert.AreEqual("/", it.Current.Pointer().ToString());
+ it.MoveNext(); Assert.AreEqual("/a", it.Current.Pointer().ToString());
+ Assert.False(it.MoveNext());
+ }
+ }
+
+ [Test]
+ public void DiffTest()
+ {
+ var a = @"{
+""a"": 1
+}";
+
+ var b = @"{
+}";
+
+ var diff = JsonParser.Parse(a).Diff(JsonParser.Parse(b)).ToArray();
+ Assert.AreEqual(1, diff.Length);
+ }
+
+#if UNITY_EDITOR
+ [Test]
+ public void Vector3()
+ {
+ var src = new UnityEngine.Vector3(1, 2, 3);
+ var json = UnityEngine.JsonUtility.ToJson(src);
+ Assert.AreEqual("{\"x\":1.0,\"y\":2.0,\"z\":3.0}", json);
+ var dst = UnityEngine.JsonUtility.FromJson<UnityEngine.Vector3>(json);
+ Assert.AreEqual(src, dst);
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs.meta
new file mode 100644
index 00000000..43396090
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonDiffTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bafda51ddeeb2b84b920b119176499b8
+timeCreated: 1532154188
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs
new file mode 100644
index 00000000..d8fcc52b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs
@@ -0,0 +1,58 @@
+using NUnit.Framework;
+using UnityEngine;
+using System.Linq;
+using System.Text;
+
+namespace UniJSON
+{
+ public class JsonFormatterTests
+ {
+ [Test]
+ public void IndentTest()
+ {
+ var formatter = new JsonFormatter(2);
+ formatter.BeginMap();
+ formatter.Key("a"); formatter.Value(1);
+ formatter.EndMap();
+
+ //var json = formatter.ToString();
+ }
+
+ [Test]
+ public void NullTest()
+ {
+ var bytes = Encoding.UTF8.GetBytes("null");
+ var json = new JsonFormatter();
+ json.Null();
+ Assert.True(json.GetStoreBytes().ToEnumerable().SequenceEqual(bytes));
+ }
+
+ [Test]
+ public void BooleanTest()
+ {
+ {
+ var bytes = Encoding.UTF8.GetBytes("true");
+ var json = new JsonFormatter();
+ json.Value(true);
+ Assert.True(json.GetStoreBytes().ToEnumerable().SequenceEqual(bytes));
+ }
+ {
+ var bytes = Encoding.UTF8.GetBytes("false");
+ var json = new JsonFormatter();
+ json.Value(false);
+ Assert.True(json.GetStoreBytes().ToEnumerable().SequenceEqual(bytes));
+ }
+ }
+
+ [Test]
+ public void ReUseFormatter()
+ {
+ IFormatter f = new JsonFormatter();
+ f.Value(1);
+
+ f.Clear();
+ // fail
+ f.Value(2);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs.meta
new file mode 100644
index 00000000..af3a70f6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonFormatterTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3defb263d8925164683447a978248b1d
+timeCreated: 1533569416
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs
new file mode 100644
index 00000000..34da625b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs
@@ -0,0 +1,354 @@
+using NUnit.Framework;
+using System;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public class JsonParserTest
+ {
+ [Test]
+ public void Tests()
+ {
+ {
+ var result = JsonParser.Parse("1");
+ Assert.AreEqual(1, result.GetInt32());
+ }
+
+ {
+ var result = JsonParser.Parse("{ \"a\": { \"b\": 1 }}");
+ Assert.True(result.ContainsKey("a"));
+ }
+ }
+
+ [Test]
+ public void NullTest()
+ {
+ {
+ var node = JsonParser.Parse("null");
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(4, node.Value.Bytes.Count);
+ Assert.True(node.IsNull());
+ }
+ }
+
+ [Test]
+ public void BooleanTest()
+ {
+ {
+ var node = JsonParser.Parse("true");
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(4, node.Value.Bytes.Count);
+ Assert.True(node.IsBoolean());
+ Assert.AreEqual(true, node.GetBoolean());
+ Assert.Catch(typeof(FormatException), () => node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse(" false ");
+ Assert.AreEqual(1, node.Value.Bytes.Offset);
+ Assert.AreEqual(5, node.Value.Bytes.Count);
+ Assert.True(node.IsBoolean());
+ Assert.AreEqual(false, node.GetBoolean());
+ }
+ }
+
+ [Test]
+ public void NumberTest()
+ {
+ {
+ var node = JsonParser.Parse("1");
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(1, node.Value.Bytes.Count);
+ Assert.True(node.IsInteger());
+ Assert.AreEqual(1, (int)node.GetDouble());
+ Assert.Catch(typeof(DeserializationException), () => node.GetBoolean());
+ }
+ {
+ var node = JsonParser.Parse(" 22 ");
+ Assert.AreEqual(1, node.Value.Bytes.Offset);
+ Assert.AreEqual(2, node.Value.Bytes.Count);
+ Assert.True(node.IsInteger());
+ Assert.AreEqual(22, (int)node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse(" 3.3 ");
+ Assert.AreEqual(1, node.Value.Bytes.Offset);
+ Assert.AreEqual(3, node.Value.Bytes.Count);
+ Assert.True(node.IsFloat());
+ Assert.AreEqual(3, (int)node.GetDouble());
+ Assert.AreEqual(3.3f, (float)node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse(" -4.44444444444444444444 ");
+ Assert.True(node.IsFloat());
+ Assert.AreEqual(-4, (int)node.GetDouble());
+ Assert.AreEqual(-4.44444444444444444444, node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse(" -5e-4 ");
+ Assert.True(node.IsFloat());
+ Assert.AreEqual(0, (int)node.GetDouble());
+ Assert.AreEqual(-5e-4, node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse("NaN");
+ Assert.True(node.IsFloat());
+ Assert.AreEqual(Double.NaN, node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse("Infinity");
+ Assert.True(node.IsFloat());
+ Assert.AreEqual(Double.PositiveInfinity, node.GetDouble());
+ }
+ {
+ var node = JsonParser.Parse("-Infinity");
+ Assert.True(node.IsFloat());
+ Assert.AreEqual(Double.NegativeInfinity, node.GetDouble());
+ }
+ }
+
+ [Test]
+ public void StringTest()
+ {
+ {
+ var value = "hoge";
+ var quoted = "\"hoge\"";
+ Assert.AreEqual(quoted, JsonString.Quote(value));
+ var node = JsonParser.Parse(quoted);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(quoted.Length, node.Value.Bytes.Count);
+ Assert.True(node.IsString());
+ Assert.AreEqual("hoge", node.GetString());
+ }
+
+ {
+ var value = "fuga\n hoge";
+ var quoted = "\"fuga\\n hoge\"";
+ Assert.AreEqual(quoted, JsonString.Quote(value));
+ var node = JsonParser.Parse(quoted);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(quoted.Length, node.Value.Bytes.Count);
+ Assert.True(node.IsString());
+ Assert.AreEqual(value, node.GetString());
+ }
+ }
+
+ [Test]
+ public void StringEscapeTest()
+ {
+ {
+ var value = "\"";
+ var escaped = "\\\"";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "\\";
+ var escaped = "\\\\";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "/";
+ var escaped = "\\/";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "\b";
+ var escaped = "\\b";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "\f";
+ var escaped = "\\f";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "\n";
+ var escaped = "\\n";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "\r";
+ var escaped = "\\r";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ {
+ var value = "\t";
+ var escaped = "\\t";
+ Assert.AreEqual(escaped, JsonString.Escape(value));
+ Assert.AreEqual(value, JsonString.Unescape(escaped));
+ }
+ }
+
+ [Test]
+ public void ObjectTest()
+ {
+ {
+ var json = "{}";
+ var node = JsonParser.Parse(json);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+
+ Assert.AreEqual(2, node.Value.Bytes.Count);
+
+ Assert.True(node.IsMap());
+ Assert.AreEqual(0, node.ObjectItems().Count());
+ }
+
+ {
+ var json = "{\"key\":\"value\"}";
+ var node = JsonParser.Parse(json);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(json.Length, node.Value.Bytes.Count);
+ Assert.True(node.IsMap());
+
+ var it = node.ObjectItems().GetEnumerator();
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual("key", it.Current.Key.GetString());
+ Assert.AreEqual("value", it.Current.Value.GetString());
+
+ Assert.IsFalse(it.MoveNext());
+ }
+
+ {
+ var json = "{\"key\":\"value\"}";
+ var node = JsonParser.Parse(json);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+ Assert.AreEqual(json.Length, node.Value.Bytes.Count);
+ Assert.True(node.IsMap());
+
+ var it = node.ObjectItems().GetEnumerator();
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual("key", it.Current.Key.GetString());
+ Assert.AreEqual("value", it.Current.Value.GetString());
+
+ Assert.IsFalse(it.MoveNext());
+ }
+ }
+
+ [Test]
+ public void NestedObjectTest()
+ {
+ {
+ var json = "{\"key\":{ \"nestedKey\": \"nestedValue\" }, \"key2\": { \"nestedKey2\": \"nestedValue2\" } }";
+ var node = JsonParser.Parse(json);
+ Assert.True(node.IsMap());
+
+ {
+ var it = node.ObjectItems().GetEnumerator();
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual("key", it.Current.Key.GetString());
+ Assert.True(it.Current.Value.IsMap());
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual("key2", it.Current.Key.GetString());
+ Assert.True(it.Current.Value.IsMap());
+
+ Assert.IsFalse(it.MoveNext());
+ }
+
+ var nested = node["key2"];
+
+ {
+ var it = nested.ObjectItems().GetEnumerator();
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual("nestedKey2", it.Current.Key.GetString());
+ Assert.AreEqual("nestedValue2", it.Current.Value.GetString());
+
+ Assert.IsFalse(it.MoveNext());
+ }
+
+ Assert.AreEqual("nestedValue2", node["key2"]["nestedKey2"].GetString());
+ }
+ }
+
+ [Test]
+ public void ArrayTest()
+ {
+ {
+ var json = "[]";
+ var node = JsonParser.Parse(json);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+
+ //Assert.Catch(() => { var result = node.Value.Bytes.Count; }, "raise exception");
+ Assert.AreEqual(2, node.Value.Bytes.Count);
+
+ Assert.True(node.IsArray());
+
+ Assert.AreEqual("[\n]", node.ToString(" "));
+ }
+
+ {
+ var json = "[1,2,3]";
+ var node = JsonParser.Parse(json);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+
+ //Assert.Catch(() => { var result = node.Value.Bytes.Count; }, "raise exception");
+
+ Assert.True(node.IsArray());
+ Assert.AreEqual(1, node[0].GetDouble());
+ Assert.AreEqual(2, node[1].GetDouble());
+ Assert.AreEqual(3, node[2].GetDouble());
+
+ Assert.AreEqual("[\n 1,\n 2,\n 3\n]", node.ToString(" "));
+ }
+
+ {
+ var json = "[\"key\",1]";
+ var node = JsonParser.Parse(json);
+ Assert.AreEqual(0, node.Value.Bytes.Offset);
+
+ //Assert.Catch(() => { var result = node.Value.Bytes.Count; }, "raise exception");
+ Assert.AreEqual(json.Length, node.Value.Bytes.Count);
+
+ Assert.True(node.IsArray());
+
+ var it = node.ArrayItems().GetEnumerator();
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual("key", it.Current.GetString());
+
+ Assert.IsTrue(it.MoveNext());
+ Assert.AreEqual(1, it.Current.GetDouble());
+
+ Assert.IsFalse(it.MoveNext());
+
+ Assert.AreEqual("key", node[0].GetString());
+ Assert.AreEqual(1, node[1].GetDouble());
+
+ Assert.AreEqual("[\n \"key\",\n 1\n]", node.ToString(" "));
+ }
+ }
+
+ [Test]
+ public void ParseTest()
+ {
+ var json = "{";
+ Assert.Catch(typeof(ParserException), () => JsonParser.Parse(json));
+ }
+
+ [Test]
+ public void Utf8Test()
+ {
+ JsonParser.Parse("\"5\"");
+ }
+
+ [Test]
+ public void TimeTest()
+ {
+ var f = new JsonFormatter();
+ f.Value(new DateTimeOffset());
+
+ Assert.AreEqual("\"0001-01-01T00:00:00Z\"", new Utf8String(f.GetStoreBytes()).ToString());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs.meta
new file mode 100644
index 00000000..d5a14a07
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonParserTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4af58e17f98c9a141b9fef25dabbd9ce
+timeCreated: 1495517074
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs
new file mode 100644
index 00000000..f96210c7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs
@@ -0,0 +1,202 @@
+#pragma warning disable 0649
+using System;
+using System.Linq;
+using NUnit.Framework;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public class JsonSerializerTests
+ {
+ struct Point
+ {
+ public float X;
+ public float Y;
+
+ public float[] Vector;
+
+ public override string ToString()
+ {
+ return string.Format("{{X={0}, Y={1}, {2}}}", X, Y, Vector);
+ }
+ }
+
+ enum HogeFuga
+ {
+ Hoge,
+ Fuga,
+ }
+
+ struct EnumTest
+ {
+ public HogeFuga EnumDefault;
+
+ [JsonSchema(EnumSerializationType =EnumSerializationType.AsInt)]
+ public HogeFuga EnumAsInt;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsString)]
+ public HogeFuga EnumAsString;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsLowerString)]
+ public HogeFuga EnumAsLowerString;
+ }
+
+ #region Serializer
+ static void SerializeValue<T>(T value, string json)
+ {
+ var b = new BytesStore();
+ var f = new JsonFormatter(b);
+
+ f.Serialize(value);
+ Assert.AreEqual(json, new Utf8String(b.Bytes).ToString());
+ }
+
+ [Test]
+ public void JsonSerializerTest()
+ {
+ SerializeValue(1, "1");
+ SerializeValue(1.1f, "1.1");
+ SerializeValue(1.2, "1.2");
+ SerializeValue(Double.NaN, "NaN");
+ SerializeValue(Double.PositiveInfinity, "Infinity");
+ SerializeValue(Double.NegativeInfinity, "-Infinity");
+ SerializeValue(true, "true");
+ SerializeValue(false, "false");
+ SerializeValue("ascii", "\"ascii\"");
+
+ SerializeValue(new[] { 1 }, "[1]");
+ SerializeValue(new[] { 1.1f }, "[1.1]");
+ SerializeValue(new[] { 1.2 }, "[1.2]");
+ SerializeValue(new[] { true, false }, "[true,false]");
+ SerializeValue(new[] { "ascii" }, "[\"ascii\"]");
+ SerializeValue(new List<int> { 1 }, "[1]");
+ //SerializeValue(new object[] { null, 1, "a" }, "[null,1,\"a\"]");
+
+ SerializeValue(new Dictionary<string, object> { }, "{}");
+ SerializeValue(new Dictionary<string, object> { { "a", 1 } }, "{\"a\":1}");
+ SerializeValue(new Dictionary<string, object> { { "a",
+ new Dictionary<string, object>{
+ } } }, "{\"a\":{}}");
+
+ SerializeValue(new Point { X = 1 }, "{\"X\":1,\"Y\":0}");
+
+ SerializeValue(HogeFuga.Fuga, "1");
+
+ SerializeValue(new EnumTest(), "{\"EnumDefault\":0,\"EnumAsInt\":0,\"EnumAsString\":\"Hoge\",\"EnumAsLowerString\":\"hoge\"}");
+
+ SerializeValue((object)new Point { X = 1 }, "{\"X\":1,\"Y\":0}");
+ }
+
+ [Test]
+ public void KeyValue()
+ {
+ var p = new Point
+ {
+ X = 1,
+ Vector = new float[] { 1, 2, 3 }
+ };
+
+ var f = new JsonFormatter();
+ f.BeginMap();
+ f.KeyValue(() => p.Vector);
+ f.EndMap();
+
+ var json = JsonParser.Parse(new Utf8String(f.GetStoreBytes()));
+
+ Assert.AreEqual(1, json.GetObjectCount());
+ Assert.AreEqual(1, json["Vector"][0].GetInt32());
+ }
+
+ #endregion
+
+ #region Deserialize
+ static void DeserializeValue<T>(T value, string json)
+ {
+ var parsed = JsonParser.Parse(json);
+
+ var t = default(T);
+ parsed.Deserialize(ref t);
+
+ Assert.AreEqual(value, t);
+ }
+
+ [Test]
+ public void JsonDeserializerTest()
+ {
+ DeserializeValue(1, "1");
+ DeserializeValue(1.1f, "1.1");
+ DeserializeValue(1.2, "1.2");
+ DeserializeValue(true, "true");
+ DeserializeValue(false, "false");
+ DeserializeValue("ascii", "\"ascii\"");
+
+ DeserializeValue(new[] { 1 }, "[1]");
+ DeserializeValue(new[] { 1.1f }, "[1.1]");
+ DeserializeValue(new[] { 1.2 }, "[1.2]");
+ DeserializeValue(new[] { true, false }, "[true,false]");
+ DeserializeValue(new[] { "ascii" }, "[\"ascii\"]");
+ DeserializeValue(new List<int> { 1 }, "[1]");
+ //DeserializeValue(new object[] { null, 1, "a" }, "[null,1,\"a\"]");
+
+ DeserializeValue(new Point { X = 1 }, "{\"X\":1,\"Y\":0}");
+
+ DeserializeValue(HogeFuga.Fuga, "1");
+
+ DeserializeValue(new EnumTest(), "{\"EnumDefault\":0,\"EnumAsInt\":0,\"EnumAsString\":\"Hoge\",\"EnumAsLowerString\":\"hoge\"}");
+ }
+
+ class DictionaryValue: IEquatable<DictionaryValue>
+ {
+ public Dictionary<string, object> Dict = new Dictionary<string, object>();
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as DictionaryValue;
+ if (rhs != null)
+ {
+ return Equals(rhs);
+ }
+ else
+ {
+ return base.Equals(obj);
+ }
+ }
+
+ public bool Equals(DictionaryValue other)
+ {
+ if(Dict==null && other.Dict == null)
+ {
+ return true;
+ }
+ else if(Dict==null || other.Dict==null)
+ {
+ return false;
+ }
+ else
+ {
+ return Dict.OrderBy(x => x.Key).SequenceEqual(other.Dict.OrderBy(x => x.Key));
+ }
+ }
+ }
+
+ [Test]
+ public void JsonDictionaryDeserializerTest()
+ {
+ DeserializeValue(new Dictionary<string, object> { }, "{}");
+ DeserializeValue(new Dictionary<string, object> { { "a", 1 } }, "{\"a\":1}");
+ DeserializeValue(new Dictionary<string, object> { { "a",
+ new Dictionary<string, object>{
+ } } }, "{\"a\":{}}");
+
+ // fix dictionary member deserialization
+ DeserializeValue(new DictionaryValue(), "{\"Dict\": {}}");
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs.meta
new file mode 100644
index 00000000..2521c928
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonSerializerTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b08b704c97f3bc54c8469f9f1822432d
+timeCreated: 1543256597
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs
new file mode 100644
index 00000000..f34a1407
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs
@@ -0,0 +1,41 @@
+using NUnit.Framework;
+using System;
+using System.Linq;
+
+namespace UniJSON
+{
+ public class JsonValueTests
+ {
+ // TODO: Add tests for values which have other types
+
+ [Test]
+ public void NaNTest()
+ {
+ {
+ var v = new JsonValue(Utf8String.From("NaN"), ValueNodeType.NaN, -1);
+ Assert.AreEqual("NaN", v.ToString());
+ Assert.AreEqual(Double.NaN, v.GetValue<double>());
+ }
+ }
+
+ [Test]
+ public void InfinityTest()
+ {
+ {
+ var v = new JsonValue(Utf8String.From("Infinity"), ValueNodeType.Infinity, -1);
+ Assert.AreEqual("Infinity", v.ToString());
+ Assert.AreEqual(Double.PositiveInfinity, v.GetValue<double>());
+ }
+ }
+
+ [Test]
+ public void MinusInfinityTest()
+ {
+ {
+ var v = new JsonValue(Utf8String.From("-Infinity"), ValueNodeType.MinusInfinity, -1);
+ Assert.AreEqual("-Infinity", v.ToString());
+ Assert.AreEqual(Double.NegativeInfinity, v.GetValue<double>());
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs.meta
new file mode 100644
index 00000000..3844caf0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/JsonValueTests.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 1b0dfab85f59470d8cba21b351fa766b
+timeCreated: 1545750553 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs
new file mode 100644
index 00000000..1f51b07a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs
@@ -0,0 +1,150 @@
+#pragma warning disable 0649
+using NUnit.Framework;
+
+namespace UniJSON
+{
+ public class SchemaTests
+ {
+ /// <summary>
+ /// http://json-schema.org/examples.html
+ /// </summary>
+ [JsonSchema(Title="Person")]
+ public class Person
+ {
+ [JsonSchema(Required = true)]
+ public string firstName;
+
+ [JsonSchema(Required = true)]
+ public string lastName;
+
+ [JsonSchema(Description = "Age in years", Minimum = 0)]
+ public int age;
+ }
+
+ [Test]
+ public void CreateFromClass()
+ {
+ var s = JsonSchema.FromType<Person>();
+ Assert.AreEqual("Person", s.Title);
+
+ var v = s.Validator as JsonObjectValidator;
+ Assert.AreEqual("Age in years", v.Properties["age"].Description);
+ Assert.AreEqual(new[] { "firstName", "lastName" }, v.Required);
+
+ var f = new JsonFormatter(2);
+ s.ToJson(f);
+ var json = f.ToString();
+
+ var parsed = JsonParser.Parse(json);
+ Assert.AreEqual(0, parsed["properties"]["age"]["minimum"].GetInt32());
+ }
+
+ [JsonSchema(Title="MultipleConstraints")]
+ public class MultipleConstraints
+ {
+ [JsonSchema(Required = true, Minimum = 0, Maximum = 100)]
+ public int ranged;
+ }
+
+ [Test]
+ public void CreateFromClassWithMultipleConstraints()
+ {
+ var s = JsonSchema.FromType<MultipleConstraints>();
+
+ var v = s.Validator as JsonObjectValidator;
+ var rangedV = v.Properties["ranged"].Validator as JsonIntValidator;
+ Assert.AreEqual(0, rangedV.Minimum);
+ Assert.AreEqual(100, rangedV.Maximum);
+ }
+
+ public enum ProjectionType
+ {
+ Perspective,
+ Orthographic
+ }
+
+ class EnumStringTest
+ {
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsLowerString)]
+ public ProjectionType type;
+ }
+
+ class EnumIntTest
+ {
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt)]
+ public ProjectionType type;
+ }
+
+ [Test]
+ public void TestEnumAsString()
+ {
+ var json = @"
+{
+ ""type"": ""object"",
+ ""properties"": {
+
+ ""type"": {
+
+ ""anyOf"": [
+ {
+ ""enum"": [ ""perspective"" ]
+ },
+ {
+ ""enum"": [ ""orthographic"" ]
+ },
+ {
+ ""type"": ""string""
+ }
+ ]
+
+ }
+
+ }
+}
+";
+
+ var fromJson = new JsonSchema();
+ fromJson.Parse(null, JsonParser.Parse(json), "enum test");
+
+ var fromType = JsonSchema.FromType<EnumStringTest>();
+
+ Assert.AreEqual(fromJson, fromType);
+ }
+
+ [Test]
+ public void TestEnumAsInt()
+ {
+ var json = @"
+{
+ ""type"": ""object"",
+ ""properties"": {
+
+ ""type"": {
+
+ ""anyOf"": [
+ {
+ ""enum"": [ 0 ]
+ },
+ {
+ ""enum"": [ 1 ]
+ },
+ {
+ ""type"": ""integer""
+ }
+ ]
+
+ }
+
+ }
+}
+";
+
+ var fromJson = new JsonSchema();
+ fromJson.Parse(null, JsonParser.Parse(json), "enum test");
+
+ var fromType = JsonSchema.FromType<EnumIntTest>();
+
+ Assert.AreEqual(fromJson, fromType);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs.meta
new file mode 100644
index 00000000..c11d56f0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SchemaTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d4dfd16b1b05c8640898b955df61c51b
+timeCreated: 1526055801
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs
new file mode 100644
index 00000000..1d022739
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs
@@ -0,0 +1,200 @@
+using NUnit.Framework;
+
+namespace UniJSON
+{
+ public class SerializeWithSchemaTests
+ {
+ [JsonSchema(Title="CheckConstraintsTest")]
+ public class CheckConstraintsTest
+ {
+ [JsonSchema(Minimum = 0)]
+ public int X;
+
+ [JsonSchema(Minimum = 10, ExplicitIgnorableValue = 0)] // Not required, thus ignored when the value violates the constraints
+ public int Y;
+ }
+
+ [Test]
+ public void TestCheckConstraints()
+ {
+ var obj = new CheckConstraintsTest()
+ {
+ X = 0,
+ Y = 0, // Will be excluded because 0 doesn't satisfy a requirement of "Minimum = 10"
+ };
+
+ var s = JsonSchema.FromType<CheckConstraintsTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{""X"":0}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ [JsonSchema(Title="ObjectNestedTest")]
+ public class ObjectNestedTest
+ {
+ public CheckConstraintsTest C;
+ }
+
+ [Test]
+ public void TestObjectNested()
+ {
+ var obj = new ObjectNestedTest()
+ {
+ C = new CheckConstraintsTest(),
+ };
+
+ var s = JsonSchema.FromType<ObjectNestedTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{""C"":{""X"":0}}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test]
+ public void TestObjectNestedWithNull()
+ {
+ var obj = new ObjectNestedTest();
+
+ var s = JsonSchema.FromType<ObjectNestedTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ public class HasDepsTest
+ {
+ [JsonSchema(Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int X;
+
+ [JsonSchema(Dependencies = new string[] {"X"})]
+ public int Y;
+ }
+
+ [Test]
+ public void TestHasDeps()
+ {
+ var obj = new HasDepsTest();
+
+ var s = JsonSchema.FromType<HasDepsTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{""X"":0,""Y"":0}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test]
+ public void TestHasDepsHasViolation()
+ {
+ var obj = new HasDepsTest()
+ {
+ X = -1,
+ };
+
+ var s = JsonSchema.FromType<HasDepsTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ public class HasStringTest
+ {
+ public string X;
+ }
+
+ [Test]
+ public void TestHasString()
+ {
+ var obj = new HasStringTest()
+ {
+ X = "a",
+ };
+
+ var s = JsonSchema.FromType<HasStringTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{""X"":""a""}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test]
+ public void TestHasStringWithNull()
+ {
+ var obj = new HasStringTest();
+
+ var s = JsonSchema.FromType<HasStringTest>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{}";
+
+ Assert.AreEqual(expected, actual);
+ }
+
+ public class NestedRequiredTestParent
+ {
+ [JsonSchema(Required = true)]
+ public NestedRequiredTestChild C;
+ }
+
+ public class NestedRequiredTestChild
+ {
+ public string X;
+ }
+
+ [Test]
+ public void TestNestedRequired()
+ {
+ var obj = new NestedRequiredTestParent()
+ {
+ C = new NestedRequiredTestChild(),
+ };
+
+ var s = JsonSchema.FromType<NestedRequiredTestParent>();
+ {
+ var c = new JsonSchemaValidationContext(obj);
+ Assert.Null(s.Validator.Validate(c, s));
+ }
+ var actual = s.Serialize(obj);
+
+ var expected = @"{""C"":{}}";
+
+ Assert.AreEqual(expected, actual);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs.meta
new file mode 100644
index 00000000..b0c9e717
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/SerializeWithSchemaTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f1d1c3d9d4d20db409e9d5d9d671abbe
+timeCreated: 1546930461
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs
new file mode 100644
index 00000000..3a02610f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs
@@ -0,0 +1,441 @@
+using NUnit.Framework;
+using System.Collections.Generic;
+
+namespace UniJSON
+{
+ public class ValidatorTests
+ {
+ [Test]
+ public void IntValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var v = new JsonIntValidator();
+ v.Maximum = 0;
+ Assert.NotNull(v.Validate(c, 1));
+ Assert.Null(v.Validate(c, 0));
+ Assert.Null(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonIntValidator();
+ v.Maximum = 0;
+ v.ExclusiveMaximum = true;
+ Assert.NotNull(v.Validate(c, 1));
+ Assert.NotNull(v.Validate(c, 0));
+ Assert.Null(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonIntValidator();
+ v.Minimum = 0;
+ Assert.Null(v.Validate(c, 1));
+ Assert.Null(v.Validate(c, 0));
+ Assert.NotNull(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonIntValidator();
+ v.Minimum = 0;
+ v.ExclusiveMinimum = true;
+ Assert.Null(v.Validate(c, 1));
+ Assert.NotNull(v.Validate(c, 0));
+ Assert.NotNull(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonIntValidator();
+ v.MultipleOf = 4;
+ Assert.Null(v.Validate(c, 4));
+ Assert.NotNull(v.Validate(c, 5));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ [Test]
+ public void NumberValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var v = new JsonNumberValidator();
+ v.Maximum = 0.1;
+ Assert.NotNull(v.Validate(c, 1));
+ Assert.Null(v.Validate(c, 0.1));
+ Assert.Null(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonNumberValidator();
+ v.Maximum = 0.1;
+ v.ExclusiveMaximum = true;
+ Assert.NotNull(v.Validate(c, 1));
+ Assert.NotNull(v.Validate(c, 0.1));
+ Assert.Null(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonNumberValidator();
+ v.Minimum = 0.1;
+ Assert.Null(v.Validate(c, 1));
+ Assert.Null(v.Validate(c, 0.1));
+ Assert.NotNull(v.Validate(c, -1));
+ }
+ {
+ var v = new JsonNumberValidator();
+ v.Minimum = 0.1;
+ v.ExclusiveMinimum = true;
+ Assert.Null(v.Validate(c, 1));
+ Assert.NotNull(v.Validate(c, 0.1));
+ Assert.NotNull(v.Validate(c, -1));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ [Test]
+ public void BoolValidator()
+ {
+ // ???
+ }
+
+ [Test]
+ public void StringValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var v = new JsonStringValidator();
+ Assert.Null(v.Validate(c, ""));
+ Assert.Null(v.Validate(c, "a"));
+ }
+
+ {
+ var v = new JsonStringValidator();
+ v.MinLength = 1;
+ Assert.Null(v.Validate(c, "a"));
+ Assert.NotNull(v.Validate(c, ""));
+ }
+ {
+ var v = new JsonStringValidator();
+ v.MaxLength = 1;
+ Assert.Null(v.Validate(c, "a"));
+ Assert.NotNull(v.Validate(c, "ab"));
+ }
+ {
+ var v = new JsonStringValidator();
+ v.Pattern = new System.Text.RegularExpressions.Regex("abc");
+ Assert.Null(v.Validate(c, "abc"));
+ Assert.NotNull(v.Validate(c, "ab"));
+ }
+ {
+ var v = new JsonStringValidator();
+ v.Pattern = new System.Text.RegularExpressions.Regex("ab+");
+ Assert.Null(v.Validate(c, "abb"));
+ Assert.Null(v.Validate(c, "ab"));
+ Assert.NotNull(v.Validate(c, "a"));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ [Test]
+ public void StringEnumValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var v = JsonStringEnumValidator.Create(new string[] { "a", "b" }, EnumSerializationType.AsString);
+ Assert.Null(v.Validate(c, "a"));
+ Assert.NotNull(v.Validate(c, "c"));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ [Test]
+ public void IntEnumValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var v = new JsonIntEnumValidator();
+ v.Values = new int[] { 1, 2 };
+ Assert.Null(v.Validate(c, 1));
+ Assert.NotNull(v.Validate(c, 3));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ [Test]
+ public void ArrayValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var v = new JsonArrayValidator();
+ v.MaxItems = 1;
+ Assert.Null(v.Validate(c, new object[] { 0 }));
+ Assert.NotNull(v.Validate(c, new object[] { 0, 1 }));
+ }
+
+ {
+ var v = new JsonArrayValidator();
+ v.MinItems = 1;
+ Assert.Null(v.Validate(c, new object[] { 0 }));
+ Assert.NotNull(v.Validate(c, new object[] { }));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ class Hoge
+ {
+ [JsonSchema(Required = true, Minimum = 1)]
+ public int Value;
+ }
+
+ [Test]
+ public void ObjectValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+ {
+ var s = JsonSchema.FromType<Hoge>();
+ Assert.Null(s.Validator.Validate(c, new Hoge { Value = 1 }));
+ Assert.NotNull(s.Validator.Validate(c, new Hoge { Value = 0 }));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ class NotRequired
+ {
+ [JsonSchema(Minimum = 1)]
+ public int Value;
+ }
+
+ [Test]
+ public void ObjectValidatorForNotRequired()
+ {
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = false, // Default behaviour
+ };
+
+ var s = JsonSchema.FromType<NotRequired>();
+ // An error is not returned because Value is not 'Required' and the diagnosis is not enabled
+ Assert.Null(s.Validator.Validate(c, new NotRequired { Value = 0 }));
+
+ Assert.True(c.IsEmpty());
+ }
+
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<NotRequired>();
+ Assert.NotNull(s.Validator.Validate(c, new NotRequired { Value = 0 }));
+
+ Assert.True(c.IsEmpty());
+ }
+ }
+
+ class NotRequiredWithIgnorable
+ {
+ [JsonSchema(Minimum = 2, ExplicitIgnorableValue = -1)]
+ public int Value;
+ }
+
+ [Test]
+ public void ObjectValidatorForNotRequiredWithIgnorable()
+ {
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = false, // Default behaviour
+ };
+
+ var s = JsonSchema.FromType<NotRequiredWithIgnorable>();
+ // An error is not returned because Value is not 'Required' and the diagnosis is not enabled
+ Assert.Null(s.Validator.Validate(c, new NotRequiredWithIgnorable { Value = 0 }));
+
+ Assert.True(c.IsEmpty());
+ }
+
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<NotRequiredWithIgnorable>();
+ Assert.NotNull(s.Validator.Validate(c, new NotRequiredWithIgnorable { Value = 0 }));
+
+ Assert.True(c.IsEmpty());
+ }
+
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<NotRequiredWithIgnorable>();
+ // An error is NOT returned even though diagnosis is enabled because of an ignorable value is matched
+ Assert.Null(s.Validator.Validate(c, new NotRequiredWithIgnorable { Value = -1 }));
+
+ Assert.True(c.IsEmpty());
+ }
+ }
+
+ [Test]
+ public void DictionaryValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var s = JsonSchema.FromType<Dictionary<string, int>>();
+ Assert.True(s.Validator is JsonDictionaryValidator<int>);
+
+ var v = s.Validator as JsonDictionaryValidator<int>;
+ v.MinProperties = 1;
+ v.AdditionalProperties = JsonSchema.FromType<int>();
+ (v.AdditionalProperties.Validator as JsonIntValidator).Minimum = 0;
+
+ Assert.Null(s.Validator.Validate(c, new Dictionary<string, int>
+ {
+ {"POSITION", 0}
+ }));
+
+ var result = s.Validator.Validate(c, new Dictionary<string, int>
+ {
+ {"POSITION", -1}
+ });
+ Assert.NotNull(result);
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ class HasDictionary
+ {
+ public Dictionary<string, float> primitiveProperties = new Dictionary<string, float>();
+ // TODO: fix
+ // public Dictionary<string, Nested> nestedProperties = new Dictionary<string, Nested>();
+ }
+
+ [Test]
+ public void HasDictionaryObjectValidator()
+ {
+ var c = new JsonSchemaValidationContext("test");
+
+ {
+ var s = JsonSchema.FromType<HasDictionary>();
+ Assert.Null(s.Validator.Validate(c, new HasDictionary()));
+ }
+
+ Assert.True(c.IsEmpty());
+ }
+
+ class HasArrayObject
+ {
+ [ItemJsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public float[] xs;
+ }
+
+ [Test]
+ public void HasArrayObjectValidator()
+ {
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<HasArrayObject>();
+
+ Assert.Null(s.Validator.Validate(c, new HasArrayObject { xs = new float[] { } }));
+ Assert.Null(s.Validator.Validate(c, new HasArrayObject { xs = new float[] { 0.5f } }));
+ Assert.NotNull(s.Validator.Validate(c, new HasArrayObject { xs = new float[] { 1.5f } }));
+
+ Assert.True(c.IsEmpty());
+ }
+ }
+
+ class HasListObject
+ {
+ [ItemJsonSchema(Minimum = 0.0, Maximum = 1.0)]
+ public List<float> xs;
+ }
+
+ [Test]
+ public void HasListObjectValidator()
+ {
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<HasListObject>();
+
+ Assert.Null(s.Validator.Validate(c, new HasListObject { xs = new List<float> { } }));
+ Assert.Null(s.Validator.Validate(c, new HasListObject { xs = new List<float> { 0.5f } }));
+ Assert.NotNull(s.Validator.Validate(c, new HasListObject { xs = new List<float> { 1.5f } }));
+
+ Assert.True(c.IsEmpty());
+ }
+ }
+
+ class HasRequiredListObject
+ {
+ [JsonSchema(Required = true, MinItems = 1)]
+ [ItemJsonSchema(Minimum = 0)]
+ public int[] xs;
+ }
+
+ [Test]
+ public void HasRequiredListObjectValidator()
+ {
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<HasRequiredListObject>();
+
+ Assert.NotNull(s.Validator.Validate(c, new HasRequiredListObject()));
+ Assert.NotNull(s.Validator.Validate(c, new HasRequiredListObject { xs = new int[] {} }));
+ Assert.NotNull(s.Validator.Validate(c, new HasRequiredListObject { xs = new int[] { -1 } }));
+ Assert.Null(s.Validator.Validate(c, new HasRequiredListObject { xs = new int[] { 0 } }));
+
+ Assert.True(c.IsEmpty());
+ }
+ }
+
+ class HasRequiredStringObject
+ {
+ [JsonSchema(Required = true)]
+ public string s;
+ }
+
+ [Test]
+ public void HasRequiredStringObjectValidator()
+ {
+ {
+ var c = new JsonSchemaValidationContext("test")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+
+ var s = JsonSchema.FromType<HasRequiredStringObject>();
+
+ Assert.NotNull(s.Validator.Validate(c, new HasRequiredStringObject()));
+ Assert.Null(s.Validator.Validate(c, new HasRequiredStringObject { s = "" }));
+
+ Assert.True(c.IsEmpty());
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs.meta
new file mode 100644
index 00000000..66ad4cae
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Json/ValidatorTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 16d778a50d1c9374894ef42f892210dd
+timeCreated: 1531900562
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack.meta
new file mode 100644
index 00000000..187193c4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0bcf0d9b7cba67c42ba04c530aa7cd38
+folderAsset: yes
+timeCreated: 1540812199
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs
new file mode 100644
index 00000000..7f7c01ea
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs
@@ -0,0 +1,92 @@
+using NUnit.Framework;
+using System;
+using System.Linq;
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class ArrayTest
+ {
+ [Test]
+ public void fix_array()
+ {
+ var f = new MsgPackFormatter();
+ // Object[] not supported
+ f.Serialize(new[] { 0, 1, false, (Object)null });
+ var _bytes = f.GetStoreBytes();
+ var bytes = _bytes.Array.Skip(_bytes.Offset).Take(_bytes.Count).ToArray();
+
+ Assert.AreEqual(new Byte[]{
+ (Byte)MsgPackType.FIX_ARRAY_0x4,
+ (Byte)MsgPackType.POSITIVE_FIXNUM,
+ (Byte)MsgPackType.POSITIVE_FIXNUM_0x01,
+ (Byte)MsgPackType.FALSE,
+ (Byte)MsgPackType.NIL
+ }, bytes);
+
+ var parsed = MsgPackParser.Parse(bytes);
+
+ Assert.AreEqual(4, parsed.GetArrayCount());
+ Assert.AreEqual(0, parsed[0].GetValue());
+ Assert.AreEqual(1, parsed[1].GetValue());
+ Assert.False((Boolean)parsed[2].GetValue());
+ Assert.AreEqual(null, parsed[3].GetValue());
+ }
+
+ [Test]
+ public void array16()
+ {
+ var f = new MsgPackFormatter();
+ var data = Enumerable.Range(0, 20).Select(x => (Object)x).ToArray();
+ f.Serialize(data);
+ var bytes = f.GetStoreBytes();
+
+ var value = MsgPackParser.Parse(bytes);
+ Assert.IsTrue(value.IsArray());
+ Assert.AreEqual(20, value.GetArrayCount());
+ for (int i = 0; i < 20; ++i)
+ {
+ Assert.AreEqual(i, value[i].GetValue());
+ }
+ }
+
+ [Test]
+ public void array129()
+ {
+ {
+ var i128 = Enumerable.Range(0, 128).ToArray();
+ var f = new MsgPackFormatter();
+ f.Serialize(i128);
+ var bytes128 = f.GetStoreBytes();
+ var deserialized = MsgPackParser.Parse(bytes128);
+ Assert.AreEqual(128, deserialized.GetArrayCount());
+ for (int i = 0; i < i128.Length; ++i)
+ {
+ Assert.AreEqual(i128[i], deserialized[i].GetValue());
+ }
+ }
+
+ {
+ var i129 = Enumerable.Range(0, 129).ToArray();
+ var f = new MsgPackFormatter();
+ f.Serialize(i129);
+ var bytes129 = f.GetStoreBytes();
+ var deserialized = MsgPackParser.Parse(bytes129);
+ Assert.AreEqual(129, deserialized.GetArrayCount());
+ for (int i = 0; i < i129.Length; ++i)
+ {
+ Assert.AreEqual(i129[i], deserialized[i].GetValue());
+ }
+ }
+ }
+
+ [Test]
+ public void ReadTest()
+ {
+ var data = new int[] { -108, 0, 1, -90, 108, 111, 103, 103, 101, 114, -110, -91, 69, 114, 114, 111, 114, -94, 101, 50 }
+ .Select(x => (Byte)x).ToArray();
+ var parsed = MsgPackParser.Parse(data);
+ Assert.True(parsed.IsArray());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs.meta
new file mode 100644
index 00000000..733ee7e6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/ArrayTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4b485b0360ebfd246ac90bbe8ad1895b
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs
new file mode 100644
index 00000000..5b38abb5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs
@@ -0,0 +1,50 @@
+using NUnit.Framework;
+using System;
+
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class BooleanTest
+ {
+ [Test]
+ public void nil()
+ {
+ {
+ var f = new MsgPackFormatter();
+ f.Null();
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[] { 0xC0 }, bytes.ToEnumerable());
+
+ var parsed = MsgPackParser.Parse(bytes);
+ Assert.True(parsed.IsNull());
+ }
+ }
+
+ [Test]
+ public void True()
+ {
+ var f = new MsgPackFormatter();
+ f.Value(true);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[] { 0xC3 }, bytes.ToEnumerable());
+
+ var value = MsgPackParser.Parse(bytes);
+ var j = value.GetBoolean();
+ Assert.AreEqual(true, j);
+ }
+
+ [Test]
+ public void False()
+ {
+ var f = new MsgPackFormatter();
+ f.Value(false);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[] { 0xC2 }, bytes.ToEnumerable());
+
+ var value = MsgPackParser.Parse(bytes);
+ var j = value.GetBoolean();
+ Assert.AreEqual(false, j);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs.meta
new file mode 100644
index 00000000..d179af7c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/BooleanTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d0f19e48b365cd446982ed0b7ba6251e
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs
new file mode 100644
index 00000000..82e1a63b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs
@@ -0,0 +1,50 @@
+using NUnit.Framework;
+using System;
+using System.Linq;
+
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class FloatTest
+ {
+ [Test]
+ public void Float32()
+ {
+ var i = 1.1f;
+ var float_be = new byte[]
+ {
+ (Byte)MsgPackType.FLOAT, 0x3f, 0x8c, 0xcc, 0xcd
+ };
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ var value = MsgPackParser.Parse(bytes);
+ var body = value.Value.Bytes;
+ Assert.AreEqual(float_be, body.ToEnumerable().ToArray());
+
+ Assert.AreEqual(i, value.GetValue());
+ }
+
+ [Test]
+ public void Float64()
+ {
+ var i = 1.1;
+ var double_be = new Byte[]{
+ (Byte)MsgPackType.DOUBLE, 0x3f, 0xf1, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9a,
+ };
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ var value = MsgPackParser.Parse(bytes);
+ var body = value.Value.Bytes;
+ Assert.AreEqual(double_be, body.ToEnumerable().ToArray());
+
+ Assert.AreEqual(i, value.GetValue());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs.meta
new file mode 100644
index 00000000..b2893722
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/FloatTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 51cdc6be3b73a34429cae41cd020c71c
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs
new file mode 100644
index 00000000..4f341129
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs
@@ -0,0 +1,220 @@
+using NUnit.Framework;
+using System;
+
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class IntTest
+ {
+ [Test]
+ public void positive_fixnum()
+ {
+ for (Byte i = 0; i < 128; ++i)
+ {
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[] { i }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void negative_fixnum()
+ {
+ for (SByte i = -32; i < 0; ++i)
+ {
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void uint8()
+ {
+ {
+ Byte i = 0x7F + 20;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[]{
+ 0xcc, 0x93,
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void cast_large_type()
+ {
+ {
+ Byte i = 0x7F + 20;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[]{
+ 0xcc, 0x93,
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void uint16()
+ {
+ {
+ UInt16 i = 0xFF + 20;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[]{
+ 0xcd, 0x01, 0x13
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void uint32()
+ {
+ {
+ UInt32 i = 0xFFFF + 20;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[]{
+ 0xce, 0x00, 0x01, 0x00, 0x13
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void uint64()
+ {
+ {
+ UInt64 i = 0xFFFFFFFF;
+ i += 20;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[]{
+ 0xcf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void int8()
+ {
+ {
+ SByte i = -64;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ Assert.AreEqual(new Byte[]{
+ 0xd0, 0xc0,
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void int128Test()
+ {
+ int i = 128;
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+ Assert.AreEqual(new Byte[]{
+ 0xcc, 0x80,
+ }, bytes.ToEnumerable());
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+
+ [Test]
+ public void int16()
+ {
+ {
+ Int16 i = -150;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ Assert.AreEqual(new Byte[]{
+ 0xd1, 0xFF, 0x6a
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void int32()
+ {
+ {
+ Int32 i = -35000;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ Assert.AreEqual(new Byte[]{
+ 0xd2, 0xff, 0xff, 0x77, 0x48
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+
+ [Test]
+ public void int64()
+ {
+ {
+ Int64 i = -2147483650;
+
+ var f = new MsgPackFormatter();
+ f.Value(i);
+ var bytes = f.GetStoreBytes();
+
+ Assert.AreEqual(new Byte[]{
+ 0xd3, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xfe
+ }, bytes.ToEnumerable());
+
+ var j = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(i, j);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs.meta
new file mode 100644
index 00000000..c2800a7f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/IntTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8d6f5e40bc0825b449887d877c0ad5c5
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs
new file mode 100644
index 00000000..d1bfb3e5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs
@@ -0,0 +1,120 @@
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Linq;
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class MapTest
+ {
+ [Test]
+ public void fix_map()
+ {
+ var f = new MsgPackFormatter();
+ f.BeginMap(2);
+ f.Key("0"); f.Value(1);
+ f.Key("2"); f.Value(3);
+ f.EndMap();
+ var bytes =
+ f.GetStoreBytes();
+ ;
+
+ Assert.AreEqual(new Byte[]{
+ 0x82, // map2
+
+ 0xa1, 0x30, // "0"
+ 0x01, // 1
+
+ 0xa1, 0x32, // "2"
+ 0x03 // 3
+ }, bytes.ToEnumerable());
+
+ var value = MsgPackParser.Parse(bytes);
+
+ Assert.AreEqual(2, value.GetObjectCount());
+ Assert.AreEqual(1, value["0"].GetValue());
+ Assert.AreEqual(3, value["2"].GetValue());
+ }
+
+ [Test]
+ public void map16()
+ {
+ var w = new MsgPackFormatter();
+ int size = 18;
+ w.BeginMap(size);
+ for (int i = 0; i < size; ++i)
+ {
+ w.Value(i.ToString());
+ w.Value(i + 5);
+ }
+ var bytes = w.GetStoreBytes().ToEnumerable().ToArray();
+
+
+ var expected = new Byte[]{
+ 0xde, // map18
+ 0x0, 0x12, // 18
+
+ 0xa1, 0x30, // "0"
+ 0x5,
+
+ 0xa1, 0x31, // "1"
+ 0x6,
+
+ 0xa1, 0x32, // "2"
+ 0x7,
+
+ 0xa1, 0x33, // "3"
+ 0x8,
+
+ 0xa1, 0x34, // "4"
+ 0x9,
+
+ 0xa1, 0x35, // "5"
+ 0xa,
+
+ 0xa1, 0x36, // "6"
+ 0xb,
+
+ 0xa1, 0x37, // "7"
+ 0xc,
+
+ 0xa1, 0x38, // "8"
+ 0xd,
+
+ 0xa1, 0x39, // "9"
+ 0xe,
+
+ 0xa2, 0x31, 0x30, // "10"
+ 0xf,
+
+ 0xa2, 0x31, 0x31, // "11"
+ 0x10,
+
+ 0xa2, 0x31, 0x32, // "12"
+ 0x11,
+
+ 0xa2, 0x31, 0x33, // "13"
+ 0x12,
+
+ 0xa2, 0x31, 0x34, // "14"
+ 0x13,
+
+ 0xa2, 0x31, 0x35, // "15"
+ 0x14,
+
+ 0xa2, 0x31, 0x36, // "16"
+ 0x15,
+
+ 0xa2, 0x31, 0x37, // "17",
+ 0x16
+ };
+
+ Assert.AreEqual(expected, bytes);
+
+ var value = MsgPackParser.Parse(bytes);
+
+ Assert.AreEqual(15, value["10"].GetValue());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs.meta
new file mode 100644
index 00000000..7c87a562
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/MapTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 87a626e93589db14fbe4526c9880b110
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs
new file mode 100644
index 00000000..d3a45862
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs
@@ -0,0 +1,34 @@
+using NUnit.Framework;
+using System;
+using System.Linq;
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class RawTest
+ {
+ [Test]
+ public void fix_raw()
+ {
+ var src = new Byte[] { 0, 1, 2 };
+ var f = new MsgPackFormatter();
+ f.Value(src);
+ var bytes = f.GetStoreBytes();
+
+ var v = MsgPackParser.Parse(bytes).Value.GetBody();
+ Assert.True(src.SequenceEqual(v.ToEnumerable()));
+ }
+
+ [Test]
+ public void raw16()
+ {
+ var src = Enumerable.Range(0, 50).Select(x => (Byte)x).ToArray();
+ var f = new MsgPackFormatter();
+ f.Value(src);
+ var bytes = f.GetStoreBytes();
+
+ var v = MsgPackParser.Parse(bytes).Value.GetBody();
+ Assert.True(src.SequenceEqual(v.ToEnumerable()));
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs.meta
new file mode 100644
index 00000000..402252f9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/RawTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 331bd613923afe5438ef4ff3a59fc5b3
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs
new file mode 100644
index 00000000..c85e899d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs
@@ -0,0 +1,36 @@
+using NUnit.Framework;
+using System;
+using System.Linq;
+
+namespace UniJSON.MsgPack
+{
+ [TestFixture]
+ public class StringTest
+ {
+ [Test]
+ public void str()
+ {
+ var f = new MsgPackFormatter();
+ f.Value("文字列");
+ var bytes = f.GetStoreBytes();
+
+ var v = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual("文字列", v);
+ }
+
+ [Test]
+ public void fix_str()
+ {
+ for (int i = 1; i < 32; ++i)
+ {
+ var str = String.Join("", Enumerable.Range(0, i).Select(_ => "0").ToArray());
+ var f = new MsgPackFormatter();
+ f.Value(str);
+ var bytes = f.GetStoreBytes();
+
+ var value = MsgPackParser.Parse(bytes);
+ Assert.AreEqual(i, ((String)value.GetValue()).Length);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs.meta
new file mode 100644
index 00000000..43802558
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3942810073614d946a76d87cbbfb222c
+timeCreated: 1540812276
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs
new file mode 100644
index 00000000..16e764f8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs
@@ -0,0 +1,50 @@
+using NUnit.Framework;
+using System;
+
+
+namespace UniJSON.MsgPack
+{
+ public class TimeTests
+ {
+ [Test]
+ public void TimeTest()
+ {
+ var f = new MsgPackFormatter();
+
+ {
+ f.GetStore().Clear();
+ var time = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
+ f.Value(time);
+
+ var bytes = f.GetStoreBytes().ArrayOrCopy();
+ unchecked
+ {
+ Assert.AreEqual(new byte[]
+ {
+ (byte)MsgPackType.FIX_EXT_4, (byte)-1, 0, 0, 0, 0
+ }, bytes);
+ }
+ var parsed = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(time, parsed);
+ }
+
+ {
+ var time = new DateTimeOffset(2018, 12, 8, 2, 12, 15, TimeSpan.Zero);
+ Assert.AreEqual(1544235135, time.ToUnixTimeSeconds());
+ f.GetStore().Clear();
+ f.Value(time);
+ var bytes = f.GetStoreBytes().ArrayOrCopy();
+ var parsed = MsgPackParser.Parse(bytes).GetValue();
+ Assert.AreEqual(time, parsed);
+ }
+
+ {
+ f.GetStore().Clear();
+ Assert.Catch(() =>
+ {
+ f.Value(new DateTimeOffset());
+ });
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs.meta
new file mode 100644
index 00000000..e1ae14b8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/MsgPack/TimeTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0a025b475357b4d4aa104e839e6791be
+timeCreated: 1544154226
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs
new file mode 100644
index 00000000..69023e8b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs
@@ -0,0 +1,98 @@
+using NUnit.Framework;
+using UniJSON.MsgPack;
+
+namespace UniJSON
+{
+ public class RPCTests
+ {
+ [Test]
+ public void JsonRpcRequestTest()
+ {
+ var f = new JsonFormatter();
+
+ {
+ f.Clear();
+ var l = JsonParser.Parse("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"num1\",\"params\":[1]}");
+ f.Request("num1", 1);
+ var u = new Utf8String(f.GetStoreBytes());
+ var r = JsonParser.Parse(u);
+ Assert.AreEqual(
+ l,
+ r);
+ }
+ {
+ f.Clear();
+ f.Request("num2", 2, true);
+ Assert.AreEqual(
+ JsonParser.Parse("{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"num2\",\"params\":[2,true]}"),
+ JsonParser.Parse(new Utf8String(f.GetStoreBytes())));
+ }
+ {
+ f.Clear();
+ f.Request("num3",
+ 3, true, "abc", false, (string)null, new[] { 1, 2 });
+ Assert.AreEqual(
+ JsonParser.Parse("{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"num3\",\"params\":[3,true,\"abc\",false,null,[1,2]]}"),
+ JsonParser.Parse(new Utf8String(f.GetStoreBytes())));
+ }
+ }
+
+ [Test]
+ public void JsonRpcDispatcherTest()
+ {
+ var dispatcher = new RpcDispatcher<JsonValue>();
+ var f = new JsonFormatter();
+
+ {
+ f.Clear();
+ dispatcher.Register("add", (int a, int b) => a + b);
+ f.Request("add", 1, 2);
+
+ var parsed = JsonParser.Parse(new Utf8String(f.GetStoreBytes()));
+
+ f.Clear();
+ dispatcher.Call(f, parsed["id"].GetInt32(), parsed["method"].GetString(), parsed["params"]);
+ var response = JsonParser.Parse(new Utf8String(f.GetStoreBytes()));
+ Assert.AreEqual(3, response["result"].GetInt32());
+ }
+
+ {
+ string msg = null;
+ dispatcher.Register("print", (string _msg) => { msg = _msg; });
+ f.Clear();
+ f.Request("print", "hoge");
+
+ var parsed = JsonParser.Parse(new Utf8String(f.GetStoreBytes()));
+ f.Clear();
+ dispatcher.Call(f, parsed["id"].GetInt32(), parsed["method"].GetString(), parsed["params"]);
+
+ Assert.AreEqual("hoge", msg);
+ }
+ }
+
+ [Test]
+ public void MsgPackRpcDispatcherTest()
+ {
+ var dispatcher = new RpcDispatcher<MsgPackValue>();
+ var f = new MsgPackFormatter();
+
+ {
+ f.GetStore().Clear();
+ dispatcher.Register("add", (int a, int b) => a + b);
+ f.Request("add", 1, 2);
+
+ var request = MsgPackParser.Parse(f.GetStoreBytes());
+ Assert.AreEqual(4, request.GetArrayCount());
+ Assert.AreEqual(MsgPackFormatter.REQUEST_TYPE, request[0].GetInt32());
+
+ f.GetStore().Clear();
+ dispatcher.Call(f, request[1].GetInt32(), request[2].GetString(), request[3]);
+ var response = MsgPackParser.Parse(f.GetStoreBytes());
+ Assert.AreEqual(4, response.GetArrayCount());
+ Assert.AreEqual(MsgPackFormatter.RESPONSE_TYPE, response[0].GetInt32());
+ Assert.True(response[2].IsNull());
+ Assert.AreEqual(3, response[3].GetInt32());
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs.meta
new file mode 100644
index 00000000..e2935550
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/RPCTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 05698e8d4a5f5f64c8482d2d6899301d
+timeCreated: 1543250712
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml.meta
new file mode 100644
index 00000000..fcfdc875
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6a719ea2a10120c48959e1fe817301af
+folderAsset: yes
+timeCreated: 1545735556
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs
new file mode 100644
index 00000000..2069c41d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs
@@ -0,0 +1,128 @@
+using NUnit.Framework;
+
+
+/*
+namespace UniJSON.Toml
+{
+ class TomlParserTests
+ {
+ [Test]
+ public void BareKeyTests()
+ {
+ {
+ var result = TomlParser.Parse(@"
+value = 1
+");
+ Assert.True(result.IsMap());
+ Assert.AreEqual(1, result["value"].GetInt32());
+ }
+ }
+
+ [Test]
+ public void DottedKeyTests()
+ {
+ {
+ var result = TomlParser.Parse(@"
+value.value2 = 1
+");
+ Assert.True(result.IsMap());
+ Assert.AreEqual(1, result["value"]["value2"].GetInt32());
+ }
+ }
+
+ [Test]
+ public void DuplicatedKey()
+ {
+ {
+ Assert.Catch(() => TomlParser.Parse(@"
+value = 1
+value = 2
+"));
+ }
+ }
+
+ [Test]
+ public void QuotedKeyTests()
+ {
+ {
+ var result = TomlParser.Parse(@"
+""value"" = 1
+");
+ Assert.True(result.IsMap());
+ Assert.AreEqual(1, result["value"].GetInt32());
+ }
+
+ {
+ var result = TomlParser.Parse(@"
+""[key=value]"" = 1
+");
+ Assert.True(result.IsMap());
+ Assert.AreEqual(1, result["value"].GetInt32());
+ }
+ }
+
+ [Test]
+ public void TableTests()
+ {
+ {
+ var result = @"
+[table]
+value = 1
+".ParseAsToml();
+ Assert.True(result.IsMap());
+ Assert.AreEqual(1, result["table"]["value"].GetInt32());
+ }
+
+ {
+ var result = @"
+[table.table2]
+value = 1
+".ParseAsToml();
+ Assert.True(result.IsMap());
+ Assert.AreEqual(1, result["table"]["table2"]["value"].GetInt32());
+ }
+ }
+
+ [Test]
+ public void TomlExample()
+ {
+ var result = @"
+# This is a TOML document.
+
+title = ""TOML Example""
+
+[owner]
+name = ""Tom Preston-Werner""
+dob = 1979 - 05 - 27T07: 32:00 - 08:00 # First class dates
+
+[database]
+server = ""192.168.1.1""
+ports = [8001, 8001, 8002]
+connection_max = 5000
+enabled = true
+
+[servers]
+
+# Indentation (tabs and/or spaces) is allowed but not required
+ [servers.alpha]
+ ip = ""10.0.0.1""
+ dc = ""eqdc10""
+
+ [servers.beta]
+ ip = ""10.0.0.2""
+ dc = ""eqdc10""
+
+[clients]
+data = [ [""gamma"", ""delta""], [1, 2] ]
+
+# Line breaks are OK when inside arrays
+hosts = [
+ ""alpha"",
+ ""omega""
+]
+".ParseAsToml();
+ Assert.AreEqual("TOML Example", result["title"].GetString());
+ }
+ }
+}
+*/
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs.meta
new file mode 100644
index 00000000..b949e4cd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Toml/TomlParserTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7959f4764f02c5e4d9f191e794bc6101
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs
new file mode 100644
index 00000000..602492e5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs
@@ -0,0 +1,129 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+
+
+namespace GenericTree
+{
+ /// <summary>
+ /// Generic tree interface
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <typeparam name="U"></typeparam>
+ interface ITreeNode<T, U>
+ where T : ITreeNode<T, U>
+ {
+ bool IsValid { get; }
+ int ValueIndex { get; }
+ U Value { get; }
+
+ bool HasParent { get; }
+ T Parent { get; }
+
+ IEnumerable<T> Children { get; }
+ }
+
+ /// <summary>
+ /// Item has parent reference by list index
+ /// </summary>
+ public interface ITreeItem
+ {
+ int ParentIndex { get; }
+ }
+
+ /// <summary>
+ /// Generic tree implementation
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ struct TreeNode<T> : ITreeNode<TreeNode<T>, T>
+ where T : ITreeItem
+ {
+ /// <summary>
+ /// Whole tree nodes
+ /// </summary>
+ public readonly List<T> Values;
+
+ public bool IsValid
+ {
+ get
+ {
+ return Values != null;
+ }
+ }
+
+ /// <summary>
+ /// This node index
+ /// </summary>
+ public int ValueIndex
+ {
+ get;
+ private set;
+ }
+
+ public T Value
+ {
+ get
+ {
+ if (Values == null)
+ {
+ return default(T);
+ }
+ return Values[ValueIndex];
+ }
+ }
+
+ public IEnumerable<TreeNode<T>> Children
+ {
+ get
+ {
+ for (int i = 0; i < Values.Count; ++i)
+ {
+ if (Values[i].ParentIndex == ValueIndex)
+ {
+ yield return new TreeNode<T>(Values, i);
+ }
+ }
+ }
+ }
+
+ public bool HasParent
+ {
+ get
+ {
+ return Value.ParentIndex >= 0 && Value.ParentIndex < Values.Count;
+ }
+ }
+
+ public TreeNode<T> Parent
+ {
+ get
+ {
+ if (Value.ParentIndex < 0)
+ {
+ throw new Exception("this may root node");
+ }
+ if (Value.ParentIndex >= Values.Count)
+ {
+ throw new IndexOutOfRangeException();
+ }
+ return new TreeNode<T>(Values, Value.ParentIndex);
+ }
+ }
+
+ public TreeNode(List<T> values, int index) : this()
+ {
+ Values = values;
+ ValueIndex = index;
+ }
+ }
+
+
+ class TreeTests
+ {
+ [Test]
+ public void TreeTest()
+ {
+
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs.meta
new file mode 100644
index 00000000..de17c436
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/TreeTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 61f513d7f9bea254690ee01fcb70e843
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef
new file mode 100644
index 00000000..7b5a5503
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef
@@ -0,0 +1,14 @@
+{
+ "name": "UniJSON.Editor.Tests",
+ "references": [
+ "UniJSON"
+ ],
+ "optionalUnityReferences": [
+ "TestAssemblies"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef.meta
new file mode 100644
index 00000000..ebbee0a7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/UniJSON.Editor.Tests.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 96fc039f80992a14a8b7b93aa81a3112
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs
new file mode 100644
index 00000000..6af873b1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs
@@ -0,0 +1,168 @@
+using NUnit.Framework;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public class Utf8StringTests
+ {
+ [Test]
+ public void Utf8StringTest()
+ {
+ var abc = Utf8String.From("abc");
+ var ab = Utf8String.From("ab");
+ var bc = Utf8String.From("bc");
+
+ Assert.True(abc.StartsWith(ab));
+ Assert.False(ab.StartsWith(abc));
+
+ Assert.True(abc.EndsWith(bc));
+ Assert.False(bc.EndsWith(abc));
+
+ Assert.AreEqual(Utf8String.From("abbc"), ab.Concat(bc));
+
+ Assert.AreEqual(2, abc.IndexOf((byte)'c'));
+
+ int pos;
+ abc.TrySearchAscii((byte)'c', 0, out pos);
+ Assert.AreEqual(2, pos);
+
+ abc.TrySearchAscii((byte)'c', 1, out pos);
+ Assert.AreEqual(2, pos);
+ }
+
+ [Test]
+ public void ShortUtf8Test()
+ {
+ var a0 = Utf8String4.Create("a");
+ Assert.AreEqual("a", a0);
+ var a1 = Utf8String4.Create(new byte[] { (byte)'a', 0x00 });
+ Assert.AreEqual(a0, a1);
+ var a2 = Utf8String4.Create("5");
+ Assert.AreEqual(3, a2.ByteLength);
+ }
+
+ [Test]
+ public void QuoteTest()
+ {
+ {
+ var value = Utf8String.From("ho5日本語ge");
+ var quoted = Utf8String.From("\"ho5日本語ge\"");
+ Assert.AreEqual(quoted, JsonString.Quote(value));
+ Assert.AreEqual(value, JsonString.Unquote(quoted));
+ }
+
+ {
+ var value = Utf8String.From("fuga\n ho5日本語ge");
+ var quoted = Utf8String.From("\"fuga\\n ho5日本語ge\"");
+ Assert.AreEqual(quoted, JsonString.Quote(value));
+ Assert.AreEqual(value, JsonString.Unquote(quoted));
+ }
+ }
+
+ [Test]
+ public void SplitTest()
+ {
+ {
+ var value = Utf8String.From("a/5/c");
+ var split = value.Split((byte)'/').ToArray();
+ Assert.AreEqual(3, split.Length);
+ Assert.AreEqual(split[0], Utf8String.From("a"));
+ Assert.AreEqual(split[1], Utf8String.From("5"));
+ Assert.AreEqual(split[2], Utf8String.From("c"));
+ }
+ {
+ var value = Utf8String.From("/a/5/c/");
+ var split = value.Split((byte)'/').ToArray();
+ Assert.AreEqual(4, split.Length);
+ Assert.AreEqual(split[0], Utf8String.From(""));
+ Assert.AreEqual(split[1], Utf8String.From("a"));
+ Assert.AreEqual(split[2], Utf8String.From("5"));
+ Assert.AreEqual(split[3], Utf8String.From("c"));
+ }
+ }
+
+ [Test]
+ public void SplitIntegerTest()
+ {
+ Assert.AreEqual("1", Utf8String.From("1 ").SplitInteger().ToString());
+ Assert.AreEqual("123", Utf8String.From("123").SplitInteger().ToString());
+ Assert.Catch(() => Utf8String.From(" 1").SplitInteger());
+ Assert.AreEqual("+12", Utf8String.From("+12\n").SplitInteger().ToString());
+ Assert.AreEqual("-123", Utf8String.From("-123\n").SplitInteger().ToString());
+ }
+
+ [Test]
+ public void AtoiTest()
+ {
+ Assert.AreEqual(1234, Utf8String.From("1234").ToInt32());
+ }
+
+ [Test]
+ public void ToCharTest()
+ {
+ {
+ // 1byte
+ var c = 'A';
+ Assert.AreEqual(1, Utf8String.From(c.ToString()).GetFirst().CurrentByteLength);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Unicode);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Char);
+ }
+ {
+ // 2byte
+ var c = '¢';
+ Assert.AreEqual(2, Utf8String.From(c.ToString()).GetFirst().CurrentByteLength);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Unicode);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Char);
+ }
+ {
+ // 3byte
+ var c = '5';
+ Assert.AreEqual(3, Utf8String.From(c.ToString()).GetFirst().CurrentByteLength);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Unicode);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Char);
+ }
+ {
+ var c = '仡';
+ Assert.AreEqual(3, Utf8String.From(c.ToString()).GetFirst().CurrentByteLength);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Unicode);
+ Assert.AreEqual(c, Utf8String.From(c.ToString()).GetFirst().Char);
+ }
+ {
+ // emoji
+ var s = "😃";
+ Assert.AreEqual(4, Utf8String.From(s).GetFirst().CurrentByteLength);
+ Assert.AreEqual(0x1F603, Utf8String.From(s).GetFirst().Unicode);
+ Assert.Catch(() =>
+ {
+ var a = Utf8String.From(s).GetFirst().Char;
+ });
+ }
+ }
+
+ [Test]
+ public void FromStringTest()
+ {
+ var buffer = new byte[12];
+
+ {
+ var src = "abc";
+ var utf8 = Utf8String.From(src, buffer);
+ Assert.AreEqual(3, utf8.ByteLength);
+ Assert.AreEqual(src, utf8.ToString());
+ }
+ {
+ var src = "¢";
+ var utf8 = Utf8String.From(src, buffer);
+ Assert.AreEqual(2, utf8.ByteLength);
+ Assert.AreEqual(src, utf8.ToString());
+ }
+ {
+ var src = "5";
+ var utf8 = Utf8String.From(src, buffer);
+ Assert.AreEqual(3, utf8.ByteLength);
+ Assert.AreEqual(src, utf8.ToString());
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs.meta
new file mode 100644
index 00000000..d445b481
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Editor/Tests/Utf8StringTest.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6c8821be74ee9054d81e25151e023015
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE b/Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE
new file mode 100644
index 00000000..3299d454
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 ousttrue
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE.meta
new file mode 100644
index 00000000..0f8b7017
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/LICENSE.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d0cd28905c8909143a42de7256c727e7
+timeCreated: 1526055773
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/README.md b/Assets/ThirdParty/VRM/VRM/UniJSON/README.md
new file mode 100644
index 00000000..82a5a022
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/README.md
@@ -0,0 +1,138 @@
+# UniJSON
+JSON serializer and deserializer and schema utilities for Unity(.Net3.5)
+
+## Usage
+
+### JSON Create
+
+```cs
+var f = new JsonFormatter();
+f.BeginMap();
+f.Key("X"); f.Value(1);
+f.Key("Y"); f.Value(1);
+f.Key("Z"); f.Value(1);
+f.EndMap();
+var json = f.ToString();
+// {"X":1,"Y":2,"Z":3}
+```
+
+### JSON Serialize
+
+Serialize public fields automatically.
+
+```cs
+var f = new JsonFormatter();
+f.Serialize(new Vector3(1, 2, 3));
+var json = f.ToString();
+// {"X":1,"Y":2,"Z":3}
+```
+
+### JSON Parse
+
+```cs
+var json = "{\"X\":1,\"Y\":2,\"Z\":3}";
+var parsed = json.ParseAsJson();
+var x = parsed["X"].GetInt32();
+```
+
+### JSON Deserialize
+
+```cs
+var v = default(Vector3);
+json.Deserialize(ref v);
+```
+
+### JSON Schema
+
+```cs
+[Serializable]
+public class glTFSparseIndices
+{
+ [JsonSchema(Minimum = 0)]
+ public int bufferView;
+
+ [JsonSchema(Minimum = 0)]
+ public int byteOffset;
+
+ [JsonSchema(EnumSerializationType = EnumSerializationType.AsInt)]
+ public glComponentType componentType;
+
+ // empty schemas
+ public object extensions;
+ public object extras;
+}
+
+
+[Test]
+public void AccessorSparseIndices()
+{
+ // from JSON schema
+ var path = Path.GetFullPath(Application.dataPath + "/../glTF/specification/2.0/schema");
+ var SchemaDir = new FileSystemAccessor(path);
+ var fromSchema = JsonSchema.ParseFromPath(SchemaDir.Get("accessor.sparse.indices.schema.json"));
+
+ // from C# type definition
+ var fromClass = JsonSchema.FromType<glTFSparseIndices>();
+
+ Assert.AreEqual(fromSchema, fromClass);
+}
+```
+
+### MsgPack
+
+Same as json interface
+
+```cs
+var f = new MsgPackFormatter();
+f.Serialize(new Vector3(1, 2, 3));
+ArraySegment<byte> msgpack = f.GetStoreBytes();
+
+var parsed = msgpack.ParseAsMsgPack();
+var x = parsed["X"].GetInt32();
+```
+
+### TOML
+
+WIP
+
+```cs
+var toml =@"
+X = 1
+Y = 2
+Z = 3
+";
+var parsed = toml.ParseAsToml();
+var x = parsed["X"].GetInt32();
+```
+
+## Reference
+### JSON
+
+* https://www.json.org/
+
+### JSON Schema
+
+* http://json-schema.org/
+* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0/schema
+
+### JSON Patch
+
+* http://jsonpatch.com/
+
+### JSON RPC
+
+* https://www.jsonrpc.org/specification
+
+
+### MsgPack
+
+* https://github.com/msgpack/msgpack/blob/master/spec.md
+
+### MsgPack-RPC
+
+* https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md
+
+### TOML
+
+* https://github.com/toml-lang/toml
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/README.md.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/README.md.meta
new file mode 100644
index 00000000..ccadb4f3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/README.md.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: aacd90cc96ffbef4bb472bcb90b2620d
+timeCreated: 1526055773
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts.meta
new file mode 100644
index 00000000..55a5d222
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 817581cb4547fa04e877a77b4888dcc8
+folderAsset: yes
+timeCreated: 1526055856
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs
new file mode 100644
index 00000000..09d6c080
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs
@@ -0,0 +1,20 @@
+using System;
+
+
+namespace UniJSON
+{
+ public struct ActionDisposer : IDisposable
+ {
+ Action m_action;
+
+ public ActionDisposer(Action action)
+ {
+ m_action = action;
+ }
+
+ public void Dispose()
+ {
+ m_action();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs.meta
new file mode 100644
index 00000000..1a21d661
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ActionDisposer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ff15446e31b14ac409251c931b7c2038
+timeCreated: 1531893103
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs
new file mode 100644
index 00000000..019c9835
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs
@@ -0,0 +1,90 @@
+using System;
+
+
+namespace UniJSON
+{
+ public class ByteBuffer
+ {
+ Byte[] m_buffer;
+ public ArraySegment<Byte> Bytes
+ {
+ get { return new ArraySegment<byte>(m_buffer, 0, Count); }
+ }
+
+ public ByteBuffer()
+ {
+
+ }
+
+ public ByteBuffer(Byte[] buffer)
+ {
+ m_buffer = buffer;
+ }
+
+ int m_used;
+ public int Count
+ {
+ get { return m_used; }
+ }
+
+ public int Remain
+ {
+ get {
+ if (m_buffer == null) return 0;
+ return m_buffer.Length - m_used;
+ }
+ }
+
+ void Ensure(int size)
+ {
+ if (m_buffer != null && size < m_buffer.Length - m_used)
+ {
+ return;
+ }
+ var buffer = new Byte[m_used + size];
+ if (m_buffer != null && m_used > 0)
+ {
+ Buffer.BlockCopy(m_buffer, 0, buffer, 0, m_used);
+ }
+ m_buffer = buffer;
+ }
+
+ public void Push(Byte b)
+ {
+ Ensure(1);
+ m_buffer[m_used++] = b;
+ }
+
+ public void Push(Byte[] buffer)
+ {
+ Push(new ArraySegment<Byte>(buffer));
+ }
+
+ public void Push(ArraySegment<Byte> buffer)
+ {
+ Ensure(buffer.Count);
+ Buffer.BlockCopy(buffer.Array, buffer.Offset, m_buffer, m_used, buffer.Count);
+ m_used += buffer.Count;
+ }
+
+ public void Unshift(int size)
+ {
+ if (size > m_used)
+ {
+ throw new ArgumentException();
+ }
+
+ if (m_used - size < size)
+ {
+ Buffer.BlockCopy(m_buffer, m_used, m_buffer, 0, m_used - size);
+ m_used = m_used - size;
+ }
+ else
+ {
+ var buffer = new Byte[m_used];
+ Buffer.BlockCopy(m_buffer, size, buffer, 0, m_used - size);
+ m_buffer = buffer;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs.meta
new file mode 100644
index 00000000..6807b17b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ByteBuffer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5de1b9c915ceb8d41b95bdc432680fc3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs
new file mode 100644
index 00000000..641e4ebf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs
@@ -0,0 +1,85 @@
+using System;
+using System.IO;
+using System.Text;
+using UnityEngine;
+using System.Reflection;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniJSON
+{
+ public static partial class ConcreteCast
+ {
+ public static string GetMethodName(Type src, Type dst)
+ {
+ return string.Format("Cast{0}To{1}", src.Name, dst.Name);
+ }
+
+ public static MethodInfo GetMethod(Type src, Type dst)
+ {
+ var name = GetMethodName(src, dst);
+ var mi = typeof(ConcreteCast).GetMethod(name,
+ BindingFlags.Static | BindingFlags.Public);
+ return mi;
+ }
+
+#if UNITY_EDITOR
+
+ static Type[] s_castTypes = new Type[]
+ {
+ typeof(byte),
+ typeof(ushort),
+ typeof(uint),
+ typeof(ulong),
+
+ typeof(sbyte),
+ typeof(short),
+ typeof(int),
+ typeof(long),
+
+ typeof(float),
+ typeof(double),
+ };
+
+ [MenuItem("VRM/UniJSON/Generate ConcreteCast")]
+ public static void GenerateGenericCast()
+ {
+ var s = new StringBuilder();
+ using (var w = new StringWriter(s))
+ {
+ w.WriteLine(@"
+using System;
+
+namespace UniJSON {
+ public static partial class ConcreteCast
+ {
+");
+ foreach (var x in s_castTypes)
+ {
+ foreach (var y in s_castTypes)
+ {
+ w.WriteLine(@"
+ public static $1 $2($0 src)
+ {
+ return ($1)src;
+ }
+".Replace("$0", x.Name).Replace("$1", y.Name).Replace("$2", GetMethodName(x, y)));
+ }
+ }
+ w.WriteLine(@"
+ }
+}
+");
+ }
+
+ var path = Application.dataPath + SOURCE;
+ Debug.LogFormat("{0}", path);
+ File.WriteAllText(path, s.ToString().Replace("\r\n", "\n"), new UTF8Encoding(false));
+ AssetDatabase.ImportAsset("Assets" + SOURCE);
+ }
+ const string SOURCE = "/VRM/UniJSON/Scripts/ConcreteCast.g.cs";
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs.meta
new file mode 100644
index 00000000..bf2b3f2d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7c7697929e4510048a5238dd9d227b2e
+timeCreated: 1549025672
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs
new file mode 100644
index 00000000..68f94c98
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs
@@ -0,0 +1,611 @@
+
+using System;
+
+namespace UniJSON {
+ public static partial class ConcreteCast
+ {
+
+
+ public static Byte CastByteToByte(Byte src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastByteToUInt16(Byte src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastByteToUInt32(Byte src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastByteToUInt64(Byte src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastByteToSByte(Byte src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastByteToInt16(Byte src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastByteToInt32(Byte src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastByteToInt64(Byte src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastByteToSingle(Byte src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastByteToDouble(Byte src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastUInt16ToByte(UInt16 src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastUInt16ToUInt16(UInt16 src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastUInt16ToUInt32(UInt16 src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastUInt16ToUInt64(UInt16 src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastUInt16ToSByte(UInt16 src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastUInt16ToInt16(UInt16 src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastUInt16ToInt32(UInt16 src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastUInt16ToInt64(UInt16 src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastUInt16ToSingle(UInt16 src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastUInt16ToDouble(UInt16 src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastUInt32ToByte(UInt32 src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastUInt32ToUInt16(UInt32 src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastUInt32ToUInt32(UInt32 src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastUInt32ToUInt64(UInt32 src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastUInt32ToSByte(UInt32 src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastUInt32ToInt16(UInt32 src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastUInt32ToInt32(UInt32 src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastUInt32ToInt64(UInt32 src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastUInt32ToSingle(UInt32 src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastUInt32ToDouble(UInt32 src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastUInt64ToByte(UInt64 src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastUInt64ToUInt16(UInt64 src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastUInt64ToUInt32(UInt64 src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastUInt64ToUInt64(UInt64 src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastUInt64ToSByte(UInt64 src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastUInt64ToInt16(UInt64 src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastUInt64ToInt32(UInt64 src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastUInt64ToInt64(UInt64 src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastUInt64ToSingle(UInt64 src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastUInt64ToDouble(UInt64 src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastSByteToByte(SByte src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastSByteToUInt16(SByte src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastSByteToUInt32(SByte src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastSByteToUInt64(SByte src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastSByteToSByte(SByte src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastSByteToInt16(SByte src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastSByteToInt32(SByte src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastSByteToInt64(SByte src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastSByteToSingle(SByte src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastSByteToDouble(SByte src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastInt16ToByte(Int16 src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastInt16ToUInt16(Int16 src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastInt16ToUInt32(Int16 src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastInt16ToUInt64(Int16 src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastInt16ToSByte(Int16 src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastInt16ToInt16(Int16 src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastInt16ToInt32(Int16 src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastInt16ToInt64(Int16 src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastInt16ToSingle(Int16 src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastInt16ToDouble(Int16 src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastInt32ToByte(Int32 src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastInt32ToUInt16(Int32 src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastInt32ToUInt32(Int32 src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastInt32ToUInt64(Int32 src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastInt32ToSByte(Int32 src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastInt32ToInt16(Int32 src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastInt32ToInt32(Int32 src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastInt32ToInt64(Int32 src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastInt32ToSingle(Int32 src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastInt32ToDouble(Int32 src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastInt64ToByte(Int64 src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastInt64ToUInt16(Int64 src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastInt64ToUInt32(Int64 src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastInt64ToUInt64(Int64 src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastInt64ToSByte(Int64 src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastInt64ToInt16(Int64 src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastInt64ToInt32(Int64 src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastInt64ToInt64(Int64 src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastInt64ToSingle(Int64 src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastInt64ToDouble(Int64 src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastSingleToByte(Single src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastSingleToUInt16(Single src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastSingleToUInt32(Single src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastSingleToUInt64(Single src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastSingleToSByte(Single src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastSingleToInt16(Single src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastSingleToInt32(Single src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastSingleToInt64(Single src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastSingleToSingle(Single src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastSingleToDouble(Single src)
+ {
+ return (Double)src;
+ }
+
+
+ public static Byte CastDoubleToByte(Double src)
+ {
+ return (Byte)src;
+ }
+
+
+ public static UInt16 CastDoubleToUInt16(Double src)
+ {
+ return (UInt16)src;
+ }
+
+
+ public static UInt32 CastDoubleToUInt32(Double src)
+ {
+ return (UInt32)src;
+ }
+
+
+ public static UInt64 CastDoubleToUInt64(Double src)
+ {
+ return (UInt64)src;
+ }
+
+
+ public static SByte CastDoubleToSByte(Double src)
+ {
+ return (SByte)src;
+ }
+
+
+ public static Int16 CastDoubleToInt16(Double src)
+ {
+ return (Int16)src;
+ }
+
+
+ public static Int32 CastDoubleToInt32(Double src)
+ {
+ return (Int32)src;
+ }
+
+
+ public static Int64 CastDoubleToInt64(Double src)
+ {
+ return (Int64)src;
+ }
+
+
+ public static Single CastDoubleToSingle(Double src)
+ {
+ return (Single)src;
+ }
+
+
+ public static Double CastDoubleToDouble(Double src)
+ {
+ return (Double)src;
+ }
+
+
+ }
+}
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs.meta
new file mode 100644
index 00000000..ad81e1c3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ConcreteCast.g.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d15ce8227d1aec64ab3fd82c4b271747
+timeCreated: 1549025426
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs
new file mode 100644
index 00000000..d92f0d75
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs
@@ -0,0 +1,34 @@
+using System;
+
+
+namespace UniJSON
+{
+ public class TreeValueException : ArgumentException
+ {
+ protected TreeValueException(string msg) : base(msg) { }
+ }
+
+ /// <summary>
+ ///Exception failure
+ /// </summary>
+ public class ParserException : TreeValueException
+ {
+ public ParserException(string msg) : base(msg) { }
+ }
+
+ /// <summary>
+ /// Successfully parsed, but fail to getValue
+ /// </summary>
+ public class DeserializationException : TreeValueException
+ {
+ public DeserializationException(string msg) : base(msg) { }
+ }
+
+ /// <summary>
+ /// Formatter exception. key value violation
+ /// </summary>
+ public class FormatterException : TreeValueException
+ {
+ public FormatterException(string msg) : base(msg) { }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs.meta
new file mode 100644
index 00000000..20620ad0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Exceptions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d854b575d2e031f40b37a49e1bff8656
+timeCreated: 1545735558
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions.meta
new file mode 100644
index 00000000..c0f932bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 64b77fe68ca869c40b77ae2f19862579
+folderAsset: yes
+timeCreated: 1526057063
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs
new file mode 100644
index 00000000..b20b2b5c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public static class ArraySegmentExtensions
+ {
+ public static T[] ArrayOrCopy<T>(this ArraySegment<T> self)
+ {
+ if (self.Array == null || self.Count==0)
+ {
+ return new T[] { };
+ }
+ else if(self.Offset==0 && self.Count==self.Array.Length)
+ {
+ return self.Array;
+ }
+ else
+ {
+ var array = new T[self.Count];
+ Array.Copy(self.Array, self.Offset, array, 0, self.Count);
+ return array;
+ }
+ }
+
+ public static IEnumerable<T> ToEnumerable<T>(this ArraySegment<T> self)
+ {
+ return self.Array.Skip(self.Offset).Take(self.Count);
+ }
+
+ public static void Set<T>(this ArraySegment<T> self, int index, T value)
+ {
+ if (index < 0 || index >= self.Count)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ self.Array[self.Offset + index] = value;
+ }
+
+ public static T Get<T>(this ArraySegment<T> self, int index)
+ {
+ if (index < 0 || index >= self.Count)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ return self.Array[self.Offset + index];
+ }
+
+ public static ArraySegment<T> Advance<T>(this ArraySegment<T> self, Int32 n)
+ {
+ return new ArraySegment<T>(self.Array, self.Offset + n, self.Count - n);
+ }
+
+ public static ArraySegment<T> Take<T>(this ArraySegment<T> self, Int32 n)
+ {
+ return new ArraySegment<T>(self.Array, self.Offset, n);
+ }
+
+ public static T[] TakeReversedArray<T>(this ArraySegment<T> self, Int32 n)
+ {
+ var array = new T[n];
+ var x = n - 1;
+ for (int i = 0; i < n; ++i, --x)
+ {
+ array[i] = self.Get(x);
+ }
+ return array;
+ }
+
+ public static byte[] Concat(this byte[] lhs, ArraySegment<byte> rhs)
+ {
+ return new ArraySegment<byte>(lhs).Concat(rhs);
+ }
+
+ public static byte[] Concat(this ArraySegment<byte> lhs, ArraySegment<byte> rhs)
+ {
+ var bytes = new byte[lhs.Count + rhs.Count];
+ Buffer.BlockCopy(lhs.Array, lhs.Offset, bytes, 0, lhs.Count);
+ Buffer.BlockCopy(rhs.Array, rhs.Offset, bytes, lhs.Count, rhs.Count);
+ return bytes;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs.meta
new file mode 100644
index 00000000..d6c810e4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ArraySegmentExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 12d3e22e2e62d4948a5aff4bc42208e9
+timeCreated: 1495517072
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs
new file mode 100644
index 00000000..72494a2d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs
@@ -0,0 +1,60 @@
+using System;
+using System.IO;
+
+namespace UniJSON
+{
+ public static class ByteExtensions
+ {
+ public static Byte GetHexDigit(this UInt16 n, int index)
+ {
+ return (Byte)(n >> 8 * index & 0xff);
+ }
+ public static Byte GetHexDigit(this UInt32 n, int index)
+ {
+ return (Byte)(n >> 8 * index & 0xff);
+ }
+ public static Byte GetHexDigit(this UInt64 n, int index)
+ {
+ return (Byte)(n >> 8 * index & 0xff);
+ }
+ public static Byte GetHexDigit(this Int16 n, int index)
+ {
+ return (Byte)(n >> 8 * index & 0xff);
+ }
+ public static Byte GetHexDigit(this Int32 n, int index)
+ {
+ return (Byte)(n >> 8 * index & 0xff);
+ }
+ public static Byte GetHexDigit(this Int64 n, int index)
+ {
+ return (Byte)(n >> 8 * index & 0xff);
+ }
+
+ public static UInt32 ToUint32(this Single n, Byte[] buffer)
+ {
+ if (buffer.Length < 4)
+ {
+ throw new ArgumentException();
+ }
+ using (var ms = new MemoryStream(buffer))
+ using (var w = new BinaryWriter(ms))
+ {
+ w.Write(n);
+ }
+ return BitConverter.ToUInt32(buffer, 0);
+ }
+ public static UInt64 ToUint64(this Double n, Byte[] buffer)
+ {
+ if (buffer.Length < 8)
+ {
+ throw new ArgumentException();
+ }
+ using (var ms = new MemoryStream(buffer))
+ using (var w = new BinaryWriter(ms))
+ {
+ w.Write(n);
+ }
+ return BitConverter.ToUInt64(buffer, 0);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs.meta
new file mode 100644
index 00000000..cb3e4ccf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ByteExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: aa32ad3ea4c1ec540a03225c0d520af9
+timeCreated: 1495517078
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs
new file mode 100644
index 00000000..faed3e4b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs
@@ -0,0 +1,23 @@
+using System;
+
+
+namespace UniJSON
+{
+ public static class DateTimeOffsetExtensions
+ {
+ public const long TicksPerSecond = 10000000;
+ public readonly static DateTimeOffset EpochTime = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
+ [Obsolete("Use EpochTime")]
+ public readonly static DateTimeOffset EpocTime = EpochTime;
+#if !NET_4_6 && !NET_STANDARD_2_0
+ public static long ToUnixTimeSeconds(this DateTimeOffset now)
+ {
+ if (now < EpochTime)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ return (now - EpochTime).Ticks / TicksPerSecond;
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs.meta
new file mode 100644
index 00000000..9aca1433
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/DateTimeOffsetExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d2fd687914fcde848ab36867817cb873
+timeCreated: 1544155597
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs
new file mode 100644
index 00000000..9cd8adbe
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs
@@ -0,0 +1,15 @@
+using System;
+
+
+namespace UniJSON
+{
+ public static class EnumExtensions
+ {
+ public static bool HasFlag(this Enum keys, Enum flag)
+ {
+ if (keys.GetType() != flag.GetType())
+ throw new ArgumentException("Type Mismatch");
+ return (Convert.ToUInt64(keys) & Convert.ToUInt64(flag)) != 0;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs.meta
new file mode 100644
index 00000000..c10223d1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/EnumExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d8691eccccb3e214db8bc5b86179f428
+timeCreated: 1526057070
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs
new file mode 100644
index 00000000..7caf664d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs
@@ -0,0 +1,52 @@
+using System;
+
+
+namespace UniJSON
+{
+ public static class StringExtensions
+ {
+ public static ListTreeNode<JsonValue> ParseAsJson(this string json)
+ {
+ return JsonParser.Parse(json);
+ }
+ public static ListTreeNode<JsonValue> ParseAsJson(this Utf8String json)
+ {
+ return JsonParser.Parse(json);
+ }
+ public static ListTreeNode<JsonValue> ParseAsJson(this byte[] bytes)
+ {
+ return JsonParser.Parse(new Utf8String(bytes));
+ }
+ public static ListTreeNode<JsonValue> ParseAsJson(this ArraySegment<byte> bytes)
+ {
+ return JsonParser.Parse(new Utf8String(bytes));
+ }
+
+ public static ListTreeNode<MsgPackValue> ParseAsMsgPack(this byte[] bytes)
+ {
+ return MsgPackParser.Parse(bytes);
+ }
+ public static ListTreeNode<MsgPackValue> ParseAsMsgPack(this ArraySegment<byte> bytes)
+ {
+ return MsgPackParser.Parse(bytes);
+ }
+
+ public static ListTreeNode<TomlValue> ParseAsToml(this string toml)
+ {
+ return TomlParser.Parse(toml);
+ }
+ public static ListTreeNode<TomlValue> ParseAsToml(this Utf8String toml)
+ {
+ return TomlParser.Parse(toml);
+ }
+ public static ListTreeNode<TomlValue> ParseAsToml(this byte[] bytes)
+ {
+ return TomlParser.Parse(new Utf8String(bytes));
+ }
+ public static ListTreeNode<TomlValue> ParseAsToml(this ArraySegment<byte> bytes)
+ {
+ return TomlParser.Parse(new Utf8String(bytes));
+ }
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs.meta
new file mode 100644
index 00000000..18343d27
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/ParserExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c25e655e5dc993145a70d9ddde6a6034
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs
new file mode 100644
index 00000000..164e7899
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public static class TypeExtensions
+ {
+ public static bool GetIsGenericList(this Type t)
+ {
+ if (t == null) return false;
+
+ return t.IsGenericType
+ && (t.GetGenericTypeDefinition() == typeof(List<>));
+ }
+
+ public static bool GetIsGenericDictionary(this Type t)
+ {
+ if (t == null) return false;
+
+ return t.IsGenericType
+ && (t.GetGenericTypeDefinition() == typeof(Dictionary<,>)
+ && t.GetGenericArguments().FirstOrDefault() == typeof(string)
+ );
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs.meta
new file mode 100644
index 00000000..d5228277
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Extensions/TypeExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2fb728ca27f90c947890313df5f94d4d
+timeCreated: 1531634657
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs
new file mode 100644
index 00000000..c9b939e1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Linq;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static partial class FormatterExtensions
+ {
+ public static ArraySegment<Byte> GetStoreBytes(this IFormatter f)
+ {
+ return f.GetStore().Bytes;
+ }
+
+ public static void Key(this IFormatter f, string x)
+ {
+ f.Key(Utf8String.From(x));
+ }
+
+ public static void Value(this IFormatter f, IEnumerable<byte> raw, int count)
+ {
+ f.Value(new ArraySegment<byte>(raw.Take(count).ToArray()));
+ }
+
+ public static void Value(this IFormatter f, Byte[] bytes)
+ {
+ f.Value(new ArraySegment<Byte>(bytes));
+ }
+
+ public static void Value(this IFormatter f, UnityEngine.Vector2 v)
+ {
+ //CommaCheck();
+ f.BeginMap(2);
+ f.Key("x"); f.Value(v.x);
+ f.Key("y"); f.Value(v.y);
+ f.EndMap();
+ }
+
+ public static void Value(this IFormatter f, UnityEngine.Vector3 v)
+ {
+ //CommaCheck();
+ f.BeginMap(3);
+ f.Key("x"); f.Value(v.x);
+ f.Key("y"); f.Value(v.y);
+ f.Key("z"); f.Value(v.z);
+ f.EndMap();
+ }
+
+ public static void Value(this IFormatter f, UnityEngine.Vector4 v)
+ {
+ //CommaCheck();
+ f.BeginMap(4);
+ f.Key("x"); f.Value(v.x);
+ f.Key("y"); f.Value(v.y);
+ f.Key("z"); f.Value(v.z);
+ f.Key("w"); f.Value(v.w);
+ f.EndMap();
+ }
+
+ static MethodInfo GetMethod<T>(Expression<Func<T>> expression)
+ {
+ var method = typeof(FormatterExtensions).GetMethod("Serialize");
+ return method.MakeGenericMethod(typeof(T));
+ }
+
+ //
+ // https://stackoverflow.com/questions/238765/given-a-type-expressiontype-memberaccess-how-do-i-get-the-field-value
+ //
+ public static void KeyValue<T>(this IFormatter f, Expression<Func<T>> expression)
+ {
+ // lambda body
+ var lambdaBody = (MemberExpression)expression.Body;
+
+ if (lambdaBody.Expression.NodeType == ExpressionType.Constant)
+ {
+ //
+ // KeyValue(() => Field);
+ //
+ var constant = (ConstantExpression)lambdaBody.Expression;
+ var field = (FieldInfo)lambdaBody.Member;
+ var value = field.GetValue(constant.Value);
+ if (value != null)
+ {
+ f.Key(lambdaBody.Member.Name);
+ f.Serialize(value);
+ }
+ }
+ else
+ {
+ //
+ // KeyValue(() => p.Field);
+ //
+ var capture = (MemberExpression)lambdaBody.Expression;
+
+ var captureVariable = (ConstantExpression)capture.Expression;
+ var captureObj = captureVariable.Value;
+ var captureField = (FieldInfo)capture.Member;
+ var captureValue = captureField.GetValue(captureObj);
+
+ var field = (FieldInfo)lambdaBody.Member;
+
+ var value = field.GetValue(captureValue);
+ if (value != null)
+ {
+ f.Key(field.Name);
+ f.Serialize(value);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs.meta
new file mode 100644
index 00000000..86e650ac
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: eb87cc122742d7544b818c171b15f746
+timeCreated: 1540812583
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs
new file mode 100644
index 00000000..53d89b67
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs
@@ -0,0 +1,176 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static class FormatterExtensionsSerializer
+ {
+ public static void SerializeDictionary(this IFormatter f, IDictionary<string, object> dictionary)
+ {
+ f.BeginMap(dictionary.Count);
+ foreach (var kv in dictionary)
+ {
+ f.Key(kv.Key);
+ f.SerializeObject(kv.Value);
+ }
+ f.EndMap();
+ }
+
+ public static void SerializeArray<T>(this IFormatter f, IEnumerable<T> values)
+ {
+ f.BeginList(values.Count());
+ foreach (var value in values)
+ {
+ f.Serialize(value);
+ }
+ f.EndList();
+ }
+
+ public static void SerializeObjectArray(this IFormatter f, object[] array)
+ {
+ f.BeginList(array.Length);
+ foreach (var x in array)
+ {
+ f.SerializeObject(x);
+ }
+ f.EndList();
+ }
+
+ public static void SerializeObject(this IFormatter f, object value)
+ {
+ if (value == null)
+ {
+ f.Null();
+ }
+ else
+ {
+ typeof(FormatterExtensionsSerializer).GetMethod("Serialize")
+ .MakeGenericMethod(value.GetType()).Invoke(null, new object[] { f, value });
+ }
+ }
+
+ public static void Serialize<T>(this IFormatter f, T arg)
+ {
+ if (arg == null)
+ {
+ f.Null();
+ return;
+ }
+
+ GenericSerializer<T>.Serialize(f, arg);
+ }
+
+ public static void SetCustomSerializer<T>(Action<IFormatter, T> serializer)
+ {
+ GenericSerializer<T>.Set(serializer);
+ }
+
+ public static MethodInfo GetMethod(string name)
+ {
+ return typeof(FormatterExtensionsSerializer).GetMethod(name);
+ }
+ }
+
+ static class GenericSerializer<T>
+ {
+ delegate void Serializer(IFormatter f, T t);
+
+ static Action<IFormatter, T> GetSerializer()
+ {
+ var t = typeof(T);
+
+ // object
+ if (typeof(T) == typeof(object) && t.GetType() != typeof(object))
+ {
+ var mi = FormatterExtensionsSerializer.GetMethod("SerializeObject");
+ return GenericInvokeCallFactory.StaticAction<IFormatter, T>(mi);
+ }
+
+ try
+ {
+ // primitive
+ var mi = typeof(IFormatter).GetMethod("Value", new Type[] { t });
+ if (mi != null)
+ {
+ return GenericInvokeCallFactory.OpenAction<IFormatter, T>(mi);
+ }
+ }
+ catch (AmbiguousMatchException)
+ {
+ // do nothing
+ }
+
+ {
+ // dictionary
+ var idictionary = t.GetInterfaces().FirstOrDefault(x =>
+ x.IsGenericType
+ && x.GetGenericTypeDefinition() == typeof(IDictionary<,>)
+ && x.GetGenericArguments()[0] == typeof(string)
+ );
+ if (idictionary != null)
+ {
+ var mi = FormatterExtensionsSerializer.GetMethod("SerializeDictionary");
+ return GenericInvokeCallFactory.StaticAction<IFormatter, T>(mi);
+ }
+ }
+
+ {
+ // object[]
+ if (t == typeof(object[]))
+ {
+ var mi = FormatterExtensionsSerializer.GetMethod("SerializeObjectArray");
+ return GenericInvokeCallFactory.StaticAction<IFormatter, T>(mi);
+ }
+ }
+
+ {
+ // list
+ var ienumerable = t.GetInterfaces().FirstOrDefault(x =>
+ x.IsGenericType
+ && x.GetGenericTypeDefinition() == typeof(IEnumerable<>)
+ );
+ if (ienumerable != null)
+ {
+ var g = FormatterExtensionsSerializer.GetMethod("SerializeArray");
+ var mi = g.MakeGenericMethod(ienumerable.GetGenericArguments());
+ return GenericInvokeCallFactory.StaticAction<IFormatter, T>(mi);
+ }
+ }
+
+ {
+ // reflection
+ var schema = JsonSchema.FromType<T>();
+ return (IFormatter f, T value) =>
+ {
+ var c = new JsonSchemaValidationContext(value)
+ {
+ EnableDiagnosisForNotRequiredFields = true
+ };
+ schema.Serialize(f, value, c);
+ };
+ }
+
+
+ //throw new NotImplementedException();
+ }
+
+ static Serializer s_serializer;
+
+ public static void Set(Action<IFormatter, T> serializer)
+ {
+ s_serializer = new Serializer(serializer);
+ }
+
+ public static void Serialize(IFormatter f, T t)
+ {
+ if (s_serializer == null)
+ {
+ s_serializer = new Serializer(GetSerializer());
+ }
+ s_serializer(f, t);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs.meta
new file mode 100644
index 00000000..a0422f7e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/FormatterExtensionsSerializer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 11342b30ed6802d4ebccbcf85663c6a0
+timeCreated: 1543520703
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility.meta
new file mode 100644
index 00000000..dc2833ab
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1a508fceebf4ef64ca956059360b2467
+folderAsset: yes
+timeCreated: 1548656168
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs
new file mode 100644
index 00000000..d644936e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs
@@ -0,0 +1,119 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Text;
+#if UNITY_EDITOR
+using UnityEditor;
+using UnityEngine;
+#endif
+
+
+namespace UniJSON
+{
+ public static partial class GenericExpressionCallFactory
+ {
+#if UNITY_EDITOR && VRM_DEVELOP
+ const int NET35MAX = 4;
+ const int ARGS = 6;
+ const string GENERATE_PATH = "/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs";
+
+ static System.Collections.Generic.IEnumerable<string> GetArgs(string prefix, int n)
+ {
+ for (int i = 0; i < n; ++i)
+ {
+ yield return prefix + i;
+ }
+ }
+
+ [MenuItem("VRM/UniJSON/Generate GenericExpressionCallFactory")]
+ static void Generate()
+ {
+ var sb = new StringBuilder();
+ using (var w = new StringWriter(sb))
+ {
+ w.WriteLine(@"
+using System;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static partial class GenericExpressionCallFactory
+ {
+");
+ // Create
+ for (int i = 1; i <= ARGS && i<NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Action<S, $0> Create<S, $0>(MethodInfo m)
+ {
+ var self = Expression.Parameter(m.DeclaringType, m.Name);
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ var call = Expression.Call(self, m, args);
+ return
+ (Action<S, $0>)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile();
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+ }
+
+ // CreateWithThis
+ for (int i = 1; i <= ARGS && i<=NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+
+ var source = @"
+ public static Action<$0> CreateWithThis<S, $0>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ if (instance != null)
+ {
+ throw new ArgumentException();
+ }
+ }
+ else
+ {
+ if (instance == null)
+ {
+ throw new ArgumentNullException();
+ }
+ }
+
+ var self = Expression.Constant(instance, typeof(S)); // thisを定数化
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ MethodCallExpression call;
+ if (m.IsStatic)
+ {
+ call = Expression.Call(m, args);
+ }
+ else
+ {
+ call = Expression.Call(self, m, args);
+ }
+ return
+ (Action<$0>)Expression.Lambda(call, args).Compile();
+ }
+".Replace("$0", g);
+
+ w.WriteLine(source);
+ }
+
+ w.WriteLine(@"
+ }
+}
+");
+ }
+
+ var path = Path.GetFullPath(Application.dataPath + GENERATE_PATH).Replace("\\", "/");
+ File.WriteAllText(path, sb.ToString().Replace("\r\n", "\n"));
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs.meta
new file mode 100644
index 00000000..85eef34b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 93b8e65929169944e823bc9a95c8a1ed
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs
new file mode 100644
index 00000000..5415ced5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs
@@ -0,0 +1,178 @@
+
+using System;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static partial class GenericExpressionCallFactory
+ {
+
+
+ public static Action<S, A0> Create<S, A0>(MethodInfo m)
+ {
+ var self = Expression.Parameter(m.DeclaringType, m.Name);
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ var call = Expression.Call(self, m, args);
+ return
+ (Action<S, A0>)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile();
+ }
+
+
+ public static Action<S, A0, A1> Create<S, A0, A1>(MethodInfo m)
+ {
+ var self = Expression.Parameter(m.DeclaringType, m.Name);
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ var call = Expression.Call(self, m, args);
+ return
+ (Action<S, A0, A1>)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile();
+ }
+
+
+ public static Action<S, A0, A1, A2> Create<S, A0, A1, A2>(MethodInfo m)
+ {
+ var self = Expression.Parameter(m.DeclaringType, m.Name);
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ var call = Expression.Call(self, m, args);
+ return
+ (Action<S, A0, A1, A2>)Expression.Lambda(call, new[] { self }.Concat(args).ToArray()).Compile();
+ }
+
+
+ public static Action<A0> CreateWithThis<S, A0>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ if (instance != null)
+ {
+ throw new ArgumentException();
+ }
+ }
+ else
+ {
+ if (instance == null)
+ {
+ throw new ArgumentNullException();
+ }
+ }
+
+ var self = Expression.Constant(instance, typeof(S)); // thisを定数化
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ MethodCallExpression call;
+ if (m.IsStatic)
+ {
+ call = Expression.Call(m, args);
+ }
+ else
+ {
+ call = Expression.Call(self, m, args);
+ }
+ return
+ (Action<A0>)Expression.Lambda(call, args).Compile();
+ }
+
+
+ public static Action<A0, A1> CreateWithThis<S, A0, A1>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ if (instance != null)
+ {
+ throw new ArgumentException();
+ }
+ }
+ else
+ {
+ if (instance == null)
+ {
+ throw new ArgumentNullException();
+ }
+ }
+
+ var self = Expression.Constant(instance, typeof(S)); // thisを定数化
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ MethodCallExpression call;
+ if (m.IsStatic)
+ {
+ call = Expression.Call(m, args);
+ }
+ else
+ {
+ call = Expression.Call(self, m, args);
+ }
+ return
+ (Action<A0, A1>)Expression.Lambda(call, args).Compile();
+ }
+
+
+ public static Action<A0, A1, A2> CreateWithThis<S, A0, A1, A2>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ if (instance != null)
+ {
+ throw new ArgumentException();
+ }
+ }
+ else
+ {
+ if (instance == null)
+ {
+ throw new ArgumentNullException();
+ }
+ }
+
+ var self = Expression.Constant(instance, typeof(S)); // thisを定数化
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ MethodCallExpression call;
+ if (m.IsStatic)
+ {
+ call = Expression.Call(m, args);
+ }
+ else
+ {
+ call = Expression.Call(self, m, args);
+ }
+ return
+ (Action<A0, A1, A2>)Expression.Lambda(call, args).Compile();
+ }
+
+
+ public static Action<A0, A1, A2, A3> CreateWithThis<S, A0, A1, A2, A3>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ if (instance != null)
+ {
+ throw new ArgumentException();
+ }
+ }
+ else
+ {
+ if (instance == null)
+ {
+ throw new ArgumentNullException();
+ }
+ }
+
+ var self = Expression.Constant(instance, typeof(S)); // thisを定数化
+ var args = m.GetParameters().Select(x => Expression.Parameter(x.ParameterType, x.Name)).ToArray();
+ MethodCallExpression call;
+ if (m.IsStatic)
+ {
+ call = Expression.Call(m, args);
+ }
+ else
+ {
+ call = Expression.Call(self, m, args);
+ }
+ return
+ (Action<A0, A1, A2, A3>)Expression.Lambda(call, args).Compile();
+ }
+
+
+ }
+}
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs.meta
new file mode 100644
index 00000000..50a6f0d2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericExpressionCallFactory.g.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cf88d89ec3acdbf4eb44842ed15aaff4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs
new file mode 100644
index 00000000..c5022bb9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs
@@ -0,0 +1,274 @@
+using System;
+using System.Reflection;
+using UnityEngine;
+#if UNITY_EDITOR && VRM_DEVELOP
+using System.IO;
+using System.Linq;
+using System.Text;
+using UnityEditor;
+#endif
+
+
+namespace UniJSON
+{
+ /// <summary>
+ /// MethodInfoからDelegateを作成する
+ ///
+ /// * StaticAction/Func StaticMethod呼び出し
+ /// * OpenAction/Func 第1引数にthisを受けるメソッド呼び出し
+ /// * BindAction/Func thisを内部に保持したメソッド呼び出し
+ ///
+ /// </summary>
+ public static partial class GenericInvokeCallFactory
+ {
+#if UNITY_EDITOR && VRM_DEVELOP
+ const int NET35MAX = 4;
+ const int ARGS = 6;
+ const string GENERATE_PATH = "/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs";
+
+ static System.Collections.Generic.IEnumerable<string> GetArgs(string prefix, int n)
+ {
+ for (int i = 0; i < n; ++i)
+ {
+ yield return prefix + i;
+ }
+ }
+
+ [MenuItem("VRM/UniJSON/Generate GenericInvokeCallFactory")]
+ static void Generate()
+ {
+ var sb = new StringBuilder();
+ using (var w = new StringWriter(sb))
+ {
+ w.WriteLine(@"
+using System;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static partial class GenericInvokeCallFactory
+ {
+");
+
+ // StaticAction
+ w.WriteLine("//////////// StaticAction");
+ for (int i = 1; i <= ARGS && i <= NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Action<$0> StaticAction<$0>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format(""{0} is not static"", m));
+ }
+
+ return (Action<$0>)Delegate.CreateDelegate(typeof(Action<$0>), null, m);
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+
+ }
+
+ // OpenAction
+ w.WriteLine("//////////// OpenAction");
+ for (int i = 1; i <= ARGS && i < NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Action<S, $0> OpenAction<S, $0>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format(""{0} is static"", m));
+ }
+
+ return (Action<S, $0>)Delegate.CreateDelegate(typeof(Action<S, $0>), m);
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+
+ }
+
+ // BindAction
+ w.WriteLine("//////////// BindAction");
+ for (int i = 1; i <= ARGS && i <= NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Action<$0> BindAction<S, $0>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format(""{0} is static"", m));
+ }
+
+ return (Action<$0>)Delegate.CreateDelegate(typeof(Action<$0>), instance, m);
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+
+ }
+
+ // StaticFunc
+ w.WriteLine("//////////// StaticFunc");
+ for (int i = 1; i <= ARGS && i <= NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Func<$0, T> StaticFunc<$0, T>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format(""{0} is not static"", m));
+ }
+
+ return (Func<$0, T>)Delegate.CreateDelegate(typeof(Func<$0, T>), null, m);
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+
+ }
+
+ // OpenFunc
+ w.WriteLine("//////////// OpenFunc");
+ for (int i = 1; i <= ARGS && i < NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Func<S, $0, T> OpenFunc<S, $0, T>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format(""{0} is static"", m));
+ }
+
+ return (Func<S, $0, T>)Delegate.CreateDelegate(typeof(Func<S, $0, T>), m);
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+
+ }
+
+ // BindFunc
+ w.WriteLine("//////////// BindFunc");
+ for (int i = 1; i <= ARGS && i <= NET35MAX; ++i)
+ {
+ var g = String.Join(", ", GetArgs("A", i).ToArray());
+ var a = String.Join(", ", GetArgs("a", i).ToArray());
+
+ var source = @"
+ public static Func<$0, T> BindFunc<S, $0, T>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format(""{0} is static"", m));
+ }
+
+ return (Func<$0, T>)Delegate.CreateDelegate(typeof(Func<$0, T>), instance, m);
+ }
+".Replace("$0", g).Replace("$1", a);
+
+ w.WriteLine(source);
+
+ }
+
+
+ w.WriteLine(@"
+ }
+}
+");
+ }
+
+ var path = Path.GetFullPath(Application.dataPath + GENERATE_PATH).Replace("\\", "/");
+ File.WriteAllText(path, sb.ToString().Replace("\r\n", "\n"));
+ }
+#endif
+
+ #region Action without arguments
+ public static Action StaticAction(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (Action)Delegate.CreateDelegate(typeof(Action), null, m);
+ }
+
+ public static Action<S> OpenAction<S>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (s) =>
+ {
+ m.Invoke(s, new object[] { });
+ };
+ }
+
+ public static Action BindAction<S>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return () =>
+ {
+ m.Invoke(instance, new object[] { });
+ };
+ }
+ #endregion
+
+ #region Func without arguments
+ public static Func<T> StaticFunc<T>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return () => (T)m.Invoke(null, new object[] { });
+ }
+
+ public static Func<S, T> OpenFunc<S, T>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (s) => (T)m.Invoke(s, new object[] { });
+ }
+
+ public static Func<T> BindFunc<S, T>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return () => (T)m.Invoke(instance, new object[] { });
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs.meta
new file mode 100644
index 00000000..7510665d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b4bdb47bf29e1214a9e3da9b4ae9f31e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs
new file mode 100644
index 00000000..88024387
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs
@@ -0,0 +1,262 @@
+
+using System;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static partial class GenericInvokeCallFactory
+ {
+
+//////////// StaticAction
+
+ public static Action<A0> StaticAction<A0>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (Action<A0>)Delegate.CreateDelegate(typeof(Action<A0>), null, m);
+ }
+
+
+ public static Action<A0, A1> StaticAction<A0, A1>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (Action<A0, A1>)Delegate.CreateDelegate(typeof(Action<A0, A1>), null, m);
+ }
+
+
+ public static Action<A0, A1, A2> StaticAction<A0, A1, A2>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (Action<A0, A1, A2>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2>), null, m);
+ }
+
+
+ public static Action<A0, A1, A2, A3> StaticAction<A0, A1, A2, A3>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (Action<A0, A1, A2, A3>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2, A3>), null, m);
+ }
+
+//////////// OpenAction
+
+ public static Action<S, A0> OpenAction<S, A0>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<S, A0>)Delegate.CreateDelegate(typeof(Action<S, A0>), m);
+ }
+
+
+ public static Action<S, A0, A1> OpenAction<S, A0, A1>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<S, A0, A1>)Delegate.CreateDelegate(typeof(Action<S, A0, A1>), m);
+ }
+
+
+ public static Action<S, A0, A1, A2> OpenAction<S, A0, A1, A2>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<S, A0, A1, A2>)Delegate.CreateDelegate(typeof(Action<S, A0, A1, A2>), m);
+ }
+
+//////////// BindAction
+
+ public static Action<A0> BindAction<S, A0>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<A0>)Delegate.CreateDelegate(typeof(Action<A0>), instance, m);
+ }
+
+
+ public static Action<A0, A1> BindAction<S, A0, A1>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<A0, A1>)Delegate.CreateDelegate(typeof(Action<A0, A1>), instance, m);
+ }
+
+
+ public static Action<A0, A1, A2> BindAction<S, A0, A1, A2>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<A0, A1, A2>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2>), instance, m);
+ }
+
+
+ public static Action<A0, A1, A2, A3> BindAction<S, A0, A1, A2, A3>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (Action<A0, A1, A2, A3>)Delegate.CreateDelegate(typeof(Action<A0, A1, A2, A3>), instance, m);
+ }
+
+//////////// StaticFunc
+
+ public static Func<A0, T> StaticFunc<A0, T>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (a0) => (T)m.Invoke(null, new object[] { a0 });
+ }
+
+
+ public static Func<A0, A1, T> StaticFunc<A0, A1, T>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (a0, a1) => (T)m.Invoke(null, new object[] { a0, a1 });
+ }
+
+
+ public static Func<A0, A1, A2, T> StaticFunc<A0, A1, A2, T>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (a0, a1, a2) => (T)m.Invoke(null, new object[] { a0, a1, a2 });
+ }
+
+
+ public static Func<A0, A1, A2, A3, T> StaticFunc<A0, A1, A2, A3, T>(MethodInfo m)
+ {
+ if (!m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is not static", m));
+ }
+
+ return (a0, a1, a2, a3) => (T)m.Invoke(null, new object[] { a0, a1, a2, a3 });
+ }
+
+//////////// OpenFunc
+
+ public static Func<S, A0, T> OpenFunc<S, A0, T>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (s, a0) => (T)m.Invoke(s, new object[] { a0 });
+ }
+
+
+ public static Func<S, A0, A1, T> OpenFunc<S, A0, A1, T>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (s, a0, a1) => (T)m.Invoke(s, new object[] { a0, a1 });
+ }
+
+
+ public static Func<S, A0, A1, A2, T> OpenFunc<S, A0, A1, A2, T>(MethodInfo m)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (s, a0, a1, a2) => (T)m.Invoke(s, new object[] { a0, a1, a2 });
+ }
+
+//////////// BindFunc
+
+ public static Func<A0, T> BindFunc<S, A0, T>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (a0) => (T)m.Invoke(instance, new object[] { a0 });
+ }
+
+
+ public static Func<A0, A1, T> BindFunc<S, A0, A1, T>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (a0, a1) => (T)m.Invoke(instance, new object[] { a0, a1 });
+ }
+
+
+ public static Func<A0, A1, A2, T> BindFunc<S, A0, A1, A2, T>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (a0, a1, a2) => (T)m.Invoke(instance, new object[] { a0, a1, a2 });
+ }
+
+
+ public static Func<A0, A1, A2, A3, T> BindFunc<S, A0, A1, A2, A3, T>(MethodInfo m, S instance)
+ {
+ if (m.IsStatic)
+ {
+ throw new ArgumentException(string.Format("{0} is static", m));
+ }
+
+ return (a0, a1, a2, a3) => (T)m.Invoke(instance, new object[] { a0, a1, a2, a3 });
+ }
+
+
+ }
+}
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs.meta
new file mode 100644
index 00000000..5ce58d61
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCallUtility/GenericInvokeCallFactory.g.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 56dfdc21f4d594143ab023e6bd171f91
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs
new file mode 100644
index 00000000..fafc29bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs
@@ -0,0 +1,72 @@
+using System;
+
+
+namespace UniJSON
+{
+ struct GenericCast<S, T>
+ {
+ public static T Null()
+ {
+ if (typeof(T).IsClass)
+ {
+ return default(T);
+ }
+ else
+ {
+ throw new MsgPackTypeException("can not null");
+ }
+ }
+
+ delegate T CastFunc(S value);
+ static CastFunc s_cast;
+
+ delegate Func<T> ConstFuncCreator(S value);
+ static ConstFuncCreator s_const;
+
+ public static Func<T> Const(S value)
+ {
+ if (s_const == null)
+ {
+ s_const = new ConstFuncCreator(GenericCast.CreateConst<S, T>());
+ }
+ return s_const(value);
+ }
+
+ public static T Cast(S value)
+ {
+ if (s_cast == null)
+ {
+ s_cast = new CastFunc(GenericCast.CreateCast<S, T>());
+ }
+ return s_cast(value);
+ }
+ }
+
+ static partial class GenericCast
+ {
+ public static Func<S, T> CreateCast<S, T>()
+ {
+ var mi = ConcreteCast.GetMethod(typeof(S), typeof(T));
+ if (mi == null)
+ {
+ return (Func<S, T>)((S s) =>
+ {
+ return (T)(object)s;
+ });
+ }
+ else
+ {
+ return GenericInvokeCallFactory.StaticFunc<S, T>(mi);
+ }
+ }
+
+ public static Func<S, Func<T>> CreateConst<S, T>()
+ {
+ var cast = CreateCast<S, T>();
+ return (Func<S, Func<T>>)((S s) =>
+ {
+ return (Func<T>)(() => cast(s));
+ });
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs.meta
new file mode 100644
index 00000000..d653d7ef
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericCast.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5e1cb5b0419b4a04da69e90f4890c349
+timeCreated: 1545134074
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs
new file mode 100644
index 00000000..003044ed
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ struct GenericConstructor<T, U>
+ where T : IListTreeItem, IValue<T>
+ {
+ static V[] ArrayCreator<V>(ListTreeNode<T> src)
+ {
+ if (!src.IsArray())
+ {
+ throw new ArgumentException("value is not array");
+ }
+ var count = src.GetArrayCount();
+ return new V[count];
+ }
+
+ static Func<ListTreeNode<T>, U> GetCreator()
+ {
+ var t = typeof(U);
+ if (t.IsArray)
+ {
+ var mi = typeof(GenericConstructor<T, U>).GetMethod("ArrayCreator",
+ BindingFlags.NonPublic | BindingFlags.Static);
+ var g = mi.MakeGenericMethod(t.GetElementType());
+ return GenericInvokeCallFactory.StaticFunc<ListTreeNode<T>, U>(g);
+ }
+
+ {
+ return _s =>
+ {
+ return Activator.CreateInstance<U>();
+ };
+ }
+ }
+
+ delegate U Creator(ListTreeNode<T> src);
+
+ static Creator s_creator;
+
+ public U Create(ListTreeNode<T> src)
+ {
+ if (s_creator == null)
+ {
+ var d = GetCreator();
+ s_creator = new Creator(d);
+ }
+ return s_creator(src);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs.meta
new file mode 100644
index 00000000..dff4825a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericConstructor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6121925cab5acc54bbb0e0e213783394
+timeCreated: 1549447177
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs
new file mode 100644
index 00000000..d5fa043b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs
@@ -0,0 +1,256 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static class GenericDeserializer<T, U>
+ where T : IListTreeItem, IValue<T>
+ {
+ public static V[] GenericArrayDeserializer<V>(ListTreeNode<T> s)
+ {
+ if (!s.IsArray())
+ {
+ throw new ArgumentException("not array: " + s.Value.ValueType);
+ }
+ var u = new V[s.GetArrayCount()];
+ int i = 0;
+ foreach (var x in s.ArrayItems())
+ {
+ x.Deserialize(ref u[i++]);
+ }
+ return u;
+ }
+
+ public static List<V> GenericListDeserializer<V>(ListTreeNode<T> s)
+ {
+ if (!s.IsArray())
+ {
+ throw new ArgumentException("not array: " + s.Value.ValueType);
+ }
+ var u = new List<V>(s.GetArrayCount());
+ foreach (var x in s.ArrayItems())
+ {
+ var e = default(V);
+ x.Deserialize(ref e);
+ u.Add(e);
+ }
+ return u;
+ }
+
+ public static object DefaultDictionaryDeserializer(ListTreeNode<T> s)
+ {
+ switch (s.Value.ValueType)
+ {
+ case ValueNodeType.Object:
+ {
+ var u = new Dictionary<string, object>();
+ foreach (var kv in s.ObjectItems())
+ {
+ //var e = default(object);
+ //kv.Value.Deserialize(ref e);
+ u.Add(kv.Key.GetString(), DefaultDictionaryDeserializer(kv.Value));
+ }
+ return u;
+ }
+
+ case ValueNodeType.Null:
+ return null;
+
+ case ValueNodeType.Boolean:
+ return s.GetBoolean();
+
+ case ValueNodeType.Integer:
+ return s.GetInt32();
+
+ case ValueNodeType.Number:
+ return s.GetDouble();
+
+ case ValueNodeType.String:
+ return s.GetString();
+
+ default:
+ throw new NotImplementedException(s.Value.ValueType.ToString());
+ }
+ }
+
+ /// <summary>
+ /// Deserialize Dictionary only string key
+ /// </summary>
+ /// <typeparam name="V"></typeparam>
+ /// <param name="s"></param>
+ /// <returns></returns>
+ public static Dictionary<string, V> DictionaryDeserializer<V>(ListTreeNode<T> s)
+ {
+ var d = new Dictionary<string, V>();
+ foreach (var kv in s.ObjectItems())
+ {
+ var value = default(V);
+ GenericDeserializer<T, V>.Deserialize(kv.Value, ref value);
+ d.Add(kv.Key.GetString(), value);
+ }
+ return d;
+ }
+
+ delegate void FieldSetter(ListTreeNode<T> s, object o);
+ static FieldSetter GetFieldDeserializer<V>(FieldInfo fi)
+ {
+ return (s, o) =>
+ {
+ var u = default(V);
+ s.Deserialize(ref u);
+ fi.SetValue(o, u);
+ };
+ }
+
+ static Func<ListTreeNode<T>, U> GetDeserializer()
+ {
+ // primitive
+ {
+ var mi = typeof(ListTreeNode<T>).GetMethods().FirstOrDefault(x =>
+ {
+ if (!x.Name.StartsWith("Get"))
+ {
+ return false;
+ }
+
+ if (!x.Name.EndsWith(typeof(U).Name))
+ {
+ return false;
+ }
+
+ var parameters = x.GetParameters();
+ if (parameters.Length != 0)
+ {
+ return false;
+ }
+
+ if (x.ReturnType != typeof(U))
+ {
+ return false;
+ }
+
+ return true;
+ });
+
+ if (mi != null)
+ {
+ return GenericInvokeCallFactory.StaticFunc<ListTreeNode<T>, U>(mi);
+ }
+ }
+
+ var target = typeof(U);
+
+ if (target.IsArray)
+ {
+ var mi = typeof(GenericDeserializer<T, U>).GetMethod("GenericArrayDeserializer",
+ BindingFlags.Static | BindingFlags.Public);
+ var g = mi.MakeGenericMethod(target.GetElementType());
+ return GenericInvokeCallFactory.StaticFunc<ListTreeNode<T>, U>(g);
+ }
+
+ if (target.IsGenericType)
+ {
+ if (target.GetGenericTypeDefinition() == typeof(List<>))
+ {
+ var mi = typeof(GenericDeserializer<T, U>).GetMethod("GenericListDeserializer",
+ BindingFlags.Static | BindingFlags.Public);
+ var g = mi.MakeGenericMethod(target.GetGenericArguments());
+ return GenericInvokeCallFactory.StaticFunc<ListTreeNode<T>, U>(g);
+ }
+
+ if (target == typeof(Dictionary<string, object>))
+ {
+
+ var mi = typeof(GenericDeserializer<T, U>).GetMethod("DefaultDictionaryDeserializer",
+ BindingFlags.Static | BindingFlags.Public);
+ return GenericInvokeCallFactory.StaticFunc<ListTreeNode<T>, U>(mi);
+ }
+ else
+ if (target.GetGenericTypeDefinition() == typeof(Dictionary<,>) &&
+ target.GetGenericArguments()[0] == typeof(string))
+ {
+ var mi = typeof(GenericDeserializer<T, U>).GetMethod("DictionaryDeserializer",
+ BindingFlags.Static | BindingFlags.Public);
+ var g = mi.MakeGenericMethod(target.GetGenericArguments()[1]);
+ return GenericInvokeCallFactory.StaticFunc<ListTreeNode<T>, U>(g);
+ }
+ }
+
+ {
+ var schema = JsonSchema.FromType<U>();
+ return s =>
+ {
+ var t = default(U);
+ schema.Validator.Deserialize(s, ref t);
+ return t;
+ };
+ }
+
+#if false
+ if (target.IsEnum)
+ {
+ var value = Expression.Parameter(typeof(int), "value");
+ var cast = Expression.Convert(value, target);
+ var func = Expression.Lambda(cast, value);
+ var compiled = (Func<int, T>)func.Compile();
+ return s =>
+ {
+ return compiled(s.GetInt32());
+ };
+ }
+
+ {
+ var fields = target.GetFields(BindingFlags.Instance | BindingFlags.Public);
+ var fieldDeserializers = fields.ToDictionary(x => Utf8String.From(x.Name), x =>
+ {
+ var mi = typeof(GenericDeserializer<S, T>).GetMethod("GetFieldDeserializer",
+ BindingFlags.Static|BindingFlags.NonPublic);
+ var g = mi.MakeGenericMethod(x.FieldType);
+ return (FieldSetter)g.Invoke(null, new object[] { x });
+ });
+
+ return (S s) =>
+ {
+ if (!s.IsMap())
+ {
+ throw new ArgumentException(s.ValueType.ToString());
+ }
+
+ var t = (object)default(GenericCreator<S, T>).Create(s);
+ foreach(var kv in s.ObjectItems())
+ {
+ FieldSetter setter;
+ if (fieldDeserializers.TryGetValue(kv.Key, out setter))
+ {
+ setter(kv.Value, t);
+ }
+ }
+ return (T)t;
+ };
+ }
+#endif
+ }
+
+ public delegate U Deserializer(ListTreeNode<T> node);
+
+ public static Deserializer s_deserializer;
+
+ public static void Deserialize(ListTreeNode<T> node, ref U value)
+ {
+ if (s_deserializer == null)
+ {
+ var d = GetDeserializer();
+ s_deserializer = new Deserializer(d);
+ }
+ value = s_deserializer(node);
+ }
+
+ public static void SetCustomDeserializer(Deserializer deserializer)
+ {
+ s_deserializer = deserializer;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs.meta
new file mode 100644
index 00000000..2efc295d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/GenericDeserializer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 74625bf2a3d6bc64d9d92b08221a8a3d
+timeCreated: 1549450914
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs
new file mode 100644
index 00000000..704ca86c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs
@@ -0,0 +1,53 @@
+using System.IO;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public interface IFileSystemAccessor
+ {
+ string ReadAllText();
+ string ReadAllText(string relativePath);
+ IFileSystemAccessor Get(string relativePath);
+ }
+
+ public class FileSystemAccessor : IFileSystemAccessor
+ {
+ string m_path;
+ string m_baseDir;
+ public FileSystemAccessor(string path)
+ {
+ m_path = path;
+ if (Directory.Exists(path))
+ {
+ m_baseDir = path;
+ }
+ else
+ {
+ m_baseDir = Path.GetDirectoryName(path);
+ }
+ }
+
+ public override string ToString()
+ {
+ return "<" + Path.GetFileName(m_path) + ">";
+ }
+
+ public string ReadAllText()
+ {
+ return File.ReadAllText(m_path, Encoding.UTF8);
+ }
+
+ public string ReadAllText(string relativePath)
+ {
+ var path = Path.Combine(m_baseDir, relativePath);
+ return File.ReadAllText(path, Encoding.UTF8);
+ }
+
+ public IFileSystemAccessor Get(string relativePath)
+ {
+ var path = Path.Combine(m_baseDir, relativePath);
+ return new FileSystemAccessor(path);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs.meta
new file mode 100644
index 00000000..823c7de7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFileSystemAccessor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 865a0727ffe095a40abbb2b8d799e720
+timeCreated: 1531504314
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs
new file mode 100644
index 00000000..101cfdd4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs
@@ -0,0 +1,43 @@
+using System;
+
+
+namespace UniJSON
+{
+ public interface IFormatter
+ {
+ IStore GetStore();
+ void Clear();
+
+ void BeginList(int n);
+ void EndList();
+
+ void BeginMap(int n);
+ void EndMap();
+
+ void Key(Utf8String x);
+
+ void Null();
+
+ void Value(Utf8String x);
+ void Value(String x);
+
+ void Value(ArraySegment<Byte> bytes);
+
+ void Value(Boolean x);
+
+ void Value(Byte x);
+ void Value(UInt16 x);
+ void Value(UInt32 x);
+ void Value(UInt64 x);
+
+ void Value(SByte x);
+ void Value(Int16 x);
+ void Value(Int32 x);
+ void Value(Int64 x);
+
+ void Value(Single x);
+ void Value(Double x);
+
+ void Value(DateTimeOffset x);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs.meta
new file mode 100644
index 00000000..48c1d76e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IFormatter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5fb858fc98e29c54d87df97ead98608e
+timeCreated: 1540812551
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore.meta
new file mode 100644
index 00000000..7cb52dbd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 2596156c052e9eb4d888f01f13445446
+folderAsset: yes
+timeCreated: 1531806172
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs
new file mode 100644
index 00000000..a83ea7f9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+
+namespace UniJSON
+{
+ public static class ByteUnion
+ {
+ [StructLayout(LayoutKind.Explicit)]
+ public struct WordValue
+ {
+ [FieldOffset(0)]
+ public Int16 Signed;
+ [FieldOffset(0)]
+ public UInt16 Unsigned;
+
+ [FieldOffset(0)]
+ public byte Byte0;
+ [FieldOffset(1)]
+ public byte Byte1;
+
+ public WordValue HostToNetworkOrder() { return new WordValue { Signed = IPAddress.HostToNetworkOrder(Signed) }; }
+
+ public static WordValue Create(Int16 value) { return new WordValue { Signed = value }; }
+ public static WordValue Create(UInt16 value) { return new WordValue { Unsigned = value }; }
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ public struct DWordValue
+ {
+ [FieldOffset(0)]
+ public Int32 Signed;
+ [FieldOffset(0)]
+ public UInt32 Unsigned;
+ [FieldOffset(0)]
+ public Single Float;
+
+ [FieldOffset(0)]
+ public byte Byte0;
+ [FieldOffset(1)]
+ public byte Byte1;
+ [FieldOffset(2)]
+ public byte Byte2;
+ [FieldOffset(3)]
+ public byte Byte3;
+
+ public DWordValue HostToNetworkOrder() { return new DWordValue { Signed = IPAddress.HostToNetworkOrder(Signed) }; }
+
+ public static DWordValue Create(Int32 value) { return new DWordValue { Signed = value }; }
+ public static DWordValue Create(UInt32 value) { return new DWordValue { Unsigned = value }; }
+ public static DWordValue Create(Single value) { return new DWordValue { Float = value }; }
+ }
+
+ [StructLayout(LayoutKind.Explicit)]
+ public struct QWordValue
+ {
+ [FieldOffset(0)]
+ public Int64 Signed;
+ [FieldOffset(0)]
+ public UInt64 Unsigned;
+ [FieldOffset(0)]
+ public Double Float;
+
+ [FieldOffset(0)]
+ public byte Byte0;
+ [FieldOffset(1)]
+ public byte Byte1;
+ [FieldOffset(2)]
+ public byte Byte2;
+ [FieldOffset(3)]
+ public byte Byte3;
+ [FieldOffset(4)]
+ public byte Byte4;
+ [FieldOffset(5)]
+ public byte Byte5;
+ [FieldOffset(6)]
+ public byte Byte6;
+ [FieldOffset(7)]
+ public byte Byte7;
+
+ public QWordValue HostToNetworkOrder()
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return new QWordValue
+ {
+ Byte0 = Byte7,
+ Byte1 = Byte6,
+ Byte2 = Byte5,
+ Byte3 = Byte4,
+ Byte4 = Byte3,
+ Byte5 = Byte2,
+ Byte6 = Byte1,
+ Byte7 = Byte0,
+ };
+ }
+ else
+ {
+ return this;
+ }
+ }
+
+ public static QWordValue Create(Int64 value) { return new QWordValue { Signed = value }; }
+ public static QWordValue Create(UInt64 value) { return new QWordValue { Unsigned = value }; }
+ public static QWordValue Create(Double value) { return new QWordValue { Float = value }; }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs.meta
new file mode 100644
index 00000000..5f5f6d7c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/ByteUnion.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 90602a3805f09cb46a2e25d5e9cb3cf4
+timeCreated: 1540907585
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs
new file mode 100644
index 00000000..67bfd151
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs
@@ -0,0 +1,288 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public class BytesStore : IStore
+ {
+ public BytesStore() : this(64)
+ { }
+
+ public BytesStore(int size) : this(new Byte[size])
+ { }
+
+ public BytesStore(Byte[] buffer)
+ {
+ m_buffer = buffer;
+ }
+
+ Byte[] m_buffer;
+ void Require(int size)
+ {
+ if (m_buffer == null)
+ {
+ m_buffer = new Byte[Math.Max(size, 1024)];
+ return;
+ }
+
+ if (m_pos + size < m_buffer.Length)
+ {
+ return;
+ }
+
+ var newSize = Math.Max(m_pos + size, m_buffer.Length * 2);
+ //Console.WriteLine(newSize);
+ var old = m_buffer;
+ m_buffer = new Byte[newSize];
+ Buffer.BlockCopy(old, 0
+ , m_buffer, 0, m_pos);
+ }
+
+ int m_pos;
+
+ public ArraySegment<byte> Bytes
+ {
+ get
+ {
+ return new ArraySegment<byte>(m_buffer, 0, m_pos);
+ }
+ }
+
+ public void Clear()
+ {
+ m_pos = 0;
+ }
+
+ char[] m_c = new char[1];
+ public void Write(char c)
+ {
+ if (c <= 0x7F)
+ {
+ // ascii
+ Require(1);
+ m_buffer[m_pos++] = (Byte)c;
+ return;
+ }
+
+ Require(3);
+ m_c[0] = c;
+ var size = Encoding.UTF8.GetBytes(m_c, 0, 1, m_buffer, m_pos);
+ m_pos += size;
+ }
+
+ public void Write(string src)
+ {
+ var size = Encoding.UTF8.GetByteCount(src);
+ Require(size);
+ var byteSize = Encoding.UTF8.GetBytes(src, 0, src.Length
+ , m_buffer, m_pos);
+ if (size != byteSize)
+ {
+ throw new Exception();
+ }
+ m_pos += byteSize;
+ }
+
+ public void Write(ArraySegment<byte> bytes)
+ {
+ Require(bytes.Count);
+ Array.Copy(bytes.Array, bytes.Offset
+ , m_buffer, m_pos, bytes.Count);
+ m_pos += bytes.Count;
+ }
+
+ public void Write(sbyte value)
+ {
+ Require(Marshal.SizeOf(value));
+ m_buffer[m_pos++] = (Byte)value;
+ }
+
+ public void Write(byte value)
+ {
+ Require(Marshal.SizeOf(value));
+ m_buffer[m_pos++] = value;
+ }
+
+ #region LittleEndian
+ public void WriteLittleEndian(short value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.WordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ }
+
+ public void WriteLittleEndian(int value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.DWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte3;
+ }
+
+ public void WriteLittleEndian(long value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.QWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte4;
+ m_buffer[m_pos++] = u.Byte5;
+ m_buffer[m_pos++] = u.Byte6;
+ m_buffer[m_pos++] = u.Byte7;
+ }
+
+ public void WriteLittleEndian(ushort value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.WordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ }
+
+ public void WriteLittleEndian(uint value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.DWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte3;
+ }
+
+ public void WriteLittleEndian(ulong value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.QWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte4;
+ m_buffer[m_pos++] = u.Byte5;
+ m_buffer[m_pos++] = u.Byte6;
+ m_buffer[m_pos++] = u.Byte7;
+ }
+
+ public void WriteLittleEndian(float value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.DWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte3;
+ }
+
+ public void WriteLittleEndian(double value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.QWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte0;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte4;
+ m_buffer[m_pos++] = u.Byte5;
+ m_buffer[m_pos++] = u.Byte6;
+ m_buffer[m_pos++] = u.Byte7;
+ }
+ #endregion
+
+ #region BigEndian
+ public void WriteBigEndian(short value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.WordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(int value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.DWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(long value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.QWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte7;
+ m_buffer[m_pos++] = u.Byte6;
+ m_buffer[m_pos++] = u.Byte5;
+ m_buffer[m_pos++] = u.Byte4;
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(ushort value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.WordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(uint value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.DWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(ulong value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.QWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte7;
+ m_buffer[m_pos++] = u.Byte6;
+ m_buffer[m_pos++] = u.Byte5;
+ m_buffer[m_pos++] = u.Byte4;
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(float value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.DWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+
+ public void WriteBigEndian(double value)
+ {
+ Require(Marshal.SizeOf(value));
+ var u = ByteUnion.QWordValue.Create(value);
+ m_buffer[m_pos++] = u.Byte7;
+ m_buffer[m_pos++] = u.Byte6;
+ m_buffer[m_pos++] = u.Byte5;
+ m_buffer[m_pos++] = u.Byte4;
+ m_buffer[m_pos++] = u.Byte3;
+ m_buffer[m_pos++] = u.Byte2;
+ m_buffer[m_pos++] = u.Byte1;
+ m_buffer[m_pos++] = u.Byte0;
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs.meta
new file mode 100644
index 00000000..c4198587
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/BytesStore.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d49a52418427394499c901cb23f13d30
+timeCreated: 1540907458
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs
new file mode 100644
index 00000000..7c552afa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace UniJSON
+{
+ public interface IStore
+ {
+ void Clear();
+ ArraySegment<Byte> Bytes { get; }
+
+ void Write(Byte value);
+ void Write(SByte value);
+
+ // network
+ void WriteBigEndian(UInt16 value);
+ void WriteBigEndian(UInt32 value);
+ void WriteBigEndian(UInt64 value);
+ void WriteBigEndian(Int16 value);
+ void WriteBigEndian(Int32 value);
+ void WriteBigEndian(Int64 value);
+ void WriteBigEndian(Single value);
+ void WriteBigEndian(Double value);
+
+ // intel cpu
+ void WriteLittleEndian(UInt16 value);
+ void WriteLittleEndian(UInt32 value);
+ void WriteLittleEndian(UInt64 value);
+ void WriteLittleEndian(Int16 value);
+ void WriteLittleEndian(Int32 value);
+ void WriteLittleEndian(Int64 value);
+ void WriteLittleEndian(Single value);
+ void WriteLittleEndian(Double value);
+
+ void Write(ArraySegment<Byte> bytes);
+
+ void Write(string src);
+ void Write(char c);
+ }
+
+ public static class IStoreExtensions
+ {
+ public static void WriteValues(this IStore s, params Byte[] bytes)
+ {
+ s.Write(new ArraySegment<Byte>(bytes));
+ }
+
+ public static void Write(this IStore s, Byte[] bytes)
+ {
+ s.Write(new ArraySegment<Byte>(bytes));
+ }
+
+ public static void Write(this IStore s, IEnumerable<Byte> bytes)
+ {
+ s.Write(new ArraySegment<Byte>(bytes.ToArray()));
+ }
+
+ public static Utf8String ToUtf8String(this IStore s)
+ {
+ return new Utf8String(s.Bytes);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs.meta
new file mode 100644
index 00000000..7f17e8f8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/IStore.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 558419bba2d829e4884fca9c2046fc3c
+timeCreated: 1495517075
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs
new file mode 100644
index 00000000..191a8361
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs
@@ -0,0 +1,149 @@
+using System;
+using System.IO;
+using System.Text;
+
+namespace UniJSON
+{
+ public class StreamStore: IStore
+ {
+ Stream m_s;
+ BinaryWriter m_w;
+
+ public StreamStore(Stream s)
+ {
+ m_s = s;
+ m_w = new BinaryWriter(m_s);
+ }
+
+ public ArraySegment<byte> Bytes
+ {
+ get
+ {
+#if NETFX_CORE
+ throw new NotImplementedException();
+#else
+ var ms = m_s as MemoryStream;
+ if (ms == null)
+ {
+ throw new NotImplementedException();
+ }
+ return new ArraySegment<byte>(ms.GetBuffer(), 0, (int)ms.Position);
+#endif
+ }
+ }
+
+ public void Clear()
+ {
+ m_s.SetLength(0);
+ }
+
+ public void Write(sbyte value)
+ {
+ m_w.Write(value);
+ }
+
+ public void Write(byte value)
+ {
+ m_w.Write(value);
+ }
+
+ public void Write(char c)
+ {
+ m_w.Write(c);
+ }
+
+ public void Write(string src)
+ {
+ m_w.Write(Encoding.UTF8.GetBytes(src));
+ }
+
+ public void Write(ArraySegment<byte> bytes)
+ {
+ m_w.Write(bytes.Array, bytes.Offset, bytes.Count);
+ }
+
+#region BigEndian
+ public void WriteBigEndian(int value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(float value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(double value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(long value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(short value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(uint value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(ulong value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(ushort value)
+ {
+ throw new NotImplementedException();
+ }
+#endregion
+
+#region LittleEndian
+ public void WriteLittleEndian(long value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(uint value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(short value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(ulong value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(double value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(float value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(int value)
+ {
+ m_w.Write(value);
+ }
+
+ public void WriteLittleEndian(ushort value)
+ {
+ m_w.Write(value);
+ }
+#endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs.meta
new file mode 100644
index 00000000..accce847
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StreamStore.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b87313b5306b62d4ea4f743055ae60f4
+timeCreated: 1495517079
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs
new file mode 100644
index 00000000..5ea55c92
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs
@@ -0,0 +1,153 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public class StringBuilderStore: IStore
+ {
+ StringBuilder m_sb;
+
+ public StringBuilderStore(StringBuilder sb)
+ {
+ m_sb = sb;
+ }
+
+ public ArraySegment<Byte> Bytes
+ {
+ get
+ {
+ return new ArraySegment<Byte>(
+ Encoding.UTF8.GetBytes(Buffer())
+ );
+ }
+ }
+
+ public string Buffer()
+ {
+ return m_sb.ToString();
+ }
+
+ public void Clear()
+ {
+ m_sb.Length = 0;
+ }
+
+ public void Write(ArraySegment<byte> bytes)
+ {
+ var text = Encoding.UTF8.GetString(bytes.Array, bytes.Offset, bytes.Count);
+ Write(text);
+ }
+
+ public void Write(byte value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Write(sbyte value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Write(IEnumerable<char> src)
+ {
+ foreach(var c in src)
+ {
+ m_sb.Append(c);
+ }
+ }
+ public void Write(Char c)
+ {
+ m_sb.Append(c);
+ }
+ public void Write(string src)
+ {
+ m_sb.Append(src);
+ }
+
+ #region BigEndian
+ public void WriteBigEndian(int value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(float value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(double value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(long value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(ulong value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(short value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(uint value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteBigEndian(ushort value)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+
+ #region LittleEndian
+ public void WriteLittleEndian(double value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(short value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(int value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(float value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(long value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(ulong value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(uint value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void WriteLittleEndian(ushort value)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs.meta
new file mode 100644
index 00000000..f3290cf7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IStore/StringBuilderStore.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 74639d64f5620dd45a1a8edc65f48aab
+timeCreated: 1495517076
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs
new file mode 100644
index 00000000..1f8edfbb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public interface ITreeNode<T, U>
+ where T : ITreeNode<T, U>
+ {
+ bool IsValid { get; }
+
+ bool HasParent { get; }
+ T Parent { get; }
+ IEnumerable<T> Children { get; }
+
+ int ValueIndex { get; }
+ U Value { get; }
+ void SetValue(U value);
+ }
+
+ public interface IListTreeItem
+ {
+ int ParentIndex { get; }
+ int ChildCount { get; }
+ void SetChildCount(int count);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs.meta
new file mode 100644
index 00000000..fc63b3d1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ITreeNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: baf3ade828d6e4c429d402b486911774
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs
new file mode 100644
index 00000000..b88341f8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs
@@ -0,0 +1,43 @@
+using System;
+
+
+namespace UniJSON
+{
+ public enum ValueNodeType
+ {
+ Null,
+ Boolean,
+ String,
+ Binary,
+ Integer,
+ Number,
+ Array,
+ Object,
+ NaN,
+ Infinity,
+ MinusInfinity,
+ }
+
+ public interface IValue<T>
+ {
+ T New(ArraySegment<byte> bytes, ValueNodeType valueType, int parentIndex);
+ T Key(Utf8String key, int parentIndex);
+ ValueNodeType ValueType { get; }
+ ArraySegment<Byte> Bytes { get; }
+ void SetBytesCount(int count);
+ Boolean GetBoolean();
+ String GetString();
+ Utf8String GetUtf8String();
+ SByte GetSByte();
+ Int16 GetInt16();
+ Int32 GetInt32();
+ Int64 GetInt64();
+ Byte GetByte();
+ UInt16 GetUInt16();
+ UInt32 GetUInt32();
+ UInt64 GetUInt64();
+ Single GetSingle();
+ Double GetDouble();
+ U GetValue<U>();
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs.meta
new file mode 100644
index 00000000..32389b8b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/IValue.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4737055a37e47074e92e6fc03a96a9a5
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json.meta
new file mode 100644
index 00000000..b2b05c2e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f4bf1a4860dc23244837e31091692c3c
+folderAsset: yes
+timeCreated: 1540897217
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs
new file mode 100644
index 00000000..faf0ee0c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs
@@ -0,0 +1,44 @@
+using System;
+
+namespace UniJSON
+{
+ public enum JsonDiffType
+ {
+ KeyAdded,
+ KeyRemoved,
+ ValueChanged,
+ }
+
+ public struct JsonDiff
+ {
+ public JsonPointer Path;
+ public JsonDiffType DiffType;
+ public string Msg;
+
+ public static JsonDiff Create<T>(ListTreeNode<T> node, JsonDiffType diffType, string msg)
+ where T: IListTreeItem, IValue<T>
+ {
+ return new JsonDiff
+ {
+ Path = JsonPointer.Create(node),
+ DiffType = diffType,
+ Msg = msg,
+ };
+ }
+
+ public override string ToString()
+ {
+ switch (DiffType)
+ {
+ case JsonDiffType.KeyAdded:
+ return string.Format("+ {0}: {1}", Path, Msg);
+ case JsonDiffType.KeyRemoved:
+ return string.Format("- {0}: {1}", Path, Msg);
+ case JsonDiffType.ValueChanged:
+ return string.Format("= {0}: {1}", Path, Msg);
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs.meta
new file mode 100644
index 00000000..3c221f2f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonDiff.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 97356eb7e23aca64c84f836d6c298f43
+timeCreated: 1543427903
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs
new file mode 100644
index 00000000..edfc41a9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs
@@ -0,0 +1,546 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public class JsonFormatter : IFormatter, IRpc
+ {
+ IStore m_w;
+ protected IStore Store
+ {
+ get { return m_w; }
+ }
+
+ enum Current
+ {
+ ROOT,
+ ARRAY,
+ OBJECT
+ }
+
+ class Context
+ {
+ public Current Current;
+ public int Count;
+
+ public Context(Current current)
+ {
+ Current = current;
+ Count = 0;
+ }
+ }
+
+ Stack<Context> m_stack = new Stack<Context>();
+
+ string m_indent;
+ void Indent()
+ {
+ if (!string.IsNullOrEmpty(m_indent))
+ {
+ m_w.Write('\n');
+ for (int i = 0; i < m_stack.Count - 1; ++i)
+ {
+ m_w.Write(m_indent);
+ }
+ }
+ }
+
+ string m_colon;
+
+ public JsonFormatter(int indent = 0)
+ : this(new BytesStore(128), indent)
+ {
+ }
+
+ public JsonFormatter(IStore w, int indent = 0)
+ {
+ m_w = w;
+ m_stack.Push(new Context(Current.ROOT));
+ m_indent = new string(Enumerable.Range(0, indent).Select(x => ' ').ToArray());
+ m_colon = indent == 0 ? ":" : ": ";
+ }
+
+ public override string ToString()
+ {
+ var bytes = this.GetStoreBytes();
+ return Encoding.UTF8.GetString(bytes.Array, bytes.Offset, bytes.Count);
+ }
+
+ public IStore GetStore()
+ {
+ return m_w;
+ }
+
+ public void Clear()
+ {
+ m_w.Clear();
+ m_stack.Clear();
+ m_stack.Push(new Context(Current.ROOT));
+ }
+
+ protected void CommaCheck(bool isKey = false)
+ {
+ var top = m_stack.Pop();
+ switch (top.Current)
+ {
+ case Current.ROOT:
+ {
+ if (top.Count != 0) throw new FormatterException("multiple root value");
+ }
+ break;
+
+ case Current.ARRAY:
+ {
+ if (top.Count != 0)
+ {
+ m_w.Write(',');
+ }
+ }
+ break;
+
+ case Current.OBJECT:
+ {
+ if (top.Count % 2 == 0)
+ {
+ if (!isKey) throw new FormatterException("key expected");
+ if (top.Count != 0)
+ {
+ m_w.Write(',');
+ }
+ }
+ else
+ {
+ if (isKey) throw new FormatterException("key not expected");
+ }
+ }
+ break;
+ }
+ top.Count += 1;
+ /*
+ {
+ var debug = string.Format("{0} {1} = {2}", m_stack.Count, top.Current, top.Count);
+ Debug.Log(debug);
+ }
+ */
+ m_stack.Push(top);
+ }
+
+ static Utf8String s_null = Utf8String.From("null");
+ public void Null()
+ {
+ CommaCheck();
+ m_w.Write(s_null.Bytes);
+ }
+
+ public void BeginList(int _ = 0)
+ {
+ CommaCheck();
+ m_w.Write('[');
+ m_stack.Push(new Context(Current.ARRAY));
+ }
+
+ public void EndList()
+ {
+ if (m_stack.Peek().Current != Current.ARRAY)
+ {
+ throw new InvalidOperationException();
+ }
+ m_w.Write(']');
+ m_stack.Pop();
+ }
+
+ public void BeginMap(int _ = 0)
+ {
+ CommaCheck();
+ m_w.Write('{');
+ m_stack.Push(new Context(Current.OBJECT));
+ }
+
+ public void EndMap()
+ {
+ if (m_stack.Peek().Current != Current.OBJECT)
+ {
+ throw new InvalidOperationException();
+ }
+ m_stack.Pop();
+ Indent();
+ m_w.Write('}');
+ }
+
+ public void Key(Utf8String key)
+ {
+ _Value(key, true);
+ m_w.Write(m_colon);
+ }
+
+ public void Value(string x)
+ {
+ Value(Utf8String.From(x));
+ }
+
+ public void Value(Utf8String key)
+ {
+ _Value(key, false);
+ }
+
+ void _Value(Utf8String key, bool isKey)
+ {
+ CommaCheck(isKey);
+ if (isKey)
+ {
+ Indent();
+ }
+ JsonString.Quote(key, m_w);
+ }
+
+ static Utf8String s_true = Utf8String.From("true");
+ static Utf8String s_false = Utf8String.From("false");
+ public void Value(Boolean x)
+ {
+ CommaCheck();
+ m_w.Write(x ? s_true.Bytes : s_false.Bytes);
+ }
+
+ public void Value(SByte x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+ public void Value(Int16 x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+ public void Value(Int32 x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+ public void Value(Int64 x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+
+ public void Value(Byte x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+ public void Value(UInt16 x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+ public void Value(UInt32 x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+ public void Value(UInt64 x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString());
+ }
+
+ public void Value(Single x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString("R", CultureInfo.InvariantCulture));
+ }
+ public void Value(Double x)
+ {
+ CommaCheck();
+ m_w.Write(x.ToString("R", CultureInfo.InvariantCulture));
+ }
+
+ public void Value(ArraySegment<Byte> x)
+ {
+ CommaCheck();
+ m_w.Write('"');
+ m_w.Write(Convert.ToBase64String(x.Array, x.Offset, x.Count));
+ m_w.Write('"');
+ }
+
+ // ISO-8601: YYYY-MM-DD“T”hh:mm:ss“Z”
+ public void Value(DateTimeOffset x)
+ {
+ Value(x.ToString("yyyy-MM-ddTHH:mm:ssZ"));
+ }
+
+ public void Value(ListTreeNode<JsonValue> node)
+ {
+ CommaCheck();
+ m_w.Write(node.Value.Bytes);
+ }
+
+ #region IRpc
+ int m_nextRequestId = 1;
+
+ static Utf8String s_jsonrpc = Utf8String.From("jsonrpc");
+ static Utf8String s_20 = Utf8String.From("2.0");
+ static Utf8String s_method = Utf8String.From("method");
+ static Utf8String s_params = Utf8String.From("params");
+
+ public void Notify(Utf8String method)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Notify<A0>(Utf8String method, A0 a0)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Notify<A0, A1>(Utf8String method, A0 a0, A1 a1)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Notify<A0, A1, A2>(Utf8String method, A0 a0, A1 a1, A2 a2)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Notify<A0, A1, A2, A3>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ this.Serialize(a3);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Notify<A0, A1, A2, A3, A4>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ this.Serialize(a3);
+ this.Serialize(a4);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Notify<A0, A1, A2, A3, A4, A5>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ this.Serialize(a3);
+ this.Serialize(a4);
+ this.Serialize(a5);
+ }
+ EndList();
+ EndMap();
+ }
+
+ static Utf8String s_id = Utf8String.From("id");
+
+ public void Request(Utf8String method)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Request<A0>(Utf8String method,
+ A0 a0)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Request<A0, A1>(Utf8String method,
+ A0 a0, A1 a1)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Request<A0, A1, A2>(Utf8String method,
+ A0 a0, A1 a1, A2 a2)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Request<A0, A1, A2, A3>(Utf8String method,
+ A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ this.Serialize(a3);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Request<A0, A1, A2, A3, A4>(Utf8String method,
+ A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ this.Serialize(a3);
+ this.Serialize(a4);
+ }
+ EndList();
+ EndMap();
+ }
+
+ public void Request<A0, A1, A2, A3, A4, A5>(Utf8String method,
+ A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(m_nextRequestId++);
+ Key(s_method); Value(method);
+ Key(s_params); BeginList();
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ this.Serialize(a2);
+ this.Serialize(a3);
+ this.Serialize(a4);
+ this.Serialize(a5);
+ }
+ EndList();
+ EndMap();
+ }
+
+ static Utf8String s_error = Utf8String.From("error");
+
+ public void ResponseError(int id, Exception error)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(id);
+ Key(s_error); this.Serialize(error);
+ EndMap();
+ }
+
+ static Utf8String s_result = Utf8String.From("result");
+
+ public void ResponseSuccess(int id)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(id);
+ Key(s_result); Null();
+ EndMap();
+ }
+
+ public void ResponseSuccess<T>(int id, T result)
+ {
+ BeginMap();
+ Key(s_jsonrpc); Value(s_20);
+ Key(s_id); Value(id);
+ Key(s_result); this.Serialize(result);
+ EndMap();
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs.meta
new file mode 100644
index 00000000..230469e5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonFormatter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9968766fe6cce164a8c7e950200cbb11
+timeCreated: 1495517078
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs
new file mode 100644
index 00000000..8936d827
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs
@@ -0,0 +1,297 @@
+using System;
+
+
+namespace UniJSON
+{
+ public static class JsonParser
+ {
+ static ValueNodeType GetValueType(Utf8String segment)
+ {
+ switch (Char.ToLower((char)segment[0]))
+ {
+ case '{': return ValueNodeType.Object;
+ case '[': return ValueNodeType.Array;
+ case '"': return ValueNodeType.String;
+ case 't': return ValueNodeType.Boolean;
+ case 'f': return ValueNodeType.Boolean;
+ case 'n':
+ if (segment.ByteLength >= 2 && Char.ToLower((char)segment[1]) == 'a')
+ {
+ return ValueNodeType.NaN;
+ }
+
+ return ValueNodeType.Null;
+
+ case 'i':
+ return ValueNodeType.Infinity;
+
+ case '-':
+ if (segment.ByteLength >= 2 && Char.ToLower((char)segment[1]) == 'i')
+ {
+ return ValueNodeType.MinusInfinity;
+ }
+ goto case '0';// fall through
+ case '0': // fall through
+ case '1': // fall through
+ case '2': // fall through
+ case '3': // fall through
+ case '4': // fall through
+ case '5': // fall through
+ case '6': // fall through
+ case '7': // fall through
+ case '8': // fall through
+ case '9': // fall through
+ {
+ if (segment.IsInt)
+ {
+ return ValueNodeType.Integer;
+ }
+ else
+ {
+ return ValueNodeType.Number;
+ }
+ }
+
+ default:
+ throw new ParserException(segment + " is not valid json start");
+ }
+ }
+
+ /// <summary>
+ /// Expected null, boolean, integer, number
+ /// </summary>
+ /// <param name="segment"></param>
+ /// <param name="valueType"></param>
+ /// <param name="parentIndex"></param>
+ /// <returns></returns>
+ static ListTreeNode<JsonValue> ParsePrimitive(ListTreeNode<JsonValue> tree, Utf8String segment, ValueNodeType valueType)
+ {
+ int i = 1;
+ for (; i < segment.ByteLength; ++i)
+ {
+ if (Char.IsWhiteSpace((char)segment[i])
+ || segment[i] == '}'
+ || segment[i] == ']'
+ || segment[i] == ','
+ || segment[i] == ':'
+ )
+ {
+ break;
+ }
+ }
+ return tree.AddValue(segment.Subbytes(0, i).Bytes, valueType);
+ }
+
+ static ListTreeNode<JsonValue> ParseString(ListTreeNode<JsonValue> tree, Utf8String segment)
+ {
+ int pos;
+ if (segment.TrySearchAscii((Byte)'"', 1, out pos))
+ {
+ return tree.AddValue(segment.Subbytes(0, pos + 1).Bytes, ValueNodeType.String);
+ }
+ else
+ {
+ throw new ParserException("no close string: " + segment);
+ }
+ }
+
+ static ListTreeNode<JsonValue> ParseArray(ListTreeNode<JsonValue> tree, Utf8String segment)
+ {
+ var array = tree.AddValue(segment.Bytes, ValueNodeType.Array);
+
+ var closeChar = ']';
+ bool isFirst = true;
+ var current = segment.Subbytes(1);
+ while (true)
+ {
+ {
+ // skip white space
+ int nextToken;
+ if (!current.TrySearchByte(x => !Char.IsWhiteSpace((char)x), out nextToken))
+ {
+ throw new ParserException("no white space expected");
+ }
+ current = current.Subbytes(nextToken);
+ }
+
+ {
+ if (current[0] == closeChar)
+ {
+ // end
+ break;
+ }
+ }
+
+ if (isFirst)
+ {
+ isFirst = false;
+ }
+ else
+ {
+ // search ',' or closeChar
+ int keyPos;
+ if (!current.TrySearchByte(x => x == ',', out keyPos))
+ {
+ throw new ParserException("',' expected");
+ }
+ current = current.Subbytes(keyPos + 1);
+ }
+
+ {
+ // skip white space
+ int nextToken;
+ if (!current.TrySearchByte(x => !Char.IsWhiteSpace((char)x), out nextToken))
+ {
+ throw new ParserException("not whitespace expected");
+ }
+ current = current.Subbytes(nextToken);
+ }
+
+ // value
+ var child = Parse(array, current);
+ current = current.Subbytes(child.Value.Segment.ByteLength);
+ }
+
+ // fix array range
+ var count = current.Bytes.Offset + 1 - segment.Bytes.Offset;
+ array.SetValueBytesCount(count);
+
+ return array;
+ }
+
+ static ListTreeNode<JsonValue> ParseObject(ListTreeNode<JsonValue> tree, Utf8String segment)
+ {
+ var obj = tree.AddValue(segment.Bytes, ValueNodeType.Object);
+
+ var closeChar = '}';
+ bool isFirst = true;
+ var current = segment.Subbytes(1);
+ while (true)
+ {
+ {
+ // skip white space
+ int nextToken;
+ if (!current.TrySearchByte(x => !Char.IsWhiteSpace((char)x), out nextToken))
+ {
+ throw new ParserException("no white space expected");
+ }
+ current = current.Subbytes(nextToken);
+ }
+
+ {
+ if (current[0] == closeChar)
+ {
+ break;
+ }
+ }
+
+ if (isFirst)
+ {
+ isFirst = false;
+ }
+ else
+ {
+ // search ',' or closeChar
+ int keyPos;
+ if (!current.TrySearchByte(x => x == ',', out keyPos))
+ {
+ throw new ParserException("',' expected");
+ }
+ current = current.Subbytes(keyPos + 1);
+ }
+
+ {
+ // skip white space
+ int nextToken;
+ if (!current.TrySearchByte(x => !Char.IsWhiteSpace((char)x), out nextToken))
+ {
+ throw new ParserException("not whitespace expected");
+ }
+ current = current.Subbytes(nextToken);
+ }
+
+ // key
+ var key = Parse(obj, current);
+ if (!key.IsString())
+ {
+ throw new ParserException("object key must string: " + key.Value.Segment);
+ }
+ current = current.Subbytes(key.Value.Segment.ByteLength);
+
+ // search ':'
+ int valuePos;
+ if (!current.TrySearchByte(x => x == ':', out valuePos))
+ {
+ throw new ParserException(": is not found");
+ }
+ current = current.Subbytes(valuePos + 1);
+
+ {
+ // skip white space
+ int nextToken;
+ if (!current.TrySearchByte(x => !Char.IsWhiteSpace((char)x), out nextToken))
+ {
+ throw new ParserException("not whitespace expected");
+ }
+ current = current.Subbytes(nextToken);
+ }
+
+ // value
+ var value = Parse(obj, current);
+ current = current.Subbytes(value.Value.Segment.ByteLength);
+ }
+
+ // fix obj range
+ var count = current.Bytes.Offset + 1 - segment.Bytes.Offset;
+ obj.SetValueBytesCount(count);
+
+ return obj;
+ }
+
+ public static ListTreeNode<JsonValue> Parse(ListTreeNode<JsonValue> tree, Utf8String segment)
+ {
+ // skip white space
+ int pos;
+ if (!segment.TrySearchByte(x => !char.IsWhiteSpace((char)x), out pos))
+ {
+ throw new ParserException("only whitespace");
+ }
+ segment = segment.Subbytes(pos);
+
+ var valueType = GetValueType(segment);
+ switch (valueType)
+ {
+ case ValueNodeType.Boolean:
+ case ValueNodeType.Integer:
+ case ValueNodeType.Number:
+ case ValueNodeType.Null:
+ case ValueNodeType.NaN:
+ case ValueNodeType.Infinity:
+ case ValueNodeType.MinusInfinity:
+ return ParsePrimitive(tree, segment, valueType);
+
+ case ValueNodeType.String:
+ return ParseString(tree, segment);
+
+ case ValueNodeType.Array: // fall through
+ return ParseArray(tree, segment);
+
+ case ValueNodeType.Object: // fall through
+ return ParseObject(tree, segment);
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ public static ListTreeNode<JsonValue> Parse(String json)
+ {
+ return Parse(Utf8String.From(json));
+ }
+
+ public static ListTreeNode<JsonValue> Parse(Utf8String json)
+ {
+ return Parse(default(ListTreeNode<JsonValue>), json);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs.meta
new file mode 100644
index 00000000..bcc3cf40
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonParser.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3ab6245869fe6f7448aa8f4e84286cdd
+timeCreated: 1526137862
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs
new file mode 100644
index 00000000..d003a869
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs
@@ -0,0 +1,101 @@
+using System;
+using System.Linq;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public struct JsonPointer
+ {
+ public ArraySegment<Utf8String> Path
+ {
+ get;
+ private set;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return Path.Count;
+ }
+ }
+
+ public Utf8String this[int index]
+ {
+ get
+ {
+ return Path.Array[Path.Offset + index];
+ }
+ }
+
+ public JsonPointer Unshift()
+ {
+ return new JsonPointer
+ {
+ Path = new ArraySegment<Utf8String>(Path.Array, Path.Offset + 1, Path.Count - 1)
+ };
+ }
+
+ public static JsonPointer Create<T>(ListTreeNode<T> node)
+ where T : IListTreeItem, IValue<T>
+ {
+ return new JsonPointer
+ {
+ Path = new ArraySegment<Utf8String>(node.Path().Skip(1).Select(x => GetKeyFromParent(x)).ToArray())
+ };
+ }
+
+ public JsonPointer(Utf8String pointer) : this()
+ {
+ int pos;
+ if (!pointer.TrySearchAscii((Byte)'/', 0, out pos))
+ {
+ throw new ArgumentException();
+ }
+ if (pos != 0)
+ {
+ throw new ArgumentException();
+ }
+
+ var split = pointer.Split((Byte)'/').ToArray();
+ Path = new ArraySegment<Utf8String>(split, 1, split.Length - 1);
+ }
+
+ public override string ToString()
+ {
+ if (Path.Count == 0)
+ {
+ return "/";
+ }
+
+ var sb = new StringBuilder();
+ var end = Path.Offset + Path.Count;
+ for (int i = Path.Offset; i < end; ++i)
+ {
+ sb.Append('/');
+ sb.Append(Path.Array[i]);
+ }
+ return sb.ToString();
+ }
+
+ static Utf8String GetKeyFromParent<T>(ListTreeNode<T> json)
+ where T : IListTreeItem, IValue<T>
+ {
+ var parent = json.Parent;
+ if (parent.IsArray())
+ {
+ var index = parent.IndexOf(json);
+ return Utf8String.From(index);
+ }
+ else if (parent.IsMap())
+ {
+ return parent.KeyOf(json);
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs.meta
new file mode 100644
index 00000000..c672f6aa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonPointer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8b7033668ce791e40819d16e664efe18
+timeCreated: 1543321766
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs
new file mode 100644
index 00000000..6e573467
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs
@@ -0,0 +1,445 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace UniJSON
+{
+ public class JsonSchema : IEquatable<JsonSchema>
+ {
+ public string Schema; // http://json-schema.org/draft-04/schema
+
+ #region Annotations
+ string m_title;
+ public string Title
+ {
+ get { return m_title; }
+ private set
+ {
+ if (value == null)
+ {
+ m_title = "";
+ }
+ else
+ {
+ m_title = value.Trim();
+ }
+ }
+ }
+
+ string m_desc;
+ public string Description
+ {
+ get { return m_desc; }
+ private set
+ {
+ if (value == null)
+ {
+ m_desc = "";
+ }
+ else
+ {
+ m_desc = value.Trim();
+ }
+ }
+ }
+
+ public object Default
+ {
+ get;
+ private set;
+ }
+ #endregion
+
+ public IJsonSchemaValidator Validator { get; set; }
+
+ /// <summary>
+ /// Skip validator comparison
+ /// </summary>
+ public bool SkipComparison { get; set; }
+
+ public object ExplicitIgnorableValue { private get; set; }
+ public int ExplicitIgnorableItemLength { private get; set; }
+
+ public override string ToString()
+ {
+ return string.Format("<{0}>", Title);
+ }
+
+ public override int GetHashCode()
+ {
+ return 1;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonSchema;
+ if (rhs == null) return false;
+ return Equals(rhs);
+ }
+
+ public bool Equals(JsonSchema rhs)
+ {
+ // skip comparison
+ if (SkipComparison) return true;
+ if (rhs.SkipComparison) return true;
+ return Validator.Equals(rhs.Validator);
+ }
+
+ public static bool operator ==(JsonSchema obj1, JsonSchema obj2)
+ {
+ if (ReferenceEquals(obj1, obj2))
+ {
+ return true;
+ }
+
+ if (ReferenceEquals(obj1, null))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(obj2, null))
+ {
+ return false;
+ }
+
+ return obj1.Equals(obj2);
+ }
+
+ public static bool operator !=(JsonSchema obj1, JsonSchema obj2)
+ {
+ return !(obj1 == obj2);
+ }
+
+ #region FromType
+ public static JsonSchema FromType<T>()
+ {
+ return FromType(typeof(T), null, null);
+ }
+
+ public static JsonSchema FromType(Type t,
+ BaseJsonSchemaAttribute a = null, // field attribute
+ ItemJsonSchemaAttribute ia = null
+ )
+ {
+ // class attribute
+ var aa = t.GetCustomAttributes(typeof(JsonSchemaAttribute), true)
+ .FirstOrDefault() as JsonSchemaAttribute;
+ if (a != null)
+ {
+ a.Merge(aa);
+ }
+ else
+ {
+ if (aa == null)
+ {
+ a = new JsonSchemaAttribute();
+ }
+ else
+ {
+ a = aa;
+ }
+ }
+
+ if (ia == null)
+ {
+ ia = t.GetCustomAttributes(typeof(ItemJsonSchemaAttribute), true)
+ .FirstOrDefault() as ItemJsonSchemaAttribute;
+ }
+
+ IJsonSchemaValidator validator = null;
+ bool skipComparison = a.SkipSchemaComparison;
+ if (t == typeof(object))
+ {
+ skipComparison = true;
+ }
+
+ if (a.EnumValues != null)
+ {
+ try
+ {
+ validator = JsonEnumValidator.Create(a.EnumValues, a.EnumSerializationType);
+ }
+ catch (Exception)
+ {
+ throw new Exception(String.Join(", ", a.EnumValues.Select(x => x.ToString()).ToArray()));
+ }
+ }
+ else if (t.IsEnum)
+ {
+ validator = JsonEnumValidator.Create(t, a.EnumSerializationType, a.EnumExcludes);
+ }
+ else
+ {
+ validator = JsonSchemaValidatorFactory.Create(t, a, ia);
+ }
+
+ var schema = new JsonSchema
+ {
+ Title = a.Title,
+ Description = a.Description,
+ Validator = validator,
+ SkipComparison = skipComparison,
+ ExplicitIgnorableValue = a.ExplicitIgnorableValue,
+ ExplicitIgnorableItemLength = a.ExplicitIgnorableItemLength,
+ };
+
+ return schema;
+ }
+ #endregion
+
+ #region FromJson
+ static ValueNodeType ParseValueType(string type)
+ {
+ try
+ {
+ return (ValueNodeType)Enum.Parse(typeof(ValueNodeType), type, true);
+ }
+ catch (ArgumentException)
+ {
+ throw new ArgumentException(string.Format("unknown type: {0}", type));
+ }
+ }
+
+ Stack<string> m_context = new Stack<string>();
+
+ static Utf8String s_ref = Utf8String.From("$ref");
+
+ public void Parse(IFileSystemAccessor fs, ListTreeNode<JsonValue> root, string Key)
+ {
+ m_context.Push(Key);
+
+ var compositionType = default(CompositionType);
+ var composition = new List<JsonSchema>();
+ foreach (var kv in root.ObjectItems())
+ {
+ switch (kv.Key.GetString())
+ {
+ case "$schema":
+ Schema = kv.Value.GetString();
+ break;
+
+ case "$ref":
+ {
+ var refFs = fs.Get(kv.Value.GetString());
+
+ // parse JSON
+ var json = refFs.ReadAllText();
+ var refRoot = JsonParser.Parse(json);
+
+ Parse(refFs, refRoot, "$ref");
+ }
+ break;
+
+ #region Annotation
+ case "title":
+ Title = kv.Value.GetString();
+ break;
+
+ case "description":
+ Description = kv.Value.GetString();
+ break;
+
+ case "default":
+ Default = kv.Value;
+ break;
+ #endregion
+
+ #region Validation
+ // http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1
+ case "type":
+ if (Validator == null)
+ {
+ Validator = JsonSchemaValidatorFactory.Create(kv.Value.GetString());
+ }
+ break;
+
+ case "enum":
+ Validator = JsonEnumValidator.Create(kv.Value);
+ break;
+
+ case "const":
+ break;
+ #endregion
+
+ #region Composite
+ // http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.7
+ case "oneOf":
+ break;
+
+ case "not":
+ break;
+
+ case "anyOf": // composition
+ case "allOf": // composition
+ {
+ compositionType = (CompositionType)Enum.Parse(typeof(CompositionType), kv.Key.GetString(), true);
+ foreach (var item in kv.Value.ArrayItems())
+ {
+ if (item.ContainsKey(s_ref))
+ {
+ var sub = JsonSchema.ParseFromPath(fs.Get(item[s_ref].GetString()));
+ composition.Add(sub);
+ }
+ else
+ {
+ var sub = new JsonSchema();
+ sub.Parse(fs, item, compositionType.ToString());
+ composition.Add(sub);
+ }
+ }
+ Composite(compositionType, composition);
+ }
+ break;
+ #endregion
+
+ // http://json-schema.org/latest/json-schema-validation.html#rfc.section.7
+ case "format":
+ break;
+
+ #region Gltf
+ case "gltf_detailedDescription":
+ break;
+
+ case "gltf_webgl":
+ break;
+
+ case "gltf_uriType":
+ break;
+ #endregion
+
+ default:
+ {
+ if (Validator != null)
+ {
+ if (Validator.FromJsonSchema(fs, kv.Key.GetString(), kv.Value))
+ {
+ continue;
+ }
+ }
+ throw new NotImplementedException(string.Format("unknown key: {0}", kv.Key));
+ }
+ }
+ }
+ m_context.Pop();
+
+ if (Validator == null)
+ {
+ SkipComparison = true;
+ }
+ }
+
+ void Composite(CompositionType compositionType, List<JsonSchema> composition)
+ {
+ switch (compositionType)
+ {
+ case CompositionType.AllOf:
+ if (composition.Count == 1)
+ {
+ // inheritance
+ if (Validator == null)
+ {
+ //Validator = JsonSchemaValidatorFactory.Create(composition[0].Validator.ValueNodeType);
+ Validator = composition[0].Validator;
+ }
+ else
+ {
+ Validator.Merge(composition[0].Validator);
+ }
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ break;
+
+ case CompositionType.AnyOf:
+ if (Validator == null)
+ {
+ if (composition.Count == 1)
+ {
+ throw new NotImplementedException();
+ //Validator = composition[0].Validator;
+ }
+ else
+ {
+ // extend enum
+ // enum, enum..., type
+ Validator = JsonEnumValidator.Create(composition, EnumSerializationType.AsString);
+ }
+ }
+ //throw new NotImplementedException();
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ public static JsonSchema ParseFromPath(IFileSystemAccessor fs)
+ {
+ // parse JSON
+ var json = fs.ReadAllText();
+ var root = JsonParser.Parse(json);
+
+ // create schema
+ var schema = new JsonSchema();
+ schema.Parse(fs, root, "__ParseFromPath__" + fs.ToString());
+ return schema;
+ }
+ #endregion
+
+ public void Serialize<T>(IFormatter f, T o, JsonSchemaValidationContext c = null)
+ {
+ if (c == null)
+ {
+ c = new JsonSchemaValidationContext(o)
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ }
+
+ var ex = Validator.Validate(c, o);
+ if (ex != null)
+ {
+ throw ex;
+ }
+
+ Validator.Serialize(f, c, o);
+ }
+
+ public void ToJson(IFormatter f)
+ {
+ f.BeginMap(2);
+ if (!string.IsNullOrEmpty(Title)) { f.Key("title"); f.Value(Title); }
+ if (!string.IsNullOrEmpty(Description)) { f.Key("description"); f.Value(Description); }
+ Validator.ToJsonSchema(f);
+ f.EndMap();
+ }
+
+ public bool IsExplicitlyIgnorableValue<T>(T obj)
+ {
+ if (obj == null)
+ {
+ return ExplicitIgnorableValue == null;
+ }
+
+ var iter = obj as System.Collections.ICollection;
+ if (ExplicitIgnorableItemLength != -1 && iter != null)
+ {
+ return iter.Count == ExplicitIgnorableItemLength;
+ }
+
+ return obj.Equals(ExplicitIgnorableValue);
+ }
+ }
+
+ public static class JsonSchemaExtensions
+ {
+ public static string Serialize<T>(this JsonSchema s, T o, JsonSchemaValidationContext c = null)
+ {
+ var f = new JsonFormatter();
+ s.Serialize(f, o, c);
+ return f.ToString();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs.meta
new file mode 100644
index 00000000..05431a7f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchema.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4d98ef4e469916e428284c9155f29059
+timeCreated: 1526056149
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs
new file mode 100644
index 00000000..21e13f5b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs
@@ -0,0 +1,187 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace UniJSON
+{
+ public enum EnumSerializationType
+ {
+ AsInt,
+ AsString,
+ AsLowerString,
+ AsUpperString,
+ }
+
+ public class BaseJsonSchemaAttribute : Attribute
+ {
+ #region Annotation
+ public string Title;
+ public string Description;
+ #endregion
+
+ #region integer, number
+ public double Minimum = double.NaN;
+ public bool ExclusiveMinimum;
+ public double Maximum = double.NaN;
+ public bool ExclusiveMaximum;
+ public double MultipleOf;
+ #endregion
+
+ #region string
+ public string Pattern;
+ #endregion
+
+ #region array
+ public int MinItems;
+ public int MaxItems;
+ #endregion
+
+ #region object
+ public ValueNodeType ValueType;
+ public int MinProperties;
+ public bool Required;
+ public string[] Dependencies;
+ #endregion
+
+ #region enum
+ public EnumSerializationType EnumSerializationType;
+ public object[] EnumValues;
+ public object[] EnumExcludes;
+ #endregion
+
+ public PropertyExportFlags ExportFlags = PropertyExportFlags.Default;
+
+ /// <summary>
+ /// skip validator comparison
+ /// </summary>
+ public bool SkipSchemaComparison;
+
+ /// <summary>
+ /// Suppress errors if a value of the field which is not required by a schema is matched to this value.
+ /// This feature will be useful to ignore invalid value which is known.
+ /// </summary>
+ public object ExplicitIgnorableValue;
+
+ /// <summary>
+ /// Suppress errors if length of a value of the field which is not required by a schema is matched to this value.
+ /// This feature will be useful to ignore invalid value which is known.
+ /// </summary>
+ public int ExplicitIgnorableItemLength = -1;
+
+ public void Merge(BaseJsonSchemaAttribute rhs)
+ {
+ if (rhs == null) return;
+
+ if (string.IsNullOrEmpty(Title))
+ {
+ Title = rhs.Title;
+ }
+ }
+
+ public virtual string GetInfo(FieldInfo fi)
+ {
+ return "";
+ }
+
+ public static bool IsNumber(Type t)
+ {
+ if (t == typeof(sbyte)
+ || t == typeof(short)
+ || t == typeof(int)
+ || t == typeof(long)
+ || t == typeof(byte)
+ || t == typeof(ushort)
+ || t == typeof(uint)
+ || t == typeof(ulong)
+ || t == typeof(float)
+ || t == typeof(double)
+ )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static string GetTypeName(Type t)
+ {
+ if (t.IsArray)
+ {
+ return t.GetElementType().Name + "[]";
+ }
+ else if (t.IsGenericType)
+ {
+ if (t.GetGenericTypeDefinition() == typeof(List<>))
+ {
+ return "List<" + t.GetGenericArguments()[0] + ">";
+ }
+ else if (t.GetGenericTypeDefinition() == typeof(Dictionary<,>))
+ {
+ return "Dictionary<" + string.Join(", ", t.GetGenericArguments().Select(x => x.Name).ToArray()) + ">";
+ }
+ }
+
+ return t.Name;
+ }
+
+ }
+
+ public class JsonSchemaAttribute : BaseJsonSchemaAttribute
+ {
+ public override string GetInfo(FieldInfo fi)
+ {
+ if (IsNumber(fi.FieldType))
+ {
+ var sb = new StringBuilder();
+ if (!double.IsNaN(Minimum) && !double.IsNaN(Maximum))
+ {
+ sb.Append(string.Format("{0} <= N <= {1}", Minimum, Maximum));
+ }
+ else if (!double.IsNaN(Minimum))
+ {
+ sb.Append(string.Format("{0} <= N", Minimum));
+ }
+ else if (!double.IsNaN(Maximum))
+ {
+ sb.Append(string.Format("N <= {0}", Maximum));
+ }
+ return sb.ToString();
+ }
+ else
+ {
+ if (EnumValues != null)
+ {
+ return string.Join(", ", EnumValues.Select(x => x.ToString()).ToArray());
+ }
+ else
+ {
+ return GetTypeName(fi.FieldType);
+ }
+ }
+ }
+ }
+
+ public class ItemJsonSchemaAttribute : BaseJsonSchemaAttribute
+ {
+ public override string GetInfo(FieldInfo fi)
+ {
+ var sb = new StringBuilder();
+ sb.Append(GetTypeName(fi.FieldType));
+ if (!double.IsNaN(MinItems) && !double.IsNaN(MaxItems))
+ {
+ sb.Append(string.Format("{0} < N < {1}", MinItems, MaxItems));
+ }
+ else if (!double.IsNaN(MinItems))
+ {
+ sb.Append(string.Format("{0}< N", MinItems));
+ }
+ else if (!double.IsNaN(MaxItems))
+ {
+
+ }
+ return sb.ToString();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs.meta
new file mode 100644
index 00000000..fa872cf7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonSchemaAttribute.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e79a9be81d4b0fc4ebd9ca47d0f20a04
+timeCreated: 1526058096
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs
new file mode 100644
index 00000000..5fb5a95e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs
@@ -0,0 +1,372 @@
+using System;
+using System.Linq;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public static class JsonString
+ {
+ #region Quote
+ public static void Escape(String s, IStore w)
+ {
+ if (String.IsNullOrEmpty(s))
+ {
+ return;
+ }
+
+ var it = s.ToCharArray().Cast<char>().GetEnumerator();
+ while (it.MoveNext())
+ {
+ switch (it.Current)
+ {
+ case '"':
+ case '\\':
+ case '/':
+ // \\ prefix
+ w.Write('\\');
+ w.Write(it.Current);
+ break;
+
+ case '\b':
+ w.Write('\\');
+ w.Write('b');
+ break;
+ case '\f':
+ w.Write('\\');
+ w.Write('f');
+ break;
+ case '\n':
+ w.Write('\\');
+ w.Write('n');
+ break;
+ case '\r':
+ w.Write('\\');
+ w.Write('r');
+ break;
+ case '\t':
+ w.Write('\\');
+ w.Write('t');
+ break;
+
+ default:
+ w.Write(it.Current);
+ break;
+ }
+ }
+ }
+
+ public static void Escape(Utf8String s, IStore w)
+ {
+ if (s.IsEmpty)
+ {
+ return;
+ }
+
+ var it = s.GetIterator();
+ while(it.MoveNext())
+ {
+ var l = it.CurrentByteLength;
+ if (l == 1)
+ {
+ var b = it.Current;
+ switch (b)
+ {
+ case (Byte)'"':
+ case (Byte)'\\':
+ case (Byte)'/':
+ // \\ prefix
+ w.Write((Byte)'\\');
+ w.Write(b);
+ break;
+
+ case (Byte)'\b':
+ w.Write((Byte)'\\');
+ w.Write((Byte)'b');
+ break;
+ case (Byte)'\f':
+ w.Write((Byte)'\\');
+ w.Write((Byte)'f');
+ break;
+ case (Byte)'\n':
+ w.Write((Byte)'\\');
+ w.Write((Byte)'n');
+ break;
+ case (Byte)'\r':
+ w.Write((Byte)'\\');
+ w.Write((Byte)'r');
+ break;
+ case (Byte)'\t':
+ w.Write((Byte)'\\');
+ w.Write((Byte)'t');
+ break;
+
+ default:
+ w.Write(b);
+ break;
+ }
+ // ascii
+ }
+ else if (l == 2)
+ {
+ w.Write(it.Current);
+ w.Write(it.Second);
+ }
+ else if (l == 3)
+ {
+ w.Write(it.Current);
+ w.Write(it.Second);
+ w.Write(it.Third);
+ }
+ else if (l == 4)
+ {
+ w.Write(it.Current);
+ w.Write(it.Second);
+ w.Write(it.Third);
+ w.Write(it.Fourth);
+ }
+ else
+ {
+ throw new ParserException("invalid utf8");
+ }
+ }
+ }
+
+ public static string Escape(String s)
+ {
+ var sb = new StringBuilder();
+ Escape(s, new StringBuilderStore(sb));
+ return sb.ToString();
+ }
+
+ public static void Quote(String s, IStore w)
+ {
+ w.Write('"');
+ Escape(s, w);
+ w.Write('"');
+ }
+
+ public static void Quote(Utf8String s, IStore w)
+ {
+ w.Write((Byte)'"');
+ Escape(s, w);
+ w.Write((Byte)'"');
+ }
+
+ /// <summary>
+ /// Added " and Escape
+ /// </summary>
+ /// <param name="s"></param>
+ /// <param name="w"></param>
+ public static string Quote(string s)
+ {
+ var sb = new StringBuilder();
+ Quote(s, new StringBuilderStore(sb));
+ return sb.ToString();
+ }
+
+ public static Utf8String Quote(Utf8String s)
+ {
+ var sb = new BytesStore(s.ByteLength);
+ Quote(s, sb);
+ return new Utf8String(sb.Bytes);
+ }
+ #endregion
+
+ #region Unquote
+ public static int Unescape(string src, IStore w)
+ {
+ int writeCount = 0;
+ Action<Char> Write = c =>
+ {
+ if (w != null)
+ {
+ w.Write(c);
+ }
+ ++writeCount;
+ };
+
+ int i = 0;
+ int length = src.Length - 1;
+ while (i < length)
+ {
+ if (src[i] == '\\')
+ {
+ var c = src[i + 1];
+ switch (c)
+ {
+ case '\\':
+ case '/':
+ case '"':
+ // remove prefix
+ Write(c);
+ i += 2;
+ continue;
+
+ case 'b':
+ Write('\b');
+ i += 2;
+ continue;
+ case 'f':
+ Write('\f');
+ i += 2;
+ continue;
+ case 'n':
+ Write('\n');
+ i += 2;
+ continue;
+ case 'r':
+ Write('\r');
+ i += 2;
+ continue;
+ case 't':
+ Write('\t');
+ i += 2;
+ continue;
+ }
+ }
+
+ Write(src[i]);
+ i += 1;
+ }
+ while (i <= length)
+ {
+ Write(src[i++]);
+ }
+
+ return writeCount;
+ }
+
+ public static int Unescape(Utf8String s, IStore w)
+ {
+ int writeCount = 0;
+ Action<Byte> Write = c =>
+ {
+ if (w != null)
+ {
+ w.Write(c);
+ }
+ ++writeCount;
+ };
+
+ var it = s.GetIterator();
+ while(it.MoveNext())
+ {
+ var l = it.CurrentByteLength;
+ if (l == 1)
+ {
+ if (it.Current == (Byte)'\\')
+ {
+ var c = it.Second;
+ switch (c)
+ {
+ case (Byte)'\\':
+ case (Byte)'/':
+ case (Byte)'"':
+ // remove prefix
+ Write(c);
+ it.MoveNext();
+ continue;
+
+ case (Byte)'b':
+ Write((Byte)'\b');
+ it.MoveNext();
+ continue;
+ case (Byte)'f':
+ Write((Byte)'\f');
+ it.MoveNext();
+ continue;
+ case (Byte)'n':
+ Write((Byte)'\n');
+ it.MoveNext();
+ continue;
+ case (Byte)'r':
+ Write((Byte)'\r');
+ it.MoveNext();
+ continue;
+ case (Byte)'t':
+ Write((Byte)'\t');
+ it.MoveNext();
+ continue;
+ }
+ }
+
+ Write(it.Current);
+ }
+ else if (l == 2)
+ {
+ Write(it.Current);
+ Write(it.Second);
+ }
+ else if (l == 3)
+ {
+ Write(it.Current);
+ Write(it.Second);
+ Write(it.Third);
+ }
+ else if (l == 4)
+ {
+ Write(it.Current);
+ Write(it.Second);
+ Write(it.Third);
+ Write(it.Fourth);
+ }
+ else
+ {
+ throw new ParserException("invalid utf8");
+ }
+ }
+
+ return writeCount;
+ }
+
+ public static string Unescape(string src)
+ {
+ var sb = new StringBuilder();
+ Unescape(src, new StringBuilderStore(sb));
+ return sb.ToString();
+ }
+
+ public static int Unquote(string src, IStore w)
+ {
+ return Unescape(src.Substring(1, src.Length - 2), w);
+ }
+
+ public static int Unquote(Utf8String src, IStore w)
+ {
+ return Unescape(src.Subbytes(1, src.ByteLength - 2), w);
+ }
+
+ public static string Unquote(string src)
+ {
+ var count = Unquote(src, null);
+ if (count == src.Length - 2)
+ {
+ return src.Substring(1, src.Length - 2);
+ }
+ else
+ {
+ var sb = new StringBuilder(count);
+ Unquote(src, new StringBuilderStore(sb));
+ var str = sb.ToString();
+ return str;
+ }
+ }
+
+ public static Utf8String Unquote(Utf8String src)
+ {
+ var count = Unquote(src, null);
+ if (count == src.ByteLength - 2)
+ {
+ return src.Subbytes(1, src.ByteLength - 2);
+ }
+ else
+ {
+ var sb = new BytesStore(count);
+ Unquote(src, sb);
+ return new Utf8String(sb.Bytes);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs.meta
new file mode 100644
index 00000000..46741726
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonString.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 04a331b0f78f87e4d928172d735672d9
+timeCreated: 1495517071
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs
new file mode 100644
index 00000000..97ddcef2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs
@@ -0,0 +1,125 @@
+using System;
+
+
+namespace UniJSON
+{
+ public struct JsonValue : IListTreeItem, IValue<JsonValue>
+ {
+ public Utf8String Segment;
+ public ArraySegment<Byte> Bytes { get { return Segment.Bytes; } }
+ public void SetBytesCount(int count)
+ {
+ Segment = new Utf8String(new ArraySegment<byte>(Bytes.Array, Bytes.Offset, count));
+ }
+
+ public ValueNodeType ValueType
+ {
+ get;
+ private set;
+ }
+
+ public int ParentIndex
+ {
+ get;
+ private set;
+ }
+
+ int _childCount;
+ public int ChildCount
+ {
+ get { return _childCount; }
+ }
+ public void SetChildCount(int count)
+ {
+ _childCount = count;
+ }
+
+ public JsonValue(Utf8String segment, ValueNodeType valueType, int parentIndex) : this()
+ {
+ Segment = segment;
+ ValueType = valueType;
+ ParentIndex = parentIndex;
+ }
+
+ public JsonValue New(ArraySegment<byte> bytes, ValueNodeType valueType, int parentIndex)
+ {
+ return new JsonValue(new Utf8String(bytes), valueType, parentIndex);
+ }
+
+ public JsonValue Key(Utf8String key, int parentIndex)
+ {
+ return new JsonValue(JsonString.Quote(key), ValueNodeType.String, parentIndex);
+ }
+
+ public override string ToString()
+ {
+ switch (ValueType)
+ {
+ case ValueNodeType.Null:
+ case ValueNodeType.Boolean:
+ case ValueNodeType.Integer:
+ case ValueNodeType.Number:
+ case ValueNodeType.Array:
+ case ValueNodeType.Object:
+ case ValueNodeType.String:
+ case ValueNodeType.NaN:
+ case ValueNodeType.Infinity:
+ case ValueNodeType.MinusInfinity:
+ return Segment.ToString();
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ static Utf8String s_true = Utf8String.From("true");
+ static Utf8String s_false = Utf8String.From("false");
+
+ public Boolean GetBoolean()
+ {
+ if (Segment == s_true)
+ {
+ return true;
+ }
+ else if (Segment == s_false)
+ {
+ return false;
+ }
+ else
+ {
+ throw new DeserializationException("invalid boolean: " + Segment.ToString());
+ }
+ }
+
+ public SByte GetSByte() { return Segment.ToSByte(); }
+ public Int16 GetInt16() { return Segment.ToInt16(); }
+ public Int32 GetInt32() { return Segment.ToInt32(); }
+ public Int64 GetInt64() { return Segment.ToInt64(); }
+ public Byte GetByte() { return Segment.ToByte(); }
+ public UInt16 GetUInt16() { return Segment.ToUInt16(); }
+ public UInt32 GetUInt32() { return Segment.ToUInt32(); }
+ public UInt64 GetUInt64() { return Segment.ToUInt64(); }
+ public Single GetSingle() { return Segment.ToSingle(); }
+ public Double GetDouble() { return Segment.ToDouble(); }
+ public String GetString() { return JsonString.Unquote(Segment.ToString()); }
+ public Utf8String GetUtf8String() { return JsonString.Unquote(Segment); }
+
+ public T GetValue<T>()
+ {
+ switch (ValueType)
+ {
+ case ValueNodeType.Null: return GenericCast<object, T>.Null();
+ case ValueNodeType.Boolean: return GenericCast<bool, T>.Cast(GetBoolean());
+ case ValueNodeType.Integer: return GenericCast<int, T>.Cast(GetInt32());
+ case ValueNodeType.Number:
+ case ValueNodeType.NaN:
+ case ValueNodeType.Infinity:
+ case ValueNodeType.MinusInfinity:
+ return GenericCast<double, T>.Cast(GetDouble());
+ case ValueNodeType.String: return GenericCast<string, T>.Cast(GetString());
+ }
+
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs.meta
new file mode 100644
index 00000000..314b7142
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Json/JsonValue.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0b59a66ed8e7b1c419d69f7ee07900c1
+timeCreated: 1526178270
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator.meta
new file mode 100644
index 00000000..817676fe
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: bebbecaad7b8e70479f6378faadbccbe
+folderAsset: yes
+timeCreated: 1531812228
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs
new file mode 100644
index 00000000..39449b6c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+
+namespace UniJSON
+{
+ public class JsonSchemaValidationContext
+ {
+ Stack<string> m_stack = new Stack<string>();
+
+ public bool EnableDiagnosisForNotRequiredFields = false;
+
+ public JsonSchemaValidationContext(object o)
+ {
+ Push(o.GetType().Name);
+ }
+
+ public ActionDisposer Push(object o)
+ {
+ m_stack.Push(o.ToString());
+ return new ActionDisposer(Pop);
+ }
+
+ public void Pop()
+ {
+ m_stack.Pop();
+ }
+
+ public bool IsEmpty()
+ {
+ return m_stack.Count == 1; // A first element will be remained.
+ }
+
+ public override string ToString()
+ {
+ return string.Join(".", m_stack.ToArray(), 0, m_stack.Count);
+ }
+ }
+
+
+ public class JsonSchemaValidationException : Exception
+ {
+ public Exception Error
+ {
+ get; private set;
+ }
+
+ public JsonSchemaValidationException(JsonSchemaValidationContext context, string msg) : base(string.Format("[{0}] {1}", context, msg))
+ {
+ }
+
+ public JsonSchemaValidationException(JsonSchemaValidationContext context, Exception ex) : base(string.Format("[{0}] {1}", context, ex))
+ {
+ Error = ex;
+ }
+ }
+
+
+ public interface IJsonSchemaValidator
+ {
+ #region JsonSchema
+ void Merge(IJsonSchemaValidator rhs);
+
+ /// <summary>
+ /// Parse json schema
+ /// </summary>
+ /// <param name="fs"></param>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value);
+
+ void ToJsonSchema(IFormatter f);
+ #endregion
+
+ #region Serializer
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="o"></param>
+ /// <returns>return null if validate value</returns>
+ JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext context, T value);
+
+ void Serialize<T>(IFormatter f, JsonSchemaValidationContext context, T value);
+
+ void Deserialize<T, U>(ListTreeNode<T> src, ref U dst) where T : IListTreeItem, IValue<T>;
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs.meta
new file mode 100644
index 00000000..0470e0b4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/IJsonSchemaValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c35476cdb8e1a4541b2f06b9b11141d0
+timeCreated: 1531812340
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs
new file mode 100644
index 00000000..501fa6f0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs
@@ -0,0 +1,300 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4
+ /// </summary>
+ public class JsonArrayValidator : IJsonSchemaValidator
+ {
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.1
+ /// </summary>
+ public JsonSchema Items
+ {
+ get; set;
+ }
+
+ // additionalItems
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.3
+ /// </summary>
+ public int? MaxItems
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.4.4
+ /// </summary>
+ public int? MinItems
+ {
+ get; set;
+ }
+
+ // uniqueItems
+
+ // contains
+
+ public override int GetHashCode()
+ {
+ return 5;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonArrayValidator;
+ if (rhs == null) return false;
+
+ if (Items != rhs.Items) return false;
+ if (MaxItems != rhs.MaxItems) return false;
+ if (MinItems != rhs.MinItems) return false;
+
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator rhs)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ switch (key)
+ {
+ case "items":
+ if (value.IsArray())
+ {
+ throw new NotImplementedException();
+ }
+ else
+ {
+ var sub = new JsonSchema();
+ sub.Parse(fs, value, "items");
+ Items = sub;
+ }
+ return true;
+
+ case "additionalItems":
+ return true;
+
+ case "maxItems":
+ MaxItems = value.GetInt32();
+ return true;
+
+ case "minItems":
+ MinItems = value.GetInt32();
+ return true;
+
+ case "uniqueItems":
+ return true;
+
+ case "contains":
+ return true;
+ }
+
+ return false;
+ }
+
+ static class GenericCounter<T>
+ {
+ delegate int Counter(T value);
+
+ static Counter s_counter;
+
+ public static int Count(T value)
+ {
+ if (s_counter == null)
+ {
+ var t = typeof(T);
+ if (t.IsArray)
+ {
+ var pi = t.GetProperty("Length");
+ var compiled = (Func<T, int>)((T array) =>
+ {
+ return (int)pi.GetValue(array, null);
+ });
+ s_counter = new Counter(compiled);
+ }
+ else if (t.GetIsGenericList())
+ {
+ var pi = t.GetProperty("Count");
+ var compiled = (Func<T, int>)((T list) =>
+ {
+ return (int)pi.GetValue(list, null);
+ });
+ s_counter = new Counter(compiled);
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ return s_counter(value);
+ }
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext context, T o)
+ {
+ if (o == null)
+ {
+ return new JsonSchemaValidationException(context, "null");
+ }
+
+ var count = GenericCounter<T>.Count(o);
+
+ // Empty array is valid
+ /*if (count == 0)
+ {
+ return new JsonSchemaValidationException(context, "empty");
+ }*/
+
+ if (MaxItems.HasValue && count > MaxItems.Value)
+ {
+ return new JsonSchemaValidationException(context, "maxItems");
+ }
+
+ if (MinItems.HasValue && count < MinItems.Value)
+ {
+ return new JsonSchemaValidationException(context, "minItems");
+ }
+
+ if (Items == null)
+ {
+ return null; // There are no json schema for items, success
+ }
+
+ var v = Items.Validator;
+ var t = o.GetType();
+ IEnumerable iter = null;
+ if (t.IsArray)
+ {
+ iter = o as Array;
+ }
+ else if (t.GetIsGenericList())
+ {
+ iter = o as IList;
+ }
+ else
+ {
+ return new JsonSchemaValidationException(context, "non iterable object");
+ }
+
+ foreach(var e in iter)
+ {
+ var ex = v.Validate(context, e);
+ if (ex != null)
+ {
+ return ex;
+ }
+ };
+
+ return null;
+ }
+
+ static void ArraySerializer<U>(IJsonSchemaValidator v, IFormatter f, JsonSchemaValidationContext c, U[] array)
+ {
+ f.BeginList(array.Length);
+ {
+ //int i = 0;
+ foreach (var x in array)
+ {
+ //using (c.Push(i++))
+ {
+ v.Serialize(f, c, x);
+ }
+ }
+ }
+ f.EndList();
+ }
+
+ static void ListSerializer<U>(IJsonSchemaValidator v, IFormatter f, JsonSchemaValidationContext c, List<U> list)
+ {
+ f.BeginList(list.Count);
+ {
+ //int i = 0;
+ foreach (var x in list)
+ {
+ //using (c.Push(i++))
+ {
+ v.Serialize(f, c, x);
+ }
+ }
+ }
+ f.EndList();
+ }
+
+ static class GenericSerializer<T>
+ {
+ delegate void Serializer(IJsonSchemaValidator v, IFormatter f, JsonSchemaValidationContext c, T o);
+
+ static Serializer s_serializer;
+
+ public static void Serialize(IJsonSchemaValidator v, IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ if (s_serializer == null)
+ {
+ var t = typeof(T);
+ MethodInfo g = null;
+ if (t.IsArray)
+ {
+ var mi = typeof(JsonArrayValidator).GetMethod("ArraySerializer",
+ BindingFlags.Static | BindingFlags.NonPublic);
+ g = mi.MakeGenericMethod(t.GetElementType());
+ }
+ else if (t.GetIsGenericList())
+ {
+ // ToDo: IList
+ var mi = typeof(JsonArrayValidator).GetMethod("ListSerializer",
+ BindingFlags.Static | BindingFlags.NonPublic);
+ g = mi.MakeGenericMethod(t.GetGenericArguments());
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+
+ var compiled = (Action<
+ IJsonSchemaValidator,
+ IFormatter,
+ JsonSchemaValidationContext,
+ T>)
+ GenericInvokeCallFactory.StaticAction<
+ IJsonSchemaValidator,
+ IFormatter,
+ JsonSchemaValidationContext,
+ T>(g);
+ s_serializer = new Serializer(compiled);
+ }
+ s_serializer(v, f, c, o);
+ }
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ GenericSerializer<T>.Serialize(Items.Validator, f, c, o);
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("array");
+
+ if (Items != null)
+ {
+ f.Key("items");
+ Items.ToJson(f);
+ }
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ src.Deserialize(ref dst);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs.meta
new file mode 100644
index 00000000..0c5ed09b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonArrayValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6144a646f2f535641885a006024771a4
+timeCreated: 1531812663
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs
new file mode 100644
index 00000000..93e4f1a2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs
@@ -0,0 +1,51 @@
+using System;
+
+
+namespace UniJSON
+{
+ public class JsonBoolValidator : IJsonSchemaValidator
+ {
+ public override int GetHashCode()
+ {
+ return 1;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonBoolValidator;
+ if (rhs == null) return false;
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ return false;
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("boolean");
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T value)
+ {
+ return null;
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T value)
+ {
+ f.Serialize(value);
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ dst = GenericCast<bool, U>.Cast(src.GetBoolean());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs.meta
new file mode 100644
index 00000000..6604e10c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonBoolValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2a6454bbd9b910d499702d2ba8270ea0
+timeCreated: 1531812394
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs
new file mode 100644
index 00000000..c28fab0a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs
@@ -0,0 +1,307 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace UniJSON
+{
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5
+ /// </summary>
+ public class JsonDictionaryValidator<T> : IJsonSchemaValidator
+ {
+ public JsonDictionaryValidator()
+ {
+ AdditionalProperties = JsonSchema.FromType<T>();
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.1
+ /// </summary>
+ public int MaxProperties
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.2
+ /// </summary>
+ public int MinProperties
+ {
+ get; set;
+ }
+
+ List<string> m_required = new List<string>();
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3
+ /// </summary>
+ public List<string> Required
+ {
+ get { return m_required; }
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5
+ /// </summary>
+ public string PatternProperties
+ {
+ get; private set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6
+ /// </summary>
+ public JsonSchema AdditionalProperties
+ {
+ get; set;
+ }
+
+ Dictionary<string, string[]> m_dependencies;
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7
+ /// </summary>
+ public Dictionary<string, string[]> Dependencies
+ {
+ get
+ {
+ if (m_dependencies == null)
+ {
+ m_dependencies = new Dictionary<string, string[]>();
+ }
+ return m_dependencies;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return 6;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonObjectValidator;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ if (Required.Count != rhs.Required.Count)
+ {
+ return false;
+ }
+ if (!Required.OrderBy(x => x).SequenceEqual(rhs.Required.OrderBy(x => x)))
+ {
+ return false;
+ }
+
+ if (Dependencies.Count != rhs.Dependencies.Count)
+ {
+ return false;
+ }
+ foreach (var kv in Dependencies)
+ {
+ if (!kv.Value.OrderBy(x => x).SequenceEqual(rhs.Dependencies[kv.Key].OrderBy(x => x)))
+ {
+ return false;
+ }
+ }
+
+ if (AdditionalProperties == null
+ && rhs.AdditionalProperties == null)
+ {
+ // ok
+ }
+ else if (AdditionalProperties == null)
+ {
+ return false;
+ }
+ else if (rhs.AdditionalProperties == null)
+ {
+ return false;
+ }
+ else
+ {
+ if (!AdditionalProperties.Equals(rhs.AdditionalProperties))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ var rhs = obj as JsonObjectValidator;
+ if (rhs == null)
+ {
+ throw new ArgumentException();
+ }
+
+ foreach (var x in rhs.Required)
+ {
+ this.Required.Add(x);
+ }
+
+ if (rhs.AdditionalProperties != null)
+ {
+ if (AdditionalProperties != null)
+ {
+ throw new NotImplementedException();
+ }
+ AdditionalProperties = rhs.AdditionalProperties;
+ }
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ switch (key)
+ {
+ case "maxProperties":
+ MaxProperties = value.GetInt32();
+ return true;
+
+ case "minProperties":
+ MinProperties = value.GetInt32();
+ return true;
+
+ case "required":
+ {
+ foreach (var req in value.ArrayItems())
+ {
+ m_required.Add(req.GetString());
+ }
+ }
+ return true;
+
+ case "patternProperties":
+ PatternProperties = value.GetString();
+ return true;
+
+ case "additionalProperties":
+ {
+ var sub = new JsonSchema();
+ sub.Parse(fs, value, "additionalProperties");
+ AdditionalProperties = sub;
+ }
+ return true;
+
+ case "dependencies":
+ {
+ foreach (var kv in value.ObjectItems())
+ {
+ Dependencies.Add(kv.Key.GetString(), kv.Value.ArrayItems().Select(x => x.GetString()).ToArray());
+ }
+ }
+ return true;
+
+ case "propertyNames":
+ return true;
+ }
+
+ return false;
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("object");
+ }
+
+ public JsonSchemaValidationException Validate<S>(JsonSchemaValidationContext c, S o)
+ {
+ if (o == null)
+ {
+ return new JsonSchemaValidationException(c, "null");
+ }
+
+ var d = o as IDictionary<string, T>;
+ if (d == null)
+ {
+ return new JsonSchemaValidationException(c, "not dictionary");
+ }
+
+ if (Required != null)
+ {
+ foreach (var x in Required)
+ {
+ using (c.Push(x))
+ {
+ // ToDo
+ }
+ }
+ }
+
+ if (AdditionalProperties != null)
+ {
+ foreach (var kv in d)
+ {
+ using (c.Push(kv.Key))
+ {
+ var result = AdditionalProperties.Validator.Validate(c, kv.Value);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ Dictionary<string, object> m_validValueMap = new Dictionary<string, object>();
+
+ public void Serialize<S>(IFormatter f, JsonSchemaValidationContext c, S o)
+ {
+ // validate properties
+ m_validValueMap.Clear();
+
+ var dict = o as Dictionary<string, T>;
+ f.BeginMap(dict.Count);
+ {
+ foreach (var kv in dict)
+ {
+ // key
+ f.Key(kv.Key);
+
+ // value
+ //using (c.Push(kv.Key))
+ {
+ AdditionalProperties.Validator.Serialize(f, c, kv.Value);
+ }
+ }
+ }
+ f.EndMap();
+ }
+
+ public void Deserialize<U, V>(ListTreeNode<U> src, ref V dst)
+ where U : IListTreeItem, IValue<U>
+ {
+ src.Deserialize(ref dst);
+ }
+ }
+
+ public static class JsonDictionaryValidator
+ {
+ public static JsonDictionaryValidator<T> Create<T>()
+ {
+ return new JsonDictionaryValidator<T>();
+ }
+
+ #region AOT
+ public static JsonDictionaryValidator<Single> CreateSingle()
+ {
+ return Create<Single>();
+ }
+
+ public static JsonDictionaryValidator<Int32> CreateInt32()
+ {
+ return Create<Int32>();
+ }
+
+ public static JsonDictionaryValidator<Boolean> CreateBoolean()
+ {
+ return Create<Boolean>();
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs.meta
new file mode 100644
index 00000000..65d5fbc0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonDictionaryValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ccee0323c35d40d498d45b207124fe7e
+timeCreated: 1531812708
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs
new file mode 100644
index 00000000..26177ef6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs
@@ -0,0 +1,441 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static class JsonEnumValidator
+ {
+ public static IJsonSchemaValidator Create(ListTreeNode<JsonValue> value)
+ {
+ foreach (var x in value.ArrayItems())
+ {
+ if (x.IsInteger() || x.IsFloat())
+ {
+ return JsonIntEnumValidator.Create(value.ArrayItems()
+ .Where(y => y.IsInteger() || y.IsFloat())
+ .Select(y => y.GetInt32())
+ );
+ }
+ else if (x.IsString())
+ {
+
+ return JsonStringEnumValidator.Create(value.ArrayItems()
+ .Where(y => y.IsString())
+ .Select(y => y.GetString())
+ , EnumSerializationType.AsString
+ );
+ }
+ else
+ {
+ }
+ }
+
+ throw new NotImplementedException();
+ }
+
+ public static IJsonSchemaValidator Create(IEnumerable<JsonSchema> composition, EnumSerializationType type)
+ {
+ foreach (var x in composition)
+ {
+ if (x.Validator is JsonStringEnumValidator)
+ {
+ return JsonStringEnumValidator.Create(composition
+ .Select(y => y.Validator as JsonStringEnumValidator)
+ .Where(y => y != null)
+ .SelectMany(y => y.Values),
+ type
+ );
+ }
+ if (x.Validator is JsonIntEnumValidator)
+ {
+ return JsonIntEnumValidator.Create(composition
+ .Select(y => y.Validator as JsonIntEnumValidator)
+ .Where(y => y != null)
+ .SelectMany(y => y.Values)
+ );
+ }
+ }
+
+ throw new NotImplementedException();
+ }
+
+ static IEnumerable<string> GetStringValues(Type t, object[] excludes, Func<String, String> filter)
+ {
+ foreach (var x in Enum.GetValues(t))
+ {
+ if (excludes == null || !excludes.Contains(x))
+ {
+ yield return filter(x.ToString());
+ }
+ }
+ }
+
+ static IEnumerable<int> GetIntValues(Type t, object[] excludes)
+ {
+ foreach (var x in Enum.GetValues(t))
+ {
+ if (excludes == null || !excludes.Contains(x))
+ {
+ yield return (int)x;
+ }
+ }
+ }
+
+ public static IJsonSchemaValidator Create(Type t, EnumSerializationType serializationType, object[] excludes)
+ {
+ switch (serializationType)
+ {
+ case EnumSerializationType.AsInt:
+ return JsonIntEnumValidator.Create(GetIntValues(t, excludes));
+
+ case EnumSerializationType.AsString:
+ return JsonStringEnumValidator.Create(GetStringValues(t, excludes, x => x), serializationType);
+
+ case EnumSerializationType.AsLowerString:
+ return JsonStringEnumValidator.Create(GetStringValues(t, excludes, x => x.ToLower()), serializationType);
+
+ case EnumSerializationType.AsUpperString:
+ return JsonStringEnumValidator.Create(GetStringValues(t, excludes, x => x.ToUpper()), serializationType);
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ public static IJsonSchemaValidator Create(object[] values, EnumSerializationType type)
+ {
+ foreach (var x in values)
+ {
+ if (x is string)
+ {
+ return JsonStringEnumValidator.Create(values.Select(y => (string)y), type);
+ }
+ if (x is int)
+ {
+ return JsonIntEnumValidator.Create(values.Select(y => (int)y));
+ }
+ }
+
+ throw new NotImplementedException();
+ }
+ }
+
+ public class JsonStringEnumValidator : IJsonSchemaValidator
+ {
+ EnumSerializationType SerializationType;
+
+ public String[] Values
+ {
+ get; set;
+ }
+
+ JsonStringEnumValidator(IEnumerable<string> values, EnumSerializationType type)
+ {
+ SerializationType = type;
+ switch (SerializationType)
+ {
+ case EnumSerializationType.AsString:
+ Values = values.ToArray();
+ break;
+
+ case EnumSerializationType.AsLowerString:
+ Values = values.Select(x => x.ToLower()).ToArray();
+ break;
+
+ case EnumSerializationType.AsUpperString:
+ Values = values.Select(x => x.ToUpper()).ToArray();
+ break;
+
+ case EnumSerializationType.AsInt:
+ throw new ArgumentException("JsonStringEnumValidator not allow AsInt");
+
+ default:
+ throw new NotImplementedException("");
+ }
+ }
+
+ public static JsonStringEnumValidator Create(IEnumerable<string> values, EnumSerializationType type)
+ {
+ return new JsonStringEnumValidator(values, type);
+ }
+
+ public override int GetHashCode()
+ {
+ return 7;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonStringEnumValidator;
+ if (rhs == null) return false;
+
+ if (Values.Length != rhs.Values.Length) return false;
+
+ var l = Values.OrderBy(x => x).GetEnumerator();
+ var r = rhs.Values.OrderBy(x => x).GetEnumerator();
+ while (l.MoveNext() && r.MoveNext())
+ {
+ if (l.Current != r.Current)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("string");
+ f.Key("enum");
+ f.BeginList(Values.Length);
+ foreach (var x in Values)
+ {
+ f.Value(x);
+ }
+ f.EndList();
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T o)
+ {
+ if (o == null)
+ {
+ return new JsonSchemaValidationException(c, "null");
+ }
+
+ var t = o.GetType();
+ string value = null;
+ if (t.IsEnum)
+ {
+ value = Enum.GetName(t, o);
+ }
+ else
+ {
+ value = GenericCast<T, string>.Cast(o);
+ }
+
+ if (SerializationType == EnumSerializationType.AsLowerString)
+ {
+ value = value.ToLower();
+ }
+ else if (SerializationType == EnumSerializationType.AsUpperString)
+ {
+ value = value.ToUpper();
+ }
+
+ if (Values.Contains(value))
+ {
+ return null;
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("{0} is not valid enum", o));
+ }
+ }
+
+ public static class GenericSerializer<T>
+ {
+ delegate void Serializer(JsonStringEnumValidator v,
+ IFormatter f, JsonSchemaValidationContext c, T o);
+
+ static Serializer s_serializer;
+
+ public static void Serialize(JsonStringEnumValidator validator,
+ IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ if (s_serializer == null)
+ {
+ var t = typeof(T);
+ if (t.IsEnum)
+ {
+ s_serializer = (vv, ff, cc, oo) =>
+ {
+ var value = Enum.GetName(t, oo);
+ if (vv.SerializationType == EnumSerializationType.AsLowerString)
+ {
+ value = value.ToLower();
+ }
+ else if (vv.SerializationType == EnumSerializationType.AsUpperString)
+ {
+ value = value.ToUpper();
+ }
+ ff.Value(value);
+ };
+ }
+ else if (t == typeof(string))
+ {
+ s_serializer = (vv, ff, cc, oo) =>
+ {
+ var value = GenericCast<T, string>.Cast(oo);
+ if (vv.SerializationType == EnumSerializationType.AsLowerString)
+ {
+ value = value.ToLower();
+ }
+ else if (vv.SerializationType == EnumSerializationType.AsUpperString)
+ {
+ value = value.ToUpper();
+ }
+ ff.Value(value);
+ };
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ s_serializer(validator, f, c, o);
+ }
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ GenericSerializer<T>.Serialize(this, f, c, o);
+ }
+
+ static class GenericDeserializer<T, U>
+ where T : IListTreeItem, IValue<T>
+ {
+ delegate U Deserializer(ListTreeNode<T> src);
+ static Deserializer s_d;
+ public static void Deserialize(ListTreeNode<T> src, ref U t)
+ {
+ if (s_d == null)
+ {
+ if (typeof(U).IsEnum)
+ {
+ // enum from string
+ var mi = typeof(Enum).GetMethods(BindingFlags.Static | BindingFlags.Public).First(
+ x => x.Name == "Parse" && x.GetParameters().Length == 3
+ );
+
+ var enumParse = GenericInvokeCallFactory.StaticFunc<Type, string, bool, object>(mi);
+ s_d = x =>
+ {
+ var enumValue = enumParse(typeof(U), x.GetString(), true);
+ return GenericCast<object, U>.Cast(enumValue);
+ };
+ }
+ else
+ {
+ s_d = x => GenericCast<string, U>.Cast(x.GetString());
+ }
+ }
+ t = s_d(src);
+ }
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ GenericDeserializer<T, U>.Deserialize(src, ref dst);
+ }
+ }
+
+ public class JsonIntEnumValidator : IJsonSchemaValidator
+ {
+ public int[] Values
+ {
+ get; set;
+ }
+
+ public static JsonIntEnumValidator Create(IEnumerable<int> values)
+ {
+ return new JsonIntEnumValidator
+ {
+ Values = values.ToArray()
+ };
+ }
+
+ public override int GetHashCode()
+ {
+ return 7;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonIntEnumValidator;
+ if (rhs == null) return false;
+
+ if (Values.Length != rhs.Values.Length) return false;
+
+ var l = Values.OrderBy(x => x).GetEnumerator();
+ var r = rhs.Values.OrderBy(x => x).GetEnumerator();
+ while (l.MoveNext() && r.MoveNext())
+ {
+ if (l.Current != r.Current)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("integer");
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T o)
+ {
+ if (Values.Contains(GenericCast<T, int>.Cast(o)))
+ {
+ return null;
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("{0} is not valid enum", o));
+ }
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ f.Serialize(GenericCast<T, int>.Cast(o));
+ }
+
+ static class GenericDeserializer<T, U>
+ where T : IListTreeItem, IValue<T>
+ {
+ delegate U Deserializer(ListTreeNode<T> src);
+
+ static Deserializer s_d;
+
+ public static void Deserialize(ListTreeNode<T> src, ref U dst)
+ {
+ if (s_d == null)
+ {
+ // enum from int
+ s_d = s => GenericCast<int, U>.Cast(s.GetInt32());
+ }
+ dst = s_d(src);
+ }
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ GenericDeserializer<T, U>.Deserialize(src, ref dst);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs.meta
new file mode 100644
index 00000000..0fd90809
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonEnumValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f503fff7ab8dcf74abc9dd8073aa9062
+timeCreated: 1531812758
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs
new file mode 100644
index 00000000..223ff4bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs
@@ -0,0 +1,430 @@
+using System;
+
+
+namespace UniJSON
+{
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#numeric
+ /// </summary>
+ public class JsonIntValidator : IJsonSchemaValidator
+ {
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.1
+ /// </summary>
+ public int? MultipleOf
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2
+ /// </summary>
+ public int? Maximum
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.3
+ /// </summary>
+ public bool ExclusiveMaximum
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4
+ /// </summary>
+ public int? Minimum
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5
+ /// </summary>
+ public bool ExclusiveMinimum
+ {
+ get; set;
+ }
+
+ public override int GetHashCode()
+ {
+ return 2;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonIntValidator;
+ if (rhs == null) return false;
+
+ if (MultipleOf != rhs.MultipleOf)
+ {
+ Console.WriteLine("MultipleOf");
+ return false;
+ }
+ if (Maximum != rhs.Maximum)
+ {
+ Console.WriteLine("Maximum");
+ return false;
+ }
+
+ if (ExclusiveMaximum != rhs.ExclusiveMaximum)
+ {
+ Console.WriteLine("ExclusiveMaximum");
+ return false;
+ }
+
+ if (Minimum != rhs.Minimum)
+ {
+ Console.WriteLine("Minimum");
+ return false;
+ }
+
+ if (ExclusiveMinimum != rhs.ExclusiveMinimum)
+ {
+ Console.WriteLine("ExclusiveMinimum");
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ switch (key)
+ {
+ case "multipleOf":
+ MultipleOf = value.GetInt32();
+ return true;
+
+ case "maximum":
+ Maximum = value.GetInt32();
+ return true;
+
+ case "exclusiveMaximum":
+ ExclusiveMaximum = value.GetBoolean();
+ return true;
+
+ case "minimum":
+ Minimum = value.GetInt32();
+ return true;
+
+ case "exclusiveMinimum":
+ ExclusiveMinimum = value.GetBoolean();
+ return true;
+ }
+
+ return false;
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("integer");
+ if (Minimum.HasValue)
+ {
+ f.Key("minimum"); f.Value(Minimum.Value);
+ }
+ if (Maximum.HasValue)
+ {
+ f.Key("maximum"); f.Value(Maximum.Value);
+ }
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ var rhs = obj as JsonIntValidator;
+ if (rhs == null)
+ {
+ throw new ArgumentException();
+ }
+
+ MultipleOf = rhs.MultipleOf;
+ Maximum = rhs.Maximum;
+ ExclusiveMaximum = rhs.ExclusiveMaximum;
+ Minimum = rhs.Minimum;
+ ExclusiveMinimum = rhs.ExclusiveMinimum;
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T o)
+ {
+ try
+ {
+ var value = GenericCast<T, int>.Cast(o);
+
+ if (Minimum.HasValue)
+ {
+ if (ExclusiveMinimum)
+ {
+ if (value > Minimum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("minimum: ! {0}>{1}", value, Minimum.Value));
+ }
+ }
+ else
+ {
+ if (value >= Minimum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("minimum: ! {0}>={1}", value, Minimum.Value));
+ }
+ }
+ }
+
+ if (Maximum.HasValue)
+ {
+ if (ExclusiveMaximum)
+ {
+ if (value < Maximum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("maximum: ! {0}<{1}", value, Maximum.Value));
+ }
+ }
+ else
+ {
+ if (value <= Maximum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("maximum: ! {0}<={1}", value, Maximum.Value));
+ }
+ }
+ }
+
+ if (MultipleOf.HasValue && value % MultipleOf.Value != 0)
+ {
+ return new JsonSchemaValidationException(c, string.Format("multipleOf: {0}%{1}", value, MultipleOf.Value));
+ }
+
+ return null;
+ }
+ catch (Exception ex)
+ {
+ return new JsonSchemaValidationException(c, ex);
+ }
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ f.Serialize(GenericCast<T, int>.Cast(o));
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ dst = GenericCast<int, U>.Cast(src.GetInt32());
+ }
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#numeric
+ /// </summary>
+ public class JsonNumberValidator : IJsonSchemaValidator
+ {
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.1
+ /// </summary>
+ public double? MultipleOf
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.2
+ /// </summary>
+ public double? Maximum
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.3
+ /// </summary>
+ public bool ExclusiveMaximum
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.4
+ /// </summary>
+ public double? Minimum
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.2.5
+ /// </summary>
+ public bool ExclusiveMinimum
+ {
+ get; set;
+ }
+
+ public override int GetHashCode()
+ {
+ return 3;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonNumberValidator;
+ if (rhs == null) return false;
+
+ if (MultipleOf != rhs.MultipleOf) return false;
+ if (Maximum != rhs.Maximum) return false;
+ if (ExclusiveMaximum != rhs.ExclusiveMaximum) return false;
+ if (Minimum != rhs.Minimum) return false;
+ if (ExclusiveMinimum != rhs.ExclusiveMinimum) return false;
+
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator rhs)
+ {
+ throw new NotImplementedException();
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ switch (key)
+ {
+ case "multipleOf":
+ MultipleOf = value.GetDouble();
+ return true;
+
+ case "maximum":
+ Maximum = value.GetDouble();
+ return true;
+
+ case "exclusiveMaximum":
+ ExclusiveMaximum = value.GetBoolean();
+ return true;
+
+ case "minimum":
+ Minimum = value.GetDouble();
+ return true;
+
+ case "exclusiveMinimum":
+ ExclusiveMinimum = value.GetBoolean();
+ return true;
+ }
+
+ return false;
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("number");
+ if (Minimum.HasValue)
+ {
+ f.Key("minimum"); f.Value(Minimum.Value);
+ }
+ if (Maximum.HasValue)
+ {
+ f.Key("maximum"); f.Value(Maximum.Value);
+ }
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T o)
+ {
+ try
+ {
+ var value = Convert.ToDouble(o);
+
+ if (Minimum.HasValue)
+ {
+ if (ExclusiveMinimum)
+ {
+ if (value > Minimum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("minimum: ! {0}>{1}", value, Minimum.Value));
+ }
+ }
+ else
+ {
+ if (value >= Minimum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("minimum: ! {0}>={1}", value, Minimum.Value));
+ }
+ }
+ }
+
+ if (Maximum.HasValue)
+ {
+ if (ExclusiveMaximum)
+ {
+ if (value < Maximum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("maximum: ! {0}<{1}", value, Maximum.Value));
+ }
+ }
+ else
+ {
+ if (value <= Maximum.Value)
+ {
+ // ok
+ }
+ else
+ {
+ return new JsonSchemaValidationException(c, string.Format("maximum: ! {0}<={1}", value, Maximum.Value));
+ }
+ }
+ }
+
+ /*
+ if (MultipleOf.HasValue && value % MultipleOf.Value != 0)
+ {
+ return new JsonSchemaValidationException(c, string.Format("multipleOf: {0}%{1}", value, MultipleOf.Value));
+ }
+ */
+ if (MultipleOf.HasValue)
+ {
+ throw new NotImplementedException();
+ }
+
+ return null;
+ }
+ catch (Exception ex)
+ {
+ return new JsonSchemaValidationException(c, ex);
+ }
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ f.Serialize(o);
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ dst = GenericCast<double, U>.Cast(src.GetDouble());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs.meta
new file mode 100644
index 00000000..6651eeb4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonNumberValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: fb1d83ccd68b93c47821000b53471eae
+timeCreated: 1531812526
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs
new file mode 100644
index 00000000..e49ee8fc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs
@@ -0,0 +1,686 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5
+ /// </summary>
+ public class JsonObjectValidator : IJsonSchemaValidator
+ {
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.1
+ /// </summary>
+ public int MaxProperties
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.2
+ /// </summary>
+ public int MinProperties
+ {
+ get; set;
+ }
+
+ HashSet<string> m_required = new HashSet<string>();
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.3
+ /// </summary>
+ public HashSet<string> Required
+ {
+ get { return m_required; }
+ }
+
+ Dictionary<string, JsonSchema> m_props;
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.4
+ /// </summary>
+ public Dictionary<string, JsonSchema> Properties
+ {
+ get
+ {
+ if (m_props == null)
+ {
+ m_props = new Dictionary<string, JsonSchema>();
+ }
+ return m_props;
+ }
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.5
+ /// </summary>
+ public string PatternProperties
+ {
+ get; private set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.6
+ /// </summary>
+ public JsonSchema AdditionalProperties
+ {
+ get; set;
+ }
+
+ Dictionary<string, string[]> m_dependencies;
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.5.7
+ /// </summary>
+ public Dictionary<string, string[]> Dependencies
+ {
+ get
+ {
+ if (m_dependencies == null)
+ {
+ m_dependencies = new Dictionary<string, string[]>();
+ }
+ return m_dependencies;
+ }
+ }
+
+ public void AddProperty(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ var sub = new JsonSchema();
+ sub.Parse(fs, value, key);
+
+ if (Properties.ContainsKey(key))
+ {
+ if (sub.Validator != null)
+ {
+ Properties[key].Validator.Merge(sub.Validator);
+ }
+ }
+ else
+ {
+ Properties.Add(key, sub);
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return 6;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonObjectValidator;
+ if (rhs == null)
+ {
+ return false;
+ }
+
+ if (Properties.Count != rhs.Properties.Count)
+ {
+ return false;
+ }
+ foreach (var pair in Properties)
+ {
+ JsonSchema value;
+ if (rhs.Properties.TryGetValue(pair.Key, out value))
+ {
+#if true
+ if (!value.Equals(pair.Value))
+ {
+ Console.WriteLine(string.Format("{0} is not equals", pair.Key));
+ var l = pair.Value.Validator;
+ var r = value.Validator;
+ return false;
+ }
+#else
+ // key name match
+ return true;
+#endif
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (Required.Count != rhs.Required.Count)
+ {
+ return false;
+ }
+ if (!Required.OrderBy(x => x).SequenceEqual(rhs.Required.OrderBy(x => x)))
+ {
+ return false;
+ }
+
+ if (Dependencies.Count != rhs.Dependencies.Count)
+ {
+ return false;
+ }
+ foreach (var kv in Dependencies)
+ {
+ if (!kv.Value.OrderBy(x => x).SequenceEqual(rhs.Dependencies[kv.Key].OrderBy(x => x)))
+ {
+ return false;
+ }
+ }
+
+ if (AdditionalProperties == null
+ && rhs.AdditionalProperties == null)
+ {
+ // ok
+ }
+ else if (AdditionalProperties == null)
+ {
+ return false;
+ }
+ else if (rhs.AdditionalProperties == null)
+ {
+ return false;
+ }
+ else
+ {
+ if (!AdditionalProperties.Equals(rhs.AdditionalProperties))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ var rhs = obj as JsonObjectValidator;
+ if (rhs == null)
+ {
+ throw new ArgumentException();
+ }
+
+ foreach (var x in rhs.Properties)
+ {
+ if (this.Properties.ContainsKey(x.Key))
+ {
+ this.Properties[x.Key] = x.Value;
+ }
+ else
+ {
+ this.Properties.Add(x.Key, x.Value);
+ }
+ }
+
+ foreach (var x in rhs.Required)
+ {
+ this.Required.Add(x);
+ }
+
+ if (rhs.AdditionalProperties != null)
+ {
+ if (AdditionalProperties != null)
+ {
+ throw new NotImplementedException();
+ }
+ AdditionalProperties = rhs.AdditionalProperties;
+ }
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ switch (key)
+ {
+ case "maxProperties":
+ MaxProperties = value.GetInt32();
+ return true;
+
+ case "minProperties":
+ MinProperties = value.GetInt32();
+ return true;
+
+ case "required":
+ {
+ foreach (var req in value.ArrayItems())
+ {
+ m_required.Add(req.GetString());
+ }
+ }
+ return true;
+
+ case "properties":
+ {
+ foreach (var prop in value.ObjectItems())
+ {
+ AddProperty(fs, prop.Key.GetString(), prop.Value);
+ }
+ }
+ return true;
+
+ case "patternProperties":
+ PatternProperties = value.GetString();
+ return true;
+
+ case "additionalProperties":
+ {
+ var sub = new JsonSchema();
+ sub.Parse(fs, value, "additionalProperties");
+ AdditionalProperties = sub;
+ }
+ return true;
+
+ case "dependencies":
+ {
+ foreach (var kv in value.ObjectItems())
+ {
+ Dependencies.Add(kv.Key.GetString(), kv.Value.ArrayItems().Select(x => x.GetString()).ToArray());
+ }
+ }
+ return true;
+
+ case "propertyNames":
+ return true;
+ }
+
+ return false;
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("object");
+ if (Properties.Count > 0)
+ {
+ f.Key("properties");
+ f.BeginMap(Properties.Count);
+ foreach (var kv in Properties)
+ {
+ f.Key(kv.Key);
+ kv.Value.ToJson(f);
+ }
+ f.EndMap();
+ }
+ }
+
+ static class GenericFieldView<T>
+ {
+ public static FieldInfo[] GetFields()
+ {
+ var t = typeof(T);
+ return t.GetFields(BindingFlags.Instance | BindingFlags.Public);
+ }
+
+ public static void CreateFieldProcessors<G, D>(
+ Func<FieldInfo, D> creator,
+ Dictionary<string, D> processors
+ )
+ {
+ foreach (var fi in GetFields())
+ {
+ processors.Add(fi.Name, creator(fi));
+ }
+ }
+ }
+
+ internal class ValidationResult
+ {
+ public bool IsIgnorable;
+ public JsonSchemaValidationException Ex;
+ }
+
+ public static class GenericValidator<T>
+ {
+ class ObjectValidator
+ {
+ delegate JsonSchemaValidationException FieldValidator(
+ JsonSchema s, JsonSchemaValidationContext c, T o, out bool isIgnorable);
+
+ Dictionary<string, FieldValidator> m_validators;
+
+ static FieldValidator CreateFieldValidator(FieldInfo fi)
+ {
+ var mi = typeof(ObjectValidator).GetMethod("_CreateFieldValidator",
+ BindingFlags.Static | BindingFlags.NonPublic)
+ ;
+ var g = mi.MakeGenericMethod(fi.FieldType);
+ return GenericInvokeCallFactory.StaticFunc<FieldInfo, FieldValidator>(g)(fi);
+ }
+
+ static FieldValidator _CreateFieldValidator<U>(FieldInfo fi)
+ {
+ var getter = (Func<T, U>)((t) => (U)fi.GetValue(t));
+
+ return (JsonSchema s, JsonSchemaValidationContext c, T o, out bool isIgnorable) =>
+ {
+ var v = s.Validator;
+ using (c.Push(fi.Name))
+ {
+ var field = getter(o);
+ var ex = v.Validate(c, field);
+
+ isIgnorable = ex != null && s.IsExplicitlyIgnorableValue(field);
+
+ return ex;
+ }
+ };
+ }
+
+ public ObjectValidator()
+ {
+ var validators = new Dictionary<string, FieldValidator>();
+ GenericFieldView<T>.CreateFieldProcessors<ObjectValidator, FieldValidator>(
+ CreateFieldValidator, validators);
+
+ m_validators = validators;
+ }
+
+ public JsonSchemaValidationException ValidateProperty(
+ HashSet<string> required,
+ KeyValuePair<string, JsonSchema> property,
+ JsonSchemaValidationContext c,
+ T o,
+ out bool isIgnorable
+ )
+ {
+ var fieldName = property.Key;
+ var schema = property.Value;
+
+ isIgnorable = false;
+
+ FieldValidator fv;
+ if (m_validators.TryGetValue(fieldName, out fv))
+ {
+ var isRequired = required != null && required.Contains(fieldName);
+
+ bool isMemberIgnorable;
+ var ex = fv(schema, c, o, out isMemberIgnorable);
+ if (ex != null)
+ {
+ isIgnorable = !isRequired && isMemberIgnorable;
+
+ if (isRequired // required fields must be checked
+ || c.EnableDiagnosisForNotRequiredFields)
+ {
+ return ex;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public JsonSchemaValidationException Validate(
+ HashSet<string> required,
+ Dictionary<string, JsonSchema> properties,
+ JsonSchemaValidationContext c, T o)
+ {
+ foreach (var kv in properties)
+ {
+ bool isIgnorable;
+ var ex = ValidateProperty(required, kv, c, o, out isIgnorable);
+ if (ex != null && !isIgnorable)
+ {
+ return ex;
+ }
+ }
+
+ return null;
+ }
+
+ public void ValidationResults
+ (HashSet<string> required,
+ Dictionary<string, JsonSchema> properties,
+ JsonSchemaValidationContext c, T o,
+ Dictionary<string, ValidationResult> results)
+ {
+ foreach (var kv in properties)
+ {
+ bool isIgnorable;
+ var ex = ValidateProperty(required, kv, c, o, out isIgnorable);
+
+ results.Add(kv.Key, new ValidationResult {
+ IsIgnorable = isIgnorable,
+ Ex = ex,
+ });
+ }
+ }
+ }
+
+ static ObjectValidator s_validator;
+
+ static void prepareValidator()
+ {
+ if (s_validator == null)
+ {
+ s_validator = new ObjectValidator();
+ }
+ }
+
+ public static JsonSchemaValidationException Validate(HashSet<string> required,
+ Dictionary<string, JsonSchema> properties,
+ JsonSchemaValidationContext c, T o)
+ {
+ prepareValidator();
+ return s_validator.Validate(required, properties, c, o);
+ }
+
+ internal static void ValidationResults(HashSet<string> required,
+ Dictionary<string, JsonSchema> properties,
+ JsonSchemaValidationContext c, T o,
+ Dictionary<string, ValidationResult> results)
+ {
+ prepareValidator();
+ s_validator.ValidationResults(required, properties, c, o, results);
+ }
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T o)
+ {
+ if (o == null)
+ {
+ return new JsonSchemaValidationException(c, "null");
+ }
+
+ if (Properties.Count < MinProperties)
+ {
+ return new JsonSchemaValidationException(c, "no properties");
+ }
+
+ return GenericValidator<T>.Validate(Required, Properties, c, o);
+ }
+
+ static class GenericSerializer<T>
+ {
+ class Serializer
+ {
+ delegate void FieldSerializer(JsonSchema s, JsonSchemaValidationContext c, IFormatter f, T o,
+ Dictionary<string, ValidationResult> vRes, string[] deps);
+
+ Dictionary<string, FieldSerializer> m_serializers;
+
+ static FieldSerializer CreateFieldSerializer(FieldInfo fi)
+ {
+ var mi = typeof(Serializer).GetMethod("_CreateFieldSerializer",
+ BindingFlags.Static | BindingFlags.NonPublic);
+ var g = mi.MakeGenericMethod(fi.FieldType);
+ return GenericInvokeCallFactory.StaticFunc<FieldInfo, FieldSerializer>(g)(fi);
+ }
+
+ static FieldSerializer _CreateFieldSerializer<U>(FieldInfo fi)
+ {
+ Func<T, U> getter = t =>
+ {
+ return (U)fi.GetValue(t);
+ };
+
+ return (s, c, f, o, vRes, deps) =>
+ {
+ var v = s.Validator;
+ var field = getter(o);
+
+ if (vRes[fi.Name].Ex != null)
+ {
+ return;
+ }
+
+ if (deps != null)
+ {
+ foreach(var dep in deps)
+ {
+ if (vRes[dep].Ex != null)
+ {
+ return;
+ }
+ }
+ }
+
+ f.Key(fi.Name);
+ v.Serialize(f, c, field);
+ };
+ }
+
+ public Serializer()
+ {
+ var serializers = new Dictionary<string, FieldSerializer>();
+ GenericFieldView<T>.CreateFieldProcessors<Serializer, FieldSerializer>(
+ CreateFieldSerializer, serializers);
+
+ m_serializers = serializers;
+ }
+
+ public void Serialize(JsonObjectValidator objectValidator,
+ IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ // Validates fields
+ var validationResults = new Dictionary<string, ValidationResult>();
+ GenericValidator<T>.ValidationResults(
+ objectValidator.Required, objectValidator.Properties,
+ c, o, validationResults);
+
+ // Serialize fields
+ f.BeginMap(objectValidator.Properties.Count());
+ foreach (var property in objectValidator.Properties)
+ {
+ var fieldName = property.Key;
+ var schema = property.Value;
+
+ string[] deps = null;
+ objectValidator.Dependencies.TryGetValue(fieldName, out deps);
+
+ FieldSerializer fs;
+ if (m_serializers.TryGetValue(fieldName, out fs))
+ {
+ fs(schema, c, f, o, validationResults, deps);
+ }
+ }
+ f.EndMap();
+ }
+ }
+
+ static FieldInfo[] s_fields;
+ static Serializer s_serializer;
+
+ public static void Serialize(JsonObjectValidator objectValidator,
+ IFormatter f, JsonSchemaValidationContext c, T value)
+ {
+ if (s_serializer == null)
+ {
+ s_serializer = new Serializer();
+ }
+
+ s_serializer.Serialize(objectValidator, f, c, value);
+ }
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T value)
+ {
+ GenericSerializer<T>.Serialize(this, f, c, value);
+ }
+
+ public static class GenericDeserializer<S, T>
+ where S : IListTreeItem, IValue<S>
+ {
+ delegate T Deserializer(ListTreeNode<S> src);
+
+ static Deserializer s_d;
+
+ delegate void FieldSetter(ListTreeNode<S> s, object o);
+ static FieldSetter GetFieldDeserializer<U>(FieldInfo fi)
+ {
+ return (s, o) =>
+ {
+ var u = default(U);
+ s.Deserialize(ref u);
+ fi.SetValue(o, u);
+ };
+ }
+
+ public static U DeserializeField<U>(JsonSchema prop, ListTreeNode<S> s)
+ {
+ var u = default(U);
+ prop.Validator.Deserialize(s, ref u);
+ return u;
+ }
+
+ public static void Deserialize(ListTreeNode<S> src, ref T dst, Dictionary<string, JsonSchema> props)
+ {
+ if (s_d == null)
+ {
+ var target = typeof(T);
+
+ var fields = target.GetFields(BindingFlags.Instance | BindingFlags.Public);
+ var fieldDeserializers = fields.ToDictionary(x => Utf8String.From(x.Name), x =>
+ {
+ /*
+ var mi = typeof(GenericDeserializer<T>).GetMethod("GetFieldDeserializer",
+ BindingFlags.Static | BindingFlags.NonPublic);
+ var g = mi.MakeGenericMethod(x.FieldType);
+ return (FieldSetter)g.Invoke(null, new object[] { x });
+ */
+ JsonSchema prop;
+ if (!props.TryGetValue(x.Name, out prop))
+ {
+ return null;
+ }
+
+ var mi = typeof(GenericDeserializer<S, T>).GetMethod("DeserializeField",
+ BindingFlags.Static | BindingFlags.Public);
+ var g = mi.MakeGenericMethod(x.FieldType);
+
+ return (FieldSetter)((s, o) =>
+ {
+ var f = g.Invoke(null, new object[] { prop, s });
+ x.SetValue(o, f);
+ });
+ });
+
+ s_d = (ListTreeNode<S> s) =>
+ {
+ if (!s.IsMap())
+ {
+ throw new ArgumentException(s.Value.ValueType.ToString());
+ }
+
+ // boxing
+ var t = (object)Activator.CreateInstance<T>();
+ foreach (var kv in s.ObjectItems())
+ {
+ FieldSetter setter;
+ if (fieldDeserializers.TryGetValue(kv.Key.GetUtf8String(), out setter))
+ {
+ if (setter != null)
+ {
+ setter(kv.Value, t);
+ }
+ }
+ }
+ return (T)t;
+ };
+
+ }
+ dst = s_d(src);
+ }
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T : IListTreeItem, IValue<T>
+ {
+ GenericDeserializer<T, U>.Deserialize(src, ref dst, Properties);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs.meta
new file mode 100644
index 00000000..66907511
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonObjectValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1bdf39f36f58f584daee6d67f7ab446f
+timeCreated: 1531812708
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs
new file mode 100644
index 00000000..f085ff09
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ [Flags]
+ public enum PropertyExportFlags
+ {
+ None,
+ PublicFields = 1,
+ PublicProperties = 2,
+
+ Default = PublicFields | PublicProperties,
+ }
+
+ public enum CompositionType
+ {
+ Unknown,
+
+ AllOf,
+ AnyOf,
+ OneOf,
+ }
+
+
+
+
+
+
+
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs.meta
new file mode 100644
index 00000000..38043343
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9ff35fccc1467f341b052622fedcb3ca
+timeCreated: 1531557083
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs
new file mode 100644
index 00000000..82a70a3d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs
@@ -0,0 +1,320 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+#if UNIJSON_PROFILING
+#else
+using UnityEngine;
+#endif
+
+
+namespace UniJSON
+{
+ public static class JsonSchemaValidatorFactory
+ {
+ struct JsonSchemaItem
+ {
+ public string Key;
+ public JsonSchema Schema;
+ public bool Required;
+ public string[] Dependencies;
+ }
+
+ static IEnumerable<JsonSchemaItem> GetProperties(Type t, PropertyExportFlags exportFlags)
+ {
+ // fields
+ foreach (var fi in t.GetFields())
+ {
+ var a = fi.GetCustomAttributes(typeof(JsonSchemaAttribute), true).FirstOrDefault() as JsonSchemaAttribute;
+ if (a == null)
+ {
+ a = fi.FieldType.GetCustomAttributes(typeof(JsonSchemaAttribute), true).FirstOrDefault() as JsonSchemaAttribute;
+ if (a == null)
+ {
+ // default
+ if (!fi.IsStatic && fi.IsPublic)
+ {
+ // only public instance field
+ a = new JsonSchemaAttribute();
+ }
+ }
+ }
+
+ // for array item
+ var ia = fi.GetCustomAttributes(typeof(ItemJsonSchemaAttribute), true).FirstOrDefault() as ItemJsonSchemaAttribute;
+
+ if (a == null)
+ {
+ //int x = 0;
+ }
+ else
+ {
+ yield return new JsonSchemaItem
+ {
+ Key = fi.Name,
+ Schema = JsonSchema.FromType(fi.FieldType, a, ia),
+ Required = a.Required,
+ Dependencies = a.Dependencies,
+ };
+ }
+ }
+
+ // properties
+ foreach (var pi in t.GetProperties())
+ {
+ var a = pi.GetCustomAttributes(typeof(JsonSchemaAttribute), true).FirstOrDefault() as JsonSchemaAttribute;
+
+ // for array item
+ var ia = pi.GetCustomAttributes(typeof(ItemJsonSchemaAttribute), true).FirstOrDefault() as ItemJsonSchemaAttribute;
+
+ if (a != null)
+ {
+ yield return new JsonSchemaItem
+ {
+ Key = pi.Name,
+ Schema = JsonSchema.FromType(pi.PropertyType, a, ia),
+ Required = a.Required,
+ Dependencies = a.Dependencies,
+ };
+ }
+ }
+ }
+
+ public static IJsonSchemaValidator Create(ValueNodeType valueType,
+ Type t = null,
+ BaseJsonSchemaAttribute a = null,
+ ItemJsonSchemaAttribute ia = null)
+ {
+ switch (valueType)
+ {
+ case ValueNodeType.Integer:
+ {
+ var v = new JsonIntValidator();
+ if (a != null)
+ {
+ if (!double.IsNaN(a.Minimum))
+ {
+ v.Minimum = (int)a.Minimum;
+ }
+ if (a.ExclusiveMinimum)
+ {
+ v.ExclusiveMinimum = a.ExclusiveMinimum;
+ }
+ if (!double.IsNaN(a.Maximum))
+ {
+ v.Maximum = (int)a.Maximum;
+ }
+ if (a.ExclusiveMaximum)
+ {
+ v.ExclusiveMaximum = a.ExclusiveMaximum;
+ }
+ if (a.MultipleOf != 0)
+ {
+ v.MultipleOf = (int)a.MultipleOf;
+ }
+ }
+ return v;
+ }
+
+ case ValueNodeType.Number:
+ {
+ var v = new JsonNumberValidator();
+ if (a != null)
+ {
+ if (!double.IsNaN(a.Minimum))
+ {
+ v.Minimum = (int)a.Minimum;
+ }
+ if (a.ExclusiveMinimum)
+ {
+ v.ExclusiveMinimum = a.ExclusiveMinimum;
+ }
+ if (!double.IsNaN(a.Maximum))
+ {
+ v.Maximum = (int)a.Maximum;
+ }
+ if (a.ExclusiveMaximum)
+ {
+ v.ExclusiveMaximum = a.ExclusiveMaximum;
+ }
+ if (a.MultipleOf != 0)
+ {
+ v.MultipleOf = (int)a.MultipleOf;
+ }
+ }
+ return v;
+ }
+
+ case ValueNodeType.String:
+ {
+ var v = new JsonStringValidator();
+ if (a != null)
+ {
+ if (a.Pattern != null)
+ {
+ v.Pattern = new System.Text.RegularExpressions.Regex(a.Pattern);
+ }
+ }
+ return v;
+ }
+
+ case ValueNodeType.Boolean:
+ return new JsonBoolValidator();
+
+ case ValueNodeType.Array:
+ {
+ var v = new JsonArrayValidator();
+ if (a != null)
+ {
+ if (a.MinItems != 0)
+ {
+ v.MinItems = a.MinItems;
+ }
+ if (a.MaxItems != 0)
+ {
+ v.MaxItems = a.MaxItems;
+ }
+
+ if (t != null)
+ {
+ if (ia == null)
+ {
+ ia = new ItemJsonSchemaAttribute();
+ }
+
+ Type elementType = null;
+ if (t.IsArray)
+ {
+ elementType = t.GetElementType();
+ }
+ else if (t.GetIsGenericList())
+ {
+ elementType = t.GetGenericArguments().First();
+ }
+
+ if (elementType != null)
+ {
+ /*
+ var sub = new JsonSchema
+ {
+ SkipComparison = ia.SkipSchemaComparison,
+ Validator = Create(elementType, ia, null)
+ };
+ */
+ var sub = JsonSchema.FromType(elementType, ia, null);
+ v.Items = sub;
+ }
+ }
+ }
+ return v;
+ }
+
+ case ValueNodeType.Object:
+ {
+ if (t.GetIsGenericDictionary())
+ {
+ var genericFactory = typeof(JsonDictionaryValidator).GetMethod("Create", BindingFlags.Static | BindingFlags.Public);
+ var factory = genericFactory.MakeGenericMethod(t.GetGenericArguments()[1]);
+ var v = factory.Invoke(null, null) as IJsonSchemaValidator;
+ return v;
+ }
+ else
+ {
+ var v = new JsonObjectValidator();
+ if (a != null)
+ {
+ if (a.MinProperties > 0)
+ {
+ v.MinProperties = a.MinProperties;
+ }
+
+ // props
+ foreach (var prop in GetProperties(t, a.ExportFlags))
+ {
+ v.Properties.Add(prop.Key, prop.Schema);
+ if (prop.Required)
+ {
+ v.Required.Add(prop.Key);
+ }
+ if (prop.Dependencies != null)
+ {
+ v.Dependencies.Add(prop.Key, prop.Dependencies);
+ }
+ }
+
+ }
+
+ if (ia != null)
+ {
+ var sub = new JsonSchema
+ {
+ SkipComparison = ia.SkipSchemaComparison,
+ Validator = Create(typeof(object), ia, null)
+ };
+ v.AdditionalProperties = sub;
+ }
+
+ return v;
+ }
+ }
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+
+ public static IJsonSchemaValidator Create(string t)
+ {
+ return Create((ValueNodeType)Enum.Parse(typeof(ValueNodeType), t, true));
+ }
+
+ static Dictionary<Type, ValueNodeType> s_typeMap = new Dictionary<Type, ValueNodeType>
+ {
+ {typeof(byte), ValueNodeType.Integer },
+ {typeof(short), ValueNodeType.Integer },
+ {typeof(int), ValueNodeType.Integer },
+ {typeof(long), ValueNodeType.Integer },
+ {typeof(sbyte), ValueNodeType.Integer },
+ {typeof(ushort), ValueNodeType.Integer },
+ {typeof(uint), ValueNodeType.Integer },
+ {typeof(ulong), ValueNodeType.Integer },
+ {typeof(float), ValueNodeType.Number },
+ {typeof(double), ValueNodeType.Number },
+ {typeof(string), ValueNodeType.String },
+ {typeof(bool), ValueNodeType.Boolean },
+
+ // Unity types
+ {typeof(Vector3), ValueNodeType.Object },
+ };
+
+ static ValueNodeType ToJsonType(Type t)
+ {
+ ValueNodeType jsonValueType;
+ if (s_typeMap.TryGetValue(t, out jsonValueType))
+ {
+ return jsonValueType;
+ }
+
+ if (t.IsArray)
+ {
+ return ValueNodeType.Array;
+ }
+ if (t.GetIsGenericList())
+ {
+ return ValueNodeType.Array;
+ }
+
+ //if (t.IsClass)
+ {
+ return ValueNodeType.Object;
+ }
+
+ //throw new NotImplementedException(string.Format("No JsonType for {0}", t));
+ }
+
+ public static IJsonSchemaValidator Create(Type t, BaseJsonSchemaAttribute a, ItemJsonSchemaAttribute ia)
+ {
+ return Create(ToJsonType(t), t, a, ia);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs.meta
new file mode 100644
index 00000000..e8996538
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonSchemaValidatorFactory.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9fef66d39a7b22b499bea68e0b22d000
+timeCreated: 1531574156
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs
new file mode 100644
index 00000000..18922975
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs
@@ -0,0 +1,143 @@
+using System;
+using System.Linq;
+using System.Text.RegularExpressions;
+
+namespace UniJSON
+{
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#string
+ /// </summary>
+ public class JsonStringValidator : IJsonSchemaValidator
+ {
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.1
+ /// </summary>
+ public int? MaxLength
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.2
+ /// </summary>
+ public int? MinLength
+ {
+ get; set;
+ }
+
+ /// <summary>
+ /// http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.3.3
+ /// </summary>
+ public Regex Pattern
+ {
+ get; set;
+ }
+
+ public override int GetHashCode()
+ {
+ return 4;
+ }
+
+ public override bool Equals(object obj)
+ {
+ var rhs = obj as JsonStringValidator;
+ if (rhs == null) return false;
+
+ if (MaxLength != rhs.MaxLength) return false;
+ if (MinLength != rhs.MinLength) return false;
+
+ if (Pattern == null && rhs.Pattern == null)
+ {
+ }
+ else if (Pattern == null)
+ {
+ return false;
+ }
+ else if (rhs.Pattern == null)
+ {
+ return false;
+ }
+ else if (Pattern.ToString() != rhs.Pattern.ToString())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Merge(IJsonSchemaValidator obj)
+ {
+ var rhs = obj as JsonStringValidator;
+ if (rhs == null)
+ {
+ throw new ArgumentException();
+ }
+
+ MaxLength = rhs.MaxLength;
+ MinLength = rhs.MinLength;
+ Pattern = rhs.Pattern;
+ }
+
+ public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
+ {
+ switch (key)
+ {
+ case "maxLength":
+ MaxLength = value.GetInt32();
+ return true;
+
+ case "minLength":
+ MinLength = value.GetInt32();
+ return true;
+
+ case "pattern":
+ Pattern = new Regex(value.GetString().Replace("\\\\", "\\"));
+ return true;
+ }
+
+ return false;
+ }
+
+ public void ToJsonSchema(IFormatter f)
+ {
+ f.Key("type"); f.Value("string");
+ }
+
+ public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T o)
+ {
+ if (o == null)
+ {
+ return new JsonSchemaValidationException(c, "null");
+ }
+
+ var value = o as string;
+
+ if (MinLength.HasValue && value.Length < MinLength)
+ {
+ return new JsonSchemaValidationException(c, string.Format("minlength: {0}<{1}", value.Length, MinLength.Value));
+ }
+ if (MaxLength.HasValue && value.Length > MaxLength)
+ {
+ return new JsonSchemaValidationException(c, string.Format("maxlength: {0}>{1}", value.Length, MaxLength.Value));
+ }
+
+ if (Pattern != null && !Pattern.IsMatch(value))
+ {
+ return new JsonSchemaValidationException(c, string.Format("pattern: {0} not match {1}", Pattern, value));
+ }
+
+ return null;
+ }
+
+ public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T o)
+ {
+ f.Value(GenericCast<T, string>.Cast(o));
+ }
+
+ public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
+ where T: IListTreeItem, IValue<T>
+ {
+ dst = GenericCast<string, U>.Cast(src.GetString());
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs.meta
new file mode 100644
index 00000000..07f08dad
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/JsonSchemaValidator/JsonStringValidator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0256cc9f46a4e6744826cf5ca0aa1b46
+timeCreated: 1531812574
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode.meta
new file mode 100644
index 00000000..5127bf90
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fa0987f7b38d9eb4b93a22c465570153
+folderAsset: yes
+timeCreated: 1545735556
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs
new file mode 100644
index 00000000..f469daed
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs
@@ -0,0 +1,458 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+
+namespace UniJSON
+{
+ public struct ListTreeNode<T> : ITreeNode<ListTreeNode<T>, T>
+ where T : IListTreeItem, IValue<T>
+ {
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (!(obj is ListTreeNode<T>))
+ {
+ return false;
+ }
+
+ var rhs = (ListTreeNode<T>)obj;
+
+ if ((Value.ValueType == ValueNodeType.Integer || Value.ValueType == ValueNodeType.Null)
+ && (rhs.Value.ValueType == ValueNodeType.Integer || rhs.Value.ValueType == ValueNodeType.Number))
+ {
+ // ok
+ }
+ else if (Value.ValueType != rhs.Value.ValueType)
+ {
+ return false;
+ }
+
+ switch (Value.ValueType)
+ {
+ case ValueNodeType.Null:
+ return true;
+
+ case ValueNodeType.Boolean:
+ return Value.GetBoolean() == rhs.GetBoolean();
+
+ case ValueNodeType.Integer:
+ case ValueNodeType.Number:
+ return Value.GetDouble() == rhs.GetDouble();
+
+ case ValueNodeType.String:
+ return Value.GetString() == rhs.GetString();
+
+ case ValueNodeType.Array:
+ return this.ArrayItems().SequenceEqual(rhs.ArrayItems());
+
+ case ValueNodeType.Object:
+ {
+ //var l = ObjectItems().ToDictionary(x => x.Key, x => x.Value);
+ //var r = rhs.ObjectItems().ToDictionary(x => x.Key, x => x.Value);
+ //return l.Equals(r);
+ return this.ObjectItems().OrderBy(x => x.Key.GetUtf8String()).SequenceEqual(rhs.ObjectItems().OrderBy(x => x.Key.GetUtf8String()));
+ }
+ }
+
+ return false;
+ }
+
+ public override string ToString()
+ {
+ if (this.IsArray())
+ {
+ var sb = new StringBuilder();
+ sb.Append("[");
+ /*
+ bool isFirst = true;
+ foreach (var x in this.ArrayItems())
+ {
+ if (isFirst)
+ {
+ isFirst = false;
+ }
+ else
+ {
+ sb.Append(",");
+ }
+ sb.Append(x.ToString());
+ }
+ */
+ sb.Append("]");
+ return sb.ToString();
+ }
+ else if (this.IsMap())
+ {
+ var sb = new StringBuilder();
+ sb.Append("{");
+ /*
+ bool isFirst = true;
+ foreach (var kv in this.ObjectItems())
+ {
+ if (isFirst)
+ {
+ isFirst = false;
+ }
+ else
+ {
+ sb.Append(",");
+ }
+ sb.Append(kv.Key.ToString());
+ sb.Append(": ");
+ sb.Append(kv.Value.ToString());
+ }
+ */
+ sb.Append("}");
+ return sb.ToString();
+ }
+ else
+ {
+ return Value.ToString();
+ }
+ }
+
+ IEnumerable<string> ToString(string indent, int level, bool value = false)
+ {
+ if (this.IsArray())
+ {
+ if (!value) for (int i = 0; i < level; ++i) yield return indent;
+ yield return "[\n";
+
+ var isFirst = true;
+ var childLevel = level + 1;
+ foreach (var x in this.ArrayItems())
+ {
+ if (isFirst)
+ {
+ isFirst = false;
+ }
+ else
+ {
+ yield return ",\n";
+ }
+
+ foreach (var y in x.ToString(indent, childLevel))
+ {
+ yield return y;
+ }
+ }
+ if (!isFirst)
+ {
+ yield return "\n";
+ }
+
+ for (int i = 0; i < level; ++i) yield return indent;
+ yield return "]";
+ }
+ else if (this.IsMap())
+ {
+ if (!value) for (int i = 0; i < level; ++i) yield return indent;
+ yield return "{\n";
+
+ var isFirst = true;
+ var childLevel = level + 1;
+ foreach (var kv in this.ObjectItems().OrderBy(x => x.Key.ToString()))
+ {
+ if (isFirst)
+ {
+ isFirst = false;
+ }
+ else
+ {
+ yield return ",\n";
+ }
+
+ // key
+ for (int i = 0; i < childLevel; ++i) yield return indent;
+ yield return kv.Key.ToString();
+ yield return ": ";
+
+ foreach (var y in kv.Value.ToString(indent, childLevel, true))
+ {
+ yield return y;
+ }
+ }
+ if (!isFirst)
+ {
+ yield return "\n";
+ }
+
+ for (int i = 0; i < level; ++i) yield return indent;
+ yield return "}";
+ }
+ else
+ {
+ if (!value) for (int i = 0; i < level; ++i) yield return indent;
+ yield return Value.ToString();
+ }
+ }
+
+ public string ToString(string indent)
+ {
+ return string.Join("", ToString(indent, 0).ToArray());
+ }
+
+ public IEnumerable<JsonDiff> Diff(ListTreeNode<T> rhs, JsonPointer path = default(JsonPointer))
+ {
+ switch (Value.ValueType)
+ {
+ case ValueNodeType.Null:
+ case ValueNodeType.Boolean:
+ case ValueNodeType.Number:
+ case ValueNodeType.Integer:
+ case ValueNodeType.String:
+ if (!Equals(rhs))
+ {
+ yield return JsonDiff.Create(this, JsonDiffType.ValueChanged, string.Format("{0} => {1}", Value, rhs.Value));
+ }
+ yield break;
+ }
+
+ if (Value.ValueType != rhs.Value.ValueType)
+ {
+ yield return JsonDiff.Create(this, JsonDiffType.ValueChanged, string.Format("{0} => {1}", Value.ValueType, rhs.Value));
+ yield break;
+ }
+
+ if (Value.ValueType == ValueNodeType.Object)
+ {
+
+ var l = this.ObjectItems().ToDictionary(x => x.Key, x => x.Value);
+ var r = rhs.ObjectItems().ToDictionary(x => x.Key, x => x.Value);
+
+ foreach (var kv in l)
+ {
+ ListTreeNode<T> x;
+ if (r.TryGetValue(kv.Key, out x))
+ {
+ r.Remove(kv.Key);
+ // Found
+ foreach (var y in kv.Value.Diff(x))
+ {
+ yield return y;
+ }
+ }
+ else
+ {
+ // Removed
+ yield return JsonDiff.Create(kv.Value, JsonDiffType.KeyRemoved, kv.Value.Value.ToString());
+ }
+ }
+
+ foreach (var kv in r)
+ {
+ // Added
+ yield return JsonDiff.Create(kv.Value, JsonDiffType.KeyAdded, kv.Value.Value.ToString());
+ }
+ }
+ else if (Value.ValueType == ValueNodeType.Array)
+ {
+ var ll = this.ArrayItems().GetEnumerator();
+ var rr = rhs.ArrayItems().GetEnumerator();
+ while (true)
+ {
+ var lll = ll.MoveNext();
+ var rrr = rr.MoveNext();
+ if (lll && rrr)
+ {
+ // found
+ foreach (var y in ll.Current.Diff(rr.Current))
+ {
+ yield return y;
+ }
+ }
+ else if (lll)
+ {
+ yield return JsonDiff.Create(ll.Current, JsonDiffType.KeyRemoved, ll.Current.Value.ToString());
+ }
+ else if (rrr)
+ {
+ yield return JsonDiff.Create(rr.Current, JsonDiffType.KeyAdded, rr.Current.Value.ToString());
+ }
+ else
+ {
+ // end
+ break;
+ }
+ }
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ /// <summary>
+ /// Whole tree nodes
+ /// </summary>
+ List<T> m_Values;
+ public bool IsValid
+ {
+ get
+ {
+ return m_Values != null;
+ }
+ }
+
+ /// <summary>
+ /// This node index
+ /// </summary>
+ int _valueIndex;
+ public int ValueIndex
+ {
+ get
+ {
+ if (m_Values == null) return -1;
+ return _valueIndex;
+ }
+ }
+
+ public ListTreeNode<T> Prev
+ {
+ get
+ {
+ return new ListTreeNode<T>(m_Values, ValueIndex - 1);
+ }
+ }
+
+ public T Value
+ {
+ get
+ {
+ if (m_Values == null)
+ {
+ return default(T);
+ }
+ return m_Values[ValueIndex];
+ }
+ }
+ public void SetValue(T value)
+ {
+ m_Values[ValueIndex] = value;
+ }
+
+ #region Children
+ public int ChildCount
+ {
+ get { return Value.ChildCount; }
+ }
+
+ public IEnumerable<ListTreeNode<T>> Children
+ {
+ get
+ {
+ int count = 0;
+ for (int i = ValueIndex; count < ChildCount && i < m_Values.Count; ++i)
+ {
+ if (m_Values[i].ParentIndex == ValueIndex)
+ {
+ ++count;
+ yield return new ListTreeNode<T>(m_Values, i);
+ }
+ }
+ }
+ }
+
+ public ListTreeNode<T> this[String key]
+ {
+ get
+ {
+ return this[Utf8String.From(key)];
+ }
+ }
+
+ public ListTreeNode<T> this[Utf8String key]
+ {
+ get
+ {
+ return this.GetObjectItem(key);
+ }
+ }
+
+ public ListTreeNode<T> this[int index]
+ {
+ get
+ {
+ return this.GetArrayItem(index);
+ }
+ }
+ #endregion
+ public bool HasParent
+ {
+ get
+ {
+ return Value.ParentIndex >= 0 && Value.ParentIndex < m_Values.Count;
+ }
+ }
+ public ListTreeNode<T> Parent
+ {
+ get
+ {
+ if (Value.ParentIndex < 0)
+ {
+ throw new Exception("no parent");
+ }
+ if (Value.ParentIndex >= m_Values.Count)
+ {
+ throw new IndexOutOfRangeException();
+ }
+ return new ListTreeNode<T>(m_Values, Value.ParentIndex);
+ }
+ }
+
+ public ListTreeNode(List<T> values, int index = 0) : this()
+ {
+ m_Values = values;
+ _valueIndex = index;
+ }
+
+ #region JsonPointer
+ public ListTreeNode<T> AddKey(Utf8String key)
+ {
+ return AddValue(default(T).Key(key, ValueIndex));
+ }
+
+ public ListTreeNode<T> AddValue(ArraySegment<byte> bytes, ValueNodeType valueType)
+ {
+ return AddValue(default(T).New(bytes, valueType, ValueIndex));
+ }
+
+ public ListTreeNode<T> AddValue(T value)
+ {
+ if (m_Values == null)
+ {
+ // initialize empty tree
+ m_Values = new List<T>();
+ _valueIndex = -1;
+ }
+ else
+ {
+ IncrementChildCount();
+ }
+ var index = m_Values.Count;
+ m_Values.Add(value);
+ return new ListTreeNode<T>(m_Values, index);
+ }
+
+ void IncrementChildCount()
+ {
+ var value = Value;
+ value.SetChildCount(value.ChildCount + 1);
+ SetValue(value);
+ }
+
+ public void SetValueBytesCount(int count)
+ {
+ var value = Value;
+ value.SetBytesCount(count);
+ SetValue(value);
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs.meta
new file mode 100644
index 00000000..4c618acd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNode.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 26f90c47d985b3e4c8cf153607f9fb31
+timeCreated: 1545735556
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs
new file mode 100644
index 00000000..7a68d2ac
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public static class ListTreeNodeArrayExtensions
+ {
+ public static IEnumerable<ListTreeNode<T>> ArrayItems<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ if (!self.IsArray()) throw new DeserializationException("is not array");
+ return self.Children;
+ }
+
+ [Obsolete("Use GetArrayItem(index)")]
+ public static ListTreeNode<T> GetArrrayItem<T>(this ListTreeNode<T> self, int index)
+ where T : IListTreeItem, IValue<T>
+ {
+ return GetArrayItem(self, index);
+ }
+
+ public static ListTreeNode<T> GetArrayItem<T>(this ListTreeNode<T> self, int index)
+ where T : IListTreeItem, IValue<T>
+ {
+ int i = 0;
+ foreach (var v in self.ArrayItems())
+ {
+ if (i++ == index)
+ {
+ return v;
+ }
+ }
+ throw new KeyNotFoundException();
+ }
+
+ public static int GetArrayCount<T>(this ListTreeNode<T> self)
+ where T : IListTreeItem, IValue<T>
+ {
+ if (!self.IsArray()) throw new DeserializationException("is not array");
+ return self.Children.Count();
+ }
+
+ public static int IndexOf<T>(this ListTreeNode<T> self, ListTreeNode<T> child)
+ where T : IListTreeItem, IValue<T>
+ {
+ int i = 0;
+ foreach (var v in self.ArrayItems())
+ {
+ if (v.ValueIndex == child.ValueIndex)
+ {
+ return i;
+ }
+ ++i;
+ }
+ throw new KeyNotFoundException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs.meta
new file mode 100644
index 00000000..4e8bb280
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeArrayExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0633f1f90105acc41b82ef809fe4ebbd
+timeCreated: 1545735556
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs
new file mode 100644
index 00000000..e0756064
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+
+namespace UniJSON
+{
+ public static class ListTreeNodeDeserializerExtensions
+ {
+ public static void Deserialize<T, U>(this ListTreeNode<T> self, ref U value)
+ where T : IListTreeItem, IValue<T>
+ {
+ GenericDeserializer<T, U>.Deserialize(self, ref value);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs.meta
new file mode 100644
index 00000000..e7edfeb7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeDeserializerExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 961c1bf9650027347a1279c4f04a1feb
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs
new file mode 100644
index 00000000..d4ddfdf8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs
@@ -0,0 +1,96 @@
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public static class ListTreeNodeExtensions
+ {
+ #region IValue
+ public static bool IsNull<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.Null;
+ }
+
+ public static bool IsBoolean<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.Boolean;
+ }
+
+ public static bool IsString<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.String;
+ }
+
+ public static bool IsInteger<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.Integer;
+ }
+
+ public static bool IsFloat<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.Number
+ || self.Value.ValueType == ValueNodeType.NaN
+ || self.Value.ValueType == ValueNodeType.Infinity
+ || self.Value.ValueType == ValueNodeType.MinusInfinity;
+ }
+
+ public static bool IsArray<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.Array;
+ }
+
+ public static bool IsMap<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.ValueType == ValueNodeType.Object;
+ }
+
+ public static bool GetBoolean<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetBoolean(); }
+ public static string GetString<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetString(); }
+ public static Utf8String GetUtf8String<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetUtf8String(); }
+ public static sbyte GetSByte<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetSByte(); }
+ public static short GetInt16<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetInt16(); }
+ public static int GetInt32<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetInt32(); }
+ public static long GetInt64<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetInt64(); }
+ public static byte GetByte<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetByte(); }
+ public static ushort GetUInt16<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetUInt16(); }
+ public static uint GetUInt32<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetUInt32(); }
+ public static ulong GetUInt64<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetUInt64(); }
+ public static float GetSingle<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetSingle(); }
+ public static double GetDouble<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T> { return self.Value.GetDouble(); }
+
+ /// <summary>
+ /// for UnitTest. Use explicit GetT() or Deserialize(ref T)
+ /// </summary>
+ /// <returns></returns>
+ public static object GetValue<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ return self.Value.GetValue<object>();
+ }
+ #endregion
+
+ public static IEnumerable<ListTreeNode<T>> Traverse<T>(this ListTreeNode<T> self) where T : IListTreeItem, IValue<T>
+ {
+ yield return self;
+ if (self.IsArray())
+ {
+ foreach (var x in self.ArrayItems())
+ {
+ foreach (var y in x.Traverse())
+ {
+ yield return y;
+ }
+ }
+ }
+ else if (self.IsMap())
+ {
+ foreach (var kv in self.ObjectItems())
+ {
+ foreach (var y in kv.Value.Traverse())
+ {
+ yield return y;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs.meta
new file mode 100644
index 00000000..a08c1a30
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a612ae688d8bc844aa89f13109b665d3
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs
new file mode 100644
index 00000000..93e506fc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public static class ListTreeNodeJsonPointerExtensions
+ {
+ public static void SetValue<T>(this ListTreeNode<T> self,
+ Utf8String jsonPointer, ArraySegment<Byte> bytes)
+ where T: IListTreeItem, IValue<T>
+ {
+ foreach (var node in self.GetNodes(jsonPointer))
+ {
+ node.SetValue(default(T).New(
+ bytes,
+ ValueNodeType.Boolean,
+ node.Value.ParentIndex));
+ }
+ }
+
+ public static void RemoveValue<T>(this ListTreeNode<T> self, Utf8String jsonPointer)
+ where T : IListTreeItem, IValue<T>
+ {
+ foreach (var node in self.GetNodes(new JsonPointer(jsonPointer)))
+ {
+ if (node.Parent.IsMap())
+ {
+ node.Prev.SetValue(default(T)); // remove key
+ }
+ node.SetValue(default(T)); // remove
+ }
+ }
+
+ public static JsonPointer Pointer<T>(this ListTreeNode<T> self)
+ where T: IListTreeItem, IValue<T>
+ {
+ return JsonPointer.Create(self);
+ }
+
+ public static IEnumerable<ListTreeNode<T>> Path<T>(this ListTreeNode<T> self)
+ where T : IListTreeItem, IValue<T>
+ {
+ if (self.HasParent)
+ {
+ foreach (var x in self.Parent.Path())
+ {
+ yield return x;
+ }
+ }
+ yield return self;
+ }
+
+ public static IEnumerable<ListTreeNode<T>> GetNodes<T>(this ListTreeNode<T> self,
+ JsonPointer jsonPointer)
+ where T : IListTreeItem, IValue<T>
+ {
+ if (jsonPointer.Path.Count == 0)
+ {
+ yield return self;
+ yield break;
+ }
+
+ if (self.IsArray())
+ {
+ // array
+ if (jsonPointer[0][0] == '*')
+ {
+ // wildcard
+ foreach (var child in self.ArrayItems())
+ {
+ foreach (var childChild in child.GetNodes(jsonPointer.Unshift()))
+ {
+ yield return childChild;
+ }
+ }
+ }
+ else
+ {
+ int index = jsonPointer[0].ToInt32();
+ var child = self.ArrayItems().Skip(index).First();
+ foreach (var childChild in child.GetNodes(jsonPointer.Unshift()))
+ {
+ yield return childChild;
+ }
+ }
+ }
+ else if (self.IsMap())
+ {
+ // object
+ if (jsonPointer[0][0] == '*')
+ {
+ // wildcard
+ foreach (var kv in self.ObjectItems())
+ {
+ foreach (var childChild in kv.Value.GetNodes(jsonPointer.Unshift()))
+ {
+ yield return childChild;
+ }
+ }
+ }
+ else
+ {
+ ListTreeNode<T> child;
+ try
+ {
+ child = self.ObjectItems().First(x => x.Key.GetUtf8String() == jsonPointer[0]).Value;
+ }
+ catch (Exception)
+ {
+ // key
+ self.AddKey(jsonPointer[0]);
+ // value
+ self.AddValue(default(ArraySegment<byte>), ValueNodeType.Object);
+
+ child = self.ObjectItems().First(x => x.Key.GetUtf8String() == jsonPointer[0]).Value;
+ }
+ foreach (var childChild in child.GetNodes(jsonPointer.Unshift()))
+ {
+ yield return childChild;
+ }
+ }
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public static IEnumerable<ListTreeNode<T>> GetNodes<T>(this ListTreeNode<T> self,
+ Utf8String jsonPointer)
+ where T : IListTreeItem, IValue<T>
+ {
+ return self.GetNodes(new JsonPointer(jsonPointer));
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs.meta
new file mode 100644
index 00000000..4359c836
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeJsonPointerExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 20e02dc7c390454448d4a3ce7aca4d17
+timeCreated: 1545735556
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs
new file mode 100644
index 00000000..e2d7f916
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public static class IValueNodeObjectExtensions
+ {
+ public static IEnumerable<KeyValuePair<ListTreeNode<T>, ListTreeNode<T>>> ObjectItems<T>(this ListTreeNode<T> self)
+ where T : IListTreeItem, IValue<T>
+ {
+ if (!self.IsMap()) throw new DeserializationException("is not object");
+ var it = self.Children.GetEnumerator();
+ while (it.MoveNext())
+ {
+ var key = it.Current;
+
+ it.MoveNext();
+ yield return new KeyValuePair<ListTreeNode<T>, ListTreeNode<T>>(key, it.Current);
+ }
+ }
+
+ public static int GetObjectCount<T>(this ListTreeNode<T> self)
+ where T : IListTreeItem, IValue<T>
+ {
+ if (!self.IsMap()) throw new DeserializationException("is not object");
+ return self.Children.Count() / 2;
+ }
+
+ public static ListTreeNode<T> GetObjectItem<T>(this ListTreeNode<T> self, String key)
+ where T : IListTreeItem, IValue<T>
+ {
+ return self.GetObjectItem(Utf8String.From(key));
+ }
+
+ public static ListTreeNode<T> GetObjectItem<T>(this ListTreeNode<T> self, Utf8String key)
+ where T : IListTreeItem, IValue<T>
+
+ {
+ foreach (var kv in self.ObjectItems())
+ {
+ if (kv.Key.GetUtf8String() == key)
+ {
+ return kv.Value;
+ }
+ }
+ throw new KeyNotFoundException();
+ }
+
+ public static bool ContainsKey<T>(this ListTreeNode<T> self, Utf8String key)
+ where T : IListTreeItem, IValue<T>
+ {
+ return self.ObjectItems().Any(x => x.Key.GetUtf8String() == key);
+ }
+
+ public static bool ContainsKey<T>(this ListTreeNode<T> self, String key)
+ where T : IListTreeItem, IValue<T>
+ {
+ var ukey = Utf8String.From(key);
+ return self.ContainsKey(ukey);
+ }
+
+ public static Utf8String KeyOf<T>(this ListTreeNode<T> self, ListTreeNode<T> node)
+ where T : IListTreeItem, IValue<T>
+ {
+ foreach (var kv in self.ObjectItems())
+ {
+ if (node.ValueIndex == kv.Value.ValueIndex)
+ {
+ return kv.Key.GetUtf8String();
+ }
+ }
+ throw new KeyNotFoundException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs.meta
new file mode 100644
index 00000000..ba8470a3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/ListTreeNode/ListTreeNodeObjectExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b3b4670381937134c9ce96d058f2f730
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack.meta
new file mode 100644
index 00000000..d1df7e37
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c2497653b22017547b01e854b0fa540d
+folderAsset: yes
+timeCreated: 1540812361
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs
new file mode 100644
index 00000000..63439db6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs
@@ -0,0 +1,434 @@
+using System;
+using System.Net;
+
+namespace UniJSON
+{
+ public static class EndianConverter
+ {
+#if false
+ /*
+ #region Converter
+ /// <summary>
+ /// Read Uint16 From NetworkBytesOrder to HostBytesOrder
+ /// </summary>
+ /// <param name="bytes"></param>
+ /// <returns></returns>
+ public static UInt16 N2H_UInt16(this ArraySegment<Byte> self)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return (UInt16)(self.Get(0) << 8 | self.Get(1));
+ }
+ else
+ {
+ return BitConverter.ToUInt16(self.Array, self.Offset);
+ }
+ }
+
+ public static UInt32 N2H_UInt32(this ArraySegment<Byte> self)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return (UInt32)(self.Get(0) << 24 | self.Get(1) << 16 | self.Get(2) << 8 | self.Get(3));
+ }
+ else
+ {
+ return BitConverter.ToUInt32(self.Array, self.Offset);
+ }
+ }
+
+ public static UInt64 N2H_UInt64(this ArraySegment<Byte> self)
+ {
+ var uvalue = BitConverter.ToUInt64(self.Array, self.Offset);
+ if (BitConverter.IsLittleEndian)
+ {
+ ulong swapped =
+ ((0x00000000000000FF) & (uvalue >> 56)
+ | (0x000000000000FF00) & (uvalue >> 40)
+ | (0x0000000000FF0000) & (uvalue >> 24)
+ | (0x00000000FF000000) & (uvalue >> 8)
+ | (0x000000FF00000000) & (uvalue << 8)
+ | (0x0000FF0000000000) & (uvalue << 24)
+ | (0x00FF000000000000) & (uvalue << 40)
+ | (0xFF00000000000000) & (uvalue << 56));
+ return swapped;
+ }
+ else
+ {
+ return uvalue;
+ }
+ }
+
+ public static Int16 N2H_Int16(this ArraySegment<Byte> self)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return (Int16)(self.Get(0) << 8 | self.Get(1));
+ }
+ else
+ {
+ return BitConverter.ToInt16(self.Array, self.Offset);
+ }
+ }
+
+ public static Int32 N2H_Int32(this ArraySegment<Byte> self)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return (Int32)(self.Get(0) << 24 | self.Get(1) << 16 | self.Get(2) << 8 | self.Get(3));
+ }
+ else
+ {
+ return BitConverter.ToInt32(self.Array, self.Offset);
+ }
+ }
+
+ public static Int64 N2H_Int64(this ArraySegment<Byte> self)
+ {
+ var value = BitConverter.ToUInt64(self.Array, self.Offset);
+ if (BitConverter.IsLittleEndian)
+ {
+ ulong swapped =
+ ((0x00000000000000FF) & (value >> 56)
+ | (0x000000000000FF00) & (value >> 40)
+ | (0x0000000000FF0000) & (value >> 24)
+ | (0x00000000FF000000) & (value >> 8)
+ | (0x000000FF00000000) & (value << 8)
+ | (0x0000FF0000000000) & (value << 24)
+ | (0x00FF000000000000) & (value << 40)
+ | (0xFF00000000000000) & (value << 56));
+ return (long)swapped;
+ }
+ else
+ {
+ return (long)value;
+ }
+ }
+
+ public static Single N2H_Single(this ArraySegment<Byte> self)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ return BitConverter.ToSingle(self.TakeReversedArray(4), 0);
+ }
+ else
+ {
+ return BitConverter.ToSingle(self.Array, self.Offset);
+ }
+ }
+
+ public static Double N2H_Double(this ArraySegment<Byte> self)
+ {
+ return BitConverter.Int64BitsToDouble(self.N2H_Int64());
+ }
+
+ public static void N2H_CopyTo(this ArraySegment<Byte> self, Byte[] buffer, int elementSize)
+ {
+ if (buffer.Length < self.Count) throw new ArgumentException();
+
+ for (int i = 0; i < self.Count; i += elementSize)
+ {
+ for (int j = 0; j < elementSize; ++j)
+ {
+ buffer[i + j] = self.Get(i + elementSize - 1 - j);
+ }
+ }
+ }
+
+ public static void N2H_CopyTo(this ArraySegment<Byte> self, Array result, Byte[] buffer)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ if (buffer.Length < self.Count)
+ {
+ throw new ArgumentException();
+ }
+ self.N2H_CopyTo(buffer, Marshal.SizeOf(result.GetType().GetElementType()));
+
+ Buffer.BlockCopy(buffer, 0, result, 0, self.Count);
+ }
+ else
+ {
+ Buffer.BlockCopy(self.Array, self.Offset, result, 0, self.Count);
+ }
+ }
+ #endregion
+ */
+
+#else
+ #region Signed
+ public static Int16 NetworkByteWordToSignedNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.WordValue
+ {
+ Byte0 = bytes.Get(1),
+ Byte1 = bytes.Get(0),
+ };
+ return value.Signed;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.WordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ };
+ return value.Signed;
+ }
+ }
+ public static Int32 NetworkByteDWordToSignedNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.DWordValue
+ {
+ Byte0 = bytes.Get(3),
+ Byte1 = bytes.Get(2),
+ Byte2 = bytes.Get(1),
+ Byte3 = bytes.Get(0),
+ };
+ return value.Signed;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.DWordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ Byte2 = bytes.Get(2),
+ Byte3 = bytes.Get(3),
+ };
+ return value.Signed;
+ }
+ }
+ public static Int64 NetworkByteQWordToSignedNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.QWordValue
+ {
+ Byte0 = bytes.Get(7),
+ Byte1 = bytes.Get(6),
+ Byte2 = bytes.Get(5),
+ Byte3 = bytes.Get(4),
+ Byte4 = bytes.Get(3),
+ Byte5 = bytes.Get(2),
+ Byte6 = bytes.Get(1),
+ Byte7 = bytes.Get(0),
+ };
+ return value.Signed;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.QWordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ Byte2 = bytes.Get(2),
+ Byte3 = bytes.Get(3),
+ Byte4 = bytes.Get(4),
+ Byte5 = bytes.Get(5),
+ Byte6 = bytes.Get(6),
+ Byte7 = bytes.Get(7),
+ };
+ return value.Signed;
+ }
+ }
+ #endregion
+ #region Unsigned
+ public static UInt16 NetworkByteWordToUnsignedNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.WordValue
+ {
+ Byte0 = bytes.Get(1),
+ Byte1 = bytes.Get(0),
+ };
+ return value.Unsigned;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.WordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ };
+ return value.Unsigned;
+ }
+ }
+ public static UInt32 NetworkByteDWordToUnsignedNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.DWordValue
+ {
+ Byte0 = bytes.Get(3),
+ Byte1 = bytes.Get(2),
+ Byte2 = bytes.Get(1),
+ Byte3 = bytes.Get(0),
+ };
+ return value.Unsigned;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.DWordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ Byte2 = bytes.Get(2),
+ Byte3 = bytes.Get(3),
+ };
+ return value.Unsigned;
+ }
+ }
+ public static UInt64 NetworkByteQWordToUnsignedNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.QWordValue
+ {
+ Byte0 = bytes.Get(7),
+ Byte1 = bytes.Get(6),
+ Byte2 = bytes.Get(5),
+ Byte3 = bytes.Get(4),
+ Byte4 = bytes.Get(3),
+ Byte5 = bytes.Get(2),
+ Byte6 = bytes.Get(1),
+ Byte7 = bytes.Get(0),
+ };
+ return value.Unsigned;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.QWordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ Byte2 = bytes.Get(2),
+ Byte3 = bytes.Get(3),
+ Byte4 = bytes.Get(4),
+ Byte5 = bytes.Get(5),
+ Byte6 = bytes.Get(6),
+ Byte7 = bytes.Get(7),
+ };
+ return value.Unsigned;
+ }
+ }
+ #endregion
+ #region Floating
+ public static Single NetworkByteDWordToFloatNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.DWordValue
+ {
+ Byte0 = bytes.Get(3),
+ Byte1 = bytes.Get(2),
+ Byte2 = bytes.Get(1),
+ Byte3 = bytes.Get(0),
+ };
+ return value.Float;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.DWordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ Byte2 = bytes.Get(2),
+ Byte3 = bytes.Get(3),
+ };
+ return value.Float;
+ }
+ }
+ public static Double NetworkByteQWordToFloatNativeByteOrder(ArraySegment<Byte> bytes)
+ {
+ if (BitConverter.IsLittleEndian)
+ {
+ // Network to Little
+ var value = new ByteUnion.QWordValue
+ {
+ Byte0 = bytes.Get(7),
+ Byte1 = bytes.Get(6),
+ Byte2 = bytes.Get(5),
+ Byte3 = bytes.Get(4),
+ Byte4 = bytes.Get(3),
+ Byte5 = bytes.Get(2),
+ Byte6 = bytes.Get(1),
+ Byte7 = bytes.Get(0),
+ };
+ return value.Float;
+ }
+ else
+ {
+ // Network to Big
+ var value = new ByteUnion.QWordValue
+ {
+ Byte0 = bytes.Get(0),
+ Byte1 = bytes.Get(1),
+ Byte2 = bytes.Get(2),
+ Byte3 = bytes.Get(3),
+ Byte4 = bytes.Get(4),
+ Byte5 = bytes.Get(5),
+ Byte6 = bytes.Get(6),
+ Byte7 = bytes.Get(7),
+ };
+ return value.Float;
+ }
+ }
+ #endregion
+#endif
+
+ public static Int16 ToNetworkByteOrder(this Int16 value)
+ {
+ return ByteUnion.WordValue.Create(value).HostToNetworkOrder().Signed;
+ }
+ public static UInt16 ToNetworkByteOrder(this UInt16 value)
+ {
+ return ByteUnion.WordValue.Create(value).HostToNetworkOrder().Unsigned;
+ }
+
+ public static Int32 ToNetworkByteOrder(this Int32 value)
+ {
+ return ByteUnion.DWordValue.Create(value).HostToNetworkOrder().Signed;
+ }
+ public static UInt32 ToNetworkByteOrder(this UInt32 value)
+ {
+ return ByteUnion.DWordValue.Create(value).HostToNetworkOrder().Unsigned;
+ }
+ public static Single ToNetworkByteOrder(this Single value)
+ {
+ return ByteUnion.DWordValue.Create(value).HostToNetworkOrder().Float;
+ }
+
+ public static Int64 ToNetworkByteOrder(this Int64 value)
+ {
+ return ByteUnion.QWordValue.Create(value).HostToNetworkOrder().Signed;
+ }
+ public static UInt64 ToNetworkByteOrder(this UInt64 value)
+ {
+ return ByteUnion.QWordValue.Create(value).HostToNetworkOrder().Unsigned;
+ }
+ public static Double ToNetworkByteOrder(this Double value)
+ {
+ return ByteUnion.QWordValue.Create(value).HostToNetworkOrder().Float;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs.meta
new file mode 100644
index 00000000..f6008eb9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/EndianConverter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2d72520a65b562f4f862ac0760306215
+timeCreated: 1540879367
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs
new file mode 100644
index 00000000..da23af39
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace UniJSON
+{
+
+ public class MsgPackTypeException : Exception
+ {
+ public MsgPackTypeException(string msg) : base(msg)
+ { }
+
+ }
+
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs.meta
new file mode 100644
index 00000000..76095e45
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/Exceptions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bc09dae63ba521545a0b9a8ef120b95a
+timeCreated: 1540906879
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs
new file mode 100644
index 00000000..47e4ff38
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs
@@ -0,0 +1,609 @@
+using System;
+
+
+namespace UniJSON
+{
+ public class MsgPackFormatter : IFormatter, IRpc
+ {
+ IStore m_store;
+ public MsgPackFormatter(IStore store)
+ {
+ m_store = store;
+ }
+
+ public MsgPackFormatter() : this(new BytesStore())
+ {
+ }
+
+ public void Clear()
+ {
+ m_store.Clear();
+ }
+
+#if false
+ public bool MsgPack_Ext(IList list)
+ {
+ var t = list.GetType();
+ var et = t.GetElementType();
+ if (et.IsClass())
+ {
+ return false;
+ }
+ m_store.Write((Byte)MsgPackType.EXT32);
+ var itemSize = Marshal.SizeOf(et);
+ WriteInt32_NBO(list.Count * itemSize);
+
+ Action<Object> pack;
+ if (et == typeof(UInt16))
+ {
+ m_store.Write((Byte)ExtType.UINT16_BE);
+ pack = o => WriteUInt16_NBO((UInt16)o);
+ }
+ else if (et == typeof(UInt32))
+ {
+ m_store.Write((Byte)ExtType.UINT32_BE);
+ pack = o => WriteUInt32_NBO((UInt32)o);
+ }
+ else if (et == typeof(UInt64))
+ {
+ m_store.Write((Byte)ExtType.UINT64_BE);
+ pack = o => WriteUInt64_NBO((UInt64)o);
+ }
+ else if (et == typeof(Int16))
+ {
+ m_store.Write((Byte)ExtType.INT16_BE);
+ pack = o => WriteInt16_NBO((Int16)o);
+ }
+ else if (et == typeof(Int32))
+ {
+ m_store.Write((Byte)ExtType.INT32_BE);
+ pack = o => WriteInt32_NBO((Int32)o);
+ }
+ else if (et == typeof(Int64))
+ {
+ m_store.Write((Byte)ExtType.INT64_BE);
+ pack = o => WriteInt64_NBO((Int64)o);
+ }
+ else if (et == typeof(Single))
+ {
+ m_store.Write((Byte)ExtType.SINGLE_BE);
+ pack = o => WriteSingle_NBO((Single)o);
+ }
+ else if (et == typeof(Double))
+ {
+ m_store.Write((Byte)ExtType.DOUBLE_BE);
+ pack = o => WriteDouble_NBO((Double)o);
+ }
+ else
+ {
+ return false;
+ }
+
+ foreach (var i in list)
+ {
+ pack(i);
+ }
+ return true;
+ }
+#endif
+
+ public void BeginList(int n)
+ {
+ if (n < 0x0F)
+ {
+ m_store.Write((Byte)((Byte)MsgPackType.FIX_ARRAY | n));
+ }
+ else if (n < 0xFFFF)
+ {
+ m_store.Write((Byte)MsgPackType.ARRAY16);
+ m_store.WriteBigEndian((UInt16)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.ARRAY32);
+ m_store.WriteBigEndian(n);
+ }
+ }
+
+ public void EndList()
+ {
+ }
+
+ public void BeginMap(int n)
+ {
+ if (n < 0x0F)
+ {
+ m_store.Write((Byte)((Byte)MsgPackType.FIX_MAP | n));
+ }
+ else if (n < 0xFFFF)
+ {
+ m_store.Write((Byte)MsgPackType.MAP16);
+ m_store.WriteBigEndian((UInt16)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.MAP32);
+ m_store.WriteBigEndian(n.ToNetworkByteOrder());
+ }
+ }
+
+ public void EndMap()
+ {
+ }
+
+ public void Null()
+ {
+ m_store.Write((Byte)MsgPackType.NIL);
+ }
+
+ public void Key(Utf8String key)
+ {
+ Value(key);
+ }
+
+ public void Value(String s)
+ {
+ Value(Utf8String.From(s));
+ }
+
+ public void Value(Utf8String s)
+ {
+ var bytes = s.Bytes;
+ int size = bytes.Count;
+ if (size < 32)
+ {
+ m_store.Write((Byte)((Byte)MsgPackType.FIX_STR | size));
+ m_store.Write(bytes);
+ }
+ else if (size < 0xFF)
+ {
+ m_store.Write((Byte)(MsgPackType.STR8));
+ m_store.Write((Byte)(size));
+ m_store.Write(bytes);
+ }
+ else if (size < 0xFFFF)
+ {
+ m_store.Write((Byte)MsgPackType.STR16);
+ m_store.WriteBigEndian((UInt16)size);
+ m_store.Write(bytes);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.STR32);
+ m_store.WriteBigEndian(size);
+ m_store.Write(bytes);
+ }
+ }
+
+ public void Value(bool value)
+ {
+ if (value)
+ {
+ m_store.Write((Byte)MsgPackType.TRUE);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.FALSE);
+ }
+ }
+
+ #region Singed
+ public void Value(sbyte n)
+ {
+ if (n >= 0)
+ {
+ // positive
+ Value((Byte)n);
+ }
+ else if (n >= -32)
+ {
+ var value = (MsgPackType)((n + 32) + (Byte)MsgPackType.NEGATIVE_FIXNUM);
+ m_store.Write((Byte)value);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.INT8);
+ m_store.Write((Byte)n);
+ }
+ }
+
+ public void Value(short n)
+ {
+ if (n >= 0)
+ {
+ // positive
+ if (n <= 0xFF)
+ {
+ Value((Byte)n);
+ }
+ else
+ {
+ Value((UInt16)n);
+ }
+ }
+ else
+ {
+ // negative
+ if (n >= -128)
+ {
+ m_store.Write((SByte)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.INT16);
+ m_store.WriteBigEndian(n);
+ }
+ }
+ }
+
+ public void Value(int n)
+ {
+ if (n >= 0)
+ {
+ // positive
+ if (n <= 0xFF)
+ {
+ Value((Byte)n);
+ }
+ else if (n <= 0xFFFF)
+ {
+ Value((UInt16)n);
+ }
+ else
+ {
+ Value((UInt32)n);
+ }
+ }
+ else
+ {
+ // negative
+ if (n >= -128)
+ {
+ Value((SByte)n);
+ }
+ else if (n >= -32768)
+ {
+ Value((Int16)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.INT32);
+ m_store.WriteBigEndian(n);
+ }
+ }
+ }
+
+ public void Value(long n)
+ {
+ if (n >= 0)
+ {
+ // positive
+ if (n <= 0xFF)
+ {
+ Value((Byte)n);
+ }
+ else if (n <= 0xFFFF)
+ {
+ Value((UInt16)n);
+ }
+ else if (n <= 0xFFFFFFFF)
+ {
+ Value((UInt32)n);
+ }
+ else
+ {
+ Value((UInt64)n);
+ }
+ }
+ else
+ {
+ // negative
+ if (n >= -128)
+ {
+ Value((SByte)n);
+ }
+ else if (n >= -32768)
+ {
+ Value((Int16)n);
+ }
+ else if (n >= -2147483648)
+ {
+ Value((Int32)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.INT64);
+ m_store.WriteBigEndian(n);
+ }
+ }
+ }
+ #endregion
+
+ #region Unsigned
+ public void Value(byte n)
+ {
+ if (n <= 0x7F)
+ {
+ // FormatType.POSITIVE_FIXNUM
+ m_store.Write(n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.UINT8);
+ m_store.Write(n);
+ }
+ }
+
+ public void Value(ushort n)
+ {
+ if (n <= 0xFF)
+ {
+ Value((Byte)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.UINT16);
+ m_store.WriteBigEndian(n);
+ }
+ }
+
+ public void Value(uint n)
+ {
+ if (n <= 0xFF)
+ {
+ Value((Byte)n);
+ }
+ else if (n <= 0xFFFF)
+ {
+ Value((UInt16)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.UINT32);
+ m_store.WriteBigEndian(n);
+ }
+ }
+
+ public void Value(ulong n)
+ {
+ if (n <= 0xFF)
+ {
+ Value((Byte)n);
+ }
+ else if (n <= 0xFFFF)
+ {
+ Value((UInt16)n);
+ }
+ else if (n <= 0xFFFFFFFF)
+ {
+ Value((UInt32)n);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.UINT64);
+ m_store.WriteBigEndian(n);
+ }
+ }
+ #endregion
+
+ public void Value(float value)
+ {
+ m_store.Write((Byte)MsgPackType.FLOAT);
+ m_store.WriteBigEndian(value);
+ }
+
+ public void Value(double value)
+ {
+ m_store.Write((Byte)MsgPackType.DOUBLE);
+ m_store.WriteBigEndian(value);
+ }
+
+ public void Value(ArraySegment<byte> bytes)
+ {
+ if (bytes.Count < 0xFF)
+ {
+ m_store.Write((Byte)(MsgPackType.BIN8));
+ m_store.Write((Byte)(bytes.Count));
+ m_store.Write(bytes);
+ }
+ else if (bytes.Count < 0xFFFF)
+ {
+ m_store.Write((Byte)MsgPackType.BIN16);
+ m_store.WriteBigEndian((UInt16)bytes.Count);
+ m_store.Write(bytes);
+ }
+ else
+ {
+ m_store.Write((Byte)MsgPackType.BIN32);
+ m_store.WriteBigEndian(bytes.Count);
+ m_store.Write(bytes);
+ }
+ }
+
+ public void TimeStamp32(DateTimeOffset time)
+ {
+ // https://github.com/ousttrue/UniJSON/blob/1.2/Scripts/Extensions/DateTimeOffsetExtensions.cs#L13-L16
+ if (time < DateTimeOffsetExtensions.EpochTime)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ m_store.Write((Byte)MsgPackType.FIX_EXT_4);
+ m_store.Write((SByte)(-1));
+ m_store.WriteBigEndian((uint)time.ToUnixTimeSeconds());
+ }
+
+ public void Value(DateTimeOffset time)
+ {
+ TimeStamp32(time);
+ }
+
+ public void Value(ListTreeNode<MsgPackValue> node)
+ {
+ m_store.Write(node.Value.Bytes);
+ }
+
+ public IStore GetStore()
+ {
+ return m_store;
+ }
+
+ #region IRpc
+ public const int REQUEST_TYPE = 0;
+ public const int RESPONSE_TYPE = 1;
+ public const int NOTIFY_TYPE = 2;
+
+ int m_msgId = 1;
+
+ public void Request(Utf8String method)
+ {
+ BeginList(4);
+ Value(REQUEST_TYPE);
+ Value(m_msgId++);
+ Value(method);
+ BeginList(0); // params
+ {
+ }
+ EndList();
+ EndList();
+ }
+
+ public void Request<A0>(Utf8String method, A0 a0)
+ {
+ BeginList(4);
+ Value(REQUEST_TYPE);
+ Value(m_msgId++);
+ Value(method);
+ BeginList(1); // params
+ {
+ this.Serialize(a0);
+ }
+ EndList();
+ EndList();
+ }
+
+ public void Request<A0, A1>(Utf8String method, A0 a0, A1 a1)
+ {
+ BeginList(4);
+ Value(REQUEST_TYPE);
+ Value(m_msgId++);
+ Value(method);
+ BeginList(2); // params
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ }
+ EndList();
+ EndList();
+ }
+
+ public void Request<A0, A1, A2>(Utf8String method, A0 a0, A1 a1, A2 a2)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Request<A0, A1, A2, A3>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Request<A0, A1, A2, A3, A4>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Request<A0, A1, A2, A3, A4, A5>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void ResponseSuccess(int id)
+ {
+ BeginList(4);
+ Value(RESPONSE_TYPE);
+ Value(id);
+ Null();
+ Null();
+ EndList();
+ }
+
+ public void ResponseSuccess<T>(int id, T result)
+ {
+ BeginList(4);
+ Value(RESPONSE_TYPE);
+ Value(id);
+ Null();
+ this.Serialize(result);
+ EndList();
+ }
+
+ public void ResponseError(int id, Exception error)
+ {
+ BeginList(4);
+ Value(RESPONSE_TYPE);
+ Value(id);
+ this.Serialize(error);
+ Null();
+ EndList();
+ }
+
+ public void Notify(Utf8String method)
+ {
+ BeginList(3);
+ Value(NOTIFY_TYPE);
+ Value(method);
+ BeginList(0); // params
+ {
+ }
+ EndList();
+ EndList();
+ }
+
+ public void Notify<A0>(Utf8String method, A0 a0)
+ {
+ BeginList(3);
+ Value(NOTIFY_TYPE);
+ Value(method);
+ BeginList(1); // params
+ {
+ this.Serialize(a0);
+ }
+ EndList();
+ EndList();
+ }
+
+ public void Notify<A0, A1>(Utf8String method, A0 a0, A1 a1)
+ {
+ BeginList(3);
+ Value(NOTIFY_TYPE);
+ Value(method);
+ BeginList(2); // params
+ {
+ this.Serialize(a0);
+ this.Serialize(a1);
+ }
+ EndList();
+ EndList();
+ }
+
+ public void Notify<A0, A1, A2>(Utf8String method, A0 a0, A1 a1, A2 a2)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Notify<A0, A1, A2, A3>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Notify<A0, A1, A2, A3, A4>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void Notify<A0, A1, A2, A3, A4, A5>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs.meta
new file mode 100644
index 00000000..cdcbc7f3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackFormatter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 41153eff97391fd46a31361bac5804fb
+timeCreated: 1540879112
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs
new file mode 100644
index 00000000..cf0e07f6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs
@@ -0,0 +1,416 @@
+using System;
+using System.Collections.Generic;
+
+namespace UniJSON
+{
+ public static class MsgPackParser
+ {
+ public static ListTreeNode<MsgPackValue> Parse(Byte[] bytes)
+ {
+ return Parse(new ArraySegment<byte>(bytes));
+ }
+
+ static MsgPackType GetFormat(ArraySegment<Byte> bytes)
+ {
+ return (MsgPackType)bytes.Get(0);
+ }
+
+ /// <summary>
+ /// Array又はMapの子要素の数を得る
+ /// </summary>
+ /// <param name="count"></param>
+ /// <returns></returns>
+ static ArraySegment<Byte> GetItemCount(ArraySegment<Byte> bytes, MsgPackType formatType, out UInt32 count)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FIX_ARRAY: count = 0; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x1: count = 1; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x2: count = 2; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x3: count = 3; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x4: count = 4; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x5: count = 5; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x6: count = 6; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x7: count = 7; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x8: count = 8; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0x9: count = 9; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0xA: count = 10; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0xB: count = 11; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0xC: count = 12; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0xD: count = 13; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0xE: count = 14; return bytes.Advance(1);
+ case MsgPackType.FIX_ARRAY_0xF: count = 15; return bytes.Advance(1);
+
+ case MsgPackType.FIX_MAP: count = 0; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x1: count = 1; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x2: count = 2; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x3: count = 3; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x4: count = 4; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x5: count = 5; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x6: count = 6; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x7: count = 7; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x8: count = 8; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0x9: count = 9; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0xA: count = 10; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0xB: count = 11; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0xC: count = 12; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0xD: count = 13; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0xE: count = 14; return bytes.Advance(1);
+ case MsgPackType.FIX_MAP_0xF: count = 15; return bytes.Advance(1);
+
+ case MsgPackType.ARRAY16:
+ case MsgPackType.MAP16:
+ count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 2);
+
+ case MsgPackType.ARRAY32:
+ case MsgPackType.MAP32:
+ count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 4);
+
+ default:
+ throw new ArgumentException("is not collection: " + formatType);
+ }
+ }
+
+ /// <summary>
+ /// ArrayとMap以外のタイプのペイロードを得る
+ /// </summary>
+ /// <returns></returns>
+ static ArraySegment<Byte> GetBody(ArraySegment<Byte> bytes, MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FIX_STR: return bytes.Advance(1).Take(0);
+ case MsgPackType.FIX_STR_0x01: return bytes.Advance(1).Take(1);
+ case MsgPackType.FIX_STR_0x02: return bytes.Advance(1).Take(2);
+ case MsgPackType.FIX_STR_0x03: return bytes.Advance(1).Take(3);
+ case MsgPackType.FIX_STR_0x04: return bytes.Advance(1).Take(4);
+ case MsgPackType.FIX_STR_0x05: return bytes.Advance(1).Take(5);
+ case MsgPackType.FIX_STR_0x06: return bytes.Advance(1).Take(6);
+ case MsgPackType.FIX_STR_0x07: return bytes.Advance(1).Take(7);
+ case MsgPackType.FIX_STR_0x08: return bytes.Advance(1).Take(8);
+ case MsgPackType.FIX_STR_0x09: return bytes.Advance(1).Take(9);
+ case MsgPackType.FIX_STR_0x0A: return bytes.Advance(1).Take(10);
+ case MsgPackType.FIX_STR_0x0B: return bytes.Advance(1).Take(11);
+ case MsgPackType.FIX_STR_0x0C: return bytes.Advance(1).Take(12);
+ case MsgPackType.FIX_STR_0x0D: return bytes.Advance(1).Take(13);
+ case MsgPackType.FIX_STR_0x0E: return bytes.Advance(1).Take(14);
+ case MsgPackType.FIX_STR_0x0F: return bytes.Advance(1).Take(15);
+
+ case MsgPackType.FIX_STR_0x10: return bytes.Advance(1).Take(16);
+ case MsgPackType.FIX_STR_0x11: return bytes.Advance(1).Take(17);
+ case MsgPackType.FIX_STR_0x12: return bytes.Advance(1).Take(18);
+ case MsgPackType.FIX_STR_0x13: return bytes.Advance(1).Take(19);
+ case MsgPackType.FIX_STR_0x14: return bytes.Advance(1).Take(20);
+ case MsgPackType.FIX_STR_0x15: return bytes.Advance(1).Take(21);
+ case MsgPackType.FIX_STR_0x16: return bytes.Advance(1).Take(22);
+ case MsgPackType.FIX_STR_0x17: return bytes.Advance(1).Take(23);
+ case MsgPackType.FIX_STR_0x18: return bytes.Advance(1).Take(24);
+ case MsgPackType.FIX_STR_0x19: return bytes.Advance(1).Take(25);
+ case MsgPackType.FIX_STR_0x1A: return bytes.Advance(1).Take(26);
+ case MsgPackType.FIX_STR_0x1B: return bytes.Advance(1).Take(27);
+ case MsgPackType.FIX_STR_0x1C: return bytes.Advance(1).Take(28);
+ case MsgPackType.FIX_STR_0x1D: return bytes.Advance(1).Take(29);
+ case MsgPackType.FIX_STR_0x1E: return bytes.Advance(1).Take(30);
+ case MsgPackType.FIX_STR_0x1F: return bytes.Advance(1).Take(31);
+
+ case MsgPackType.STR8:
+ case MsgPackType.BIN8:
+ {
+ var count = bytes.Get(1);
+ return bytes.Advance(1 + 1).Take(count);
+ }
+
+ case MsgPackType.STR16:
+ case MsgPackType.BIN16:
+ {
+ var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 2).Take(count);
+ }
+
+ case MsgPackType.STR32:
+ case MsgPackType.BIN32:
+ {
+ var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 4).Take((int)count);
+ }
+
+ case MsgPackType.NIL:
+ case MsgPackType.TRUE:
+ case MsgPackType.FALSE:
+ case MsgPackType.POSITIVE_FIXNUM:
+ case MsgPackType.POSITIVE_FIXNUM_0x01:
+ case MsgPackType.POSITIVE_FIXNUM_0x02:
+ case MsgPackType.POSITIVE_FIXNUM_0x03:
+ case MsgPackType.POSITIVE_FIXNUM_0x04:
+ case MsgPackType.POSITIVE_FIXNUM_0x05:
+ case MsgPackType.POSITIVE_FIXNUM_0x06:
+ case MsgPackType.POSITIVE_FIXNUM_0x07:
+ case MsgPackType.POSITIVE_FIXNUM_0x08:
+ case MsgPackType.POSITIVE_FIXNUM_0x09:
+ case MsgPackType.POSITIVE_FIXNUM_0x0A:
+ case MsgPackType.POSITIVE_FIXNUM_0x0B:
+ case MsgPackType.POSITIVE_FIXNUM_0x0C:
+ case MsgPackType.POSITIVE_FIXNUM_0x0D:
+ case MsgPackType.POSITIVE_FIXNUM_0x0E:
+ case MsgPackType.POSITIVE_FIXNUM_0x0F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x10:
+ case MsgPackType.POSITIVE_FIXNUM_0x11:
+ case MsgPackType.POSITIVE_FIXNUM_0x12:
+ case MsgPackType.POSITIVE_FIXNUM_0x13:
+ case MsgPackType.POSITIVE_FIXNUM_0x14:
+ case MsgPackType.POSITIVE_FIXNUM_0x15:
+ case MsgPackType.POSITIVE_FIXNUM_0x16:
+ case MsgPackType.POSITIVE_FIXNUM_0x17:
+ case MsgPackType.POSITIVE_FIXNUM_0x18:
+ case MsgPackType.POSITIVE_FIXNUM_0x19:
+ case MsgPackType.POSITIVE_FIXNUM_0x1A:
+ case MsgPackType.POSITIVE_FIXNUM_0x1B:
+ case MsgPackType.POSITIVE_FIXNUM_0x1C:
+ case MsgPackType.POSITIVE_FIXNUM_0x1D:
+ case MsgPackType.POSITIVE_FIXNUM_0x1E:
+ case MsgPackType.POSITIVE_FIXNUM_0x1F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x20:
+ case MsgPackType.POSITIVE_FIXNUM_0x21:
+ case MsgPackType.POSITIVE_FIXNUM_0x22:
+ case MsgPackType.POSITIVE_FIXNUM_0x23:
+ case MsgPackType.POSITIVE_FIXNUM_0x24:
+ case MsgPackType.POSITIVE_FIXNUM_0x25:
+ case MsgPackType.POSITIVE_FIXNUM_0x26:
+ case MsgPackType.POSITIVE_FIXNUM_0x27:
+ case MsgPackType.POSITIVE_FIXNUM_0x28:
+ case MsgPackType.POSITIVE_FIXNUM_0x29:
+ case MsgPackType.POSITIVE_FIXNUM_0x2A:
+ case MsgPackType.POSITIVE_FIXNUM_0x2B:
+ case MsgPackType.POSITIVE_FIXNUM_0x2C:
+ case MsgPackType.POSITIVE_FIXNUM_0x2D:
+ case MsgPackType.POSITIVE_FIXNUM_0x2E:
+ case MsgPackType.POSITIVE_FIXNUM_0x2F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x30:
+ case MsgPackType.POSITIVE_FIXNUM_0x31:
+ case MsgPackType.POSITIVE_FIXNUM_0x32:
+ case MsgPackType.POSITIVE_FIXNUM_0x33:
+ case MsgPackType.POSITIVE_FIXNUM_0x34:
+ case MsgPackType.POSITIVE_FIXNUM_0x35:
+ case MsgPackType.POSITIVE_FIXNUM_0x36:
+ case MsgPackType.POSITIVE_FIXNUM_0x37:
+ case MsgPackType.POSITIVE_FIXNUM_0x38:
+ case MsgPackType.POSITIVE_FIXNUM_0x39:
+ case MsgPackType.POSITIVE_FIXNUM_0x3A:
+ case MsgPackType.POSITIVE_FIXNUM_0x3B:
+ case MsgPackType.POSITIVE_FIXNUM_0x3C:
+ case MsgPackType.POSITIVE_FIXNUM_0x3D:
+ case MsgPackType.POSITIVE_FIXNUM_0x3E:
+ case MsgPackType.POSITIVE_FIXNUM_0x3F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x40:
+ case MsgPackType.POSITIVE_FIXNUM_0x41:
+ case MsgPackType.POSITIVE_FIXNUM_0x42:
+ case MsgPackType.POSITIVE_FIXNUM_0x43:
+ case MsgPackType.POSITIVE_FIXNUM_0x44:
+ case MsgPackType.POSITIVE_FIXNUM_0x45:
+ case MsgPackType.POSITIVE_FIXNUM_0x46:
+ case MsgPackType.POSITIVE_FIXNUM_0x47:
+ case MsgPackType.POSITIVE_FIXNUM_0x48:
+ case MsgPackType.POSITIVE_FIXNUM_0x49:
+ case MsgPackType.POSITIVE_FIXNUM_0x4A:
+ case MsgPackType.POSITIVE_FIXNUM_0x4B:
+ case MsgPackType.POSITIVE_FIXNUM_0x4C:
+ case MsgPackType.POSITIVE_FIXNUM_0x4D:
+ case MsgPackType.POSITIVE_FIXNUM_0x4E:
+ case MsgPackType.POSITIVE_FIXNUM_0x4F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x50:
+ case MsgPackType.POSITIVE_FIXNUM_0x51:
+ case MsgPackType.POSITIVE_FIXNUM_0x52:
+ case MsgPackType.POSITIVE_FIXNUM_0x53:
+ case MsgPackType.POSITIVE_FIXNUM_0x54:
+ case MsgPackType.POSITIVE_FIXNUM_0x55:
+ case MsgPackType.POSITIVE_FIXNUM_0x56:
+ case MsgPackType.POSITIVE_FIXNUM_0x57:
+ case MsgPackType.POSITIVE_FIXNUM_0x58:
+ case MsgPackType.POSITIVE_FIXNUM_0x59:
+ case MsgPackType.POSITIVE_FIXNUM_0x5A:
+ case MsgPackType.POSITIVE_FIXNUM_0x5B:
+ case MsgPackType.POSITIVE_FIXNUM_0x5C:
+ case MsgPackType.POSITIVE_FIXNUM_0x5D:
+ case MsgPackType.POSITIVE_FIXNUM_0x5E:
+ case MsgPackType.POSITIVE_FIXNUM_0x5F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x60:
+ case MsgPackType.POSITIVE_FIXNUM_0x61:
+ case MsgPackType.POSITIVE_FIXNUM_0x62:
+ case MsgPackType.POSITIVE_FIXNUM_0x63:
+ case MsgPackType.POSITIVE_FIXNUM_0x64:
+ case MsgPackType.POSITIVE_FIXNUM_0x65:
+ case MsgPackType.POSITIVE_FIXNUM_0x66:
+ case MsgPackType.POSITIVE_FIXNUM_0x67:
+ case MsgPackType.POSITIVE_FIXNUM_0x68:
+ case MsgPackType.POSITIVE_FIXNUM_0x69:
+ case MsgPackType.POSITIVE_FIXNUM_0x6A:
+ case MsgPackType.POSITIVE_FIXNUM_0x6B:
+ case MsgPackType.POSITIVE_FIXNUM_0x6C:
+ case MsgPackType.POSITIVE_FIXNUM_0x6D:
+ case MsgPackType.POSITIVE_FIXNUM_0x6E:
+ case MsgPackType.POSITIVE_FIXNUM_0x6F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x70:
+ case MsgPackType.POSITIVE_FIXNUM_0x71:
+ case MsgPackType.POSITIVE_FIXNUM_0x72:
+ case MsgPackType.POSITIVE_FIXNUM_0x73:
+ case MsgPackType.POSITIVE_FIXNUM_0x74:
+ case MsgPackType.POSITIVE_FIXNUM_0x75:
+ case MsgPackType.POSITIVE_FIXNUM_0x76:
+ case MsgPackType.POSITIVE_FIXNUM_0x77:
+ case MsgPackType.POSITIVE_FIXNUM_0x78:
+ case MsgPackType.POSITIVE_FIXNUM_0x79:
+ case MsgPackType.POSITIVE_FIXNUM_0x7A:
+ case MsgPackType.POSITIVE_FIXNUM_0x7B:
+ case MsgPackType.POSITIVE_FIXNUM_0x7C:
+ case MsgPackType.POSITIVE_FIXNUM_0x7D:
+ case MsgPackType.POSITIVE_FIXNUM_0x7E:
+ case MsgPackType.POSITIVE_FIXNUM_0x7F:
+
+ case MsgPackType.NEGATIVE_FIXNUM:
+ case MsgPackType.NEGATIVE_FIXNUM_0x01:
+ case MsgPackType.NEGATIVE_FIXNUM_0x02:
+ case MsgPackType.NEGATIVE_FIXNUM_0x03:
+ case MsgPackType.NEGATIVE_FIXNUM_0x04:
+ case MsgPackType.NEGATIVE_FIXNUM_0x05:
+ case MsgPackType.NEGATIVE_FIXNUM_0x06:
+ case MsgPackType.NEGATIVE_FIXNUM_0x07:
+ case MsgPackType.NEGATIVE_FIXNUM_0x08:
+ case MsgPackType.NEGATIVE_FIXNUM_0x09:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0A:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0B:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0C:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0D:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0E:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0F:
+ case MsgPackType.NEGATIVE_FIXNUM_0x10:
+ case MsgPackType.NEGATIVE_FIXNUM_0x11:
+ case MsgPackType.NEGATIVE_FIXNUM_0x12:
+ case MsgPackType.NEGATIVE_FIXNUM_0x13:
+ case MsgPackType.NEGATIVE_FIXNUM_0x14:
+ case MsgPackType.NEGATIVE_FIXNUM_0x15:
+ case MsgPackType.NEGATIVE_FIXNUM_0x16:
+ case MsgPackType.NEGATIVE_FIXNUM_0x17:
+ case MsgPackType.NEGATIVE_FIXNUM_0x18:
+ case MsgPackType.NEGATIVE_FIXNUM_0x19:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1A:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1B:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1C:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1D:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1E:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1F:
+ return bytes.Advance(1).Take(0);
+
+ case MsgPackType.UINT8:
+ case MsgPackType.INT8:
+ return bytes.Advance(1).Take(1);
+
+ case MsgPackType.UINT16:
+ case MsgPackType.INT16:
+ return bytes.Advance(1).Take(2);
+
+ case MsgPackType.UINT32:
+ case MsgPackType.INT32:
+ case MsgPackType.FLOAT:
+ return bytes.Advance(1).Take(4);
+
+ case MsgPackType.UINT64:
+ case MsgPackType.INT64:
+ case MsgPackType.DOUBLE:
+ return bytes.Advance(1).Take(8);
+
+ case MsgPackType.FIX_EXT_1:
+ return bytes.Advance(2).Take(1);
+ case MsgPackType.FIX_EXT_2:
+ return bytes.Advance(2).Take(2);
+ case MsgPackType.FIX_EXT_4:
+ return bytes.Advance(2).Take(4);
+ case MsgPackType.FIX_EXT_8:
+ return bytes.Advance(2).Take(8);
+ case MsgPackType.FIX_EXT_16:
+ return bytes.Advance(2).Take(16);
+ case MsgPackType.EXT8:
+ {
+ var count = bytes.Get(1);
+ return bytes.Advance(1 + 1 + 1).Take(count);
+ }
+ case MsgPackType.EXT16:
+ {
+ var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 2 + 1).Take(count);
+ }
+ case MsgPackType.EXT32:
+ {
+ var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 4 + 1).Take((int)count);
+ }
+ default:
+ throw new ArgumentException("unknown type: " + formatType);
+ }
+ }
+
+ static ListTreeNode<MsgPackValue> _Parse(ListTreeNode<MsgPackValue> tree, ArraySegment<Byte> bytes)
+ {
+ MsgPackType formatType = GetFormat(bytes);
+ if (formatType.IsArray())
+ {
+ var array = tree.AddValue(bytes, ValueNodeType.Array);
+
+ uint count;
+ bytes = GetItemCount(bytes, formatType, out count);
+ for (var i = 0; i < count; ++i)
+ {
+ var child = _Parse(array, bytes);
+ bytes = bytes.Advance(child.Value.Bytes.Count);
+ }
+
+ array.SetValueBytesCount(bytes.Offset - array.Value.Bytes.Offset);
+
+ return array;
+ }
+ else if (formatType.IsMap())
+ {
+ var obj = tree.AddValue(bytes, ValueNodeType.Object);
+
+ uint count;
+ bytes = GetItemCount(bytes, formatType, out count);
+ for (var i = 0; i < count; ++i)
+ {
+ // key
+ var key = _Parse(obj, bytes);
+ bytes = bytes.Advance(key.Value.Bytes.Count);
+
+ // value
+ var value = _Parse(obj, bytes);
+ bytes = bytes.Advance(value.Value.Bytes.Count);
+ }
+
+ obj.SetValueBytesCount(bytes.Offset - obj.Value.Bytes.Offset);
+
+ return obj;
+ }
+ else
+ {
+ var body = GetBody(bytes, formatType);
+ var headerSize = body.Offset - bytes.Offset;
+ var size = headerSize + body.Count;
+
+ var value = tree.AddValue(bytes.Take(size), ValueNodeType.Null);
+ return value;
+ }
+ }
+
+ public static ListTreeNode<MsgPackValue> Parse(ArraySegment<Byte> bytes)
+ {
+ return _Parse(default(ListTreeNode<MsgPackValue>), bytes);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs.meta
new file mode 100644
index 00000000..ba4452ea
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackParser.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 96621564d26fc294291143738c163a3d
+timeCreated: 1540815282
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs
new file mode 100644
index 00000000..dd71d3d3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs
@@ -0,0 +1,313 @@
+namespace UniJSON
+{
+ public enum MsgPackType : byte
+ {
+ #region POSITIVE_FIXNUM 0x00-0x7F
+ POSITIVE_FIXNUM = 0x00,
+ POSITIVE_FIXNUM_0x01 = 0x01,
+ POSITIVE_FIXNUM_0x02 = 0x02,
+ POSITIVE_FIXNUM_0x03 = 0x03,
+ POSITIVE_FIXNUM_0x04 = 0x04,
+ POSITIVE_FIXNUM_0x05 = 0x05,
+ POSITIVE_FIXNUM_0x06 = 0x06,
+ POSITIVE_FIXNUM_0x07 = 0x07,
+ POSITIVE_FIXNUM_0x08 = 0x08,
+ POSITIVE_FIXNUM_0x09 = 0x09,
+ POSITIVE_FIXNUM_0x0A = 0x0A,
+ POSITIVE_FIXNUM_0x0B = 0x0B,
+ POSITIVE_FIXNUM_0x0C = 0x0C,
+ POSITIVE_FIXNUM_0x0D = 0x0D,
+ POSITIVE_FIXNUM_0x0E = 0x0E,
+ POSITIVE_FIXNUM_0x0F = 0x0F,
+
+ POSITIVE_FIXNUM_0x10 = 0x10,
+ POSITIVE_FIXNUM_0x11 = 0x11,
+ POSITIVE_FIXNUM_0x12 = 0x12,
+ POSITIVE_FIXNUM_0x13 = 0x13,
+ POSITIVE_FIXNUM_0x14 = 0x14,
+ POSITIVE_FIXNUM_0x15 = 0x15,
+ POSITIVE_FIXNUM_0x16 = 0x16,
+ POSITIVE_FIXNUM_0x17 = 0x17,
+ POSITIVE_FIXNUM_0x18 = 0x18,
+ POSITIVE_FIXNUM_0x19 = 0x19,
+ POSITIVE_FIXNUM_0x1A = 0x1A,
+ POSITIVE_FIXNUM_0x1B = 0x1B,
+ POSITIVE_FIXNUM_0x1C = 0x1C,
+ POSITIVE_FIXNUM_0x1D = 0x1D,
+ POSITIVE_FIXNUM_0x1E = 0x1E,
+ POSITIVE_FIXNUM_0x1F = 0x1F,
+
+ POSITIVE_FIXNUM_0x20 = 0x20,
+ POSITIVE_FIXNUM_0x21 = 0x21,
+ POSITIVE_FIXNUM_0x22 = 0x22,
+ POSITIVE_FIXNUM_0x23 = 0x23,
+ POSITIVE_FIXNUM_0x24 = 0x24,
+ POSITIVE_FIXNUM_0x25 = 0x25,
+ POSITIVE_FIXNUM_0x26 = 0x26,
+ POSITIVE_FIXNUM_0x27 = 0x27,
+ POSITIVE_FIXNUM_0x28 = 0x28,
+ POSITIVE_FIXNUM_0x29 = 0x29,
+ POSITIVE_FIXNUM_0x2A = 0x2A,
+ POSITIVE_FIXNUM_0x2B = 0x2B,
+ POSITIVE_FIXNUM_0x2C = 0x2C,
+ POSITIVE_FIXNUM_0x2D = 0x2D,
+ POSITIVE_FIXNUM_0x2E = 0x2E,
+ POSITIVE_FIXNUM_0x2F = 0x2F,
+
+ POSITIVE_FIXNUM_0x30 = 0x30,
+ POSITIVE_FIXNUM_0x31 = 0x31,
+ POSITIVE_FIXNUM_0x32 = 0x32,
+ POSITIVE_FIXNUM_0x33 = 0x33,
+ POSITIVE_FIXNUM_0x34 = 0x34,
+ POSITIVE_FIXNUM_0x35 = 0x35,
+ POSITIVE_FIXNUM_0x36 = 0x36,
+ POSITIVE_FIXNUM_0x37 = 0x37,
+ POSITIVE_FIXNUM_0x38 = 0x38,
+ POSITIVE_FIXNUM_0x39 = 0x39,
+ POSITIVE_FIXNUM_0x3A = 0x3A,
+ POSITIVE_FIXNUM_0x3B = 0x3B,
+ POSITIVE_FIXNUM_0x3C = 0x3C,
+ POSITIVE_FIXNUM_0x3D = 0x3D,
+ POSITIVE_FIXNUM_0x3E = 0x3E,
+ POSITIVE_FIXNUM_0x3F = 0x3F,
+
+ POSITIVE_FIXNUM_0x40 = 0x40,
+ POSITIVE_FIXNUM_0x41 = 0x41,
+ POSITIVE_FIXNUM_0x42 = 0x42,
+ POSITIVE_FIXNUM_0x43 = 0x43,
+ POSITIVE_FIXNUM_0x44 = 0x44,
+ POSITIVE_FIXNUM_0x45 = 0x45,
+ POSITIVE_FIXNUM_0x46 = 0x46,
+ POSITIVE_FIXNUM_0x47 = 0x47,
+ POSITIVE_FIXNUM_0x48 = 0x48,
+ POSITIVE_FIXNUM_0x49 = 0x49,
+ POSITIVE_FIXNUM_0x4A = 0x4A,
+ POSITIVE_FIXNUM_0x4B = 0x4B,
+ POSITIVE_FIXNUM_0x4C = 0x4C,
+ POSITIVE_FIXNUM_0x4D = 0x4D,
+ POSITIVE_FIXNUM_0x4E = 0x4E,
+ POSITIVE_FIXNUM_0x4F = 0x4F,
+
+ POSITIVE_FIXNUM_0x50 = 0x50,
+ POSITIVE_FIXNUM_0x51 = 0x51,
+ POSITIVE_FIXNUM_0x52 = 0x52,
+ POSITIVE_FIXNUM_0x53 = 0x53,
+ POSITIVE_FIXNUM_0x54 = 0x54,
+ POSITIVE_FIXNUM_0x55 = 0x55,
+ POSITIVE_FIXNUM_0x56 = 0x56,
+ POSITIVE_FIXNUM_0x57 = 0x57,
+ POSITIVE_FIXNUM_0x58 = 0x58,
+ POSITIVE_FIXNUM_0x59 = 0x59,
+ POSITIVE_FIXNUM_0x5A = 0x5A,
+ POSITIVE_FIXNUM_0x5B = 0x5B,
+ POSITIVE_FIXNUM_0x5C = 0x5C,
+ POSITIVE_FIXNUM_0x5D = 0x5D,
+ POSITIVE_FIXNUM_0x5E = 0x5E,
+ POSITIVE_FIXNUM_0x5F = 0x5F,
+
+ POSITIVE_FIXNUM_0x60 = 0x60,
+ POSITIVE_FIXNUM_0x61 = 0x61,
+ POSITIVE_FIXNUM_0x62 = 0x62,
+ POSITIVE_FIXNUM_0x63 = 0x63,
+ POSITIVE_FIXNUM_0x64 = 0x64,
+ POSITIVE_FIXNUM_0x65 = 0x65,
+ POSITIVE_FIXNUM_0x66 = 0x66,
+ POSITIVE_FIXNUM_0x67 = 0x67,
+ POSITIVE_FIXNUM_0x68 = 0x68,
+ POSITIVE_FIXNUM_0x69 = 0x69,
+ POSITIVE_FIXNUM_0x6A = 0x6A,
+ POSITIVE_FIXNUM_0x6B = 0x6B,
+ POSITIVE_FIXNUM_0x6C = 0x6C,
+ POSITIVE_FIXNUM_0x6D = 0x6D,
+ POSITIVE_FIXNUM_0x6E = 0x6E,
+ POSITIVE_FIXNUM_0x6F = 0x6F,
+
+ POSITIVE_FIXNUM_0x70 = 0x70,
+ POSITIVE_FIXNUM_0x71 = 0x71,
+ POSITIVE_FIXNUM_0x72 = 0x72,
+ POSITIVE_FIXNUM_0x73 = 0x73,
+ POSITIVE_FIXNUM_0x74 = 0x74,
+ POSITIVE_FIXNUM_0x75 = 0x75,
+ POSITIVE_FIXNUM_0x76 = 0x76,
+ POSITIVE_FIXNUM_0x77 = 0x77,
+ POSITIVE_FIXNUM_0x78 = 0x78,
+ POSITIVE_FIXNUM_0x79 = 0x79,
+ POSITIVE_FIXNUM_0x7A = 0x7A,
+ POSITIVE_FIXNUM_0x7B = 0x7B,
+ POSITIVE_FIXNUM_0x7C = 0x7C,
+ POSITIVE_FIXNUM_0x7D = 0x7D,
+ POSITIVE_FIXNUM_0x7E = 0x7E,
+ POSITIVE_FIXNUM_0x7F = 0x7F,
+ #endregion
+
+ #region FIX_MAP 0x80-0x8F
+ FIX_MAP = 0x80,
+ FIX_MAP_0x1 = 0x81,
+ FIX_MAP_0x2 = 0x82,
+ FIX_MAP_0x3 = 0x83,
+ FIX_MAP_0x4 = 0x84,
+ FIX_MAP_0x5 = 0x85,
+ FIX_MAP_0x6 = 0x86,
+ FIX_MAP_0x7 = 0x87,
+ FIX_MAP_0x8 = 0x88,
+ FIX_MAP_0x9 = 0x89,
+ FIX_MAP_0xA = 0x8A,
+ FIX_MAP_0xB = 0x8B,
+ FIX_MAP_0xC = 0x8C,
+ FIX_MAP_0xD = 0x8D,
+ FIX_MAP_0xE = 0x8E,
+ FIX_MAP_0xF = 0x8F,
+ #endregion
+
+ #region FIX_ARRAY 0x90-0x9F
+ FIX_ARRAY = 0x90,
+ FIX_ARRAY_0x1 = 0x91,
+ FIX_ARRAY_0x2 = 0x92,
+ FIX_ARRAY_0x3 = 0x93,
+ FIX_ARRAY_0x4 = 0x94,
+ FIX_ARRAY_0x5 = 0x95,
+ FIX_ARRAY_0x6 = 0x96,
+ FIX_ARRAY_0x7 = 0x97,
+ FIX_ARRAY_0x8 = 0x98,
+ FIX_ARRAY_0x9 = 0x99,
+ FIX_ARRAY_0xA = 0x9A,
+ FIX_ARRAY_0xB = 0x9B,
+ FIX_ARRAY_0xC = 0x9C,
+ FIX_ARRAY_0xD = 0x9D,
+ FIX_ARRAY_0xE = 0x9E,
+ FIX_ARRAY_0xF = 0x9F,
+ #endregion
+
+ #region FIX_STR 0xA0-0xBF
+ FIX_STR = 0xA0,
+ FIX_STR_0x01 = 0xA1,
+ FIX_STR_0x02 = 0xA2,
+ FIX_STR_0x03 = 0xA3,
+ FIX_STR_0x04 = 0xA4,
+ FIX_STR_0x05 = 0xA5,
+ FIX_STR_0x06 = 0xA6,
+ FIX_STR_0x07 = 0xA7,
+ FIX_STR_0x08 = 0xA8,
+ FIX_STR_0x09 = 0xA9,
+ FIX_STR_0x0A = 0xAA,
+ FIX_STR_0x0B = 0xAB,
+ FIX_STR_0x0C = 0xAC,
+ FIX_STR_0x0D = 0xAD,
+ FIX_STR_0x0E = 0xAE,
+ FIX_STR_0x0F = 0xAF,
+ FIX_STR_0x10 = 0xB0,
+ FIX_STR_0x11 = 0xB1,
+ FIX_STR_0x12 = 0xB2,
+ FIX_STR_0x13 = 0xB3,
+ FIX_STR_0x14 = 0xB4,
+ FIX_STR_0x15 = 0xB5,
+ FIX_STR_0x16 = 0xB6,
+ FIX_STR_0x17 = 0xB7,
+ FIX_STR_0x18 = 0xB8,
+ FIX_STR_0x19 = 0xB9,
+ FIX_STR_0x1A = 0xBA,
+ FIX_STR_0x1B = 0xBB,
+ FIX_STR_0x1C = 0xBC,
+ FIX_STR_0x1D = 0xBD,
+ FIX_STR_0x1E = 0xBE,
+ FIX_STR_0x1F = 0xBF,
+ #endregion
+
+ NIL = 0xC0,
+ NEVER_USED = 0xC1,
+ FALSE = 0xC2,
+ TRUE = 0xC3,
+
+ BIN8 = 0xC4,
+ BIN16 = 0xC5,
+ BIN32 = 0xC6,
+
+ EXT8 = 0xC7,
+ EXT16 = 0xC8,
+ EXT32 = 0xC9,
+
+ FLOAT = 0xCA,
+ DOUBLE = 0xCB,
+ UINT8 = 0xCC,
+ UINT16 = 0xCD,
+ UINT32 = 0xCE,
+ UINT64 = 0xCF,
+ INT8 = 0xD0,
+ INT16 = 0xD1,
+ INT32 = 0xD2,
+ INT64 = 0xD3,
+
+ FIX_EXT_1 = 0xD4,
+ FIX_EXT_2 = 0xD5,
+ FIX_EXT_4 = 0xD6,
+ FIX_EXT_8 = 0xD7,
+ FIX_EXT_16 = 0xD8,
+
+ STR8 = 0xD9,
+ STR16 = 0xDA,
+ STR32 = 0xDB,
+
+ ARRAY16 = 0xDC,
+ ARRAY32 = 0xDD,
+ MAP16 = 0xDE,
+ MAP32 = 0xDF,
+
+ #region NEGATIVE_FIXNUM 0xE0-0xFF
+ NEGATIVE_FIXNUM = 0xE0, // 1110 0000 = -32
+ NEGATIVE_FIXNUM_0x1F = 0xE1, // -31
+ NEGATIVE_FIXNUM_0x1E = 0xE2,
+ NEGATIVE_FIXNUM_0x1D = 0xE3,
+ NEGATIVE_FIXNUM_0x1C = 0xE4,
+ NEGATIVE_FIXNUM_0x1B = 0xE5,
+ NEGATIVE_FIXNUM_0x1A = 0xE6,
+ NEGATIVE_FIXNUM_0x19 = 0xE7,
+ NEGATIVE_FIXNUM_0x18 = 0xE8,
+ NEGATIVE_FIXNUM_0x17 = 0xE9,
+ NEGATIVE_FIXNUM_0x16 = 0xEA,
+ NEGATIVE_FIXNUM_0x15 = 0xEB,
+ NEGATIVE_FIXNUM_0x14 = 0xEC,
+ NEGATIVE_FIXNUM_0x13 = 0xED,
+ NEGATIVE_FIXNUM_0x12 = 0xEE,
+ NEGATIVE_FIXNUM_0x11 = 0xEF,
+ NEGATIVE_FIXNUM_0x10 = 0xF0,
+ NEGATIVE_FIXNUM_0x0F = 0xF1,
+ NEGATIVE_FIXNUM_0x0E = 0xF2,
+ NEGATIVE_FIXNUM_0x0D = 0xF3,
+ NEGATIVE_FIXNUM_0x0C = 0xF4,
+ NEGATIVE_FIXNUM_0x0B = 0xF5,
+ NEGATIVE_FIXNUM_0x0A = 0xF6,
+ NEGATIVE_FIXNUM_0x09 = 0xF7,
+ NEGATIVE_FIXNUM_0x08 = 0xF8,
+ NEGATIVE_FIXNUM_0x07 = 0xF9,
+ NEGATIVE_FIXNUM_0x06 = 0xFA,
+ NEGATIVE_FIXNUM_0x05 = 0xFB,
+ NEGATIVE_FIXNUM_0x04 = 0xFC,
+ NEGATIVE_FIXNUM_0x03 = 0xFD,
+ NEGATIVE_FIXNUM_0x02 = 0xFE,
+ NEGATIVE_FIXNUM_0x01 = 0xFF, // -1
+ #endregion
+ }
+
+ public enum ExtType : byte
+ {
+ UNKNOWN = 0x00,
+
+ UINT16_BE = 0x01,
+ UINT32_BE = 0x02,
+ UINT64_BE = 0x03,
+ INT16_BE = 0x04,
+ INT32_BE = 0x05,
+ INT64_BE = 0x06,
+ SINGLE_BE = 0x07,
+ DOUBLE_BE = 0x08,
+
+ UINT16_LE = 0x09,
+ UINT32_LE = 0x0A,
+ UINT64_LE = 0x0B,
+ INT16_LE = 0x0C,
+ INT32_LE = 0x0D,
+ INT64_LE = 0x0E,
+ SINGLE_LE = 0x0F,
+ DOUBLE_LE = 0x10,
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs.meta
new file mode 100644
index 00000000..702f717e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackType.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4c6d91a562e590e438f0baa988389d61
+timeCreated: 1540814648
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs
new file mode 100644
index 00000000..a81026a4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs
@@ -0,0 +1,341 @@
+namespace UniJSON
+{
+ public static class MsgPackTypeExtensions
+ {
+ public static bool IsArray(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FIX_ARRAY:
+ case MsgPackType.FIX_ARRAY_0x1:
+ case MsgPackType.FIX_ARRAY_0x2:
+ case MsgPackType.FIX_ARRAY_0x3:
+ case MsgPackType.FIX_ARRAY_0x4:
+ case MsgPackType.FIX_ARRAY_0x5:
+ case MsgPackType.FIX_ARRAY_0x6:
+ case MsgPackType.FIX_ARRAY_0x7:
+ case MsgPackType.FIX_ARRAY_0x8:
+ case MsgPackType.FIX_ARRAY_0x9:
+ case MsgPackType.FIX_ARRAY_0xA:
+ case MsgPackType.FIX_ARRAY_0xB:
+ case MsgPackType.FIX_ARRAY_0xC:
+ case MsgPackType.FIX_ARRAY_0xD:
+ case MsgPackType.FIX_ARRAY_0xE:
+ case MsgPackType.FIX_ARRAY_0xF:
+ case MsgPackType.ARRAY16:
+ case MsgPackType.ARRAY32:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ public static bool IsMap(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FIX_MAP:
+ case MsgPackType.FIX_MAP_0x1:
+ case MsgPackType.FIX_MAP_0x2:
+ case MsgPackType.FIX_MAP_0x3:
+ case MsgPackType.FIX_MAP_0x4:
+ case MsgPackType.FIX_MAP_0x5:
+ case MsgPackType.FIX_MAP_0x6:
+ case MsgPackType.FIX_MAP_0x7:
+ case MsgPackType.FIX_MAP_0x8:
+ case MsgPackType.FIX_MAP_0x9:
+ case MsgPackType.FIX_MAP_0xA:
+ case MsgPackType.FIX_MAP_0xB:
+ case MsgPackType.FIX_MAP_0xC:
+ case MsgPackType.FIX_MAP_0xD:
+ case MsgPackType.FIX_MAP_0xE:
+ case MsgPackType.FIX_MAP_0xF:
+ case MsgPackType.MAP16:
+ case MsgPackType.MAP32:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ public static bool IsInteger(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.POSITIVE_FIXNUM:
+ case MsgPackType.POSITIVE_FIXNUM_0x01:
+ case MsgPackType.POSITIVE_FIXNUM_0x02:
+ case MsgPackType.POSITIVE_FIXNUM_0x03:
+ case MsgPackType.POSITIVE_FIXNUM_0x04:
+ case MsgPackType.POSITIVE_FIXNUM_0x05:
+ case MsgPackType.POSITIVE_FIXNUM_0x06:
+ case MsgPackType.POSITIVE_FIXNUM_0x07:
+ case MsgPackType.POSITIVE_FIXNUM_0x08:
+ case MsgPackType.POSITIVE_FIXNUM_0x09:
+ case MsgPackType.POSITIVE_FIXNUM_0x0A:
+ case MsgPackType.POSITIVE_FIXNUM_0x0B:
+ case MsgPackType.POSITIVE_FIXNUM_0x0C:
+ case MsgPackType.POSITIVE_FIXNUM_0x0D:
+ case MsgPackType.POSITIVE_FIXNUM_0x0E:
+ case MsgPackType.POSITIVE_FIXNUM_0x0F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x10:
+ case MsgPackType.POSITIVE_FIXNUM_0x11:
+ case MsgPackType.POSITIVE_FIXNUM_0x12:
+ case MsgPackType.POSITIVE_FIXNUM_0x13:
+ case MsgPackType.POSITIVE_FIXNUM_0x14:
+ case MsgPackType.POSITIVE_FIXNUM_0x15:
+ case MsgPackType.POSITIVE_FIXNUM_0x16:
+ case MsgPackType.POSITIVE_FIXNUM_0x17:
+ case MsgPackType.POSITIVE_FIXNUM_0x18:
+ case MsgPackType.POSITIVE_FIXNUM_0x19:
+ case MsgPackType.POSITIVE_FIXNUM_0x1A:
+ case MsgPackType.POSITIVE_FIXNUM_0x1B:
+ case MsgPackType.POSITIVE_FIXNUM_0x1C:
+ case MsgPackType.POSITIVE_FIXNUM_0x1D:
+ case MsgPackType.POSITIVE_FIXNUM_0x1E:
+ case MsgPackType.POSITIVE_FIXNUM_0x1F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x20:
+ case MsgPackType.POSITIVE_FIXNUM_0x21:
+ case MsgPackType.POSITIVE_FIXNUM_0x22:
+ case MsgPackType.POSITIVE_FIXNUM_0x23:
+ case MsgPackType.POSITIVE_FIXNUM_0x24:
+ case MsgPackType.POSITIVE_FIXNUM_0x25:
+ case MsgPackType.POSITIVE_FIXNUM_0x26:
+ case MsgPackType.POSITIVE_FIXNUM_0x27:
+ case MsgPackType.POSITIVE_FIXNUM_0x28:
+ case MsgPackType.POSITIVE_FIXNUM_0x29:
+ case MsgPackType.POSITIVE_FIXNUM_0x2A:
+ case MsgPackType.POSITIVE_FIXNUM_0x2B:
+ case MsgPackType.POSITIVE_FIXNUM_0x2C:
+ case MsgPackType.POSITIVE_FIXNUM_0x2D:
+ case MsgPackType.POSITIVE_FIXNUM_0x2E:
+ case MsgPackType.POSITIVE_FIXNUM_0x2F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x30:
+ case MsgPackType.POSITIVE_FIXNUM_0x31:
+ case MsgPackType.POSITIVE_FIXNUM_0x32:
+ case MsgPackType.POSITIVE_FIXNUM_0x33:
+ case MsgPackType.POSITIVE_FIXNUM_0x34:
+ case MsgPackType.POSITIVE_FIXNUM_0x35:
+ case MsgPackType.POSITIVE_FIXNUM_0x36:
+ case MsgPackType.POSITIVE_FIXNUM_0x37:
+ case MsgPackType.POSITIVE_FIXNUM_0x38:
+ case MsgPackType.POSITIVE_FIXNUM_0x39:
+ case MsgPackType.POSITIVE_FIXNUM_0x3A:
+ case MsgPackType.POSITIVE_FIXNUM_0x3B:
+ case MsgPackType.POSITIVE_FIXNUM_0x3C:
+ case MsgPackType.POSITIVE_FIXNUM_0x3D:
+ case MsgPackType.POSITIVE_FIXNUM_0x3E:
+ case MsgPackType.POSITIVE_FIXNUM_0x3F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x40:
+ case MsgPackType.POSITIVE_FIXNUM_0x41:
+ case MsgPackType.POSITIVE_FIXNUM_0x42:
+ case MsgPackType.POSITIVE_FIXNUM_0x43:
+ case MsgPackType.POSITIVE_FIXNUM_0x44:
+ case MsgPackType.POSITIVE_FIXNUM_0x45:
+ case MsgPackType.POSITIVE_FIXNUM_0x46:
+ case MsgPackType.POSITIVE_FIXNUM_0x47:
+ case MsgPackType.POSITIVE_FIXNUM_0x48:
+ case MsgPackType.POSITIVE_FIXNUM_0x49:
+ case MsgPackType.POSITIVE_FIXNUM_0x4A:
+ case MsgPackType.POSITIVE_FIXNUM_0x4B:
+ case MsgPackType.POSITIVE_FIXNUM_0x4C:
+ case MsgPackType.POSITIVE_FIXNUM_0x4D:
+ case MsgPackType.POSITIVE_FIXNUM_0x4E:
+ case MsgPackType.POSITIVE_FIXNUM_0x4F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x50:
+ case MsgPackType.POSITIVE_FIXNUM_0x51:
+ case MsgPackType.POSITIVE_FIXNUM_0x52:
+ case MsgPackType.POSITIVE_FIXNUM_0x53:
+ case MsgPackType.POSITIVE_FIXNUM_0x54:
+ case MsgPackType.POSITIVE_FIXNUM_0x55:
+ case MsgPackType.POSITIVE_FIXNUM_0x56:
+ case MsgPackType.POSITIVE_FIXNUM_0x57:
+ case MsgPackType.POSITIVE_FIXNUM_0x58:
+ case MsgPackType.POSITIVE_FIXNUM_0x59:
+ case MsgPackType.POSITIVE_FIXNUM_0x5A:
+ case MsgPackType.POSITIVE_FIXNUM_0x5B:
+ case MsgPackType.POSITIVE_FIXNUM_0x5C:
+ case MsgPackType.POSITIVE_FIXNUM_0x5D:
+ case MsgPackType.POSITIVE_FIXNUM_0x5E:
+ case MsgPackType.POSITIVE_FIXNUM_0x5F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x60:
+ case MsgPackType.POSITIVE_FIXNUM_0x61:
+ case MsgPackType.POSITIVE_FIXNUM_0x62:
+ case MsgPackType.POSITIVE_FIXNUM_0x63:
+ case MsgPackType.POSITIVE_FIXNUM_0x64:
+ case MsgPackType.POSITIVE_FIXNUM_0x65:
+ case MsgPackType.POSITIVE_FIXNUM_0x66:
+ case MsgPackType.POSITIVE_FIXNUM_0x67:
+ case MsgPackType.POSITIVE_FIXNUM_0x68:
+ case MsgPackType.POSITIVE_FIXNUM_0x69:
+ case MsgPackType.POSITIVE_FIXNUM_0x6A:
+ case MsgPackType.POSITIVE_FIXNUM_0x6B:
+ case MsgPackType.POSITIVE_FIXNUM_0x6C:
+ case MsgPackType.POSITIVE_FIXNUM_0x6D:
+ case MsgPackType.POSITIVE_FIXNUM_0x6E:
+ case MsgPackType.POSITIVE_FIXNUM_0x6F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x70:
+ case MsgPackType.POSITIVE_FIXNUM_0x71:
+ case MsgPackType.POSITIVE_FIXNUM_0x72:
+ case MsgPackType.POSITIVE_FIXNUM_0x73:
+ case MsgPackType.POSITIVE_FIXNUM_0x74:
+ case MsgPackType.POSITIVE_FIXNUM_0x75:
+ case MsgPackType.POSITIVE_FIXNUM_0x76:
+ case MsgPackType.POSITIVE_FIXNUM_0x77:
+ case MsgPackType.POSITIVE_FIXNUM_0x78:
+ case MsgPackType.POSITIVE_FIXNUM_0x79:
+ case MsgPackType.POSITIVE_FIXNUM_0x7A:
+ case MsgPackType.POSITIVE_FIXNUM_0x7B:
+ case MsgPackType.POSITIVE_FIXNUM_0x7C:
+ case MsgPackType.POSITIVE_FIXNUM_0x7D:
+ case MsgPackType.POSITIVE_FIXNUM_0x7E:
+ case MsgPackType.POSITIVE_FIXNUM_0x7F:
+
+ case MsgPackType.NEGATIVE_FIXNUM:
+ case MsgPackType.NEGATIVE_FIXNUM_0x01:
+ case MsgPackType.NEGATIVE_FIXNUM_0x02:
+ case MsgPackType.NEGATIVE_FIXNUM_0x03:
+ case MsgPackType.NEGATIVE_FIXNUM_0x04:
+ case MsgPackType.NEGATIVE_FIXNUM_0x05:
+ case MsgPackType.NEGATIVE_FIXNUM_0x06:
+ case MsgPackType.NEGATIVE_FIXNUM_0x07:
+ case MsgPackType.NEGATIVE_FIXNUM_0x08:
+ case MsgPackType.NEGATIVE_FIXNUM_0x09:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0A:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0B:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0C:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0D:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0E:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0F:
+ case MsgPackType.NEGATIVE_FIXNUM_0x10:
+ case MsgPackType.NEGATIVE_FIXNUM_0x11:
+ case MsgPackType.NEGATIVE_FIXNUM_0x12:
+ case MsgPackType.NEGATIVE_FIXNUM_0x13:
+ case MsgPackType.NEGATIVE_FIXNUM_0x14:
+ case MsgPackType.NEGATIVE_FIXNUM_0x15:
+ case MsgPackType.NEGATIVE_FIXNUM_0x16:
+ case MsgPackType.NEGATIVE_FIXNUM_0x17:
+ case MsgPackType.NEGATIVE_FIXNUM_0x18:
+ case MsgPackType.NEGATIVE_FIXNUM_0x19:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1A:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1B:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1C:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1D:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1E:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1F:
+
+ case MsgPackType.INT8:
+ case MsgPackType.INT16:
+ case MsgPackType.INT32:
+ case MsgPackType.INT64:
+ case MsgPackType.UINT8:
+ case MsgPackType.UINT16:
+ case MsgPackType.UINT32:
+ case MsgPackType.UINT64:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ public static bool IsFloat(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FLOAT:
+ case MsgPackType.DOUBLE:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ public static bool IsString(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FIX_STR:
+ case MsgPackType.FIX_STR_0x01:
+ case MsgPackType.FIX_STR_0x02:
+ case MsgPackType.FIX_STR_0x03:
+ case MsgPackType.FIX_STR_0x04:
+ case MsgPackType.FIX_STR_0x05:
+ case MsgPackType.FIX_STR_0x06:
+ case MsgPackType.FIX_STR_0x07:
+ case MsgPackType.FIX_STR_0x08:
+ case MsgPackType.FIX_STR_0x09:
+ case MsgPackType.FIX_STR_0x0A:
+ case MsgPackType.FIX_STR_0x0B:
+ case MsgPackType.FIX_STR_0x0C:
+ case MsgPackType.FIX_STR_0x0D:
+ case MsgPackType.FIX_STR_0x0E:
+ case MsgPackType.FIX_STR_0x0F:
+ case MsgPackType.FIX_STR_0x10:
+ case MsgPackType.FIX_STR_0x11:
+ case MsgPackType.FIX_STR_0x12:
+ case MsgPackType.FIX_STR_0x13:
+ case MsgPackType.FIX_STR_0x14:
+ case MsgPackType.FIX_STR_0x15:
+ case MsgPackType.FIX_STR_0x16:
+ case MsgPackType.FIX_STR_0x17:
+ case MsgPackType.FIX_STR_0x18:
+ case MsgPackType.FIX_STR_0x19:
+ case MsgPackType.FIX_STR_0x1A:
+ case MsgPackType.FIX_STR_0x1B:
+ case MsgPackType.FIX_STR_0x1C:
+ case MsgPackType.FIX_STR_0x1D:
+ case MsgPackType.FIX_STR_0x1E:
+ case MsgPackType.FIX_STR_0x1F:
+ case MsgPackType.STR8:
+ case MsgPackType.STR16:
+ case MsgPackType.STR32:
+ return true;
+ }
+ return false;
+ }
+
+ public static bool IsExt(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.FIX_EXT_1:
+ case MsgPackType.FIX_EXT_2:
+ case MsgPackType.FIX_EXT_4:
+ case MsgPackType.FIX_EXT_8:
+ case MsgPackType.FIX_EXT_16:
+ case MsgPackType.EXT8:
+ case MsgPackType.EXT16:
+ case MsgPackType.EXT32:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ public static bool IsBinary(this MsgPackType formatType)
+ {
+ switch (formatType)
+ {
+ case MsgPackType.BIN8:
+ case MsgPackType.BIN16:
+ case MsgPackType.BIN32:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs.meta
new file mode 100644
index 00000000..4c4ef420
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackTypeExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6e803181a063cd940b8272f45497b506
+timeCreated: 1540898737
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs
new file mode 100644
index 00000000..77c43f29
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs
@@ -0,0 +1,767 @@
+using System;
+using System.Text;
+
+namespace UniJSON
+{
+ public struct MsgPackValue: IListTreeItem, IValue<MsgPackValue>
+ {
+ public int ParentIndex
+ {
+ get;
+ private set;
+ }
+
+ public ArraySegment<Byte> Bytes
+ {
+ get;
+ private set;
+ }
+ public void SetBytesCount(int count)
+ {
+ Bytes = new ArraySegment<byte>(Bytes.Array, Bytes.Offset, count);
+ }
+
+ public MsgPackType Format
+ {
+ get
+ {
+ return (MsgPackType)Bytes.Get(0);
+ }
+ }
+
+ public ValueNodeType ValueType
+ {
+ get
+ {
+ switch (Format)
+ {
+ case MsgPackType.NIL:
+ return ValueNodeType.Null;
+
+ case MsgPackType.TRUE:
+ case MsgPackType.FALSE:
+ return ValueNodeType.Boolean;
+
+ default:
+ if (Format.IsArray())
+ {
+ return ValueNodeType.Array;
+ }
+ else if (Format.IsMap())
+ {
+ return ValueNodeType.Object;
+ }
+ else if (Format.IsInteger())
+ {
+ return ValueNodeType.Integer;
+ }
+ else if (Format.IsFloat())
+ {
+ return ValueNodeType.Number;
+ }
+ else if (Format.IsString())
+ {
+ return ValueNodeType.String;
+ }
+ else if (Format.IsBinary())
+ {
+ return ValueNodeType.Binary;
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+ }
+
+ int _childCount;
+ public int ChildCount
+ {
+ get { return _childCount; }
+ }
+ public void SetChildCount(int count)
+ {
+ _childCount = count;
+ }
+
+ public MsgPackValue(ArraySegment<Byte> segment, int parentIndex) : this()
+ {
+ Bytes = segment;
+ ParentIndex = parentIndex;
+ }
+
+ public MsgPackValue New(ArraySegment<byte> bytes, ValueNodeType valueType, int parentIndex)
+ {
+ return new MsgPackValue(bytes, parentIndex);
+ }
+
+ public MsgPackValue Key(Utf8String key, int parentIndex)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// ArrayとMap以外のタイプのペイロードを得る
+ /// </summary>
+ /// <returns></returns>
+ public ArraySegment<Byte> GetBody()
+ {
+ var bytes = Bytes;
+ var formatType = Format;
+ switch (formatType)
+ {
+ case MsgPackType.FIX_STR: return bytes.Advance(1).Take(0);
+ case MsgPackType.FIX_STR_0x01: return bytes.Advance(1).Take(1);
+ case MsgPackType.FIX_STR_0x02: return bytes.Advance(1).Take(2);
+ case MsgPackType.FIX_STR_0x03: return bytes.Advance(1).Take(3);
+ case MsgPackType.FIX_STR_0x04: return bytes.Advance(1).Take(4);
+ case MsgPackType.FIX_STR_0x05: return bytes.Advance(1).Take(5);
+ case MsgPackType.FIX_STR_0x06: return bytes.Advance(1).Take(6);
+ case MsgPackType.FIX_STR_0x07: return bytes.Advance(1).Take(7);
+ case MsgPackType.FIX_STR_0x08: return bytes.Advance(1).Take(8);
+ case MsgPackType.FIX_STR_0x09: return bytes.Advance(1).Take(9);
+ case MsgPackType.FIX_STR_0x0A: return bytes.Advance(1).Take(10);
+ case MsgPackType.FIX_STR_0x0B: return bytes.Advance(1).Take(11);
+ case MsgPackType.FIX_STR_0x0C: return bytes.Advance(1).Take(12);
+ case MsgPackType.FIX_STR_0x0D: return bytes.Advance(1).Take(13);
+ case MsgPackType.FIX_STR_0x0E: return bytes.Advance(1).Take(14);
+ case MsgPackType.FIX_STR_0x0F: return bytes.Advance(1).Take(15);
+
+ case MsgPackType.FIX_STR_0x10: return bytes.Advance(1).Take(16);
+ case MsgPackType.FIX_STR_0x11: return bytes.Advance(1).Take(17);
+ case MsgPackType.FIX_STR_0x12: return bytes.Advance(1).Take(18);
+ case MsgPackType.FIX_STR_0x13: return bytes.Advance(1).Take(19);
+ case MsgPackType.FIX_STR_0x14: return bytes.Advance(1).Take(20);
+ case MsgPackType.FIX_STR_0x15: return bytes.Advance(1).Take(21);
+ case MsgPackType.FIX_STR_0x16: return bytes.Advance(1).Take(22);
+ case MsgPackType.FIX_STR_0x17: return bytes.Advance(1).Take(23);
+ case MsgPackType.FIX_STR_0x18: return bytes.Advance(1).Take(24);
+ case MsgPackType.FIX_STR_0x19: return bytes.Advance(1).Take(25);
+ case MsgPackType.FIX_STR_0x1A: return bytes.Advance(1).Take(26);
+ case MsgPackType.FIX_STR_0x1B: return bytes.Advance(1).Take(27);
+ case MsgPackType.FIX_STR_0x1C: return bytes.Advance(1).Take(28);
+ case MsgPackType.FIX_STR_0x1D: return bytes.Advance(1).Take(29);
+ case MsgPackType.FIX_STR_0x1E: return bytes.Advance(1).Take(30);
+ case MsgPackType.FIX_STR_0x1F: return bytes.Advance(1).Take(31);
+
+ case MsgPackType.STR8:
+ case MsgPackType.BIN8:
+ {
+ var count = bytes.Get(1);
+ return bytes.Advance(1 + 1).Take(count);
+ }
+
+ case MsgPackType.STR16:
+ case MsgPackType.BIN16:
+ {
+ var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 2).Take(count);
+ }
+
+ case MsgPackType.STR32:
+ case MsgPackType.BIN32:
+ {
+ var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 4).Take((int)count);
+ }
+
+ case MsgPackType.NIL:
+ case MsgPackType.TRUE:
+ case MsgPackType.FALSE:
+ case MsgPackType.POSITIVE_FIXNUM:
+ case MsgPackType.POSITIVE_FIXNUM_0x01:
+ case MsgPackType.POSITIVE_FIXNUM_0x02:
+ case MsgPackType.POSITIVE_FIXNUM_0x03:
+ case MsgPackType.POSITIVE_FIXNUM_0x04:
+ case MsgPackType.POSITIVE_FIXNUM_0x05:
+ case MsgPackType.POSITIVE_FIXNUM_0x06:
+ case MsgPackType.POSITIVE_FIXNUM_0x07:
+ case MsgPackType.POSITIVE_FIXNUM_0x08:
+ case MsgPackType.POSITIVE_FIXNUM_0x09:
+ case MsgPackType.POSITIVE_FIXNUM_0x0A:
+ case MsgPackType.POSITIVE_FIXNUM_0x0B:
+ case MsgPackType.POSITIVE_FIXNUM_0x0C:
+ case MsgPackType.POSITIVE_FIXNUM_0x0D:
+ case MsgPackType.POSITIVE_FIXNUM_0x0E:
+ case MsgPackType.POSITIVE_FIXNUM_0x0F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x10:
+ case MsgPackType.POSITIVE_FIXNUM_0x11:
+ case MsgPackType.POSITIVE_FIXNUM_0x12:
+ case MsgPackType.POSITIVE_FIXNUM_0x13:
+ case MsgPackType.POSITIVE_FIXNUM_0x14:
+ case MsgPackType.POSITIVE_FIXNUM_0x15:
+ case MsgPackType.POSITIVE_FIXNUM_0x16:
+ case MsgPackType.POSITIVE_FIXNUM_0x17:
+ case MsgPackType.POSITIVE_FIXNUM_0x18:
+ case MsgPackType.POSITIVE_FIXNUM_0x19:
+ case MsgPackType.POSITIVE_FIXNUM_0x1A:
+ case MsgPackType.POSITIVE_FIXNUM_0x1B:
+ case MsgPackType.POSITIVE_FIXNUM_0x1C:
+ case MsgPackType.POSITIVE_FIXNUM_0x1D:
+ case MsgPackType.POSITIVE_FIXNUM_0x1E:
+ case MsgPackType.POSITIVE_FIXNUM_0x1F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x20:
+ case MsgPackType.POSITIVE_FIXNUM_0x21:
+ case MsgPackType.POSITIVE_FIXNUM_0x22:
+ case MsgPackType.POSITIVE_FIXNUM_0x23:
+ case MsgPackType.POSITIVE_FIXNUM_0x24:
+ case MsgPackType.POSITIVE_FIXNUM_0x25:
+ case MsgPackType.POSITIVE_FIXNUM_0x26:
+ case MsgPackType.POSITIVE_FIXNUM_0x27:
+ case MsgPackType.POSITIVE_FIXNUM_0x28:
+ case MsgPackType.POSITIVE_FIXNUM_0x29:
+ case MsgPackType.POSITIVE_FIXNUM_0x2A:
+ case MsgPackType.POSITIVE_FIXNUM_0x2B:
+ case MsgPackType.POSITIVE_FIXNUM_0x2C:
+ case MsgPackType.POSITIVE_FIXNUM_0x2D:
+ case MsgPackType.POSITIVE_FIXNUM_0x2E:
+ case MsgPackType.POSITIVE_FIXNUM_0x2F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x30:
+ case MsgPackType.POSITIVE_FIXNUM_0x31:
+ case MsgPackType.POSITIVE_FIXNUM_0x32:
+ case MsgPackType.POSITIVE_FIXNUM_0x33:
+ case MsgPackType.POSITIVE_FIXNUM_0x34:
+ case MsgPackType.POSITIVE_FIXNUM_0x35:
+ case MsgPackType.POSITIVE_FIXNUM_0x36:
+ case MsgPackType.POSITIVE_FIXNUM_0x37:
+ case MsgPackType.POSITIVE_FIXNUM_0x38:
+ case MsgPackType.POSITIVE_FIXNUM_0x39:
+ case MsgPackType.POSITIVE_FIXNUM_0x3A:
+ case MsgPackType.POSITIVE_FIXNUM_0x3B:
+ case MsgPackType.POSITIVE_FIXNUM_0x3C:
+ case MsgPackType.POSITIVE_FIXNUM_0x3D:
+ case MsgPackType.POSITIVE_FIXNUM_0x3E:
+ case MsgPackType.POSITIVE_FIXNUM_0x3F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x40:
+ case MsgPackType.POSITIVE_FIXNUM_0x41:
+ case MsgPackType.POSITIVE_FIXNUM_0x42:
+ case MsgPackType.POSITIVE_FIXNUM_0x43:
+ case MsgPackType.POSITIVE_FIXNUM_0x44:
+ case MsgPackType.POSITIVE_FIXNUM_0x45:
+ case MsgPackType.POSITIVE_FIXNUM_0x46:
+ case MsgPackType.POSITIVE_FIXNUM_0x47:
+ case MsgPackType.POSITIVE_FIXNUM_0x48:
+ case MsgPackType.POSITIVE_FIXNUM_0x49:
+ case MsgPackType.POSITIVE_FIXNUM_0x4A:
+ case MsgPackType.POSITIVE_FIXNUM_0x4B:
+ case MsgPackType.POSITIVE_FIXNUM_0x4C:
+ case MsgPackType.POSITIVE_FIXNUM_0x4D:
+ case MsgPackType.POSITIVE_FIXNUM_0x4E:
+ case MsgPackType.POSITIVE_FIXNUM_0x4F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x50:
+ case MsgPackType.POSITIVE_FIXNUM_0x51:
+ case MsgPackType.POSITIVE_FIXNUM_0x52:
+ case MsgPackType.POSITIVE_FIXNUM_0x53:
+ case MsgPackType.POSITIVE_FIXNUM_0x54:
+ case MsgPackType.POSITIVE_FIXNUM_0x55:
+ case MsgPackType.POSITIVE_FIXNUM_0x56:
+ case MsgPackType.POSITIVE_FIXNUM_0x57:
+ case MsgPackType.POSITIVE_FIXNUM_0x58:
+ case MsgPackType.POSITIVE_FIXNUM_0x59:
+ case MsgPackType.POSITIVE_FIXNUM_0x5A:
+ case MsgPackType.POSITIVE_FIXNUM_0x5B:
+ case MsgPackType.POSITIVE_FIXNUM_0x5C:
+ case MsgPackType.POSITIVE_FIXNUM_0x5D:
+ case MsgPackType.POSITIVE_FIXNUM_0x5E:
+ case MsgPackType.POSITIVE_FIXNUM_0x5F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x60:
+ case MsgPackType.POSITIVE_FIXNUM_0x61:
+ case MsgPackType.POSITIVE_FIXNUM_0x62:
+ case MsgPackType.POSITIVE_FIXNUM_0x63:
+ case MsgPackType.POSITIVE_FIXNUM_0x64:
+ case MsgPackType.POSITIVE_FIXNUM_0x65:
+ case MsgPackType.POSITIVE_FIXNUM_0x66:
+ case MsgPackType.POSITIVE_FIXNUM_0x67:
+ case MsgPackType.POSITIVE_FIXNUM_0x68:
+ case MsgPackType.POSITIVE_FIXNUM_0x69:
+ case MsgPackType.POSITIVE_FIXNUM_0x6A:
+ case MsgPackType.POSITIVE_FIXNUM_0x6B:
+ case MsgPackType.POSITIVE_FIXNUM_0x6C:
+ case MsgPackType.POSITIVE_FIXNUM_0x6D:
+ case MsgPackType.POSITIVE_FIXNUM_0x6E:
+ case MsgPackType.POSITIVE_FIXNUM_0x6F:
+
+ case MsgPackType.POSITIVE_FIXNUM_0x70:
+ case MsgPackType.POSITIVE_FIXNUM_0x71:
+ case MsgPackType.POSITIVE_FIXNUM_0x72:
+ case MsgPackType.POSITIVE_FIXNUM_0x73:
+ case MsgPackType.POSITIVE_FIXNUM_0x74:
+ case MsgPackType.POSITIVE_FIXNUM_0x75:
+ case MsgPackType.POSITIVE_FIXNUM_0x76:
+ case MsgPackType.POSITIVE_FIXNUM_0x77:
+ case MsgPackType.POSITIVE_FIXNUM_0x78:
+ case MsgPackType.POSITIVE_FIXNUM_0x79:
+ case MsgPackType.POSITIVE_FIXNUM_0x7A:
+ case MsgPackType.POSITIVE_FIXNUM_0x7B:
+ case MsgPackType.POSITIVE_FIXNUM_0x7C:
+ case MsgPackType.POSITIVE_FIXNUM_0x7D:
+ case MsgPackType.POSITIVE_FIXNUM_0x7E:
+ case MsgPackType.POSITIVE_FIXNUM_0x7F:
+
+ case MsgPackType.NEGATIVE_FIXNUM:
+ case MsgPackType.NEGATIVE_FIXNUM_0x01:
+ case MsgPackType.NEGATIVE_FIXNUM_0x02:
+ case MsgPackType.NEGATIVE_FIXNUM_0x03:
+ case MsgPackType.NEGATIVE_FIXNUM_0x04:
+ case MsgPackType.NEGATIVE_FIXNUM_0x05:
+ case MsgPackType.NEGATIVE_FIXNUM_0x06:
+ case MsgPackType.NEGATIVE_FIXNUM_0x07:
+ case MsgPackType.NEGATIVE_FIXNUM_0x08:
+ case MsgPackType.NEGATIVE_FIXNUM_0x09:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0A:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0B:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0C:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0D:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0E:
+ case MsgPackType.NEGATIVE_FIXNUM_0x0F:
+ case MsgPackType.NEGATIVE_FIXNUM_0x10:
+ case MsgPackType.NEGATIVE_FIXNUM_0x11:
+ case MsgPackType.NEGATIVE_FIXNUM_0x12:
+ case MsgPackType.NEGATIVE_FIXNUM_0x13:
+ case MsgPackType.NEGATIVE_FIXNUM_0x14:
+ case MsgPackType.NEGATIVE_FIXNUM_0x15:
+ case MsgPackType.NEGATIVE_FIXNUM_0x16:
+ case MsgPackType.NEGATIVE_FIXNUM_0x17:
+ case MsgPackType.NEGATIVE_FIXNUM_0x18:
+ case MsgPackType.NEGATIVE_FIXNUM_0x19:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1A:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1B:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1C:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1D:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1E:
+ case MsgPackType.NEGATIVE_FIXNUM_0x1F:
+ return bytes.Advance(1).Take(0);
+
+ case MsgPackType.UINT8:
+ case MsgPackType.INT8:
+ return bytes.Advance(1).Take(1);
+
+ case MsgPackType.UINT16:
+ case MsgPackType.INT16:
+ return bytes.Advance(1).Take(2);
+
+ case MsgPackType.UINT32:
+ case MsgPackType.INT32:
+ case MsgPackType.FLOAT:
+ return bytes.Advance(1).Take(4);
+
+ case MsgPackType.UINT64:
+ case MsgPackType.INT64:
+ case MsgPackType.DOUBLE:
+ return bytes.Advance(1).Take(8);
+
+ case MsgPackType.FIX_EXT_1:
+ return bytes.Advance(2).Take(1);
+ case MsgPackType.FIX_EXT_2:
+ return bytes.Advance(2).Take(2);
+ case MsgPackType.FIX_EXT_4:
+ return bytes.Advance(2).Take(4);
+ case MsgPackType.FIX_EXT_8:
+ return bytes.Advance(2).Take(8);
+ case MsgPackType.FIX_EXT_16:
+ return bytes.Advance(2).Take(16);
+ case MsgPackType.EXT8:
+ {
+ var count = bytes.Get(1);
+ return bytes.Advance(1 + 1 + 1).Take(count);
+ }
+ case MsgPackType.EXT16:
+ {
+ var count = EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 2 + 1).Take(count);
+ }
+ case MsgPackType.EXT32:
+ {
+ var count = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(bytes.Advance(1));
+ return bytes.Advance(1 + 4 + 1).Take((int)count);
+ }
+ default:
+ throw new ArgumentException("unknown type: " + formatType);
+ }
+ }
+
+ public SByte GetExtType()
+ {
+ var formatType = Format;
+ switch (formatType)
+ {
+ case MsgPackType.FIX_EXT_4:
+ return (SByte)Bytes.Get(1);
+ }
+
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// ArrayとMap以外のタイプの値を得る
+ /// </summary>
+ /// <returns></returns>
+ public T GetValue<T>()
+ {
+ var formatType = Format;
+ switch (formatType)
+ {
+ case MsgPackType.NIL: return GenericCast<object, T>.Null();
+ case MsgPackType.TRUE: return GenericCast<bool, T>.Const(true)();
+ case MsgPackType.FALSE: return GenericCast<bool, T>.Const(false)();
+ case MsgPackType.POSITIVE_FIXNUM: return GenericCast<int, T>.Const(0)();
+ case MsgPackType.POSITIVE_FIXNUM_0x01: return GenericCast<int, T>.Const(1)();
+ case MsgPackType.POSITIVE_FIXNUM_0x02: return GenericCast<int, T>.Const(2)();
+ case MsgPackType.POSITIVE_FIXNUM_0x03: return GenericCast<int, T>.Const(3)();
+ case MsgPackType.POSITIVE_FIXNUM_0x04: return GenericCast<int, T>.Const(4)();
+ case MsgPackType.POSITIVE_FIXNUM_0x05: return GenericCast<int, T>.Const(5)();
+ case MsgPackType.POSITIVE_FIXNUM_0x06: return GenericCast<int, T>.Const(6)();
+ case MsgPackType.POSITIVE_FIXNUM_0x07: return GenericCast<int, T>.Const(7)();
+ case MsgPackType.POSITIVE_FIXNUM_0x08: return GenericCast<int, T>.Const(8)();
+ case MsgPackType.POSITIVE_FIXNUM_0x09: return GenericCast<int, T>.Const(9)();
+ case MsgPackType.POSITIVE_FIXNUM_0x0A: return GenericCast<int, T>.Const(10)();
+ case MsgPackType.POSITIVE_FIXNUM_0x0B: return GenericCast<int, T>.Const(11)();
+ case MsgPackType.POSITIVE_FIXNUM_0x0C: return GenericCast<int, T>.Const(12)();
+ case MsgPackType.POSITIVE_FIXNUM_0x0D: return GenericCast<int, T>.Const(13)();
+ case MsgPackType.POSITIVE_FIXNUM_0x0E: return GenericCast<int, T>.Const(14)();
+ case MsgPackType.POSITIVE_FIXNUM_0x0F: return GenericCast<int, T>.Const(15)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x10: return GenericCast<int, T>.Const(16)();
+ case MsgPackType.POSITIVE_FIXNUM_0x11: return GenericCast<int, T>.Const(17)();
+ case MsgPackType.POSITIVE_FIXNUM_0x12: return GenericCast<int, T>.Const(18)();
+ case MsgPackType.POSITIVE_FIXNUM_0x13: return GenericCast<int, T>.Const(19)();
+ case MsgPackType.POSITIVE_FIXNUM_0x14: return GenericCast<int, T>.Const(20)();
+ case MsgPackType.POSITIVE_FIXNUM_0x15: return GenericCast<int, T>.Const(21)();
+ case MsgPackType.POSITIVE_FIXNUM_0x16: return GenericCast<int, T>.Const(22)();
+ case MsgPackType.POSITIVE_FIXNUM_0x17: return GenericCast<int, T>.Const(23)();
+ case MsgPackType.POSITIVE_FIXNUM_0x18: return GenericCast<int, T>.Const(24)();
+ case MsgPackType.POSITIVE_FIXNUM_0x19: return GenericCast<int, T>.Const(25)();
+ case MsgPackType.POSITIVE_FIXNUM_0x1A: return GenericCast<int, T>.Const(26)();
+ case MsgPackType.POSITIVE_FIXNUM_0x1B: return GenericCast<int, T>.Const(27)();
+ case MsgPackType.POSITIVE_FIXNUM_0x1C: return GenericCast<int, T>.Const(28)();
+ case MsgPackType.POSITIVE_FIXNUM_0x1D: return GenericCast<int, T>.Const(29)();
+ case MsgPackType.POSITIVE_FIXNUM_0x1E: return GenericCast<int, T>.Const(30)();
+ case MsgPackType.POSITIVE_FIXNUM_0x1F: return GenericCast<int, T>.Const(31)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x20: return GenericCast<int, T>.Const(32)();
+ case MsgPackType.POSITIVE_FIXNUM_0x21: return GenericCast<int, T>.Const(33)();
+ case MsgPackType.POSITIVE_FIXNUM_0x22: return GenericCast<int, T>.Const(34)();
+ case MsgPackType.POSITIVE_FIXNUM_0x23: return GenericCast<int, T>.Const(35)();
+ case MsgPackType.POSITIVE_FIXNUM_0x24: return GenericCast<int, T>.Const(36)();
+ case MsgPackType.POSITIVE_FIXNUM_0x25: return GenericCast<int, T>.Const(37)();
+ case MsgPackType.POSITIVE_FIXNUM_0x26: return GenericCast<int, T>.Const(38)();
+ case MsgPackType.POSITIVE_FIXNUM_0x27: return GenericCast<int, T>.Const(39)();
+ case MsgPackType.POSITIVE_FIXNUM_0x28: return GenericCast<int, T>.Const(40)();
+ case MsgPackType.POSITIVE_FIXNUM_0x29: return GenericCast<int, T>.Const(41)();
+ case MsgPackType.POSITIVE_FIXNUM_0x2A: return GenericCast<int, T>.Const(42)();
+ case MsgPackType.POSITIVE_FIXNUM_0x2B: return GenericCast<int, T>.Const(43)();
+ case MsgPackType.POSITIVE_FIXNUM_0x2C: return GenericCast<int, T>.Const(44)();
+ case MsgPackType.POSITIVE_FIXNUM_0x2D: return GenericCast<int, T>.Const(45)();
+ case MsgPackType.POSITIVE_FIXNUM_0x2E: return GenericCast<int, T>.Const(46)();
+ case MsgPackType.POSITIVE_FIXNUM_0x2F: return GenericCast<int, T>.Const(47)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x30: return GenericCast<int, T>.Const(48)();
+ case MsgPackType.POSITIVE_FIXNUM_0x31: return GenericCast<int, T>.Const(49)();
+ case MsgPackType.POSITIVE_FIXNUM_0x32: return GenericCast<int, T>.Const(50)();
+ case MsgPackType.POSITIVE_FIXNUM_0x33: return GenericCast<int, T>.Const(51)();
+ case MsgPackType.POSITIVE_FIXNUM_0x34: return GenericCast<int, T>.Const(52)();
+ case MsgPackType.POSITIVE_FIXNUM_0x35: return GenericCast<int, T>.Const(53)();
+ case MsgPackType.POSITIVE_FIXNUM_0x36: return GenericCast<int, T>.Const(54)();
+ case MsgPackType.POSITIVE_FIXNUM_0x37: return GenericCast<int, T>.Const(55)();
+ case MsgPackType.POSITIVE_FIXNUM_0x38: return GenericCast<int, T>.Const(56)();
+ case MsgPackType.POSITIVE_FIXNUM_0x39: return GenericCast<int, T>.Const(57)();
+ case MsgPackType.POSITIVE_FIXNUM_0x3A: return GenericCast<int, T>.Const(58)();
+ case MsgPackType.POSITIVE_FIXNUM_0x3B: return GenericCast<int, T>.Const(59)();
+ case MsgPackType.POSITIVE_FIXNUM_0x3C: return GenericCast<int, T>.Const(60)();
+ case MsgPackType.POSITIVE_FIXNUM_0x3D: return GenericCast<int, T>.Const(61)();
+ case MsgPackType.POSITIVE_FIXNUM_0x3E: return GenericCast<int, T>.Const(62)();
+ case MsgPackType.POSITIVE_FIXNUM_0x3F: return GenericCast<int, T>.Const(63)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x40: return GenericCast<int, T>.Const(64)();
+ case MsgPackType.POSITIVE_FIXNUM_0x41: return GenericCast<int, T>.Const(65)();
+ case MsgPackType.POSITIVE_FIXNUM_0x42: return GenericCast<int, T>.Const(66)();
+ case MsgPackType.POSITIVE_FIXNUM_0x43: return GenericCast<int, T>.Const(67)();
+ case MsgPackType.POSITIVE_FIXNUM_0x44: return GenericCast<int, T>.Const(68)();
+ case MsgPackType.POSITIVE_FIXNUM_0x45: return GenericCast<int, T>.Const(69)();
+ case MsgPackType.POSITIVE_FIXNUM_0x46: return GenericCast<int, T>.Const(70)();
+ case MsgPackType.POSITIVE_FIXNUM_0x47: return GenericCast<int, T>.Const(71)();
+ case MsgPackType.POSITIVE_FIXNUM_0x48: return GenericCast<int, T>.Const(72)();
+ case MsgPackType.POSITIVE_FIXNUM_0x49: return GenericCast<int, T>.Const(73)();
+ case MsgPackType.POSITIVE_FIXNUM_0x4A: return GenericCast<int, T>.Const(74)();
+ case MsgPackType.POSITIVE_FIXNUM_0x4B: return GenericCast<int, T>.Const(75)();
+ case MsgPackType.POSITIVE_FIXNUM_0x4C: return GenericCast<int, T>.Const(76)();
+ case MsgPackType.POSITIVE_FIXNUM_0x4D: return GenericCast<int, T>.Const(77)();
+ case MsgPackType.POSITIVE_FIXNUM_0x4E: return GenericCast<int, T>.Const(78)();
+ case MsgPackType.POSITIVE_FIXNUM_0x4F: return GenericCast<int, T>.Const(79)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x50: return GenericCast<int, T>.Const(80)();
+ case MsgPackType.POSITIVE_FIXNUM_0x51: return GenericCast<int, T>.Const(81)();
+ case MsgPackType.POSITIVE_FIXNUM_0x52: return GenericCast<int, T>.Const(82)();
+ case MsgPackType.POSITIVE_FIXNUM_0x53: return GenericCast<int, T>.Const(83)();
+ case MsgPackType.POSITIVE_FIXNUM_0x54: return GenericCast<int, T>.Const(84)();
+ case MsgPackType.POSITIVE_FIXNUM_0x55: return GenericCast<int, T>.Const(85)();
+ case MsgPackType.POSITIVE_FIXNUM_0x56: return GenericCast<int, T>.Const(86)();
+ case MsgPackType.POSITIVE_FIXNUM_0x57: return GenericCast<int, T>.Const(87)();
+ case MsgPackType.POSITIVE_FIXNUM_0x58: return GenericCast<int, T>.Const(88)();
+ case MsgPackType.POSITIVE_FIXNUM_0x59: return GenericCast<int, T>.Const(89)();
+ case MsgPackType.POSITIVE_FIXNUM_0x5A: return GenericCast<int, T>.Const(90)();
+ case MsgPackType.POSITIVE_FIXNUM_0x5B: return GenericCast<int, T>.Const(91)();
+ case MsgPackType.POSITIVE_FIXNUM_0x5C: return GenericCast<int, T>.Const(92)();
+ case MsgPackType.POSITIVE_FIXNUM_0x5D: return GenericCast<int, T>.Const(93)();
+ case MsgPackType.POSITIVE_FIXNUM_0x5E: return GenericCast<int, T>.Const(94)();
+ case MsgPackType.POSITIVE_FIXNUM_0x5F: return GenericCast<int, T>.Const(95)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x60: return GenericCast<int, T>.Const(96)();
+ case MsgPackType.POSITIVE_FIXNUM_0x61: return GenericCast<int, T>.Const(97)();
+ case MsgPackType.POSITIVE_FIXNUM_0x62: return GenericCast<int, T>.Const(98)();
+ case MsgPackType.POSITIVE_FIXNUM_0x63: return GenericCast<int, T>.Const(99)();
+ case MsgPackType.POSITIVE_FIXNUM_0x64: return GenericCast<int, T>.Const(100)();
+ case MsgPackType.POSITIVE_FIXNUM_0x65: return GenericCast<int, T>.Const(101)();
+ case MsgPackType.POSITIVE_FIXNUM_0x66: return GenericCast<int, T>.Const(102)();
+ case MsgPackType.POSITIVE_FIXNUM_0x67: return GenericCast<int, T>.Const(103)();
+ case MsgPackType.POSITIVE_FIXNUM_0x68: return GenericCast<int, T>.Const(104)();
+ case MsgPackType.POSITIVE_FIXNUM_0x69: return GenericCast<int, T>.Const(105)();
+ case MsgPackType.POSITIVE_FIXNUM_0x6A: return GenericCast<int, T>.Const(106)();
+ case MsgPackType.POSITIVE_FIXNUM_0x6B: return GenericCast<int, T>.Const(107)();
+ case MsgPackType.POSITIVE_FIXNUM_0x6C: return GenericCast<int, T>.Const(108)();
+ case MsgPackType.POSITIVE_FIXNUM_0x6D: return GenericCast<int, T>.Const(109)();
+ case MsgPackType.POSITIVE_FIXNUM_0x6E: return GenericCast<int, T>.Const(110)();
+ case MsgPackType.POSITIVE_FIXNUM_0x6F: return GenericCast<int, T>.Const(111)();
+
+ case MsgPackType.POSITIVE_FIXNUM_0x70: return GenericCast<int, T>.Const(112)();
+ case MsgPackType.POSITIVE_FIXNUM_0x71: return GenericCast<int, T>.Const(113)();
+ case MsgPackType.POSITIVE_FIXNUM_0x72: return GenericCast<int, T>.Const(114)();
+ case MsgPackType.POSITIVE_FIXNUM_0x73: return GenericCast<int, T>.Const(115)();
+ case MsgPackType.POSITIVE_FIXNUM_0x74: return GenericCast<int, T>.Const(116)();
+ case MsgPackType.POSITIVE_FIXNUM_0x75: return GenericCast<int, T>.Const(117)();
+ case MsgPackType.POSITIVE_FIXNUM_0x76: return GenericCast<int, T>.Const(118)();
+ case MsgPackType.POSITIVE_FIXNUM_0x77: return GenericCast<int, T>.Const(119)();
+ case MsgPackType.POSITIVE_FIXNUM_0x78: return GenericCast<int, T>.Const(120)();
+ case MsgPackType.POSITIVE_FIXNUM_0x79: return GenericCast<int, T>.Const(121)();
+ case MsgPackType.POSITIVE_FIXNUM_0x7A: return GenericCast<int, T>.Const(122)();
+ case MsgPackType.POSITIVE_FIXNUM_0x7B: return GenericCast<int, T>.Const(123)();
+ case MsgPackType.POSITIVE_FIXNUM_0x7C: return GenericCast<int, T>.Const(124)();
+ case MsgPackType.POSITIVE_FIXNUM_0x7D: return GenericCast<int, T>.Const(125)();
+ case MsgPackType.POSITIVE_FIXNUM_0x7E: return GenericCast<int, T>.Const(126)();
+ case MsgPackType.POSITIVE_FIXNUM_0x7F: return GenericCast<int, T>.Const(127)();
+
+ case MsgPackType.NEGATIVE_FIXNUM: return GenericCast<int, T>.Const(-32)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x01: return GenericCast<int, T>.Const(-1)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x02: return GenericCast<int, T>.Const(-2)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x03: return GenericCast<int, T>.Const(-3)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x04: return GenericCast<int, T>.Const(-4)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x05: return GenericCast<int, T>.Const(-5)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x06: return GenericCast<int, T>.Const(-6)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x07: return GenericCast<int, T>.Const(-7)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x08: return GenericCast<int, T>.Const(-8)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x09: return GenericCast<int, T>.Const(-9)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x0A: return GenericCast<int, T>.Const(-10)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x0B: return GenericCast<int, T>.Const(-11)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x0C: return GenericCast<int, T>.Const(-12)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x0D: return GenericCast<int, T>.Const(-13)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x0E: return GenericCast<int, T>.Const(-14)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x0F: return GenericCast<int, T>.Const(-15)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x10: return GenericCast<int, T>.Const(-16)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x11: return GenericCast<int, T>.Const(-17)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x12: return GenericCast<int, T>.Const(-18)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x13: return GenericCast<int, T>.Const(-19)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x14: return GenericCast<int, T>.Const(-20)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x15: return GenericCast<int, T>.Const(-21)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x16: return GenericCast<int, T>.Const(-22)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x17: return GenericCast<int, T>.Const(-23)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x18: return GenericCast<int, T>.Const(-24)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x19: return GenericCast<int, T>.Const(-25)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x1A: return GenericCast<int, T>.Const(-26)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x1B: return GenericCast<int, T>.Const(-27)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x1C: return GenericCast<int, T>.Const(-28)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x1D: return GenericCast<int, T>.Const(-29)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x1E: return GenericCast<int, T>.Const(-30)();
+ case MsgPackType.NEGATIVE_FIXNUM_0x1F: return GenericCast<int, T>.Const(-31)();
+
+ case MsgPackType.INT8: return GenericCast<SByte, T>.Cast((SByte)GetBody().Get(0));
+ case MsgPackType.INT16: return GenericCast<short, T>.Cast(EndianConverter.NetworkByteWordToSignedNativeByteOrder(GetBody()));
+ case MsgPackType.INT32: return GenericCast<int, T>.Cast(EndianConverter.NetworkByteDWordToSignedNativeByteOrder(GetBody()));
+ case MsgPackType.INT64: return GenericCast<long, T>.Cast(EndianConverter.NetworkByteQWordToSignedNativeByteOrder(GetBody()));
+ case MsgPackType.UINT8: return GenericCast<Byte, T>.Cast(GetBody().Get(0));
+ case MsgPackType.UINT16: return GenericCast<ushort, T>.Cast(EndianConverter.NetworkByteWordToUnsignedNativeByteOrder(GetBody()));
+ case MsgPackType.UINT32: return GenericCast<uint, T>.Cast(EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(GetBody()));
+ case MsgPackType.UINT64: return GenericCast<ulong, T>.Cast(EndianConverter.NetworkByteQWordToUnsignedNativeByteOrder(GetBody()));
+ case MsgPackType.FLOAT: return GenericCast<float, T>.Cast(EndianConverter.NetworkByteDWordToFloatNativeByteOrder(GetBody()));
+ case MsgPackType.DOUBLE: return GenericCast<double, T>.Cast(EndianConverter.NetworkByteQWordToFloatNativeByteOrder(GetBody()));
+
+ case MsgPackType.FIX_STR: return GenericCast<string, T>.Const("")();
+ case MsgPackType.FIX_STR_0x01:
+ case MsgPackType.FIX_STR_0x02:
+ case MsgPackType.FIX_STR_0x03:
+ case MsgPackType.FIX_STR_0x04:
+ case MsgPackType.FIX_STR_0x05:
+ case MsgPackType.FIX_STR_0x06:
+ case MsgPackType.FIX_STR_0x07:
+ case MsgPackType.FIX_STR_0x08:
+ case MsgPackType.FIX_STR_0x09:
+ case MsgPackType.FIX_STR_0x0A:
+ case MsgPackType.FIX_STR_0x0B:
+ case MsgPackType.FIX_STR_0x0C:
+ case MsgPackType.FIX_STR_0x0D:
+ case MsgPackType.FIX_STR_0x0E:
+ case MsgPackType.FIX_STR_0x0F:
+ case MsgPackType.FIX_STR_0x10:
+ case MsgPackType.FIX_STR_0x11:
+ case MsgPackType.FIX_STR_0x12:
+ case MsgPackType.FIX_STR_0x13:
+ case MsgPackType.FIX_STR_0x14:
+ case MsgPackType.FIX_STR_0x15:
+ case MsgPackType.FIX_STR_0x16:
+ case MsgPackType.FIX_STR_0x17:
+ case MsgPackType.FIX_STR_0x18:
+ case MsgPackType.FIX_STR_0x19:
+ case MsgPackType.FIX_STR_0x1A:
+ case MsgPackType.FIX_STR_0x1B:
+ case MsgPackType.FIX_STR_0x1C:
+ case MsgPackType.FIX_STR_0x1D:
+ case MsgPackType.FIX_STR_0x1E:
+ case MsgPackType.FIX_STR_0x1F:
+ case MsgPackType.STR8:
+ case MsgPackType.STR16:
+ case MsgPackType.STR32:
+ {
+ var body = GetBody();
+ var str = Encoding.UTF8.GetString(body.Array, body.Offset, body.Count);
+ return GenericCast<string, T>.Cast(str);
+ }
+
+ case MsgPackType.BIN8:
+ case MsgPackType.BIN16:
+ case MsgPackType.BIN32:
+ {
+ var body = GetBody();
+ return GenericCast<ArraySegment<Byte>, T>.Cast(body);
+ }
+
+ case MsgPackType.FIX_EXT_4:
+ {
+ if (GetExtType() == -1)
+ {
+ var unixtime = EndianConverter.NetworkByteDWordToUnsignedNativeByteOrder(GetBody());
+ var dt = new DateTimeOffset(unixtime * DateTimeOffsetExtensions.TicksPerSecond + DateTimeOffsetExtensions.EpochTime.Ticks, TimeSpan.Zero);
+ return GenericCast<DateTimeOffset, T>.Cast(dt);
+ }
+ break;
+ }
+ }
+
+ throw new ArgumentException("GetValue to array or map: " + formatType);
+ }
+
+ public bool GetBoolean()
+ {
+ switch (Format)
+ {
+ case MsgPackType.TRUE: return true;
+ case MsgPackType.FALSE: return false;
+ default: throw new MsgPackTypeException("Not boolean");
+ }
+ }
+
+ public ArraySegment<Byte> GetBytes()
+ {
+ if (!Format.IsBinary())
+ {
+ throw new MsgPackTypeException("Not bin");
+ }
+ return GetBody();
+ }
+
+ public string GetString()
+ {
+ if (!Format.IsString())
+ {
+ throw new MsgPackTypeException("Not str");
+ }
+ var bytes = GetBody();
+ return Encoding.UTF8.GetString(bytes.Array, bytes.Offset, bytes.Count);
+ }
+
+ public Utf8String GetUtf8String()
+ {
+ if (!Format.IsString())
+ {
+ throw new MsgPackTypeException("Not str");
+ }
+ var bytes = GetBody();
+ return new Utf8String(bytes);
+ }
+
+ public SByte GetSByte()
+ {
+ return GetValue<SByte>();
+ }
+
+ public Int16 GetInt16()
+ {
+ return GetValue<Int16>();
+ }
+
+ public Int32 GetInt32()
+ {
+ return GetValue<Int32>();
+ }
+
+ public Int64 GetInt64()
+ {
+ return GetValue<Int64>();
+ }
+
+ public Byte GetByte()
+ {
+ return GetValue<Byte>();
+ }
+
+ public UInt16 GetUInt16()
+ {
+ return GetValue<UInt16>();
+ }
+
+ public UInt32 GetUInt32()
+ {
+ return GetValue<UInt32>();
+ }
+
+ public UInt64 GetUInt64()
+ {
+ return GetValue<UInt64>();
+ }
+
+ public float GetSingle()
+ {
+ return GetValue<Single>();
+ }
+
+ public double GetDouble()
+ {
+ return GetValue<Double>();
+ }
+
+ public void SetValue<T>(Utf8String jsonPointer, T value)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void RemoveValue(Utf8String jsonPointer)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void AddKey(Utf8String key)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void AddValue(ArraySegment<byte> bytes, ValueNodeType valueType)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs.meta
new file mode 100644
index 00000000..e67e534a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/MsgPack/MsgPackValue.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e201eb676758d5d419ae0629fda171ac
+timeCreated: 1540904080
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc.meta
new file mode 100644
index 00000000..b31ccf87
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: e9f4765570f7add459493027e7057429
+folderAsset: yes
+timeCreated: 1543734557
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs
new file mode 100644
index 00000000..ee35dab1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs
@@ -0,0 +1,84 @@
+namespace UniJSON
+{
+ public interface IRpc
+ {
+ void Request(Utf8String method);
+ void Request<A0>(Utf8String method, A0 a0);
+ void Request<A0, A1>(Utf8String method, A0 a0, A1 a1);
+ void Request<A0, A1, A2>(Utf8String method, A0 a0, A1 a1, A2 a2);
+ void Request<A0, A1, A2, A3>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3);
+ void Request<A0, A1, A2, A3, A4>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4);
+ void Request<A0, A1, A2, A3, A4, A5>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5);
+ void ResponseSuccess(int id);
+ void ResponseSuccess<T>(int id, T result);
+ void ResponseError(int id, System.Exception error);
+ void Notify(Utf8String method);
+ void Notify<A0>(Utf8String method, A0 a0);
+ void Notify<A0, A1>(Utf8String method, A0 a0, A1 a1);
+ void Notify<A0, A1, A2>(Utf8String method, A0 a0, A1 a1, A2 a2);
+ void Notify<A0, A1, A2, A3>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3);
+ void Notify<A0, A1, A2, A3, A4>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4);
+ void Notify<A0, A1, A2, A3, A4, A5>(Utf8String method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5);
+ }
+
+ public static class RpcExtensions
+ {
+ public static void Request(this IRpc rpc, string method)
+ {
+ rpc.Request(Utf8String.From(method));
+ }
+ public static void Request<A0>(this IRpc rpc, string method, A0 a0)
+ {
+ rpc.Request(Utf8String.From(method), a0);
+ }
+ public static void Request<A0, A1>(this IRpc rpc, string method, A0 a0, A1 a1)
+ {
+ rpc.Request(Utf8String.From(method), a0, a1);
+ }
+ public static void Request<A0, A1, A2>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2)
+ {
+ rpc.Request(Utf8String.From(method), a0, a1, a2);
+ }
+ public static void Request<A0, A1, A2, A3>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ rpc.Request(Utf8String.From(method), a0, a1, a2, a3);
+ }
+ public static void Request<A0, A1, A2, A3, A4>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ rpc.Request(Utf8String.From(method), a0, a1, a2, a3, a4);
+ }
+ public static void Request<A0, A1, A2, A3, A4, A5>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ rpc.Request(Utf8String.From(method), a0, a1, a2, a3, a4, a5);
+ }
+
+ public static void Notify(this IRpc rpc, string method)
+ {
+ rpc.Notify(Utf8String.From(method));
+ }
+ public static void Notify<A0>(this IRpc rpc, string method, A0 a0)
+ {
+ rpc.Notify(Utf8String.From(method), a0);
+ }
+ public static void Notify<A0, A1>(this IRpc rpc, string method, A0 a0, A1 a1)
+ {
+ rpc.Notify(Utf8String.From(method), a0, a1);
+ }
+ public static void Notify<A0, A1, A2>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2)
+ {
+ rpc.Notify(Utf8String.From(method), a0, a1, a2);
+ }
+ public static void Notify<A0, A1, A2, A3>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ rpc.Notify(Utf8String.From(method), a0, a1, a2, a3);
+ }
+ public static void Notify<A0, A1, A2, A3, A4>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ rpc.Notify(Utf8String.From(method), a0, a1, a2, a3, a4);
+ }
+ public static void Notify<A0, A1, A2, A3, A4, A5>(this IRpc rpc, string method, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ rpc.Notify(Utf8String.From(method), a0, a1, a2, a3, a4, a5);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs.meta
new file mode 100644
index 00000000..dd1d74b3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/IRpc.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 565cc7f9a76689a45b352370db24f90f
+timeCreated: 1543734576
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs
new file mode 100644
index 00000000..bdf9a392
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public class RpcDispatcher<T>
+ where T : IListTreeItem, IValue<T>
+ {
+ delegate void Callback(int id, ListTreeNode<T> args, IRpc f);
+ Dictionary<string, Callback> m_map = new Dictionary<string, Callback>();
+
+ #region Action
+ public void Register<A0>(string method, Action<A0> action)
+ {
+ m_map.Add(method, (id, args, f) =>
+ {
+ var it = args.ArrayItems().GetEnumerator();
+
+ var a0 = default(A0);
+ it.MoveNext();
+ it.Current.Deserialize(ref a0);
+
+ try
+ {
+ action(a0);
+ f.ResponseSuccess(id);
+ }
+ catch(Exception ex)
+ {
+ f.ResponseError(id, ex);
+ }
+ });
+ }
+
+ public void Register<A0, A1>(string method, Action<A0, A1> action)
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+
+ #region Func
+ public void Register<A0, A1, R>(string method, Func<A0, A1, R> action)
+ {
+ m_map.Add(method, (id, args, f) =>
+ {
+ var it = args.ArrayItems().GetEnumerator();
+
+ var a0 = default(A0);
+ it.MoveNext();
+ it.Current.Deserialize(ref a0);
+
+ var a1 = default(A1);
+ it.MoveNext();
+ it.Current.Deserialize(ref a1);
+
+ try
+ {
+ var r = action(a0, a1);
+ f.ResponseSuccess(id, r);
+ }
+ catch(Exception ex)
+ {
+ f.ResponseError(id, ex);
+ }
+ });
+ }
+ #endregion
+
+ public void Call(IRpc f, int id, string method, ListTreeNode<T> args)
+ {
+ Callback callback;
+ if (!m_map.TryGetValue(method, out callback))
+ {
+ throw new KeyNotFoundException();
+ }
+ callback(id, args, f);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs.meta
new file mode 100644
index 00000000..912d7172
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Rpc/RpcDispatcher.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 648f9a3ef9c1a6f41b11198b1f499d5c
+timeCreated: 1543549119
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml.meta
new file mode 100644
index 00000000..a58d5b65
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ebc8d8c2347b31d4a8023a91b95f618e
+folderAsset: yes
+timeCreated: 1545735556
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs
new file mode 100644
index 00000000..ec4dd6fb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs
@@ -0,0 +1,185 @@
+using System;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public static class TomlParser
+ {
+ static TomlValue ParseLHS(Utf8String segment, int parentIndex)
+ {
+ var it = segment.GetIterator();
+ while (it.MoveNext())
+ {
+ if (it.Current == '"')
+ {
+ throw new NotImplementedException();
+ }
+ else if (it.Current == '.')
+ {
+ throw new NotImplementedException();
+ }
+ else if (it.Current == ' ' || it.Current == '\t' || it.Current == '=')
+ {
+ return new TomlValue(segment.Subbytes(0, it.BytePosition),
+ TomlValueType.BareKey, parentIndex);
+ }
+ }
+
+ throw new NotImplementedException();
+ }
+
+ static TomlValue ParseRHS(Utf8String segment, int parentIndex)
+ {
+ switch ((char)segment[0])
+ {
+ case '+':
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (segment.IsInt)
+ {
+ return new TomlValue(segment.SplitInteger(), TomlValueType.Integer, parentIndex);
+ }
+ else
+ {
+ return new TomlValue(segment, TomlValueType.Float, parentIndex);
+ }
+
+ case '"':
+ {
+ int pos;
+ if (segment.TrySearchAscii((Byte)'"', 1, out pos))
+ {
+ return new TomlValue(segment.Subbytes(0, pos + 1), TomlValueType.BasicString, parentIndex);
+ }
+ else
+ {
+ throw new ParserException("no close string: " + segment);
+ }
+ }
+
+ case '[':
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ throw new NotImplementedException();
+ }
+
+ public static ListTreeNode<TomlValue> Parse(Utf8String segment)
+ {
+ var values = new List<TomlValue>()
+ {
+ new TomlValue(segment, TomlValueType.Table, -1),
+ };
+ var current = 0;
+
+ while (!segment.IsEmpty)
+ {
+ segment = segment.TrimStart();
+ if (segment.IsEmpty)
+ {
+ break;
+ }
+
+ if (segment[0] == '#')
+ {
+ // comment line
+ // skip to line end
+ segment = segment.Subbytes(segment.GetLine().ByteLength);
+ continue;
+ }
+
+ if (segment.ByteLength>=4 && segment[0]=='[' && segment[1]=='[')
+ {
+ // [[array_name]]
+ throw new NotImplementedException();
+ }
+ else if (segment.ByteLength>=2 && segment[0]=='[')
+ {
+ // [table_name]
+ int table_end;
+ if (!segment.TrySearchByte(x => x == ']', out table_end))
+ {
+ throw new ParserException("] not found");
+ }
+ var table_name = segment.Subbytes(1, table_end-1).Trim();
+ if (table_name.IsEmpty)
+ {
+ throw new ParserException("empty table name");
+ }
+
+ // top level key
+ values.Add(new TomlValue(table_name, TomlValueType.Table, 0));
+ current = values.Count - 1;
+
+ // skip to line end
+ segment = segment.Subbytes(segment.GetLine().ByteLength);
+ }
+ else
+ {
+ // key = value
+ {
+ var key = ParseLHS(segment, current);
+ switch(key.TomlValueType)
+ {
+ case TomlValueType.BareKey:
+ case TomlValueType.QuotedKey:
+ {
+ values.Add(key);
+
+ // skip key
+ segment = segment.Subbytes(key.Bytes.Count);
+ }
+ break;
+
+ case TomlValueType.DottedKey:
+ throw new NotImplementedException();
+ }
+ }
+
+ {
+ // search and skip =
+ int eq;
+ if (!segment.TrySearchByte(x => x == '=', out eq))
+ {
+ throw new ParserException("= not found");
+ }
+ segment = segment.Subbytes(eq + 1);
+
+ // skip white space
+ segment = segment.TrimStart();
+ }
+
+ {
+ var value = ParseRHS(segment, current);
+ values.Add(value);
+
+ // skip value
+ segment = segment.Subbytes(value.Bytes.Count);
+
+ // skip to line end
+ segment = segment.Subbytes(segment.GetLine().ByteLength);
+ }
+ }
+ }
+
+ return new ListTreeNode<TomlValue>(values);
+ }
+
+ public static ListTreeNode<TomlValue> Parse(String Toml)
+ {
+ return Parse(Utf8String.From(Toml));
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs.meta
new file mode 100644
index 00000000..55335358
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlParser.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3fcee2cba67aa504a9385323813c07df
+timeCreated: 1545735557
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs
new file mode 100644
index 00000000..9a8391b6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs
@@ -0,0 +1,171 @@
+using System;
+
+
+namespace UniJSON
+{
+ public enum TomlValueType
+ {
+ BareKey, // key
+ QuotedKey, // "key"
+ DottedKey, // key.nested
+ BasicString, // "str"
+ MultilineBasicString, // """str"""
+ LiteralString, // 'str'
+ MultilineLiteralString, // '''str'''
+ Integer,
+ Float,
+ Boolean,
+ OffsetDatetime,
+ Array, // [1, 2, 3]
+ Table, // [table_name]
+ }
+
+ public struct TomlValue : IListTreeItem, IValue<TomlValue>
+ {
+ public override string ToString()
+ {
+ return m_segment.ToString();
+ }
+
+ public int ParentIndex { get; private set; }
+
+ public TomlValueType TomlValueType
+ {
+ get;
+ private set;
+ }
+
+ public ValueNodeType ValueType
+ {
+ get
+ {
+ switch (TomlValueType)
+ {
+ case TomlValueType.Integer: return ValueNodeType.Integer;
+ case TomlValueType.Float: return ValueNodeType.Number;
+ case TomlValueType.Boolean: return ValueNodeType.Boolean;
+
+ case TomlValueType.BareKey: return ValueNodeType.String;
+ case TomlValueType.QuotedKey: return ValueNodeType.String;
+ case TomlValueType.DottedKey: return ValueNodeType.String;
+
+ case TomlValueType.BasicString: return ValueNodeType.String;
+ case TomlValueType.MultilineBasicString: return ValueNodeType.String;
+ case TomlValueType.LiteralString: return ValueNodeType.String;
+ case TomlValueType.MultilineLiteralString: return ValueNodeType.String;
+
+ case TomlValueType.Table: return ValueNodeType.Object;
+ case TomlValueType.Array: return ValueNodeType.Array;
+ }
+ throw new NotImplementedException();
+ }
+ }
+
+ Utf8String m_segment;
+
+ public ArraySegment<byte> Bytes { get { return m_segment.Bytes; } }
+ public void SetBytesCount(int count)
+ {
+ throw new NotImplementedException();
+ }
+
+ public int ChildCount
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ public void SetChildCount(int count)
+ {
+ throw new NotImplementedException();
+ }
+
+ public TomlValue(Utf8String segment, TomlValueType valueType, int parentIndex) : this()
+ {
+ ParentIndex = parentIndex;
+ TomlValueType = valueType;
+ m_segment = segment;
+ }
+
+ public bool GetBoolean()
+ {
+ throw new NotImplementedException();
+ }
+
+ public byte GetByte()
+ {
+ throw new NotImplementedException();
+ }
+
+ public double GetDouble()
+ {
+ throw new NotImplementedException();
+ }
+
+ public short GetInt16()
+ {
+ throw new NotImplementedException();
+ }
+
+ public int GetInt32()
+ {
+ return m_segment.ToInt32();
+ }
+
+ public long GetInt64()
+ {
+ throw new NotImplementedException();
+ }
+
+ public sbyte GetSByte()
+ {
+ throw new NotImplementedException();
+ }
+
+ public float GetSingle()
+ {
+ throw new NotImplementedException();
+ }
+
+ public string GetString()
+ {
+ throw new NotImplementedException();
+ }
+
+ public ushort GetUInt16()
+ {
+ throw new NotImplementedException();
+ }
+
+ public uint GetUInt32()
+ {
+ throw new NotImplementedException();
+ }
+
+ public ulong GetUInt64()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Utf8String GetUtf8String()
+ {
+ return m_segment;
+ }
+
+ public U GetValue<U>()
+ {
+ throw new NotImplementedException();
+ }
+
+ public TomlValue Key(Utf8String key, int parentIndex)
+ {
+ throw new NotImplementedException();
+ }
+
+ public TomlValue New(ArraySegment<byte> bytes, ValueNodeType valueType, int parentIndex)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs.meta
new file mode 100644
index 00000000..5443be45
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Toml/TomlValue.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e62dc750f570d764ab8c88742ceaa383
+timeCreated: 1545735558
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String.meta
new file mode 100644
index 00000000..e62a8f04
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0e40e6ba8a3b47845ab0c82501dbb7d1
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs
new file mode 100644
index 00000000..65159e72
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public interface IUtf8String: IEnumerable<Byte>
+ {
+ int ByteLength { get; }
+ }
+
+ /// <summary>
+ /// Immutable short utf8 string
+ /// </summary>
+ [StructLayout(LayoutKind.Explicit)]
+ public struct Utf8String4 : IEquatable<Utf8String4>, IUtf8String
+ {
+ [FieldOffset(0)]
+ uint _value;
+
+ [FieldOffset(0)]
+ byte _byte0;
+
+ [FieldOffset(1)]
+ byte _byte1;
+
+ [FieldOffset(2)]
+ byte _byte2;
+
+ [FieldOffset(3)]
+ byte _byte3;
+
+ public int ByteLength
+ {
+ get
+ {
+ if (_byte0 == 0) return 0;
+ if (_byte1 == 0) return 1;
+ if (_byte2 == 0) return 2;
+ if (_byte3 == 0) return 3;
+ return 4;
+ }
+ }
+
+ static Utf8String4 Create(uint value)
+ {
+ return new Utf8String4
+ {
+ _value = value
+ };
+ }
+
+ public static Utf8String4 Create(IEnumerable<byte> bytes)
+ {
+ var u = new Utf8String4();
+ var it = bytes.GetEnumerator();
+
+ if (!it.MoveNext()) return u;
+ u._byte0 = it.Current;
+
+ if (!it.MoveNext()) return u;
+ u._byte1 = it.Current;
+
+ if (!it.MoveNext()) return u;
+ u._byte2 = it.Current;
+
+ if (!it.MoveNext()) return u;
+ u._byte3 = it.Current;
+
+ if (!it.MoveNext())
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ return u;
+ }
+
+ public static Utf8String4 Create(string src)
+ {
+ return Create(Utf8String.Encoding.GetBytes(src));
+ }
+
+ public bool Equals(Utf8String4 other)
+ {
+ return _value == other._value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj == null) return false;
+
+ if (obj is Utf8String4)
+ {
+ return Equals((Utf8String4)obj);
+ }
+
+ {
+ var s = obj as string;
+ if (s != null)
+ {
+ return ToString() == s;
+ }
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+
+ public override string ToString()
+ {
+ return Utf8String.Encoding.GetString(this.ToArray());
+ }
+
+ public IEnumerator<byte> GetEnumerator()
+ {
+ if (_byte0 == 0) yield break;
+ yield return _byte0;
+ if (_byte1 == 0) yield break;
+ yield return _byte1;
+ if (_byte2 == 0) yield break;
+ yield return _byte2;
+ if (_byte3 == 0) yield break;
+ yield return _byte3;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs.meta
new file mode 100644
index 00000000..9e2b5f49
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/IUtf8String.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d41f7c86ebb46934c8511b31de827279
+timeCreated: 1543422872
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs
new file mode 100644
index 00000000..440703aa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs
@@ -0,0 +1,199 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+
+namespace UniJSON
+{
+ public struct Utf8Iterator : IEnumerator<Byte>
+ {
+ Byte[] m_bytes;
+ int m_offset;
+ int m_start;
+ int m_position;
+ int m_end;
+
+ public Utf8Iterator(ArraySegment<Byte> range, int start = 0)
+ {
+ m_bytes = range.Array;
+ m_offset = range.Offset;
+ m_start = m_offset + start;
+ m_position = -1;
+ m_end = range.Offset + range.Count;
+ }
+
+ public int BytePosition
+ {
+ get { return m_position - m_offset; }
+ }
+
+ public int CurrentByteLength
+ {
+ get
+ {
+ var firstByte = Current;
+ if (firstByte <= 0x7F)
+ {
+ return 1;
+ }
+ else if (firstByte <= 0xDF)
+ {
+ return 2;
+ }
+ else if (firstByte <= 0xEF)
+ {
+ return 3;
+ }
+ else if (firstByte <= 0xF7)
+ {
+ return 4;
+ }
+ else
+ {
+ throw new Exception("invalid utf8");
+ }
+ }
+ }
+
+ public byte Current
+ {
+ get { return m_bytes[m_position]; }
+ }
+
+ object IEnumerator.Current
+ {
+ get { return Current; }
+ }
+
+ public byte Second
+ {
+ get { return m_bytes[m_position + 1]; }
+ }
+
+ public byte Third
+ {
+ get { return m_bytes[m_position + 2]; }
+ }
+
+ public byte Fourth
+ {
+ get { return m_bytes[m_position + 3]; }
+ }
+
+ public const uint Mask1 = 0x01;
+ public const uint Mask2 = 0x03;
+ public const uint Mask3 = 0x07;
+ public const uint Mask4 = 0x0F;
+ public const uint Mask5 = 0x1F;
+ public const uint Mask6 = 0x3F;
+ public const uint Mask7 = 0x7F;
+ public const uint Mask11 = 0x07FF;
+
+ public const uint Head1 = 0x80;
+ public const uint Head2 = 0xC0;
+ public const uint Head3 = 0xE0;
+ public const uint Head4 = 0xF0;
+
+ public static int ByteLengthFromChar(char c)
+ {
+ if (c <= Mask7)
+ {
+ return 1;
+ }
+ else if (c <= Mask11)
+ {
+ return 2;
+ }
+ else
+ {
+ return 3;
+ }
+ }
+
+ public uint Unicode
+ {
+ get
+ {
+ var l = CurrentByteLength;
+ if (l == 1)
+ {
+ // 7bit
+ return Current;
+ }
+ else if (l == 2)
+ {
+ // 11bit
+ return (Mask5 & Current) << 6 | (Mask6 & Second);
+ }
+ else if (l == 3)
+ {
+ // 16bit
+ return (Mask4 & Current) << 12 | (Mask6 & Second) << 6 | (Mask6 & Third);
+ }
+ else if (l == 4)
+ {
+ // 21bit
+ return (Mask3 & Current) << 18 | (Mask6 & Second) << 12 | (Mask6 & Third) << 6 | (Mask6 & Fourth);
+ }
+ else
+ {
+ throw new Exception("invalid utf8");
+ }
+ }
+ }
+
+ public char Char
+ {
+ get
+ {
+ var l = CurrentByteLength;
+ if (l == 1)
+ {
+ // 7bit
+ return (char)Current;
+ }
+ else if (l == 2)
+ {
+ // 11bit
+ return (char)((Mask5 & Current) << 6 | (Mask6 & Second));
+ }
+ else if (l == 3)
+ {
+ // 16bit
+ return (char)((Mask4 & Current) << 12 | (Mask6 & Second) << 6 | (Mask6 & Third));
+ }
+ else if (l == 4)
+ {
+ // 21bit
+ throw new NotImplementedException();
+ }
+ else
+ {
+ throw new Exception("invalid utf8");
+ }
+ }
+ }
+
+ public void Dispose()
+ {
+ }
+
+ public bool MoveNext()
+ {
+ if (m_position == -1)
+ {
+ m_position = m_start;
+ }
+ else
+ {
+ m_position += CurrentByteLength;
+ }
+ return m_position < m_end;
+ }
+
+ public void Reset()
+ {
+ m_position = -1;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs.meta
new file mode 100644
index 00000000..65f901d6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8Iterator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a5c7531d2d3a77a4ba81e8ee43426726
+timeCreated: 1544057442
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs
new file mode 100644
index 00000000..ac959694
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs
@@ -0,0 +1,444 @@
+using System;
+using System.Linq;
+
+
+namespace UniJSON
+{
+ public struct Utf8String : IComparable<Utf8String>
+ {
+ public static readonly System.Text.Encoding Encoding = new System.Text.UTF8Encoding(false);
+
+ public readonly ArraySegment<Byte> Bytes;
+ public int ByteLength
+ {
+ get { return Bytes.Count; }
+ }
+
+ public Utf8Iterator GetIterator()
+ {
+ return new Utf8Iterator(Bytes);
+ }
+
+ public int CompareTo(Utf8String other)
+ {
+ int i = 0;
+ for (; i < ByteLength && i < other.ByteLength; ++i)
+ {
+ if (this[i] < other[i])
+ {
+ return 1;
+ }
+ else if (this[i] > other[i])
+ {
+ return -1;
+ }
+ }
+ if (i < ByteLength)
+ {
+ return -1;
+ }
+ else if (i < other.ByteLength)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public Byte this[int i]
+ {
+ get { return Bytes.Array[Bytes.Offset + i]; }
+ }
+
+ public Utf8String(ArraySegment<Byte> bytes)
+ {
+ Bytes = bytes;
+ }
+
+ public Utf8String(Byte[] bytes, int offset, int count) : this(new ArraySegment<Byte>(bytes, offset, count))
+ {
+ }
+
+ public Utf8String(Byte[] bytes) : this(bytes, 0, bytes.Length)
+ {
+ }
+
+ public static Utf8String From(string src)
+ {
+ return new Utf8String(Encoding.GetBytes(src));
+ }
+
+ public static Utf8String From(string src, Byte[] bytes)
+ {
+ var required = src.Sum(c => Utf8Iterator.ByteLengthFromChar(c));
+ if (required > bytes.Length)
+ {
+ throw new OverflowException();
+ }
+ int pos = 0;
+ foreach (var c in src)
+ {
+ if (c <= Utf8Iterator.Mask7)
+ {
+ // 1bit
+ bytes[pos++] = (byte)c;
+ }
+ else if (c <= Utf8Iterator.Mask11)
+ {
+ // 2bit
+ bytes[pos++] = (byte)(Utf8Iterator.Head2 | Utf8Iterator.Mask5 & (c >> 6));
+ bytes[pos++] = (byte)(Utf8Iterator.Head1 | Utf8Iterator.Mask6 & (c));
+ }
+ else
+ {
+ // 3bit
+ bytes[pos++] = (byte)(Utf8Iterator.Head3 | Utf8Iterator.Mask4 & (c >> 12));
+ bytes[pos++] = (byte)(Utf8Iterator.Head1 | Utf8Iterator.Mask6 & (c >> 6));
+ bytes[pos++] = (byte)(Utf8Iterator.Head1 | Utf8Iterator.Mask6 & (c));
+ }
+ }
+ return new Utf8String(new ArraySegment<byte>(bytes, 0, pos));
+ }
+
+ // -2147483648 ~ 2147483647
+ public static Utf8String From(int src)
+ {
+ if (src >= 0)
+ {
+ if (src < 10)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src),
+ });
+ }
+ else if (src < 100)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 1000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 10000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 100000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/10000),
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 1000000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/100000),
+ (byte)(0x30 + src/10000),
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 10000000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/1000000),
+ (byte)(0x30 + src/100000),
+ (byte)(0x30 + src/10000),
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 100000000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/10000000),
+ (byte)(0x30 + src/1000000),
+ (byte)(0x30 + src/100000),
+ (byte)(0x30 + src/10000),
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else if (src < 1000000000)
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/100000000),
+ (byte)(0x30 + src/10000000),
+ (byte)(0x30 + src/1000000),
+ (byte)(0x30 + src/100000),
+ (byte)(0x30 + src/10000),
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ else
+ {
+ return new Utf8String(new byte[] {
+ (byte)(0x30 + src/1000000000),
+ (byte)(0x30 + src/100000000),
+ (byte)(0x30 + src/10000000),
+ (byte)(0x30 + src/1000000),
+ (byte)(0x30 + src/100000),
+ (byte)(0x30 + src/10000),
+ (byte)(0x30 + src/1000),
+ (byte)(0x30 + src/100),
+ (byte)(0x30 + src/10),
+ (byte)(0x30 + src%10),
+ });
+ }
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public Utf8String Concat(Utf8String rhs)
+ {
+ var bytes = new Byte[ByteLength + rhs.ByteLength];
+ Buffer.BlockCopy(Bytes.Array, Bytes.Offset, bytes, 0, ByteLength);
+ Buffer.BlockCopy(rhs.Bytes.Array, rhs.Bytes.Offset, bytes, ByteLength, rhs.ByteLength);
+ return new Utf8String(bytes);
+ }
+
+ public override string ToString()
+ {
+ if (ByteLength == 0) return "";
+ return Encoding.GetString(Bytes.Array, Bytes.Offset, Bytes.Count);
+ }
+
+ public string ToAscii()
+ {
+ if (ByteLength == 0) return "";
+ return System.Text.Encoding.ASCII.GetString(Bytes.Array, Bytes.Offset, Bytes.Count);
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return ByteLength == 0;
+ }
+ }
+
+ public bool StartsWith(Utf8String rhs)
+ {
+ if (rhs.ByteLength > ByteLength)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < rhs.ByteLength; ++i)
+ {
+ if (this[i] != rhs[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public bool EndsWith(Utf8String rhs)
+ {
+ if (rhs.ByteLength > ByteLength)
+ {
+ return false;
+ }
+
+ for (int i = 1; i <= rhs.ByteLength; ++i)
+ {
+ if (this[ByteLength - i] != rhs[rhs.ByteLength - i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public int IndexOf(Byte code)
+ {
+ return IndexOf(0, code);
+ }
+
+ public int IndexOf(int offset, Byte code)
+ {
+ var pos = offset + Bytes.Offset;
+ for (int i = 0; i < Bytes.Count; ++i, ++pos)
+ {
+ if (Bytes.Array[pos] == code)
+ {
+ return pos - Bytes.Offset;
+ }
+ }
+ return -1;
+ }
+
+ public Utf8String Subbytes(int offset)
+ {
+ return Subbytes(offset, ByteLength - offset);
+ }
+
+ public Utf8String Subbytes(int offset, int count)
+ {
+ return new Utf8String(Bytes.Array, Bytes.Offset + offset, count);
+ }
+
+ static bool IsSpace(Byte b)
+ {
+ switch (b)
+ {
+ case 0x20:
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x09:
+ return true;
+ }
+
+ return false;
+ }
+
+ public Utf8String TrimStart()
+ {
+ var i = 0;
+ for (; i < ByteLength; ++i)
+ {
+ if (!IsSpace(this[i]))
+ {
+ break;
+ }
+ }
+ return Subbytes(i);
+ }
+
+ public Utf8String TrimEnd()
+ {
+ var i = ByteLength-1;
+ for (; i >= 0; --i)
+ {
+ if (!IsSpace(this[i]))
+ {
+ break;
+ }
+ }
+ return Subbytes(0, i+1);
+ }
+
+ public Utf8String Trim()
+ {
+ return TrimStart().TrimEnd();
+ }
+
+ public override bool Equals(Object obj)
+ {
+ return obj is Utf8String && Equals((Utf8String)obj);
+ }
+
+ public static bool operator ==(Utf8String x, Utf8String y)
+ {
+ return x.Equals(y);
+ }
+
+ public static bool operator !=(Utf8String x, Utf8String y)
+ {
+ return !(x == y);
+ }
+
+ public bool Equals(Utf8String other)
+ {
+ if (ByteLength != other.ByteLength)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < ByteLength; ++i)
+ {
+ if (this[i] != other[i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public override int GetHashCode()
+ {
+ return ByteLength.GetHashCode();
+ }
+
+ public static Utf8String operator +(Utf8String l, Utf8String r)
+ {
+ return new Utf8String(l.Bytes.Concat(r.Bytes));
+ }
+
+ public bool IsInt
+ {
+ get
+ {
+ //bool isInt = false;
+ for (int i = 0; i < ByteLength; ++i)
+ {
+ var c = this[i];
+ if (c == '0'
+ || c == '1'
+ || c == '2'
+ || c == '3'
+ || c == '4'
+ || c == '5'
+ || c == '6'
+ || c == '7'
+ || c == '8'
+ || c == '9'
+ )
+ {
+ // ok
+ //isInt = true;
+ }
+ else if (i == 0 && c == '-')
+ {
+ // ok
+ }
+ else if (c == '.' || c == 'e')
+ {
+ return false;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return true;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs.meta
new file mode 100644
index 00000000..fa34c195
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8String.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 93adff1e1b4725f498a92faccf7e240d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs
new file mode 100644
index 00000000..59a58b7e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs
@@ -0,0 +1,33 @@
+using System.Text;
+
+namespace UniJSON
+{
+ public class Utf8StringBuilder
+ {
+ ByteBuffer m_buffer = new ByteBuffer();
+
+ public void Ascii(char c)
+ {
+ m_buffer.Push((byte)c);
+ }
+
+ static Encoding s_utf8 = new UTF8Encoding(false);
+
+ public void Quote(string text)
+ {
+ Ascii('"');
+ m_buffer.Push(s_utf8.GetBytes(text));
+ Ascii('"');
+ }
+
+ public void Add(Utf8String str)
+ {
+ m_buffer.Push(str.Bytes);
+ }
+
+ public Utf8String ToUtf8String()
+ {
+ return new Utf8String(m_buffer.Bytes);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs.meta
new file mode 100644
index 00000000..d3d1cfd8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringBuilder.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ba2dbf26152e2704d986754eb12f5af4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs
new file mode 100644
index 00000000..e0df03db
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs
@@ -0,0 +1,341 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+
+namespace UniJSON
+{
+ public static class Utf8StringExtensions
+ {
+ public static void WriteTo(this Utf8String src, Stream dst)
+ {
+ dst.Write(src.Bytes.Array, src.Bytes.Offset, src.Bytes.Count);
+ }
+
+ public static Utf8Iterator GetFirst(this Utf8String src)
+ {
+ var it = src.GetIterator();
+ it.MoveNext();
+ return it;
+ }
+
+ public static bool TrySearchByte(this Utf8String src, Func<byte, bool> pred, out int pos)
+ {
+ pos = 0;
+ for (; pos < src.ByteLength; ++pos)
+ {
+ if (pred(src[pos]))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static bool TrySearchAscii(this Utf8String src, Byte target, int start, out int pos)
+ {
+ var p = new Utf8Iterator(src.Bytes, start);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ if (b <= 0x7F)
+ {
+ // ascii
+ if (b == target/*'\"'*/)
+ {
+ // closed
+ pos = p.BytePosition;
+ return true;
+ }
+ else if (b == '\\')
+ {
+ // escaped
+ switch ((char)p.Second)
+ {
+ case '"': // fall through
+ case '\\': // fall through
+ case '/': // fall through
+ case 'b': // fall through
+ case 'f': // fall through
+ case 'n': // fall through
+ case 'r': // fall through
+ case 't': // fall through
+ // skip next
+ p.MoveNext();
+ break;
+
+ case 'u': // unicode
+ // skip next 4
+ p.MoveNext();
+ p.MoveNext();
+ p.MoveNext();
+ p.MoveNext();
+ break;
+
+ default:
+ // unknown escape
+ throw new ParserException("unknown escape: " + p.Second);
+ }
+ }
+ }
+ }
+
+ pos = -1;
+ return false;
+ }
+
+ public static IEnumerable<Utf8String> Split(this Utf8String src, byte delimiter)
+ {
+ var start = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ if (p.Current == delimiter)
+ {
+ if (p.BytePosition - start == 0)
+ {
+ yield return default(Utf8String);
+ }
+ else
+ {
+ yield return src.Subbytes(start, p.BytePosition - start);
+ }
+ start = p.BytePosition + 1;
+ }
+ }
+
+ if (start < p.BytePosition)
+ {
+ yield return src.Subbytes(start, p.BytePosition - start);
+ }
+ }
+
+ #region atoi
+ public static SByte ToSByte(this Utf8String src)
+ {
+ SByte value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (SByte)(value * 10); break;
+ case 0x31: value = (SByte)(value * 10 + 1); break;
+ case 0x32: value = (SByte)(value * 10 + 2); break;
+ case 0x33: value = (SByte)(value * 10 + 3); break;
+ case 0x34: value = (SByte)(value * 10 + 4); break;
+ case 0x35: value = (SByte)(value * 10 + 5); break;
+ case 0x36: value = (SByte)(value * 10 + 6); break;
+ case 0x37: value = (SByte)(value * 10 + 7); break;
+ case 0x38: value = (SByte)(value * 10 + 8); break;
+ case 0x39: value = (SByte)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ public static Int16 ToInt16(this Utf8String src)
+ {
+ Int16 value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (Int16)(value * 10); break;
+ case 0x31: value = (Int16)(value * 10 + 1); break;
+ case 0x32: value = (Int16)(value * 10 + 2); break;
+ case 0x33: value = (Int16)(value * 10 + 3); break;
+ case 0x34: value = (Int16)(value * 10 + 4); break;
+ case 0x35: value = (Int16)(value * 10 + 5); break;
+ case 0x36: value = (Int16)(value * 10 + 6); break;
+ case 0x37: value = (Int16)(value * 10 + 7); break;
+ case 0x38: value = (Int16)(value * 10 + 8); break;
+ case 0x39: value = (Int16)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ public static Int32 ToInt32(this Utf8String src)
+ {
+ Int32 value = 0;
+ Int32 sign = 1;
+ var p = new Utf8Iterator(src.Bytes);
+ bool isFirst = true;
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+
+ if (isFirst)
+ {
+ isFirst = false;
+ if (b == '-')
+ {
+ sign = -1;
+ continue;
+ }
+ }
+
+ switch (b)
+ {
+ case 0x30: value = value * 10; break;
+ case 0x31: value = value * 10 + 1; break;
+ case 0x32: value = value * 10 + 2; break;
+ case 0x33: value = value * 10 + 3; break;
+ case 0x34: value = value * 10 + 4; break;
+ case 0x35: value = value * 10 + 5; break;
+ case 0x36: value = value * 10 + 6; break;
+ case 0x37: value = value * 10 + 7; break;
+ case 0x38: value = value * 10 + 8; break;
+ case 0x39: value = value * 10 + 9; break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value * sign;
+ }
+ public static Int64 ToInt64(this Utf8String src)
+ {
+ Int64 value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (Int64)(value * 10); break;
+ case 0x31: value = (Int64)(value * 10 + 1); break;
+ case 0x32: value = (Int64)(value * 10 + 2); break;
+ case 0x33: value = (Int64)(value * 10 + 3); break;
+ case 0x34: value = (Int64)(value * 10 + 4); break;
+ case 0x35: value = (Int64)(value * 10 + 5); break;
+ case 0x36: value = (Int64)(value * 10 + 6); break;
+ case 0x37: value = (Int64)(value * 10 + 7); break;
+ case 0x38: value = (Int64)(value * 10 + 8); break;
+ case 0x39: value = (Int64)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ public static Byte ToByte(this Utf8String src)
+ {
+ Byte value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (Byte)(value * 10); break;
+ case 0x31: value = (Byte)(value * 10 + 1); break;
+ case 0x32: value = (Byte)(value * 10 + 2); break;
+ case 0x33: value = (Byte)(value * 10 + 3); break;
+ case 0x34: value = (Byte)(value * 10 + 4); break;
+ case 0x35: value = (Byte)(value * 10 + 5); break;
+ case 0x36: value = (Byte)(value * 10 + 6); break;
+ case 0x37: value = (Byte)(value * 10 + 7); break;
+ case 0x38: value = (Byte)(value * 10 + 8); break;
+ case 0x39: value = (Byte)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ public static UInt16 ToUInt16(this Utf8String src)
+ {
+ UInt16 value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (UInt16)(value * 10); break;
+ case 0x31: value = (UInt16)(value * 10 + 1); break;
+ case 0x32: value = (UInt16)(value * 10 + 2); break;
+ case 0x33: value = (UInt16)(value * 10 + 3); break;
+ case 0x34: value = (UInt16)(value * 10 + 4); break;
+ case 0x35: value = (UInt16)(value * 10 + 5); break;
+ case 0x36: value = (UInt16)(value * 10 + 6); break;
+ case 0x37: value = (UInt16)(value * 10 + 7); break;
+ case 0x38: value = (UInt16)(value * 10 + 8); break;
+ case 0x39: value = (UInt16)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ public static UInt32 ToUInt32(this Utf8String src)
+ {
+ UInt32 value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (UInt32)(value * 10); break;
+ case 0x31: value = (UInt32)(value * 10 + 1); break;
+ case 0x32: value = (UInt32)(value * 10 + 2); break;
+ case 0x33: value = (UInt32)(value * 10 + 3); break;
+ case 0x34: value = (UInt32)(value * 10 + 4); break;
+ case 0x35: value = (UInt32)(value * 10 + 5); break;
+ case 0x36: value = (UInt32)(value * 10 + 6); break;
+ case 0x37: value = (UInt32)(value * 10 + 7); break;
+ case 0x38: value = (UInt32)(value * 10 + 8); break;
+ case 0x39: value = (UInt32)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ public static UInt64 ToUInt64(this Utf8String src)
+ {
+ UInt64 value = 0;
+ var p = new Utf8Iterator(src.Bytes);
+ while (p.MoveNext())
+ {
+ var b = p.Current;
+ switch (b)
+ {
+ case 0x30: value = (UInt64)(value * 10); break;
+ case 0x31: value = (UInt64)(value * 10 + 1); break;
+ case 0x32: value = (UInt64)(value * 10 + 2); break;
+ case 0x33: value = (UInt64)(value * 10 + 3); break;
+ case 0x34: value = (UInt64)(value * 10 + 4); break;
+ case 0x35: value = (UInt64)(value * 10 + 5); break;
+ case 0x36: value = (UInt64)(value * 10 + 6); break;
+ case 0x37: value = (UInt64)(value * 10 + 7); break;
+ case 0x38: value = (UInt64)(value * 10 + 8); break;
+ case 0x39: value = (UInt64)(value * 10 + 9); break;
+ default: throw new ArgumentOutOfRangeException();
+ }
+ }
+ return value;
+ }
+ #endregion
+
+ public static float ToSingle(this Utf8String src)
+ {
+ return Single.Parse(src.ToAscii(), System.Globalization.CultureInfo.InvariantCulture);
+ }
+ public static double ToDouble(this Utf8String src)
+ {
+ return Double.Parse(src.ToAscii(), System.Globalization.CultureInfo.InvariantCulture);
+ }
+
+ public static Utf8String GetLine(this Utf8String src)
+ {
+ int pos;
+ if (!src.TrySearchAscii((byte)'\n', 0, out pos))
+ {
+ return src;
+ }
+
+ return src.Subbytes(0, pos + 1);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs.meta
new file mode 100644
index 00000000..edb9bdbd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f613907c8a91aa049809fe1f754776de
+timeCreated: 1544060764
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs
new file mode 100644
index 00000000..a5784bbb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs
@@ -0,0 +1,44 @@
+using System;
+
+
+namespace UniJSON
+{
+ public static class Utf8StringSplitterExtensions
+ {
+ /// <summary>
+ /// Split integer from start
+ ///
+ /// "123 " => "123"
+ /// " 123" => FormatException
+ ///
+ /// must start +-0123456789
+ ///
+ /// </summary>
+ /// <param name="src"></param>
+ /// <returns></returns>
+ public static Utf8String SplitInteger(this Utf8String src)
+ {
+ var i = 0;
+ if(src[0]=='+' || src[0] == '-')
+ {
+ ++i;
+ }
+
+ var j = i;
+ for(; j<src.ByteLength; ++j)
+ {
+ if(src[j]<'0' || src[j]>'9')
+ {
+ break;
+ }
+ }
+
+ if (i == j)
+ {
+ throw new FormatException();
+ }
+
+ return src.Subbytes(0, j);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs.meta
new file mode 100644
index 00000000..080f9ba2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/Scripts/Utf8String/Utf8StringSplitterExtensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1627ff7e9bb16a8459021fda0223909c
+timeCreated: 1545735556
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef b/Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef
new file mode 100644
index 00000000..54ea498a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef
@@ -0,0 +1,3 @@
+{
+ "name": "UniJSON"
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef.meta
new file mode 100644
index 00000000..9e8f0135
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniJSON/UniJSON.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 5dad3aa3e33a0ea48b088de553c50bf7
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM.meta b/Assets/ThirdParty/VRM/VRM/UniVRM.meta
new file mode 100644
index 00000000..6c8ff4b4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: cd93bd4f117e1e54db244c5cadbef691
+folderAsset: yes
+timeCreated: 1546003999
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor.meta
new file mode 100644
index 00000000..3b4c9994
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 41cb69128d62a4e4a9ffde396b606553
+folderAsset: yes
+timeCreated: 1521102890
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape.meta
new file mode 100644
index 00000000..7eb84d67
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9e31b30e42902a44f94793be121d2479
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs
new file mode 100644
index 00000000..7338589f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UniGLTF;
+using UnityEditor;
+using UnityEditorInternal;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [CustomEditor(typeof(BlendShapeAvatar))]
+ public class BlendShapeAvatarEditor : PreviewEditor
+ {
+ ReorderableList m_clipList;
+
+ BlendShapeClipSelector m_selector;
+
+ SerializedBlendShapeEditor m_clipEditor;
+
+ protected override PreviewSceneManager.BakeValue GetBakeValue()
+ {
+ var clip = m_selector.Selected;
+ var value = new PreviewSceneManager.BakeValue();
+ if (clip != null)
+ {
+ value.BlendShapeBindings = clip.Values;
+ value.MaterialValueBindings = clip.MaterialValues;
+ value.Weight = 1.0f;
+ }
+ return value;
+ }
+
+ void OnSelected(BlendShapeClip clip)
+ {
+ if (PreviewSceneManager == null)
+ {
+ m_clipEditor = null;
+ }
+ else if (clip != null)
+ {
+ m_clipEditor = new SerializedBlendShapeEditor(clip, PreviewSceneManager);
+ PreviewSceneManager.Bake(new PreviewSceneManager.BakeValue
+ {
+ BlendShapeBindings = clip.Values,
+ MaterialValueBindings = clip.MaterialValues,
+ Weight = 1.0f
+ });
+ }
+ else
+ {
+ m_clipEditor = null;
+ PreviewSceneManager.Bake(new PreviewSceneManager.BakeValue());
+ }
+ }
+
+ protected override void OnEnable()
+ {
+ m_selector = new BlendShapeClipSelector((BlendShapeAvatar)target, OnSelected);
+
+ var prop = serializedObject.FindProperty("Clips");
+ m_clipList = new ReorderableList(serializedObject, prop);
+
+ m_clipList.drawHeaderCallback = (rect) =>
+ EditorGUI.LabelField(rect, "BlendShapeClips");
+
+ m_clipList.elementHeight = BlendShapeClipDrawer.Height;
+ m_clipList.drawElementCallback = (rect, index, isActive, isFocused) =>
+ {
+ var element = prop.GetArrayElementAtIndex(index);
+ rect.height -= 4;
+ rect.y += 2;
+ EditorGUI.PropertyField(rect, element);
+ };
+
+ m_clipList.onAddCallback += (list) =>
+ {
+ // Add slot
+ prop.arraySize++;
+ // select last item
+ list.index = prop.arraySize - 1;
+ // get last item
+ var element = prop.GetArrayElementAtIndex(list.index);
+ element.objectReferenceValue = null;
+
+ var dir = Path.GetDirectoryName(AssetDatabase.GetAssetPath(target));
+ var path = EditorUtility.SaveFilePanel(
+ "Create BlendShapeClip",
+ dir,
+ string.Format("BlendShapeClip#{0}.asset", list.count),
+ "asset");
+ if (!string.IsNullOrEmpty(path))
+ {
+ var clip = BlendShapeAvatar.CreateBlendShapeClip(path.ToUnityRelativePath());
+ //clip.Prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GetAssetPath(target));
+
+ element.objectReferenceValue = clip;
+ }
+ };
+
+ m_clipList.onSelectCallback += (list) =>
+ {
+ var a = list.serializedProperty;
+ var selected = a.GetArrayElementAtIndex(list.index);
+ OnSelected((BlendShapeClip)selected.objectReferenceValue);
+ };
+
+ //m_clipList.onCanRemoveCallback += list => true;
+ base.OnEnable();
+
+ OnSelected(m_selector.Selected);
+ }
+
+ int m_mode;
+ static readonly string[] MODES = new string[]{
+ "Editor",
+ "List"
+ };
+
+ public override void OnInspectorGUI()
+ {
+ serializedObject.Update();
+
+ base.OnInspectorGUI();
+
+ m_mode = GUILayout.Toolbar(m_mode, MODES);
+ switch (m_mode)
+ {
+ case 0:
+ m_selector.SelectGUI();
+ if (m_clipEditor != null)
+ {
+ Separator();
+ var result = m_clipEditor.Draw();
+ if (result.Changed)
+ {
+ PreviewSceneManager.Bake(new PreviewSceneManager.BakeValue
+ {
+ BlendShapeBindings = result.BlendShapeBindings,
+ MaterialValueBindings = result.MaterialValueBindings,
+ Weight = 1.0f,
+ });
+ }
+ }
+ break;
+
+ case 1:
+ m_clipList.DoLayoutList();
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+
+ serializedObject.ApplyModifiedProperties();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs.meta
new file mode 100644
index 00000000..e99155b8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeAvatarEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 1cde1e2369885f14181eb58009310c92
+timeCreated: 1523199409
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs
new file mode 100644
index 00000000..646c8c4d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs
@@ -0,0 +1,63 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+
+ [CustomPropertyDrawer(typeof(BlendShapeClip))]
+ public class BlendShapeClipDrawer : PropertyDrawer
+ {
+ //public const int Height = 132;
+
+ //public const int ThumbnailSize = 128;
+
+ public const int Height = 80;
+ public const int ThumbnailSize = 0;
+
+ public override void OnGUI(Rect position,
+ SerializedProperty property, GUIContent label)
+ {
+ using (new EditorGUI.PropertyScope(position, label, property))
+ {
+ //EditorGUIUtility.labelWidth = 80;
+
+ position.height = EditorGUIUtility.singleLineHeight;
+
+ //var halfWidth = position.width * 0.5f;
+
+ var rect = new Rect(position.x + ThumbnailSize, position.y, position.width - ThumbnailSize, position.height);
+ EditorGUI.PropertyField(rect, property);
+
+ var clip = property.objectReferenceValue as BlendShapeClip;
+ if (clip != null)
+ {
+ var clipObj = new SerializedObject(clip);
+ //var thumbnail = clipObj.FindProperty("Thumbnail");
+ var blendShapeName = clipObj.FindProperty("BlendShapeName");
+ var preset = clipObj.FindProperty("Preset");
+ var isBinary = clipObj.FindProperty("IsBinary");
+
+ /*
+ EditorGUI.ObjectField(new Rect(position)
+ {
+ width = ThumbnailSize,
+ height = ThumbnailSize
+ }, thumbnail.objectReferenceValue, typeof(Texture), false);
+ */
+
+ rect.y += (EditorGUIUtility.singleLineHeight + 2);
+ EditorGUI.PropertyField(rect, blendShapeName);
+ rect.y += (EditorGUIUtility.singleLineHeight + 2);
+ EditorGUI.PropertyField(rect, preset);
+ rect.y += (EditorGUIUtility.singleLineHeight + 2);
+ EditorGUI.PropertyField(rect, isBinary);
+
+ clipObj.ApplyModifiedProperties();
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs.meta
new file mode 100644
index 00000000..b5ef0081
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipDrawer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6a31667cfcf461c47b3b384211e2d9ff
+timeCreated: 1541179390
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs
new file mode 100644
index 00000000..4186b68c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs
@@ -0,0 +1,171 @@
+using System;
+using System.IO;
+using UniGLTF;
+using UnityEditor;
+using UnityEditorInternal;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [CustomEditor(typeof(BlendShapeClip))]
+ public class BlendShapeClipEditor : PreviewEditor
+ {
+ SerializedBlendShapeEditor m_serializedEditor;
+
+ BlendShapeClip m_target;
+ protected override PreviewSceneManager.BakeValue GetBakeValue()
+ {
+ return new PreviewSceneManager.BakeValue
+ {
+ BlendShapeBindings = m_target.Values,
+ MaterialValueBindings = m_target.MaterialValues,
+ Weight = 1.0f,
+ };
+ }
+
+ //SerializedProperty m_thumbnailProp;
+ SerializedProperty m_isBinaryProp;
+
+ protected override GameObject GetPrefab()
+ {
+ return m_target.Prefab;
+ }
+
+ protected override void OnEnable()
+ {
+ m_target = (BlendShapeClip)target;
+
+ base.OnEnable();
+ }
+
+ float m_previewSlider = 1.0f;
+
+ static Texture2D SaveResizedImage(RenderTexture rt, UnityPath path, int size)
+ {
+ var tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false);
+ RenderTexture.active = rt;
+ tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
+ tex.Apply();
+
+ //TextureScale.Scale(tex, size, size);
+ tex = TextureScale.GetResized(tex, size, size);
+
+ byte[] bytes;
+ switch (path.Extension.ToLower())
+ {
+ case ".png":
+ bytes = tex.EncodeToPNG();
+ break;
+
+ case ".jpg":
+ bytes = tex.EncodeToJPG();
+ break;
+
+ default:
+ throw new Exception();
+ }
+
+ if (Application.isPlaying)
+ {
+ UnityEngine.Object.Destroy(tex);
+ }
+ else
+ {
+ UnityEngine.Object.DestroyImmediate(tex);
+ }
+ File.WriteAllBytes(path.FullPath, bytes);
+
+ path.ImportAsset();
+ return path.LoadAsset<Texture2D>();
+ }
+
+ public override void OnInspectorGUI()
+ {
+ if (PreviewSceneManager == null)
+ {
+ return;
+ }
+ serializedObject.Update();
+
+ if (m_serializedEditor == null)
+ {
+ m_serializedEditor = new SerializedBlendShapeEditor(serializedObject, PreviewSceneManager);
+ //m_thumbnailProp = serializedObject.FindProperty("Thumbnail");
+ m_isBinaryProp = serializedObject.FindProperty("IsBinary");
+ }
+
+ EditorGUILayout.BeginHorizontal();
+
+ /*
+ int thumbnailSize = 96;
+ var objectReferenceValue = EditorGUILayout.ObjectField(m_thumbnailProp.objectReferenceValue, typeof(Texture), false,
+ GUILayout.Width(thumbnailSize), GUILayout.Height(thumbnailSize));
+ if (m_thumbnailProp.objectReferenceValue != objectReferenceValue)
+ {
+ m_thumbnailProp.objectReferenceValue = objectReferenceValue;
+ serializedObject.ApplyModifiedProperties();
+ }
+ */
+
+ var changed = false;
+ EditorGUILayout.BeginVertical();
+ base.OnInspectorGUI();
+ EditorGUILayout.LabelField("Preview Weight");
+ var previewSlider = EditorGUILayout.Slider(m_previewSlider, 0, 1.0f);
+ GUI.enabled = PreviewTexture != null;
+ /*
+ if (GUILayout.Button("save thumbnail"))
+ {
+ //var ext = "jpg";
+ var ext = "png";
+ var asset = UnityPath.FromAsset(target);
+ var path = EditorUtility.SaveFilePanel(
+ "save thumbnail",
+ asset.Parent.FullPath,
+ string.Format("{0}.{1}", asset.FileNameWithoutExtension, ext),
+ ext);
+ if (!string.IsNullOrEmpty(path))
+ {
+ var thumbnail = SaveResizedImage(PreviewTexture, UnityPath.FromFullpath(path),
+ BlendShapeClipDrawer.ThumbnailSize);
+ m_thumbnailProp.objectReferenceValue = thumbnail;
+ serializedObject.ApplyModifiedProperties();
+ }
+ }
+ */
+ GUI.enabled = true;
+ EditorGUILayout.EndVertical();
+
+ if (m_isBinaryProp.boolValue)
+ {
+ previewSlider = Mathf.Round(previewSlider);
+ }
+ if (previewSlider != m_previewSlider)
+ {
+ m_previewSlider = previewSlider;
+ changed = true;
+ }
+
+ EditorGUILayout.EndHorizontal();
+ Separator();
+ EditorGUILayout.Space();
+
+ var result = m_serializedEditor.Draw();
+ if ((changed || result.Changed) && PreviewSceneManager != null)
+ {
+ PreviewSceneManager.Bake(new PreviewSceneManager.BakeValue
+ {
+ BlendShapeBindings = result.BlendShapeBindings,
+ MaterialValueBindings = result.MaterialValueBindings,
+ Weight = m_previewSlider
+ });
+ }
+ }
+
+ public override string GetInfoString()
+ {
+ return BlendShapeKey.CreateFromClip((BlendShapeClip)target).ToString();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs.meta
new file mode 100644
index 00000000..c23db230
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4b3d6730e24442c44baaa50a1e6f3a6d
+timeCreated: 1522927173
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs
new file mode 100644
index 00000000..a8489894
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs
@@ -0,0 +1,341 @@
+using System;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public static class BlendShapeClipEditorHelper
+ {
+ ///
+ /// BlendShape List のElement描画
+ ///
+ public static bool DrawBlendShapeBinding(Rect position, SerializedProperty property,
+ PreviewSceneManager scene)
+ {
+ bool changed = false;
+ if (scene != null)
+ {
+ var height = 16;
+
+ var y = position.y;
+ var rect = new Rect(position.x, y, position.width, height);
+ int pathIndex;
+ if (StringPopup(rect, property.FindPropertyRelative("RelativePath"), scene.SkinnedMeshRendererPathList, out pathIndex))
+ {
+ changed = true;
+ }
+
+ y += height;
+ rect = new Rect(position.x, y, position.width, height);
+ int blendShapeIndex;
+ if (IntPopup(rect, property.FindPropertyRelative("Index"), scene.GetBlendShapeNames(pathIndex), out blendShapeIndex))
+ {
+ changed = true;
+ }
+
+ y += height;
+ rect = new Rect(position.x, y, position.width, height);
+ if (FloatSlider(rect, property.FindPropertyRelative("Weight"), 100))
+ {
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ ///
+ /// Material List のElement描画
+ ///
+ public static bool DrawMaterialValueBinding(Rect position, SerializedProperty property,
+ PreviewSceneManager scene)
+ {
+ bool changed = false;
+ if (scene != null)
+ {
+ var height = 16;
+
+ var y = position.y;
+ var rect = new Rect(position.x, y, position.width, height);
+ int materialIndex;
+ if (StringPopup(rect, property.FindPropertyRelative("MaterialName"), scene.MaterialNames, out materialIndex))
+ {
+ changed = true;
+ }
+
+ if (materialIndex >= 0)
+ {
+ var materialItem = scene.GetMaterialItem(scene.MaterialNames[materialIndex]);
+ if (materialItem != null)
+ {
+ y += height;
+ rect = new Rect(position.x, y, position.width, height);
+
+ // プロパティ名のポップアップ
+ int propIndex;
+ if (StringPopup(rect, property.FindPropertyRelative("ValueName"), materialItem.PropNames, out propIndex))
+ {
+ changed = true;
+ }
+
+ if (propIndex >= 0)
+ {
+ // 有効なプロパティ名が選択された
+ var propItem = materialItem.PropMap[materialItem.PropNames[propIndex]];
+ {
+ switch (propItem.PropertyType)
+ {
+ case ShaderUtil.ShaderPropertyType.Color:
+ {
+ property.FindPropertyRelative("BaseValue").vector4Value = propItem.DefaultValues;
+
+ // max
+ y += height;
+ rect = new Rect(position.x, y, position.width, height);
+ if (ColorProp(rect, property.FindPropertyRelative("TargetValue")))
+ {
+ changed = true;
+ }
+ }
+ break;
+
+ case ShaderUtil.ShaderPropertyType.TexEnv:
+ {
+ property.FindPropertyRelative("BaseValue").vector4Value = propItem.DefaultValues;
+
+ // max
+ y += height;
+ rect = new Rect(position.x, y, position.width, height);
+ if (OffsetProp(rect, property.FindPropertyRelative("TargetValue")))
+ {
+ changed = true;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return changed;
+ }
+
+ #region Private
+ static bool StringPopup(Rect rect, SerializedProperty prop, string[] options, out int newIndex)
+ {
+ if (options == null)
+ {
+ newIndex = -1;
+ return false;
+ }
+
+ var oldIndex = Array.IndexOf(options, prop.stringValue);
+ newIndex = EditorGUI.Popup(rect, oldIndex, options);
+ if (newIndex != oldIndex && newIndex >= 0 && newIndex < options.Length)
+ {
+ prop.stringValue = options[newIndex];
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static bool IntPopup(Rect rect, SerializedProperty prop, string[] options, out int newIndex)
+ {
+ if (options == null)
+ {
+ newIndex = -1;
+ return false;
+ }
+
+ var oldIndex = prop.intValue;
+ newIndex = EditorGUI.Popup(rect, oldIndex, options);
+ if (newIndex != oldIndex && newIndex >= 0 && newIndex < options.Length)
+ {
+ prop.intValue = newIndex;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static bool FloatSlider(Rect rect, SerializedProperty prop, float maxValue)
+ {
+ var oldValue = prop.floatValue;
+ var newValue = EditorGUI.Slider(rect, prop.floatValue, 0, 100f);
+ if (newValue != oldValue)
+ {
+ prop.floatValue = newValue;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static bool ColorProp(Rect rect, SerializedProperty prop)
+ {
+ var oldValue = (Color)prop.vector4Value;
+ var newValue = EditorGUI.ColorField(rect, prop.displayName, oldValue);
+ if (newValue != oldValue)
+ {
+ prop.vector4Value = newValue;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static Rect AdvanceRect(ref float x, float y, float w, float h)
+ {
+ var rect = new Rect(x, y, w, h);
+ x += w;
+ return rect;
+ }
+
+ static float[] v2 = new float[2];
+ static GUIContent[] l2 = new GUIContent[]{
+ new GUIContent("x"),
+ new GUIContent("y")
+ };
+ static Vector4 TilingOffset(Rect rect, string label, Vector4 src)
+ {
+ /*
+ var style = new GUIStyle()
+ {
+ alignment = TextAnchor.MiddleRight,
+ };
+ */
+
+ var quad = (rect.width - 56);
+ var x = rect.x;
+ //EditorGUIUtility.labelWidth = 18;
+
+ EditorGUI.LabelField(AdvanceRect(ref x, rect.y, 40, rect.height), "Tiling");
+ v2[0] = src.x;
+ v2[1] = src.y;
+ EditorGUI.MultiFloatField(AdvanceRect(ref x, rect.y, quad, rect.height), l2, v2);
+ src.x = v2[0];
+ src.y = v2[1];
+
+ //EditorGUI.LabelField(AdvanceRect(ref x, rect.y, quad, rect.height), "Y", style);
+ //src.y = EditorGUI.FloatField(AdvanceRect(ref x, rect.y, quad, rect.height), "Y", src.y);
+
+ rect.y += EditorGUIUtility.singleLineHeight;
+ x = rect.x;
+ EditorGUI.LabelField(AdvanceRect(ref x, rect.y, 40, rect.height), "Offset");
+ v2[0] = src.z;
+ v2[1] = src.w;
+ EditorGUI.MultiFloatField(AdvanceRect(ref x, rect.y, quad, rect.height), l2, v2);
+ src.z = v2[0];
+ src.w = v2[1];
+
+ //EditorGUI.LabelField(AdvanceRect(ref x, rect.y, quad * 2, rect.height), "Offset X", style);
+ //src.z = EditorGUI.FloatField(AdvanceRect(ref x, rect.y, quad, rect.height), "X", src.z);
+
+ //EditorGUI.LabelField(AdvanceRect(ref x, rect.y, quad, rect.height), "Y", style);
+ //src.w = EditorGUI.FloatField(AdvanceRect(ref x, rect.y, quad, rect.height), "Y", src.w);
+
+ return src;
+ }
+
+ static bool OffsetProp(Rect rect, SerializedProperty prop)
+ {
+ var oldValue = prop.vector4Value;
+ //var newValue = EditorGUI.Vector4Field(rect, prop.displayName, oldValue);
+ var newValue = TilingOffset(rect, prop.displayName, oldValue);
+ if (newValue != oldValue)
+ {
+ prop.vector4Value = newValue;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ #endregion
+ }
+
+ /// https://gist.github.com/gszauer/7799899
+ public class TextureScale
+ {
+ private static Color[] texColors;
+ private static Color[] newColors;
+ private static int w;
+ private static float ratioX;
+ private static float ratioY;
+ private static int w2;
+
+ public static void Scale(Texture2D tex, int newWidth, int newHeight)
+ {
+ texColors = tex.GetPixels();
+ newColors = new Color[newWidth * newHeight];
+ ratioX = 1.0f / ((float)newWidth / (tex.width - 1));
+ ratioY = 1.0f / ((float)newHeight / (tex.height - 1));
+ w = tex.width;
+ w2 = newWidth;
+
+ BilinearScale(0, newHeight);
+
+ tex.Resize(newWidth, newHeight);
+ tex.SetPixels(newColors);
+ tex.Apply();
+ }
+
+ private static void BilinearScale(int start, int end)
+ {
+ for (var y = start; y < end; y++)
+ {
+ int yFloor = (int)Mathf.Floor(y * ratioY);
+ var y1 = yFloor * w;
+ var y2 = (yFloor + 1) * w;
+ var yw = y * w2;
+
+ for (var x = 0; x < w2; x++)
+ {
+ int xFloor = (int)Mathf.Floor(x * ratioX);
+ var xLerp = x * ratioX - xFloor;
+ newColors[yw + x] = ColorLerpUnclamped(ColorLerpUnclamped(texColors[y1 + xFloor], texColors[y1 + xFloor + 1], xLerp),
+ ColorLerpUnclamped(texColors[y2 + xFloor], texColors[y2 + xFloor + 1], xLerp),
+ y * ratioY - yFloor);
+ }
+ }
+ }
+
+ private static Color ColorLerpUnclamped(Color c1, Color c2, float value)
+ {
+ return new Color(c1.r + (c2.r - c1.r) * value,
+ c1.g + (c2.g - c1.g) * value,
+ c1.b + (c2.b - c1.b) * value,
+ c1.a + (c2.a - c1.a) * value);
+ }
+
+ /// http://light11.hatenadiary.com/entry/2018/04/19/194015
+ public static Texture2D GetResized(Texture2D texture, int width, int height)
+ {
+ // リサイズ後のサイズを持つRenderTextureを作成して書き込む
+ var rt = RenderTexture.GetTemporary(width, height);
+ Graphics.Blit(texture, rt);
+
+ // リサイズ後のサイズを持つTexture2Dを作成してRenderTextureから書き込む
+ var preRT = RenderTexture.active;
+ RenderTexture.active = rt;
+ var ret = new Texture2D(width, height);
+ ret.ReadPixels(new Rect(0, 0, width, height), 0, 0);
+ ret.Apply();
+ RenderTexture.active = preRT;
+
+ RenderTexture.ReleaseTemporary(rt);
+ return ret;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs.meta
new file mode 100644
index 00000000..173dc5c1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipEditorHelper.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: fcb56a7eb1db73c4cb9ea1689635b246
+timeCreated: 1541144400
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs
new file mode 100644
index 00000000..2865ed6a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Linq;
+using UnityEngine;
+using UnityEditor;
+using System.IO;
+using UniGLTF;
+
+namespace VRM
+{
+ class BlendShapeClipSelector
+ {
+ BlendShapeAvatar m_avatar;
+
+ public BlendShapeClip Selected
+ {
+ get
+ {
+ if (m_avatar == null || m_avatar.Clips == null)
+ {
+ return null;
+ }
+ if (m_selectedIndex < 0 || m_selectedIndex >= m_avatar.Clips.Count)
+ {
+ return null;
+ }
+ return m_avatar.Clips[m_selectedIndex];
+ }
+ }
+
+ int m_selectedIndex;
+ int SelectedIndex
+ {
+ get { return m_selectedIndex; }
+ set
+ {
+ if (m_selectedIndex == value) return;
+ m_selectedIndex = value;
+ if (m_onSelected != null)
+ {
+ m_onSelected(Selected);
+ }
+ }
+ }
+
+ Action<BlendShapeClip> m_onSelected;
+
+ public BlendShapeClipSelector(BlendShapeAvatar avatar, Action<BlendShapeClip> onSelected)
+ {
+ avatar.RemoveNullClip();
+
+ m_avatar = avatar;
+ m_onSelected = onSelected;
+
+ onSelected(Selected);
+ }
+
+ public void SelectGUI()
+ {
+ if (m_avatar != null && m_avatar.Clips != null)
+ {
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Select BlendShapeClip", EditorStyles.boldLabel);
+ var array = m_avatar.Clips
+ .Select(x => x != null
+ ? BlendShapeKey.CreateFromClip(x).ToString()
+ : "null"
+ ).ToArray();
+ SelectedIndex = GUILayout.SelectionGrid(SelectedIndex, array, 4);
+ }
+
+ if (GUILayout.Button("Add BlendShapeClip"))
+ {
+ var dir = Path.GetDirectoryName(AssetDatabase.GetAssetPath(m_avatar));
+ var path = EditorUtility.SaveFilePanel(
+ "Create BlendShapeClip",
+ dir,
+ string.Format("BlendShapeClip#{0}.asset", m_avatar.Clips.Count),
+ "asset");
+ if (!string.IsNullOrEmpty(path))
+ {
+ var clip = BlendShapeAvatar.CreateBlendShapeClip(path.ToUnityRelativePath());
+ //clip.Prefab = AssetDatabase.LoadAssetAtPath<GameObject>(AssetDatabase.GetAssetPath(target));
+
+ m_avatar.Clips.Add(clip);
+ }
+ }
+ }
+
+ public void DuplicateWarn()
+ {
+ var key = BlendShapeKey.CreateFromClip(Selected);
+ if (m_avatar.Clips.Where(x => key.Match(x)).Count() > 1)
+ {
+ EditorGUILayout.HelpBox("duplicate clip: " + key, MessageType.Error);
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs.meta
new file mode 100644
index 00000000..b5985862
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/BlendShapeClipSelector.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7842ed7a65c676740aa02678316dd625
+timeCreated: 1541138009
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs
new file mode 100644
index 00000000..c12f8d6d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs
@@ -0,0 +1,277 @@
+using UnityEditor;
+using UnityEngine;
+using UnityEditorInternal;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace VRM
+{
+ /// <summary>
+ /// Prefabをインスタンス化してPreviewに表示する
+ ///
+ /// * https://github.com/Unity-Technologies/UnityCsReference/blob/11bcfd801fccd2a52b09bb6fd636c1ddcc9f1705/Editor/Mono/Inspector/ModelInspector.cs
+ ///
+ /// </summary>
+ public abstract class PreviewEditor : Editor
+ {
+ /// <summary>
+ /// PreviewRenderUtilityを管理する。
+ ///
+ /// * PreviewRenderUtility.m_cameraのUnityVersionによる切り分け
+ ///
+ /// </summary>
+ PreviewFaceRenderer m_renderer;
+
+ /// <summary>
+ /// Prefabをインスタンス化したシーンを管理する。
+ ///
+ /// * BlendShapeのBake
+ /// * MaterialMorphの適用
+ /// * Previewカメラのコントロール
+ /// * Previewライティングのコントロール
+ ///
+ /// </summary>
+ PreviewSceneManager m_scene;
+ protected PreviewSceneManager PreviewSceneManager
+ {
+ get { return m_scene; }
+ }
+
+ /// <summary>
+ /// Previewシーンに表示するPrefab
+ /// </summary>
+ GameObject m_prefab;
+ protected GameObject Prefab
+ {
+ get { return m_prefab; }
+ private set
+ {
+ if (m_prefab == value) return;
+
+ //Debug.LogFormat("Prefab = {0}", value);
+ m_prefab = value;
+
+ if (m_scene != null)
+ {
+ //Debug.LogFormat("OnDestroy");
+ GameObject.DestroyImmediate(m_scene.gameObject);
+ m_scene = null;
+ }
+
+ if (m_prefab != null)
+ {
+ m_scene = VRM.PreviewSceneManager.GetOrCreate(m_prefab);
+ if (m_scene != null)
+ {
+ m_scene.gameObject.SetActive(false);
+ }
+
+ Bake();
+ }
+ }
+ }
+
+ protected abstract PreviewSceneManager.BakeValue GetBakeValue();
+
+ /// <summary>
+ /// Preview シーンに BlendShape と MaterialValue を適用する
+ /// </summary>
+ protected void Bake()
+ {
+ if (m_scene != null)
+ {
+ //Debug.Log("Bake");
+ m_scene.Bake(GetBakeValue());
+ }
+ }
+
+ protected virtual GameObject GetPrefab()
+ {
+ var assetPath = AssetDatabase.GetAssetPath(target);
+ if (string.IsNullOrEmpty(assetPath))
+ {
+ return null;
+ }
+
+ var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
+ // search prefab if nothing
+ if (prefab == null && 0 < (target as BlendShapeAvatar).Clips.Count)
+ {
+ prefab = (target as BlendShapeAvatar).Clips[0].Prefab;
+ }
+ // once more, with string-based method
+ if (prefab == null)
+ {
+ var parent = UniGLTF.UnityPath.FromUnityPath(assetPath).Parent;
+ var prefabPath = parent.Parent.Child(parent.FileNameWithoutExtension + ".prefab");
+ prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath.Value);
+ }
+ return prefab;
+ }
+
+ protected virtual void OnEnable()
+ {
+ m_renderer = new PreviewFaceRenderer();
+
+ Prefab = GetPrefab();
+ }
+
+ protected virtual void OnDisable()
+ {
+ if (m_renderer != null)
+ {
+ m_renderer.Dispose();
+ m_renderer = null;
+ }
+ }
+
+ protected virtual void OnDestroy()
+ {
+ if (m_scene != null)
+ {
+ //Debug.LogFormat("OnDestroy");
+ m_scene.Clean();
+ GameObject.DestroyImmediate(m_scene.gameObject);
+ m_scene = null;
+ }
+ }
+
+ protected static void Separator()
+ {
+ EditorGUILayout.Space();
+ EditorGUILayout.BeginHorizontal();
+ //GUILayout.Space();
+ GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
+ EditorGUILayout.EndHorizontal();
+ EditorGUILayout.Space();
+ }
+
+ public override void OnInspectorGUI()
+ {
+ //base.OnInspectorGUI();
+
+ Prefab = (GameObject)EditorGUILayout.ObjectField("Preview Prefab", Prefab, typeof(GameObject), false);
+
+ //Separator();
+ }
+
+ private static int sliderHash = "Slider".GetHashCode();
+ float m_yaw = 180.0f;
+ float m_pitch;
+ Vector3 m_position = new Vector3(0, 0, -0.8f);
+
+ // very important to override this, it tells Unity to render an ObjectPreview at the bottom of the inspector
+ public override bool HasPreviewGUI() { return true; }
+
+ public RenderTexture PreviewTexture;
+
+ // the main ObjectPreview function... it's called constantly, like other IMGUI On*GUI() functions
+ public override void OnPreviewGUI(Rect r, GUIStyle background)
+ {
+ // if this is happening, you have bigger problems
+ if (!ShaderUtil.hardwareSupportsRectRenderTexture)
+ {
+ if (Event.current.type == EventType.Repaint)
+ {
+ EditorGUI.DropShadowLabel(new Rect(r.x, r.y, r.width, 40f),
+ "Mesh preview requires\nrender texture support");
+ }
+ return;
+ }
+
+ var src = r;
+
+ var min = Mathf.Min(r.width, r.height);
+ r.width = min;
+ r.height = min;
+ r.x = src.x + (src.width - min) / 2;
+ r.y = src.y + (src.height - min) / 2;
+
+ //previewDir = Drag2D(previewDir, r);
+ {
+ int controlId = GUIUtility.GetControlID(sliderHash, FocusType.Passive);
+ Event e = Event.current;
+ switch (e.GetTypeForControl(controlId))
+ {
+ case EventType.MouseDown:
+ if (r.Contains(e.mousePosition) && (double)r.width > 50.0)
+ {
+ GUIUtility.hotControl = controlId;
+ e.Use();
+ EditorGUIUtility.SetWantsMouseJumping(1);
+ break;
+ }
+ break;
+
+ case EventType.MouseUp:
+ if (GUIUtility.hotControl == controlId)
+ GUIUtility.hotControl = 0;
+ EditorGUIUtility.SetWantsMouseJumping(0);
+ break;
+
+ case EventType.MouseDrag:
+ if (GUIUtility.hotControl == controlId)
+ {
+ if (e.button == 2)
+ {
+ var shift = e.delta * (!e.shift ? 1f : 3f) / Mathf.Min(r.width, r.height);
+ m_position.x -= shift.x;
+ m_position.y += shift.y;
+ e.Use();
+ GUI.changed = true;
+ }
+ else if (
+ e.button == 0 ||
+ e.button == 1)
+ {
+ var shift = e.delta * (!e.shift ? 1f : 3f) / Mathf.Min(r.width, r.height) * 140f;
+ m_yaw += shift.x;
+ m_pitch += shift.y;
+ m_pitch = Mathf.Clamp(m_pitch, -90f, 90f);
+ e.Use();
+ GUI.changed = true;
+ }
+ break;
+ }
+ break;
+
+ case EventType.ScrollWheel:
+ //Debug.LogFormat("wheel: {0}", current.delta);
+ if (r.Contains(e.mousePosition))
+ {
+ if (e.delta.y > 0)
+ {
+ m_position.z *= 1.1f;
+ Repaint();
+ }
+ else if (e.delta.y < 0)
+ {
+ m_position.z *= 0.9f;
+ Repaint();
+ }
+ }
+ break;
+ }
+ //return scrollPosition;
+ }
+ //Debug.LogFormat("{0}", previewDir);
+
+ if (Event.current.type != EventType.Repaint)
+ {
+ // if we don't need to update yet, then don't
+ return;
+ }
+
+ if (m_renderer != null && m_scene != null)
+ {
+ PreviewTexture = m_renderer.Render(r, background, m_scene, m_yaw, m_pitch, m_position) as RenderTexture;
+ if (PreviewTexture != null)
+ {
+ // draw the RenderTexture in the ObjectPreview pane
+ GUI.DrawTexture(r, PreviewTexture, ScaleMode.StretchToFill, false);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs.meta
new file mode 100644
index 00000000..49dab878
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 3eee31718196e8e41a491f9a4f650ac7
+timeCreated: 1523201293
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs
new file mode 100644
index 00000000..641de550
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs
@@ -0,0 +1,168 @@
+using System;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+ /// <summary>
+ /// based
+ ///
+ /// * https://gist.github.com/radiatoryang/a2282d44ba71848e498bb2e03da98991
+ /// </summary>
+
+ /// <summary>
+ /// PreviewRenderUtilityを管理する
+ /// PreviewSceneをレンダリングする
+ /// </summary>
+ public class PreviewFaceRenderer : IDisposable
+ {
+ PreviewRenderUtility m_previewUtility;
+ public Camera PreviewCamera
+ {
+ get
+ {
+#if UNITY_2017_1_OR_NEWER
+ return m_previewUtility.camera;
+#else
+ return m_previewUtility.m_Camera;
+#endif
+ }
+ }
+
+ public Light[] PreviewLights
+ {
+ get
+ {
+#if UNITY_2017_1_OR_NEWER
+ return m_previewUtility.lights;
+#else
+ return m_previewUtility.m_Light;
+#endif
+ }
+ }
+
+ public void SetAmbientColor(Color color)
+ {
+#if UNITY_2017_1_OR_NEWER
+ m_previewUtility.ambientColor = color;
+#else
+ // ?
+#endif
+ }
+
+ public PreviewFaceRenderer()
+ {
+ m_previewUtility = new PreviewRenderUtility();
+
+ foreach (var light in PreviewLights)
+ {
+ if (light == null) continue;
+ light.intensity = 0f;
+ }
+
+ if (PreviewLights.Length > 0 && PreviewLights[0] != null)
+ {
+ PreviewLights[0].intensity = 1f;
+ PreviewLights[0].transform.rotation = Quaternion.Euler(20f, 200f, 0);
+ PreviewLights[0].color = new Color(1f, 1f, 1f, 1f);
+ }
+
+ SetAmbientColor(new Color(0.1f, 0.1f, 0.1f, 1f));
+ }
+
+ class FogScope : IDisposable
+ {
+ bool fog;
+
+ public FogScope()
+ {
+ fog = RenderSettings.fog; // ... let's remember the current fog setting...
+ // we are technically rendering everything in the scene, so scene fog might affect it...
+ Unsupported.SetRenderSettingsUseFogNoDirty(false); // ... and then temporarily turn it off
+ }
+
+ public void Dispose()
+ {
+ Unsupported.SetRenderSettingsUseFogNoDirty(fog);
+ }
+ }
+
+ //const float FACTOR = 0.1f;
+
+ public Texture Render(Rect r, GUIStyle background, PreviewSceneManager scene,
+ float yaw, float pitch, Vector3 position)
+ {
+ if (scene == null) return null;
+
+ using (var fog = new FogScope())
+ {
+ m_previewUtility.BeginPreview(r, background); // set up the PreviewRenderUtility's mini internal scene
+
+ // setup the ObjectPreview's camera
+ scene.SetupCamera(PreviewCamera, scene.TargetPosition, yaw, pitch, position);
+
+ foreach (var item in scene.EnumRenderItems)
+ {
+ // now, actually render out the RenderTexture
+ //RenderMeshPreview(previewMesh, skinMeshRender.sharedMaterials);
+ // submesh support, in case the mesh is made of multiple parts
+ int subMeshCount = item.Mesh.subMeshCount;
+ for (int i = 0; i < subMeshCount; i++)
+ {
+ m_previewUtility.DrawMesh(item.Mesh,
+ item.Position, item.Rotation,
+ item.Materials[i], i);
+ }
+ }
+
+ // VERY IMPORTANT: this manually tells the camera to render and produce the render texture
+ PreviewCamera.Render();
+ //m_previewUtility.Render(false, false);
+
+ // reset the scene's fog from before
+ return m_previewUtility.EndPreview();
+ }
+ }
+
+ #region IDisposable Support
+ private bool disposedValue = false; // 重複する呼び出しを検出するには
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ if (disposing)
+ {
+ // TODO: マネージ状態を破棄します (マネージ オブジェクト)。
+ if (this.m_previewUtility != null)
+ {
+ this.m_previewUtility.Cleanup();
+ this.m_previewUtility = null;
+ }
+ }
+
+ // TODO: アンマネージ リソース (アンマネージ オブジェクト) を解放し、下のファイナライザーをオーバーライドします。
+ // TODO: 大きなフィールドを null に設定します。
+
+ disposedValue = true;
+ }
+ }
+
+ // TODO: 上の Dispose(bool disposing) にアンマネージ リソースを解放するコードが含まれる場合にのみ、ファイナライザーをオーバーライドします。
+ // ~PreviewFaceRenderer() {
+ // // このコードを変更しないでください。クリーンアップ コードを上の Dispose(bool disposing) に記述します。
+ // Dispose(false);
+ // }
+
+ // このコードは、破棄可能なパターンを正しく実装できるように追加されました。
+ public void Dispose()
+ {
+ // このコードを変更しないでください。クリーンアップ コードを上の Dispose(bool disposing) に記述します。
+ Dispose(true);
+ // TODO: 上のファイナライザーがオーバーライドされる場合は、次の行のコメントを解除してください。
+ // GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs.meta
new file mode 100644
index 00000000..4c49174e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/PreviewFaceRenderer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b59705d1618086148b505c2c3d9f1992
+timeCreated: 1522931965
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs
new file mode 100644
index 00000000..17112291
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs
@@ -0,0 +1,309 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEditor;
+using UnityEditorInternal;
+using UnityEngine;
+
+namespace VRM
+{
+ public class SerializedBlendShapeEditor
+ {
+ BlendShapeClip m_targetObject;
+
+ SerializedObject m_serializedObject;
+
+ #region Properties
+ SerializedProperty m_thumbnail;
+ SerializedProperty m_blendShapeNameProp;
+ SerializedProperty m_presetProp;
+
+ SerializedProperty m_isBinaryProp;
+ #endregion
+
+ #region BlendShapeBind
+ public static int BlendShapeBindingHeight = 60;
+ ReorderableList m_ValuesList;
+
+ SerializedProperty m_valuesProp;
+ #endregion
+
+ #region MaterialValueBind
+ const int MaterialValueBindingHeight = 90;
+ ReorderableList m_MaterialValuesList;
+
+ SerializedProperty m_materialsProp;
+ #endregion
+
+ #region Editor values
+ //float m_previewSlider = 1.0f;
+
+ bool m_changed;
+
+ int m_mode;
+ static string[] MODES = new[]{
+ "BlendShape",
+ "BlendShape List",
+ "Material List"
+ };
+
+ MeshPreviewItem[] m_items;
+ #endregion
+
+ public SerializedBlendShapeEditor(SerializedObject serializedObject,
+ PreviewSceneManager previewSceneManager) : this(
+ serializedObject, (BlendShapeClip)serializedObject.targetObject, previewSceneManager)
+ { }
+
+ public SerializedBlendShapeEditor(BlendShapeClip blendShapeClip,
+ PreviewSceneManager previewSceneManager) : this(
+ new SerializedObject(blendShapeClip), blendShapeClip, previewSceneManager)
+ { }
+
+ public SerializedBlendShapeEditor(SerializedObject serializedObject, BlendShapeClip targetObject,
+ PreviewSceneManager previewSceneManager)
+ {
+ this.m_serializedObject = serializedObject;
+ this.m_targetObject = targetObject;
+
+ //m_thumbnail = serializedObject.FindProperty("Thumbnail");
+ m_blendShapeNameProp = serializedObject.FindProperty("BlendShapeName");
+ m_presetProp = serializedObject.FindProperty("Preset");
+ m_isBinaryProp = serializedObject.FindProperty("IsBinary");
+
+ m_valuesProp = serializedObject.FindProperty("Values");
+
+ m_ValuesList = new ReorderableList(serializedObject, m_valuesProp);
+ m_ValuesList.elementHeight = BlendShapeBindingHeight;
+ m_ValuesList.drawElementCallback =
+ (rect, index, isActive, isFocused) =>
+ {
+ var element = m_valuesProp.GetArrayElementAtIndex(index);
+ rect.height -= 4;
+ rect.y += 2;
+ if (BlendShapeClipEditorHelper.DrawBlendShapeBinding(rect, element, previewSceneManager))
+ {
+ m_changed = true;
+ }
+ };
+
+ m_materialsProp = serializedObject.FindProperty("MaterialValues");
+ m_MaterialValuesList = new ReorderableList(serializedObject, m_materialsProp);
+ m_MaterialValuesList.elementHeight = MaterialValueBindingHeight;
+ m_MaterialValuesList.drawElementCallback =
+ (rect, index, isActive, isFocused) =>
+ {
+ var element = m_materialsProp.GetArrayElementAtIndex(index);
+ rect.height -= 4;
+ rect.y += 2;
+ if (BlendShapeClipEditorHelper.DrawMaterialValueBinding(rect, element, previewSceneManager))
+ {
+ m_changed = true;
+ }
+ };
+
+ m_items = previewSceneManager.EnumRenderItems
+ .Where(x => x.SkinnedMeshRenderer != null)
+ .ToArray();
+ }
+
+ public struct DrawResult
+ {
+ public bool Changed;
+
+ public BlendShapeBinding[] BlendShapeBindings;
+
+ public MaterialValueBinding[] MaterialValueBindings;
+ }
+
+ public DrawResult Draw()
+ {
+ m_changed = false;
+
+ m_serializedObject.Update();
+
+ // Readonly のBlendShapeClip参照
+ GUI.enabled = false;
+ EditorGUILayout.ObjectField("Current clip",
+ m_targetObject, typeof(BlendShapeClip), false);
+ GUI.enabled = true;
+
+ EditorGUILayout.PropertyField(m_blendShapeNameProp, true);
+ EditorGUILayout.PropertyField(m_presetProp, true);
+
+ // v0.45 Added. Binary flag
+ EditorGUILayout.PropertyField(m_isBinaryProp, true);
+
+ EditorGUILayout.Space();
+ //m_mode = EditorGUILayout.Popup("SourceType", m_mode, MODES);
+ m_mode = GUILayout.Toolbar(m_mode, MODES);
+ switch (m_mode)
+ {
+ case 0:
+ {
+ ClipGUI();
+ }
+ break;
+
+ case 1:
+ {
+ if (GUILayout.Button("Clear"))
+ {
+ m_changed = true;
+ m_valuesProp.arraySize = 0;
+ }
+ m_ValuesList.DoLayoutList();
+ }
+ break;
+
+ case 2:
+ {
+ if (GUILayout.Button("Clear"))
+ {
+ m_changed = true;
+ m_materialsProp.arraySize = 0;
+ }
+ m_MaterialValuesList.DoLayoutList();
+ }
+ break;
+ }
+
+ m_serializedObject.ApplyModifiedProperties();
+
+ return new DrawResult
+ {
+ Changed = m_changed,
+ BlendShapeBindings = m_targetObject.Values,
+ MaterialValueBindings = m_targetObject.MaterialValues
+ };
+ }
+
+ void ClipGUI()
+ {
+ var changed = BlendShapeBindsGUI();
+ if (changed)
+ {
+ string maxWeightName;
+ var bindings = GetBindings(out maxWeightName);
+ m_valuesProp.ClearArray();
+ m_valuesProp.arraySize = bindings.Length;
+ for (int i = 0; i < bindings.Length; ++i)
+ {
+ var item = m_valuesProp.GetArrayElementAtIndex(i);
+
+ var endProperty = item.GetEndProperty();
+ while (item.NextVisible(true))
+ {
+ if (SerializedProperty.EqualContents(item, endProperty))
+ {
+ break;
+ }
+
+ switch (item.name)
+ {
+ case "RelativePath":
+ item.stringValue = bindings[i].RelativePath;
+ break;
+
+ case "Index":
+ item.intValue = bindings[i].Index;
+ break;
+
+ case "Weight":
+ item.floatValue = bindings[i].Weight;
+ break;
+
+ default:
+ throw new Exception();
+ }
+ }
+ }
+
+ m_changed = true;
+ }
+ }
+
+ List<bool> m_meshFolds = new List<bool>();
+ bool BlendShapeBindsGUI()
+ {
+ bool changed = false;
+ int foldIndex = 0;
+ // すべてのSkinnedMeshRendererを列挙する
+ foreach (var renderer in m_items.Select(x => x.SkinnedMeshRenderer))
+ {
+ var mesh = renderer.sharedMesh;
+ if (mesh != null && mesh.blendShapeCount > 0)
+ {
+ //var relativePath = UniGLTF.UnityExtensions.RelativePathFrom(renderer.transform, m_target.transform);
+ //EditorGUILayout.LabelField(m_target.name + "/" + item.Path);
+
+ if (foldIndex >= m_meshFolds.Count)
+ {
+ m_meshFolds.Add(false);
+ }
+ m_meshFolds[foldIndex] = EditorGUILayout.Foldout(m_meshFolds[foldIndex], renderer.name);
+ if (m_meshFolds[foldIndex])
+ {
+ //EditorGUI.indentLevel += 1;
+ for (int i = 0; i < mesh.blendShapeCount; ++i)
+ {
+ var src = renderer.GetBlendShapeWeight(i);
+ var dst = EditorGUILayout.Slider(mesh.GetBlendShapeName(i), src, 0, 100.0f);
+ if (dst != src)
+ {
+ renderer.SetBlendShapeWeight(i, dst);
+ changed = true;
+ }
+ }
+ //EditorGUI.indentLevel -= 1;
+ }
+ ++foldIndex;
+ }
+ }
+ return changed;
+ }
+
+ BlendShapeBinding[] GetBindings(out string _maxWeightName)
+ {
+ var maxWeight = 0.0f;
+ var maxWeightName = "";
+ // weightのついたblendShapeを集める
+ var values = m_items
+ .SelectMany(x =>
+ {
+ var mesh = x.SkinnedMeshRenderer.sharedMesh;
+
+ var relativePath = x.Path;
+
+ var list = new List<BlendShapeBinding>();
+ if (mesh != null)
+ {
+ for (int i = 0; i < mesh.blendShapeCount; ++i)
+ {
+ var weight = x.SkinnedMeshRenderer.GetBlendShapeWeight(i);
+ if (weight == 0)
+ {
+ continue;
+ }
+ var name = mesh.GetBlendShapeName(i);
+ if (weight > maxWeight)
+ {
+ maxWeightName = name;
+ maxWeight = weight;
+ }
+ list.Add(new BlendShapeBinding
+ {
+ Index = i,
+ RelativePath = relativePath,
+ Weight = weight
+ });
+ }
+ }
+ return list;
+ }).ToArray()
+ ;
+ _maxWeightName = maxWeightName;
+ return values;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs.meta
new file mode 100644
index 00000000..209e1f5b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/SerializedBlendShapeClipEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: eaafa3ff7bf991642b922e6af7ecbbc0
+timeCreated: 1541081003
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs
new file mode 100644
index 00000000..743bb5eb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs
@@ -0,0 +1,71 @@
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+using System.Linq;
+
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMBlendShapeProxy))]
+ public class VRMBlendShapeProxyEditor : Editor
+ {
+ VRMBlendShapeProxy m_target;
+ SkinnedMeshRenderer[] m_renderers;
+
+ public class BlendShapeSlider
+ {
+ VRMBlendShapeProxy m_target;
+ BlendShapeKey m_key;
+
+ public BlendShapeSlider(VRMBlendShapeProxy target, BlendShapeKey key)
+ {
+ m_target = target;
+ m_key = key;
+ }
+
+ public KeyValuePair<BlendShapeKey, float> Slider()
+ {
+ var oldValue = m_target.GetValue(m_key);
+ var enable = GUI.enabled;
+ GUI.enabled = Application.isPlaying;
+ var newValue = EditorGUILayout.Slider(m_key.ToString(), oldValue, 0, 1.0f);
+ GUI.enabled = enable;
+ return new KeyValuePair<BlendShapeKey, float>(m_key, newValue);
+ }
+ }
+ List<BlendShapeSlider> m_sliders;
+
+ void OnEnable()
+ {
+ m_target = (VRMBlendShapeProxy)target;
+ if (m_target.BlendShapeAvatar != null && m_target.BlendShapeAvatar.Clips != null)
+ {
+ m_sliders = m_target.BlendShapeAvatar.Clips
+ .Where(x => x != null)
+ .Select(x => new BlendShapeSlider(m_target, BlendShapeKey.CreateFromClip(x)))
+ .ToList()
+ ;
+ }
+ }
+
+ public override void OnInspectorGUI()
+ {
+ base.OnInspectorGUI();
+
+ if (!Application.isPlaying)
+ {
+ EditorGUILayout.HelpBox("Enable when playing", MessageType.Info);
+ }
+
+ if (m_target.BlendShapeAvatar == null)
+ {
+ return;
+ }
+
+ if (m_sliders != null)
+ {
+ m_target.SetValues(m_sliders.Select(x => x.Slider()));
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs.meta
new file mode 100644
index 00000000..7d4c2095
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 0f9ca53e9d292ce48a7e6449a03734a9
+timeCreated: 1517819499
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs
new file mode 100644
index 00000000..898aac57
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs
@@ -0,0 +1,76 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VRM
+{
+ public static class VRMBlendShapeProxyValidator
+ {
+ public static IEnumerable<Validation> Validate(this VRMBlendShapeProxy p)
+ {
+ if (p == null)
+ {
+ yield return Validation.Error("VRMBlendShapeProxy is null");
+ yield break;
+ }
+
+ if (p.BlendShapeAvatar == null)
+ {
+ yield return Validation.Error("BlendShapeAvatar is null");
+ yield break;
+ }
+
+ // presetがユニークか
+ var used = new HashSet<BlendShapeKey>();
+ foreach (var c in p.BlendShapeAvatar.Clips)
+ {
+ var key = c.Key;
+ if (used.Contains(key))
+ {
+ yield return Validation.Error($"duplicated BlendShapeKey: {key}");
+ }
+ else
+ {
+ used.Add(key);
+ }
+ }
+
+ var materialNames = new HashSet<string>();
+ foreach (var r in p.GetComponentsInChildren<Renderer>(true))
+ {
+ foreach (var m in r.sharedMaterials)
+ {
+ if (m != null)
+ {
+ if (!materialNames.Contains(m.name))
+ {
+ materialNames.Add(m.name);
+ }
+ }
+ }
+ }
+
+ // 参照が生きているか
+ foreach (var c in p.BlendShapeAvatar.Clips)
+ {
+ for (int i = 0; i < c.Values.Length; ++i)
+ {
+ var v = c.Values[i];
+ var target = p.transform.Find(v.RelativePath);
+ if (target == null)
+ {
+ yield return Validation.Warning($"{c}.Values[{i}].RelativePath({v.RelativePath} is not found");
+ }
+ }
+
+ for (int i = 0; i < c.MaterialValues.Length; ++i)
+ {
+ var v = c.MaterialValues[i];
+ if (!materialNames.Contains(v.MaterialName))
+ {
+ yield return Validation.Warning($"{c}.MaterialValues[{i}].MaterialName({v.MaterialName} is not found");
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs.meta
new file mode 100644
index 00000000..c17ae8d8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/BlendShape/VRMBlendShapeProxyValidator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 50a28b39ccee4874b85d99c095180e5a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs
new file mode 100644
index 00000000..38c8ed01
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs
@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEditor;
+
+namespace VRM.M17N
+{
+ /// <summary>
+ /// 多言語対応
+ /// </summary>
+ public enum Languages
+ {
+ ja,
+ en,
+ }
+
+ [System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
+ public class LangMsgAttribute : System.Attribute
+ {
+ public Languages Language;
+ public string Message;
+
+ public LangMsgAttribute(Languages language, string msg)
+ {
+ Language = language;
+ Message = msg;
+ }
+ }
+
+ public enum VRMExporterWizardMessages
+ {
+ [LangMsg(Languages.ja, "ExportRootをセットしてください")]
+ [LangMsg(Languages.en, "Please set up a ExportRoot for model export")]
+ ROOT_EXISTS,
+
+ [LangMsg(Languages.ja, "ExportRootに親はオブジェクトは持てません")]
+ [LangMsg(Languages.en, "ExportRoot must be topmost parent")]
+ NO_PARENT,
+
+ [LangMsg(Languages.ja, "ExportRootに回転・拡大縮小は持てません。子階層で回転・拡大縮小してください")]
+ [LangMsg(Languages.en, "ExportRoot's rotation and scaling are not allowed to change. Please set up rotation and scaling in child node")]
+ ROOT_WITHOUT_ROTATION_AND_SCALING_CHANGED,
+
+ [LangMsg(Languages.ja, "シーンに出していない Prefab はエクスポートできません(細かい挙動が違い、想定外の動作をところがあるため)。シーンに展開してからエクスポートしてください")]
+ [LangMsg(Languages.en, "Prefab Asset cannot be exported. Prefab Asset has different behaviour with Scene GameObject. Please put the prefab into the scene")]
+ PREFAB_CANNOT_EXPORT,
+
+ [LangMsg(Languages.ja, "回転・拡大縮小を持つノードが含まれています。正規化が必用です。Setting の PoseFreeze を有効にしてください")]
+ [LangMsg(Languages.en, " Normalization is required. There are nodes (child GameObject) where rotation and scaling are not default. Please enable PoseFreeze")]
+ ROTATION_OR_SCALEING_INCLUDED_IN_NODE,
+
+ [LangMsg(Languages.ja, "正規化済みです。Setting の PoseFreeze は不要です")]
+ [LangMsg(Languages.en, "Normalization has been done. PoseFreeze is not required")]
+ IS_POSE_FREEZE_DONE,
+
+ [LangMsg(Languages.ja, "ExportRootに Animator がありません")]
+ [LangMsg(Languages.en, "No Animator in ExportRoot")]
+ NO_ANIMATOR,
+
+ [LangMsg(Languages.ja, "Z+ 向きにしてください")]
+ [LangMsg(Languages.en, "The model needs to face the positive Z-axis")]
+ FACE_Z_POSITIVE_DIRECTION,
+
+ [LangMsg(Languages.ja, "ExportRootの Animator に Avatar がありません")]
+ [LangMsg(Languages.en, "No Avatar in ExportRoot's Animator")]
+ NO_AVATAR_IN_ANIMATOR,
+
+ [LangMsg(Languages.ja, "ExportRootの Animator.Avatar が不正です")]
+ [LangMsg(Languages.en, "Animator.avatar in ExportRoot is not valid")]
+ AVATAR_IS_NOT_VALID,
+
+ [LangMsg(Languages.ja, "ExportRootの Animator.Avatar がヒューマノイドではありません。FBX importer の Rig で設定してください")]
+ [LangMsg(Languages.en, "Animator.avatar is not humanoid. Please change model's AnimationType to humanoid")]
+ AVATAR_IS_NOT_HUMANOID,
+
+ [LangMsg(Languages.ja, "humanoid設定に顎が含まれている。FBX importer の rig 設定に戻って設定を解除することをおすすめします")]
+ [LangMsg(Languages.en, "Jaw bone is included. It may not what you intended. Please check the humanoid avatar setting screen")]
+ JAW_BONE_IS_INCLUDED,
+
+ [LangMsg(Languages.ja, "ヒエラルキーの中に同じ名前のGameObjectが含まれている。 エクスポートした場合に自動でリネームする")]
+ [LangMsg(Languages.en, "There are bones with the same name in the hierarchy. They will be automatically renamed after export")]
+ DUPLICATE_BONE_NAME_EXISTS,
+
+ [LangMsg(Languages.ja, "VRMBlendShapeProxyが必要です。先にVRMフォーマットに変換してください")]
+ [LangMsg(Languages.en, "VRMBlendShapeProxy is required. Please convert to VRM format first")]
+ NEEDS_VRM_BLENDSHAPE_PROXY,
+
+ [LangMsg(Languages.en, "This model contains vertex color")]
+ [LangMsg(Languages.ja, "ヒエラルキーに含まれる mesh に頂点カラーが含まれている")]
+ VERTEX_COLOR_IS_INCLUDED,
+
+ [LangMsg(Languages.ja, "ヒエラルキーに active なメッシュが含まれていない")]
+ [LangMsg(Languages.en, "No active mesh")]
+ NO_ACTIVE_MESH,
+
+ [LangMsg(Languages.ja, "Standard, Unlit, MToon 以外のマテリアルは、Standard になります")]
+ [LangMsg(Languages.en, "It will export as `Standard` fallback")]
+ UNKNOWN_SHADER,
+
+ [LangMsg(Languages.ja, "名前が長すぎる。リネームしてください: ")]
+ [LangMsg(Languages.en, "FileName is too long: ")]
+ FILENAME_TOO_LONG,
+ }
+
+ static class MsgCache<T> where T : Enum
+ {
+ static Dictionary<Languages, Dictionary<T, string>> s_cache = new Dictionary<Languages, Dictionary<T, string>>();
+
+ static LangMsgAttribute GetAttribute(T value, Languages language)
+ {
+ var t = typeof(T);
+ var memberInfos = t.GetMember(value.ToString());
+ var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == t);
+ var attr = enumValueMemberInfo.GetCustomAttributes(typeof(LangMsgAttribute), false).Select(x => (LangMsgAttribute)x).ToArray();
+ if (attr == null || attr.Length == 0)
+ {
+ return null;
+ }
+ var match = attr.FirstOrDefault(x => x.Language == language);
+ if (match != null)
+ {
+ return match;
+ }
+ return attr.First();
+ }
+
+ public static string Get(Languages language, T key)
+ {
+ if (!s_cache.TryGetValue(language, out Dictionary<T, string> map))
+ {
+ map = new Dictionary<T, string>();
+
+ var t = typeof(T);
+ foreach (T value in Enum.GetValues(t))
+ {
+ var match = GetAttribute(value, language);
+ // Attribute。無かったら enum の ToString
+ map.Add(value, match != null ? match.Message : key.ToString());
+ }
+
+ s_cache.Add(language, map);
+ }
+ return map[key];
+ }
+ }
+ public static class Getter
+ {
+ const string LANG_KEY = "VRM_LANG";
+
+ static Languages? m_lang;
+
+ public static Languages Lang
+ {
+ get
+ {
+ if (!m_lang.HasValue)
+ {
+ m_lang = EnumUtil.TryParseOrDefault<Languages>(EditorPrefs.GetString(LANG_KEY, default(Languages).ToString()));
+ }
+ return m_lang.Value;
+ }
+ }
+
+ public static string Msg<T>(T key) where T : Enum
+ {
+ return M17N.MsgCache<T>.Get(Lang, key);
+ }
+
+ public static void OnGuiSelectLang()
+ {
+ var lang = (M17N.Languages)EditorGUILayout.EnumPopup("lang", Lang);
+ if (lang != Lang)
+ {
+ m_lang = lang;
+ EditorPrefs.SetString(LANG_KEY, M17N.Getter.Lang.ToString());
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs.meta
new file mode 100644
index 00000000..179168ee
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/EditorLanguages.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7829d135d35830f4bb9235eb10b3de1f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs
new file mode 100644
index 00000000..86c7445f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs
@@ -0,0 +1,19 @@
+using System.Linq;
+using MeshUtility;
+using UnityEngine;
+
+namespace VRM
+{
+ public static class ExporterExtensions
+ {
+ public static bool EnableForExport(this Component mono)
+ {
+ if (mono.transform.Ancestors().Any(x => !x.gameObject.activeSelf))
+ {
+ // 自分か祖先に !activeSelf がいる
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs.meta
new file mode 100644
index 00000000..91082a7c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/ExporterExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 84a3f0f4ae5319a46839f08a76ae0edd
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson.meta
new file mode 100644
index 00000000..9a822339
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f5e58f0fdf4d1c9488760d699fa491ef
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs
new file mode 100644
index 00000000..0e2e57cf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs
@@ -0,0 +1,30 @@
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [CustomPropertyDrawer(typeof(VRMFirstPerson.RendererFirstPersonFlags))]
+ public class RendererFirstPersonFlagsDrawer : PropertyDrawer
+ {
+ static Rect LeftSide(Rect position, float width)
+ {
+ return new Rect(position.x, position.y, position.width - width, position.height);
+ }
+ static Rect RightSide(Rect position, float width)
+ {
+ return new Rect(position.x + (position.width - width), position.y, width, position.height);
+ }
+
+ public override void OnGUI(Rect position,
+ SerializedProperty property, GUIContent label)
+ {
+ var rendererProp = property.FindPropertyRelative("Renderer");
+ var flagProp = property.FindPropertyRelative("FirstPersonFlag");
+
+ const float WIDTH = 140.0f;
+ EditorGUI.PropertyField(LeftSide(position, WIDTH), rendererProp, new GUIContent(""), true);
+ EditorGUI.PropertyField(RightSide(position, WIDTH), flagProp, new GUIContent(""), true);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs.meta
new file mode 100644
index 00000000..b75e211c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/RendererFirstPersonFlagsDrawer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ddbc54a3a83438841a744bf50b34ebb9
+timeCreated: 1520848617
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs
new file mode 100644
index 00000000..5d478112
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs
@@ -0,0 +1,88 @@
+using UnityEditor;
+using UnityEngine;
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMFirstPerson))]
+ class VRMFirstPersonEditor : Editor
+ {
+ VRMFirstPerson m_target;
+
+ void OnEnable()
+ {
+ m_target = target as VRMFirstPerson;
+ }
+
+ void OnDisable()
+ {
+
+ }
+
+ /// <summary>
+ /// SceneView gizmo
+ /// </summary>
+ void OnSceneGUI()
+ {
+ var head = m_target.FirstPersonBone;
+ if (head == null)
+ {
+ return;
+ }
+
+ EditorGUI.BeginChangeCheck();
+
+ var worldOffset = head.localToWorldMatrix.MultiplyPoint(m_target.FirstPersonOffset);
+ worldOffset = Handles.PositionHandle(worldOffset, head.rotation);
+
+ Handles.Label(worldOffset, "FirstPersonOffset");
+
+ if (EditorGUI.EndChangeCheck())
+ {
+ Undo.RecordObject(m_target, "Changed FirstPerson");
+
+ m_target.FirstPersonOffset = head.worldToLocalMatrix.MultiplyPoint(worldOffset);
+ }
+ }
+
+ public static void Separator(int indentLevel = 0)
+ {
+ EditorGUILayout.BeginHorizontal();
+ GUILayout.Space(indentLevel * 15);
+ GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
+ EditorGUILayout.EndHorizontal();
+ }
+
+ public override void OnInspectorGUI()
+ {
+ VRMFirstPersonValidator.Hierarchy = m_target.transform.GetComponentsInChildren<Transform>(true);
+
+ // show vaildation
+ bool isValid = true;
+ for (int i = 0; i < m_target.Renderers.Count; ++i)
+ {
+ if (VRMFirstPersonValidator.IsValid(m_target.Renderers[i], $"Renderers[{i}]", out Validation v))
+ {
+ continue;
+ }
+ if (isValid)
+ {
+ EditorGUILayout.LabelField("Validation Errors");
+ }
+ v.DrawGUI();
+ isValid = false;
+ }
+ if (!isValid)
+ {
+ if (GUILayout.Button("reset renderers"))
+ {
+ m_target.TraverseRenderers();
+ }
+ GUILayout.Space(10);
+ Separator();
+ GUILayout.Space(10);
+ }
+
+ base.OnInspectorGUI();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs.meta
new file mode 100644
index 00000000..3af9542c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e68be7adce7f09d4287af62a2bac63d7
+timeCreated: 1545891764
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs
new file mode 100644
index 00000000..f7cd0a80
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs
@@ -0,0 +1,48 @@
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+namespace VRM
+{
+ public static class VRMFirstPersonValidator
+ {
+ public static Transform[] Hierarchy;
+
+ public static bool IsValid(this VRMFirstPerson.RendererFirstPersonFlags r, string name, out Validation validation)
+ {
+ if (r.Renderer == null)
+ {
+ validation = Validation.Error($"{name}.Renderer is null");
+ return false;
+ }
+
+ if (!Hierarchy.Contains(r.Renderer.transform))
+ {
+ validation = Validation.Error($"{name}.Renderer is out of hierarchy");
+ return false;
+ }
+
+ if (!r.Renderer.EnableForExport())
+ {
+ validation = Validation.Error($"{name}.Renderer is not active");
+ return false;
+ }
+
+ validation = default;
+ return true;
+ }
+
+ public static IEnumerable<Validation> Validate(this VRMFirstPerson self)
+ {
+ Hierarchy = self.GetComponentsInChildren<Transform>(true);
+
+ for (int i = 0; i < self.Renderers.Count; ++i)
+ {
+ if (!IsValid(self.Renderers[i], $"[VRMFirstPerson]{self.name}.Renderers[{i}]", out Validation v))
+ {
+ yield return v;
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs.meta
new file mode 100644
index 00000000..1c881b70
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/FirstPerson/VRMFirstPersonValidator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 48854dc6374b64d45a8a5e099bf5ced0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format.meta
new file mode 100644
index 00000000..bfe0a6a6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 127df51bf554ee64cbe91b05e14a9266
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs
new file mode 100644
index 00000000..cc3f0557
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs
@@ -0,0 +1,26 @@
+using System;
+using UnityEditor;
+
+namespace VRM
+{
+ /// <summary>
+ /// UndoをGroupを開始して、DisposeでUndoする。
+ /// using で使うのを想定。
+ /// using ブロック内で Undo されるべき操作をする。
+ /// </summary>
+ public struct RecordDisposer : IDisposable
+ {
+ int _group;
+ public RecordDisposer(UnityEngine.Object[] objects, string msg)
+ {
+ Undo.IncrementCurrentGroup();
+ _group = Undo.GetCurrentGroup();
+ Undo.RecordObjects(objects, msg);
+ }
+
+ public void Dispose()
+ {
+ Undo.RevertAllDownToGroup(_group);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs.meta
new file mode 100644
index 00000000..5cf6bf1e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/RecordDisposer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b304ed2aeece5a54191a5a8b69d9d113
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs
new file mode 100644
index 00000000..3e2b64f7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs
@@ -0,0 +1,311 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using UniGLTF;
+using UniJSON;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public static class VRMAOTMenu
+ {
+ /// <summary>
+ /// AOT向けにダミーのGenerics呼び出しを作成する
+ /// </summary>
+#if VRM_DEVELOP
+ [MenuItem(VRMVersion.MENU + "/GenerateAOTCall")]
+#endif
+ static void GenerateAOTCall()
+ {
+ var path = UnityPath.FromUnityPath("Assets/VRM/UniVRM/Scripts/AOTCall.g.cs");
+ var encoding = new UTF8Encoding(false);
+ using (var s = new MemoryStream())
+ {
+ using (var w = new StreamWriter(s, encoding))
+ {
+ w.WriteLine(@"
+using System;
+using UniJSON;
+using UniGLTF;
+using System.Collections.Generic;
+
+
+namespace VRM {
+ public static partial class VRMAOTCall {
+ static void glTF()
+ {
+ {
+ var f = new JsonFormatter();
+");
+
+ {
+ var excludes = new List<Type>
+ {
+ typeof(object),
+ };
+
+ foreach (var t in new Type[]
+ {
+ typeof(string),
+ typeof(bool),
+
+ typeof(byte),
+ typeof(ushort),
+ typeof(uint),
+ typeof(ulong),
+
+ typeof(sbyte),
+ typeof(short),
+ typeof(int),
+ typeof(long),
+
+ typeof(float),
+ typeof(double),
+ typeof(Vector2),
+ typeof(Vector3),
+ typeof(Vector4),
+ typeof(Quaternion),
+ typeof(glTF),
+ })
+ {
+ TraverseType("JsonValue", w, t, excludes);
+ }
+ }
+
+ w.WriteLine(@"}
+
+{
+ var f = new MsgPackFormatter();
+");
+
+ {
+ var excludes = new List<Type>
+ {
+ typeof(object),
+ };
+
+ foreach (var t in new Type[]
+ {
+ typeof(string),
+ typeof(bool),
+
+ typeof(byte),
+ typeof(ushort),
+ typeof(uint),
+ typeof(ulong),
+
+ typeof(sbyte),
+ typeof(short),
+ typeof(int),
+ typeof(long),
+
+ typeof(float),
+ typeof(double),
+ typeof(Vector2),
+ typeof(Vector3),
+ typeof(Vector4),
+ typeof(Quaternion),
+ })
+ {
+ TraverseType("MsgPackValue", w, t, excludes);
+ }
+ }
+
+ w.WriteLine(@"
+ }
+ }
+ }
+}
+");
+ }
+
+ var text = encoding.GetString(s.ToArray());
+ File.WriteAllText(path.FullPath, text.Replace("\r\n", "\n"), encoding);
+ }
+
+ path.ImportAsset();
+ }
+
+ static bool IsGenericList(Type t)
+ {
+ if (t.IsGenericType
+ && t.GetGenericTypeDefinition() == typeof(List<>))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static bool IsGenericDictionary(Type t)
+ {
+ if (t.IsGenericType
+ && t.GetGenericTypeDefinition() == typeof(Dictionary<,>)
+ && t.GetGenericArguments()[0] == typeof(string))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ static IEnumerable<Type> GetNestedTypes(Type t)
+ {
+ if (t.DeclaringType == null)
+ {
+ yield break;
+ }
+
+ foreach(var x in GetNestedTypes(t.DeclaringType))
+ {
+ yield return x;
+ }
+
+ yield return t.DeclaringType;
+ }
+
+ static string GenericTypeName(Type t)
+ {
+ if (!t.IsGenericType)
+ {
+ return t.Name;
+ }
+ else
+ {
+ return t.Name.Split('`')[0]
+ + "<"
+ + string.Join(",", t.GetGenericArguments().Select(x => GenericTypeName(x)).ToArray())
+ + ">"
+ ;
+ }
+ }
+
+ static string GetTypeName(Type t)
+ {
+ var sb = new StringBuilder();
+ if (!string.IsNullOrEmpty(t.Name))
+ {
+ sb.Append(t.Namespace);
+ sb.Append(".");
+ }
+
+ foreach(var x in GetNestedTypes(t))
+ {
+ sb.Append(x.Name);
+ sb.Append(".");
+ }
+
+ sb.Append(GenericTypeName(t));
+
+ return sb.ToString();
+ }
+
+ static void TraverseType(string value, TextWriter w, Type t, List<Type> excludes)
+ {
+ if (excludes.Contains(t))
+ {
+ return;
+ }
+
+ w.WriteLine();
+ w.WriteLine("// $0".Replace("$0", t.Name));
+ excludes.Add(t);
+
+ if (t.IsArray)
+ {
+ var valueType = t.GetElementType();
+ w.WriteLine("f.Serialize(default($0[]));".Replace("$0", valueType.Name));
+ w.WriteLine(@"{
+var value = default($0[]);
+default(ListTreeNode<$2>).Deserialize(ref value);
+GenericDeserializer<$2, $0[]>.GenericArrayDeserializer<$0>(default(ListTreeNode<$2>));
+}"
+.Replace("$0", valueType.Name)
+.Replace("$2", value)
+);
+
+ return;
+ }
+
+ {
+ // list
+ if (IsGenericList(t))
+ {
+ var name = GetTypeName(t.GetGenericArguments()[0]);
+ w.WriteLine("f.Serialize(default(List<$0>));".Replace("$0", name));
+ w.WriteLine(@"{
+var value = default(List<$0>);
+default(ListTreeNode<$2>).Deserialize(ref value);
+GenericDeserializer<$2, List<$0>>.GenericListDeserializer<$0>(default(ListTreeNode<$2>));
+}"
+.Replace("$0", name)
+.Replace("$2", value)
+);
+
+ TraverseType(value, w, t.GetGenericArguments()[0], excludes);
+
+ return;
+ }
+ }
+
+ {
+ // dict
+ if (IsGenericDictionary(t))
+ {
+ var name = GetTypeName(t.GetGenericArguments()[1]);
+ w.WriteLine("f.Serialize(default(Dictionary<string, $0>));".Replace("$0", name));
+ w.WriteLine(@"{
+var value = default(Dictionary<string, $0>);
+default(ListTreeNode<$2>).Deserialize(ref value);
+GenericDeserializer<$2, Dictionary<string, $0>>.DictionaryDeserializer<$0>(default(ListTreeNode<$2>));
+}"
+.Replace("$0", name)
+.Replace("$2", value)
+);
+
+ TraverseType(value, w, t.GetGenericArguments()[1], excludes);
+ return;
+ }
+ }
+
+ {
+ var name = GetTypeName(t);
+ w.WriteLine("f.Serialize(default($0));".Replace("$0", name));
+ w.WriteLine(@"{
+var value = default($0);
+default(ListTreeNode<$2>).Deserialize(ref value);
+}"
+.Replace("$0", name)
+.Replace("$2", value)
+);
+ }
+
+ // object
+ //if (t.IsClass)
+ {
+ foreach (var fi in t.GetFields(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var fieldTypeName = GetTypeName(fi.FieldType);
+ w.WriteLine(@"{
+JsonObjectValidator.GenericDeserializer<$2,$0>.DeserializeField<$1>(default(JsonSchema), default(ListTreeNode<$2>));
+}"
+.Replace("$0", GetTypeName(t))
+.Replace("$1", GetTypeName(fi.FieldType))
+.Replace("$2", value)
+);
+
+ TraverseType(value, w, fi.FieldType, excludes);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs.meta
new file mode 100644
index 00000000..1fd39a6d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAOTMenu.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 400503f201487874f93b0efdc892cbf3
+timeCreated: 1550040672
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs
new file mode 100644
index 00000000..c1a359a0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs
@@ -0,0 +1,214 @@
+#if false
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UniGLTF;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public static class VRMAssetWriter
+ {
+ interface ISubAssetWriter
+ {
+ void WriteIfHas(GameObject go);
+ }
+
+ class SubAssetWriter<T>: ISubAssetWriter where T : UnityEngine.Object
+ {
+ HashSet<T> m_set = new HashSet<T>();
+
+ String m_assetPath;
+ public delegate IEnumerable<T> GetterFunc(GameObject go);
+ GetterFunc m_getter;
+ public SubAssetWriter(string assetPath, GetterFunc getter)
+ {
+ m_assetPath = assetPath;
+ m_getter = getter;
+ }
+
+ public void WriteIfHas(GameObject go)
+ {
+ foreach(var o in m_getter(go))
+ {
+ if (!m_set.Contains(o))
+ {
+ AssetDatabase.AddObjectToAsset(o, m_assetPath);
+ m_set.Add(o);
+ }
+ }
+ }
+ }
+
+ static IEnumerable<Mesh> GetMeshs(GameObject go)
+ {
+ var skinnedMesh = go.GetComponent<SkinnedMeshRenderer>();
+ if (skinnedMesh != null)
+ {
+ yield return skinnedMesh.sharedMesh;
+ }
+
+ var filter = go.GetComponent<MeshFilter>();
+ if (filter != null)
+ {
+ yield return filter.sharedMesh;
+ }
+ }
+
+ static IEnumerable<Material> GetMaterials(GameObject go)
+ {
+ var renderer = go.GetComponent<Renderer>();
+ if (renderer != null)
+ {
+ return renderer.sharedMaterials;
+ }
+ else
+ {
+ return Enumerable.Empty<Material>();
+ }
+ }
+
+ static IEnumerable<Texture2D> GetTextures(GameObject go)
+ {
+ foreach (var m in GetMaterials(go))
+ {
+ foreach(Texture2D x in m.GetTextures())
+ {
+ if (x != null)
+ {
+ yield return x;
+ }
+ }
+ }
+ }
+
+ static IEnumerable<Avatar> GetAvatars(GameObject go)
+ {
+ var animator = go.GetComponent<Animator>();
+ if(animator!=null && animator.avatar != null)
+ {
+ yield return animator.avatar;
+ }
+ }
+
+ static IEnumerable<BlendShapeClip> GetBlendShapeClips(GameObject go)
+ {
+ var proxy = go.GetComponent<VRMBlendShapeProxy>();
+ if (proxy != null && proxy.BlendShapeAvatar != null)
+ {
+ return proxy.BlendShapeAvatar.Clips;
+ }
+ else
+ {
+ return Enumerable.Empty<BlendShapeClip>();
+ }
+ }
+
+ static IEnumerable<BlendShapeAvatar> GetBlendShapeAvatars(GameObject go)
+ {
+ var proxy = go.GetComponent<VRMBlendShapeProxy>();
+ if (proxy != null && proxy.BlendShapeAvatar != null)
+ {
+ yield return proxy.BlendShapeAvatar;
+ }
+ }
+
+ static IEnumerable<UniHumanoid.AvatarDescription> GetAvatarDecriptions(GameObject go)
+ {
+ var humanoid = go.GetComponent<VRMHumanoidDescription>();
+ if (humanoid!=null && humanoid.Description != null)
+ {
+ yield return humanoid.Description;
+ }
+ else
+ {
+ var animator = go.GetComponent<Animator>();
+ if(animator!=null && animator.avatar)
+ {
+ var description= UniHumanoid.AvatarDescription.CreateFrom(animator.avatar);
+ if (description != null)
+ {
+ description.name = "AvatarDescription";
+ yield return description;
+ }
+ }
+ }
+ }
+
+ static IEnumerable<Texture2D> GetThumbnails(GameObject go)
+ {
+ var meta = go.GetComponent<VRMMetaInformation>();
+ if (meta != null && meta.Thumbnail != null)
+ {
+ yield return meta.Thumbnail;
+ }
+ }
+
+ static IEnumerable<UnityEngine.Object> GetSubAssets(String prefabPath)
+ {
+ return AssetDatabase.LoadAllAssetsAtPath(prefabPath);
+ }
+
+ public static void SaveAsPrefab(GameObject root, String path)
+ {
+ var prefabPath = path.ToUnityRelativePath();
+ Debug.LogFormat("SaveAsPrefab: {0}", prefabPath);
+
+ // clear subassets
+ if (File.Exists(prefabPath))
+ {
+ //Debug.LogFormat("Exist: {0}", m_prefabPath);
+
+ // clear subassets
+ foreach (var x in GetSubAssets(prefabPath))
+ {
+ if (x is Transform
+ || x is GameObject)
+ {
+ continue;
+ }
+ GameObject.DestroyImmediate(x, true);
+ }
+ }
+
+ // add subassets
+ var writers = new ISubAssetWriter[]{
+ new SubAssetWriter<Texture2D>(prefabPath, GetTextures),
+ new SubAssetWriter<Material>(prefabPath, GetMaterials),
+ new SubAssetWriter<Mesh>(prefabPath, GetMeshs),
+ new SubAssetWriter<Avatar>(prefabPath, GetAvatars),
+ // VRM Objects
+ new SubAssetWriter<BlendShapeClip>(prefabPath, GetBlendShapeClips),
+ new SubAssetWriter<BlendShapeAvatar>(prefabPath, GetBlendShapeAvatars),
+ new SubAssetWriter<UniHumanoid.AvatarDescription>(prefabPath, GetAvatarDecriptions),
+ new SubAssetWriter<Texture2D>(prefabPath, GetThumbnails),
+ };
+ foreach (var x in root.transform.Traverse())
+ {
+ foreach (var writer in writers)
+ {
+ writer.WriteIfHas(x.gameObject);
+ }
+ }
+
+ ///
+ /// create prefab, after subasset AssetDatabase.AddObjectToAsset
+ ///
+ if (File.Exists(prefabPath))
+ {
+ //Debug.LogFormat("ReplacePrefab: {0}", m_prefabPath);
+ var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
+ PrefabUtility.ReplacePrefab(root, prefab, ReplacePrefabOptions.ConnectToPrefab);
+ }
+ else
+ {
+ //Debug.LogFormat("CreatePrefab: {0}", m_prefabPath);
+ PrefabUtility.CreatePrefab(prefabPath, root, ReplacePrefabOptions.ConnectToPrefab);
+ }
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs.meta
new file mode 100644
index 00000000..264ff80e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMAssetWriter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8b409aa5d363b9948995cc00f7f1a0d0
+timeCreated: 1520241647
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs
new file mode 100644
index 00000000..a3726090
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs
@@ -0,0 +1,240 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using UniGLTF;
+using UnityEditor;
+using UnityEngine;
+
+namespace VRM
+{
+ public static class VRMEditorExporter
+ {
+ /// <summary>
+ /// Editor向けのエクスポート処理
+ /// </summary>
+ /// <param name="path">出力先</param>
+ /// <param name="settings">エクスポート設定</param>
+ public static void Export(string path, GameObject exportRoot, VRMMetaObject meta, VRMExportSettings settings, IReadOnlyList<MeshExportInfo> info)
+ {
+ List<GameObject> destroy = new List<GameObject>();
+ try
+ {
+ Export(path, exportRoot, meta, settings, info, destroy);
+ }
+ finally
+ {
+ foreach (var x in destroy)
+ {
+ Debug.LogFormat("destroy: {0}", x.name);
+ GameObject.DestroyImmediate(x);
+ }
+ }
+ }
+
+ static bool IsPrefab(GameObject go)
+ {
+ return !go.scene.IsValid();
+ }
+
+ /// <summary>
+ /// DeepCopy
+ /// </summary>
+ /// <param name="src"></param>
+ /// <returns></returns>
+ static BlendShapeAvatar CopyBlendShapeAvatar(BlendShapeAvatar src, bool removeUnknown)
+ {
+ var avatar = GameObject.Instantiate(src);
+ avatar.Clips = new List<BlendShapeClip>();
+ foreach (var clip in src.Clips)
+ {
+ if (removeUnknown && clip.Preset == BlendShapePreset.Unknown)
+ {
+ continue;
+ }
+ avatar.Clips.Add(GameObject.Instantiate(clip));
+ }
+ return avatar;
+ }
+
+ /// <summary>
+ /// 使用されない BlendShape を間引いた Mesh を作成して置き換える
+ /// </summary>
+ /// <param name="mesh"></param>
+ /// <returns></returns>
+ static void ReplaceMesh(GameObject target, SkinnedMeshRenderer smr, BlendShapeAvatar copyBlendShapeAvatar)
+ {
+ Mesh mesh = smr.sharedMesh;
+ if (mesh == null) return;
+ if (mesh.blendShapeCount == 0) return;
+
+ // Mesh から BlendShapeClip からの参照がある blendShape の index を集める
+ var usedBlendshapeIndexArray = copyBlendShapeAvatar.Clips
+ .SelectMany(clip => clip.Values)
+ .Where(val => target.transform.Find(val.RelativePath) == smr.transform)
+ .Select(val => val.Index)
+ .Distinct()
+ .ToArray();
+
+ var copyMesh = MeshUtility.MeshExtensions.Copy(mesh, copyBlendShape: false);
+ // 使われている BlendShape だけをコピーする
+ foreach (var i in usedBlendshapeIndexArray)
+ {
+ var name = mesh.GetBlendShapeName(i);
+ var vCount = mesh.vertexCount;
+ var vertices = new Vector3[vCount];
+ var normals = new Vector3[vCount];
+ var tangents = new Vector3[vCount];
+ mesh.GetBlendShapeFrameVertices(i, 0, vertices, normals, tangents);
+
+ copyMesh.AddBlendShapeFrame(name, 100f, vertices, normals, tangents);
+ }
+
+ // BlendShapeClip の BlendShapeIndex を更新する(前に詰める)
+ var indexMapper = usedBlendshapeIndexArray
+ .Select((x, i) => new { x, i })
+ .ToDictionary(pair => pair.x, pair => pair.i);
+ foreach (var clip in copyBlendShapeAvatar.Clips)
+ {
+ for (var i = 0; i < clip.Values.Length; ++i)
+ {
+ var value = clip.Values[i];
+ if (target.transform.Find(value.RelativePath) != smr.transform) continue;
+ value.Index = indexMapper[value.Index];
+ clip.Values[i] = value;
+ }
+ }
+
+ // mesh を置き換える
+ smr.sharedMesh = copyMesh;
+ }
+
+ static void ForceUniqueName(Transform transform, Dictionary<string, int> nameCount)
+ {
+ for (int i = 2; i < 5000; ++i)
+ {
+ var sb = new StringBuilder();
+ sb.Append(transform.name);
+ sb.Append('_');
+ sb.Append(i);
+ var newName = sb.ToString();
+ if (!nameCount.ContainsKey(newName))
+ {
+ Debug.LogWarningFormat("force rename {0} => {1}", transform.name, newName);
+ transform.name = newName;
+ nameCount.Add(newName, 1);
+ return;
+ }
+ }
+ throw new Exception("?");
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="path"></param>
+ /// <param name="settings"></param>
+ /// <param name="destroy">作業が終わったらDestoryするべき一時オブジェクト</param>
+ static void Export(string path, GameObject exportRoot, VRMMetaObject meta,
+ VRMExportSettings settings, IReadOnlyList<UniGLTF.MeshExportInfo> info,
+ List<GameObject> destroy)
+ {
+ var target = exportRoot;
+
+ // 常にコピーする。シーンを変化させない
+ target = GameObject.Instantiate(target);
+ destroy.Add(target);
+
+ var metaBehaviour = target.GetComponent<VRMMeta>();
+ if (metaBehaviour == null)
+ {
+ metaBehaviour = target.AddComponent<VRMMeta>();
+ metaBehaviour.Meta = meta;
+ }
+ if (metaBehaviour.Meta == null)
+ {
+ // 来ないはず
+ throw new Exception("meta required");
+ }
+
+ {
+ // copy元
+ var animator = exportRoot.GetComponent<Animator>();
+ var beforeTransforms = exportRoot.GetComponentsInChildren<Transform>();
+ // copy先
+ var afterTransforms = target.GetComponentsInChildren<Transform>();
+ // copy先のhumanoidBoneのリストを得る
+ var bones = (HumanBodyBones[])Enum.GetValues(typeof(HumanBodyBones));
+ var humanTransforms = bones
+ .Where(x => x != HumanBodyBones.LastBone)
+ .Select(x => animator.GetBoneTransform(x))
+ .Where(x => x != null)
+ .Select(x => afterTransforms[Array.IndexOf(beforeTransforms, x)]) // copy 先を得る
+ .ToArray();
+
+ var nameCount = target.GetComponentsInChildren<Transform>()
+ .GroupBy(x => x.name)
+ .ToDictionary(x => x.Key, x => x.Count());
+ foreach (var t in target.GetComponentsInChildren<Transform>())
+ {
+ if (humanTransforms.Contains(t))
+ {
+ // keep original name
+ continue;
+ }
+
+ if (nameCount[t.name] > 1)
+ {
+ // 重複するボーン名をリネームする
+ ForceUniqueName(t, nameCount);
+ }
+ }
+ }
+
+ // 正規化
+ if (settings.PoseFreeze)
+ {
+ // BoneNormalizer.Execute は Copy を作って正規化する。UNDO無用
+ target = VRMBoneNormalizer.Execute(target, settings.ForceTPose, false);
+ destroy.Add(target);
+ }
+
+ // 元のBlendShapeClipに変更を加えないように複製
+ var proxy = target.GetComponent<VRMBlendShapeProxy>();
+ if (proxy != null)
+ {
+ var copyBlendShapeAvatar = CopyBlendShapeAvatar(proxy.BlendShapeAvatar, settings.ReduceBlendshapeClip);
+ proxy.BlendShapeAvatar = copyBlendShapeAvatar;
+
+ // BlendShape削減
+ if (settings.ReduceBlendshape)
+ {
+ foreach (SkinnedMeshRenderer smr in target.GetComponentsInChildren<SkinnedMeshRenderer>())
+ {
+ // 未使用のBlendShapeを間引く
+ ReplaceMesh(target, smr, copyBlendShapeAvatar);
+ }
+ }
+ }
+
+ // 出力
+ var sw = System.Diagnostics.Stopwatch.StartNew();
+ var gltf = new UniGLTF.glTF();
+ using (var exporter = new VRMExporter(gltf))
+ {
+ exporter.Prepare(target);
+ exporter.Export(settings.MeshExportSettings);
+ }
+ var bytes = gltf.ToGlbBytes();
+ File.WriteAllBytes(path, bytes);
+ Debug.LogFormat("Export elapsed {0}", sw.Elapsed);
+
+ if (path.StartsWithUnityAssetPath())
+ {
+ // 出力ファイルのインポートを発動
+ AssetDatabase.ImportAsset(path.ToUnityRelativePath());
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs.meta
new file mode 100644
index 00000000..f6863a95
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMEditorExporter.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cea266830a7f57843bb928d0ea37bcbc
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs
new file mode 100644
index 00000000..00a4dc74
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs
@@ -0,0 +1,226 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnityEngine;
+
+namespace VRM
+{
+ /// <summary>
+ /// Export時にMeshを一覧する。
+ ///
+ /// Mesh関連の Validation する。
+ /// Meshのエクスポートサイズを試算する。
+ /// </summary>
+ [Serializable]
+ public class VRMExportMeshes : ScriptableObject
+ {
+ static Mesh GetMesh(Renderer r)
+ {
+ if (r is SkinnedMeshRenderer smr)
+ {
+ return smr.sharedMesh;
+ }
+ if (r is MeshRenderer)
+ {
+ MeshFilter f = r.GetComponent<MeshFilter>();
+ if (f != null)
+ {
+ return f.sharedMesh;
+ }
+ }
+ return null;
+ }
+
+ static bool ClipsContainsName(IReadOnlyList<BlendShapeClip> clips, bool onlyPreset, BlendShapeBinding binding)
+ {
+ foreach (var c in clips)
+ {
+ if (onlyPreset)
+ {
+ if (c.Preset == BlendShapePreset.Unknown)
+ {
+ continue;
+ }
+ }
+
+ foreach (var b in c.Values)
+ {
+ if (b.RelativePath == binding.RelativePath && b.Index == binding.Index)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public List<UniGLTF.MeshExportInfo> Meshes = new List<UniGLTF.MeshExportInfo>();
+
+ public int ExpectedExportByteSize => Meshes.Where(x => x.IsRendererActive).Sum(x => x.ExportByteSize);
+
+ List<Validation> m_validations = new List<Validation>();
+ public IEnumerable<Validation> Validations => m_validations;
+
+ public static void CalcMeshSize(ref UniGLTF.MeshExportInfo info,
+ string relativePath, VRMExportSettings settings, IReadOnlyList<BlendShapeClip> clips)
+ {
+ var sb = new StringBuilder();
+ if (!info.IsRendererActive)
+ {
+ sb.Append("[NotActive]");
+ }
+
+ info.VertexCount = info.Mesh.vertexCount;
+ info.ExportVertexSize = 0;
+ info.TotalBlendShapeCount = 0;
+ info.ExportBlendShapeCount = 0;
+
+ // float4 x 3
+ // vertices
+ sb.Append($"(Pos");
+ if (info.HasNormal)
+ {
+ sb.Append("+Nom");
+ info.ExportVertexSize += 4 * 3;
+ }
+ if (info.HasUV)
+ {
+ sb.Append("+UV");
+ info.ExportVertexSize += 4 * 2;
+ }
+ if (info.HasVertexColor)
+ {
+ sb.Append("+Col");
+ info.ExportVertexSize += 4 * 4;
+ }
+ if (info.HasSkinning)
+ {
+ // short, float x 4 weights
+ sb.Append("+Skin");
+ info.ExportVertexSize += (2 + 4) * 4;
+ }
+ // indices
+ info.IndexCount = info.Mesh.triangles.Length;
+
+ // postion + normal ?. always tangent is ignored
+ info.TotalBlendShapeCount = info.Mesh.blendShapeCount;
+ info.ExportBlendShapeVertexSize = settings.OnlyBlendshapePosition ? 4 * 3 : 4 * (3 + 3);
+ for (var i = 0; i < info.Mesh.blendShapeCount; ++i)
+ {
+ // var name = Mesh.GetBlendShapeName(i);
+ if (settings.ReduceBlendshape)
+ {
+ if (!ClipsContainsName(clips, settings.ReduceBlendshapeClip, new BlendShapeBinding
+ {
+ Index = i,
+ RelativePath = relativePath,
+ }))
+ {
+ // skip
+ continue;
+ }
+ }
+
+ ++info.ExportBlendShapeCount;
+ }
+
+ if (info.ExportBlendShapeCount > 0)
+ {
+ sb.Append($"+Morph x {info.ExportBlendShapeCount}");
+ }
+ sb.Append($") x {info.Mesh.vertexCount}");
+ switch (info.VertexColor)
+ {
+ case UniGLTF.MeshExportInfo.VertexColorState.ExistsAndIsUsed:
+ case UniGLTF.MeshExportInfo.VertexColorState.ExistsAndMixed: // エクスポートする
+ sb.Insert(0, "[use vcolor]");
+ break;
+ case UniGLTF.MeshExportInfo.VertexColorState.ExistsButNotUsed:
+ sb.Insert(0, "[remove vcolor]");
+ break;
+ }
+ if (info.ExportBlendShapeCount > 0 && !info.HasSkinning)
+ {
+ sb.Insert(0, "[morph without skin]");
+ }
+
+ // total bytes
+ sb.Insert(0, $"{info.ExportByteSize:#,0} Bytes = ");
+ info.Summary = sb.ToString();
+ }
+
+ bool TryGetMeshInfo(GameObject root, Renderer renderer, IReadOnlyList<BlendShapeClip> clips, VRMExportSettings settings, out UniGLTF.MeshExportInfo info)
+ {
+ info = default;
+ if (root == null)
+ {
+ info.Summary = "";
+ return false;
+ }
+ if (renderer == null)
+ {
+ info.Summary = "no Renderer";
+ return false;
+ }
+ info.Renderer = renderer;
+
+ if (renderer is SkinnedMeshRenderer smr)
+ {
+ info.Skinned = true;
+ info.Mesh = smr.sharedMesh;
+ info.IsRendererActive = smr.EnableForExport();
+ }
+ else if (renderer is MeshRenderer mr)
+ {
+ var filter = mr.GetComponent<MeshFilter>();
+ if (filter != null)
+ {
+ info.Mesh = filter.sharedMesh;
+ }
+ info.IsRendererActive = mr.EnableForExport();
+ }
+ else
+ {
+ info.Summary = "no Mesh";
+ return false;
+ }
+
+ info.VertexColor = UniGLTF.MeshExportInfo.DetectVertexColor(info.Mesh, info.Renderer.sharedMaterials);
+
+ var relativePath = UniGLTF.UnityExtensions.RelativePathFrom(renderer.transform, root.transform);
+ CalcMeshSize(ref info, relativePath, settings, clips);
+
+ return true;
+ }
+
+ public void SetRoot(GameObject ExportRoot, VRMExportSettings settings)
+ {
+ m_validations.Clear();
+ Meshes.Clear();
+ if (ExportRoot == null)
+ {
+ return;
+ }
+
+ var clips = new List<BlendShapeClip>();
+ var proxy = ExportRoot.GetComponent<VRMBlendShapeProxy>();
+ if (proxy != null)
+ {
+ // Export サイズ の 計算
+ if (proxy.BlendShapeAvatar != null)
+ {
+ clips.AddRange(proxy.BlendShapeAvatar.Clips);
+ }
+ }
+
+ foreach (var renderer in ExportRoot.GetComponentsInChildren<Renderer>(true))
+ {
+ if (TryGetMeshInfo(ExportRoot, renderer, clips, settings, out UniGLTF.MeshExportInfo info))
+ {
+ Meshes.Add(info);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs.meta
new file mode 100644
index 00000000..d045660f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshes.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7961eaa3060a80d43b2bcd80961bbd29
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs
new file mode 100644
index 00000000..f650385c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs
@@ -0,0 +1,53 @@
+
+using System;
+using UnityEditor;
+using UnityEngine;
+using VRM.M17N;
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMExportMeshes))]
+ public class VRMExportMeshesEditor : Editor
+ {
+ VRMExportMeshes m_target;
+
+ private void OnEnable()
+ {
+ m_target = target as VRMExportMeshes;
+ }
+
+ public override void OnInspectorGUI()
+ {
+ for (int i = 0; i < m_target.Meshes.Count; ++i)
+ {
+ DrawElement(i, m_target.Meshes[i]);
+ }
+ }
+
+ static (Rect, Rect) LeftRight(float x, float y, float left, float right, float height)
+ {
+ return (
+ new Rect(x, y, left, height),
+ new Rect(x + left, y, right, height)
+ );
+ }
+
+ void DrawElement(int i, UniGLTF.MeshExportInfo info)
+ {
+ var r = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 20));
+ var col0 = 32;
+ var (left, right) = LeftRight(r.x, r.y, col0, r.width - col0, EditorGUIUtility.singleLineHeight);
+ EditorGUI.LabelField(left, $"{i,3}");
+
+ GUI.enabled = false;
+ EditorGUI.ObjectField(right, info.Renderer, info.Renderer.GetType(), true);
+
+ right.y += EditorGUIUtility.singleLineHeight;
+ EditorGUI.ObjectField(right, info.Mesh, info.Renderer.GetType(), true);
+ GUI.enabled = true;
+
+ right.y += EditorGUIUtility.singleLineHeight;
+ EditorGUI.LabelField(right, info.Summary);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs.meta
new file mode 100644
index 00000000..bf6e8d24
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportMeshesEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 64237fa04d62bfa48a479f54155467c6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs
new file mode 100644
index 00000000..35205b54
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VRM
+{
+ [Serializable]
+ public class VRMExportSettings : ScriptableObject
+ {
+ /// <summary>
+ /// エクスポート時に強制的にT-Pose化する
+ /// </summary>
+ [Tooltip("Option")]
+ public bool ForceTPose = false;
+
+ /// <summary>
+ /// エクスポート時にヒエラルキーの正規化を実施する
+ /// </summary>
+ [Tooltip("Require only first time")]
+ public bool PoseFreeze = true;
+
+ /// <summary>
+ /// BlendShapeのシリアライズにSparseAccessorを使う
+ /// </summary>
+ [Tooltip("Use sparse accessor for blendshape. This may reduce vrm size")]
+ public bool UseSparseAccessor = false;
+
+ /// <summary>
+ /// BlendShapeのPositionのみをエクスポートする
+ /// </summary>
+ [Tooltip("UniVRM-0.54 or later can load it. Otherwise fail to load")]
+ public bool OnlyBlendshapePosition = false;
+
+ /// <summary>
+ /// エクスポート時にBlendShapeClipから参照されないBlendShapeを削除する
+ /// </summary>
+ [Tooltip("Remove blendshape that is not used from BlendShapeClip")]
+ public bool ReduceBlendshape = false;
+
+ /// <summary>
+ /// skip if BlendShapeClip.Preset == Unknown
+ /// </summary>
+ [Tooltip("Remove blendShapeClip that preset is Unknown")]
+ public bool ReduceBlendshapeClip = false;
+
+ public UniGLTF.MeshExportSettings MeshExportSettings => new UniGLTF.MeshExportSettings
+ {
+ UseSparseAccessorForMorphTarget = UseSparseAccessor,
+ ExportOnlyBlendShapePosition = OnlyBlendshapePosition,
+ };
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs.meta
new file mode 100644
index 00000000..d80644aa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettings.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f1bcfcc2d4692ef41b0c8f0f9ec3df14
+timeCreated: 1532066746
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs
new file mode 100644
index 00000000..2f9a1c3e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs
@@ -0,0 +1,151 @@
+
+using System;
+using UnityEditor;
+using UnityEngine;
+using VRM.M17N;
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMExportSettings))]
+ public class VRMExportSettingsEditor : Editor
+ {
+ class CheckBoxProp
+ {
+ public SerializedProperty Property;
+ public Func<string> Description;
+
+ public CheckBoxProp(SerializedProperty property, Func<string> desc)
+ {
+ Property = property;
+ Description = desc;
+ }
+
+ public CheckBoxProp(SerializedProperty property, Options desc) : this(property, () => Msg(desc))
+ {
+ }
+
+ public CheckBoxProp(SerializedProperty property, string desc) : this(property, () => desc)
+ {
+ }
+
+ public void Draw()
+ {
+ EditorGUILayout.PropertyField(Property);
+ EditorGUILayout.HelpBox(Description(), MessageType.None);
+ EditorGUILayout.Space();
+ }
+ }
+
+ /// <summary>
+ /// エクスポート時に強制的にT-Pose化する
+ /// </summary>
+ [Tooltip("Option")]
+ public bool ForceTPose = false;
+
+ /// <summary>
+ /// エクスポート時にヒエラルキーの正規化を実施する
+ /// </summary>
+ [Tooltip("Require only first time")]
+ public bool PoseFreeze = true;
+
+ /// <summary>
+ /// エクスポート時に新しいJsonSerializerを使う
+ /// </summary>
+ [Tooltip("Use new JSON serializer")]
+ public bool UseExperimentalExporter = false;
+
+ /// <summary>
+ /// BlendShapeのシリアライズにSparseAccessorを使う
+ /// </summary>
+ [Tooltip("Use sparse accessor for blendshape. This may reduce vrm size")]
+ public bool UseSparseAccessor = false;
+
+ /// <summary>
+ /// BlendShapeのPositionのみをエクスポートする
+ /// </summary>
+ [Tooltip("UniVRM-0.54 or later can load it. Otherwise fail to load")]
+ public bool OnlyBlendshapePosition = false;
+
+ /// <summary>
+ /// エクスポート時にBlendShapeClipから参照されないBlendShapeを削除する
+ /// </summary>
+ [Tooltip("Remove blendshape that is not used from BlendShapeClip")]
+ public bool ReduceBlendshape = false;
+
+ /// <summary>
+ /// skip if BlendShapeClip.Preset == Unknown
+ /// </summary>
+ [Tooltip("Remove blendShapeClip that preset is Unknown")]
+ public bool ReduceBlendshapeClip = false;
+
+ CheckBoxProp m_forceTPose;
+ CheckBoxProp m_poseFreeze;
+ CheckBoxProp m_useSparseAccessor;
+ CheckBoxProp m_onlyBlendShapePosition;
+ CheckBoxProp m_reduceBlendShape;
+ CheckBoxProp m_reduceBlendShapeClip;
+
+ static string Msg(Options key)
+ {
+ return M17N.Getter.Msg(key);
+ }
+
+ enum Options
+ {
+ [LangMsg(Languages.ja, "エクスポート時に強制的にT-Pose化する。これを使わずに手動でT-Poseを作っても問題ありません")]
+ [LangMsg(Languages.en, "Force T-Pose before export. Manually making T-Pose for model without enabling this is ok")]
+ FORCE_T_POSE,
+
+ [LangMsg(Languages.ja, "エクスポート時に正規化(ヒエラルキーから回転と拡大縮小を取り除くためにベイク)する")]
+ [LangMsg(Languages.en, "Model's normalization (bake to remove roation and scaling from the hierarchy)")]
+ NORMALIZE,
+
+ [LangMsg(Languages.ja, "エクスポート時に新しいJsonSerializerを使う")]
+ [LangMsg(Languages.en, "The new version of JsonSerializer for model export")]
+ USE_GENERATED_SERIALIZER,
+
+ [LangMsg(Languages.ja, "BlendShapeの容量を GLTF の Sparse Accessor 機能で削減する。修正中: UniGLTF以外でロードできません")]
+ [LangMsg(Languages.en, "BlendShape size can be reduced by using Sparse Accessor")]
+ BLENDSHAPE_USE_SPARSE,
+
+ [LangMsg(Languages.ja, "BlendShapeClipのエクスポートに法線とTangentを含めない。UniVRM-0.53 以前ではロードがエラーになるのに注意してください")]
+ [LangMsg(Languages.en, "BlendShape's Normal and Tangent will not be exported. Be aware that errors may occur during import if the model is made by UniVRM-0.53 or earlier versions")]
+ BLENDSHAPE_EXCLUDE_NORMAL_AND_TANGENT,
+
+ [LangMsg(Languages.ja, "BlendShapeClipから参照されないBlendShapeをエクスポートに含めない")]
+ [LangMsg(Languages.en, "BlendShapes that are not referenced by BlendShapeClips will not be exported")]
+ BLENDSHAPE_ONLY_CLIP_USE,
+
+ [LangMsg(Languages.ja, "BlendShapeClip.Preset == Unknown のBlendShapeClipをエクスポートに含めない")]
+ [LangMsg(Languages.en, "BlendShapeClip will not be exported if BlendShapeClip.Preset == Unknown")]
+ BLENDSHAPE_EXCLUDE_UNKNOWN,
+
+ [LangMsg(Languages.ja, "エクスポートに頂点カラーを含めない")]
+ [LangMsg(Languages.en, "Vertex color will not be exported")]
+ REMOVE_VERTEX_COLOR,
+ }
+
+ private void OnEnable()
+ {
+ m_forceTPose = new CheckBoxProp(serializedObject.FindProperty(nameof(ForceTPose)), Options.FORCE_T_POSE);
+ m_poseFreeze = new CheckBoxProp(serializedObject.FindProperty(nameof(PoseFreeze)), Options.NORMALIZE);
+ m_useSparseAccessor = new CheckBoxProp(serializedObject.FindProperty(nameof(UseSparseAccessor)), Options.BLENDSHAPE_USE_SPARSE);
+ m_onlyBlendShapePosition = new CheckBoxProp(serializedObject.FindProperty(nameof(OnlyBlendshapePosition)), Options.BLENDSHAPE_EXCLUDE_NORMAL_AND_TANGENT);
+ m_reduceBlendShape = new CheckBoxProp(serializedObject.FindProperty(nameof(ReduceBlendshape)), Options.BLENDSHAPE_ONLY_CLIP_USE);
+ m_reduceBlendShapeClip = new CheckBoxProp(serializedObject.FindProperty(nameof(ReduceBlendshapeClip)), Options.BLENDSHAPE_EXCLUDE_UNKNOWN);
+ }
+
+ public override void OnInspectorGUI()
+ {
+ EditorGUIUtility.labelWidth = 160;
+ serializedObject.Update();
+ m_forceTPose.Draw();
+ m_poseFreeze.Draw();
+ m_useSparseAccessor.Draw();
+ m_onlyBlendShapePosition.Draw();
+ m_reduceBlendShape.Draw();
+ m_reduceBlendShapeClip.Draw();
+ serializedObject.ApplyModifiedProperties();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs.meta
new file mode 100644
index 00000000..a7311540
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExportSettingsEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a4dedd0bd9be75140833b413c489c2fc
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs
new file mode 100644
index 00000000..14d3c813
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs
@@ -0,0 +1,327 @@
+using System.Collections.Generic;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+
+namespace VRM
+{
+ public class VRMExporterValidator
+ {
+ // Allows you to enable and disable the wizard create button, so that the user can not click it.
+ public bool IsValid
+ {
+ get
+ {
+ var hasError = m_validations.Any(x => !x.CanExport);
+ return !hasError && !MetaHasError;
+ }
+ }
+
+ bool MetaHasError = false;
+
+ List<Validation> m_validations = new List<Validation>();
+ public IEnumerable<Validation> Validations => m_validations;
+
+ /// <summary>
+ /// ボーン名の重複を確認
+ /// </summary>
+ /// <returns></returns>
+ bool DuplicateBoneNameExists(GameObject ExportRoot)
+ {
+ if (ExportRoot == null)
+ {
+ return false;
+ }
+ var bones = ExportRoot.transform.GetComponentsInChildren<Transform>();
+ var duplicates = bones
+ .GroupBy(p => p.name)
+ .Where(g => g.Count() > 1)
+ .Select(g => g.Key);
+
+ return (duplicates.Any());
+ }
+
+ public static bool IsFileNameLengthTooLong(string fileName)
+ {
+ return fileName.Length > 64;
+ }
+
+ public static bool HasRotationOrScale(GameObject root)
+ {
+ foreach (var t in root.GetComponentsInChildren<Transform>())
+ {
+ if (t.localRotation != Quaternion.identity)
+ {
+ return true;
+ }
+ if (t.localScale != Vector3.one)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ static Vector3 GetForward(Transform l, Transform r)
+ {
+ if (l == null || r == null)
+ {
+ return Vector3.zero;
+ }
+ var lr = (r.position - l.position).normalized;
+ return Vector3.Cross(lr, Vector3.up);
+ }
+
+ static string Msg(VRMExporterWizardMessages key)
+ {
+ return M17N.Getter.Msg(key);
+ }
+
+ /// <summary>
+ /// ExportDialogを表示する前に確認する。
+ /// </summary>
+ /// <param name="ExportRoot"></param>
+ /// <param name="m_settings"></param>
+ /// <returns></returns>
+ public bool RootAndHumanoidCheck(GameObject ExportRoot, VRMExportSettings m_settings, IReadOnlyList<UniGLTF.MeshExportInfo> info)
+ {
+ //
+ // root
+ //
+ if (ExportRoot == null)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.ROOT_EXISTS)).DrawGUI();
+ return false;
+ }
+ if (ExportRoot.transform.parent != null)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.NO_PARENT)).DrawGUI();
+ return false;
+ }
+
+ var renderers = ExportRoot.GetComponentsInChildren<Renderer>();
+ if (renderers.All(x => !x.EnableForExport()))
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.NO_ACTIVE_MESH)).DrawGUI();
+ return false;
+ }
+
+ if (HasRotationOrScale(ExportRoot) || info.Any(x => x.ExportBlendShapeCount > 0 && !x.HasSkinning))
+ {
+ // 正規化必用
+ if (m_settings.PoseFreeze)
+ {
+ // する
+ EditorGUILayout.HelpBox("PoseFreeze checked. OK", MessageType.Info);
+ }
+ else
+ {
+ // しない
+ Validation.Warning(Msg(VRMExporterWizardMessages.ROTATION_OR_SCALEING_INCLUDED_IN_NODE)).DrawGUI();
+ }
+ }
+ else
+ {
+ // 不要
+ if (m_settings.PoseFreeze)
+ {
+ // する
+ Validation.Warning(Msg(VRMExporterWizardMessages.IS_POSE_FREEZE_DONE)).DrawGUI();
+ }
+ else
+ {
+ // しない
+ EditorGUILayout.HelpBox("Root OK", MessageType.Info);
+ }
+ }
+
+ //
+ // animator
+ //
+ var animator = ExportRoot.GetComponent<Animator>();
+ if (animator == null)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.NO_ANIMATOR)).DrawGUI();
+ return false;
+ }
+
+ var avatar = animator.avatar;
+ if (avatar == null)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.NO_AVATAR_IN_ANIMATOR)).DrawGUI();
+ return false;
+ }
+ if (!avatar.isValid)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.AVATAR_IS_NOT_VALID)).DrawGUI();
+ return false;
+ }
+ if (!avatar.isHuman)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.AVATAR_IS_NOT_HUMANOID)).DrawGUI();
+ return false;
+ }
+ {
+ var l = animator.GetBoneTransform(HumanBodyBones.LeftUpperLeg);
+ var r = animator.GetBoneTransform(HumanBodyBones.RightUpperLeg);
+ var f = GetForward(l, r);
+ if (Vector3.Dot(f, Vector3.forward) < 0.8f)
+ {
+ Validation.Error(Msg(VRMExporterWizardMessages.FACE_Z_POSITIVE_DIRECTION)).DrawGUI();
+ return false;
+ }
+ }
+ var jaw = animator.GetBoneTransform(HumanBodyBones.Jaw);
+ if (jaw != null)
+ {
+ Validation.Warning(Msg(VRMExporterWizardMessages.JAW_BONE_IS_INCLUDED)).DrawGUI();
+ }
+ else
+ {
+ EditorGUILayout.HelpBox("Animator OK", MessageType.Info);
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// エクスポート可能か検証する。
+ /// </summary>
+ /// <returns></returns>
+ public void Validate(GameObject ExportRoot, VRMExportSettings m_settings, VRMMetaObject meta)
+ {
+ m_validations.Clear();
+ if (ExportRoot == null)
+ {
+ return;
+ }
+ var proxy = ExportRoot.GetComponent<VRMBlendShapeProxy>();
+
+ m_validations.AddRange(_Validate(ExportRoot, m_settings));
+ m_validations.AddRange(VRMSpringBoneValidator.Validate(ExportRoot));
+ var firstPerson = ExportRoot.GetComponent<VRMFirstPerson>();
+ if (firstPerson != null)
+ {
+ m_validations.AddRange(firstPerson.Validate());
+ }
+ if (proxy != null)
+ {
+ m_validations.AddRange(proxy.Validate());
+ }
+ MetaHasError = meta.Validate().Any();
+ }
+
+ IEnumerable<Validation> _Validate(GameObject ExportRoot, VRMExportSettings m_settings)
+ {
+ if (ExportRoot == null)
+ {
+ yield break;
+ }
+
+ if (DuplicateBoneNameExists(ExportRoot))
+ {
+ yield return Validation.Warning(Msg(VRMExporterWizardMessages.DUPLICATE_BONE_NAME_EXISTS));
+ }
+
+ if (m_settings.ReduceBlendshape && ExportRoot.GetComponent<VRMBlendShapeProxy>() == null)
+ {
+ yield return Validation.Error(Msg(VRMExporterWizardMessages.NEEDS_VRM_BLENDSHAPE_PROXY));
+ }
+
+ var renderers = ExportRoot.GetComponentsInChildren<Renderer>();
+ foreach (var r in renderers)
+ {
+ for (int i = 0; i < r.sharedMaterials.Length; ++i)
+ if (r.sharedMaterials[i] == null)
+ {
+ yield return Validation.Error($"Renderer: {r.name}.Materials[{i}] is null. please fix it");
+ }
+ }
+
+ var materials = renderers.SelectMany(x => x.sharedMaterials).Where(x => x != null).Distinct();
+ foreach (var material in materials)
+ {
+ if (material == null)
+ {
+ continue;
+ }
+
+ if (material.shader.name == "Standard")
+ {
+ // standard
+ continue;
+ }
+
+ if (VRMMaterialExporter.UseUnlit(material.shader.name))
+ {
+ // unlit
+ continue;
+ }
+
+ if (VRMMaterialExporter.VRMExtensionShaders.Contains(material.shader.name))
+ {
+ // VRM supported
+ continue;
+ }
+
+ yield return Validation.Warning($"Material: {material.name}. Unknown Shader: \"{material.shader.name}\" is used. {Msg(VRMExporterWizardMessages.UNKNOWN_SHADER)}");
+ }
+
+ foreach (var material in materials)
+ {
+ if (IsFileNameLengthTooLong(material.name))
+ yield return Validation.Error(Msg(VRMExporterWizardMessages.FILENAME_TOO_LONG) + material.name);
+ }
+
+ var textureNameList = new List<string>();
+ foreach (var material in materials)
+ {
+ var shader = material.shader;
+ int propertyCount = ShaderUtil.GetPropertyCount(shader);
+ for (int i = 0; i < propertyCount; i++)
+ {
+ if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
+ {
+ if ((material.GetTexture(ShaderUtil.GetPropertyName(shader, i)) != null))
+ {
+ var textureName = material.GetTexture(ShaderUtil.GetPropertyName(shader, i)).name;
+ if (!textureNameList.Contains(textureName))
+ textureNameList.Add(textureName);
+ }
+ }
+ }
+ }
+
+ foreach (var textureName in textureNameList)
+ {
+ if (IsFileNameLengthTooLong(textureName))
+ yield return Validation.Error(Msg(VRMExporterWizardMessages.FILENAME_TOO_LONG) + textureName);
+ }
+
+ var vrmMeta = ExportRoot.GetComponent<VRMMeta>();
+ if (vrmMeta != null && vrmMeta.Meta != null && vrmMeta.Meta.Thumbnail != null)
+ {
+ var thumbnailName = vrmMeta.Meta.Thumbnail.name;
+ if (IsFileNameLengthTooLong(thumbnailName))
+ yield return Validation.Error(Msg(VRMExporterWizardMessages.FILENAME_TOO_LONG) + thumbnailName);
+ }
+
+ var meshFilters = ExportRoot.GetComponentsInChildren<MeshFilter>();
+ var meshesName = meshFilters.Select(x => x.sharedMesh.name).Distinct();
+ foreach (var meshName in meshesName)
+ {
+ if (IsFileNameLengthTooLong(meshName))
+ yield return Validation.Error(Msg(VRMExporterWizardMessages.FILENAME_TOO_LONG) + meshName);
+ }
+
+ var skinnedmeshRenderers = ExportRoot.GetComponentsInChildren<SkinnedMeshRenderer>();
+ var skinnedmeshesName = skinnedmeshRenderers.Select(x => x.sharedMesh.name).Distinct();
+ foreach (var skinnedmeshName in skinnedmeshesName)
+ {
+ if (IsFileNameLengthTooLong(skinnedmeshName))
+ yield return Validation.Error(Msg(VRMExporterWizardMessages.FILENAME_TOO_LONG) + skinnedmeshName);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs.meta
new file mode 100644
index 00000000..c28dfe80
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterVaildator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bc233cbadb897eb4886de9927bee9fc2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs
new file mode 100644
index 00000000..3b4984ea
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs
@@ -0,0 +1,391 @@
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using UnityEditor;
+using UnityEngine;
+
+namespace VRM
+{
+ /// <summary>
+ /// エクスポートダイアログ
+ /// </summary>
+ public class VRMExporterWizard : EditorWindow
+ {
+ const string CONVERT_HUMANOID_KEY = VRMVersion.MENU + "/Export humanoid";
+
+ [MenuItem(CONVERT_HUMANOID_KEY, false, 1)]
+ private static void ExportFromMenu()
+ {
+ VRMExporterWizard.CreateWizard();
+ }
+
+ enum Tabs
+ {
+ Meta,
+ Mesh,
+ ExportSettings,
+ }
+ Tabs _tab;
+
+ GUIStyle TabButtonStyle => "LargeButton";
+
+ // GUI.ToolbarButtonSize.FitToContentsも設定できる
+ GUI.ToolbarButtonSize TabButtonSize => GUI.ToolbarButtonSize.Fixed;
+ const string EXTENSION = ".vrm";
+
+ private static string m_lastExportDir;
+
+
+ GameObject ExportRoot;
+
+ VRMExportSettings m_settings;
+ VRMExportMeshes m_meshes;
+
+ VRMMetaObject m_meta;
+ VRMMetaObject Meta
+ {
+ get { return m_meta; }
+ set
+ {
+ if (m_meta == value)
+ {
+ return;
+ }
+ m_requireValidation = true;
+ if (m_metaEditor != null)
+ {
+ UnityEditor.Editor.DestroyImmediate(m_metaEditor);
+ m_metaEditor = null;
+ }
+ m_meta = value;
+ }
+ }
+
+ void UpdateRoot(GameObject root)
+ {
+ if (root == ExportRoot)
+ {
+ return;
+ }
+ m_requireValidation = true;
+ ExportRoot = root;
+ UnityEditor.Editor.DestroyImmediate(m_metaEditor);
+ m_metaEditor = null;
+
+ if (ExportRoot == null)
+ {
+ Meta = null;
+ }
+ else
+ {
+ // do validation
+ Validate();
+
+ // default setting
+ m_settings.PoseFreeze =
+ VRMExporterValidator.HasRotationOrScale(ExportRoot)
+ || m_meshes.Meshes.Any(x => x.ExportBlendShapeCount > 0 && !x.HasSkinning)
+ ;
+
+ var meta = ExportRoot.GetComponent<VRMMeta>();
+ if (meta != null)
+ {
+ Meta = meta.Meta;
+ }
+ else
+ {
+ Meta = null;
+ }
+ }
+ }
+
+ void Validate()
+ {
+ if (!m_requireValidation)
+ {
+ return;
+ }
+ m_validator.Validate(ExportRoot, m_settings, Meta != null ? Meta : m_tmpMeta);
+ m_requireValidation = false;
+ m_meshes.SetRoot(ExportRoot, m_settings);
+ }
+
+ VRMMetaObject m_tmpMeta;
+
+ Editor m_metaEditor;
+ Editor m_settingsInspector;
+ Editor m_meshesInspector;
+
+ VRMExporterValidator m_validator = new VRMExporterValidator();
+ bool m_requireValidation = true;
+
+ private Vector2 m_ScrollPosition;
+
+ void OnEnable()
+ {
+ // Debug.Log("OnEnable");
+ Undo.willFlushUndoRecord += OnWizardUpdate;
+ Selection.selectionChanged += OnWizardUpdate;
+
+ m_tmpMeta = ScriptableObject.CreateInstance<VRMMetaObject>();
+
+ m_settings = ScriptableObject.CreateInstance<VRMExportSettings>();
+ m_settingsInspector = Editor.CreateEditor(m_settings);
+
+ m_meshes = ScriptableObject.CreateInstance<VRMExportMeshes>();
+ m_meshesInspector = Editor.CreateEditor(m_meshes);
+ }
+
+ void OnDisable()
+ {
+ ExportRoot = null;
+
+ // Debug.Log("OnDisable");
+ Selection.selectionChanged -= OnWizardUpdate;
+ Undo.willFlushUndoRecord -= OnWizardUpdate;
+
+ // m_metaEditor
+ UnityEditor.Editor.DestroyImmediate(m_metaEditor);
+ m_metaEditor = null;
+ // m_settingsInspector
+ UnityEditor.Editor.DestroyImmediate(m_settingsInspector);
+ m_settingsInspector = null;
+ // m_meshesInspector
+ UnityEditor.Editor.DestroyImmediate(m_meshesInspector);
+ m_meshesInspector = null;
+ // Meta
+ Meta = null;
+ ScriptableObject.DestroyImmediate(m_tmpMeta);
+ m_tmpMeta = null;
+ // m_settings
+ ScriptableObject.DestroyImmediate(m_settings);
+ m_settings = null;
+ // m_meshes
+ ScriptableObject.DestroyImmediate(m_meshes);
+ m_meshes = null;
+ }
+
+ private void InvokeWizardUpdate()
+ {
+ const BindingFlags kInstanceInvokeFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy;
+ MethodInfo method = GetType().GetMethod("OnWizardUpdate", kInstanceInvokeFlags);
+ if (method != null)
+ method.Invoke(this, null);
+ }
+
+ private class Styles
+ {
+ public static string errorText = "Wizard Error";
+ public static string box = "Wizard Box";
+ }
+
+ public delegate Vector2 BeginVerticalScrollViewFunc(Vector2 scrollPosition, bool alwaysShowVertical, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options);
+ static BeginVerticalScrollViewFunc s_func;
+ static BeginVerticalScrollViewFunc BeginVerticalScrollView
+ {
+ get
+ {
+ if (s_func == null)
+ {
+ var methods = typeof(EditorGUILayout).GetMethods(BindingFlags.Static | BindingFlags.NonPublic).Where(x => x.Name == "BeginVerticalScrollView").ToArray();
+ var method = methods.First(x => x.GetParameters()[1].ParameterType == typeof(bool));
+ s_func = (BeginVerticalScrollViewFunc)method.CreateDelegate(typeof(BeginVerticalScrollViewFunc));
+ }
+ return s_func;
+ }
+ }
+
+ private void OnGUI()
+ {
+ if (m_tmpMeta == null)
+ {
+ // OnDisable
+ return;
+ }
+
+ EditorGUIUtility.labelWidth = 150;
+
+ // lang
+ M17N.Getter.OnGuiSelectLang();
+
+ EditorGUILayout.LabelField("ExportRoot");
+ {
+ var root = (GameObject)EditorGUILayout.ObjectField(ExportRoot, typeof(GameObject), true);
+ UpdateRoot(root);
+ }
+
+ // ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint Aborting
+ // Validation により GUI の表示項目が変わる場合があるので、
+ // EventType.Layout と EventType.Repaint 間で内容が変わらないようしている。
+ if (Event.current.type == EventType.Layout)
+ {
+ Validate();
+ }
+
+ //
+ // Humanoid として適正か? ここで失敗する場合は Export UI を表示しない
+ //
+ if (!m_validator.RootAndHumanoidCheck(ExportRoot, m_settings, m_meshes.Meshes))
+ {
+ return;
+ }
+
+ EditorGUILayout.HelpBox($"Mesh size: {m_meshes.ExpectedExportByteSize / 1000000.0f:0.0} MByte", MessageType.Info);
+ _tab = TabBar.OnGUI(_tab, TabButtonStyle, TabButtonSize);
+
+ // Render contents using Generic Inspector GUI
+ m_ScrollPosition = BeginVerticalScrollView(m_ScrollPosition, false, GUI.skin.verticalScrollbar, "OL Box");
+ GUIUtility.GetControlID(645789, FocusType.Passive);
+
+ //
+ // VRM の Validation
+ //
+ foreach (var v in m_validator.Validations)
+ {
+ v.DrawGUI();
+ }
+ foreach (var meshInfo in m_meshes.Meshes)
+ {
+ switch (meshInfo.VertexColor)
+ {
+ case UniGLTF.MeshExportInfo.VertexColorState.ExistsAndMixed:
+ Validation.Warning($"{meshInfo.Renderer}: Both vcolor.multiply and not multiply unlit materials exist").DrawGUI();
+ break;
+ }
+ }
+
+ bool modified = DrawWizardGUI();
+ EditorGUILayout.EndScrollView();
+
+ // Create and Other Buttons
+ {
+ // errors
+ GUILayout.BeginVertical();
+ // GUILayout.FlexibleSpace();
+
+ {
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ GUI.enabled = m_validator.IsValid;
+
+ if (GUILayout.Button("Export", GUILayout.MinWidth(100)))
+ {
+ OnWizardCreate();
+ Close();
+ GUIUtility.ExitGUI();
+ }
+ GUI.enabled = true;
+
+ GUILayout.EndHorizontal();
+ }
+ GUILayout.EndVertical();
+ }
+
+ GUILayout.Space(8);
+
+ if (modified)
+ {
+ m_requireValidation = true;
+ Repaint();
+ }
+ }
+
+ bool DrawWizardGUI()
+ {
+ if (m_tmpMeta == null)
+ {
+ // disabled
+ return false;
+ }
+
+ // tabbar
+ switch (_tab)
+ {
+ case Tabs.Meta:
+ if (m_metaEditor == null)
+ {
+ if (m_meta != null)
+ {
+ m_metaEditor = Editor.CreateEditor(Meta);
+ }
+ else
+ {
+ m_metaEditor = Editor.CreateEditor(m_tmpMeta);
+ }
+ }
+ m_metaEditor.OnInspectorGUI();
+ break;
+
+ case Tabs.ExportSettings:
+ m_settingsInspector.OnInspectorGUI();
+ break;
+
+ case Tabs.Mesh:
+ m_meshesInspector.OnInspectorGUI();
+ break;
+ }
+
+ return true;
+ }
+
+ // Creates a wizard.
+ public static VRMExporterWizard DisplayWizard()
+ {
+ VRMExporterWizard wizard = CreateInstance<VRMExporterWizard>();
+ wizard.titleContent = new GUIContent("VRM Exporter");
+ if (wizard != null)
+ {
+ wizard.InvokeWizardUpdate();
+ wizard.ShowUtility();
+ }
+ return wizard;
+ }
+
+ public static void CreateWizard()
+ {
+ var wiz = VRMExporterWizard.DisplayWizard();
+ var go = Selection.activeObject as GameObject;
+
+ // update checkbox
+ wiz.UpdateRoot(go);
+
+ if (go != null)
+ {
+ wiz.m_settings.PoseFreeze = VRMExporterValidator.HasRotationOrScale(go);
+ }
+
+ wiz.OnWizardUpdate();
+ }
+
+ void OnWizardCreate()
+ {
+ string directory;
+ if (string.IsNullOrEmpty(m_lastExportDir))
+ directory = Directory.GetParent(Application.dataPath).ToString();
+ else
+ directory = m_lastExportDir;
+
+ // save dialog
+ var path = EditorUtility.SaveFilePanel(
+ "Save vrm",
+ directory,
+ ExportRoot.name + EXTENSION,
+ EXTENSION.Substring(1));
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+ m_lastExportDir = Path.GetDirectoryName(path).Replace("\\", "/");
+
+ // export
+ VRMEditorExporter.Export(path, ExportRoot, Meta != null ? Meta : m_tmpMeta, m_settings, m_meshes.Meshes);
+ }
+
+ void OnWizardUpdate()
+ {
+ UpdateRoot(ExportRoot);
+ m_requireValidation = true;
+ Repaint();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs.meta
new file mode 100644
index 00000000..ee2067f0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a8e41aa30fcc76e43ad8588aef8572ea
+timeCreated: 1520491195
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs
new file mode 100644
index 00000000..e9e521f5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs
@@ -0,0 +1,80 @@
+using VRM.M17N;
+
+namespace VRM
+{
+ public enum VRMExporterWizardMessages
+ {
+ [LangMsg(Languages.ja, "ExportRootをセットしてください")]
+ [LangMsg(Languages.en, "Please set up a ExportRoot for model export")]
+ ROOT_EXISTS,
+
+
+ [LangMsg(Languages.ja, "ExportRootに親はオブジェクトは持てません")]
+ [LangMsg(Languages.en, "ExportRoot must be topmost parent")]
+ NO_PARENT,
+
+ [LangMsg(Languages.ja, "ExportRootに回転・拡大縮小は持てません。子階層で回転・拡大縮小してください")]
+ [LangMsg(Languages.en, "ExportRoot's rotation and scaling are not allowed to change. Please set up rotation and scaling in child node")]
+ ROOT_WITHOUT_ROTATION_AND_SCALING_CHANGED,
+
+ [LangMsg(Languages.ja, "シーンに出していない Prefab はエクスポートできません(細かい挙動が違い、想定外の動作をところがあるため)。シーンに展開してからエクスポートしてください")]
+ [LangMsg(Languages.en, "Prefab Asset cannot be exported. Prefab Asset has different behaviour with Scene GameObject. Please put the prefab into the scene")]
+ PREFAB_CANNOT_EXPORT,
+
+ [LangMsg(Languages.ja, "回転・拡大縮小もしくはWeightの無いBlendShapeが含まれています。正規化が必用です。Setting の PoseFreeze を有効にしてください")]
+ [LangMsg(Languages.en, " Normalization is required. There are nodes (child GameObject) where rotation and scaling or blendshape without bone weight are not default. Please enable PoseFreeze")]
+ ROTATION_OR_SCALEING_INCLUDED_IN_NODE,
+
+ [LangMsg(Languages.ja, "正規化済みです。Setting の PoseFreeze は不要です")]
+ [LangMsg(Languages.en, "Normalization has been done. PoseFreeze is not required")]
+ IS_POSE_FREEZE_DONE,
+
+ [LangMsg(Languages.ja, "ExportRootに Animator がありません")]
+ [LangMsg(Languages.en, "No Animator in ExportRoot")]
+ NO_ANIMATOR,
+
+ [LangMsg(Languages.ja, "Z+ 向きにしてください")]
+ [LangMsg(Languages.en, "The model needs to face the positive Z-axis")]
+ FACE_Z_POSITIVE_DIRECTION,
+
+ [LangMsg(Languages.ja, "ExportRootの Animator に Avatar がありません")]
+ [LangMsg(Languages.en, "No Avatar in ExportRoot's Animator")]
+ NO_AVATAR_IN_ANIMATOR,
+
+ [LangMsg(Languages.ja, "ExportRootの Animator.Avatar が不正です")]
+ [LangMsg(Languages.en, "Animator.avatar in ExportRoot is not valid")]
+ AVATAR_IS_NOT_VALID,
+
+ [LangMsg(Languages.ja, "ExportRootの Animator.Avatar がヒューマノイドではありません。FBX importer の Rig で設定してください")]
+ [LangMsg(Languages.en, "Animator.avatar is not humanoid. Please change model's AnimationType to humanoid")]
+ AVATAR_IS_NOT_HUMANOID,
+
+ [LangMsg(Languages.ja, "humanoid設定に顎が含まれている。FBX importer の rig 設定で顎ボーンの割り当てを確認できます")]
+ [LangMsg(Languages.en, "Jaw bone is included. It may not what you intended. Please check the humanoid avatar setting screen")]
+ JAW_BONE_IS_INCLUDED,
+
+ [LangMsg(Languages.ja, "ヒエラルキーの中に同じ名前のGameObjectが含まれている。 エクスポートした場合に自動でリネームする")]
+ [LangMsg(Languages.en, "There are bones with the same name in the hierarchy. They will be automatically renamed after export")]
+ DUPLICATE_BONE_NAME_EXISTS,
+
+ [LangMsg(Languages.ja, "VRMBlendShapeProxyが必要です。先にVRMフォーマットに変換してください")]
+ [LangMsg(Languages.en, "VRMBlendShapeProxy is required. Please convert to VRM format first")]
+ NEEDS_VRM_BLENDSHAPE_PROXY,
+
+ [LangMsg(Languages.en, "This model contains vertex color")]
+ [LangMsg(Languages.ja, "ヒエラルキーに含まれる mesh に頂点カラーが含まれている")]
+ VERTEX_COLOR_IS_INCLUDED,
+
+ [LangMsg(Languages.ja, "ヒエラルキーに active なメッシュが含まれていない")]
+ [LangMsg(Languages.en, "No active mesh")]
+ NO_ACTIVE_MESH,
+
+ [LangMsg(Languages.ja, "Standard, Unlit, MToon 以外のマテリアルは、Standard になります")]
+ [LangMsg(Languages.en, "It will export as `Standard` fallback")]
+ UNKNOWN_SHADER,
+
+ [LangMsg(Languages.ja, "名前が長すぎる。リネームしてください: ")]
+ [LangMsg(Languages.en, "FileName is too long: ")]
+ FILENAME_TOO_LONG,
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs.meta
new file mode 100644
index 00000000..e6728223
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMExporterWizardMessages.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 515984b15b5b5bf4baca4fa2d6344fcf
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs
new file mode 100644
index 00000000..6dbb8bc2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs
@@ -0,0 +1,55 @@
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+using UniGLTF;
+
+
+namespace VRM
+{
+ public static class VRMHumanoidNormalizerMenu
+ {
+ const string MENU_KEY = VRMVersion.MENU + "/Freeze T-Pose";
+ [MenuItem(MENU_KEY, true, 1)]
+ private static bool ExportValidate()
+ {
+ var root = Selection.activeObject as GameObject;
+ if (root == null)
+ {
+ return false;
+ }
+
+ var animator = root.GetComponent<Animator>();
+ if (animator == null)
+ {
+ return false;
+ }
+
+ var avatar = animator.avatar;
+ if (avatar == null)
+ {
+ return false;
+ }
+
+ if (!avatar.isValid)
+ {
+ return false;
+ }
+
+ if (!avatar.isHuman)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ [MenuItem(MENU_KEY, false, 1)]
+ private static void ExportFromMenu()
+ {
+ var go = Selection.activeObject as GameObject;
+
+ // BoneNormalizer.Execute はコピーを正規化する。UNDO無用
+ Selection.activeGameObject = VRMBoneNormalizer.Execute(go, true, false);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs.meta
new file mode 100644
index 00000000..619ee096
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMHumanoidNormalizerMenu.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b3e1aacd7b7e1fb468b3378de03e5629
+timeCreated: 1520488809
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs
new file mode 100644
index 00000000..59d4430a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs
@@ -0,0 +1,67 @@
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+using UniGLTF;
+
+
+namespace VRM
+{
+ public static class VRMImporterMenu
+ {
+ [MenuItem(VRMVersion.MENU + "/Import", priority = 1)]
+ static void ImportMenu()
+ {
+ var path = EditorUtility.OpenFilePanel("open vrm", "", "vrm");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ if (Application.isPlaying)
+ {
+ // load into scene
+ var context = new VRMImporterContext();
+ context.Load(path);
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ Selection.activeGameObject = context.Root;
+ }
+ else
+ {
+ if (path.StartsWithUnityAssetPath())
+ {
+ Debug.LogWarningFormat("disallow import from folder under the Assets");
+ return;
+ }
+
+ var assetPath = EditorUtility.SaveFilePanel("save prefab", "Assets", Path.GetFileNameWithoutExtension(path), "prefab");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ if (!assetPath.StartsWithUnityAssetPath())
+ {
+ Debug.LogWarningFormat("out of asset path: {0}", assetPath);
+ return;
+ }
+
+ // import as asset
+ var prefabPath = UnityPath.FromUnityPath(assetPath);
+ var context = new VRMImporterContext();
+ context.ParseGlb(File.ReadAllBytes(path));
+ context.ExtractImages(prefabPath);
+
+ EditorApplication.delayCall += () =>
+ {
+ //
+ // after textures imported
+ //
+ context.Load();
+ context.SaveAsAsset(prefabPath);
+ context.EditorDestroyRoot();
+ };
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs.meta
new file mode 100644
index 00000000..921acdc6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMImporterMenu.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: da5decfeae53a6444977caf85d09bc88
+timeCreated: 1517153624
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs
new file mode 100644
index 00000000..a2d05726
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs
@@ -0,0 +1,144 @@
+using System.IO;
+using System.Text;
+using UnityEditor;
+using UnityEngine;
+
+namespace VRM
+{
+ public class VRMVersionMenu : EditorWindow
+ {
+ const string VersionPath = "Assets/VRM/UniVRM/Scripts/Format/VRMVersion.cs";
+ const string VersionTemplate = @"
+namespace VRM
+{{
+ public static partial class VRMVersion
+ {{
+ public const int MAJOR = {0};
+ public const int MINOR = {1};
+ public const int PATCH = {2};
+ public const string VERSION = ""{0}.{1}.{2}"";
+ }}
+}}
+";
+
+ const string VRMShadersPackagePath = "Assets/VRMShaders/package.json";
+ const string VRMShadersPackageTemplate = @"{{
+ ""name"": ""com.vrmc.vrmshaders"",
+ ""version"": ""{0}.{1}.{2}"",
+ ""displayName"": ""VRM Shaders"",
+ ""description"": ""VRM Shaders"",
+ ""unity"": ""2018.4"",
+ ""keywords"": [
+ ""vrm"",
+ ""shader""
+ ],
+ ""author"": {{
+ ""name"": ""VRM Consortium""
+ }}
+}}
+";
+
+ const string MeshUtilityPath = "Assets/MeshUtility/package.json";
+ const string MeshUtilityTemplate = @"{{
+ ""name"": ""com.vrmc.meshutility"",
+ ""version"": ""{0}.{1}.{2}"",
+ ""displayName"": ""MeshUtility"",
+ ""unity"": ""2018.4"",
+ ""description"": ""MeshUtility is a package for mesh separation, etc. \n\nCheck out the latest information here: <https://github.com/vrm-c/UniVRM/tree/master/Assets/MeshUtility>"",
+ ""keywords"": [
+ ""mesh""
+ ],
+ ""author"": {{
+ ""name"": ""VRM Consortium""
+ }}
+}}
+";
+
+ const string VRMPackagePath = "Assets/VRM/package.json";
+ const string VRMPackageTemplate = @"{{
+ ""name"": ""com.vrmc.univrm"",
+ ""version"": ""{0}.{1}.{2}"",
+ ""displayName"": ""VRM"",
+ ""description"": ""VRM importer"",
+ ""unity"": ""2018.4"",
+ ""keywords"": [
+ ""vrm"",
+ ""importer"",
+ ""avatar"",
+ ""vr""
+ ],
+ ""author"": {{
+ ""name"": ""VRM Consortium""
+ }},
+ ""dependencies"": {{
+ ""com.vrmc.vrmshaders"": ""{0}.{1}.{2}"",
+ ""com.vrmc.meshutility"": ""{0}.{1}.{2}""
+ }}
+}}
+";
+
+ [SerializeField]
+ string m_version;
+
+ void OnGUI()
+ {
+ GUILayout.Label($"Current version: {VRMVersion.VERSION}");
+
+ m_version = EditorGUILayout.TextField("Major.Minor.Patch", m_version);
+
+ if (GUILayout.Button("Apply"))
+ {
+ if (string.IsNullOrEmpty(m_version))
+ {
+ return;
+ }
+ var splitted = m_version.Split('.');
+ if (splitted.Length != 3)
+ {
+ Debug.LogWarning($"InvalidFormat: {m_version}");
+ return;
+ }
+ var values = new int[3];
+ for (int i = 0; i < 3; ++i)
+ {
+ values[i] = int.Parse(splitted[i]);
+ }
+
+ // generate
+ var utf8 = new UTF8Encoding(false);
+ File.WriteAllText(VersionPath, string.Format(VersionTemplate,
+ values[0],
+ values[1],
+ values[2]), utf8);
+ File.WriteAllText(VRMShadersPackagePath, string.Format(VRMShadersPackageTemplate,
+ values[0],
+ values[1],
+ values[2]), utf8);
+ File.WriteAllText(MeshUtilityPath, string.Format(MeshUtilityTemplate,
+ values[0],
+ values[1],
+ values[2]), utf8);
+ File.WriteAllText(VRMPackagePath, string.Format(VRMPackageTemplate,
+ values[0],
+ values[1],
+ values[2]), utf8);
+ AssetDatabase.Refresh();
+ }
+
+ if (GUILayout.Button("Close"))
+ {
+ Close();
+ }
+ }
+
+#if VRM_DEVELOP
+ [MenuItem(VRMVersion.MENU + "/VersionDialog")]
+#endif
+ static void ShowVersionDialog()
+ {
+ var window = ScriptableObject.CreateInstance<VRMVersionMenu>();
+ window.m_version = VRMVersion.VERSION;
+ window.ShowUtility();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs.meta
new file mode 100644
index 00000000..9d7c9e56
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/VRMVersionMenu.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 0c69abb555d67f647a7d3175e35e37d8
+timeCreated: 1522130550
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs
new file mode 100644
index 00000000..0bb5d097
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs
@@ -0,0 +1,58 @@
+using System;
+using System.IO;
+using System.Linq;
+using UniGLTF;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+#if !VRM_STOP_ASSETPOSTPROCESSOR
+ public class vrmAssetPostprocessor : AssetPostprocessor
+ {
+ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
+ {
+ foreach (string path in importedAssets)
+ {
+ if (UnityPath.FromUnityPath(path).IsStreamingAsset)
+ {
+ Debug.LogFormat("Skip StreamingAssets: {0}", path);
+ continue;
+ }
+
+ var ext = Path.GetExtension(path).ToLower();
+ if (ext == ".vrm")
+ {
+ ImportVrm(UnityPath.FromUnityPath(path));
+ }
+ }
+ }
+
+ static void ImportVrm(UnityPath path)
+ {
+ if (!path.IsUnderAssetsFolder)
+ {
+ throw new Exception();
+ }
+ var context = new VRMImporterContext();
+ context.ParseGlb(File.ReadAllBytes(path.FullPath));
+
+ var prefabPath = path.Parent.Child(path.FileNameWithoutExtension + ".prefab");
+
+ // save texture assets !
+ context.ExtractImages(prefabPath);
+
+ EditorApplication.delayCall += () =>
+ {
+ //
+ // after textures imported
+ //
+ context.Load();
+ context.SaveAsAsset(prefabPath);
+ context.EditorDestroyRoot();
+ };
+ }
+ }
+#endif
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs.meta
new file mode 100644
index 00000000..162103e6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 561392fdfe88bf14e83b6e89a075cc52
+timeCreated: 1517119659
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt.meta
new file mode 100644
index 00000000..62aecba1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 11125e99ded1b2941b4e6742fca5be7b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs
new file mode 100644
index 00000000..9fa73a5c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs
@@ -0,0 +1,185 @@
+using UnityEditor;
+using UnityEngine;
+using UniGLTF;
+using System.Linq;
+
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMLookAtHead))]
+ public class VRMLookAtHeadEditor : Editor
+ {
+ VRMLookAtHead m_target;
+ PreviewRenderUtility m_previewRenderUtility;
+
+#if UNITY_2017_1_OR_NEWER
+ struct Item
+ {
+ public Transform Transform;
+ public SkinnedMeshRenderer SkinnedMeshRenderer;
+ public Mesh Mesh;
+ public Material[] Materials;
+
+ public Mesh Baked()
+ {
+ if (SkinnedMeshRenderer != null)
+ {
+ if (Mesh == null)
+ {
+ Mesh = new Mesh();
+ }
+ SkinnedMeshRenderer.BakeMesh(Mesh);
+ }
+ return Mesh;
+ }
+ }
+ Item[] m_items;
+
+ void SetupItems()
+ {
+ m_items = m_target.transform.Traverse().Select(x =>
+ {
+ var meshFilter = x.GetComponent<MeshFilter>();
+ var meshRenderer = x.GetComponent<MeshRenderer>();
+ var skinnedMeshRenderer = x.GetComponent<SkinnedMeshRenderer>();
+ if (meshFilter != null && meshRenderer != null)
+ {
+ return new Item
+ {
+ Mesh = meshFilter.sharedMesh,
+ Transform = x.transform,
+ Materials = meshRenderer.sharedMaterials,
+ };
+ }
+ else if (skinnedMeshRenderer != null)
+ {
+ return new Item
+ {
+ //Mesh = skinnedMeshRenderer.sharedMesh,
+ SkinnedMeshRenderer = skinnedMeshRenderer,
+ Transform = x.transform,
+ Materials = skinnedMeshRenderer.sharedMaterials
+ };
+ }
+ else
+ {
+ return default(Item);
+ }
+ })
+ .Where(x => x.Transform != null)
+ .ToArray();
+ }
+#endif
+
+ void OnEnable()
+ {
+ m_target = (VRMLookAtHead)target;
+ m_previewRenderUtility = new PreviewRenderUtility(true);
+
+#if UNITY_2017_1_OR_NEWER
+ SetupItems();
+#endif
+ }
+
+ private void OnDisable()
+ {
+ m_previewRenderUtility.Cleanup();
+ m_previewRenderUtility = null;
+ }
+
+ static void SetPreviewCamera(Camera camera, Vector3 target, Vector3 forward)
+ {
+ camera.fieldOfView = 30f;
+ camera.farClipPlane = 100;
+ camera.nearClipPlane = 0.1f;
+
+ camera.transform.position = target + forward * 0.8f;
+ camera.transform.LookAt(target);
+ }
+
+ public override bool HasPreviewGUI()
+ {
+ return true;
+ }
+
+ public override void OnPreviewGUI(Rect r, GUIStyle background)
+ {
+ m_previewRenderUtility.BeginPreview(r, background);
+ var target = m_target.Head;
+ if (target != null)
+ {
+#if UNITY_2017_1_OR_NEWER
+ SetPreviewCamera(
+ m_previewRenderUtility.camera,
+ target.position + new Vector3(0, 0.1f, 0),
+ target.forward
+ );
+ for(int j=0; j<m_items.Length; ++j)
+ {
+ ref var x = ref m_items[j];
+ var mesh = x.Baked();
+ for(int i=0; i<x.Materials.Length; ++i)
+ {
+ m_previewRenderUtility.DrawMesh(mesh, x.Transform.position, x.Transform.rotation,
+ x.Materials[i], i);
+ }
+ }
+
+ m_previewRenderUtility.Render();
+#else
+ SetPreviewCamera(
+ m_previewRenderUtility.m_Camera,
+ target.position + new Vector3(0, 0.1f, 0),
+ target.forward
+ );
+ m_previewRenderUtility.m_Camera.Render();
+#endif
+ }
+ m_previewRenderUtility.EndAndDrawPreview(r);
+ }
+
+ const float RADIUS = 0.5f;
+
+ void OnSceneGUI()
+ {
+ if (m_target.Head == null) return;
+ if (!m_target.DrawGizmo) return;
+
+ if (m_target.Target != null)
+ {
+ {
+ EditorGUI.BeginChangeCheck();
+ var newTargetPosition = Handles.PositionHandle(m_target.Target.position, Quaternion.identity);
+ if (EditorGUI.EndChangeCheck())
+ {
+ Undo.RecordObject(m_target.Target, "Change Look At Target Position");
+ m_target.Target.position = newTargetPosition;
+ }
+ }
+
+ Handles.color = new Color(1, 1, 1, 0.6f);
+ Handles.DrawDottedLine(m_target.Head.position, m_target.Target.position, 4.0f);
+ }
+
+ Handles.matrix = m_target.Head.localToWorldMatrix;
+ Handles.Label(Vector3.zero, string.Format("Yaw: {0:0.}degree\nPitch: {1:0.}degree",
+ m_target.Yaw,
+ m_target.Pitch));
+
+ Handles.color = new Color(0, 1, 0, 0.2f);
+ Handles.DrawSolidArc(Vector3.zero,
+ Matrix4x4.identity.GetColumn(1),
+ Matrix4x4.identity.GetColumn(2),
+ m_target.Yaw,
+ RADIUS);
+
+ Handles.matrix = m_target.Head.localToWorldMatrix * m_target.YawMatrix;
+ Handles.color = new Color(1, 0, 0, 0.2f);
+ Handles.DrawSolidArc(Vector3.zero,
+ Matrix4x4.identity.GetColumn(0),
+ Matrix4x4.identity.GetColumn(2),
+ -m_target.Pitch,
+ RADIUS);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs.meta
new file mode 100644
index 00000000..637bbdae
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/LookAt/VRMLookAtHeadEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 6c4b1a599166c48488a860a0017c884a
+timeCreated: 1518293126
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta.meta
new file mode 100644
index 00000000..9f0aa7bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 04a204174b44d7a499298d6ca0cde1cc
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs
new file mode 100644
index 00000000..fac50451
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs
@@ -0,0 +1,29 @@
+using UnityEditor;
+
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMMeta))]
+ public class VRMMetaEditor : Editor
+ {
+ Editor m_Inspector;
+ SerializedProperty m_VRMMetaObjectProp;
+
+ private void OnDestroy()
+ {
+ UnityEditor.Editor.DestroyImmediate(m_Inspector);
+ }
+
+ private void OnEnable()
+ {
+ m_VRMMetaObjectProp = serializedObject.FindProperty("Meta");
+ m_Inspector = Editor.CreateEditor(m_VRMMetaObjectProp.objectReferenceValue);
+ }
+
+ public override void OnInspectorGUI()
+ {
+ EditorGUILayout.PropertyField(m_VRMMetaObjectProp);
+ m_Inspector.OnInspectorGUI();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs.meta
new file mode 100644
index 00000000..63aaa988
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ca21d8c33b34adc4db45afd930049fc1
+timeCreated: 1522989712
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs
new file mode 100644
index 00000000..206ce5a2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs
@@ -0,0 +1,250 @@
+using UnityEditor;
+using UnityEngine;
+using VRM.M17N;
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMMetaObject))]
+ public class VRMMetaObjectEditor : Editor
+ {
+ class ValidateProperty
+ {
+ public SerializedProperty m_prop;
+
+ public delegate (string, MessageType) Validator(SerializedProperty prop);
+ Validator m_validator;
+
+ public ValidateProperty(SerializedProperty prop, Validator validator)
+ {
+ m_prop = prop;
+ m_validator = validator;
+ }
+
+ public void OnGUI()
+ {
+ // var old = m_prop.stringValue;
+ EditorGUILayout.PropertyField(m_prop);
+ var (msg, msgType) = m_validator(m_prop);
+ if (!string.IsNullOrEmpty(msg))
+ {
+ EditorGUILayout.HelpBox(msg, msgType);
+ }
+ // return old != m_prop.stringValue;
+ }
+ }
+
+ VRMMetaObject m_target;
+ SerializedProperty m_Script;
+ SerializedProperty m_exporterVersion;
+ SerializedProperty m_thumbnail;
+ ValidateProperty m_title;
+ ValidateProperty m_version;
+ ValidateProperty m_author;
+ ValidateProperty m_contact;
+ ValidateProperty m_reference;
+
+ SerializedProperty m_AllowedUser;
+ SerializedProperty m_ViolentUssage;
+ SerializedProperty m_SexualUssage;
+ SerializedProperty m_CommercialUssage;
+ SerializedProperty m_OtherPermissionUrl;
+
+ SerializedProperty m_LicenseType;
+ SerializedProperty m_OtherLicenseUrl;
+
+ static string RequiredMessage(string name)
+ {
+ switch (M17N.Getter.Lang)
+ {
+ case M17N.Languages.ja:
+ return $"必須項目。{name} を入力してください";
+
+ case M17N.Languages.en:
+ return $"{name} is required";
+
+ default:
+ throw new System.NotImplementedException();
+ }
+ }
+
+ private void OnEnable()
+ {
+ m_target = (VRMMetaObject)target;
+
+ m_Script = serializedObject.FindProperty("m_Script");
+ m_exporterVersion = serializedObject.FindProperty(nameof(m_target.ExporterVersion));
+ m_thumbnail = serializedObject.FindProperty(nameof(m_target.Thumbnail));
+ m_title = new ValidateProperty(serializedObject.FindProperty(nameof(m_target.Title)), prop =>
+ {
+ if (string.IsNullOrEmpty(prop.stringValue))
+ {
+ return (RequiredMessage(prop.name), MessageType.Error);
+ }
+ return ("", MessageType.None);
+ });
+ m_version = new ValidateProperty(serializedObject.FindProperty(nameof(m_target.Version)), prop =>
+ {
+ if (string.IsNullOrEmpty(prop.stringValue))
+ {
+ return (RequiredMessage(prop.name), MessageType.Error);
+ }
+ return ("", MessageType.None);
+ });
+ m_author = new ValidateProperty(serializedObject.FindProperty(nameof(m_target.Author)), prop =>
+ {
+ if (string.IsNullOrEmpty(prop.stringValue))
+ {
+ return (RequiredMessage(prop.name), MessageType.Error);
+ }
+ return ("", MessageType.None);
+ });
+ m_contact = new ValidateProperty(serializedObject.FindProperty(nameof(m_target.ContactInformation)), prop =>
+ {
+ return ("", MessageType.None);
+ });
+ m_reference = new ValidateProperty(serializedObject.FindProperty(nameof(m_target.Reference)), prop =>
+ {
+ return ("", MessageType.None);
+ });
+
+ m_AllowedUser = serializedObject.FindProperty(nameof(m_target.AllowedUser));
+ m_ViolentUssage = serializedObject.FindProperty(nameof(m_target.ViolentUssage));
+ m_SexualUssage = serializedObject.FindProperty(nameof(m_target.SexualUssage));
+ m_CommercialUssage = serializedObject.FindProperty(nameof(m_target.CommercialUssage));
+ m_OtherPermissionUrl = serializedObject.FindProperty(nameof(m_target.OtherLicenseUrl));
+
+ m_LicenseType = serializedObject.FindProperty(nameof(m_target.LicenseType));
+ m_OtherLicenseUrl = serializedObject.FindProperty(nameof(m_target.OtherLicenseUrl));
+ }
+
+ enum MessageKeys
+ {
+ [LangMsg(Languages.ja, "アバターの人格に関する許諾範囲")]
+ [LangMsg(Languages.en, "Personation / Characterization Permission")]
+ PERSONATION,
+
+ [LangMsg(Languages.ja, "アバターに人格を与えることの許諾範囲")]
+ [LangMsg(Languages.en, "A person who can perform with this avatar")]
+ ALLOWED_USER,
+
+ [LangMsg(Languages.ja, "このアバターを用いて暴力表現を演じることの許可")]
+ [LangMsg(Languages.en, "Violent acts using this avatar")]
+ VIOLENT_USAGE,
+
+ [LangMsg(Languages.ja, "このアバターを用いて性的表現を演じることの許可")]
+ [LangMsg(Languages.en, "Sexuality acts using this avatar")]
+ SEXUAL_USAGE,
+
+ [LangMsg(Languages.ja, "商用利用の許可")]
+ [LangMsg(Languages.en, "For commercial use")]
+ COMMERCIAL_USAGE,
+
+ [LangMsg(Languages.ja, "再配布・改変に関する許諾範囲")]
+ [LangMsg(Languages.en, "Redistribution / Modifications License")]
+ REDISTRIBUTION_MODIFICATIONS,
+
+ // [LangMsg(Languages.ja, "")]
+ // [LangMsg(Languages.en, "")]
+ }
+
+ static string Msg(MessageKeys key)
+ {
+ return M17N.Getter.Msg(key);
+ }
+
+ bool m_foldoutInfo = true;
+ bool m_foldoutPermission = true;
+ bool m_foldoutDistribution = true;
+
+ public override void OnInspectorGUI()
+ {
+ serializedObject.Update();
+
+ if (VRMVersion.IsNewer(m_exporterVersion.stringValue))
+ {
+ EditorGUILayout.HelpBox("Check UniVRM new version. https://github.com/dwango/UniVRM/releases", MessageType.Warning);
+ }
+
+ // texture
+ EditorGUILayout.BeginHorizontal();
+ {
+ EditorGUILayout.BeginVertical();
+ GUI.enabled = false;
+ EditorGUILayout.PropertyField(m_exporterVersion);
+ GUI.enabled = true;
+ EditorGUILayout.PropertyField(m_thumbnail);
+ EditorGUILayout.EndVertical();
+ m_thumbnail.objectReferenceValue = TextureField("", (Texture2D)m_thumbnail.objectReferenceValue, 100);
+ }
+ EditorGUILayout.EndHorizontal();
+
+ m_foldoutInfo = EditorGUILayout.Foldout(m_foldoutInfo, "Information");
+ if (m_foldoutInfo)
+ {
+ m_title.OnGUI();
+ m_version.OnGUI();
+ m_author.OnGUI();
+ m_contact.OnGUI();
+ m_reference.OnGUI();
+ }
+ // EditorGUILayout.LabelField("License ", EditorStyles.boldLabel);
+ m_foldoutPermission = EditorGUILayout.Foldout(m_foldoutPermission, Msg(MessageKeys.PERSONATION));
+ if (m_foldoutPermission)
+ {
+ var backup = EditorGUIUtility.labelWidth;
+ RightFixedPropField(m_AllowedUser, Msg(MessageKeys.ALLOWED_USER));
+ RightFixedPropField(m_ViolentUssage, Msg(MessageKeys.VIOLENT_USAGE));
+ RightFixedPropField(m_SexualUssage, Msg(MessageKeys.SEXUAL_USAGE));
+ RightFixedPropField(m_CommercialUssage, Msg(MessageKeys.COMMERCIAL_USAGE));
+ EditorGUILayout.PropertyField(m_OtherPermissionUrl, new GUIContent("Other License Url"));
+ EditorGUIUtility.labelWidth = backup;
+ }
+
+ m_foldoutDistribution = EditorGUILayout.Foldout(m_foldoutDistribution, Msg(MessageKeys.REDISTRIBUTION_MODIFICATIONS));
+ if (m_foldoutDistribution)
+ {
+ var licenseType = m_LicenseType;
+ EditorGUILayout.PropertyField(licenseType);
+ if ((LicenseType)licenseType.intValue == LicenseType.Other)
+ {
+ EditorGUILayout.PropertyField(m_OtherLicenseUrl);
+ }
+ }
+
+ serializedObject.ApplyModifiedProperties();
+ }
+
+ static (Rect, Rect) FixedRight(Rect r, int width)
+ {
+ if (width > r.width)
+ {
+ width = (int)r.width;
+ }
+ return (
+ new Rect(r.x, r.y, r.width - width, r.height),
+ new Rect(r.x + r.width - width, r.y, width, r.height)
+ );
+ }
+
+ static void RightFixedPropField(SerializedProperty prop, string label)
+ {
+ var r = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(EditorGUIUtility.singleLineHeight));
+ var (left, right) = FixedRight(r, 64);
+ // Debug.Log($"{left}, {right}");
+ EditorGUI.LabelField(left, label);
+ EditorGUI.PropertyField(right, prop, new GUIContent(""), false);
+ }
+
+ private static Texture2D TextureField(string name, Texture2D texture, int size)
+ {
+ GUILayout.BeginHorizontal();
+ var style = new GUIStyle(GUI.skin.label);
+ style.alignment = TextAnchor.UpperCenter;
+ //style.fixedWidth = size;
+ GUILayout.Label(name, style);
+ var result = (Texture2D)EditorGUILayout.ObjectField(texture, typeof(Texture2D), false, GUILayout.Width(size), GUILayout.Height(size));
+ GUILayout.EndVertical();
+ return result;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs.meta
new file mode 100644
index 00000000..b14c584e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Meta/VRMMetaObjectEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c244f35fd2772004c9d51095f6326420
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility.meta
new file mode 100644
index 00000000..45dc7e07
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 19a2ce0e7783c634691240378ed54c47
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs
new file mode 100644
index 00000000..9eb266a1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs
@@ -0,0 +1,161 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UniGLTF;
+using UnityEditor;
+using UnityEngine;
+using Object = UnityEngine.Object;
+
+
+namespace VRM
+{
+ /// <summary>
+ /// 複数のメッシュをまとめて、BlendShapeClipに変更を反映する
+ /// </summary>
+ [DisallowMultipleComponent]
+ public static class MeshIntegratorEditor
+ {
+ const string MENU_KEY = "Mesh Utility/MeshIntegrator";
+ const string ASSET_SUFFIX = ".mesh.asset";
+
+ [MenuItem(MENU_KEY, true)]
+ private static bool ExportValidate()
+ {
+ return Selection.activeObject != null &&
+ Selection.activeObject is GameObject &&
+ SkinnedMeshUtility.IsPrefab(Selection.activeObject);
+ }
+
+ [MenuItem(MENU_KEY, priority = 1)]
+ private static void ExportFromMenu()
+ {
+ var go = Selection.activeObject as GameObject;
+
+ Integrate(go);
+ }
+
+ //[MenuItem("Assets/fooa", false)]
+ //private static void Foo()
+ //{
+ // var go = Selection.activeObject as GameObject;
+
+ // Debug.Log(SkinnedMeshUtility.IsPrefab(go));
+ //}
+
+
+ public static List<MeshUtility.MeshIntegrationResult> Integrate(GameObject prefab)
+ {
+ Undo.RecordObject(prefab, "Mesh Integration");
+ var instance = SkinnedMeshUtility.InstantiatePrefab(prefab);
+
+
+ var clips = new List<BlendShapeClip>();
+ var proxy = instance.GetComponent<VRMBlendShapeProxy>();
+ if (proxy != null && proxy.BlendShapeAvatar != null)
+ {
+ clips = proxy.BlendShapeAvatar.Clips;
+ }
+ foreach (var clip in clips)
+ {
+ Undo.RecordObject(clip, "Mesh Integration");
+ }
+
+ // Backup Exists
+ BackupVrmPrefab(prefab);
+
+ // Execute
+ var results = VRMMeshIntegratorUtility.Integrate(instance, clips);
+
+ foreach (var res in results)
+ {
+ if (res.IntegratedRenderer == null) continue;
+
+ SaveMeshAsset(res.IntegratedRenderer.sharedMesh, instance, res.IntegratedRenderer.gameObject.name);
+ Undo.RegisterCreatedObjectUndo(res.IntegratedRenderer.gameObject, "Integrate Renderers");
+ }
+
+ // destroy source renderers
+ foreach (var res in results)
+ {
+ foreach (var renderer in res.SourceSkinnedMeshRenderers)
+ {
+ Undo.RecordObject(renderer.gameObject, "Deactivate old renderer");
+ renderer.gameObject.SetActive(false);
+ }
+
+ foreach (var renderer in res.SourceMeshRenderers)
+ {
+ Undo.RecordObject(renderer.gameObject, "Deactivate old renderer");
+ renderer.gameObject.SetActive(false);
+ }
+ }
+
+ // Apply to Prefab
+ SkinnedMeshUtility.ApplyChangesToPrefab(instance);
+ Object.DestroyImmediate(instance);
+
+ return results;
+ }
+
+ private static void BackupVrmPrefab(GameObject rootPrefab)
+ {
+ var proxy = rootPrefab.GetComponent<VRMBlendShapeProxy>();
+
+ var srcAvatar = proxy.BlendShapeAvatar;
+ var dstAvatar = (BlendShapeAvatar)BackupAsset(srcAvatar, rootPrefab);
+
+ var clipMapper = srcAvatar.Clips.ToDictionary(x => x, x => (BlendShapeClip)BackupAsset(x, rootPrefab));
+ dstAvatar.Clips = clipMapper.Values.ToList();
+
+ var dstPrefab = BackupAsset(rootPrefab, rootPrefab);
+ var dstInstance = SkinnedMeshUtility.InstantiatePrefab(dstPrefab);
+ dstInstance.GetComponent<VRMBlendShapeProxy>().BlendShapeAvatar = dstAvatar;
+ SkinnedMeshUtility.ApplyChangesToPrefab(dstInstance);
+ Object.DestroyImmediate(dstInstance);
+ }
+
+ private static T BackupAsset<T>(T asset, GameObject rootPrefab) where T : UnityEngine.Object
+ {
+ var srcAssetPath = UnityPath.FromAsset(asset);
+ var assetName = srcAssetPath.FileName;
+
+ var backupDir = "MeshIntegratorBackup";
+ var backupPath = UnityPath.FromAsset(rootPrefab).Parent.Child(backupDir);
+ backupPath.EnsureFolder();
+ var dstAssetPath = backupPath.Child(assetName);
+
+ AssetDatabase.CopyAsset(srcAssetPath.Value, dstAssetPath.Value);
+ return dstAssetPath.LoadAsset<T>();
+ }
+
+ private static string GetRootPrefabPath(GameObject go)
+ {
+ var prefab = SkinnedMeshUtility.IsPrefab(go) ? go : SkinnedMeshUtility.GetPrefab(go);
+ var assetPath = "";
+ if (prefab != null)
+ {
+ var prefabPath = AssetDatabase.GetAssetPath(prefab);
+ assetPath = string.Format("{0}/", Path.GetDirectoryName(prefabPath));
+ }
+ else
+ {
+ assetPath = string.Format("Assets/");
+ }
+ assetPath = assetPath.Replace(@"\", @"/");
+ return assetPath;
+ }
+
+ private static void SaveMeshAsset(Mesh mesh, GameObject go, string name)
+ {
+ var assetPath = Path.Combine(GetRootPrefabPath(go), string.Format("{0}{1}",
+ name,
+ ASSET_SUFFIX
+ ));
+
+ Debug.LogFormat("CreateAsset: {0}", assetPath);
+ AssetDatabase.CreateAsset(mesh, assetPath);
+ }
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs.meta
new file mode 100644
index 00000000..f87becc3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorEditor.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 648920943c26bde4b920119bdbb38f70
+timeCreated: 1518194696
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs
new file mode 100644
index 00000000..f931b281
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs
@@ -0,0 +1,170 @@
+#pragma warning disable 0414, 0649
+using UnityEditor;
+using UnityEngine;
+using System.Linq;
+using System;
+using System.Collections.Generic;
+
+
+namespace VRM
+{
+ public class MeshIntegratorWizard : ScriptableWizard
+ {
+ const string MENU_KEY = "Assets/UnityEditorScripts/MeshIntegratorWizard";
+
+ [SerializeField]
+ GameObject m_root;
+
+ [SerializeField]
+ Material[] m_uniqueMaterials;
+
+ [Serializable]
+ struct MaterialKey
+ {
+ public string Shader;
+ public KeyValuePair<string, object>[] Properties;
+
+ public override bool Equals(object obj)
+ {
+ if(!(obj is MaterialKey))
+ {
+ return base.Equals(obj);
+ }
+
+ var key = (MaterialKey)obj;
+
+ return Shader == key.Shader
+ && Properties.SequenceEqual(key.Properties)
+ ;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+
+ [Serializable]
+ struct MaterialList
+ {
+ public Material[] Materials;
+
+ public MaterialList(Material[] list)
+ {
+ Materials = list;
+ }
+ }
+ [SerializeField]
+ MaterialList[] m_duplicateMaterials;
+
+ [Header("Result")]
+ public MeshUtility.MeshIntegrationResult[] integrationResults;
+
+ [MenuItem(MENU_KEY)]
+ static void CreateWizard()
+ {
+ ScriptableWizard.DisplayWizard<MeshIntegratorWizard>("MeshIntegrator", "Integrate and close window", "Integrate");
+ }
+
+ private void OnEnable()
+ {
+ m_root = Selection.activeGameObject;
+ OnValidate();
+ }
+
+ static object GetPropertyValue(Shader shader, int i, Material m)
+ {
+ var propType = ShaderUtil.GetPropertyType(shader, i);
+ switch (propType)
+ {
+ case ShaderUtil.ShaderPropertyType.Color:
+ return m.GetColor(ShaderUtil.GetPropertyName(shader, i));
+
+ case ShaderUtil.ShaderPropertyType.Range:
+ case ShaderUtil.ShaderPropertyType.Float:
+ return m.GetFloat(ShaderUtil.GetPropertyName(shader, i));
+
+ case ShaderUtil.ShaderPropertyType.Vector:
+ return m.GetVector(ShaderUtil.GetPropertyName(shader, i));
+
+ case ShaderUtil.ShaderPropertyType.TexEnv:
+ return m.GetTexture(ShaderUtil.GetPropertyName(shader, i));
+
+ default:
+ throw new NotImplementedException(propType.ToString());
+ }
+ }
+
+ static MaterialKey GetMaterialKey(Material m)
+ {
+ var key = new MaterialKey
+ {
+ Shader = m.shader.name,
+ };
+
+ key.Properties = Enumerable.Range(0, ShaderUtil.GetPropertyCount(m.shader))
+ .Select(x => new KeyValuePair<string, object>(
+ ShaderUtil.GetPropertyName(m.shader, x),
+ GetPropertyValue(m.shader, x, m))
+ )
+ .OrderBy(x => x.Key)
+ .ToArray()
+ ;
+
+ return key;
+ }
+
+ void OnValidate()
+ {
+ Debug.Log("OnValidate");
+ if (m_root == null)
+ {
+ m_uniqueMaterials = new Material[] { };
+ m_duplicateMaterials = new MaterialList[] { };
+ return;
+ }
+
+ m_uniqueMaterials = MeshUtility.MeshIntegratorUtility.EnumerateSkinnedMeshRenderer(m_root.transform, false)
+ .SelectMany(x => x.sharedMaterials)
+ .Distinct()
+ .ToArray();
+
+ m_duplicateMaterials = m_uniqueMaterials
+ .GroupBy(x => GetMaterialKey(x), x => x)
+ .Select(x => new MaterialList(x.ToArray()))
+ .Where(x => x.Materials.Length > 1)
+ .ToArray()
+ ;
+ }
+
+ void OnWizardUpdate()
+ {
+ helpString = "select target mesh root";
+ }
+
+ void Integrate()
+ {
+ if (m_root == null)
+ {
+ Debug.LogWarning("no root object");
+ return;
+ }
+
+ integrationResults = MeshIntegratorEditor.Integrate(m_root).ToArray();
+ }
+
+ void OnWizardCreate()
+ {
+ Debug.Log("OnWizardCreate");
+ Integrate();
+
+ // close
+ }
+
+ void OnWizardOtherButton()
+ {
+ Debug.Log("OnWizardOtherButton");
+ Integrate();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs.meta
new file mode 100644
index 00000000..19c7bdf9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/MeshIntegratorWizard.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 744f66c7013807b4cae1d38d2ecfff38
+timeCreated: 1518503829
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs
new file mode 100644
index 00000000..20c05a31
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs
@@ -0,0 +1,59 @@
+using System;
+using UnityEditor;
+using UnityEngine;
+using Object = UnityEngine.Object;
+
+namespace VRM
+{
+ public static class SkinnedMeshUtility
+ {
+ public const string MENU_KEY = "GameObject/UnityEditorScripts/";
+ public const int MENU_PRIORITY = 11;
+
+ public static Object GetPrefab(GameObject instance)
+ {
+#if UNITY_2018_2_OR_NEWER
+ return PrefabUtility.GetCorrespondingObjectFromSource(instance);
+#else
+ return PrefabUtility.GetPrefabParent(go);
+#endif
+ }
+
+ public static bool IsPrefab(Object instance)
+ {
+ if (instance == null)
+ {
+ return false;
+ }
+ if (PrefabUtility.GetPrefabAssetType(instance) != PrefabAssetType.Regular)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public static void ApplyChangesToPrefab(GameObject instance)
+ {
+ var prefab = GetPrefab(instance);
+ if (prefab == null)
+ {
+ return;
+ }
+
+ var path = AssetDatabase.GetAssetPath(prefab);
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ PrefabUtility.SaveAsPrefabAssetAndConnect(instance, path, InteractionMode.AutomatedAction);
+ }
+
+ public static GameObject InstantiatePrefab(GameObject prefab)
+ {
+ if (!IsPrefab(prefab)) return null;
+
+ return (GameObject)PrefabUtility.InstantiatePrefab(prefab);
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs.meta
new file mode 100644
index 00000000..6cda243d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SkinnedMeshUtility/SkinnedMeshUtility.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: d66a91f4b51e42a6b165fe39fdb48d64
+timeCreated: 1559541677 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone.meta
new file mode 100644
index 00000000..82f0a5ba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 89f2a80d3b112504eaa38231bd7e1a71
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs
new file mode 100644
index 00000000..89f5192f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs
@@ -0,0 +1,81 @@
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [CustomEditor(typeof(VRMSpringBoneColliderGroup))]
+ public class VRMSpringBoneColliderGroupEditor : Editor
+ {
+ VRMSpringBoneColliderGroup m_target;
+
+ private void OnEnable()
+ {
+ m_target = (VRMSpringBoneColliderGroup)target;
+ }
+
+ private void OnSceneGUI()
+ {
+ Undo.RecordObject(m_target, "VRMSpringBoneColliderGroupEditor");
+
+ Handles.matrix = m_target.transform.localToWorldMatrix;
+ Gizmos.color = Color.green;
+
+ bool changed = false;
+
+ foreach (var x in m_target.Colliders)
+ {
+ var offset = Handles.PositionHandle(x.Offset, Quaternion.identity);
+ if (offset != x.Offset)
+ {
+ changed = true;
+ x.Offset = offset;
+ }
+ }
+
+ if (changed)
+ {
+ EditorUtility.SetDirty(m_target);
+ }
+ }
+
+ [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/X Mirror")]
+ private static void InvertOffsetX(MenuCommand command)
+ {
+ var target = command.context as VRMSpringBoneColliderGroup;
+ if (target == null) return;
+
+ Undo.RecordObject(target, "X Mirror");
+
+ foreach (var sphereCollider in target.Colliders)
+ {
+ var offset = sphereCollider.Offset;
+ offset.x *= -1f;
+ sphereCollider.Offset = offset;
+ }
+ }
+
+ [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Radius")]
+ private static void SortByRadius(MenuCommand command)
+ {
+ var target = command.context as VRMSpringBoneColliderGroup;
+ if (target == null) return;
+
+ Undo.RecordObject(target, "Sort Colliders by Radius");
+
+ target.Colliders = target.Colliders.OrderBy(x => -x.Radius).ToArray();
+ }
+
+ [MenuItem("CONTEXT/VRMSpringBoneColliderGroup/Sort Colliders by Offset Y")]
+ private static void SortByOffsetY(MenuCommand command)
+ {
+ var target = command.context as VRMSpringBoneColliderGroup;
+ if (target == null) return;
+
+ Undo.RecordObject(target, "Sort Colliders by Offset Y");
+
+ target.Colliders = target.Colliders.OrderBy(x => -x.Offset.y).ToArray();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs.meta
new file mode 100644
index 00000000..dab2d9cd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneColliderGroupEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1f8b723890cc43042b070277cb3b73ef
+timeCreated: 1519735770
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs
new file mode 100644
index 00000000..ee6968c9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs
@@ -0,0 +1,104 @@
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+namespace VRM
+{
+ static class VRMSpringBoneValidator
+ {
+ // https://github.com/vrm-c/UniVRM/issues/474
+ public static IEnumerable<Validation> Validate(GameObject root)
+ {
+ if (root == null)
+ {
+ yield break;
+ }
+
+ var hierarchy = root.GetComponentsInChildren<Transform>(true);
+
+ Dictionary<Transform, List<VRMSpringBone>> rootMap = new Dictionary<Transform, List<VRMSpringBone>>();
+
+ foreach (var sb in root.GetComponentsInChildren<VRMSpringBone>())
+ {
+ for (int i = 0; i < sb.RootBones.Count; ++i)
+ {
+ var springRoot = sb.RootBones[i];
+ if (springRoot == null)
+ {
+ yield return Validation.Error($"[VRMSpringBone]{sb.name}.RootBones[{i}] is null");
+ continue;
+ }
+ if (!hierarchy.Contains(springRoot))
+ {
+ yield return Validation.Error($"[VRMSpringBone]{sb.name}.RootBones[{i}] is out of hierarchy");
+ continue;
+ }
+ if (!springRoot.transform.EnableForExport())
+ {
+ yield return Validation.Error($"[VRMSpringBone]{sb.name}.RootBones[{i}] is not active");
+ continue;
+ }
+
+ if (!rootMap.TryGetValue(springRoot, out List<VRMSpringBone> list))
+ {
+ list = new List<VRMSpringBone>();
+ rootMap.Add(springRoot, list);
+ }
+ list.Add(sb);
+ }
+
+ for (int i = 0; i < sb.ColliderGroups.Length; ++i)
+ {
+ var c = sb.ColliderGroups[i];
+ if (c == null)
+ {
+ yield return Validation.Error($"{sb.name}.ColliderGroups[{i}] is null");
+ continue;
+ }
+ if (!hierarchy.Contains(c.transform))
+ {
+ yield return Validation.Error($"{sb.name}.ColliderGroups[{i}] is out of hierarchy");
+ continue;
+ }
+ }
+ }
+
+ foreach (var kv in rootMap)
+ {
+ if (kv.Value.Count > 1)
+ {
+ // * GameObjectが複数回ルートとして指定されてる(SpringBoneが同じでも別でも)
+ var list = string.Join(", ", kv.Value.Select(x => string.IsNullOrEmpty(x.m_comment) ? x.name : x.m_comment));
+ yield return Validation.Warning($"{kv.Key} found multiple. {list}");
+ }
+
+ var rootInRootMap = new Dictionary<Transform, List<Transform>>();
+ foreach (var child in kv.Key.GetComponentsInChildren<Transform>())
+ {
+ // * Rootから子をだどって、別のRootが現れる
+ if (child == kv.Key)
+ {
+ continue;
+ }
+
+ if (!rootMap.ContainsKey(child))
+ {
+ continue;
+ }
+
+ if (!rootInRootMap.TryGetValue(kv.Key, out List<Transform> rootInRoot))
+ {
+ rootInRoot = new List<Transform>();
+ rootInRootMap.Add(kv.Key, rootInRoot);
+ }
+ rootInRoot.Add(child);
+ }
+ foreach (var rootList in rootInRootMap)
+ {
+ var list = string.Join(", ", rootList.Value.Select(x => x.name));
+ yield return Validation.Warning($"{rootList.Key} hierarchy contains other root: {list}");
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs.meta
new file mode 100644
index 00000000..1a9e37b0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/SpringBone/VRMSpringBoneValidator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dc588ccd280c0e2429d1d3cc3db5d950
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs
new file mode 100644
index 00000000..76a1c748
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+
+namespace VRM
+{
+
+ static class TabBar
+ {
+ public static T OnGUI<T>(T t, GUIStyle buttonStyle, GUI.ToolbarButtonSize buttonSize) where T : Enum
+ {
+ using (new EditorGUILayout.HorizontalScope())
+ {
+ GUILayout.FlexibleSpace();
+ // タブを描画する
+ var value = GUILayout.Toolbar((int)(object)t, TabCache<T>.TabToggles, buttonStyle, buttonSize);
+ GUILayout.FlexibleSpace();
+ return (T)(object)value;
+ }
+ }
+ static class TabCache<T> where T : Enum
+ {
+ private static GUIContent[] _tabToggles = null;
+
+ public static GUIContent[] TabToggles
+ {
+ get
+ {
+ if (_tabToggles == null)
+ {
+ _tabToggles = System.Enum.GetNames(typeof(T)).Select(x => new GUIContent(x)).ToArray();
+ }
+ return _tabToggles;
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs.meta
new file mode 100644
index 00000000..ee1d88d4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/TabBar.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a93e997ef78acca448e14f07cb06e18a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests.meta
new file mode 100644
index 00000000..9acbf73c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 0903c33afe5ef6346ad9526e78055293
+folderAsset: yes
+timeCreated: 1521799604
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs
new file mode 100644
index 00000000..7d5b4d6d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs
@@ -0,0 +1,21 @@
+using NUnit.Framework;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class EnumUtilTest
+ {
+ [Test]
+ public void EnumUtilTestSimplePasses()
+ {
+ Assert.AreEqual(default(HumanBodyBones), EnumUtil.TryParseOrDefault<HumanBodyBones>("xxx"));
+
+#if UNITY_5_6_OR_NEWER
+ Assert.AreEqual(HumanBodyBones.UpperChest, EnumUtil.TryParseOrDefault<HumanBodyBones>("upperchest"));
+#else
+ Assert.AreEqual(default(HumanBodyBones), EnumUtil.TryParseOrDefault<HumanBodyBones>("upperchest"));
+#endif
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs.meta
new file mode 100644
index 00000000..7082ee76
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/EnumUtilTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d4a5f44a23cb4884b9667b622f262497
+timeCreated: 1523088686
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs
new file mode 100644
index 00000000..003027f5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs
@@ -0,0 +1,48 @@
+using NUnit.Framework;
+using System.Linq;
+using System.IO;
+
+namespace VRM
+{
+ public class InvalidFileNameTest
+ {
+ [Test]
+ [TestCase("VRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMVRMV", true)]
+ [TestCase("VRMFormatVRMFormatVRMFormatVRMFormatVRMFormatVRMFormatVRMFormat", false)]
+ [TestCase("UniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRM", true)]
+ [TestCase("UniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniVRMUniV", false)]
+ [TestCase("AliciaAliciaAliciaAliciaAliciaAliciaAliciaAliciaAliciaAliciaAliciaAlicia", true)]
+ public void DetectFileNameLength(string fileName, bool isIllegal)
+ {
+ var result = VRMExporterValidator.IsFileNameLengthTooLong(fileName);
+ Assert.AreEqual(result, isIllegal);
+ }
+
+ [Test]
+ [TestCase("\u0000\u0042\u0062", true)]
+ [TestCase("\u0045\u0046\u0047\u0065\u0068\u0036", false)]
+ [TestCase("\u0043\u0045\u0047\u007F", true)]
+ [TestCase("\u0000\u0042\u0062", true)]
+ [TestCase("\u003A\u0039\u005C\u0060\u0074", false)]
+ [TestCase("\u005D\u006F\u001C\u007A\u0036\u0049", true)]
+ public void DetectControlCharacters(string fileName, bool isIllegal)
+ {
+ var result = fileName.Any(x => char.IsControl(x));
+ Assert.AreEqual(result, isIllegal);
+ }
+
+ [Test]
+ [TestCase("VRM|Alicia?VRM", true)]
+ [TestCase("UniVRMUniVRM:UniVRM", true)]
+ [TestCase("VRMIsVRFileFormat", false)]
+ [TestCase("Alicia<Alicia>Alicia", true)]
+ [TestCase("UniVRMIsVRMImplementationInUnityPlatform", false)]
+ [TestCase("Avator*Avator/Avator", true)]
+ public void DetectInvalidCharacters(string fileName, bool isIllegal)
+ {
+ char[] invalidPathChars = Path.GetInvalidFileNameChars();
+ var result = fileName.Any(x => invalidPathChars.Contains(x));
+ Assert.AreEqual(result, isIllegal);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs.meta
new file mode 100644
index 00000000..aa5f1146
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/InvalidFileNameTest.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8511ed091b59bca4da4fd280693b7c82
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs
new file mode 100644
index 00000000..6be712b0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs
@@ -0,0 +1,63 @@
+using NUnit.Framework;
+using UnityEngine;
+using System.Linq;
+
+namespace VRM
+{
+ public class MeshTests
+ {
+ public static void MeshEquals(Mesh l, Mesh r)
+ {
+#if UNITY_2017_3_OR_NEWER
+ Assert.AreEqual(l.indexFormat, r.indexFormat);
+#endif
+ Assert.True(l.vertices.SequenceEqual(r.vertices));
+ Assert.True(l.normals.SequenceEqual(r.normals));
+ Assert.True(l.tangents.SequenceEqual(r.tangents));
+ Assert.True(l.uv.SequenceEqual(r.uv));
+ Assert.True(l.uv2.SequenceEqual(r.uv2));
+ Assert.True(l.uv3.SequenceEqual(r.uv3));
+ Assert.True(l.uv4.SequenceEqual(r.uv4));
+ Assert.True(l.colors.SequenceEqual(r.colors));
+ Assert.True(l.boneWeights.SequenceEqual(r.boneWeights));
+ Assert.True(l.bindposes.SequenceEqual(r.bindposes));
+
+ Assert.AreEqual(l.subMeshCount, r.subMeshCount);
+ for (int i = 0; i < l.subMeshCount; ++i)
+ {
+ Assert.True(l.GetIndices(i).SequenceEqual(r.GetIndices(i)));
+ }
+
+ Assert.AreEqual(l.blendShapeCount, r.blendShapeCount);
+ for (int i = 0; i < l.blendShapeCount; ++i)
+ {
+ Assert.AreEqual(l.GetBlendShapeName(i), r.GetBlendShapeName(i));
+ Assert.AreEqual(l.GetBlendShapeFrameCount(i), r.GetBlendShapeFrameCount(i));
+ Assert.AreEqual(l.GetBlendShapeFrameWeight(i, 0), r.GetBlendShapeFrameWeight(i, 0));
+
+ var lv = l.vertices;
+ var ln = l.vertices;
+ var lt = l.vertices;
+ var rv = r.vertices;
+ var rn = r.vertices;
+ var rt = r.vertices;
+ l.GetBlendShapeFrameVertices(i, 0, lv, ln, lt);
+ r.GetBlendShapeFrameVertices(i, 0, rv, rn, rt);
+ Assert.True(lv.SequenceEqual(rv));
+ Assert.True(ln.SequenceEqual(rn));
+ Assert.True(lt.SequenceEqual(rt));
+ }
+ }
+
+ [Test]
+ public void MeshCopyTest()
+ {
+ var src = new Mesh();
+ src.AddBlendShapeFrame("blendShape", 100.0f, null, null, null);
+
+ var dst = MeshUtility.MeshExtensions.Copy(src, true);
+
+ MeshEquals(src, dst);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs.meta
new file mode 100644
index 00000000..2b91dd68
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/MeshTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0fa06e6e83b995a49a1357924b9ef23e
+timeCreated: 1533274120
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs
new file mode 100644
index 00000000..1126b647
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs
@@ -0,0 +1,89 @@
+using System.Collections.Generic;
+using System.Linq;
+using NUnit.Framework;
+using UnityEngine;
+
+namespace VRM
+{
+ public class NormalizeTests
+ {
+ class BoneMap
+ {
+ public List<Transform> SrcBones = new List<Transform>();
+ public List<Transform> DstBones = new List<Transform>();
+ public Dictionary<Transform, Transform> Map = new Dictionary<Transform, Transform>();
+
+ public void Add(GameObject src, GameObject dst)
+ {
+ SrcBones.Add(src?.transform);
+ if (dst != null)
+ {
+ DstBones.Add(dst.transform);
+ }
+ if (src != null)
+ {
+ Map.Add(src?.transform, dst?.transform);
+ }
+ }
+
+ public IEnumerable<BoneWeight> CreateBoneWeight(int vertexCount)
+ {
+ int j = 0;
+ for (int i = 0; i < vertexCount; ++i)
+ {
+ yield return new BoneWeight
+ {
+ boneIndex0 = j++,
+ boneIndex1 = j++,
+ boneIndex2 = j++,
+ boneIndex3 = j++,
+ weight0 = 0.25f,
+ weight1 = 0.25f,
+ weight2 = 0.25f,
+ weight3 = 0.25f,
+ };
+ }
+ }
+ }
+
+ [Test]
+ public void MapBoneWeightTest()
+ {
+ {
+ var map = new BoneMap();
+ map.Add(new GameObject("a"), new GameObject("A"));
+ map.Add(new GameObject("b"), new GameObject("B"));
+ map.Add(new GameObject("c"), new GameObject("C"));
+ map.Add(new GameObject("d"), new GameObject("D"));
+ map.Add(null, new GameObject("null"));
+ // map.Add(new GameObject("c"), null); // ありえないので Exception にしてある
+ var boneWeights = map.CreateBoneWeight(64).ToArray();
+ var newBoneWeight = MeshUtility.BoneNormalizer.MapBoneWeight(boneWeights, map.Map,
+ map.SrcBones.ToArray(), map.DstBones.ToArray());
+
+ // 正常系
+ // exception が出なければよい
+ }
+
+ {
+ var map = new BoneMap();
+ map.Add(new GameObject("a"), new GameObject("A"));
+ map.Add(new GameObject("b"), new GameObject("B"));
+ map.Add(new GameObject("c"), new GameObject("C"));
+ map.Add(new GameObject("d"), new GameObject("D"));
+ map.Add(null, new GameObject("null"));
+ // map.Add(new GameObject("c"), null); // ありえないので Exception にしてある
+ var boneWeights = map.CreateBoneWeight(64).ToArray();
+ var newBoneWeight = MeshUtility.BoneNormalizer.MapBoneWeight(boneWeights, map.Map,
+ map.SrcBones.ToArray(), map.DstBones.ToArray());
+
+ // 4 つめが 0 になる
+ Assert.AreEqual(0, newBoneWeight[1].boneIndex0);
+ Assert.AreEqual(0, newBoneWeight[1].weight0);
+ // 5 つめ以降が 0 になる。out of range
+ Assert.AreEqual(0, newBoneWeight[1].boneIndex1);
+ Assert.AreEqual(0, newBoneWeight[1].weight1);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs.meta
new file mode 100644
index 00000000..b3822bbd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/NormalizeTests.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4014814a6ed5bf84faa36c7b99d6d4b8
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef
new file mode 100644
index 00000000..d10983bc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef
@@ -0,0 +1,21 @@
+{
+ "name": "UniVRM.Editor.Tests",
+ "references": [
+ "VRM",
+ "UniJSON",
+ "UniVRM.Editor",
+ "MeshUtility"
+ ],
+ "optionalUnityReferences": [
+ "TestAssemblies"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": []
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef.meta
new file mode 100644
index 00000000..704a813b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRM.Editor.Tests.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ea02711c84d022f46bcbae5d1cd38c16
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs
new file mode 100644
index 00000000..8b1caac2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs
@@ -0,0 +1,687 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniJSON;
+using UnityEngine;
+
+namespace VRM
+{
+ public class UniVRMSerializeTests
+ {
+ [Test]
+ public void MaterialValueBindTest()
+ {
+ var model = new glTF_VRM_MaterialValueBind();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_MaterialValueBind>().Serialize(model, c);
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void BlendShapeBindTest()
+ {
+ var model = new glTF_VRM_BlendShapeBind()
+ {
+ mesh = 1,
+ weight = 2,
+ index = 3,
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""mesh"":1,""index"":3,""weight"":2}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_BlendShapeBind>().Serialize(model, c);
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void BlendShapeBindTestError()
+ {
+ var model = new glTF_VRM_BlendShapeBind();
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_BlendShapeBind>().Serialize(model, c)
+ );
+ Assert.AreEqual("[mesh.String] minimum: ! -1>=0", ex.Message);
+ }
+
+ [Test]
+ public void BlendShapeGroupTest()
+ {
+ var model = new glTF_VRM_BlendShapeGroup()
+ {
+ presetName = "neutral",
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""presetName"":""neutral"",""isBinary"":false,""binds"":[],""materialValues"":[]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_BlendShapeGroup>().Serialize(model, c);
+ Assert.AreEqual(@"{""presetName"":""neutral"",""binds"":[],""materialValues"":[],""isBinary"":false}", json2);
+ }
+
+ [Test]
+ public void BlendShapeGroupTestError()
+ {
+ var model = new glTF_VRM_BlendShapeGroup()
+ {
+ presetName = "aaaaaaaaaaaa_not_exists_",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_BlendShapeGroup>().Serialize(model, c)
+ );
+ Assert.AreEqual("[presetName.String] aaaaaaaaaaaa_not_exists_ is not valid enum", ex.Message);
+ }
+
+ [Test]
+ public void DegreeMapTest()
+ {
+ var model = new glTF_VRM_DegreeMap();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""xRange"":90,""yRange"":10}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_DegreeMap>().Serialize(model, c);
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void MeshAnnotationTest()
+ {
+ var model = new glTF_VRM_MeshAnnotation();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""mesh"":0}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_MeshAnnotation>().Serialize(model, c);
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void FirstPersonTest()
+ {
+ var model = new glTF_VRM_Firstperson();
+
+ var json = model.ToJson();
+ Assert.AreEqual(
+ @"{""firstPersonBone"":-1,""firstPersonBoneOffset"":{""x"":0,""y"":0,""z"":0},""meshAnnotations"":[],""lookAtTypeName"":""Bone"",""lookAtHorizontalInner"":{""xRange"":90,""yRange"":10},""lookAtHorizontalOuter"":{""xRange"":90,""yRange"":10},""lookAtVerticalDown"":{""xRange"":90,""yRange"":10},""lookAtVerticalUp"":{""xRange"":90,""yRange"":10}}",
+ json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_Firstperson>().Serialize(model, c);
+ Assert.AreEqual(
+ @"{""firstPersonBoneOffset"":{""x"":0,""y"":0,""z"":0},""meshAnnotations"":[],""lookAtTypeName"":""Bone"",""lookAtHorizontalInner"":{""xRange"":90,""yRange"":10},""lookAtHorizontalOuter"":{""xRange"":90,""yRange"":10},""lookAtVerticalDown"":{""xRange"":90,""yRange"":10},""lookAtVerticalUp"":{""xRange"":90,""yRange"":10}}",
+ json2);
+ }
+
+ [Test]
+ public void HumanoidBoneTest()
+ {
+ var model = new glTF_VRM_HumanoidBone()
+ {
+ bone = "hips", // NOTE: This field must not be null?
+ node = 0,
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""bone"":""hips"",""node"":0,""useDefaultValues"":true}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_HumanoidBone>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(
+ @"{""bone"":""hips"",""node"":0,""useDefaultValues"":true,""min"":{""x"":0,""y"":0,""z"":0},""max"":{""x"":0,""y"":0,""z"":0},""center"":{""x"":0,""y"":0,""z"":0},""axisLength"":0}",
+ json2);
+ }
+
+ [Test]
+ public void HumanoidBoneTestError()
+ {
+ var model = new glTF_VRM_HumanoidBone()
+ {
+ bone = "hips", // NOTE: This field must not be null?
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_HumanoidBone>().Serialize(model, c)
+ );
+ Assert.AreEqual("[node.String] minimum: ! -1>=0", ex.Message);
+ }
+
+ [Test]
+ public void HumanoidTest()
+ {
+ var model = new glTF_VRM_Humanoid();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""humanBones"":[],""armStretch"":0.05,""legStretch"":0.05,""upperArmTwist"":0.5,""lowerArmTwist"":0.5,""upperLegTwist"":0.5,""lowerLegTwist"":0.5,""feetSpacing"":0,""hasTranslationDoF"":false}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_Humanoid>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void MaterialTest()
+ {
+ var model = new glTF_VRM_Material
+ {
+ floatProperties = new Dictionary<string, float>
+ {
+ {"float", 1.0f}
+ },
+ vectorProperties = new Dictionary<string, float[]>
+ {
+ {"vector", new float[]{0, 1, 2, 3 }}
+ },
+ textureProperties = new Dictionary<string, int>
+ {
+ {"texture", 0}
+ },
+ keywordMap = new Dictionary<string, bool>
+ {
+ {"keyword", true}
+ },
+ tagMap = new Dictionary<string, string>
+ {
+ {"tag", "map"}
+ },
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""renderQueue"":-1,""floatProperties"":{""float"":1},""vectorProperties"":{""vector"":[0,1,2,3]},""textureProperties"":{""texture"":0},""keywordMap"":{""keyword"":true},""tagMap"":{""tag"":""map""}}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_Material>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(json, json2);
+
+ // deserialize
+ var deserialized = default(glTF_VRM_Material);
+ json.ParseAsJson().Deserialize(ref deserialized);
+ Assert.AreEqual(1, deserialized.floatProperties.Count);
+ }
+
+ [Test]
+ public void MetaTest()
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""texture"":-1,""allowedUserName"":""OnlyAuthor"",""violentUssageName"":""Disallow"",""sexualUssageName"":""Disallow"",""commercialUssageName"":""Disallow"",""licenseName"":""CC0""}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(@"{""allowedUserName"":""OnlyAuthor"",""violentUssageName"":""Disallow"",""sexualUssageName"":""Disallow"",""commercialUssageName"":""Disallow"",""licenseName"":""CC0""}", json2);
+ }
+
+ [Test]
+ public void MetaTestError()
+ {
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = null,
+ violentUssageName = null,
+ sexualUssageName = null,
+ commercialUssageName = null,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[allowedUserName.String] null", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ //licenseName = "CC0",
+ licenseName = null,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[licenseName.String] null", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ licenseName = "_INVALID_SOME_THING_",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[licenseName.String] _INVALID_SOME_THING_ is not valid enum", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ // allowedUserName = "OnlyAuthor",
+ allowedUserName = null,
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[allowedUserName.String] null", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "_INVALID_SOME_THING_",
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[allowedUserName.String] _INVALID_SOME_THING_ is not valid enum", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ //violentUssageName = "Disallow",
+ violentUssageName = null,
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[violentUssageName.String] null", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "_INVALID_SOME_THING_",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[violentUssageName.String] _INVALID_SOME_THING_ is not valid enum", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ //sexualUssageName = "Disallow",
+ sexualUssageName = null,
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[sexualUssageName.String] null", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ sexualUssageName = "_INVALID_SOME_THING_",
+ commercialUssageName = "Disallow",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[sexualUssageName.String] _INVALID_SOME_THING_ is not valid enum", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ //commercialUssageName = "Disallow",
+ commercialUssageName = null,
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[commercialUssageName.String] null", ex.Message);
+ }
+
+ {
+ var model = new glTF_VRM_Meta()
+ {
+ allowedUserName = "OnlyAuthor",
+ violentUssageName = "Disallow",
+ sexualUssageName = "Disallow",
+ commercialUssageName = "_INVALID_SOME_THING_",
+ licenseName = "CC0",
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_Meta>().Serialize(model, c)
+ );
+ Assert.AreEqual("[commercialUssageName.String] _INVALID_SOME_THING_ is not valid enum", ex.Message);
+ }
+ }
+
+ // TODO: Move to another suitable location
+ [Test]
+ public void MetaDeserializeTest()
+ {
+ var json = @"{}";
+
+ var model = deserialize<glTF_VRM_Meta>(json);
+
+ Assert.AreEqual(-1, model.texture);
+ }
+
+ [Test]
+ public void SecondaryAnimationColliderTest()
+ {
+ var model = new glTF_VRM_SecondaryAnimationCollider()
+ {
+ offset = new Vector3(1, 2, 3),
+ radius = 42,
+ };
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""offset"":{""x"":1,""y"":2,""z"":3},""radius"":42}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_SecondaryAnimationCollider>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void SecondaryAnimationColliderGroupTest()
+ {
+ var model = new glTF_VRM_SecondaryAnimationColliderGroup();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""node"":0,""colliders"":[]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_SecondaryAnimationColliderGroup>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void SecondaryAnimationColliderGroupTestError()
+ {
+ var model = new glTF_VRM_SecondaryAnimationColliderGroup()
+ {
+ node = -1,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_SecondaryAnimationColliderGroup>().Serialize(model, c)
+ );
+ Assert.AreEqual("[node.String] minimum: ! -1>=0", ex.Message);
+ }
+
+ [Test]
+ public void SecondaryAnimationGroupTest()
+ {
+ var model = new glTF_VRM_SecondaryAnimationGroup();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""stiffiness"":0,""gravityPower"":0,""gravityDir"":{""x"":0,""y"":0,""z"":0},""dragForce"":0,""center"":0,""hitRadius"":0,""bones"":[],""colliderGroups"":[]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_SecondaryAnimationGroup>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void SecondaryAnimationGroupTestErrorBones()
+ {
+ var model = new glTF_VRM_SecondaryAnimationGroup()
+ {
+ bones = new int[] { -1 }
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_SecondaryAnimationGroup>().Serialize(model, c)
+ );
+ Assert.AreEqual("[bones.String] minimum: ! -1>=0", ex.Message);
+ }
+
+ [Test]
+ public void SecondaryAnimationGroupTestErrorColliderGroups()
+ {
+ var model = new glTF_VRM_SecondaryAnimationGroup()
+ {
+ colliderGroups = new int[] { -1 }
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var ex = Assert.Throws<JsonSchemaValidationException>(
+ () => JsonSchema.FromType<glTF_VRM_SecondaryAnimationGroup>().Serialize(model, c)
+ );
+ Assert.AreEqual("[colliderGroups.String] minimum: ! -1>=0", ex.Message);
+ }
+
+ [Test]
+ public void SecondaryAnimationTest()
+ {
+ var model = new glTF_VRM_SecondaryAnimation();
+
+ var json = model.ToJson();
+ Assert.AreEqual(@"{""boneGroups"":[],""colliderGroups"":[]}", json);
+ Debug.Log(json);
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_SecondaryAnimation>().Serialize(model, c);
+ // NOTE: New serializer outputs values which will not be used...
+ Assert.AreEqual(json, json2);
+ }
+
+ [Test]
+ public void ExtensionsTest()
+ {
+ var model = new glTF_VRM_extensions()
+ {
+ meta = null,
+ humanoid = null,
+ firstPerson = null,
+ blendShapeMaster = null,
+ secondaryAnimation = null,
+ materialProperties = null,
+ };
+
+ var c = new JsonSchemaValidationContext("")
+ {
+ EnableDiagnosisForNotRequiredFields = true,
+ };
+ var json2 = JsonSchema.FromType<glTF_VRM_extensions>().Serialize(model, c);
+ var expected =
+ String.Format(@"{{""exporterVersion"":""{0}"",""specVersion"":""0.0""}}", VRMVersion.VRM_VERSION);
+ Assert.AreEqual(expected, json2);
+ }
+
+ // TODO: Move to another suitable location
+ T deserialize<T>(string json)
+ {
+ return JsonUtility.FromJson<T>(json);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs.meta
new file mode 100644
index 00000000..60e8389f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/UniVRMSerializeTests.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 06e8ebf6af2b4e19a0c72ad986e88444
+timeCreated: 1547719804 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs
new file mode 100644
index 00000000..a3aed506
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs
@@ -0,0 +1,58 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+
+namespace VRM
+{
+ public class VRMBlendShapeKeyTest
+ {
+ static BlendShapeKey CreateBlendShapeKey(string name, BlendShapePreset preset)
+ {
+ var argTypes = new Type[] {typeof(string), typeof(BlendShapePreset)};
+ // private constructor
+ var constructor = typeof(BlendShapeKey).GetConstructor(
+ BindingFlags.Instance | BindingFlags.NonPublic,
+ null, argTypes, null);
+ return (BlendShapeKey) constructor.Invoke(new object[] {name, preset});
+ }
+
+ [Test]
+ public void KeyTest()
+ {
+ var key = BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink);
+ Assert.AreEqual(key, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
+ Assert.AreEqual(key, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
+ Assert.AreEqual(key, CreateBlendShapeKey("xxx", BlendShapePreset.Blink));
+ Assert.AreEqual(key.Name, "Blink");
+
+ var dict = new Dictionary<BlendShapeKey, float>();
+ dict[key] = 1.0f;
+
+ Assert.IsTrue(dict.ContainsKey(CreateBlendShapeKey("Blink", BlendShapePreset.Blink)));
+ Assert.IsTrue(dict.ContainsKey(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink)));
+ Assert.IsTrue(dict.ContainsKey(CreateBlendShapeKey("xxx", BlendShapePreset.Blink)));
+
+ dict.Clear();
+
+ var key2 = BlendShapeKey.CreateUnknown("Blink"); // Name: Blink, Preset: Unknown
+ dict[key2] = 1.0f;
+
+ Assert.AreEqual(key2, CreateBlendShapeKey("Blink", BlendShapePreset.Unknown));
+ Assert.AreNotEqual(key2, BlendShapeKey.CreateUnknown("blink"));
+ Assert.AreNotEqual(key2, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
+ Assert.AreNotEqual(key2, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
+ Assert.AreEqual(key2.Name, "Blink");
+
+ Assert.IsFalse(dict.ContainsKey(BlendShapeKey.CreateUnknown("blink")));
+ Assert.IsFalse(dict.ContainsKey(CreateBlendShapeKey("Blink", BlendShapePreset.Blink)));
+ Assert.IsFalse(dict.ContainsKey(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink)));
+
+ var key3 = CreateBlendShapeKey("xxx", BlendShapePreset.Blink); // Unknown 以外は独自の名前を持てない
+ Assert.AreEqual(key3, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
+ Assert.AreNotEqual(key3, CreateBlendShapeKey("xxx", BlendShapePreset.Unknown));
+ Assert.AreEqual(key3.Name, "Blink");
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs.meta
new file mode 100644
index 00000000..cb7c673a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VRMBlendShapeKeyTest.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ca2bf37b88b7c3a45adbeebb8a17559d
+timeCreated: 1521799592
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs
new file mode 100644
index 00000000..d45c9ac6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs
@@ -0,0 +1,58 @@
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniJSON;
+using UnityEngine;
+
+namespace VRM
+{
+ public class UniVRMVersionTests
+ {
+ [Test]
+ [TestCase(VRMVersion.VERSION, false)]
+ [TestCase("0.99", true)]
+ [TestCase("0.99.0", true)]
+ [TestCase("1.0.0", true)]
+ public void IsNewerTest(string newer, bool isNewer)
+ {
+ Assert.AreEqual(isNewer, VRMVersion.IsNewer(newer));
+ }
+
+ [Test]
+ [TestCase("0.50", "0.50", false)]
+ [TestCase("0.50", "0.51.0", false)]
+ [TestCase("0.51.0", "0.50", true)]
+ [TestCase("0.51.0", "0.51.0", false)]
+ [TestCase("0.51.1", "0.51.0", true)]
+ [TestCase("0.51.0", "0.51.0-a", false)]
+ [TestCase("0.51.0-b", "0.51.0-a", true)]
+ [TestCase("1.0.0-a", "0.51.0", true)]
+ [TestCase("1.0.0", "0.51.0", true)]
+ public void IsNewerTest(string newer, string older, bool isNewer)
+ {
+ Assert.AreEqual(isNewer, VRMVersion.IsNewer(newer, older));
+ }
+
+ [Test]
+ [TestCase("0.50", true, 0, 50, 0, "")]
+ [TestCase("0.51.0", true, 0, 51, 0, "")]
+ [TestCase("0.51.1", true, 0, 51, 1, "")]
+ [TestCase("0.51.2-a", true, 0, 51, 2, "a")]
+ [TestCase("0.51.10-a1", true, 0, 51, 10, "a1")]
+ [TestCase("aaaaa", false, 0, 0, 0, "")]
+ public void ParseVersionTest(string version, bool canBeParsed, int major, int minor, int patch, string pre)
+ {
+ VRMVersion.Version v;
+ var res = VRMVersion.ParseVersion(version, out v);
+ Assert.AreEqual(canBeParsed, res);
+ if (res)
+ {
+ Assert.AreEqual(major, v.Major);
+ Assert.AreEqual(minor, v.Minor);
+ Assert.AreEqual(patch, v.Patch);
+ Assert.AreEqual(pre, v.Pre);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs.meta
new file mode 100644
index 00000000..f417c0c5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/Tests/VersionTests.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 40fe68d2a0dd7fa40bb4c5d05da70a21
+timeCreated: 1551255796
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef
new file mode 100644
index 00000000..b6be87e8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef
@@ -0,0 +1,20 @@
+{
+ "name": "UniVRM.Editor",
+ "references": [
+ "VRM",
+ "UniJSON",
+ "UniHumanoid",
+ "MeshUtility",
+ "UniUnlit"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": []
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef.meta
new file mode 100644
index 00000000..13cb618b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/UniVRM.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f7b2dd4e5e1e7264089dc065c45db910
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs
new file mode 100644
index 00000000..7effc76f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs
@@ -0,0 +1,30 @@
+using System;
+using UnityEngine;
+using VRM;
+
+
+public static class VRMMonoBehaviourComparator
+{
+ public static bool AssertAreEquals(GameObject l, GameObject r)
+ {
+ return
+ AssertAreEquals<VRMMeta>(l, r,
+ (x, y) => x[0].Meta.Equals(y[0].Meta))
+ ;
+ }
+
+ public static bool AssertAreEquals<T>(GameObject l, GameObject r, Func<T[], T[], bool> pred) where T : Component
+ {
+ var ll = l.GetComponents<T>();
+ var rr = r.GetComponents<T>();
+ if (ll.Length != rr.Length)
+ {
+ return false;
+ }
+ if (ll.Length == 0)
+ {
+ return true;
+ }
+ return pred(ll, rr);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs.meta
new file mode 100644
index 00000000..c0a76a6d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Editor/VRMMonoBehaviourComparator.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 557330772b8af474c9342f543cd61550
+timeCreated: 1521106869
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources.meta
new file mode 100644
index 00000000..dba65026
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 48dcd5308bfbc814ba46c9f74a040385
+folderAsset: yes
+timeCreated: 1526882640
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders.meta
new file mode 100644
index 00000000..a8ed3f9e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 869d9c66aca5d6e44a93d4b792a360b3
+folderAsset: yes
+timeCreated: 1519883871
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants
new file mode 100644
index 00000000..dc5583ce
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants
@@ -0,0 +1,33 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!200 &20000000
+ShaderVariantCollection:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: VRMShaders
+ m_Shaders:
+ data:
+ first: {fileID: 4800000, guid: 1a70c9898704e1a4691843883f5101af, type: 3}
+ second:
+ variants: []
+ data:
+ first: {fileID: 4800000, guid: 429a3203ab2959741aab76fa2856b450, type: 3}
+ second:
+ variants: []
+ data:
+ first: {fileID: 4800000, guid: 4c9ce97af40038f45811fc4b0975a483, type: 3}
+ second:
+ variants: []
+ data:
+ first: {fileID: 4800000, guid: 8c17b56f4bf084c47872edcb95237e4a, type: 3}
+ second:
+ variants: []
+ data:
+ first: {fileID: 4800000, guid: df359ad0838642d4fa0339514fcbbb2d, type: 3}
+ second:
+ variants: []
+ data:
+ first: {fileID: 4800000, guid: 1a97144e4ad27a04aafd70f7b915cedb, type: 3}
+ second:
+ variants: []
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants.meta
new file mode 100644
index 00000000..6cccfe0a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMShaders.shadervariants.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 486ebb794ada0de41be4f35c56876f82
+timeCreated: 1520840003
+licenseType: Free
+NativeFormatImporter:
+ mainObjectFileID: 20000000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader
new file mode 100644
index 00000000..33052c9b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader
@@ -0,0 +1,61 @@
+Shader "VRM/UnlitCutout"
+{
+Properties {
+ _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
+ _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
+}
+SubShader {
+ Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
+ LOD 100
+
+ Lighting Off
+
+ Pass {
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma target 2.0
+ #pragma multi_compile_fog
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t {
+ float4 vertex : POSITION;
+ float2 texcoord : TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f {
+ float4 vertex : SV_POSITION;
+ float2 texcoord : TEXCOORD0;
+ UNITY_FOG_COORDS(1)
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ sampler2D _MainTex;
+ float4 _MainTex_ST;
+ fixed _Cutoff;
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
+ UNITY_TRANSFER_FOG(o,o.vertex);
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = tex2D(_MainTex, i.texcoord);
+ clip(col.a - _Cutoff);
+ UNITY_APPLY_FOG(i.fogCoord, col);
+ return col;
+ }
+ ENDCG
+ }
+}
+
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader.meta
new file mode 100644
index 00000000..aefa9756
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitCutout.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4c9ce97af40038f45811fc4b0975a483
+timeCreated: 1522661614
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader
new file mode 100644
index 00000000..edb666f9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader
@@ -0,0 +1,58 @@
+Shader "VRM/UnlitTexture"
+{
+ Properties
+ {
+ _MainTex ("Texture", 2D) = "white" {}
+ }
+ SubShader
+ {
+ Tags { "RenderType"="Opaque" }
+ LOD 100
+
+ Pass
+ {
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ // make fog work
+ #pragma multi_compile_fog
+
+ #include "UnityCG.cginc"
+
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float2 uv : TEXCOORD0;
+ };
+
+ struct v2f
+ {
+ float2 uv : TEXCOORD0;
+ UNITY_FOG_COORDS(1)
+ float4 vertex : SV_POSITION;
+ };
+
+ sampler2D _MainTex;
+ float4 _MainTex_ST;
+
+ v2f vert (appdata v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.uv = TRANSFORM_TEX(v.uv, _MainTex);
+ UNITY_TRANSFER_FOG(o,o.vertex);
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ // sample the texture
+ fixed4 col = tex2D(_MainTex, i.uv);
+ // apply fog
+ UNITY_APPLY_FOG(i.fogCoord, col);
+ return col;
+ }
+ ENDCG
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader.meta
new file mode 100644
index 00000000..b5367926
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTexture.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1a70c9898704e1a4691843883f5101af
+timeCreated: 1522661614
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader
new file mode 100644
index 00000000..4cf8e9ea
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader
@@ -0,0 +1,61 @@
+Shader "VRM/UnlitTransparent"
+{
+Properties {
+ _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
+}
+
+SubShader {
+ Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
+ LOD 100
+
+ ZWrite Off
+ Blend SrcAlpha OneMinusSrcAlpha
+ BlendOp Add, Max
+
+ Pass {
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma target 2.0
+ #pragma multi_compile_fog
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t {
+ float4 vertex : POSITION;
+ float2 texcoord : TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f {
+ float4 vertex : SV_POSITION;
+ float2 texcoord : TEXCOORD0;
+ UNITY_FOG_COORDS(1)
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ sampler2D _MainTex;
+ float4 _MainTex_ST;
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
+ UNITY_TRANSFER_FOG(o,o.vertex);
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = tex2D(_MainTex, i.texcoord);
+ UNITY_APPLY_FOG(i.fogCoord, col);
+ return col;
+ }
+ ENDCG
+ }
+}
+
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader.meta
new file mode 100644
index 00000000..a2e35ec0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparent.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: df359ad0838642d4fa0339514fcbbb2d
+timeCreated: 1522661614
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader
new file mode 100644
index 00000000..70d5ea96
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader
@@ -0,0 +1,61 @@
+Shader "VRM/UnlitTransparentZWrite"
+{
+Properties {
+ _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
+}
+
+SubShader {
+ Tags {"Queue"="AlphaTest+150" "IgnoreProjector"="True" "RenderType"="Transparent"}
+ LOD 100
+
+ ZWrite On
+ Blend SrcAlpha OneMinusSrcAlpha
+ BlendOp Add, Max
+
+ Pass {
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma target 2.0
+ #pragma multi_compile_fog
+
+ #include "UnityCG.cginc"
+
+ struct appdata_t {
+ float4 vertex : POSITION;
+ float2 texcoord : TEXCOORD0;
+ UNITY_VERTEX_INPUT_INSTANCE_ID
+ };
+
+ struct v2f {
+ float4 vertex : SV_POSITION;
+ float2 texcoord : TEXCOORD0;
+ UNITY_FOG_COORDS(1)
+ UNITY_VERTEX_OUTPUT_STEREO
+ };
+
+ sampler2D _MainTex;
+ float4 _MainTex_ST;
+
+ v2f vert (appdata_t v)
+ {
+ v2f o;
+ UNITY_SETUP_INSTANCE_ID(v);
+ UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
+ UNITY_TRANSFER_FOG(o,o.vertex);
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = tex2D(_MainTex, i.texcoord);
+ UNITY_APPLY_FOG(i.fogCoord, col);
+ return col;
+ }
+ ENDCG
+ }
+}
+
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader.meta
new file mode 100644
index 00000000..b7cb6fe1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Resources/Shaders/VRMUnlitTransparentZWrite.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 429a3203ab2959741aab76fa2856b450
+timeCreated: 1522661614
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts.meta
new file mode 100644
index 00000000..96afb8fa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 2f85d3d3cb76658408fd936e3b798481
+folderAsset: yes
+timeCreated: 1517228412
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs
new file mode 100644
index 00000000..c111002f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs
@@ -0,0 +1,1953 @@
+
+using System;
+using UniJSON;
+using UniGLTF;
+using System.Collections.Generic;
+
+
+namespace VRM {
+ public static partial class VRMAOTCall {
+ static void glTF()
+ {
+ {
+ var f = new JsonFormatter();
+
+
+// String
+f.Serialize(default(System.String));
+{
+var value = default(System.String);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Boolean
+f.Serialize(default(System.Boolean));
+{
+var value = default(System.Boolean);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Byte
+f.Serialize(default(System.Byte));
+{
+var value = default(System.Byte);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// UInt16
+f.Serialize(default(System.UInt16));
+{
+var value = default(System.UInt16);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// UInt32
+f.Serialize(default(System.UInt32));
+{
+var value = default(System.UInt32);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// UInt64
+f.Serialize(default(System.UInt64));
+{
+var value = default(System.UInt64);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// SByte
+f.Serialize(default(System.SByte));
+{
+var value = default(System.SByte);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Int16
+f.Serialize(default(System.Int16));
+{
+var value = default(System.Int16);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Int32
+f.Serialize(default(System.Int32));
+{
+var value = default(System.Int32);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Int64
+f.Serialize(default(System.Int64));
+{
+var value = default(System.Int64);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Single
+f.Serialize(default(System.Single));
+{
+var value = default(System.Single);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Double
+f.Serialize(default(System.Double));
+{
+var value = default(System.Double);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+
+// Vector2
+f.Serialize(default(UnityEngine.Vector2));
+{
+var value = default(UnityEngine.Vector2);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector2>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector2>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Vector3
+f.Serialize(default(UnityEngine.Vector3));
+{
+var value = default(UnityEngine.Vector3);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector3>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector3>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector3>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Vector4
+f.Serialize(default(UnityEngine.Vector4));
+{
+var value = default(UnityEngine.Vector4);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Quaternion
+f.Serialize(default(UnityEngine.Quaternion));
+{
+var value = default(UnityEngine.Quaternion);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF
+f.Serialize(default(UniGLTF.glTF));
+{
+var value = default(UniGLTF.glTF);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<UniGLTF.glTFAssets>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFAssets
+f.Serialize(default(UniGLTF.glTFAssets));
+{
+var value = default(UniGLTF.glTFAssets);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAssets>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAssets>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAssets>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAssets>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAssets>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAssets>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFBuffer>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFBuffer>));
+{
+var value = default(List<UniGLTF.glTFBuffer>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFBuffer>>.GenericListDeserializer<UniGLTF.glTFBuffer>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFBuffer
+f.Serialize(default(UniGLTF.glTFBuffer));
+{
+var value = default(UniGLTF.glTFBuffer);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBuffer>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBuffer>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBuffer>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBuffer>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBuffer>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFBufferView>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFBufferView>));
+{
+var value = default(List<UniGLTF.glTFBufferView>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFBufferView>>.GenericListDeserializer<UniGLTF.glTFBufferView>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFBufferView
+f.Serialize(default(UniGLTF.glTFBufferView));
+{
+var value = default(UniGLTF.glTFBufferView);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<UniGLTF.glBufferTarget>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glBufferTarget
+f.Serialize(default(UniGLTF.glBufferTarget));
+{
+var value = default(UniGLTF.glBufferTarget);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glBufferTarget>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFBufferView>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFAccessor>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFAccessor>));
+{
+var value = default(List<UniGLTF.glTFAccessor>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFAccessor>>.GenericListDeserializer<UniGLTF.glTFAccessor>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFAccessor
+f.Serialize(default(UniGLTF.glTFAccessor));
+{
+var value = default(UniGLTF.glTFAccessor);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<UniGLTF.glComponentType>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glComponentType
+f.Serialize(default(UniGLTF.glComponentType));
+{
+var value = default(UniGLTF.glComponentType);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glComponentType>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Single[]
+f.Serialize(default(Single[]));
+{
+var value = default(Single[]);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Single[]>.GenericArrayDeserializer<Single>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Boolean>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<UniGLTF.glTFSparse>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFSparse
+f.Serialize(default(UniGLTF.glTFSparse));
+{
+var value = default(UniGLTF.glTFSparse);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparse>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparse>.DeserializeField<UniGLTF.glTFSparseIndices>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFSparseIndices
+f.Serialize(default(UniGLTF.glTFSparseIndices));
+{
+var value = default(UniGLTF.glTFSparseIndices);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseIndices>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseIndices>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseIndices>.DeserializeField<UniGLTF.glComponentType>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseIndices>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseIndices>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparse>.DeserializeField<UniGLTF.glTFSparseValues>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFSparseValues
+f.Serialize(default(UniGLTF.glTFSparseValues));
+{
+var value = default(UniGLTF.glTFSparseValues);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseValues>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseValues>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseValues>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparseValues>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparse>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSparse>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAccessor>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFTexture>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFTexture>));
+{
+var value = default(List<UniGLTF.glTFTexture>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFTexture>>.GenericListDeserializer<UniGLTF.glTFTexture>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFTexture
+f.Serialize(default(UniGLTF.glTFTexture));
+{
+var value = default(UniGLTF.glTFTexture);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTexture>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTexture>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTexture>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTexture>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTexture>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFTextureSampler>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFTextureSampler>));
+{
+var value = default(List<UniGLTF.glTFTextureSampler>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFTextureSampler>>.GenericListDeserializer<UniGLTF.glTFTextureSampler>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFTextureSampler
+f.Serialize(default(UniGLTF.glTFTextureSampler));
+{
+var value = default(UniGLTF.glTFTextureSampler);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<UniGLTF.glFilter>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glFilter
+f.Serialize(default(UniGLTF.glFilter));
+{
+var value = default(UniGLTF.glFilter);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glFilter>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<UniGLTF.glFilter>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<UniGLTF.glWrap>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glWrap
+f.Serialize(default(UniGLTF.glWrap));
+{
+var value = default(UniGLTF.glWrap);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glWrap>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<UniGLTF.glWrap>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFTextureSampler>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFImage>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFImage>));
+{
+var value = default(List<UniGLTF.glTFImage>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFImage>>.GenericListDeserializer<UniGLTF.glTFImage>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFImage
+f.Serialize(default(UniGLTF.glTFImage));
+{
+var value = default(UniGLTF.glTFImage);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFImage>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFImage>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFImage>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFImage>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFImage>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFImage>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFMaterial>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFMaterial>));
+{
+var value = default(List<UniGLTF.glTFMaterial>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFMaterial>>.GenericListDeserializer<UniGLTF.glTFMaterial>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterial
+f.Serialize(default(UniGLTF.glTFMaterial));
+{
+var value = default(UniGLTF.glTFMaterial);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<UniGLTF.glTFPbrMetallicRoughness>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFPbrMetallicRoughness
+f.Serialize(default(UniGLTF.glTFPbrMetallicRoughness));
+{
+var value = default(UniGLTF.glTFPbrMetallicRoughness);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<UniGLTF.glTFMaterialBaseColorTextureInfo>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterialBaseColorTextureInfo
+f.Serialize(default(UniGLTF.glTFMaterialBaseColorTextureInfo));
+{
+var value = default(UniGLTF.glTFMaterialBaseColorTextureInfo);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialBaseColorTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialBaseColorTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialBaseColorTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialBaseColorTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<UniGLTF.glTFMaterialMetallicRoughnessTextureInfo>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterialMetallicRoughnessTextureInfo
+f.Serialize(default(UniGLTF.glTFMaterialMetallicRoughnessTextureInfo));
+{
+var value = default(UniGLTF.glTFMaterialMetallicRoughnessTextureInfo);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialMetallicRoughnessTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialMetallicRoughnessTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialMetallicRoughnessTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialMetallicRoughnessTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPbrMetallicRoughness>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<UniGLTF.glTFMaterialNormalTextureInfo>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterialNormalTextureInfo
+f.Serialize(default(UniGLTF.glTFMaterialNormalTextureInfo));
+{
+var value = default(UniGLTF.glTFMaterialNormalTextureInfo);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialNormalTextureInfo>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialNormalTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialNormalTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialNormalTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialNormalTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<UniGLTF.glTFMaterialOcclusionTextureInfo>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterialOcclusionTextureInfo
+f.Serialize(default(UniGLTF.glTFMaterialOcclusionTextureInfo));
+{
+var value = default(UniGLTF.glTFMaterialOcclusionTextureInfo);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialOcclusionTextureInfo>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialOcclusionTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialOcclusionTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialOcclusionTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialOcclusionTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<UniGLTF.glTFMaterialEmissiveTextureInfo>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterialEmissiveTextureInfo
+f.Serialize(default(UniGLTF.glTFMaterialEmissiveTextureInfo));
+{
+var value = default(UniGLTF.glTFMaterialEmissiveTextureInfo);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialEmissiveTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialEmissiveTextureInfo>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialEmissiveTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterialEmissiveTextureInfo>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<System.Boolean>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<UniGLTF.glTFMaterial_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFMaterial_extensions
+f.Serialize(default(UniGLTF.glTFMaterial_extensions));
+{
+var value = default(UniGLTF.glTFMaterial_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial_extensions>.DeserializeField<UniGLTF.glTF_KHR_materials_unlit>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_KHR_materials_unlit
+f.Serialize(default(UniGLTF.glTF_KHR_materials_unlit));
+{
+var value = default(UniGLTF.glTF_KHR_materials_unlit);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMaterial>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFMesh>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFMesh>));
+{
+var value = default(List<UniGLTF.glTFMesh>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFMesh>>.GenericListDeserializer<UniGLTF.glTFMesh>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFMesh
+f.Serialize(default(UniGLTF.glTFMesh));
+{
+var value = default(UniGLTF.glTFMesh);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMesh>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMesh>.DeserializeField<System.Collections.Generic.List<glTFPrimitives>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFPrimitives>));
+{
+var value = default(List<UniGLTF.glTFPrimitives>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFPrimitives>>.GenericListDeserializer<UniGLTF.glTFPrimitives>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFPrimitives
+f.Serialize(default(UniGLTF.glTFPrimitives));
+{
+var value = default(UniGLTF.glTFPrimitives);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<UniGLTF.glTFAttributes>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFAttributes
+f.Serialize(default(UniGLTF.glTFAttributes));
+{
+var value = default(UniGLTF.glTFAttributes);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAttributes>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<System.Collections.Generic.List<gltfMorphTarget>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.gltfMorphTarget>));
+{
+var value = default(List<UniGLTF.gltfMorphTarget>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.gltfMorphTarget>>.GenericListDeserializer<UniGLTF.gltfMorphTarget>(default(ListTreeNode<JsonValue>));
+}
+
+// gltfMorphTarget
+f.Serialize(default(UniGLTF.gltfMorphTarget));
+{
+var value = default(UniGLTF.gltfMorphTarget);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfMorphTarget>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfMorphTarget>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfMorphTarget>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<UniGLTF.glTFPrimitives_extras>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFPrimitives_extras
+f.Serialize(default(UniGLTF.glTFPrimitives_extras));
+{
+var value = default(UniGLTF.glTFPrimitives_extras);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives_extras>.DeserializeField<System.Collections.Generic.List<String>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<System.String>));
+{
+var value = default(List<System.String>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<System.String>>.GenericListDeserializer<System.String>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPrimitives>.DeserializeField<UniGLTF.glTFPrimitives_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFPrimitives_extensions
+f.Serialize(default(UniGLTF.glTFPrimitives_extensions));
+{
+var value = default(UniGLTF.glTFPrimitives_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMesh>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMesh>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFMesh>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFNode>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFNode>));
+{
+var value = default(List<UniGLTF.glTFNode>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFNode>>.GenericListDeserializer<UniGLTF.glTFNode>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFNode
+f.Serialize(default(UniGLTF.glTFNode));
+{
+var value = default(UniGLTF.glTFNode);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Int32[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Int32[]
+f.Serialize(default(Int32[]));
+{
+var value = default(Int32[]);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Int32[]>.GenericArrayDeserializer<Int32>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<UniGLTF.glTFNode_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFNode_extensions
+f.Serialize(default(UniGLTF.glTFNode_extensions));
+{
+var value = default(UniGLTF.glTFNode_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFNode>.DeserializeField<UniGLTF.glTFNode_extra>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFNode_extra
+f.Serialize(default(UniGLTF.glTFNode_extra));
+{
+var value = default(UniGLTF.glTFNode_extra);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFSkin>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFSkin>));
+{
+var value = default(List<UniGLTF.glTFSkin>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFSkin>>.GenericListDeserializer<UniGLTF.glTFSkin>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFSkin
+f.Serialize(default(UniGLTF.glTFSkin));
+{
+var value = default(UniGLTF.glTFSkin);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSkin>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSkin>.DeserializeField<System.Int32[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSkin>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSkin>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSkin>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFSkin>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<gltfScene>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.gltfScene>));
+{
+var value = default(List<UniGLTF.gltfScene>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.gltfScene>>.GenericListDeserializer<UniGLTF.gltfScene>(default(ListTreeNode<JsonValue>));
+}
+
+// gltfScene
+f.Serialize(default(UniGLTF.gltfScene));
+{
+var value = default(UniGLTF.gltfScene);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfScene>.DeserializeField<System.Int32[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfScene>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfScene>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.gltfScene>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFAnimation>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFAnimation>));
+{
+var value = default(List<UniGLTF.glTFAnimation>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFAnimation>>.GenericListDeserializer<UniGLTF.glTFAnimation>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFAnimation
+f.Serialize(default(UniGLTF.glTFAnimation));
+{
+var value = default(UniGLTF.glTFAnimation);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimation>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimation>.DeserializeField<System.Collections.Generic.List<glTFAnimationChannel>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFAnimationChannel>));
+{
+var value = default(List<UniGLTF.glTFAnimationChannel>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFAnimationChannel>>.GenericListDeserializer<UniGLTF.glTFAnimationChannel>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFAnimationChannel
+f.Serialize(default(UniGLTF.glTFAnimationChannel));
+{
+var value = default(UniGLTF.glTFAnimationChannel);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationChannel>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationChannel>.DeserializeField<UniGLTF.glTFAnimationTarget>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFAnimationTarget
+f.Serialize(default(UniGLTF.glTFAnimationTarget));
+{
+var value = default(UniGLTF.glTFAnimationTarget);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationTarget>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationTarget>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationTarget>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationTarget>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationChannel>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationChannel>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimation>.DeserializeField<System.Collections.Generic.List<glTFAnimationSampler>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFAnimationSampler>));
+{
+var value = default(List<UniGLTF.glTFAnimationSampler>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFAnimationSampler>>.GenericListDeserializer<UniGLTF.glTFAnimationSampler>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFAnimationSampler
+f.Serialize(default(UniGLTF.glTFAnimationSampler));
+{
+var value = default(UniGLTF.glTFAnimationSampler);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationSampler>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationSampler>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationSampler>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationSampler>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimationSampler>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimation>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFAnimation>.DeserializeField<System.Object>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<glTFCamera>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<UniGLTF.glTFCamera>));
+{
+var value = default(List<UniGLTF.glTFCamera>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<UniGLTF.glTFCamera>>.GenericListDeserializer<UniGLTF.glTFCamera>(default(ListTreeNode<JsonValue>));
+}
+
+// glTFCamera
+f.Serialize(default(UniGLTF.glTFCamera));
+{
+var value = default(UniGLTF.glTFCamera);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFCamera>.DeserializeField<UniGLTF.glTFOrthographic>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFOrthographic
+f.Serialize(default(UniGLTF.glTFOrthographic));
+{
+var value = default(UniGLTF.glTFOrthographic);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFOrthographic>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFOrthographic>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFOrthographic>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFOrthographic>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFOrthographic>.DeserializeField<UniGLTF.glTFOrthographic_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFOrthographic_extensions
+f.Serialize(default(UniGLTF.glTFOrthographic_extensions));
+{
+var value = default(UniGLTF.glTFOrthographic_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFOrthographic>.DeserializeField<UniGLTF.glTFOrthographic_extras>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFOrthographic_extras
+f.Serialize(default(UniGLTF.glTFOrthographic_extras));
+{
+var value = default(UniGLTF.glTFOrthographic_extras);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFCamera>.DeserializeField<UniGLTF.glTFPerspective>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFPerspective
+f.Serialize(default(UniGLTF.glTFPerspective));
+{
+var value = default(UniGLTF.glTFPerspective);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPerspective>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPerspective>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPerspective>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPerspective>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPerspective>.DeserializeField<UniGLTF.glTFPerspective_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFPerspective_extensions
+f.Serialize(default(UniGLTF.glTFPerspective_extensions));
+{
+var value = default(UniGLTF.glTFPerspective_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFPerspective>.DeserializeField<UniGLTF.glTFPerspective_extras>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFPerspective_extras
+f.Serialize(default(UniGLTF.glTFPerspective_extras));
+{
+var value = default(UniGLTF.glTFPerspective_extras);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFCamera>.DeserializeField<UniGLTF.ProjectionType>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// ProjectionType
+f.Serialize(default(UniGLTF.ProjectionType));
+{
+var value = default(UniGLTF.ProjectionType);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.ProjectionType>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFCamera>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFCamera>.DeserializeField<UniGLTF.glTFCamera_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFCamera_extensions
+f.Serialize(default(UniGLTF.glTFCamera_extensions));
+{
+var value = default(UniGLTF.glTFCamera_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTFCamera>.DeserializeField<UniGLTF.glTFCamera_extras>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTFCamera_extras
+f.Serialize(default(UniGLTF.glTFCamera_extras));
+{
+var value = default(UniGLTF.glTFCamera_extras);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<String>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<System.Collections.Generic.List<String>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<UniGLTF.glTF_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_extensions
+f.Serialize(default(UniGLTF.glTF_extensions));
+{
+var value = default(UniGLTF.glTF_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF_extensions>.DeserializeField<VRM.glTF_VRM_extensions>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_extensions
+f.Serialize(default(VRM.glTF_VRM_extensions));
+{
+var value = default(VRM.glTF_VRM_extensions);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<VRM.glTF_VRM_Meta>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_Meta
+f.Serialize(default(VRM.glTF_VRM_Meta));
+{
+var value = default(VRM.glTF_VRM_Meta);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Meta>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<VRM.glTF_VRM_Humanoid>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_Humanoid
+f.Serialize(default(VRM.glTF_VRM_Humanoid));
+{
+var value = default(VRM.glTF_VRM_Humanoid);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Collections.Generic.List<glTF_VRM_HumanoidBone>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_HumanoidBone>));
+{
+var value = default(List<VRM.glTF_VRM_HumanoidBone>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_HumanoidBone>>.GenericListDeserializer<VRM.glTF_VRM_HumanoidBone>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_HumanoidBone
+f.Serialize(default(VRM.glTF_VRM_HumanoidBone));
+{
+var value = default(VRM.glTF_VRM_HumanoidBone);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<System.Boolean>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<UnityEngine.Vector3>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<UnityEngine.Vector3>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<UnityEngine.Vector3>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_HumanoidBone>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Humanoid>.DeserializeField<System.Boolean>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<VRM.glTF_VRM_Firstperson>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_Firstperson
+f.Serialize(default(VRM.glTF_VRM_Firstperson));
+{
+var value = default(VRM.glTF_VRM_Firstperson);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<UnityEngine.Vector3>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<System.Collections.Generic.List<glTF_VRM_MeshAnnotation>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_MeshAnnotation>));
+{
+var value = default(List<VRM.glTF_VRM_MeshAnnotation>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_MeshAnnotation>>.GenericListDeserializer<VRM.glTF_VRM_MeshAnnotation>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_MeshAnnotation
+f.Serialize(default(VRM.glTF_VRM_MeshAnnotation));
+{
+var value = default(VRM.glTF_VRM_MeshAnnotation);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_MeshAnnotation>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_MeshAnnotation>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<VRM.glTF_VRM_DegreeMap>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_DegreeMap
+f.Serialize(default(VRM.glTF_VRM_DegreeMap));
+{
+var value = default(VRM.glTF_VRM_DegreeMap);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_DegreeMap>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_DegreeMap>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_DegreeMap>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<VRM.glTF_VRM_DegreeMap>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<VRM.glTF_VRM_DegreeMap>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Firstperson>.DeserializeField<VRM.glTF_VRM_DegreeMap>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<VRM.glTF_VRM_BlendShapeMaster>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_BlendShapeMaster
+f.Serialize(default(VRM.glTF_VRM_BlendShapeMaster));
+{
+var value = default(VRM.glTF_VRM_BlendShapeMaster);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeMaster>.DeserializeField<System.Collections.Generic.List<glTF_VRM_BlendShapeGroup>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_BlendShapeGroup>));
+{
+var value = default(List<VRM.glTF_VRM_BlendShapeGroup>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_BlendShapeGroup>>.GenericListDeserializer<VRM.glTF_VRM_BlendShapeGroup>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_BlendShapeGroup
+f.Serialize(default(VRM.glTF_VRM_BlendShapeGroup));
+{
+var value = default(VRM.glTF_VRM_BlendShapeGroup);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeGroup>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeGroup>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeGroup>.DeserializeField<System.Collections.Generic.List<glTF_VRM_BlendShapeBind>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_BlendShapeBind>));
+{
+var value = default(List<VRM.glTF_VRM_BlendShapeBind>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_BlendShapeBind>>.GenericListDeserializer<VRM.glTF_VRM_BlendShapeBind>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_BlendShapeBind
+f.Serialize(default(VRM.glTF_VRM_BlendShapeBind));
+{
+var value = default(VRM.glTF_VRM_BlendShapeBind);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeBind>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeBind>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeBind>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeGroup>.DeserializeField<System.Collections.Generic.List<glTF_VRM_MaterialValueBind>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_MaterialValueBind>));
+{
+var value = default(List<VRM.glTF_VRM_MaterialValueBind>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_MaterialValueBind>>.GenericListDeserializer<VRM.glTF_VRM_MaterialValueBind>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_MaterialValueBind
+f.Serialize(default(VRM.glTF_VRM_MaterialValueBind));
+{
+var value = default(VRM.glTF_VRM_MaterialValueBind);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_MaterialValueBind>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_MaterialValueBind>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_MaterialValueBind>.DeserializeField<System.Single[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_BlendShapeGroup>.DeserializeField<System.Boolean>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<VRM.glTF_VRM_SecondaryAnimation>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_SecondaryAnimation
+f.Serialize(default(VRM.glTF_VRM_SecondaryAnimation));
+{
+var value = default(VRM.glTF_VRM_SecondaryAnimation);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimation>.DeserializeField<System.Collections.Generic.List<glTF_VRM_SecondaryAnimationGroup>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_SecondaryAnimationGroup>));
+{
+var value = default(List<VRM.glTF_VRM_SecondaryAnimationGroup>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_SecondaryAnimationGroup>>.GenericListDeserializer<VRM.glTF_VRM_SecondaryAnimationGroup>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_SecondaryAnimationGroup
+f.Serialize(default(VRM.glTF_VRM_SecondaryAnimationGroup));
+{
+var value = default(VRM.glTF_VRM_SecondaryAnimationGroup);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<UnityEngine.Vector3>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Int32[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationGroup>.DeserializeField<System.Int32[]>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimation>.DeserializeField<System.Collections.Generic.List<glTF_VRM_SecondaryAnimationColliderGroup>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_SecondaryAnimationColliderGroup>));
+{
+var value = default(List<VRM.glTF_VRM_SecondaryAnimationColliderGroup>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_SecondaryAnimationColliderGroup>>.GenericListDeserializer<VRM.glTF_VRM_SecondaryAnimationColliderGroup>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_SecondaryAnimationColliderGroup
+f.Serialize(default(VRM.glTF_VRM_SecondaryAnimationColliderGroup));
+{
+var value = default(VRM.glTF_VRM_SecondaryAnimationColliderGroup);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationColliderGroup>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationColliderGroup>.DeserializeField<System.Collections.Generic.List<glTF_VRM_SecondaryAnimationCollider>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_SecondaryAnimationCollider>));
+{
+var value = default(List<VRM.glTF_VRM_SecondaryAnimationCollider>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_SecondaryAnimationCollider>>.GenericListDeserializer<VRM.glTF_VRM_SecondaryAnimationCollider>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_SecondaryAnimationCollider
+f.Serialize(default(VRM.glTF_VRM_SecondaryAnimationCollider));
+{
+var value = default(VRM.glTF_VRM_SecondaryAnimationCollider);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationCollider>.DeserializeField<UnityEngine.Vector3>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_SecondaryAnimationCollider>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_extensions>.DeserializeField<System.Collections.Generic.List<glTF_VRM_Material>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// List`1
+f.Serialize(default(List<VRM.glTF_VRM_Material>));
+{
+var value = default(List<VRM.glTF_VRM_Material>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, List<VRM.glTF_VRM_Material>>.GenericListDeserializer<VRM.glTF_VRM_Material>(default(ListTreeNode<JsonValue>));
+}
+
+// glTF_VRM_Material
+f.Serialize(default(VRM.glTF_VRM_Material));
+{
+var value = default(VRM.glTF_VRM_Material);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.String>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.Int32>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.Collections.Generic.Dictionary<String,Single>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Dictionary`2
+f.Serialize(default(Dictionary<string, System.Single>));
+{
+var value = default(Dictionary<string, System.Single>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Dictionary<string, System.Single>>.DictionaryDeserializer<System.Single>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.Collections.Generic.Dictionary<String,Single[]>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Dictionary`2
+f.Serialize(default(Dictionary<string, System.Single[]>));
+{
+var value = default(Dictionary<string, System.Single[]>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Dictionary<string, System.Single[]>>.DictionaryDeserializer<System.Single[]>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.Collections.Generic.Dictionary<String,Int32>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Dictionary`2
+f.Serialize(default(Dictionary<string, System.Int32>));
+{
+var value = default(Dictionary<string, System.Int32>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Dictionary<string, System.Int32>>.DictionaryDeserializer<System.Int32>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.Collections.Generic.Dictionary<String,Boolean>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Dictionary`2
+f.Serialize(default(Dictionary<string, System.Boolean>));
+{
+var value = default(Dictionary<string, System.Boolean>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Dictionary<string, System.Boolean>>.DictionaryDeserializer<System.Boolean>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,VRM.glTF_VRM_Material>.DeserializeField<System.Collections.Generic.Dictionary<String,String>>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// Dictionary`2
+f.Serialize(default(Dictionary<string, System.String>));
+{
+var value = default(Dictionary<string, System.String>);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+GenericDeserializer<JsonValue, Dictionary<string, System.String>>.DictionaryDeserializer<System.String>(default(ListTreeNode<JsonValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<JsonValue,UniGLTF.glTF>.DeserializeField<UniGLTF.gltf_extras>(default(JsonSchema), default(ListTreeNode<JsonValue>));
+}
+
+// gltf_extras
+f.Serialize(default(UniGLTF.gltf_extras));
+{
+var value = default(UniGLTF.gltf_extras);
+default(ListTreeNode<JsonValue>).Deserialize(ref value);
+}
+}
+
+{
+ var f = new MsgPackFormatter();
+
+
+// String
+f.Serialize(default(System.String));
+{
+var value = default(System.String);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Boolean
+f.Serialize(default(System.Boolean));
+{
+var value = default(System.Boolean);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Byte
+f.Serialize(default(System.Byte));
+{
+var value = default(System.Byte);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// UInt16
+f.Serialize(default(System.UInt16));
+{
+var value = default(System.UInt16);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// UInt32
+f.Serialize(default(System.UInt32));
+{
+var value = default(System.UInt32);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// UInt64
+f.Serialize(default(System.UInt64));
+{
+var value = default(System.UInt64);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// SByte
+f.Serialize(default(System.SByte));
+{
+var value = default(System.SByte);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Int16
+f.Serialize(default(System.Int16));
+{
+var value = default(System.Int16);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Int32
+f.Serialize(default(System.Int32));
+{
+var value = default(System.Int32);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Int64
+f.Serialize(default(System.Int64));
+{
+var value = default(System.Int64);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Single
+f.Serialize(default(System.Single));
+{
+var value = default(System.Single);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Double
+f.Serialize(default(System.Double));
+{
+var value = default(System.Double);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+
+// Vector2
+f.Serialize(default(UnityEngine.Vector2));
+{
+var value = default(UnityEngine.Vector2);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector2>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector2>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+
+// Vector3
+f.Serialize(default(UnityEngine.Vector3));
+{
+var value = default(UnityEngine.Vector3);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector3>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector3>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector3>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+
+// Vector4
+f.Serialize(default(UnityEngine.Vector4));
+{
+var value = default(UnityEngine.Vector4);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Vector4>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+
+// Quaternion
+f.Serialize(default(UnityEngine.Quaternion));
+{
+var value = default(UnityEngine.Quaternion);
+default(ListTreeNode<MsgPackValue>).Deserialize(ref value);
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+{
+JsonObjectValidator.GenericDeserializer<MsgPackValue,UnityEngine.Quaternion>.DeserializeField<System.Single>(default(JsonSchema), default(ListTreeNode<MsgPackValue>));
+}
+
+ }
+ }
+ }
+}
+
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs.meta
new file mode 100644
index 00000000..9fda613b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/AOTCall.g.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7e3d4b1fe26c7984f93ae501382f2dd6
+timeCreated: 1550041070
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape.meta
new file mode 100644
index 00000000..88f90990
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 0604208c180cfea44878a6962ab134b3
+folderAsset: yes
+timeCreated: 1517402736
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs
new file mode 100644
index 00000000..6129050e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs
@@ -0,0 +1,149 @@
+using UnityEngine;
+using System.Linq;
+using System;
+using System.Collections.Generic;
+using UniGLTF;
+using System.IO;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+namespace VRM
+{
+ [CreateAssetMenu(menuName = "VRM/BlendShapeAvatar")]
+ public class BlendShapeAvatar : ScriptableObject
+ {
+ [SerializeField]
+ public List<BlendShapeClip> Clips = new List<BlendShapeClip>();
+
+ /// <summary>
+ /// NullのClipを削除して詰める
+ /// </summary>
+ public void RemoveNullClip()
+ {
+ if (Clips == null)
+ {
+ return;
+ }
+ for (int i = Clips.Count - 1; i >= 0; --i)
+ {
+ if (Clips[i] == null)
+ {
+ Clips.RemoveAt(i);
+ }
+ }
+ }
+
+#if UNITY_EDITOR
+ [ContextMenu("Restore")]
+ void Restore()
+ {
+ var assetPath = UnityPath.FromAsset(this);
+ if (assetPath.IsNull)
+ {
+ return;
+ }
+
+
+ foreach (var x in assetPath.Parent.ChildFiles)
+ {
+ var clip = UnityEditor.AssetDatabase.LoadAssetAtPath<BlendShapeClip>(x.Value);
+ if (clip == null) continue;
+
+ if (!Clips.Contains(clip))
+ {
+ Clips.Add(clip);
+ }
+
+ Debug.LogFormat("{0}", clip.name);
+ }
+ Clips = Clips.OrderBy(x => BlendShapeKey.CreateFromClip(x)).ToList();
+ }
+
+ static public BlendShapeClip CreateBlendShapeClip(string path)
+ {
+ //Debug.LogFormat("{0}", path);
+ var clip = ScriptableObject.CreateInstance<BlendShapeClip>();
+ clip.BlendShapeName = Path.GetFileNameWithoutExtension(path);
+ AssetDatabase.CreateAsset(clip, path);
+ AssetDatabase.ImportAsset(path);
+ return clip;
+ //Clips.Add(clip);
+ //EditorUtility.SetDirty(this);
+ //AssetDatabase.SaveAssets();
+ }
+#endif
+
+ /// <summary>
+ /// Unknown以外で存在しないものを全て作る
+ /// </summary>
+ public void CreateDefaultPreset()
+ {
+ var presets = CacheEnum.GetValues<BlendShapePreset>();
+
+ foreach (var preset in presets)
+ {
+ if (preset == BlendShapePreset.Unknown) continue;
+ CreateDefaultPreset(preset);
+ }
+ }
+
+ void CreateDefaultPreset(BlendShapePreset preset)
+ {
+ BlendShapeClip clip = null;
+
+ foreach (var c in Clips)
+ {
+ if (c.Preset == preset)
+ {
+ clip = c;
+ break;
+ }
+ }
+ if (clip != null) return;
+
+ clip = ScriptableObject.CreateInstance<BlendShapeClip>();
+ clip.name = preset.ToString();
+ clip.BlendShapeName = preset.ToString();
+ clip.Preset = preset;
+ Clips.Add(clip);
+ }
+
+ public void SetClip(BlendShapeKey key, BlendShapeClip clip)
+ {
+ int index = -1;
+ try
+ {
+ index = Clips.FindIndex(x => key.Match(x));
+ }
+ catch (Exception)
+ {
+
+ }
+ if (index == -1)
+ {
+ Clips.Add(clip);
+ }
+ else
+ {
+ Clips[index] = clip;
+ }
+ }
+
+ public BlendShapeClip GetClip(BlendShapeKey key)
+ {
+ if (Clips == null) return null;
+ return Clips.FirstOrDefault(x => key.Match(x));
+ }
+
+ public BlendShapeClip GetClip(BlendShapePreset preset)
+ {
+ return GetClip(BlendShapeKey.CreateFromPreset(preset));
+ }
+
+ public BlendShapeClip GetClip(String name)
+ {
+ return GetClip(BlendShapeKey.CreateUnknown(name));
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs.meta
new file mode 100644
index 00000000..e67352a9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeAvatar.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 329dca3bf78fcdd42b2df941673db76f
+timeCreated: 1519195979
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs
new file mode 100644
index 00000000..0dbfd174
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VRM
+{
+ ///
+ /// A.Value * A.Weight + B.Value * B.Weight ...
+ ///
+ class BlendShapeBindingMerger
+ {
+ class DictionaryKeyBlendShapeBindingComparer : IEqualityComparer<BlendShapeBinding>
+ {
+ public bool Equals(BlendShapeBinding x, BlendShapeBinding y)
+ {
+ return x.RelativePath == y.RelativePath
+ && x.Index == y.Index;
+ }
+
+ public int GetHashCode(BlendShapeBinding obj)
+ {
+ return obj.RelativePath.GetHashCode() + obj.Index;
+ }
+ }
+
+ private static DictionaryKeyBlendShapeBindingComparer comparer = new DictionaryKeyBlendShapeBindingComparer();
+
+ /// <summary>
+ /// BlendShapeの適用値を蓄積する
+ /// </summary>
+ /// <typeparam name="BlendShapeBinding"></typeparam>
+ /// <typeparam name="float"></typeparam>
+ /// <returns></returns>
+ Dictionary<BlendShapeBinding, float> m_blendShapeValueMap = new Dictionary<BlendShapeBinding, float>(comparer);
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ Dictionary<BlendShapeBinding, Action<float>> m_blendShapeSetterMap = new Dictionary<BlendShapeBinding, Action<float>>(comparer);
+
+ public BlendShapeBindingMerger(Dictionary<BlendShapeKey, BlendShapeClip> clipMap, Transform root)
+ {
+ foreach (var kv in clipMap)
+ {
+ foreach (var binding in kv.Value.Values)
+ {
+ if (!m_blendShapeSetterMap.ContainsKey(binding))
+ {
+ var _target = root.Find(binding.RelativePath);
+ SkinnedMeshRenderer target = null;
+ if (_target != null)
+ {
+ target = _target.GetComponent<SkinnedMeshRenderer>();
+ }
+ if (target != null)
+ {
+ if (binding.Index >= 0 && binding.Index < target.sharedMesh.blendShapeCount)
+ {
+ m_blendShapeSetterMap.Add(binding, x =>
+ {
+ target.SetBlendShapeWeight(binding.Index, x);
+ });
+ }
+ else
+ {
+ Debug.LogWarningFormat("Invalid blendshape binding: {0}: {1}", target.name, binding);
+ }
+
+ }
+ else
+ {
+ Debug.LogWarningFormat("SkinnedMeshRenderer: {0} not found", binding.RelativePath);
+ }
+ }
+ }
+ }
+ }
+
+ public void ImmediatelySetValue(BlendShapeClip clip, float value)
+ {
+ foreach (var binding in clip.Values)
+ {
+ Action<float> setter;
+ if (m_blendShapeSetterMap.TryGetValue(binding, out setter))
+ {
+ setter(binding.Weight * value);
+ }
+ }
+ }
+
+ public void AccumulateValue(BlendShapeClip clip, float value)
+ {
+ foreach (var binding in clip.Values)
+ {
+ float acc;
+ if (m_blendShapeValueMap.TryGetValue(binding, out acc))
+ {
+ var accumulatedSum = acc + binding.Weight * value;
+ m_blendShapeValueMap[binding] = Mathf.Clamp(accumulatedSum, 0.0f, 100.0f);
+ }
+ else
+ {
+ m_blendShapeValueMap[binding] = binding.Weight * value;
+ }
+ }
+ }
+
+ public void Apply()
+ {
+ foreach (var kv in m_blendShapeValueMap)
+ {
+ Action<float> setter;
+ if (m_blendShapeSetterMap.TryGetValue(kv.Key, out setter))
+ {
+ setter(kv.Value);
+ }
+ }
+ m_blendShapeValueMap.Clear();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs.meta
new file mode 100644
index 00000000..29c3d844
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeBindingMerger.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ca4c8446451eeed46b1598db9e08bb73
+timeCreated: 1541229189
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs
new file mode 100644
index 00000000..ab560ca8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs
@@ -0,0 +1,146 @@
+using System;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [Serializable]
+ public struct BlendShapeBinding : IEquatable<BlendShapeBinding>
+ {
+ public String RelativePath;
+ public int Index;
+ public float Weight;
+
+ public override string ToString()
+ {
+ return string.Format("{0}[{1}]=>{2}", RelativePath, Index, Weight);
+ }
+
+ public bool Equals(BlendShapeBinding other)
+ {
+ return string.Equals(RelativePath, other.RelativePath) && Index == other.Index && Weight.Equals(other.Weight);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ return obj is BlendShapeBinding && Equals((BlendShapeBinding)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ var hashCode = (RelativePath != null ? RelativePath.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ Index;
+ hashCode = (hashCode * 397) ^ Weight.GetHashCode();
+ return hashCode;
+ }
+ }
+ }
+
+ [Serializable]
+ public struct MaterialValueBinding : IEquatable<MaterialValueBinding>
+ {
+ public String MaterialName;
+ public String ValueName;
+ public Vector4 TargetValue;
+ public Vector4 BaseValue;
+
+ public bool Equals(MaterialValueBinding other)
+ {
+ return string.Equals(MaterialName, other.MaterialName) && string.Equals(ValueName, other.ValueName) && TargetValue.Equals(other.TargetValue) && BaseValue.Equals(other.BaseValue);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ return obj is MaterialValueBinding && Equals((MaterialValueBinding)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ var hashCode = (MaterialName != null ? MaterialName.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (ValueName != null ? ValueName.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ TargetValue.GetHashCode();
+ hashCode = (hashCode * 397) ^ BaseValue.GetHashCode();
+ return hashCode;
+ }
+ }
+ }
+
+ [CreateAssetMenu(menuName = "VRM/BlendShapeClip")]
+ public class BlendShapeClip : ScriptableObject
+ {
+#if UNITY_EDITOR
+ /// <summary>
+ /// Preview 用のObject参照
+ /// </summary>
+ [SerializeField]
+ GameObject m_prefab;
+ public GameObject Prefab
+ {
+ set { m_prefab = value; }
+ get
+ {
+ if (m_prefab == null)
+ {
+ var assetPath = UnityEditor.AssetDatabase.GetAssetPath(this);
+ if (!string.IsNullOrEmpty(assetPath))
+ {
+ // if asset is subasset of prefab
+ m_prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
+ if (m_prefab == null)
+ {
+ var parent = UniGLTF.UnityPath.FromAsset(this).Parent;
+ var prefabPath = parent.Parent.Child(parent.FileNameWithoutExtension + ".prefab");
+ m_prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath.Value);
+ }
+ }
+ }
+ return m_prefab;
+ }
+ }
+#endif
+
+ /// <summary>
+ /// BlendShapePresetがUnknown場合の識別子
+ /// </summary>
+ [SerializeField]
+ public string BlendShapeName = "";
+
+ /// <summary>
+ /// BlendShapePresetを識別する。Unknownの場合は、BlendShapeNameで識別する
+ /// </summary>
+ [SerializeField]
+ public BlendShapePreset Preset;
+
+ /// <summary>
+ /// BlendShapeClipに対応するBlendShapeKey
+ /// </summary>
+ /// <returns></returns>
+ public BlendShapeKey Key => BlendShapeKey.CreateFromClip(this);
+
+ /// <summary>
+ /// BlendShapeに対する参照(index ベース)
+ /// </summary>
+ /// <value></value>
+ [SerializeField]
+ public BlendShapeBinding[] Values = new BlendShapeBinding[] { };
+
+ /// <summary>
+ /// マテリアルに対する参照(名前ベース)
+ /// </summary>
+ /// <value></value>
+ [SerializeField]
+ public MaterialValueBinding[] MaterialValues = new MaterialValueBinding[] { };
+
+ /// <summary>
+ /// UniVRM-0.45: trueの場合、このBlendShapeClipは0と1の間の中間値を取らない。四捨五入する
+ /// </summary>
+ [SerializeField]
+ public bool IsBinary;
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs.meta
new file mode 100644
index 00000000..cddffb58
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClip.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 37562b39ff933b245ac2f35d87edbcd6
+timeCreated: 1517402750
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs
new file mode 100644
index 00000000..2021df4a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs
@@ -0,0 +1,61 @@
+using UnityEngine;
+using System.Linq;
+using System;
+
+namespace VRM
+{
+ [Obsolete("Use VRMBlendShapeProxy")]
+ public class BlendShapeClipHandler
+ {
+ BlendShapeClip m_clip;
+ [Obsolete("Use Clip")]
+ public BlendShapeClip Cilp
+ {
+ get { return Clip; }
+ }
+ public BlendShapeClip Clip
+ {
+ get { return m_clip; }
+ }
+ SkinnedMeshRenderer[] m_renderers;
+
+ public BlendShapeClipHandler(BlendShapeClip clip, Transform transform)
+ {
+ m_clip = clip;
+
+ if (m_clip != null && m_clip.Values != null && transform != null)
+ {
+ m_renderers = m_clip.Values.Select(x =>
+ {
+ var target = UniGLTF.UnityExtensions.GetFromPath(transform, x.RelativePath);
+ return target.GetComponent<SkinnedMeshRenderer>();
+ })
+ .ToArray();
+ }
+ }
+
+ public float LastValue
+ {
+ get;
+ private set;
+ }
+
+ public void Apply(float value)
+ {
+ LastValue = value;
+
+ if (m_clip == null) return;
+ if (m_renderers == null) return;
+
+ for (int i = 0; i < m_clip.Values.Length; ++i)
+ {
+ var binding = m_clip.Values[i];
+ var target = m_renderers[i];
+ if (binding.Index >= 0 && binding.Index < target.sharedMesh.blendShapeCount)
+ {
+ target.SetBlendShapeWeight(binding.Index, binding.Weight * value);
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs.meta
new file mode 100644
index 00000000..1b0a17fc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeClipHandler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b93cb40fe6ff9ec4a8dcac1686f90ce8
+timeCreated: 1519729616
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs
new file mode 100644
index 00000000..344904f2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs
@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+
+namespace VRM
+{
+ [Serializable]
+ public readonly struct BlendShapeKey : IEquatable<BlendShapeKey>, IComparable<BlendShapeKey>
+ {
+ /// <summary>
+ /// Enum.ToString() のGC回避用キャッシュ
+ /// </summary>
+ private static readonly Dictionary<BlendShapePreset, string> PresetNameCacheDictionary =
+ new Dictionary<BlendShapePreset, string>();
+
+ /// <summary>
+ /// BlendShapePresetと同名の名前を持つ独自に追加したBlendShapeを区別するためのprefix
+ /// </summary>
+ private static readonly string UnknownPresetPrefix = "Unknown_";
+
+ public string Name { get; }
+
+ public readonly BlendShapePreset Preset;
+
+ private readonly string m_id;
+
+ /// <summary>
+ /// name と preset のペアからBlendShapeKeyを生成するが、
+ /// BlendShapePreset.Unknown のときと、それ以外のときで挙動が異なることを知っている必要があって、わかりにくいので private に変更。
+ /// v0.56
+ ///
+ /// 代わりに、public static 関数を使って生成します
+ ///
+ /// CreateFromPreset(BlendShapePreset)
+ /// CreateFromClip(BlendShapeClip)
+ /// CreateUnknown(string)
+ ///
+ /// TODO ?
+ /// 旧仕様(GC発生などでパフォーマンスは、あまりよろしくない)
+ /// CreateLegacyFromString(string);
+ ///
+ /// </summary>
+ /// <param name="name"></param>
+ /// <param name="preset"></param>
+ private BlendShapeKey(string name, BlendShapePreset preset)
+ {
+ Preset = preset;
+
+ if (Preset != BlendShapePreset.Unknown)
+ {
+ if (PresetNameCacheDictionary.TryGetValue(Preset, out var presetName))
+ {
+ m_id = Name = presetName;
+ }
+ else
+ {
+ // BlendShapePreset.Unknown 以外の場合、 name は捨てられる
+ m_id = Name = Preset.ToString();
+
+ PresetNameCacheDictionary.Add(Preset, Name);
+ }
+ }
+ else
+ {
+ Name = !string.IsNullOrEmpty(name) ? name : "";
+ m_id = UnknownPresetPrefix + Name;
+ }
+ }
+
+ /// <summary>
+ /// PresetからBlendShapeKeyを生成
+ /// </summary>
+ /// <param name="preset"></param>
+ /// <returns></returns>
+ public static BlendShapeKey CreateFromPreset(BlendShapePreset preset)
+ {
+ return new BlendShapeKey("", preset);
+ }
+
+ /// <summary>
+ /// BlendShapeClipからBlendShapeKeyを生成
+ /// </summary>
+ /// <param name="clip"></param>
+ /// <returns></returns>
+ public static BlendShapeKey CreateFromClip(BlendShapeClip clip)
+ {
+ if (clip == null)
+ {
+ return default(BlendShapeKey);
+ }
+
+ return new BlendShapeKey(clip.BlendShapeName, clip.Preset);
+ }
+
+ /// <summary>
+ /// BlendShapePreset.Unknown である BlendShapeKey を name から作成する
+ /// </summary>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ public static BlendShapeKey CreateUnknown(string name)
+ {
+ return new BlendShapeKey(name, BlendShapePreset.Unknown);
+ }
+
+ public override string ToString()
+ {
+ return m_id.Replace(UnknownPresetPrefix, "");
+ }
+
+ public bool Equals(BlendShapeKey other)
+ {
+ return m_id == other.m_id;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is BlendShapeKey)
+ {
+ return Equals((BlendShapeKey) obj);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return m_id.GetHashCode();
+ }
+
+ public bool Match(BlendShapeClip clip)
+ {
+ return this.Equals(CreateFromClip(clip));
+ }
+
+ public int CompareTo(BlendShapeKey other)
+ {
+ if (Preset != other.Preset)
+ {
+ return Preset - other.Preset;
+ }
+
+ return 0;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs.meta
new file mode 100644
index 00000000..83719f7f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeKey.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 273b1f57f417db8408c13673d45890ff
+timeCreated: 1521727258
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs
new file mode 100644
index 00000000..02e60ab7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+
+ /// <summary>
+ /// ブレンドシェイプを蓄えてまとめて適用するクラス
+ /// </summary>
+ class BlendShapeMerger
+ {
+ /// <summary>
+ /// Key からBlendShapeClipを得る
+ /// </summary>
+ Dictionary<BlendShapeKey, BlendShapeClip> m_clipMap;
+
+ /// <summary>
+ /// BlendShape のWeightを記録する
+ /// </summary>
+ Dictionary<BlendShapeKey, float> m_valueMap;
+
+ BlendShapeBindingMerger m_blendShapeBindingMerger;
+
+ MaterialValueBindingMerger m_materialValueBindingMerger;
+
+
+ public BlendShapeMerger(IEnumerable<BlendShapeClip> clips, Transform root)
+ {
+ m_clipMap = clips.ToDictionary(x => BlendShapeKey.CreateFromClip(x), x => x);
+
+ m_valueMap = new Dictionary<BlendShapeKey, float>();
+
+ m_blendShapeBindingMerger = new BlendShapeBindingMerger(m_clipMap, root);
+ m_materialValueBindingMerger = new MaterialValueBindingMerger(m_clipMap, root);
+ }
+
+ /*
+ public void Clear()
+ {
+ foreach (var kv in m_valueMap.ToArray())
+ {
+ SetValue(kv.Key, kv.Value, false);
+ }
+ Apply();
+ }
+ */
+
+ /// <summary>
+ /// 蓄積した値を適用する
+ /// </summary>
+ public void Apply()
+ {
+ m_blendShapeBindingMerger.Apply();
+ m_materialValueBindingMerger.Apply();
+ }
+
+ /// <summary>
+ /// まとめて反映する。1フレームに1回呼び出されることを想定
+ /// </summary>
+ /// <param name="values"></param>
+ public void SetValues(IEnumerable<KeyValuePair<BlendShapeKey, float>> values)
+ {
+ foreach (var kv in values)
+ {
+ AccumulateValue(kv.Key, kv.Value);
+ }
+ Apply();
+ }
+
+ /// <summary>
+ /// 即時に反映しない。後にApplyによって反映する
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ public void AccumulateValue(BlendShapeKey key, float value)
+ {
+ m_valueMap[key] = value;
+
+ BlendShapeClip clip;
+ if (!m_clipMap.TryGetValue(key, out clip))
+ {
+ return;
+ }
+
+ if (clip.IsBinary)
+ {
+ value = Mathf.Round(value);
+ }
+
+ m_blendShapeBindingMerger.AccumulateValue(clip, value);
+ m_materialValueBindingMerger.AccumulateValue(clip, value);
+ }
+
+ /// <summary>
+ /// 即時に反映する
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ public void ImmediatelySetValue(BlendShapeKey key, float value)
+ {
+ m_valueMap[key] = value;
+
+ BlendShapeClip clip;
+ if (!m_clipMap.TryGetValue(key, out clip))
+ {
+ return;
+ }
+
+ if (clip.IsBinary)
+ {
+ value = Mathf.Round(value);
+ }
+
+ m_blendShapeBindingMerger.ImmediatelySetValue(clip, value);
+ m_materialValueBindingMerger.ImmediatelySetValue(clip, value);
+ }
+
+ public void SetValue(BlendShapeKey key, float value, bool immediately)
+ {
+ if (immediately)
+ {
+ ImmediatelySetValue(key, value);
+ }
+ else
+ {
+ AccumulateValue(key, value);
+ }
+ }
+
+ public float GetValue(BlendShapeKey key)
+ {
+ float value;
+ if (!m_valueMap.TryGetValue(key, out value))
+ {
+ return 0;
+ }
+ return value;
+ }
+
+ public void RestoreMaterialInitialValues(IEnumerable<BlendShapeClip> clips)
+ {
+ m_materialValueBindingMerger.RestoreMaterialInitialValues(clips);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs.meta
new file mode 100644
index 00000000..18c37fa0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/BlendShapeMerger.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 08be778bf6b570847a9fb8dc57e29946
+timeCreated: 1524201297
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs
new file mode 100644
index 00000000..40e31fd1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs
@@ -0,0 +1,119 @@
+using System.Collections;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class Blinker : MonoBehaviour
+ {
+ [SerializeField]
+ public VRMBlendShapeProxy BlendShapes;
+ private void Reset()
+ {
+ BlendShapes = GetComponent<VRMBlendShapeProxy>();
+ }
+
+ [SerializeField]
+ float m_interVal = 5.0f;
+
+ [SerializeField]
+ float m_closingTime = 0.06f;
+
+ [SerializeField]
+ float m_openingSeconds = 0.03f;
+
+ [SerializeField]
+ float m_closeSeconds = 0.1f;
+
+ protected Coroutine m_coroutine;
+
+ //static readonly string BLINK_NAME = BlendShapePreset.Blink.ToString();
+
+ float m_nextRequest;
+ bool m_request;
+ public bool Request
+ {
+ get { return m_request; }
+ set
+ {
+ if (Time.time < m_nextRequest)
+ {
+ return;
+ }
+ m_request = value;
+ m_nextRequest = Time.time + 1.0f;
+ }
+ }
+
+ protected IEnumerator BlinkRoutine()
+ {
+ while (true)
+ {
+ var waitTime = Time.time + Random.value * m_interVal;
+ while (waitTime > Time.time)
+ {
+ if (Request)
+ {
+ m_request = false;
+ break;
+ }
+ yield return null;
+ }
+
+ // close
+ var value = 0.0f;
+ var closeSpeed = 1.0f / m_closeSeconds;
+ while (true)
+ {
+ value += Time.deltaTime * closeSpeed;
+ if (value >= 1.0f)
+ {
+ break;
+ }
+
+ BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), value);
+ yield return null;
+ }
+ BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), 1.0f);
+
+ // wait...
+ yield return new WaitForSeconds(m_closingTime);
+
+ // open
+ value = 1.0f;
+ var openSpeed = 1.0f / m_openingSeconds;
+ while (true)
+ {
+ value -= Time.deltaTime * openSpeed;
+ if (value < 0)
+ {
+ break;
+ }
+
+ BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), value);
+ yield return null;
+ }
+ BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), 0);
+ }
+ }
+
+ private void Awake()
+ {
+ if (BlendShapes == null) BlendShapes = GetComponent<VRM.VRMBlendShapeProxy>();
+ }
+
+ private void OnEnable()
+ {
+ m_coroutine = StartCoroutine(BlinkRoutine());
+ }
+
+ private void OnDisable()
+ {
+ if (m_coroutine != null)
+ {
+ StopCoroutine(m_coroutine);
+ m_coroutine = null;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs.meta
new file mode 100644
index 00000000..73f197d4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/Blinker.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 69ea1f88e8d74e04e9341465573a4ef8
+timeCreated: 1517463794
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs
new file mode 100644
index 00000000..0dcb380a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs
@@ -0,0 +1,288 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UniGLTF;
+
+namespace VRM
+{
+ ///
+ /// Base + (A.Target - Base) * A.Weight + (B.Target - Base) * B.Weight ...
+ ///
+ class MaterialValueBindingMerger
+ {
+
+ struct DictionaryKeyMaterialValueBindingComparer : IEqualityComparer<MaterialValueBinding>
+ {
+ public bool Equals(MaterialValueBinding x, MaterialValueBinding y)
+ {
+ return x.TargetValue == y.TargetValue && x.BaseValue == y.BaseValue && x.MaterialName == y.MaterialName && x.ValueName == y.ValueName;
+ }
+
+ public int GetHashCode(MaterialValueBinding obj)
+ {
+ return obj.GetHashCode();
+ }
+ }
+
+ static DictionaryKeyMaterialValueBindingComparer comparer = new DictionaryKeyMaterialValueBindingComparer();
+
+ /// <summary>
+ /// 名前とmaterialのマッピング
+ /// </summary>
+ Dictionary<string, Material> m_materialMap = new Dictionary<string, Material>();
+
+ delegate void Setter(float value, bool firstValue);
+
+ /// <summary>
+ /// MaterialValueの適用値を蓄積する
+ /// </summary>
+ /// <typeparam name="MaterialValueBinding"></typeparam>
+ /// <typeparam name="float"></typeparam>
+ /// <returns></returns>
+ Dictionary<MaterialValueBinding, float> m_materialValueMap = new Dictionary<MaterialValueBinding, float>(comparer);
+
+ Dictionary<MaterialValueBinding, Setter> m_materialSetterMap = new Dictionary<MaterialValueBinding, Setter>(comparer);
+
+ //BlendShapeClip[] m_clips;
+
+ public MaterialValueBindingMerger(Dictionary<BlendShapeKey, BlendShapeClip> clipMap, Transform root)
+ {
+ //m_clips = clipMap.Values.ToArray();
+
+ foreach (var x in root.Traverse())
+ {
+ var renderer = x.GetComponent<Renderer>();
+ if (renderer != null)
+ {
+ foreach (var y in renderer.sharedMaterials.Where(y => y != null))
+ {
+ if (!string.IsNullOrEmpty(y.name))
+ {
+ if (!m_materialMap.ContainsKey(y.name))
+ {
+ m_materialMap.Add(y.name, y);
+ }
+ }
+ }
+ }
+ }
+
+ foreach (var kv in clipMap)
+ {
+ foreach (var binding in kv.Value.MaterialValues)
+ {
+ if (!m_materialSetterMap.ContainsKey(binding))
+ {
+ Material target;
+ if (m_materialMap.TryGetValue(binding.MaterialName, out target))
+ {
+ if (binding.ValueName.EndsWith("_ST_S"))
+ {
+ var valueName = binding.ValueName.Substring(0, binding.ValueName.Length - 2);
+ Setter setter = (value, firstValue) =>
+ {
+ var propValue = firstValue
+ ? (binding.BaseValue + (binding.TargetValue - binding.BaseValue) * value)
+ : (target.GetVector(valueName) + (binding.TargetValue - binding.BaseValue) * value)
+ ;
+ var src = target.GetVector(valueName);
+ src.x = propValue.x; // horizontal only
+ src.z = propValue.z; // horizontal only
+ target.SetVector(valueName, src);
+ };
+ m_materialSetterMap.Add(binding, setter);
+ }
+ else if (binding.ValueName.EndsWith("_ST_T"))
+ {
+ var valueName = binding.ValueName.Substring(0, binding.ValueName.Length - 2);
+ Setter setter = (value, firstValue) =>
+ {
+ var propValue = firstValue
+ ? (binding.BaseValue + (binding.TargetValue - binding.BaseValue) * value)
+ : (target.GetVector(valueName) + (binding.TargetValue - binding.BaseValue) * value)
+ ;
+ var src = target.GetVector(valueName);
+ src.y = propValue.y; // vertical only
+ src.w = propValue.w; // vertical only
+ target.SetVector(valueName, src);
+ };
+ m_materialSetterMap.Add(binding, setter);
+ }
+ else
+ {
+ Setter vec4Setter = (value, firstValue) =>
+ {
+ var propValue = firstValue
+ ? (binding.BaseValue + (binding.TargetValue - binding.BaseValue) * value)
+ : (target.GetVector(binding.ValueName) + (binding.TargetValue - binding.BaseValue) * value)
+ ;
+ target.SetColor(binding.ValueName, propValue);
+ };
+ m_materialSetterMap.Add(binding, vec4Setter);
+ }
+ }
+ else
+ {
+ Debug.LogWarningFormat("material: {0} not found", binding.MaterialName);
+ }
+ }
+ }
+ }
+ }
+
+ public void RestoreMaterialInitialValues(IEnumerable<BlendShapeClip> clips)
+ {
+ if (m_materialMap != null)
+ {
+ foreach (var x in clips)
+ {
+ foreach (var y in x.MaterialValues)
+ {
+ // restore values
+ Material material;
+ if (m_materialMap.TryGetValue(y.MaterialName, out material))
+ {
+ var valueName = y.ValueName;
+ if (valueName.EndsWith("_ST_S")
+ || valueName.EndsWith("_ST_T"))
+ {
+ valueName = valueName.Substring(0, valueName.Length - 2);
+ }
+#if UNITY_EDITOR
+ // restore only material with asset
+ if (!string.IsNullOrEmpty(UnityEditor.AssetDatabase.GetAssetPath(material)))
+ {
+ material.SetColor(valueName, y.BaseValue);
+ }
+#endif
+ }
+ else
+ {
+ Debug.LogWarningFormat("{0} not found", y.MaterialName);
+ }
+ }
+ }
+ }
+ }
+
+ public void ImmediatelySetValue(BlendShapeClip clip, float value)
+ {
+ foreach (var binding in clip.MaterialValues)
+ {
+ Setter setter;
+ if (m_materialSetterMap.TryGetValue(binding, out setter))
+ {
+ setter(value, true);
+ }
+ }
+ }
+
+ public void AccumulateValue(BlendShapeClip clip, float value)
+ {
+ foreach (var binding in clip.MaterialValues)
+ {
+ // 積算
+ float acc;
+ if (m_materialValueMap.TryGetValue(binding, out acc))
+ {
+ m_materialValueMap[binding] = acc + value;
+ }
+ else
+ {
+ m_materialValueMap[binding] = value;
+ }
+ }
+ }
+
+ struct MaterialTarget : IEquatable<MaterialTarget>
+ {
+ public string MaterialName;
+ public string ValueName;
+
+ public bool Equals(MaterialTarget other)
+ {
+ return MaterialName == other.MaterialName
+ && ValueName == other.ValueName;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is MaterialTarget)
+ {
+ return Equals((MaterialTarget)obj);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ if (MaterialName == null || ValueName == null)
+ {
+ return 0;
+ }
+ return MaterialName.GetHashCode() + ValueName.GetHashCode();
+ }
+
+ public static MaterialTarget Create(MaterialValueBinding binding)
+ {
+ return new MaterialTarget
+ {
+ MaterialName=binding.MaterialName,
+ ValueName=binding.ValueName
+ };
+ }
+ }
+
+ HashSet<MaterialTarget> m_used = new HashSet<MaterialTarget>();
+
+ public void Apply()
+ {
+ // clear
+ //RestoreMaterialInitialValues(m_clips);
+ m_used.Clear();
+
+ // (binding.Value-Base) * weight を足す
+ foreach (var kv in m_materialValueMap)
+ {
+ var key = MaterialTarget.Create(kv.Key);
+ if (!m_used.Contains(key))
+ {
+ // restore value
+ Material material;
+ if (m_materialMap.TryGetValue(key.MaterialName, out material))
+ {
+ var value = kv.Key.BaseValue;
+ var valueName = key.ValueName;
+ if (valueName.EndsWith("_ST_S"))
+ {
+ valueName = valueName.Substring(0, valueName.Length - 2);
+ var v=material.GetVector(valueName);
+ value.y = v.y;
+ value.w = v.w;
+ }
+ else if (valueName.EndsWith("_ST_T"))
+ {
+ valueName = valueName.Substring(0, valueName.Length - 2);
+ var v = material.GetVector(valueName);
+ value.x = v.x;
+ value.z = v.z;
+ }
+ material.SetColor(valueName, value);
+ }
+ m_used.Add(key);
+ }
+
+ Setter setter;
+ if (m_materialSetterMap.TryGetValue(kv.Key, out setter))
+ {
+ setter(kv.Value, false);
+ }
+ }
+ m_materialValueMap.Clear();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs.meta
new file mode 100644
index 00000000..53929f07
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MaterialValueBindingMerger.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4ccc88d77d5d1e74499d053083ade08d
+timeCreated: 1541229189
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs
new file mode 100644
index 00000000..54dfc182
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs
@@ -0,0 +1,236 @@
+using System.Linq;
+using UnityEngine;
+using UniGLTF;
+using System;
+using System.Collections.Generic;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace VRM
+{
+#if UNITY_EDITOR
+ [Serializable]
+ public struct PropItem
+ {
+ public ShaderUtil.ShaderPropertyType PropertyType;
+ public Vector4 DefaultValues;
+ }
+#endif
+
+ [Serializable]
+ public class MaterialItem
+ {
+ public Material Material { get; private set; }
+#if UNITY_EDITOR
+ public Dictionary<string, PropItem> PropMap = new Dictionary<string, PropItem>();
+
+ public string[] PropNames
+ {
+ get;
+ private set;
+ }
+#endif
+
+ public static MaterialItem Create(Material material)
+ {
+ var item = new MaterialItem
+ {
+ Material = material
+ };
+#if UNITY_EDITOR
+
+ var propNames = new List<string>();
+ for (int i = 0; i < ShaderUtil.GetPropertyCount(material.shader); ++i)
+ {
+ var propType = ShaderUtil.GetPropertyType(material.shader, i);
+ var name = ShaderUtil.GetPropertyName(material.shader, i);
+
+ switch (propType)
+ {
+ case ShaderUtil.ShaderPropertyType.Color:
+ // 色
+ item.PropMap.Add(name, new PropItem
+ {
+ PropertyType = propType,
+ DefaultValues = material.GetColor(name),
+ });
+ propNames.Add(name);
+ break;
+
+ case ShaderUtil.ShaderPropertyType.TexEnv:
+ // テクスチャ
+ {
+ name += "_ST";
+ item.PropMap.Add(name, new PropItem
+ {
+ PropertyType = propType,
+ DefaultValues = material.GetVector(name),
+ });
+ propNames.Add(name);
+ }
+ // 縦横分離用
+ {
+ var st_name = name + "_S";
+ item.PropMap.Add(st_name, new PropItem
+ {
+ PropertyType = propType,
+ DefaultValues = material.GetVector(name),
+ });
+ propNames.Add(st_name);
+ }
+ {
+ var st_name = name + "_T";
+ item.PropMap.Add(st_name, new PropItem
+ {
+ PropertyType = propType,
+ DefaultValues = material.GetVector(name),
+ });
+ propNames.Add(st_name);
+ }
+ break;
+ }
+ }
+ item.PropNames = propNames.ToArray();
+#endif
+ return item;
+ }
+ }
+
+ [Serializable]
+ public class MeshPreviewItem
+ {
+ public string Path
+ {
+ get;
+ private set;
+ }
+
+ public SkinnedMeshRenderer SkinnedMeshRenderer
+ {
+ get;
+ private set;
+ }
+
+ public Mesh Mesh
+ {
+ get;
+ private set;
+ }
+
+ public string[] BlendShapeNames
+ {
+ get;
+ private set;
+ }
+
+ public int BlendShapeCount
+ {
+ get { return BlendShapeNames.Length; }
+ }
+
+ public Material[] Materials
+ {
+ get;
+ private set;
+ }
+
+ Transform m_transform;
+ public Vector3 Position
+ {
+ get { return m_transform.position; }
+ }
+ public Quaternion Rotation
+ {
+ get { return m_transform.rotation; }
+ }
+
+ MeshPreviewItem(string path, Transform transform, Material[] materials)
+ {
+ Path = path;
+ m_transform = transform;
+ Materials = materials;
+ }
+
+ public void Bake(IEnumerable<BlendShapeBinding> values, float weight)
+ {
+ if (SkinnedMeshRenderer == null) return;
+
+ // Update baked mesh
+ if (values != null)
+ {
+ // clear
+ for (int i = 0; i < BlendShapeCount; ++i)
+ {
+ SkinnedMeshRenderer.SetBlendShapeWeight(i, 0);
+ }
+
+ foreach (var x in values)
+ {
+ if (x.RelativePath == Path)
+ {
+ if (x.Index >= 0 && x.Index < SkinnedMeshRenderer.sharedMesh.blendShapeCount)
+ {
+ SkinnedMeshRenderer.SetBlendShapeWeight(x.Index, x.Weight * weight);
+ }
+ else
+ {
+ Debug.LogWarningFormat("Out of range {0}: 0 <= {1} < {2}",
+ SkinnedMeshRenderer.name,
+ x.Index,
+ SkinnedMeshRenderer.sharedMesh.blendShapeCount);
+ }
+ }
+ }
+ }
+ SkinnedMeshRenderer.BakeMesh(Mesh);
+ }
+
+ public static MeshPreviewItem Create(Transform t, Transform root,
+ Func<Material, Material> getOrCreateMaterial)
+ {
+ //Debug.Log("create");
+
+ var meshFilter = t.GetComponent<MeshFilter>();
+ var meshRenderer = t.GetComponent<MeshRenderer>();
+ var skinnedMeshRenderer = t.GetComponent<SkinnedMeshRenderer>();
+ if (meshFilter != null && meshRenderer != null)
+ {
+ // copy
+ meshRenderer.sharedMaterials = meshRenderer.sharedMaterials.Select(x => getOrCreateMaterial(x)).ToArray();
+ return new MeshPreviewItem(t.RelativePathFrom(root), t, meshRenderer.sharedMaterials)
+ {
+ Mesh = meshFilter.sharedMesh
+ };
+ }
+ else if (skinnedMeshRenderer != null)
+ {
+ // copy
+ skinnedMeshRenderer.sharedMaterials = skinnedMeshRenderer.sharedMaterials.Select(x => getOrCreateMaterial(x)).ToArray();
+ if (skinnedMeshRenderer.sharedMesh.blendShapeCount > 0)
+ {
+ // bake required
+ var sharedMesh = skinnedMeshRenderer.sharedMesh;
+ return new MeshPreviewItem(t.RelativePathFrom(root), t, skinnedMeshRenderer.sharedMaterials)
+ {
+ SkinnedMeshRenderer = skinnedMeshRenderer,
+ Mesh = new Mesh(), // for bake
+ BlendShapeNames = Enumerable.Range(0, sharedMesh.blendShapeCount).Select(x => sharedMesh.GetBlendShapeName(x)).ToArray()
+ };
+ }
+ else
+ {
+ return new MeshPreviewItem(t.RelativePathFrom(root), t, skinnedMeshRenderer.sharedMaterials)
+ {
+ Mesh = skinnedMeshRenderer.sharedMesh,
+ };
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs.meta
new file mode 100644
index 00000000..fb8fb8dd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/MeshPreviewItem.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 7a8f34605a43f30459f50399149f5929
+timeCreated: 1523145842
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs
new file mode 100644
index 00000000..1a748011
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs
@@ -0,0 +1,306 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using System.Reflection;
+using System;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+using UniGLTF;
+
+
+namespace VRM
+{
+ /// <summary>
+ /// プレビュー向けのシーンを管理する
+ /// </summary>
+ public class PreviewSceneManager : MonoBehaviour
+ {
+ public GameObject Prefab;
+
+#if UNITY_EDITOR
+ public static PreviewSceneManager GetOrCreate(GameObject prefab)
+ {
+ if (prefab == null)
+ {
+ return null;
+ }
+
+ PreviewSceneManager manager = null;
+
+ // if we already instantiated a PreviewInstance previously but just lost the reference, then use that same instance instead of making a new one
+ var managers = GameObject.FindObjectsOfType<PreviewSceneManager>();
+ foreach (var x in managers)
+ {
+ if (x.Prefab == prefab)
+ {
+ Debug.LogFormat("find {0}", manager);
+ return manager;
+ }
+ Debug.LogFormat("destroy {0}", x);
+ GameObject.DestroyImmediate(x.gameObject);
+ }
+
+ //Debug.Log("new prefab. instanciate");
+ // no previous instance detected, so now let's make a fresh one
+ // very important: this loads the PreviewInstance prefab and temporarily instantiates it into PreviewInstance
+ var go = GameObject.Instantiate(prefab,
+ prefab.transform.position,
+ prefab.transform.rotation
+ );
+ go.name = "__PREVIEW_SCENE_MANGER__";
+ manager = go.AddComponent<PreviewSceneManager>();
+ manager.Initialize(prefab);
+
+ // HideFlags are special editor-only settings that let you have *secret* GameObjects in a scene, or to tell Unity not to save that temporary GameObject as part of the scene
+ foreach (var x in go.transform.Traverse())
+ {
+ x.gameObject.hideFlags = HideFlags.None
+ | HideFlags.DontSave
+ //| HideFlags.DontSaveInBuild
+#if VRM_DEVELOP
+#else
+ | HideFlags.HideAndDontSave
+#endif
+ ;
+ }
+
+ return manager;
+ }
+#endif
+
+ public void Clean()
+ {
+ foreach (var kv in m_materialMap)
+ {
+ UnityEngine.Object.DestroyImmediate(kv.Value.Material);
+ }
+ }
+
+ private void Initialize(GameObject prefab)
+ {
+ //Debug.LogFormat("[PreviewSceneManager.Initialize] {0}", prefab);
+ Prefab = prefab;
+
+ var materialNames = new List<string>();
+ var map = new Dictionary<Material, Material>();
+ Func<Material, Material> getOrCreateMaterial = src =>
+ {
+ if (src == null) return null;
+ if (string.IsNullOrEmpty(src.name)) return null; // !
+
+ Material dst;
+ if (!map.TryGetValue(src, out dst))
+ {
+ dst = new Material(src);
+ map.Add(src, dst);
+
+ //Debug.LogFormat("add material {0}", src.name);
+ materialNames.Add(src.name);
+ m_materialMap.Add(src.name, MaterialItem.Create(dst));
+ }
+ return dst;
+ };
+
+ m_meshes = transform.Traverse()
+ .Select(x => MeshPreviewItem.Create(x, transform, getOrCreateMaterial))
+ .Where(x => x != null)
+ .ToArray()
+ ;
+ MaterialNames = materialNames.ToArray();
+
+ m_blendShapeMeshes = m_meshes
+ .Where(x => x.SkinnedMeshRenderer != null
+ && x.SkinnedMeshRenderer.sharedMesh.blendShapeCount > 0)
+ .ToArray();
+
+ //Bake(values, materialValues);
+
+ m_rendererPathList = m_meshes.Select(x => x.Path).ToArray();
+ m_skinnedMeshRendererPathList = m_meshes
+ .Where(x => x.SkinnedMeshRenderer != null)
+ .Select(x => x.Path)
+ .ToArray();
+
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ var head = animator.GetBoneTransform(HumanBodyBones.Head);
+ if (head != null)
+ {
+ m_target = head;
+ }
+ }
+ }
+
+ MeshPreviewItem[] m_meshes;
+ MeshPreviewItem[] m_blendShapeMeshes;
+ public IEnumerable<MeshPreviewItem> EnumRenderItems
+ {
+ get
+ {
+ if (m_meshes != null)
+ {
+ foreach (var x in m_meshes)
+ {
+ yield return x;
+ }
+ }
+ }
+ }
+
+ public string[] MaterialNames
+ {
+ get;
+ private set;
+ }
+
+ Dictionary<string, MaterialItem> m_materialMap = new Dictionary<string, MaterialItem>();
+
+ string[] m_rendererPathList;
+ public string[] RendererPathList
+ {
+ get { return m_rendererPathList; }
+ }
+
+ string[] m_skinnedMeshRendererPathList;
+ public string[] SkinnedMeshRendererPathList
+ {
+ get { return m_skinnedMeshRendererPathList; }
+ }
+
+ public string[] GetBlendShapeNames(int blendShapeMeshIndex)
+ {
+ if (blendShapeMeshIndex >= 0 && blendShapeMeshIndex < m_blendShapeMeshes.Length)
+ {
+ var item = m_blendShapeMeshes[blendShapeMeshIndex];
+ return item.BlendShapeNames;
+ }
+
+ return null;
+ }
+
+ public MaterialItem GetMaterialItem(string materialName)
+ {
+ MaterialItem item;
+ if (!m_materialMap.TryGetValue(materialName, out item))
+ {
+ return null;
+ }
+
+ return item;
+ }
+
+ public Transform m_target;
+ public Vector3 TargetPosition
+ {
+ get
+ {
+ if (m_target == null)
+ {
+ return new Vector3(0, 1.4f, 0);
+ }
+ return m_target.position + new Vector3(0, 0.1f, 0);
+ }
+ }
+
+#if UNITY_EDITOR
+
+ public struct BakeValue
+ {
+ public IEnumerable<BlendShapeBinding> BlendShapeBindings;
+ public IEnumerable<MaterialValueBinding> MaterialValueBindings;
+ public float Weight;
+ }
+
+ Bounds m_bounds;
+ public void Bake(BakeValue bake)
+ {
+ //
+ // Bake BlendShape
+ //
+ m_bounds = default(Bounds);
+ if (m_meshes != null)
+ {
+ foreach (var x in m_meshes)
+ {
+ x.Bake(bake.BlendShapeBindings, bake.Weight);
+ m_bounds.Expand(x.Mesh.bounds.size);
+ }
+ }
+
+ //
+ // Update Material
+ //
+ if (bake.MaterialValueBindings != null && m_materialMap != null)
+ {
+ // clear
+ //Debug.LogFormat("clear material");
+ foreach (var kv in m_materialMap)
+ {
+ foreach (var _kv in kv.Value.PropMap)
+ {
+ kv.Value.Material.SetColor(_kv.Key, _kv.Value.DefaultValues);
+ }
+ }
+
+ foreach (var x in bake.MaterialValueBindings)
+ {
+ MaterialItem item;
+ if (m_materialMap.TryGetValue(x.MaterialName, out item))
+ {
+ //Debug.Log("set material");
+ PropItem prop;
+ if (item.PropMap.TryGetValue(x.ValueName, out prop))
+ {
+ var valueName = x.ValueName;
+ if (valueName.EndsWith("_ST_S")
+ || valueName.EndsWith("_ST_T"))
+ {
+ valueName = valueName.Substring(0, valueName.Length - 2);
+ }
+
+ var value = item.Material.GetVector(valueName);
+ //Debug.LogFormat("{0} => {1}", valueName, x.TargetValue);
+ value += ((x.TargetValue - x.BaseValue) * bake.Weight);
+ item.Material.SetColor(valueName, value);
+ }
+ }
+ }
+ }
+ }
+#endif
+
+ /// <summary>
+ /// カメラパラメーターを決める
+ /// </summary>
+ /// <param name="camera"></param>
+ public void SetupCamera(Camera camera, Vector3 target, float yaw, float pitch, Vector3 position)
+ {
+ camera.backgroundColor = Color.gray;
+ camera.clearFlags = CameraClearFlags.Color;
+
+ // projection
+ //float magnitude = m_bounds.extents.magnitude * 0.5f;
+ //float distance = magnitude;
+ //var distance = target.magnitude;
+
+ camera.fieldOfView = 27f;
+ camera.nearClipPlane = 0.3f;
+ camera.farClipPlane = -position.z /*+ magnitude*/ * 2.1f;
+
+ var t = Matrix4x4.Translate(position);
+ var r = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(pitch, yaw, 0), Vector3.one);
+ // 回転してから移動
+ var m = r * t;
+
+ camera.transform.position = target + m.ExtractPosition();
+ camera.transform.rotation = m.ExtractRotation();
+ //camera.transform.LookAt(target);
+
+ //previewLayer のみ表示する
+ //camera.cullingMask = 1 << PreviewLayer;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs.meta
new file mode 100644
index 00000000..59d59634
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/PreviewSceneManager.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f478195c182f6d344b5d30b4318321a4
+timeCreated: 1523096653
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs
new file mode 100644
index 00000000..1721c6da
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs
@@ -0,0 +1,211 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [DisallowMultipleComponent]
+ public class VRMBlendShapeProxy : MonoBehaviour, IVRMComponent
+ {
+ [SerializeField]
+ public BlendShapeAvatar BlendShapeAvatar;
+
+ public void OnImported(VRMImporterContext context)
+ {
+ throw new NotImplementedException();
+ }
+
+ BlendShapeMerger m_merger;
+
+ private void OnDestroy()
+ {
+ if (m_merger != null)
+ {
+ m_merger.RestoreMaterialInitialValues(BlendShapeAvatar.Clips);
+ }
+ }
+
+ private void Start()
+ {
+ if (BlendShapeAvatar != null)
+ {
+ if (m_merger == null)
+ {
+ m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Immediately SetValue
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ public void ImmediatelySetValue(BlendShapeKey key, float value)
+ {
+ if (m_merger != null)
+ {
+ m_merger.ImmediatelySetValue(key, value);
+ }
+ }
+
+ /// <summary>
+ /// AccumulateValue. After, Should call Apply
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ public void AccumulateValue(BlendShapeKey key, float value)
+ {
+ if (m_merger != null)
+ {
+ m_merger.AccumulateValue(key, value);
+ }
+ }
+
+ /// <summary>
+ /// Get a blendShape value
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public float GetValue(BlendShapeKey key)
+ {
+ if (m_merger == null)
+ {
+ return 0;
+ }
+ return m_merger.GetValue(key);
+ }
+
+ public IEnumerable<KeyValuePair<BlendShapeKey, float>> GetValues()
+ {
+ if (m_merger != null && BlendShapeAvatar != null)
+ {
+ foreach (var clip in BlendShapeAvatar.Clips)
+ {
+ var key = BlendShapeKey.CreateFromClip(clip);
+ yield return new KeyValuePair<BlendShapeKey, float>(key, m_merger.GetValue(key));
+ }
+ }
+ }
+
+ /// <summary>
+ /// Set blendShape values immediate.
+ /// </summary>
+ /// <param name="values"></param>
+ public void SetValues(IEnumerable<KeyValuePair<BlendShapeKey, float>> values)
+ {
+ if (m_merger != null)
+ {
+ m_merger.SetValues(values);
+ }
+ }
+
+ /// <summary>
+ /// Apply blendShape values that use SetValue apply=false
+ /// </summary>
+ public void Apply()
+ {
+ if (m_merger != null)
+ {
+ m_merger.Apply();
+ }
+ }
+ }
+
+ public static class VRMBlendShapeProxyExtensions
+ {
+ [Obsolete("Use BlendShapeKey.CreateFromPreset")]
+ public static float GetValue(this VRMBlendShapeProxy proxy, BlendShapePreset key)
+ {
+ return proxy.GetValue(BlendShapeKey.CreateFromPreset(key));
+ }
+
+ [Obsolete("Use BlendShapeKey.CreateUnknown")]
+ public static float GetValue(this VRMBlendShapeProxy proxy, String key)
+ {
+ return proxy.GetValue(BlendShapeKey.CreateUnknown(key));
+ }
+
+ [Obsolete("Use ImmediatelySetValue")]
+ public static void SetValue(this VRMBlendShapeProxy proxy, BlendShapePreset key, float value)
+ {
+ proxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(key), value);
+ }
+
+ [Obsolete("Use BlendShapeKey.CreateFromPreset")]
+ public static void ImmediatelySetValue(this VRMBlendShapeProxy proxy, BlendShapePreset key, float value)
+ {
+ proxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(key), value);
+ }
+
+ [Obsolete("Use BlendShapeKey.CreateFromPreset")]
+ public static void AccumulateValue(this VRMBlendShapeProxy proxy, BlendShapePreset key, float value)
+ {
+ proxy.AccumulateValue(BlendShapeKey.CreateFromPreset(key), value);
+ }
+
+ [Obsolete("Use ImmediatelySetValue")]
+ public static void SetValue(this VRMBlendShapeProxy proxy, String key, float value)
+ {
+ proxy.ImmediatelySetValue(BlendShapeKey.CreateUnknown(key), value);
+ }
+
+ [Obsolete("Use BlendShapeKey.CreateUnknown")]
+ public static void ImmediatelySetValue(this VRMBlendShapeProxy proxy, String key, float value)
+ {
+ proxy.ImmediatelySetValue(BlendShapeKey.CreateUnknown(key), value);
+ }
+
+ [Obsolete("Use BlendShapeKey.CreateUnknown")]
+ public static void AccumulateValue(this VRMBlendShapeProxy proxy, String key, float value)
+ {
+ proxy.AccumulateValue(BlendShapeKey.CreateUnknown(key), value);
+ }
+
+ [Obsolete("Use ImmediatelySetValue")]
+ public static void SetValue(this VRMBlendShapeProxy proxy, BlendShapeKey key, float value)
+ {
+ proxy.ImmediatelySetValue(key, value);
+ }
+
+ [Obsolete("Use ImmediatelySetValue or AccumulateValue")]
+ public static void SetValue(this VRMBlendShapeProxy proxy, BlendShapePreset key, float value, bool apply)
+ {
+ if (apply)
+ {
+ proxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(key), value);
+ }
+ else
+ {
+ proxy.AccumulateValue(BlendShapeKey.CreateFromPreset(key), value);
+ }
+ }
+
+ [Obsolete("Use ImmediatelySetValue or AccumulateValue")]
+ public static void SetValue(this VRMBlendShapeProxy proxy, String key, float value, bool apply)
+ {
+ if (apply)
+ {
+ proxy.ImmediatelySetValue(BlendShapeKey.CreateUnknown(key), value);
+ }
+ else
+ {
+ proxy.AccumulateValue(BlendShapeKey.CreateUnknown(key), value);
+ }
+ }
+
+ [Obsolete("Use ImmediatelySetValue or AccumulateValue")]
+ public static void SetValue(this VRMBlendShapeProxy proxy, BlendShapeKey key, float value, bool apply)
+ {
+ if (apply)
+ {
+ proxy.ImmediatelySetValue(key, value);
+ }
+ else
+ {
+ proxy.AccumulateValue(key, value);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs.meta
new file mode 100644
index 00000000..9eaaa544
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/BlendShape/VRMBlendShapeProxy.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 5b678c1df50cfb547990db24a32856da
+timeCreated: 1517467747
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs
new file mode 100644
index 00000000..53cc505b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs
@@ -0,0 +1,20 @@
+using System;
+
+
+namespace VRM
+{
+ public static class EnumUtil
+ {
+ public static T TryParseOrDefault<T>(string src, T defaultValue=default(T)) where T : struct
+ {
+ try
+ {
+ return (T)Enum.Parse(typeof(T), src, true);
+ }
+ catch (Exception)
+ {
+ return defaultValue;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs.meta
new file mode 100644
index 00000000..cc497ab3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/EnumUtil.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: da515e03d4b6ec244839077b79aad26a
+timeCreated: 1523088440
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions.meta
new file mode 100644
index 00000000..dd6ebd73
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 62d471cb6d6ebcb43b1ec282ae6cd8d0
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs
new file mode 100644
index 00000000..98a98e60
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs
@@ -0,0 +1,137 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace VRM
+{
+ public static class EnumExtensions
+ {
+ public static HumanBodyBones ToUnityBone(this VRMBone val)
+ {
+ switch (val)
+ {
+ case VRMBone.hips: return HumanBodyBones.Hips;//"hips"
+ case VRMBone.leftUpperLeg: return HumanBodyBones.LeftUpperLeg;//"leftUpperLeg";
+ case VRMBone.rightUpperLeg: return HumanBodyBones.RightUpperLeg;//"rightUpperLeg";
+ case VRMBone.leftLowerLeg: return HumanBodyBones.LeftLowerLeg;//"leftLowerLeg";
+ case VRMBone.rightLowerLeg: return HumanBodyBones.RightLowerLeg;//"rightLowerLeg";
+ case VRMBone.leftFoot: return HumanBodyBones.LeftFoot;//"leftFoot";
+ case VRMBone.rightFoot: return HumanBodyBones.RightFoot;//"rightFoot";
+ case VRMBone.spine: return HumanBodyBones.Spine;//"spine";
+ case VRMBone.chest: return HumanBodyBones.Chest;//"chest";
+ case VRMBone.neck: return HumanBodyBones.Neck;//"neck";
+ case VRMBone.head: return HumanBodyBones.Head;//"head";
+ case VRMBone.leftShoulder: return HumanBodyBones.LeftShoulder;//"leftShoulder";
+ case VRMBone.rightShoulder: return HumanBodyBones.RightShoulder;//"rightShoulder";
+ case VRMBone.leftUpperArm: return HumanBodyBones.LeftUpperArm;//"leftUpperArm";
+ case VRMBone.rightUpperArm: return HumanBodyBones.RightUpperArm;//"rightUpperArm";
+ case VRMBone.leftLowerArm: return HumanBodyBones.LeftLowerArm;//"leftLowerArm";
+ case VRMBone.rightLowerArm: return HumanBodyBones.RightLowerArm;//"rightLowerArm";
+ case VRMBone.leftHand: return HumanBodyBones.LeftHand;//"leftHand";
+ case VRMBone.rightHand: return HumanBodyBones.RightHand;//"rightHand";
+ case VRMBone.leftToes: return HumanBodyBones.LeftToes;//"leftToes";
+ case VRMBone.rightToes: return HumanBodyBones.RightToes;//"rightToes";
+ case VRMBone.leftEye: return HumanBodyBones.LeftEye;//"leftEye";
+ case VRMBone.rightEye: return HumanBodyBones.RightEye;//"rightEye";
+ case VRMBone.jaw: return HumanBodyBones.Jaw;//"jaw";
+ case VRMBone.leftThumbProximal: return HumanBodyBones.LeftThumbProximal;
+ case VRMBone.leftThumbIntermediate: return HumanBodyBones.LeftThumbIntermediate;
+ case VRMBone.leftThumbDistal: return HumanBodyBones.LeftThumbDistal;
+ case VRMBone.leftIndexProximal: return HumanBodyBones.LeftIndexProximal;
+ case VRMBone.leftIndexIntermediate: return HumanBodyBones.LeftIndexIntermediate;
+ case VRMBone.leftIndexDistal: return HumanBodyBones.LeftIndexDistal;
+ case VRMBone.leftMiddleProximal: return HumanBodyBones.LeftMiddleProximal;
+ case VRMBone.leftMiddleIntermediate: return HumanBodyBones.LeftMiddleIntermediate;
+ case VRMBone.leftMiddleDistal: return HumanBodyBones.LeftMiddleDistal;
+ case VRMBone.leftRingProximal: return HumanBodyBones.LeftRingProximal;
+ case VRMBone.leftRingIntermediate: return HumanBodyBones.LeftRingIntermediate;
+ case VRMBone.leftRingDistal: return HumanBodyBones.LeftRingDistal;
+ case VRMBone.leftLittleProximal: return HumanBodyBones.LeftLittleProximal;
+ case VRMBone.leftLittleIntermediate: return HumanBodyBones.LeftLittleIntermediate;
+ case VRMBone.leftLittleDistal: return HumanBodyBones.LeftLittleDistal;
+ case VRMBone.rightThumbProximal: return HumanBodyBones.RightThumbProximal;
+ case VRMBone.rightThumbIntermediate: return HumanBodyBones.RightThumbIntermediate;
+ case VRMBone.rightThumbDistal: return HumanBodyBones.RightThumbDistal;
+ case VRMBone.rightIndexProximal: return HumanBodyBones.RightIndexProximal;
+ case VRMBone.rightIndexIntermediate: return HumanBodyBones.RightIndexIntermediate;
+ case VRMBone.rightIndexDistal: return HumanBodyBones.RightIndexDistal;
+ case VRMBone.rightMiddleProximal: return HumanBodyBones.RightMiddleProximal;
+ case VRMBone.rightMiddleIntermediate: return HumanBodyBones.RightMiddleIntermediate;
+ case VRMBone.rightMiddleDistal: return HumanBodyBones.RightMiddleDistal;
+ case VRMBone.rightRingProximal: return HumanBodyBones.RightRingProximal;
+ case VRMBone.rightRingIntermediate: return HumanBodyBones.RightRingIntermediate;
+ case VRMBone.rightRingDistal: return HumanBodyBones.RightRingDistal;
+ case VRMBone.rightLittleProximal: return HumanBodyBones.RightLittleProximal;
+ case VRMBone.rightLittleIntermediate: return HumanBodyBones.RightLittleIntermediate;
+ case VRMBone.rightLittleDistal: return HumanBodyBones.RightLittleDistal;
+ case VRMBone.upperChest: return HumanBodyBones.UpperChest;
+ default: throw new System.InvalidOperationException();
+ }
+ }
+
+
+ public static VRMBone ToVrmBone(this HumanBodyBones val)
+ {
+ switch (val)
+ {
+ case HumanBodyBones.Hips: return VRMBone.hips;
+ case HumanBodyBones.LeftUpperLeg: return VRMBone.leftUpperLeg;
+ case HumanBodyBones.RightUpperLeg: return VRMBone.rightUpperLeg;
+ case HumanBodyBones.LeftLowerLeg: return VRMBone.leftLowerLeg;
+ case HumanBodyBones.RightLowerLeg: return VRMBone.rightLowerLeg;
+ case HumanBodyBones.LeftFoot: return VRMBone.leftFoot;
+ case HumanBodyBones.RightFoot: return VRMBone.rightFoot;
+ case HumanBodyBones.Spine: return VRMBone.spine;
+ case HumanBodyBones.Chest: return VRMBone.chest;
+ case HumanBodyBones.Neck: return VRMBone.neck;
+ case HumanBodyBones.Head: return VRMBone.head;
+ case HumanBodyBones.LeftShoulder: return VRMBone.leftShoulder;
+ case HumanBodyBones.RightShoulder: return VRMBone.rightShoulder;
+ case HumanBodyBones.LeftUpperArm: return VRMBone.leftUpperArm;
+ case HumanBodyBones.RightUpperArm: return VRMBone.rightUpperArm;
+ case HumanBodyBones.LeftLowerArm: return VRMBone.leftLowerArm;
+ case HumanBodyBones.RightLowerArm: return VRMBone.rightLowerArm;
+ case HumanBodyBones.LeftHand: return VRMBone.leftHand;
+ case HumanBodyBones.RightHand: return VRMBone.rightHand;
+ case HumanBodyBones.LeftToes: return VRMBone.leftToes;
+ case HumanBodyBones.RightToes: return VRMBone.rightToes;
+ case HumanBodyBones.LeftEye: return VRMBone.leftEye;
+ case HumanBodyBones.RightEye: return VRMBone.rightEye;
+ case HumanBodyBones.Jaw: return VRMBone.jaw;
+ case HumanBodyBones.LeftThumbProximal: return VRMBone.leftThumbProximal;
+ case HumanBodyBones.LeftThumbIntermediate: return VRMBone.leftThumbIntermediate;
+ case HumanBodyBones.LeftThumbDistal: return VRMBone.leftThumbDistal;
+ case HumanBodyBones.LeftIndexProximal: return VRMBone.leftIndexProximal;
+ case HumanBodyBones.LeftIndexIntermediate: return VRMBone.leftIndexIntermediate;
+ case HumanBodyBones.LeftIndexDistal: return VRMBone.leftIndexDistal;
+ case HumanBodyBones.LeftMiddleProximal: return VRMBone.leftMiddleProximal;
+ case HumanBodyBones.LeftMiddleIntermediate: return VRMBone.leftMiddleIntermediate;
+ case HumanBodyBones.LeftMiddleDistal: return VRMBone.leftMiddleDistal;
+ case HumanBodyBones.LeftRingProximal: return VRMBone.leftRingProximal;
+ case HumanBodyBones.LeftRingIntermediate: return VRMBone.leftRingIntermediate;
+ case HumanBodyBones.LeftRingDistal: return VRMBone.leftRingDistal;
+ case HumanBodyBones.LeftLittleProximal: return VRMBone.leftLittleProximal;
+ case HumanBodyBones.LeftLittleIntermediate: return VRMBone.leftLittleIntermediate;
+ case HumanBodyBones.LeftLittleDistal: return VRMBone.leftLittleDistal;
+ case HumanBodyBones.RightThumbProximal: return VRMBone.rightThumbProximal;
+ case HumanBodyBones.RightThumbIntermediate: return VRMBone.rightThumbIntermediate;
+ case HumanBodyBones.RightThumbDistal: return VRMBone.rightThumbDistal;
+ case HumanBodyBones.RightIndexProximal: return VRMBone.rightIndexProximal;
+ case HumanBodyBones.RightIndexIntermediate: return VRMBone.rightIndexIntermediate;
+ case HumanBodyBones.RightIndexDistal: return VRMBone.rightIndexDistal;
+ case HumanBodyBones.RightMiddleProximal: return VRMBone.rightMiddleProximal;
+ case HumanBodyBones.RightMiddleIntermediate: return VRMBone.rightMiddleIntermediate;
+ case HumanBodyBones.RightMiddleDistal: return VRMBone.rightMiddleDistal;
+ case HumanBodyBones.RightRingProximal: return VRMBone.rightRingProximal;
+ case HumanBodyBones.RightRingIntermediate: return VRMBone.rightRingIntermediate;
+ case HumanBodyBones.RightRingDistal: return VRMBone.rightRingDistal;
+ case HumanBodyBones.RightLittleProximal: return VRMBone.rightLittleProximal;
+ case HumanBodyBones.RightLittleIntermediate: return VRMBone.rightLittleIntermediate;
+ case HumanBodyBones.RightLittleDistal: return VRMBone.rightLittleDistal;
+ case HumanBodyBones.UpperChest: return VRMBone.upperChest;
+ //case HumanBodyBones.LastBone:
+ default: throw new System.InvalidOperationException();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs.meta
new file mode 100644
index 00000000..0ceb4541
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Extensions/EnumExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d5e9521d3f142254ab773f38bacd0905
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson.meta
new file mode 100644
index 00000000..28a1a013
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 5a5c5355606c9da4cb354f3ae2ae4bae
+folderAsset: yes
+timeCreated: 1519278754
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs
new file mode 100644
index 00000000..509c974d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs
@@ -0,0 +1,294 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMFirstPerson : MonoBehaviour
+ {
+ // If no layer names are set, use the default layer IDs.
+ // Otherwise use the two Unity layers called "VRMFirstPersonOnly" and "VRMThirdPersonOnly".
+ public static bool TriedSetupLayer = false;
+ public static int FIRSTPERSON_ONLY_LAYER = 9;
+ public static int THIRDPERSON_ONLY_LAYER = 10;
+
+ [SerializeField]
+ public Transform FirstPersonBone;
+
+ [SerializeField]
+ public Vector3 FirstPersonOffset;
+
+ [Serializable]
+ public struct RendererFirstPersonFlags
+ {
+ public Renderer Renderer;
+ public FirstPersonFlag FirstPersonFlag;
+ public Mesh SharedMesh
+ {
+ get
+ {
+ var renderer = Renderer as SkinnedMeshRenderer;
+ if (renderer != null)
+ {
+ return renderer.sharedMesh;
+ }
+
+ var filter = Renderer.GetComponent<MeshFilter>();
+ if (filter != null)
+ {
+ return filter.sharedMesh;
+ }
+
+ return null;
+ }
+ }
+ }
+
+ [SerializeField]
+ public List<RendererFirstPersonFlags> Renderers = new List<RendererFirstPersonFlags>();
+
+ public void CopyTo(GameObject _dst, Dictionary<Transform, Transform> map)
+ {
+ var dst = _dst.AddComponent<VRMFirstPerson>();
+ dst.FirstPersonBone = map[FirstPersonBone];
+ dst.FirstPersonOffset = FirstPersonOffset;
+ dst.Renderers = Renderers.Select(x =>
+ {
+ var renderer = map[x.Renderer.transform].GetComponent<Renderer>();
+ return new VRMFirstPerson.RendererFirstPersonFlags
+ {
+ Renderer = renderer,
+ FirstPersonFlag = x.FirstPersonFlag,
+ };
+ }).ToList();
+ }
+
+ public void SetDefault()
+ {
+ FirstPersonOffset = new Vector3(0, 0.06f, 0);
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ FirstPersonBone = animator.GetBoneTransform(HumanBodyBones.Head);
+ }
+ }
+
+ private void Reset()
+ {
+ SetDefault();
+ TraverseRenderers();
+ }
+
+ public void TraverseRenderers(VRMImporterContext context = null)
+ {
+ Renderers.Clear();
+
+ var rendererComponents = transform.GetComponentsInChildren<Renderer>();
+ foreach (var renderer in rendererComponents)
+ {
+ var flags = new RendererFirstPersonFlags
+ {
+ Renderer = renderer,
+ FirstPersonFlag = context == null
+ ? FirstPersonFlag.Auto
+ : GetFirstPersonFlag(context, renderer)
+ };
+ Renderers.Add(flags);
+ }
+ }
+
+ static FirstPersonFlag GetFirstPersonFlag(VRMImporterContext context, Renderer r)
+ {
+ var mesh = r.transform.GetSharedMesh();
+ if (mesh == null)
+ {
+ return FirstPersonFlag.Auto;
+ }
+
+ var index = context.Meshes.FindIndex(x => x.Mesh == mesh);
+ if (index == -1)
+ {
+ return FirstPersonFlag.Auto;
+ }
+
+ foreach (var x in context.GLTF.extensions.VRM.firstPerson.meshAnnotations)
+ {
+ if (x.mesh == index)
+ {
+ return CacheEnum.TryParseOrDefault<FirstPersonFlag>(x.firstPersonFlag, true);
+ }
+ }
+
+ return FirstPersonFlag.Auto;
+ }
+
+ /// <summary>
+ /// ヘッドレスモデルを作成した場合に返す
+ /// </summary>
+ Mesh CreateHeadlessModel(Renderer _renderer, Transform EraseRoot)
+ {
+ {
+ var renderer = _renderer as SkinnedMeshRenderer;
+ if (renderer != null)
+ {
+ return CreateHeadlessModelForSkinnedMeshRenderer(renderer, EraseRoot);
+ }
+ }
+
+
+ {
+ var renderer = _renderer as MeshRenderer;
+ if (renderer != null)
+ {
+ CreateHeadlessModelForMeshRenderer(renderer, EraseRoot);
+ return null;
+ }
+ }
+
+ // ここには来ない
+ return null;
+ }
+
+ public static void SetupLayers()
+ {
+ if (!TriedSetupLayer)
+ {
+ TriedSetupLayer = true;
+ int layer = LayerMask.NameToLayer("VRMFirstPersonOnly");
+ FIRSTPERSON_ONLY_LAYER = (layer == -1) ? FIRSTPERSON_ONLY_LAYER : layer;
+ layer = LayerMask.NameToLayer("VRMThirdPersonOnly");
+ THIRDPERSON_ONLY_LAYER = (layer == -1) ? THIRDPERSON_ONLY_LAYER : layer;
+ }
+ }
+
+ private static void CreateHeadlessModelForMeshRenderer(MeshRenderer renderer, Transform eraseRoot)
+ {
+ if (renderer.transform.Ancestors().Any(x => x == eraseRoot))
+ {
+ // 祖先に削除ボーンが居る
+ SetupLayers();
+ renderer.gameObject.layer = THIRDPERSON_ONLY_LAYER;
+ }
+ else
+ {
+ // 特に変更しない => 両方表示
+ }
+ }
+
+ /// <summary>
+ /// ヘッドレスモデルを作成する。
+ ///
+ /// 以下の場合は作成しない。
+ ///
+ /// * 削除対象が無い場合
+ /// * 全部削除対象の場合
+ ///
+ /// </summary>
+ private static Mesh CreateHeadlessModelForSkinnedMeshRenderer(SkinnedMeshRenderer renderer, Transform eraseRoot)
+ {
+ SetupLayers();
+ var bones = renderer.bones;
+
+ var eraseBones = bones.Select((x, i) =>
+ {
+ // 祖先に削除対象が存在するか
+ bool erase = x.Ancestors().Any(y => y == eraseRoot);
+ return new
+ {
+ i,
+ erase,
+ };
+ })
+ .Where(x => x.erase)
+ .Select(x => x.i)
+ .ToArray()
+ ;
+ if (eraseBones.Length == 0)
+ {
+ // 削除対象が存在しない
+ return null;
+ }
+
+ // 元のメッシュを三人称に変更(自分からは見えない)
+ renderer.gameObject.layer = THIRDPERSON_ONLY_LAYER;
+
+ // 削除対象のボーンに対するウェイトを保持する三角形を除外して、一人称用のモデルを複製する
+ var headlessMesh = MeshUtility.BoneMeshEraser.CreateErasedMesh(renderer.sharedMesh, eraseBones);
+ if (headlessMesh.triangles.Length == 0)
+ {
+ // 一人称用のmeshには描画すべき部分が無い(全部削除された)
+ UnityEngine.Object.Destroy(headlessMesh);
+ return null;
+ }
+
+ // 一人称用のモデルのセットアップ
+ var go = new GameObject("_headless_" + renderer.name);
+ go.layer = FIRSTPERSON_ONLY_LAYER;
+ go.transform.SetParent(renderer.transform, false);
+ var erased = go.AddComponent<SkinnedMeshRenderer>();
+ erased.sharedMesh = headlessMesh;
+ erased.sharedMaterials = renderer.sharedMaterials;
+ erased.bones = bones;
+ erased.rootBone = renderer.rootBone;
+ erased.updateWhenOffscreen = true;
+ return headlessMesh;
+ }
+
+ bool m_done;
+
+ List<Mesh> m_headlessMeshes = new List<Mesh>();
+
+ /// <summary>
+ /// 配下のモデルのレイヤー設定など
+ /// </summary>
+ public void Setup()
+ {
+ SetupLayers();
+ if (m_done) return;
+ m_done = true;
+ foreach (var x in Renderers)
+ {
+ switch (x.FirstPersonFlag)
+ {
+ case FirstPersonFlag.Auto:
+ {
+ var headlessMesh = CreateHeadlessModel(x.Renderer, FirstPersonBone);
+ if (headlessMesh != null)
+ {
+ m_headlessMeshes.Add(headlessMesh);
+ }
+ }
+ break;
+
+ case FirstPersonFlag.FirstPersonOnly:
+ x.Renderer.gameObject.layer = FIRSTPERSON_ONLY_LAYER;
+ break;
+
+ case FirstPersonFlag.ThirdPersonOnly:
+ x.Renderer.gameObject.layer = THIRDPERSON_ONLY_LAYER;
+ break;
+
+ case FirstPersonFlag.Both:
+ //x.Renderer.gameObject.layer = 0;
+ break;
+ }
+ }
+ }
+
+ void OnDestroy()
+ {
+ foreach (var mesh in m_headlessMeshes)
+ {
+ if (mesh != null)
+ {
+ // Debug.LogFormat("[VRMFirstPerson] OnDestroy: {0}", mesh);
+ UnityEngine.Object.Destroy(mesh);
+ }
+ }
+ m_headlessMeshes.Clear();
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs.meta
new file mode 100644
index 00000000..0711249b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPerson.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: dedba1309bdf12b42af2362f52eea134
+timeCreated: 1519218333
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs
new file mode 100644
index 00000000..dda06faa
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs
@@ -0,0 +1,91 @@
+#pragma warning disable 0414, 0649
+using UnityEngine;
+using System.Linq;
+using UnityEngine.UI;
+using System;
+
+namespace VRM
+{
+ /// <summary>
+ /// ファーストパーソン向けLayer検討
+ ///
+ /// * Default LayerをFirstPersonレイヤーとして使う
+ /// * 9番にThirdPerson Layerを追加する
+ ///
+ /// * FirstPersonCameraはCullingMaskでThirdPerson Layerを除外
+ /// * ThirdPersonCameraはCullingMaskでDefault Layerを除外
+ ///
+ /// * それ以外のシーンオブジェクトはDefaultLayerとThirdPersonレイヤーの両方に所属するべし
+ /// * 首無しモデルはDefault Layerのみに所属するべし
+ /// * 首有りモデルはThirdPerson Layerのみに所属するべし
+ /// * コントローラーはDefault Layerがいいかも
+ /// * 鏡もDefault Layerがいいかも(カメラごとにRenderTargetを用意するのは煩雑)
+ /// </summary>
+ public class VRMFirstPersonCameraManager : MonoBehaviour
+ {
+ [Serializable]
+ class CameraWithRawImage
+ {
+ public Camera Camera;
+ public RenderTexture Texture;
+ public RawImage Image;
+ }
+
+ /// <summary>
+ /// FirstPerson
+ /// </summary>
+ [SerializeField]
+ CameraWithRawImage m_topLeft;
+
+ /// <summary>
+ /// ThirdPerson body
+ /// </summary>
+ [SerializeField]
+ CameraWithRawImage m_topRight;
+
+ /// <summary>
+ /// ThirdPerson head
+ /// </summary>
+ [SerializeField]
+ CameraWithRawImage m_bottomRight;
+
+ [SerializeField, Header("Cameras")]
+ Camera m_firstPersonCamera;
+
+ [SerializeField]
+ Camera[] m_thirdPersonCameras;
+
+ void Reset()
+ {
+ var cameras = GameObject.FindObjectsOfType<Camera>();
+ m_firstPersonCamera = Camera.main;
+ m_thirdPersonCameras = cameras.Where(x => x != m_firstPersonCamera).ToArray();
+ }
+
+ private void Update()
+ {
+ var halfWidth = Screen.width / 2;
+ var halfHeight = Screen.height / 2;
+ SetupRenderTarget(m_topLeft, halfWidth, halfHeight);
+ SetupRenderTarget(m_topRight, halfWidth, halfHeight);
+ SetupRenderTarget(m_bottomRight, halfWidth, halfHeight);
+ }
+
+ void SetupRenderTarget(CameraWithRawImage cameraWithImage, int w, int h)
+ {
+ if (cameraWithImage.Camera == null) return;
+ if (cameraWithImage.Image == null) return;
+
+ if (cameraWithImage.Texture == null
+ || cameraWithImage.Texture.width != w
+ || cameraWithImage.Texture.height != h
+ )
+ {
+ var texture = new RenderTexture(w, h, 16);
+ cameraWithImage.Texture = texture;
+ cameraWithImage.Camera.targetTexture = texture;
+ cameraWithImage.Image.texture = texture;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs.meta
new file mode 100644
index 00000000..c781b7cf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/FirstPerson/VRMFirstPersonCameraManager.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 6b34fb2c039c3ce4881f04e476a2128f
+timeCreated: 1519220439
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format.meta
new file mode 100644
index 00000000..9f69f16c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 8dc6b68ffeda9f54494eee1cd17af615
+folderAsset: yes
+timeCreated: 1517308531
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs
new file mode 100644
index 00000000..7ed58e52
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs
@@ -0,0 +1,15 @@
+using System;
+
+
+namespace VRM
+{
+ class VRMException : Exception
+ {
+ public VRMException()
+ { }
+ public VRMException(string msg) : base(msg)
+ { }
+ public VRMException(string msg, params object[] args) : base(string.Format(msg, args))
+ { }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs.meta
new file mode 100644
index 00000000..1ce57a3f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMException.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c34ca281dd113124cbe3d277d0955291
+timeCreated: 1519982614
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs
new file mode 100644
index 00000000..e35cf298
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs
@@ -0,0 +1,205 @@
+using System;
+using System.Linq;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMExporter : gltfExporter
+ {
+ protected override IMaterialExporter CreateMaterialExporter()
+ {
+ return new VRMMaterialExporter();
+ }
+
+ public static glTF Export(MeshExportSettings configuration, GameObject go)
+ {
+ var gltf = new glTF();
+ using (var exporter = new VRMExporter(gltf))
+ {
+ exporter.Prepare(go);
+ exporter.Export(configuration);
+ }
+ return gltf;
+ }
+
+ public VRMExporter(glTF gltf) : base(gltf)
+ {
+ gltf.extensionsUsed.Add(glTF_VRM_extensions.ExtensionName);
+ gltf.extensions.VRM = new glTF_VRM_extensions();
+ }
+
+ public override void Export(MeshExportSettings configuration)
+ {
+ base.Export(configuration);
+
+ // avatar
+ var animator = Copy.GetComponent<Animator>();
+ if (animator != null)
+ {
+ var humanoid = Copy.GetComponent<VRMHumanoidDescription>();
+ UniHumanoid.AvatarDescription description = null;
+ var nodes = Copy.transform.Traverse().Skip(1).ToList();
+ {
+ var isCreated = false;
+ if (humanoid != null)
+ {
+ description = humanoid.GetDescription(out isCreated);
+ }
+
+ if (description != null)
+ {
+ // use description
+ glTF.extensions.VRM.humanoid.Apply(description, nodes);
+ }
+
+ if (isCreated)
+ {
+ GameObject.DestroyImmediate(description);
+ }
+ }
+
+ {
+ // set humanoid bone mapping
+ var avatar = animator.avatar;
+ foreach (HumanBodyBones key in Enum.GetValues(typeof(HumanBodyBones)))
+ {
+ if (key == HumanBodyBones.LastBone)
+ {
+ break;
+ }
+
+ var transform = animator.GetBoneTransform(key);
+ if (transform != null)
+ {
+ glTF.extensions.VRM.humanoid.SetNodeIndex(key, nodes.IndexOf(transform));
+ }
+ }
+ }
+ }
+
+ // morph
+ var master = Copy.GetComponent<VRMBlendShapeProxy>();
+ if (master != null)
+ {
+ var avatar = master.BlendShapeAvatar;
+ if (avatar != null)
+ {
+ foreach (var x in avatar.Clips)
+ {
+ glTF.extensions.VRM.blendShapeMaster.Add(x, this);
+ }
+ }
+ }
+
+ // secondary
+ VRMSpringUtility.ExportSecondary(Copy.transform, Nodes,
+ x => glTF.extensions.VRM.secondaryAnimation.colliderGroups.Add(x),
+ x => glTF.extensions.VRM.secondaryAnimation.boneGroups.Add(x)
+ );
+
+#pragma warning disable 0618
+ // meta(obsolete)
+ {
+ var meta = Copy.GetComponent<VRMMetaInformation>();
+ if (meta != null)
+ {
+ glTF.extensions.VRM.meta.author = meta.Author;
+ glTF.extensions.VRM.meta.contactInformation = meta.ContactInformation;
+ glTF.extensions.VRM.meta.title = meta.Title;
+ if (meta.Thumbnail != null)
+ {
+ glTF.extensions.VRM.meta.texture = TextureIO.ExportTexture(glTF, glTF.buffers.Count - 1, meta.Thumbnail, glTFTextureTypes.Unknown);
+ }
+
+ glTF.extensions.VRM.meta.licenseType = meta.LicenseType;
+ glTF.extensions.VRM.meta.otherLicenseUrl = meta.OtherLicenseUrl;
+ glTF.extensions.VRM.meta.reference = meta.Reference;
+ }
+ }
+#pragma warning restore 0618
+
+ // meta
+ {
+ var _meta = Copy.GetComponent<VRMMeta>();
+ if (_meta != null && _meta.Meta != null)
+ {
+ var meta = _meta.Meta;
+
+ // info
+ glTF.extensions.VRM.meta.version = meta.Version;
+ glTF.extensions.VRM.meta.author = meta.Author;
+ glTF.extensions.VRM.meta.contactInformation = meta.ContactInformation;
+ glTF.extensions.VRM.meta.reference = meta.Reference;
+ glTF.extensions.VRM.meta.title = meta.Title;
+ if (meta.Thumbnail != null)
+ {
+ glTF.extensions.VRM.meta.texture = TextureIO.ExportTexture(glTF, glTF.buffers.Count - 1, meta.Thumbnail, glTFTextureTypes.Unknown);
+ }
+
+ // ussage permission
+ glTF.extensions.VRM.meta.allowedUser = meta.AllowedUser;
+ glTF.extensions.VRM.meta.violentUssage = meta.ViolentUssage;
+ glTF.extensions.VRM.meta.sexualUssage = meta.SexualUssage;
+ glTF.extensions.VRM.meta.commercialUssage = meta.CommercialUssage;
+ glTF.extensions.VRM.meta.otherPermissionUrl = meta.OtherPermissionUrl;
+
+ // distribution license
+ glTF.extensions.VRM.meta.licenseType = meta.LicenseType;
+ if (meta.LicenseType == LicenseType.Other)
+ {
+ glTF.extensions.VRM.meta.otherLicenseUrl = meta.OtherLicenseUrl;
+ }
+ }
+ }
+
+ // firstPerson
+ var firstPerson = Copy.GetComponent<VRMFirstPerson>();
+ if (firstPerson != null)
+ {
+ if (firstPerson.FirstPersonBone != null)
+ {
+ glTF.extensions.VRM.firstPerson.firstPersonBone = Nodes.IndexOf(firstPerson.FirstPersonBone);
+ glTF.extensions.VRM.firstPerson.firstPersonBoneOffset = firstPerson.FirstPersonOffset;
+ glTF.extensions.VRM.firstPerson.meshAnnotations = firstPerson.Renderers.Select(x => new glTF_VRM_MeshAnnotation
+ {
+ mesh = Meshes.IndexOf(x.SharedMesh),
+ firstPersonFlag = x.FirstPersonFlag.ToString(),
+ }).ToList();
+ }
+
+ // lookAt
+ {
+ var lookAtHead = Copy.GetComponent<VRMLookAtHead>();
+ if (lookAtHead != null)
+ {
+ var boneApplyer = Copy.GetComponent<VRMLookAtBoneApplyer>();
+ var blendShapeApplyer = Copy.GetComponent<VRMLookAtBlendShapeApplyer>();
+ if (boneApplyer != null)
+ {
+ glTF.extensions.VRM.firstPerson.lookAtType = LookAtType.Bone;
+ glTF.extensions.VRM.firstPerson.lookAtHorizontalInner.Apply(boneApplyer.HorizontalInner);
+ glTF.extensions.VRM.firstPerson.lookAtHorizontalOuter.Apply(boneApplyer.HorizontalOuter);
+ glTF.extensions.VRM.firstPerson.lookAtVerticalDown.Apply(boneApplyer.VerticalDown);
+ glTF.extensions.VRM.firstPerson.lookAtVerticalUp.Apply(boneApplyer.VerticalUp);
+ }
+ else if (blendShapeApplyer != null)
+ {
+ glTF.extensions.VRM.firstPerson.lookAtType = LookAtType.BlendShape;
+ glTF.extensions.VRM.firstPerson.lookAtHorizontalOuter.Apply(blendShapeApplyer.Horizontal);
+ glTF.extensions.VRM.firstPerson.lookAtVerticalDown.Apply(blendShapeApplyer.VerticalDown);
+ glTF.extensions.VRM.firstPerson.lookAtVerticalUp.Apply(blendShapeApplyer.VerticalUp);
+ }
+ }
+ }
+ }
+
+ // materials
+ foreach (var m in Materials)
+ {
+ glTF.extensions.VRM.materialProperties.Add(VRMMaterialExporter.CreateFromMaterial(m, TextureManager.Textures));
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs.meta
new file mode 100644
index 00000000..f286ab34
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMExporter.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 73f9ea5f415aa1d449d6cd63aeaccb67
+timeCreated: 1516612766
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs
new file mode 100644
index 00000000..6e50945e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using UniGLTF;
+using UniJSON;
+
+namespace UniGLTF
+{
+ public partial class glTF_extensions : ExtensionsBase<glTF_extensions>
+ {
+ public VRM.glTF_VRM_extensions VRM;
+
+ [JsonSerializeMembers]
+ void VRMSerializeMembers(GLTFJsonFormatter f)
+ {
+ if (VRM != null)
+ {
+ f.Key("VRM"); f.GLTFValue(VRM);
+ }
+ }
+ }
+}
+
+
+namespace VRM
+{
+ [Serializable]
+ [JsonSchema(Title = "vrm", Description = @"
+VRM extension is for 3d humanoid avatars (and models) in VR applications.
+")]
+ public class glTF_VRM_extensions : JsonSerializableBase
+ {
+ public static string ExtensionName
+ {
+ get
+ {
+ return "VRM";
+ }
+ }
+
+ [JsonSchema(Description = @"Version of exporter that vrm created. " + VRMVersion.VRM_VERSION)]
+ public string exporterVersion = "UniVRM-" + VRMVersion.VERSION;
+
+ [JsonSchema(Description = @"Version of VRM specification. " + VRMSpecVersion.VERSION)]
+ public string specVersion = VRMSpecVersion.Version;
+
+ public glTF_VRM_Meta meta = new glTF_VRM_Meta();
+ public glTF_VRM_Humanoid humanoid = new glTF_VRM_Humanoid();
+ public glTF_VRM_Firstperson firstPerson = new glTF_VRM_Firstperson();
+ public glTF_VRM_BlendShapeMaster blendShapeMaster = new glTF_VRM_BlendShapeMaster();
+ public glTF_VRM_SecondaryAnimation secondaryAnimation = new glTF_VRM_SecondaryAnimation();
+ public List<glTF_VRM_Material> materialProperties = new List<glTF_VRM_Material>();
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => exporterVersion);
+ f.KeyValue(() => specVersion);
+ f.Key("meta"); f.GLTFValue(meta);
+ f.Key("humanoid"); f.GLTFValue(humanoid);
+ f.Key("firstPerson"); f.GLTFValue(firstPerson);
+ f.Key("blendShapeMaster"); f.GLTFValue(blendShapeMaster);
+ f.Key("secondaryAnimation"); f.GLTFValue(secondaryAnimation);
+ f.Key("materialProperties"); f.GLTFValue(materialProperties);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs.meta
new file mode 100644
index 00000000..ae2eaf1f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMFormat.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 20eca00211c61d047b586f852b818b8f
+timeCreated: 1517308526
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs
new file mode 100644
index 00000000..863da42c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs
@@ -0,0 +1,116 @@
+using System;
+using System.IO;
+using UniGLTF;
+using UnityEngine;
+#if ((NET_4_6 || NET_STANDARD_2_0) && UNITY_2017_1_OR_NEWER)
+using System.Threading.Tasks;
+#endif
+
+
+namespace VRM
+{
+ public static class VRMImporter
+ {
+ [Obsolete("use VRMImporterContext.Load(path)")]
+ public static GameObject LoadFromPath(string path)
+ {
+ var context = new VRMImporterContext();
+ context.Parse(path, File.ReadAllBytes(path));
+ context.Load();
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ return context.Root;
+ }
+
+ [Obsolete("use VRMImporterContext.Load(bytes)")]
+ public static GameObject LoadFromBytes(Byte[] bytes)
+ {
+ var context = new VRMImporterContext();
+ context.ParseGlb(bytes);
+ context.Load();
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ return context.Root;
+ }
+
+ [Obsolete("use VRMImporterContext.Load()")]
+ public static void LoadFromBytes(VRMImporterContext context)
+ {
+ context.Load();
+ context.ShowMeshes();
+ context.EnableUpdateWhenOffscreen();
+ }
+
+ #region LoadVrmAsync
+ [Obsolete("use VRMImporterContext.LoadAsync")]
+ public static void LoadVrmAsync(string path, Action<GameObject> onLoaded, Action<Exception> onError = null, bool show = true)
+ {
+ LoadVrmAsync(File.ReadAllBytes(path), onLoaded, onError, show);
+ }
+
+ [Obsolete("use VRMImporterContext.LoadAsync")]
+ public static void LoadVrmAsync(Byte[] bytes, Action<GameObject> onLoaded, Action<Exception> onError = null, bool show = true)
+ {
+ var context = new VRMImporterContext();
+ using (context.MeasureTime("ParseGlb"))
+ {
+ context.ParseGlb(bytes);
+ }
+ context.LoadAsync(_ =>
+ {
+ if (show)
+ {
+ context.ShowMeshes();
+ }
+ onLoaded(context.Root);
+ },
+ onError);
+ }
+
+ [Obsolete("use VRMImporterContext.LoadAsync")]
+ public static void LoadVrmAsync(VRMImporterContext context, Action<GameObject> onLoaded, Action<Exception> onError = null, bool show = true)
+ {
+ context.LoadAsync(_ =>
+ {
+ if (show)
+ {
+ context.ShowMeshes();
+ }
+ onLoaded(context.Root);
+ },
+ onError);
+ }
+ #endregion
+
+#if ((NET_4_6 || NET_STANDARD_2_0) && UNITY_2017_1_OR_NEWER && !UNITY_WEBGL)
+
+ [Obsolete("use VRMImporterContext.LoadAsync()")]
+ public static Task<GameObject> LoadVrmAsync(string path, bool show = true)
+ {
+ var context = new VRMImporterContext();
+ context.ParseGlb(File.ReadAllBytes(path));
+ return LoadVrmAsync(context, show);
+ }
+
+ [Obsolete("use VRMImporterContext.LoadAsync()")]
+ public static Task<GameObject> LoadVrmAsync(Byte[] bytes, bool show = true)
+ {
+ var context = new VRMImporterContext();
+ context.ParseGlb(bytes);
+ return LoadVrmAsync(context, show);
+ }
+
+ [Obsolete("use VRMImporterContext.LoadAsync()")]
+ public async static Task<GameObject> LoadVrmAsync(VRMImporterContext ctx, bool show = true)
+ {
+ await ctx.LoadAsyncTask();
+ if (show)
+ {
+ ctx.ShowMeshes();
+ }
+ return ctx.Root;
+ }
+
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs.meta
new file mode 100644
index 00000000..e6ca9d7b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporter.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 7ec67bcfca2bdcc4484bcbdd1efe52f9
+timeCreated: 1517153624
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs
new file mode 100644
index 00000000..a1362954
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs
@@ -0,0 +1,404 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UniGLTF;
+using UnityEngine;
+using System.IO;
+using System.Collections;
+
+namespace VRM
+{
+ public class VRMImporterContext : ImporterContext
+ {
+ const string HUMANOID_KEY = "humanoid";
+ const string MATERIAL_KEY = "materialProperties";
+
+ public VRMImporterContext()
+ {
+ }
+
+ public override void Parse(string path, byte[] bytes)
+ {
+ var ext = Path.GetExtension(path).ToLower();
+ switch (ext)
+ {
+ case ".vrm":
+ ParseGlb(bytes);
+ break;
+
+ default:
+ base.Parse(path, bytes);
+ break;
+ }
+ }
+
+ public override void ParseJson(string json, IStorage storage)
+ {
+ base.ParseJson(json, storage);
+ SetMaterialImporter(new VRMMaterialImporter(this, glTF_VRM_Material.Parse(Json)));
+ }
+
+ #region OnLoad
+ protected override IEnumerator OnLoadModel()
+ {
+ Root.name = "VRM";
+
+ using (MeasureTime("VRM LoadMeta"))
+ {
+ LoadMeta();
+ }
+ yield return null;
+
+ using (MeasureTime("VRM LoadHumanoid"))
+ {
+ LoadHumanoid();
+ }
+ yield return null;
+
+ using (MeasureTime("VRM LoadBlendShapeMaster"))
+ {
+ LoadBlendShapeMaster();
+ }
+ yield return null;
+
+ using (MeasureTime("VRM LoadSecondary"))
+ {
+ VRMSpringUtility.LoadSecondary(Root.transform, Nodes,
+ GLTF.extensions.VRM.secondaryAnimation);
+ }
+ yield return null;
+
+ using (MeasureTime("VRM LoadFirstPerson"))
+ {
+ LoadFirstPerson();
+ }
+ }
+
+ void LoadMeta()
+ {
+ var meta = ReadMeta();
+ if (meta.Thumbnail == null)
+ {
+ /*
+ // 作る
+ var lookAt = Root.GetComponent<VRMLookAtHead>();
+ var thumbnail = lookAt.CreateThumbnail();
+ thumbnail.name = "thumbnail";
+ meta.Thumbnail = thumbnail;
+ Textures.Add(new TextureItem(thumbnail));
+ */
+ }
+ var _meta = Root.AddComponent<VRMMeta>();
+ _meta.Meta = meta;
+ Meta = meta;
+ }
+
+ void LoadFirstPerson()
+ {
+ var firstPerson = Root.AddComponent<VRMFirstPerson>();
+
+ var gltfFirstPerson = GLTF.extensions.VRM.firstPerson;
+ if (gltfFirstPerson.firstPersonBone != -1)
+ {
+ firstPerson.FirstPersonBone = Nodes[gltfFirstPerson.firstPersonBone];
+ firstPerson.FirstPersonOffset = gltfFirstPerson.firstPersonBoneOffset;
+ }
+ else
+ {
+ // fallback
+ firstPerson.SetDefault();
+ firstPerson.FirstPersonOffset = gltfFirstPerson.firstPersonBoneOffset;
+ }
+ firstPerson.TraverseRenderers(this);
+
+ // LookAt
+ var lookAtHead = Root.AddComponent<VRMLookAtHead>();
+ lookAtHead.OnImported(this);
+ }
+
+ void LoadBlendShapeMaster()
+ {
+ BlendShapeAvatar = ScriptableObject.CreateInstance<BlendShapeAvatar>();
+ BlendShapeAvatar.name = "BlendShape";
+
+ var transformMeshTable = new Dictionary<Mesh, Transform>();
+ foreach (var transform in Root.transform.Traverse())
+ {
+ if (transform.GetSharedMesh() != null)
+ {
+ transformMeshTable.Add(transform.GetSharedMesh(), transform);
+ }
+ }
+
+ var blendShapeList = GLTF.extensions.VRM.blendShapeMaster.blendShapeGroups;
+ if (blendShapeList != null && blendShapeList.Count > 0)
+ {
+ foreach (var x in blendShapeList)
+ {
+ BlendShapeAvatar.Clips.Add(LoadBlendShapeBind(x, transformMeshTable));
+ }
+ }
+
+ var proxy = Root.AddComponent<VRMBlendShapeProxy>();
+ BlendShapeAvatar.CreateDefaultPreset();
+ proxy.BlendShapeAvatar = BlendShapeAvatar;
+ }
+
+ BlendShapeClip LoadBlendShapeBind(glTF_VRM_BlendShapeGroup group, Dictionary<Mesh, Transform> transformMeshTable)
+ {
+ var asset = ScriptableObject.CreateInstance<BlendShapeClip>();
+ var groupName = group.name;
+ var prefix = "BlendShape.";
+ while (groupName.StartsWith(prefix))
+ {
+ groupName = groupName.Substring(prefix.Length);
+ }
+ asset.name = "BlendShape." + groupName;
+
+ if (group != null)
+ {
+ asset.BlendShapeName = groupName;
+ asset.Preset = CacheEnum.TryParseOrDefault<BlendShapePreset>(group.presetName, true);
+ asset.IsBinary = group.isBinary;
+ if (asset.Preset == BlendShapePreset.Unknown)
+ {
+ // fallback
+ asset.Preset = CacheEnum.TryParseOrDefault<BlendShapePreset>(group.name, true);
+ }
+ asset.Values = group.binds.Select(x =>
+ {
+ var mesh = Meshes[x.mesh].Mesh;
+ var node = transformMeshTable[mesh];
+ var relativePath = UniGLTF.UnityExtensions.RelativePathFrom(node, Root.transform);
+ return new BlendShapeBinding
+ {
+ RelativePath = relativePath,
+ Index = x.index,
+ Weight = x.weight,
+ };
+ })
+ .ToArray();
+ asset.MaterialValues = group.materialValues.Select(x =>
+ {
+ var value = new Vector4();
+ for (int i = 0; i < x.targetValue.Length; ++i)
+ {
+ switch (i)
+ {
+ case 0: value.x = x.targetValue[0]; break;
+ case 1: value.y = x.targetValue[1]; break;
+ case 2: value.z = x.targetValue[2]; break;
+ case 3: value.w = x.targetValue[3]; break;
+ }
+ }
+
+ var material = GetMaterials().FirstOrDefault(y => y.name == x.materialName);
+ var propertyName = x.propertyName;
+ if (x.propertyName.EndsWith("_ST_S")
+ || x.propertyName.EndsWith("_ST_T"))
+ {
+ propertyName = x.propertyName.Substring(0, x.propertyName.Length - 2);
+ }
+
+ var binding = default(MaterialValueBinding?);
+
+ if (material != null)
+ {
+ try
+ {
+ binding = new MaterialValueBinding
+ {
+ MaterialName = x.materialName,
+ ValueName = x.propertyName,
+ TargetValue = value,
+ BaseValue = material.GetColor(propertyName),
+ };
+ }
+ catch (Exception)
+ {
+ // do nothing
+ }
+ }
+
+ return binding;
+ })
+ .Where(x => x.HasValue)
+ .Select(x => x.Value)
+ .ToArray();
+ }
+
+ return asset;
+ }
+
+ static String ToHumanBoneName(HumanBodyBones b)
+ {
+ foreach (var x in HumanTrait.BoneName)
+ {
+ if (x.Replace(" ", "") == b.ToString())
+ {
+ return x;
+ }
+ }
+
+ throw new KeyNotFoundException();
+ }
+
+ static SkeletonBone ToSkeletonBone(Transform t)
+ {
+ var sb = new SkeletonBone();
+ sb.name = t.name;
+ sb.position = t.localPosition;
+ sb.rotation = t.localRotation;
+ sb.scale = t.localScale;
+ return sb;
+ }
+
+ private void LoadHumanoid()
+ {
+ AvatarDescription = GLTF.extensions.VRM.humanoid.ToDescription(Nodes);
+ AvatarDescription.name = "AvatarDescription";
+ HumanoidAvatar = AvatarDescription.CreateAvatar(Root.transform);
+ if (!HumanoidAvatar.isValid || !HumanoidAvatar.isHuman)
+ {
+ throw new Exception("fail to create avatar");
+ }
+
+ HumanoidAvatar.name = "VrmAvatar";
+
+ var humanoid = Root.AddComponent<VRMHumanoidDescription>();
+ humanoid.Avatar = HumanoidAvatar;
+ humanoid.Description = AvatarDescription;
+
+ var animator = Root.GetComponent<Animator>();
+ if (animator == null)
+ {
+ animator = Root.AddComponent<Animator>();
+ }
+ animator.avatar = HumanoidAvatar;
+ }
+ #endregion
+
+ public UniHumanoid.AvatarDescription AvatarDescription;
+ public Avatar HumanoidAvatar;
+ public BlendShapeAvatar BlendShapeAvatar;
+ public VRMMetaObject Meta;
+
+ public VRMMetaObject ReadMeta(bool createThumbnail = false)
+ {
+ var meta = ScriptableObject.CreateInstance<VRMMetaObject>();
+ meta.name = "Meta";
+ meta.ExporterVersion = GLTF.extensions.VRM.exporterVersion;
+
+ var gltfMeta = GLTF.extensions.VRM.meta;
+ meta.Version = gltfMeta.version; // model version
+ meta.Author = gltfMeta.author;
+ meta.ContactInformation = gltfMeta.contactInformation;
+ meta.Reference = gltfMeta.reference;
+ meta.Title = gltfMeta.title;
+
+ var thumbnail = GetTexture(gltfMeta.texture);
+ if (thumbnail != null)
+ {
+ // ロード済み
+ meta.Thumbnail = thumbnail.Texture;
+ }
+ else if (createThumbnail)
+ {
+ // 作成する(先行ロード用)
+ if (gltfMeta.texture >= 0 && gltfMeta.texture < GLTF.textures.Count)
+ {
+ var t = new TextureItem(gltfMeta.texture, CreateTextureLoader(gltfMeta.texture));
+ t.Process(GLTF, Storage);
+ meta.Thumbnail = t.Texture;
+ }
+ }
+
+ meta.AllowedUser = gltfMeta.allowedUser;
+ meta.ViolentUssage = gltfMeta.violentUssage;
+ meta.SexualUssage = gltfMeta.sexualUssage;
+ meta.CommercialUssage = gltfMeta.commercialUssage;
+ meta.OtherPermissionUrl = gltfMeta.otherPermissionUrl;
+
+ meta.LicenseType = gltfMeta.licenseType;
+ meta.OtherLicenseUrl = gltfMeta.otherLicenseUrl;
+
+ return meta;
+ }
+
+ protected override IEnumerable<UnityEngine.Object> ObjectsForSubAsset()
+ {
+ foreach (var x in base.ObjectsForSubAsset())
+ {
+ yield return x;
+ }
+
+ yield return AvatarDescription;
+ yield return HumanoidAvatar;
+
+ if (BlendShapeAvatar != null && BlendShapeAvatar.Clips != null)
+ {
+ foreach (var x in BlendShapeAvatar.Clips)
+ {
+ yield return x;
+ }
+ }
+ yield return BlendShapeAvatar;
+
+ yield return Meta;
+ }
+
+#if UNITY_EDITOR
+ public override bool AvoidOverwriteAndLoad(UnityPath assetPath, UnityEngine.Object o)
+ {
+ if (o is BlendShapeAvatar)
+ {
+ var loaded = assetPath.LoadAsset<BlendShapeAvatar>();
+ var proxy = Root.GetComponent<VRMBlendShapeProxy>();
+ proxy.BlendShapeAvatar = loaded;
+
+ return true;
+ }
+
+ if (o is BlendShapeClip)
+ {
+ return true;
+ }
+
+ return base.AvoidOverwriteAndLoad(assetPath, o);
+ }
+
+ protected override UnityPath GetAssetPath(UnityPath prefabPath, UnityEngine.Object o)
+ {
+ if (o is BlendShapeAvatar
+ || o is BlendShapeClip)
+ {
+ var dir = prefabPath.GetAssetFolder(".BlendShapes");
+ var assetPath = dir.Child(o.name.EscapeFilePath() + ".asset");
+ return assetPath;
+ }
+ else if (o is Avatar)
+ {
+ var dir = prefabPath.GetAssetFolder(".Avatar");
+ var assetPath = dir.Child(o.name.EscapeFilePath() + ".asset");
+ return assetPath;
+ }
+ else if (o is VRMMetaObject)
+ {
+ var dir = prefabPath.GetAssetFolder(".MetaObject");
+ var assetPath = dir.Child(o.name.EscapeFilePath() + ".asset");
+ return assetPath;
+ }
+ else if (o is UniHumanoid.AvatarDescription)
+ {
+ var dir = prefabPath.GetAssetFolder(".AvatarDescription");
+ var assetPath = dir.Child(o.name.EscapeFilePath() + ".asset");
+ return assetPath;
+ }
+ else
+ {
+ return base.GetAssetPath(prefabPath, o);
+ }
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs.meta
new file mode 100644
index 00000000..d3dde769
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3299c9bf57c48cc46a0bcd96b1394f18
+timeCreated: 1521446485
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs
new file mode 100644
index 00000000..9878528f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs
@@ -0,0 +1,230 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UniGLTF.ShaderPropExporter;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMMaterialExporter : MaterialExporter
+ {
+ public static bool UseUnlit(string shaderName)
+ {
+ switch (shaderName)
+ {
+ case "Unlit/Color":
+ case "Unlit/Texture":
+ case "Unlit/Transparent":
+ case "Unlit/Transparent Cutout":
+ case "UniGLTF/UniUnlit":
+ case "VRM/UnlitTexture":
+ case "VRM/UnlitTransparent":
+ case "VRM/UnlitCutout":
+ return true;
+ }
+ return false;
+ }
+
+ protected override glTFMaterial CreateMaterial(Material m)
+ {
+ switch (m.shader.name)
+ {
+ case "VRM/UnlitTexture":
+ return Export_VRMUnlitTexture(m);
+
+ case "VRM/UnlitTransparent":
+ return Export_VRMUnlitTransparent(m);
+
+ case "VRM/UnlitCutout":
+ return Export_VRMUnlitCutout(m);
+
+ case "VRM/UnlitTransparentZWrite":
+ return Export_VRMUnlitTransparentZWrite(m);
+
+ case "VRM/MToon":
+ return Export_VRMMToon(m);
+
+ default:
+ return base.CreateMaterial(m);
+ }
+ }
+
+ static glTFMaterial Export_VRMUnlitTexture(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = "OPAQUE";
+ return material;
+ }
+ static glTFMaterial Export_VRMUnlitTransparent(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = "BLEND";
+ return material;
+ }
+ static glTFMaterial Export_VRMUnlitCutout(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = "MASK";
+ return material;
+ }
+ static glTFMaterial Export_VRMUnlitTransparentZWrite(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+ material.alphaMode = "BLEND";
+ return material;
+ }
+
+ static glTFMaterial Export_VRMMToon(Material m)
+ {
+ var material = glTF_KHR_materials_unlit.CreateDefault();
+
+ switch (m.GetTag("RenderType", true))
+ {
+ case "Transparent":
+ material.alphaMode = "BLEND";
+ break;
+
+ case "TransparentCutout":
+ material.alphaMode = "MASK";
+ material.alphaCutoff = m.GetFloat("_Cutoff");
+ break;
+
+ default:
+ material.alphaMode = "OPAQUE";
+ break;
+ }
+
+ switch ((int)m.GetFloat("_CullMode"))
+ {
+ case 0:
+ material.doubleSided = true;
+ break;
+
+ case 1:
+ Debug.LogWarning("ignore cull front");
+ break;
+
+ case 2:
+ // cull back
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+
+ return material;
+ }
+
+ #region CreateFromMaterial
+ public static readonly string[] VRMExtensionShaders = new string[]
+ {
+ "VRM/UnlitTransparentZWrite",
+ "VRM/MToon"
+ };
+
+ static readonly string[] TAGS = new string[]{
+ "RenderType",
+ // "Queue",
+ };
+
+ public static glTF_VRM_Material CreateFromMaterial(Material m, List<Texture> textures)
+ {
+ var material = new glTF_VRM_Material
+ {
+ name = m.name,
+ shader = m.shader.name,
+ renderQueue = m.renderQueue,
+ };
+
+ if (!VRMExtensionShaders.Contains(m.shader.name))
+ {
+ material.shader = glTF_VRM_Material.VRM_USE_GLTFSHADER;
+ return material;
+ }
+
+ var prop = PreShaderPropExporter.GetPropsForSupportedShader(m.shader.name);
+ if (prop == null)
+ {
+ Debug.LogWarningFormat("Fail to export shader: {0}", m.shader.name);
+ }
+ else
+ {
+ foreach (var keyword in m.shaderKeywords)
+ {
+ material.keywordMap.Add(keyword, m.IsKeywordEnabled(keyword));
+ }
+
+ // get properties
+ //material.SetProp(prop);
+ foreach (var kv in prop.Properties)
+ {
+ switch (kv.ShaderPropertyType)
+ {
+ case ShaderPropertyType.Color:
+ {
+ var value = m.GetColor(kv.Key).ToArray();
+ material.vectorProperties.Add(kv.Key, value);
+ }
+ break;
+
+ case ShaderPropertyType.Range:
+ case ShaderPropertyType.Float:
+ {
+ var value = m.GetFloat(kv.Key);
+ material.floatProperties.Add(kv.Key, value);
+ }
+ break;
+
+ case ShaderPropertyType.TexEnv:
+ {
+ var texture = m.GetTexture(kv.Key);
+ if (texture != null)
+ {
+ var value = textures.IndexOf(texture);
+ if (value == -1)
+ {
+ Debug.LogFormat("not found {0}", texture.name);
+ }
+ else
+ {
+ material.textureProperties.Add(kv.Key, value);
+ }
+ }
+
+ // offset & scaling
+ var offset = m.GetTextureOffset(kv.Key);
+ var scaling = m.GetTextureScale(kv.Key);
+ material.vectorProperties.Add(kv.Key,
+ new float[] { offset.x, offset.y, scaling.x, scaling.y });
+ }
+ break;
+
+ case ShaderPropertyType.Vector:
+ {
+ var value = m.GetVector(kv.Key).ToArray();
+ material.vectorProperties.Add(kv.Key, value);
+ }
+ break;
+
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ foreach (var tag in TAGS)
+ {
+ var value = m.GetTag(tag, false);
+ if (!String.IsNullOrEmpty(value))
+ {
+ material.tagMap.Add(tag, value);
+ }
+ }
+
+ return material;
+ }
+ #endregion
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs.meta
new file mode 100644
index 00000000..fda7bf8d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialExporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d2c64f4ed81bb144b90cca5260272ecf
+timeCreated: 1534510965
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs
new file mode 100644
index 00000000..af08ab04
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs
@@ -0,0 +1,124 @@
+using System.Collections.Generic;
+using UniGLTF;
+using UnityEngine;
+using System.Linq;
+using System;
+
+namespace VRM
+{
+ public class VRMMaterialImporter : MaterialImporter
+ {
+ List<glTF_VRM_Material> m_materials;
+ public VRMMaterialImporter(ImporterContext context, List<glTF_VRM_Material> materials) : base(new ShaderStore(context), (int index) => context.GetTexture(index))
+ {
+ m_materials = materials;
+ }
+
+ static string[] VRM_SHADER_NAMES =
+ {
+ "Standard",
+ "VRM/MToon",
+ "UniGLTF/UniUnlit",
+
+ "VRM/UnlitTexture",
+ "VRM/UnlitCutout",
+ "VRM/UnlitTransparent",
+ "VRM/UnlitTransparentZWrite",
+ };
+
+ public override Material CreateMaterial(int i, glTFMaterial src, bool hasVertexColor)
+ {
+ if(i==0 && m_materials.Count == 0)
+ {
+ // dummy
+ return new Material(Shader.Find("Standard"));
+ }
+
+ var item = m_materials[i];
+ var shaderName = item.shader;
+ var shader = Shader.Find(shaderName);
+ if (shader == null)
+ {
+ //
+ // no shader
+ //
+ if (VRM_SHADER_NAMES.Contains(shaderName))
+ {
+ Debug.LogErrorFormat("shader {0} not found. set Assets/VRM/Shaders/VRMShaders to Edit - project setting - Graphics - preloaded shaders", shaderName);
+ }
+ else
+ {
+ Debug.LogWarningFormat("unknown shader {0}.", shaderName);
+ }
+ return base.CreateMaterial(i, src, hasVertexColor);
+ }
+
+ //
+ // restore VRM material
+ //
+ var material = new Material(shader);
+ material.name = item.name;
+ material.renderQueue = item.renderQueue;
+
+ foreach (var kv in item.floatProperties)
+ {
+ material.SetFloat(kv.Key, kv.Value);
+ }
+ foreach (var kv in item.vectorProperties)
+ {
+ if (item.textureProperties.ContainsKey(kv.Key))
+ {
+ // texture offset & scale
+ material.SetTextureOffset(kv.Key, new Vector2(kv.Value[0], kv.Value[1]));
+ material.SetTextureScale(kv.Key, new Vector2(kv.Value[2], kv.Value[3]));
+ }
+ else
+ {
+ // vector4
+ var v = new Vector4(kv.Value[0], kv.Value[1], kv.Value[2], kv.Value[3]);
+ material.SetVector(kv.Key, v);
+ }
+ }
+ foreach (var kv in item.textureProperties)
+ {
+ var texture = base.GetTextureFunc(kv.Value);
+ if (texture != null)
+ {
+ var converted = texture.ConvertTexture(kv.Key);
+ if (converted != null)
+ {
+ material.SetTexture(kv.Key, converted);
+ }
+ else
+ {
+ material.SetTexture(kv.Key, texture.Texture);
+ }
+ }
+ }
+ foreach (var kv in item.keywordMap)
+ {
+ if (kv.Value)
+ {
+ material.EnableKeyword(kv.Key);
+ }
+ else
+ {
+ material.DisableKeyword(kv.Key);
+ }
+ }
+ foreach (var kv in item.tagMap)
+ {
+ material.SetOverrideTag(kv.Key, kv.Value);
+ }
+
+ if (shaderName == MToon.Utils.ShaderName)
+ {
+ // TODO: Material拡張にMToonの項目が追加されたら旧バージョンのshaderPropから変換をかける
+ // インポート時にUniVRMに含まれるMToonのバージョンに上書きする
+ material.SetFloat(MToon.Utils.PropVersion, MToon.Utils.VersionNumber);
+ }
+
+ return material;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs.meta
new file mode 100644
index 00000000..e5ff70b7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMMaterialImporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 77db57076c0650c469c3ff0d4853ce21
+timeCreated: 1533624711
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs
new file mode 100644
index 00000000..95872ee4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace VRM
+{
+ public class VRMSpecVersion
+ {
+ public const int Major = 0;
+ public const int Minor = 0;
+
+ public static string Version
+ {
+ get
+ {
+ return String.Format("{0}.{1}", Major, Minor);
+ }
+ }
+
+ public const string VERSION = "0.0";
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs.meta
new file mode 100644
index 00000000..6e5da297
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMSpecVersion.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 3c5b8467d0154d6da78a74ecae5f85e7
+timeCreated: 1549016543 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs
new file mode 100644
index 00000000..91142132
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs
@@ -0,0 +1,11 @@
+
+namespace VRM
+{
+ public static partial class VRMVersion
+ {
+ public const int MAJOR = 0;
+ public const int MINOR = 61;
+ public const int PATCH = 0;
+ public const string VERSION = "0.61.0";
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs.meta
new file mode 100644
index 00000000..b953c85a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersion.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 93c46c8b64555f14bada9f5bb0b7761a
+timeCreated: 1522130257
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs
new file mode 100644
index 00000000..ebaaa3df
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Text.RegularExpressions;
+
+namespace VRM
+{
+ public static partial class VRMVersion
+ {
+ /// <summary>
+ /// Returns true if a passed version is newer than current UniVRM.
+ /// </summary>
+ /// <param name="version"></param>
+ /// <returns></returns>
+ public static bool IsNewer(string version)
+ {
+ if (string.IsNullOrEmpty(version))
+ {
+ return false;
+ }
+
+ var prefix = "UniVRM-";
+ if (version.StartsWith(prefix))
+ {
+ version = version.Substring(prefix.Length);
+ }
+
+ return IsNewer(version, VERSION);
+ }
+
+ public static bool IsNewer(string newer, string older)
+ {
+ Version newerVersion;
+ if (!ParseVersion(newer, out newerVersion))
+ {
+ return false;
+ }
+
+ Version olderVersion;
+ if (!ParseVersion(older, out olderVersion))
+ {
+ return false;
+ }
+
+ if (newerVersion.Major > olderVersion.Major)
+ {
+ return true;
+ }
+
+ if (newerVersion.Minor > olderVersion.Minor)
+ {
+ return true;
+ }
+
+ if (newerVersion.Patch > olderVersion.Patch)
+ {
+ return true;
+ }
+
+ if (String.Compare(newerVersion.Pre, olderVersion.Pre) > 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private static readonly Regex VersionSpec =
+ new Regex(@"(?<major>\d+)\.(?<minor>\d+)(\.(?<patch>\d+))?(-(?<pre>[0-9A-Za-z-]+))?");
+
+ public static bool ParseVersion(string version, out Version v)
+ {
+ var match = VersionSpec.Match(version);
+ if (!match.Success)
+ {
+ v = new Version();
+ return false;
+ }
+
+ v = new Version();
+ try
+ {
+ v.Major = int.Parse(match.Groups["major"].Value);
+ v.Minor = int.Parse(match.Groups["minor"].Value);
+ v.Patch = match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0;
+ v.Pre = match.Groups["pre"].Success ? match.Groups["pre"].Value : "";
+
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
+ public struct Version
+ {
+ public int Major;
+ public int Minor;
+ public int Patch;
+ public string Pre;
+ }
+
+ public const string VRM_VERSION = "UniVRM-" + VERSION;
+ public const string MENU = "VRM/" + VRM_VERSION;
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs.meta
new file mode 100644
index 00000000..b505fdb0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/VRMVersionPartial.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 4ab9ac9856a4d4c4aa652c07c5b496e6
+timeCreated: 1522130257
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs
new file mode 100644
index 00000000..47e10a1d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs
@@ -0,0 +1,135 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public static class glTF_VRMExtensions
+ {
+ [Obsolete("Use Create(root, meshes, binding)")]
+ public static glTF_VRM_BlendShapeBind Cerate(Transform root, BlendShapeBinding binding,
+ gltfExporter exporter)
+ {
+ return Create(root, binding, exporter);
+ }
+
+ public static glTF_VRM_BlendShapeBind Create(Transform root, BlendShapeBinding binding,
+ gltfExporter exporter)
+ {
+ if (string.IsNullOrEmpty((binding.RelativePath)))
+ {
+ Debug.LogWarning("binding.RelativePath is null");
+ return null;
+ }
+ var found = root.transform.Find(binding.RelativePath);
+ if (found == null)
+ {
+ var name = binding.RelativePath.Split('/').Last();
+ found = root.GetComponentsInChildren<Transform>().Where(x => x.name == name).First();
+ if (found == null)
+ {
+ Debug.LogWarning($"{binding.RelativePath} not found");
+ return null;
+ }
+ else
+ {
+ Debug.LogWarning($"fall back '{binding.RelativePath}' => '{found.RelativePathFrom(root)}'");
+ }
+ }
+ var renderer = found.GetComponent<SkinnedMeshRenderer>();
+ if (renderer == null)
+ {
+ return null;
+ }
+
+ if (!renderer.gameObject.activeInHierarchy)
+ {
+ return null;
+ }
+
+ var mesh = renderer.sharedMesh;
+ var meshIndex = exporter.Meshes.IndexOf(mesh);
+ if (meshIndex == -1)
+ {
+ return null;
+ }
+
+ if (!exporter.MeshBlendShapeIndexMap.TryGetValue(mesh, out Dictionary<int, int> blendShapeIndexMap))
+ {
+ // この Mesh は エクスポートされていない
+ return null;
+ }
+
+ if (!blendShapeIndexMap.TryGetValue(binding.Index, out int blendShapeIndex))
+ {
+ // この blendShape は エクスポートされていない(空だった?)
+ return null;
+ }
+
+ return new glTF_VRM_BlendShapeBind
+ {
+ mesh = meshIndex,
+ index = blendShapeIndex,
+ weight = binding.Weight,
+ };
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="master"></param>
+ /// <param name="clip"></param>
+ /// <param name="transform"></param>
+ /// <param name="meshes"></param>
+ /// <param name="blendShapeIndexMap">エクスポート中にBlendShapeIndexが変わったかもしれない</param>
+ public static void Add(this glTF_VRM_BlendShapeMaster master,
+ BlendShapeClip clip, gltfExporter exporter)
+ {
+ var list = new List<glTF_VRM_BlendShapeBind>();
+ if (clip.Values != null)
+ {
+ foreach (var value in clip.Values)
+ {
+ var bind = Create(exporter.Copy.transform, value, exporter);
+ if (bind == null)
+ {
+ // Debug.LogFormat("{0}: skip blendshapebind", clip.name);
+ continue;
+ }
+ list.Add(bind);
+ }
+ }
+
+ var materialList = new List<glTF_VRM_MaterialValueBind>();
+ if (clip.MaterialValues != null)
+ {
+ materialList.AddRange(clip.MaterialValues.Select(y => new glTF_VRM_MaterialValueBind
+ {
+ materialName = y.MaterialName,
+ propertyName = y.ValueName,
+ targetValue = y.TargetValue.ToArray(),
+ }));
+ }
+
+ var group = new glTF_VRM_BlendShapeGroup
+ {
+ name = clip.BlendShapeName,
+ presetName = clip.Preset.ToString().ToLower(),
+ isBinary = clip.IsBinary,
+ binds = list,
+ materialValues = materialList,
+ };
+ master.blendShapeGroups.Add(group);
+ }
+
+ public static void Apply(this glTF_VRM_DegreeMap map, CurveMapper mapper)
+ {
+ map.curve = mapper.Curve.keys.SelectMany(x => new float[] { x.time, x.value, x.inTangent, x.outTangent }).ToArray();
+ map.xRange = mapper.CurveXRangeDegree;
+ map.yRange = mapper.CurveYRangeDegree;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs.meta
new file mode 100644
index 00000000..9291c8bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRMExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5fbd5248b4a422e47be4510ca85c9ade
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs
new file mode 100644
index 00000000..80e85966
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs
@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using UniGLTF;
+using UniJSON;
+
+
+namespace VRM
+{
+ [Serializable]
+ [JsonSchema(Title = "vrm.blendshape.materialbind")]
+ public class glTF_VRM_MaterialValueBind : UniGLTF.JsonSerializableBase
+ {
+ public string materialName;
+ public string propertyName;
+ public float[] targetValue;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => materialName);
+ f.KeyValue(() => propertyName);
+ f.KeyValue(() => targetValue);
+ }
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.blendshape.bind")]
+ public class glTF_VRM_BlendShapeBind : UniGLTF.JsonSerializableBase
+ {
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int mesh = -1;
+
+ [JsonSchema(Required = true, Minimum = 0)]
+ public int index = -1;
+
+ [JsonSchema(Required =true, Minimum = 0, Maximum = 100, Description = @"SkinnedMeshRenderer.SetBlendShapeWeight")]
+ public float weight = 0;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => mesh);
+ f.KeyValue(() => index);
+ f.KeyValue(() => weight);
+ }
+ }
+
+ public enum BlendShapePreset
+ {
+ Unknown,
+
+ Neutral,
+
+ A,
+ I,
+ U,
+ E,
+ O,
+
+ Blink,
+
+ // 喜怒哀楽
+ Joy,
+ Angry,
+ Sorrow,
+ Fun,
+
+ // LookAt
+ LookUp,
+ LookDown,
+ LookLeft,
+ LookRight,
+
+ Blink_L,
+ Blink_R,
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.blendshape.group", Description = "BlendShapeClip of UniVRM")]
+ public class glTF_VRM_BlendShapeGroup : UniGLTF.JsonSerializableBase
+ {
+ [JsonSchema(Description = "Expression name")]
+ public string name;
+
+ [JsonSchema(Description = "Predefined Expression name", EnumValues = new object[] {
+ "unknown",
+ "neutral",
+ "a",
+ "i",
+ "u",
+ "e",
+ "o",
+ "blink",
+ "joy",
+ "angry",
+ "sorrow",
+ "fun",
+ "lookup",
+ "lookdown",
+ "lookleft",
+ "lookright",
+ "blink_l",
+ "blink_r",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string presetName;
+
+ [JsonSchema(Description = "Low level blendshape references. ")]
+ public List<glTF_VRM_BlendShapeBind> binds = new List<glTF_VRM_BlendShapeBind>();
+
+ [JsonSchema(Description = "Material animation references.")]
+ public List<glTF_VRM_MaterialValueBind> materialValues = new List<glTF_VRM_MaterialValueBind>();
+
+ [JsonSchema(Description = "0 or 1. Do not allow an intermediate value. Value should rounded")]
+ public bool isBinary;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => name);
+ f.KeyValue(() => presetName);
+ f.KeyValue(() => isBinary);
+ f.Key("binds"); f.GLTFValue(binds);
+ f.Key("materialValues"); f.GLTFValue(materialValues);
+ }
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.blendshape", Description = "BlendShapeAvatar of UniVRM")]
+ public class glTF_VRM_BlendShapeMaster : UniGLTF.JsonSerializableBase
+ {
+ public List<glTF_VRM_BlendShapeGroup> blendShapeGroups = new List<glTF_VRM_BlendShapeGroup>();
+
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.Key("blendShapeGroups"); f.GLTFValue(blendShapeGroups);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs.meta
new file mode 100644
index 00000000..043c8ab3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_BlendShape.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 73f7fb3db66d55b4684333583a685757
+timeCreated: 1517549334
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs
new file mode 100644
index 00000000..d376478f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs
@@ -0,0 +1,120 @@
+using System;
+using System.Collections.Generic;
+using UniGLTF;
+using UnityEngine;
+using UniJSON;
+
+
+namespace VRM
+{
+ [Serializable]
+ [JsonSchema(Title = "vrm.firstperson.degreemap")]
+ public class glTF_VRM_DegreeMap : UniGLTF.JsonSerializableBase
+ {
+ [JsonSchema(Description = "None linear mapping params. time, value, inTangent, outTangent")]
+ public float[] curve;
+
+ [JsonSchema(Description = "Look at input clamp range degree.")]
+ public float xRange = 90.0f;
+
+ [JsonSchema(Description = "Look at map range degree from xRange.")]
+ public float yRange = 10.0f;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ if (curve != null)
+ {
+ f.KeyValue(() => curve);
+ }
+ f.KeyValue(() => xRange);
+ f.KeyValue(() => yRange);
+ }
+ }
+
+ public enum FirstPersonFlag
+ {
+ Auto, // Create headlessModel
+ Both, // Default layer
+ ThirdPersonOnly,
+ FirstPersonOnly,
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.firstperson.meshannotation")]
+ public class glTF_VRM_MeshAnnotation : JsonSerializableBase
+ {
+ // When the value is -1, it means that no target mesh is found.
+ [JsonSchema(Minimum = 0)]
+ public int mesh;
+
+ public string firstPersonFlag;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => mesh);
+ f.KeyValue(() => firstPersonFlag);
+ }
+ }
+
+ public enum LookAtType
+ {
+ None,
+ Bone,
+ BlendShape,
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.firstperson")]
+ public class glTF_VRM_Firstperson : UniGLTF.JsonSerializableBase
+ {
+ // When the value is -1, it means that no bone for first person is found.
+ [JsonSchema(Description = "The bone whose rendering should be turned off in first-person view. Usually Head is specified.", Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int firstPersonBone = -1;
+
+ [JsonSchema(Description = @"The target position of the VR headset in first-person view. It is assumed that an offset from the head bone to the VR headset is added.")]
+ public Vector3 firstPersonBoneOffset;
+
+ [JsonSchema(Description = "Switch display / undisplay for each mesh in first-person view or the others.")]
+ public List<glTF_VRM_MeshAnnotation> meshAnnotations = new List<glTF_VRM_MeshAnnotation>();
+
+ // lookat
+ [JsonSchema(Description = "Eye controller mode.", EnumValues = new object[] {
+ "Bone",
+ "BlendShape",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string lookAtTypeName = "Bone";
+ public LookAtType lookAtType
+ {
+ get
+ {
+ return CacheEnum.TryParseOrDefault<LookAtType>(lookAtTypeName, true);
+ }
+ set { lookAtTypeName = value.ToString(); }
+ }
+
+ [JsonSchema(Description = "Eye controller setting.")]
+ public glTF_VRM_DegreeMap lookAtHorizontalInner = new glTF_VRM_DegreeMap();
+
+ [JsonSchema(Description = "Eye controller setting.")]
+ public glTF_VRM_DegreeMap lookAtHorizontalOuter = new glTF_VRM_DegreeMap();
+
+ [JsonSchema(Description = "Eye controller setting.")]
+ public glTF_VRM_DegreeMap lookAtVerticalDown = new glTF_VRM_DegreeMap();
+
+ [JsonSchema(Description = "Eye controller setting.")]
+ public glTF_VRM_DegreeMap lookAtVerticalUp = new glTF_VRM_DegreeMap();
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => firstPersonBone);
+ f.KeyValue(() => firstPersonBoneOffset);
+ f.Key("meshAnnotations"); f.GLTFValue(meshAnnotations);
+
+ f.KeyValue(() => lookAtTypeName);
+ f.Key("lookAtHorizontalInner"); f.GLTFValue(lookAtHorizontalInner);
+ f.Key("lookAtHorizontalOuter"); f.GLTFValue(lookAtHorizontalOuter);
+ f.Key("lookAtVerticalDown"); f.GLTFValue(lookAtVerticalDown);
+ f.Key("lookAtVerticalUp"); f.GLTFValue(lookAtVerticalUp);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs.meta
new file mode 100644
index 00000000..615736dc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_FirstPerson.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: fe59508ed49a5db4287c74e0061799b3
+timeCreated: 1519282840
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs
new file mode 100644
index 00000000..6065a38d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs
@@ -0,0 +1,332 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UniJSON;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public enum VRMBone
+ {
+ hips,
+ leftUpperLeg,
+ rightUpperLeg,
+ leftLowerLeg,
+ rightLowerLeg,
+ leftFoot,
+ rightFoot,
+ spine,
+ chest,
+ neck,
+ head,
+ leftShoulder,
+ rightShoulder,
+ leftUpperArm,
+ rightUpperArm,
+ leftLowerArm,
+ rightLowerArm,
+ leftHand,
+ rightHand,
+ leftToes,
+ rightToes,
+ leftEye,
+ rightEye,
+ jaw,
+ leftThumbProximal,
+ leftThumbIntermediate,
+ leftThumbDistal,
+ leftIndexProximal,
+ leftIndexIntermediate,
+ leftIndexDistal,
+ leftMiddleProximal,
+ leftMiddleIntermediate,
+ leftMiddleDistal,
+ leftRingProximal,
+ leftRingIntermediate,
+ leftRingDistal,
+ leftLittleProximal,
+ leftLittleIntermediate,
+ leftLittleDistal,
+ rightThumbProximal,
+ rightThumbIntermediate,
+ rightThumbDistal,
+ rightIndexProximal,
+ rightIndexIntermediate,
+ rightIndexDistal,
+ rightMiddleProximal,
+ rightMiddleIntermediate,
+ rightMiddleDistal,
+ rightRingProximal,
+ rightRingIntermediate,
+ rightRingDistal,
+ rightLittleProximal,
+ rightLittleIntermediate,
+ rightLittleDistal,
+ upperChest,
+
+ unknown,
+ }
+
+ public static class VRMBoneExtensions
+ {
+ public static VRMBone FromHumanBodyBone(this HumanBodyBones human)
+ {
+ return human.ToVrmBone();
+ }
+
+ public static HumanBodyBones ToHumanBodyBone(this VRMBone bone)
+ {
+#if UNITY_5_6_OR_NEWER
+#else
+ if (bone == VRMBone.upperChest)
+ {
+ return HumanBodyBones.LastBone;
+ }
+#endif
+ return bone.ToUnityBone();
+ }
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.humanoid.bone")]
+ public class glTF_VRM_HumanoidBone : JsonSerializableBase
+ {
+ [JsonSchema(Description = "Human bone name.", EnumValues = new object[]
+ {
+ "hips",
+ "leftUpperLeg",
+ "rightUpperLeg",
+ "leftLowerLeg",
+ "rightLowerLeg",
+ "leftFoot",
+ "rightFoot",
+ "spine",
+ "chest",
+ "neck",
+ "head",
+ "leftShoulder",
+ "rightShoulder",
+ "leftUpperArm",
+ "rightUpperArm",
+ "leftLowerArm",
+ "rightLowerArm",
+ "leftHand",
+ "rightHand",
+ "leftToes",
+ "rightToes",
+ "leftEye",
+ "rightEye",
+ "jaw",
+ "leftThumbProximal",
+ "leftThumbIntermediate",
+ "leftThumbDistal",
+ "leftIndexProximal",
+ "leftIndexIntermediate",
+ "leftIndexDistal",
+ "leftMiddleProximal",
+ "leftMiddleIntermediate",
+ "leftMiddleDistal",
+ "leftRingProximal",
+ "leftRingIntermediate",
+ "leftRingDistal",
+ "leftLittleProximal",
+ "leftLittleIntermediate",
+ "leftLittleDistal",
+ "rightThumbProximal",
+ "rightThumbIntermediate",
+ "rightThumbDistal",
+ "rightIndexProximal",
+ "rightIndexIntermediate",
+ "rightIndexDistal",
+ "rightMiddleProximal",
+ "rightMiddleIntermediate",
+ "rightMiddleDistal",
+ "rightRingProximal",
+ "rightRingIntermediate",
+ "rightRingDistal",
+ "rightLittleProximal",
+ "rightLittleIntermediate",
+ "rightLittleDistal",
+ "upperChest",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string bone;
+
+ public VRMBone vrmBone
+ {
+ set
+ {
+ bone = value.ToString();
+ }
+ get
+ {
+ return CacheEnum.Parse<VRMBone>(bone, true);
+ }
+ }
+
+ // When the value is -1, it means that no node is found.
+ [JsonSchema(Description = "Reference node index", Minimum = 0)]
+ public int node = -1;
+
+ [JsonSchema(Description = "Unity's HumanLimit.useDefaultValues")]
+ public bool useDefaultValues = true;
+
+ [JsonSchema(Description = "Unity's HumanLimit.min")]
+ public Vector3 min;
+
+ [JsonSchema(Description = "Unity's HumanLimit.max")]
+ public Vector3 max;
+
+ [JsonSchema(Description = "Unity's HumanLimit.center")]
+ public Vector3 center;
+
+ [JsonSchema(Description = "Unity's HumanLimit.axisLength")]
+ public float axisLength;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.Key("bone"); f.Value((string) bone.ToString());
+ f.KeyValue(() => node);
+ f.KeyValue(() => useDefaultValues);
+ if (!useDefaultValues)
+ {
+ f.KeyValue(() => min);
+ f.KeyValue(() => max);
+ f.KeyValue(() => center);
+ f.KeyValue(() => axisLength);
+ }
+ }
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.humanoid")]
+ public class glTF_VRM_Humanoid : JsonSerializableBase
+ {
+ public List<glTF_VRM_HumanoidBone> humanBones = new List<glTF_VRM_HumanoidBone>();
+
+ [JsonSchema(Description = "Unity's HumanDescription.armStretch")]
+ public float armStretch = 0.05f;
+
+ [JsonSchema(Description = "Unity's HumanDescription.legStretch")]
+ public float legStretch = 0.05f;
+
+ [JsonSchema(Description = "Unity's HumanDescription.upperArmTwist")]
+ public float upperArmTwist = 0.5f;
+
+ [JsonSchema(Description = "Unity's HumanDescription.lowerArmTwist")]
+ public float lowerArmTwist = 0.5f;
+
+ [JsonSchema(Description = "Unity's HumanDescription.upperLegTwist")]
+ public float upperLegTwist = 0.5f;
+
+ [JsonSchema(Description = "Unity's HumanDescription.lowerLegTwist")]
+ public float lowerLegTwist = 0.5f;
+
+ [JsonSchema(Description = "Unity's HumanDescription.feetSpacing")]
+ public float feetSpacing = 0;
+
+ [JsonSchema(Description = "Unity's HumanDescription.hasTranslationDoF")]
+ public bool hasTranslationDoF = false;
+
+ public void SetNodeIndex(HumanBodyBones _key, int node)
+ {
+ var key = _key.FromHumanBodyBone();
+ var index = humanBones.FindIndex(x => x.vrmBone == key);
+ if (index == -1 || humanBones[index] == null)
+ {
+ // not found
+ humanBones.Add(new glTF_VRM_HumanoidBone
+ {
+ vrmBone = key,
+ node = node
+ });
+ }
+ else
+ {
+ humanBones[index].node = node;
+ }
+ }
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.Key("humanBones"); f.GLTFValue(humanBones);
+ f.KeyValue(() => armStretch);
+ f.KeyValue(() => legStretch);
+ f.KeyValue(() => upperArmTwist);
+ f.KeyValue(() => lowerArmTwist);
+ f.KeyValue(() => upperLegTwist);
+ f.KeyValue(() => lowerLegTwist);
+ f.KeyValue(() => feetSpacing);
+ f.KeyValue(() => hasTranslationDoF);
+ }
+
+ public void Apply(UniHumanoid.AvatarDescription desc, List<Transform> nodes)
+ {
+ armStretch = desc.armStretch;
+ legStretch = desc.legStretch;
+ upperArmTwist = desc.upperArmTwist;
+ lowerArmTwist = desc.lowerArmTwist;
+ upperLegTwist = desc.upperLegTwist;
+ lowerLegTwist = desc.lowerArmTwist;
+ feetSpacing = desc.feetSpacing;
+ hasTranslationDoF = desc.hasTranslationDoF;
+
+ foreach (var x in desc.human)
+ {
+ var key = x.humanBone.FromHumanBodyBone();
+ var found = humanBones.FirstOrDefault(y => y.vrmBone == key);
+ if (found == null)
+ {
+ found = new glTF_VRM_HumanoidBone
+ {
+ vrmBone = key
+ };
+ humanBones.Add(found);
+ }
+
+ found.node = nodes.FindIndex(y => y.name == x.boneName);
+
+ found.useDefaultValues = x.useDefaultValues;
+ found.axisLength = x.axisLength;
+ found.center = x.center;
+ found.max = x.max;
+ found.min = x.min;
+ }
+ }
+
+ public UniHumanoid.AvatarDescription ToDescription(List<Transform> nodes)
+ {
+ var description = ScriptableObject.CreateInstance<UniHumanoid.AvatarDescription>();
+ description.upperLegTwist = upperLegTwist;
+ description.lowerLegTwist = lowerLegTwist;
+ description.upperArmTwist = upperArmTwist;
+ description.lowerArmTwist = lowerArmTwist;
+ description.armStretch = armStretch;
+ description.legStretch = legStretch;
+ description.hasTranslationDoF = hasTranslationDoF;
+
+ var boneLimits = new UniHumanoid.BoneLimit[humanBones.Count];
+ int index = 0;
+ foreach (var x in humanBones)
+ {
+ if (x.node < 0 || x.node >= nodes.Count) continue;
+ boneLimits[index] = new UniHumanoid.BoneLimit
+ {
+ boneName = nodes[x.node].name,
+ useDefaultValues = x.useDefaultValues,
+ axisLength = x.axisLength,
+ center = x.center,
+ min = x.min,
+ max = x.max,
+ humanBone = x.vrmBone.ToHumanBodyBone(),
+ };
+ index++;
+ }
+
+ description.human = boneLimits;
+
+ return description;
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs.meta
new file mode 100644
index 00000000..5b423083
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Humanoid.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 3f9f79a650473ec46b54bf693bd745d2
+timeCreated: 1517549206
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs
new file mode 100644
index 00000000..726cd58d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UniJSON;
+
+
+namespace VRM
+{
+ [Serializable]
+ [JsonSchema(Title = "vrm.material")]
+ public class glTF_VRM_Material : JsonSerializableBase
+ {
+ public string name;
+ public string shader;
+ public int renderQueue = -1;
+
+ public Dictionary<string, float> floatProperties = new Dictionary<string, float>();
+ public Dictionary<string, float[]> vectorProperties = new Dictionary<string, float[]>();
+ public Dictionary<string, int> textureProperties = new Dictionary<string, int>();
+ public Dictionary<string, bool> keywordMap = new Dictionary<string, bool>();
+ public Dictionary<string, string> tagMap = new Dictionary<string, string>();
+
+ public static readonly string VRM_USE_GLTFSHADER = "VRM_USE_GLTFSHADER";
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => name);
+ f.KeyValue(() => renderQueue);
+ f.KeyValue(() => shader);
+ {
+ f.Key("floatProperties"); f.BeginMap();
+ foreach (var kv in floatProperties)
+ {
+ f.Key(kv.Key); f.Value(kv.Value);
+ }
+ f.EndMap();
+ }
+ {
+ f.Key("vectorProperties"); f.BeginMap();
+ foreach (var kv in vectorProperties)
+ {
+ f.Key(kv.Key); f.Serialize(kv.Value.ToArray());
+ }
+ f.EndMap();
+ }
+ {
+ f.Key("textureProperties"); f.BeginMap();
+ foreach (var kv in textureProperties)
+ {
+ f.Key(kv.Key); f.Value(kv.Value);
+ }
+ f.EndMap();
+ }
+ {
+ f.Key("keywordMap"); f.BeginMap();
+ foreach (var kv in keywordMap)
+ {
+ f.Key(kv.Key); f.Value(kv.Value);
+ }
+ f.EndMap();
+ }
+ {
+ f.Key("tagMap"); f.BeginMap();
+ foreach (var kv in tagMap)
+ {
+ f.Key(kv.Key); f.Value(kv.Value);
+ }
+ f.EndMap();
+ }
+ }
+
+ public static List<glTF_VRM_Material> Parse(string src)
+ {
+ var json = JsonParser.Parse(src)["extensions"]["VRM"]["materialProperties"];
+ return Parse(json);
+ }
+
+ static Utf8String s_floatProperties = Utf8String.From("floatProperties");
+ static Utf8String s_vectorProperties = Utf8String.From("vectorProperties");
+ static Utf8String s_keywordMap = Utf8String.From("keywordMap");
+ static Utf8String s_tagMap = Utf8String.From("tagMap");
+ static Utf8String s_textureProperties = Utf8String.From("textureProperties");
+
+ public static List<glTF_VRM_Material> Parse(ListTreeNode<JsonValue> json)
+ {
+ var materials = json.DeserializeList<glTF_VRM_Material>();
+ var jsonItems = json.ArrayItems().ToArray();
+ for (int i = 0; i < materials.Count; ++i)
+ {
+ materials[i].floatProperties =
+ jsonItems[i][s_floatProperties].ObjectItems().ToDictionary(x => x.Key.GetString(), x => x.Value.GetSingle());
+ materials[i].vectorProperties =
+ jsonItems[i][s_vectorProperties].ObjectItems().ToDictionary(x => x.Key.GetString(), x =>
+ {
+ return x.Value.ArrayItems().Select(y => y.GetSingle()).ToArray();
+ });
+ materials[i].keywordMap =
+ jsonItems[i][s_keywordMap].ObjectItems().ToDictionary(x => x.Key.GetString(), x => x.Value.GetBoolean());
+ materials[i].tagMap =
+ jsonItems[i][s_tagMap].ObjectItems().ToDictionary(x => x.Key.GetString(), x => x.Value.GetString());
+ materials[i].textureProperties =
+ jsonItems[i][s_textureProperties].ObjectItems().ToDictionary(x => x.Key.GetString(), x => x.Value.GetInt32());
+ }
+ return materials;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs.meta
new file mode 100644
index 00000000..f333cb24
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Material.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 130dbb872890027439584d752fe160ef
+timeCreated: 1519805969
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs
new file mode 100644
index 00000000..7610142f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs
@@ -0,0 +1,171 @@
+using System;
+using UniGLTF;
+using UniJSON;
+
+namespace VRM
+{
+ public enum AllowedUser
+ {
+ OnlyAuthor,
+ ExplicitlyLicensedPerson,
+ Everyone,
+ }
+
+ public enum LicenseType
+ {
+ Redistribution_Prohibited,
+ CC0,
+ CC_BY,
+ CC_BY_NC,
+ CC_BY_SA,
+ CC_BY_NC_SA,
+ CC_BY_ND,
+ CC_BY_NC_ND,
+ Other
+ }
+
+ public enum UssageLicense
+ {
+ Disallow,
+ Allow,
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.meta")]
+ public class glTF_VRM_Meta : JsonSerializableBase
+ {
+ static UssageLicense FromString(string src)
+ {
+ return CacheEnum.TryParseOrDefault<UssageLicense>(src, true);
+ }
+
+ [JsonSchema(Description = "Title of VRM model")]
+ public string title;
+
+ [JsonSchema(Description = "Version of VRM model")]
+ public string version;
+
+ [JsonSchema(Description = "Author of VRM model")]
+ public string author;
+
+ [JsonSchema(Description = "Contact Information of VRM model author")]
+ public string contactInformation;
+
+ [JsonSchema(Description = "Reference of VRM model")]
+ public string reference;
+
+ // When the value is -1, it means that texture is not specified.
+ [JsonSchema(Description = "Thumbnail of VRM model", Minimum = 0, ExplicitIgnorableValue = -1)]
+ public int texture = -1;
+
+ #region Ussage Permission
+ [JsonSchema(Required = true, Description = "A person who can perform with this avatar ", EnumValues = new object[] {
+ "OnlyAuthor",
+ "ExplicitlyLicensedPerson",
+ "Everyone",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string allowedUserName = "OnlyAuthor";
+ public AllowedUser allowedUser
+ {
+ get
+ {
+ return CacheEnum.TryParseOrDefault<AllowedUser>(allowedUserName, true);
+ }
+ set
+ {
+ allowedUserName = value.ToString();
+ }
+ }
+
+ [JsonSchema(Required = true, Description = "Permission to perform violent acts with this avatar", EnumValues = new object[]
+ {
+ "Disallow",
+ "Allow",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string violentUssageName = "Disallow";
+ public UssageLicense violentUssage
+ {
+ get { return FromString(violentUssageName); }
+ set { violentUssageName = value.ToString(); }
+ }
+
+ [JsonSchema(Required = true, Description = "Permission to perform sexual acts with this avatar", EnumValues = new object[]
+ {
+ "Disallow",
+ "Allow",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string sexualUssageName = "Disallow";
+ public UssageLicense sexualUssage
+ {
+ get { return FromString(sexualUssageName); }
+ set { sexualUssageName = value.ToString(); }
+ }
+
+ [JsonSchema(Required = true, Description = "For commercial use", EnumValues = new object[]
+ {
+ "Disallow",
+ "Allow",
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string commercialUssageName = "Disallow";
+ public UssageLicense commercialUssage
+ {
+ get { return FromString(commercialUssageName); }
+ set { commercialUssageName = value.ToString(); }
+ }
+
+ [JsonSchema(Description = "If there are any conditions not mentioned above, put the URL link of the license document here.")]
+ public string otherPermissionUrl;
+ #endregion
+
+ #region Distribution License
+ [JsonSchema(Required = true, Description = "License type", EnumValues = new object[]
+ {
+ "Redistribution_Prohibited",
+ "CC0",
+ "CC_BY",
+ "CC_BY_NC",
+ "CC_BY_SA",
+ "CC_BY_NC_SA",
+ "CC_BY_ND",
+ "CC_BY_NC_ND",
+ "Other"
+ }, EnumSerializationType = EnumSerializationType.AsString)]
+ public string licenseName = "Redistribution_Prohibited";
+ public LicenseType licenseType
+ {
+ get
+ {
+ return CacheEnum.TryParseOrDefault<LicenseType>(licenseName, true);
+ }
+ set
+ {
+ licenseName = value.ToString();
+ }
+ }
+
+ [JsonSchema(Description = "If “Other” is selected, put the URL link of the license document here.")]
+ public string otherLicenseUrl;
+ #endregion
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => version);
+
+ f.KeyValue(() => author);
+ f.KeyValue(() => contactInformation);
+ f.KeyValue(() => reference);
+
+ f.KeyValue(() => title);
+ f.KeyValue(() => texture);
+
+ f.KeyValue(() => allowedUserName);
+ f.KeyValue(() => violentUssageName);
+ f.KeyValue(() => sexualUssageName);
+ f.KeyValue(() => commercialUssageName);
+ f.KeyValue(() => otherPermissionUrl);
+
+ f.KeyValue(() => licenseName);
+ f.KeyValue(() => otherLicenseUrl);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs.meta
new file mode 100644
index 00000000..5a8af484
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_Meta.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 06d4ab405dbbf9041b20a3b99f1cbe4f
+timeCreated: 1520237793
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs
new file mode 100644
index 00000000..5d825b8c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs
@@ -0,0 +1,110 @@
+using System;
+using System.Collections.Generic;
+using UniGLTF;
+using UniJSON;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [Serializable]
+ public class glTF_VRM_SecondaryAnimationCollider : JsonSerializableBase
+ {
+ [JsonSchema(Description = "The local coordinate from the node of the collider group.")]
+ public Vector3 offset;
+
+ [JsonSchema(Description = "The radius of the collider.")]
+ public float radius;
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => offset);
+ f.KeyValue(() => radius);
+ }
+ }
+
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.secondaryanimation.collidergroup", Description = @"Set sphere balls for colliders used for collision detections with swaying objects.")]
+ public class glTF_VRM_SecondaryAnimationColliderGroup : JsonSerializableBase
+ {
+ [JsonSchema(Description = "The node of the collider group for setting up collision detections.", Minimum = 0)]
+ public int node;
+
+ public List<glTF_VRM_SecondaryAnimationCollider> colliders = new List<glTF_VRM_SecondaryAnimationCollider>();
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => node);
+ f.Key("colliders"); f.GLTFValue(colliders);
+ }
+ }
+
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.secondaryanimation.spring")]
+ public class glTF_VRM_SecondaryAnimationGroup : JsonSerializableBase
+ {
+ [JsonSchema(Description = "Annotation comment")]
+ public string comment;
+
+ [JsonSchema(Description = "The resilience of the swaying object (the power of returning to the initial pose).")]
+ public float stiffiness;
+
+ [JsonSchema(Description = "The strength of gravity.")]
+ public float gravityPower;
+
+ [JsonSchema(Description = "The direction of gravity. Set (0, -1, 0) for simulating the gravity. Set (1, 0, 0) for simulating the wind.")]
+ public Vector3 gravityDir;
+
+ [JsonSchema(Description = "The resistance (deceleration) of automatic animation.")]
+ public float dragForce;
+
+ // NOTE: This value denotes index but may contain -1 as a value.
+ // When the value is -1, it means that center node is not specified.
+ // This is a historical issue and a compromise for forward compatibility.
+ [JsonSchema(Description = @"The reference point of a swaying object can be set at any location except the origin. When implementing UI moving with warp, the parent node to move with warp can be specified if you don't want to make the object swaying with warp movement.")]
+ public int center;
+
+ [JsonSchema(Description = "The radius of the sphere used for the collision detection with colliders.")]
+ public float hitRadius;
+
+ [JsonSchema(Description = "Specify the node index of the root bone of the swaying object.")]
+ [ItemJsonSchema(Minimum = 0)]
+ public int[] bones = new int[] { };
+
+ [JsonSchema(Description = "Specify the index of the collider group for collisions with swaying objects.")]
+ [ItemJsonSchema(Minimum = 0)]
+ public int[] colliderGroups = new int[] { };
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.KeyValue(() => comment);
+ f.KeyValue(() => stiffiness);
+ f.KeyValue(() => gravityPower);
+ f.KeyValue(() => gravityDir);
+ f.KeyValue(() => dragForce);
+ f.KeyValue(() => center);
+ f.KeyValue(() => hitRadius);
+ f.KeyValue(() => bones);
+ f.KeyValue(() => colliderGroups);
+ }
+ }
+
+ [Serializable]
+ [JsonSchema(Title = "vrm.secondaryanimation", Description = "The setting of automatic animation of string-like objects such as tails and hairs.")]
+ public class glTF_VRM_SecondaryAnimation : JsonSerializableBase
+ {
+ [JsonSchema(ExplicitIgnorableItemLength = 0)]
+ public List<glTF_VRM_SecondaryAnimationGroup> boneGroups = new List<glTF_VRM_SecondaryAnimationGroup>();
+
+ [JsonSchema(ExplicitIgnorableItemLength = 0)]
+ public List<glTF_VRM_SecondaryAnimationColliderGroup> colliderGroups = new List<glTF_VRM_SecondaryAnimationColliderGroup>();
+
+ protected override void SerializeMembers(GLTFJsonFormatter f)
+ {
+ f.Key("boneGroups"); f.GLTFValue(boneGroups);
+ f.Key("colliderGroups"); f.GLTFValue(colliderGroups);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs.meta
new file mode 100644
index 00000000..34daa1cc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Format/glTF_VRM_SecondaryAnimation.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5fb9119ad9fa65849ad2379d4da417bd
+timeCreated: 1519653096
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid.meta
new file mode 100644
index 00000000..30cc06e3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: dabe3b8d8da159f43a06701a61a69dbf
+folderAsset: yes
+timeCreated: 1520410756
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs
new file mode 100644
index 00000000..5a177e50
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs
@@ -0,0 +1,56 @@
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMHumanoidDescription : MonoBehaviour
+ {
+ [SerializeField]
+ public Avatar Avatar;
+
+ [SerializeField]
+ public UniHumanoid.AvatarDescription Description;
+
+ public UniHumanoid.AvatarDescription GetDescription(out bool isCreated)
+ {
+ isCreated = false;
+ if (Description != null)
+ {
+ return Description;
+ }
+
+#if UNITY_EDITOR
+ if (Avatar != null)
+ {
+ isCreated = true;
+ return UniHumanoid.AvatarDescription.CreateFrom(Avatar);
+ }
+#endif
+
+ return null;
+ }
+
+ private void OnValidate()
+ {
+ if(Avatar!=null && (!Avatar.isValid || !Avatar.isHuman))
+ {
+ Avatar = null;
+ }
+ }
+
+ void Reset()
+ {
+ var animator = GetComponent<Animator>();
+ if (animator == null)
+ {
+ return;
+ }
+
+ Avatar = animator.avatar;
+ if (Avatar == null)
+ {
+ return;
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs.meta
new file mode 100644
index 00000000..a9bf0367
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Humanoid/VRMHumanoidDescription.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3869812175467a143ab9cd865752b4a9
+timeCreated: 1520410765
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs
new file mode 100644
index 00000000..0eaa1471
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs
@@ -0,0 +1,19 @@
+namespace VRM
+{
+ /// <summary>
+ ///
+ /// * OnImported(Serializableなメンバの初期化)とStart(ランタイムのメンバ初期化)で
+ /// セットアップが終わるように注意する。
+ ///
+ /// * Reset, Awake, OnEnableには注意する(Editor時はAddComponentで呼ばれ、Runtimeでは開始時に呼ばれる)
+ ///
+ /// </summary>
+ public interface IVRMComponent
+ {
+ /// <summary>
+ /// Serializableな値を初期化する
+ /// </summary>
+ /// <param name="imported"></param>
+ void OnImported(VRMImporterContext context);
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs.meta
new file mode 100644
index 00000000..17496a5c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/IVRMComponent.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3edd6ae2fa8e64746b11daac1d1d9bad
+timeCreated: 1524053597
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt.meta
new file mode 100644
index 00000000..4ed54325
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: a7e29185fa574ef4eab4b030a279a64d
+folderAsset: yes
+timeCreated: 1518293103
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs
new file mode 100644
index 00000000..cbc750d2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [Serializable]
+ public class CurveMapper
+ {
+ public AnimationCurve Curve = AnimationCurve.Linear(0, 0, 1.0f, 1.0f);
+
+ [Range(20.0f, 90.0f)]
+ public float CurveXRangeDegree;
+
+ [Range(0, 90.0f)]
+ public float CurveYRangeDegree;
+
+ /*
+ public CurveMapper() : this(90.0f, 10.0f)
+ {
+ }
+ */
+
+ public CurveMapper(float xRange, float yRange)
+ {
+ CurveXRangeDegree = xRange;
+ CurveYRangeDegree = yRange;
+ }
+
+ public void OnValidate()
+ {
+ if (CurveXRangeDegree == 0)
+ {
+ CurveXRangeDegree = 90.0f;
+ }
+ }
+
+ public void Apply(glTF_VRM_DegreeMap degreeMap)
+ {
+ CurveXRangeDegree = degreeMap.xRange;
+ CurveYRangeDegree = degreeMap.yRange;
+ if (degreeMap.curve != null)
+ {
+ Curve = new AnimationCurve(ToKeys(degreeMap.curve).ToArray());
+ }
+ else
+ {
+ Curve = AnimationCurve.Linear(0, 0, 1.0f, 1.0f);
+ }
+ }
+
+ IEnumerable<Keyframe> ToKeys(float[] values)
+ {
+ for (int i = 0; i < values.Length; i += 4)
+ {
+ yield return new Keyframe(values[i], values[i + 1], values[i + 2], values[i + 3]);
+ }
+ }
+
+ public float Map(float src)
+ {
+ if (src < 0)
+ {
+ src = 0;
+ }
+ else if (src > CurveXRangeDegree)
+ {
+ src = CurveXRangeDegree;
+ }
+ return Curve.Evaluate(src / CurveXRangeDegree) * CurveYRangeDegree;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs.meta
new file mode 100644
index 00000000..7e0fc4de
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/CurveMapper.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: baf8dab7dcbbb03429b01dfa7e2f65cd
+timeCreated: 1521805484
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs
new file mode 100644
index 00000000..c6bb6cca
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs
@@ -0,0 +1,78 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class LookAtTargetSwitcher : MonoBehaviour
+ {
+ [SerializeField]
+ List<Transform> m_targets = new List<Transform>();
+
+ [SerializeField, Range(0, 90.0f)]
+ float m_thresholdDegrees = 60.0f;
+
+ [SerializeField]
+ VRMLookAtHead m_lookAtHead;
+
+ [SerializeField]
+ Blinker m_blinker;
+
+ private void Reset()
+ {
+ m_lookAtHead = GameObject.FindObjectOfType<VRMLookAtHead>();
+ m_blinker = GameObject.FindObjectOfType<Blinker>();
+ }
+
+ float CalcScore(Transform target)
+ {
+ return Vector3.Dot(m_lookAtHead.Head.forward, target.position - m_lookAtHead.Head.position);
+ }
+
+ Transform ChooseTarget()
+ {
+ Transform target = null;
+ float maxScore = 0;
+ var min = System.Math.Cos(m_thresholdDegrees * Mathf.Deg2Rad);
+ foreach (var x in m_targets)
+ {
+ var score = CalcScore(x);
+ if (score > min && score > maxScore)
+ {
+ maxScore = score;
+ target = x;
+ }
+ }
+ return target;
+ }
+
+ Transform m_lastTarget;
+
+ private void Update()
+ {
+ if (m_targets == null || m_targets.Count == 0) return;
+
+ var target = ChooseTarget();
+ if (target != m_lastTarget)
+ {
+ // blink
+ //Debug.Log("request");
+ m_lastTarget = target;
+ m_blinker.Request = true;
+ }
+
+ Vector3 targetPosition;
+ if (target == null)
+ {
+ // forward
+ targetPosition = m_lookAtHead.Head.position + m_lookAtHead.Head.forward * 20.0f;
+ }
+ else
+ {
+ targetPosition = target.position;
+ }
+ // half move
+ transform.position += (targetPosition - transform.position) * 0.5f;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs.meta
new file mode 100644
index 00000000..f02c2c72
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookAtTargetSwitcher.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bcd30950d78a34d48a749efb962224e6
+timeCreated: 1522156957
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs
new file mode 100644
index 00000000..f6752b8c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs
@@ -0,0 +1,36 @@
+using UnityEngine;
+using UniGLTF;
+
+
+namespace VRM
+{
+ public class LookTarget : MonoBehaviour
+ {
+ [SerializeField]
+ public Transform Target;
+
+ [SerializeField]
+ Vector3 m_offset = new Vector3(0, 0.05f, 0);
+
+ [SerializeField, Range(0, 3.0f)]
+ float m_distance = 0.7f;
+
+ public OffsetOnTransform m_offsetTransform;
+
+ void Update()
+ {
+ if (Target != m_offsetTransform.Transform)
+ {
+ m_offsetTransform = OffsetOnTransform.Create(Target);
+ }
+
+ var target = m_offsetTransform.Transform;
+ if (target != null)
+ {
+ var targetPosition = target.position + m_offset;
+ transform.position = targetPosition + (m_offsetTransform.WorldMatrix.ExtractRotation() * Vector3.forward) * m_distance;
+ transform.LookAt(targetPosition);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs.meta
new file mode 100644
index 00000000..3c40d1c1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/LookTarget.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d1cc319f70f55264eb38d1959c4222c6
+timeCreated: 1519912723
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs
new file mode 100644
index 00000000..89b43526
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs
@@ -0,0 +1,38 @@
+using System;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public static class Matrix4x4Extensions
+ {
+ public static void CalcYawPitch(this Matrix4x4 m, Vector3 target, out float yaw, out float pitch)
+ {
+ var zaxis = Vector3.Project(target, m.GetColumn(2));
+ var yaxis = Vector3.Project(target, m.GetColumn(1));
+ var xaxis = Vector3.Project(target, m.GetColumn(0));
+
+ var yawPlusMinus = Vector3.Dot(xaxis, m.GetColumn(0)) > 0 ? 1.0f : -1.0f;
+ yaw = (float)Math.Atan2(xaxis.magnitude, zaxis.magnitude) * yawPlusMinus * Mathf.Rad2Deg;
+
+ var pitchPlusMinus = Vector3.Dot(yaxis, m.GetColumn(1)) > 0 ? 1.0f : -1.0f;
+ pitch = (float)Math.Atan2(yaxis.magnitude, (xaxis + zaxis).magnitude) * pitchPlusMinus * Mathf.Rad2Deg;
+ }
+
+ public static Quaternion YawPitchRotation(this Matrix4x4 m, float yaw, float pitch)
+ {
+ return Quaternion.AngleAxis(yaw, m.GetColumn(1)) * Quaternion.AngleAxis(-pitch, m.GetColumn(0));
+ }
+
+ public static Matrix4x4 RotationToWorldAxis(this Matrix4x4 m)
+ {
+ return UnityExtensions.Matrix4x4FromColumns(
+ m.MultiplyVector(Vector3.right),
+ m.MultiplyVector(Vector3.up),
+ m.MultiplyVector(Vector3.forward),
+ new Vector4(0, 0, 0, 1)
+ );
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs.meta
new file mode 100644
index 00000000..85d92bc0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/Matrix4x4Extensions.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: ab9df13cea6667a4bbf488fc297bd014
+timeCreated: 1518347175
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs
new file mode 100644
index 00000000..a559f44b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs
@@ -0,0 +1,61 @@
+using System;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [Serializable]
+ public struct OffsetOnTransform
+ {
+ public Transform Transform;
+ public Matrix4x4 OffsetRotation;
+
+ public Matrix4x4 WorldMatrix
+ {
+ get
+ {
+ if (Transform == null) return Matrix4x4.identity;
+ return Transform.localToWorldMatrix * OffsetRotation;
+ }
+ }
+
+ public Vector3 WorldForward
+ {
+ get
+ {
+ var m = WorldMatrix;
+ return m.GetColumn(2); // zaxis
+ }
+ }
+
+ Matrix4x4 m_initialLocalMatrix;
+ public void Setup()
+ {
+ if (Transform == null) return;
+ m_initialLocalMatrix = Transform.parent.worldToLocalMatrix * Transform.localToWorldMatrix;
+ }
+
+ public Matrix4x4 InitialWorldMatrix
+ {
+ get
+ {
+ return Transform.parent.localToWorldMatrix * m_initialLocalMatrix;
+ }
+ }
+
+ public static OffsetOnTransform Create(Transform transform)
+ {
+ var coordinate = new OffsetOnTransform
+ {
+ Transform = transform
+ };
+
+ if (transform != null)
+ {
+ coordinate.OffsetRotation = transform.worldToLocalMatrix.RotationToWorldAxis();
+ }
+
+ return coordinate;
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs.meta
new file mode 100644
index 00000000..3a8c67c2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/OffsetOnTransform.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: e8e294185b0b06148a057dc3a21cc55f
+timeCreated: 1518347841
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs
new file mode 100644
index 00000000..419a0f7b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs
@@ -0,0 +1,253 @@
+#pragma warning disable 0414, 0649
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ [Obsolete("Use VRMLookAtHead")]
+ public class VRMLookAt : MonoBehaviour
+ {
+ public bool DrawGizmo = true;
+
+ [SerializeField]
+ public bool UseUpdate = true;
+
+ [SerializeField]
+ public Transform Target;
+
+ [SerializeField]
+ public OffsetOnTransform LeftEye;
+
+ [SerializeField]
+ public OffsetOnTransform RightEye;
+
+ [SerializeField]
+ public OffsetOnTransform Head;
+
+ [SerializeField, Header("Degree Mapping")]
+ public CurveMapper HorizontalOuter = new CurveMapper(90.0f, 10.0f);
+
+ [SerializeField]
+ public CurveMapper HorizontalInner = new CurveMapper(90.0f, 10.0f);
+
+ [SerializeField]
+ public CurveMapper VerticalDown = new CurveMapper(90.0f, 10.0f);
+
+ [SerializeField]
+ public CurveMapper VerticalUp = new CurveMapper(90.0f, 10.0f);
+
+ public Texture2D CreateThumbnail()
+ {
+ var texture = new Texture2D(2048, 2048);
+ {
+ var go = new GameObject("ThumbCamera");
+ var camera = go.AddComponent<Camera>();
+ CreateThumbnail(camera, texture);
+ if (Application.isPlaying) { GameObject.Destroy(go); } else { GameObject.DestroyImmediate(go); }
+ }
+ return texture;
+ }
+ void CreateThumbnail(Camera camera, Texture2D dst)
+ {
+ RenderTexture currentRT = RenderTexture.active;
+ {
+ var renderTexture = new RenderTexture(dst.width, dst.height, 24);
+ camera.targetTexture = renderTexture;
+ RenderTexture.active = renderTexture;
+ LookFace(camera.transform);
+ camera.Render();
+ dst.ReadPixels(new Rect(0, 0, dst.width, dst.height), 0, 0);
+
+ RenderTexture.active = currentRT;
+ camera.targetTexture = null;
+ if (Application.isPlaying)
+ {
+ UnityEngine.Object.Destroy(renderTexture);
+ }
+ else
+ {
+ UnityEngine.Object.DestroyImmediate(renderTexture);
+ }
+ }
+ }
+
+ public void LookFace(Transform t)
+ {
+ if (Head.Transform == null) return;
+ var head = Head.Transform;
+ var headPosition = head.position + new Vector3(0, 0.05f, 0);
+ t.position = headPosition + Head.WorldMatrix.ExtractRotation() * new Vector3(0, 0, 0.7f);
+ t.LookAt(headPosition);
+ }
+
+ public void CopyTo(GameObject _dst, Dictionary<Transform, Transform> map)
+ {
+ var dst = _dst.AddComponent<VRMLookAt>();
+ dst.Target = Target;
+ dst.Head = OffsetOnTransform.Create(map[Head.Transform]);
+ dst.RightEye = OffsetOnTransform.Create(map[RightEye.Transform]);
+ dst.LeftEye = OffsetOnTransform.Create(map[LeftEye.Transform]);
+
+ dst.HorizontalOuter = HorizontalOuter;
+ dst.HorizontalInner = HorizontalInner;
+ dst.VerticalDown = VerticalDown;
+ dst.VerticalUp = VerticalUp;
+ }
+
+ private void Reset()
+ {
+ Target = Camera.main.transform;
+
+ GetBones();
+ }
+
+ private void OnValidate()
+ {
+ HorizontalInner.OnValidate();
+ HorizontalOuter.OnValidate();
+ VerticalUp.OnValidate();
+ VerticalDown.OnValidate();
+ }
+
+ public void GetBones()
+ {
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ LeftEye = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.LeftEye));
+ RightEye = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.RightEye));
+ Head = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.Head));
+ }
+ }
+
+ private void Awake()
+ {
+ Head.Setup();
+ LeftEye.Setup();
+ RightEye.Setup();
+ }
+
+ #region Gizmo
+ static void DrawMatrix(Matrix4x4 m, float size)
+ {
+ Gizmos.matrix = m;
+ Gizmos.color = Color.red;
+ Gizmos.DrawLine(Vector3.zero, Vector3.right * size);
+ Gizmos.color = Color.green;
+ Gizmos.DrawLine(Vector3.zero, Vector3.up * size);
+ Gizmos.color = Color.blue;
+ Gizmos.DrawLine(Vector3.zero, Vector3.forward * size);
+ }
+
+ const float SIZE = 0.5f;
+
+ private void OnDrawGizmos()
+ {
+ if (!DrawGizmo) return;
+
+ if (LeftEye.Transform != null & RightEye.Transform != null)
+ {
+ DrawMatrix(LeftEye.WorldMatrix, SIZE);
+ DrawMatrix(RightEye.WorldMatrix, SIZE);
+
+ }
+ else
+ {
+ DrawMatrix(Head.WorldMatrix, SIZE);
+ }
+ }
+ #endregion
+
+ static Matrix4x4 LookAtMatrixFromWorld(Vector3 from, Vector3 target)
+ {
+ var pos = new Vector4(from.x, from.y, from.z, 1);
+ return LookAtMatrix(UnityExtensions.Matrix4x4FromColumns(Vector3.right, Vector3.up, Vector3.forward, pos), target);
+ }
+
+ static Matrix4x4 LookAtMatrix(Vector3 up_vector, Vector3 localPosition)
+ {
+ var z_axis = localPosition.normalized;
+ var x_axis = Vector3.Cross(up_vector, z_axis).normalized;
+ var y_axis = Vector3.Cross(z_axis, x_axis).normalized;
+ return UnityExtensions.Matrix4x4FromColumns(x_axis, y_axis, z_axis, new Vector4(0, 0, 0, 1));
+ }
+
+ static Matrix4x4 LookAtMatrix(Matrix4x4 m, Vector3 target)
+ {
+ return LookAtMatrix(Vector3.up, m.inverse.MultiplyPoint(target));
+ }
+
+ public Matrix4x4 YawMatrix
+ {
+ get
+ {
+ var yaw = Quaternion.AngleAxis(Yaw, Head.OffsetRotation.GetColumn(1));
+ var m = default(Matrix4x4);
+ m.SetTRS(Vector3.zero, yaw, Vector3.one);
+ return m;
+ }
+ }
+
+ [SerializeField, Header("Debug")]
+ public float Yaw;
+ public float Pitch;
+ private void LateUpdate()
+ {
+ if (!UseUpdate) return;
+ if (Target == null) return;
+
+ LookWorldPosition(Target.position);
+ }
+
+ public void LookWorldPosition(Vector3 targetPosition)
+ {
+ var localPosition = Head.InitialWorldMatrix.inverse.MultiplyPoint(targetPosition);
+ Head.OffsetRotation.CalcYawPitch(localPosition, out Yaw, out Pitch);
+
+ ApplyRotations(Yaw, Pitch);
+ }
+
+ void ApplyRotations(float yaw, float pitch)
+ {
+ // horizontal
+ float leftYaw, rightYaw;
+ if (yaw < 0)
+ {
+ leftYaw = -HorizontalOuter.Map(-yaw);
+ rightYaw = -HorizontalInner.Map(-yaw);
+ }
+ else
+ {
+ rightYaw = HorizontalOuter.Map(yaw);
+ leftYaw = HorizontalInner.Map(yaw);
+ }
+
+ // vertical
+ if (pitch < 0)
+ {
+ pitch = -VerticalDown.Map(-pitch);
+ }
+ else
+ {
+ pitch = VerticalUp.Map(pitch);
+ }
+
+ // Apply
+ if (LeftEye.Transform != null && RightEye.Transform != null)
+ {
+ // 目に値を適用する
+ LeftEye.Transform.rotation = LeftEye.InitialWorldMatrix.ExtractRotation() * Head.OffsetRotation.YawPitchRotation(leftYaw, pitch);
+ RightEye.Transform.rotation = RightEye.InitialWorldMatrix.ExtractRotation() * Head.OffsetRotation.YawPitchRotation(rightYaw, pitch);
+ }
+ else if (Head.Transform != null)
+ {
+ // 頭に値を適用する
+ Head.Transform.rotation = Head.InitialWorldMatrix.ExtractRotation() * Head.OffsetRotation.YawPitchRotation(yaw, pitch);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs.meta
new file mode 100644
index 00000000..132208d6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAt.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 04a3e59a0190f1647892e3709c075845
+timeCreated: 1517991576
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs
new file mode 100644
index 00000000..252fd935
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs
@@ -0,0 +1,90 @@
+#pragma warning disable 0414, 0649
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMLookAtBlendShapeApplyer : MonoBehaviour, IVRMComponent
+ {
+ public bool DrawGizmo = true;
+
+ [SerializeField, Header("Degree Mapping")]
+ public CurveMapper Horizontal = new CurveMapper(90.0f, 1.0f);
+
+ [SerializeField]
+ public CurveMapper VerticalDown = new CurveMapper(90.0f, 1.0f);
+
+ [SerializeField]
+ public CurveMapper VerticalUp = new CurveMapper(90.0f, 1.0f);
+
+ /// <summary>
+ /// v0.56 からデフォルト値を true に変更
+ ///
+ /// true の場合: BlendShapeProxy.AccumulateValue を使う(推奨)
+ /// 別途 BlendShapeProxy.Apply を別の場所で呼び出す必要があります
+ /// false の場合: BlendShapeProxy.ImmediatelySetValueを使う
+ /// 目をテクスチャUVのOffset値の変更で表現するモデルの場合に、
+ /// Material.SetVector("_MainTex_ST", new Vector4(1, 1, 横の移動値, 0))
+ /// Material.SetVector("_MainTex_ST", new Vector4(1, 1, 0, 縦の移動値))
+ /// と連続で呼ばれることで、横の移動値が打ち消されてしまいます。
+ /// BlendShapeProxy.AccumulateValue はこの値を加算して new Vector4(1, 1, 横の移動値, 縦の移動値)
+ /// となるように扱えます。
+ /// </summary>
+ [SerializeField]
+ public bool m_notSetValueApply = true;
+
+ public void OnImported(VRMImporterContext context)
+ {
+ var gltfFirstPerson = context.GLTF.extensions.VRM.firstPerson;
+ Horizontal.Apply(gltfFirstPerson.lookAtHorizontalOuter);
+ VerticalDown.Apply(gltfFirstPerson.lookAtVerticalDown);
+ VerticalUp.Apply(gltfFirstPerson.lookAtVerticalUp);
+ }
+
+ VRMLookAtHead m_head;
+ VRMBlendShapeProxy m_proxy;
+
+ private void Start()
+ {
+ m_head = GetComponent<VRMLookAtHead>();
+ m_proxy = GetComponent<VRMBlendShapeProxy>();
+ if (m_head == null)
+ {
+ enabled = false;
+ return;
+ }
+ m_head.YawPitchChanged += ApplyRotations;
+ }
+
+ void ApplyRotations(float yaw, float pitch)
+ {
+#pragma warning disable 0618
+ if (yaw < 0)
+ {
+ // Left
+ m_proxy.SetValue(BlendShapePreset.LookRight, 0, !m_notSetValueApply); // clear first
+ m_proxy.SetValue(BlendShapePreset.LookLeft, Mathf.Clamp(Horizontal.Map(-yaw), 0, 1.0f), !m_notSetValueApply);
+ }
+ else
+ {
+ // Right
+ m_proxy.SetValue(BlendShapePreset.LookLeft, 0, !m_notSetValueApply); // clear first
+ m_proxy.SetValue(BlendShapePreset.LookRight, Mathf.Clamp(Horizontal.Map(yaw), 0, 1.0f), !m_notSetValueApply);
+ }
+
+ if (pitch < 0)
+ {
+ // Down
+ m_proxy.SetValue(BlendShapePreset.LookUp, 0, !m_notSetValueApply); // clear first
+ m_proxy.SetValue(BlendShapePreset.LookDown, Mathf.Clamp(VerticalDown.Map(-pitch), 0, 1.0f), !m_notSetValueApply);
+ }
+ else
+ {
+ // Up
+ m_proxy.SetValue(BlendShapePreset.LookDown, 0, !m_notSetValueApply); // clear first
+ m_proxy.SetValue(BlendShapePreset.LookUp, Mathf.Clamp(VerticalUp.Map(pitch), 0, 1.0f), !m_notSetValueApply);
+ }
+#pragma warning restore 0618
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs.meta
new file mode 100644
index 00000000..eff87cae
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBlendShapeApplyer.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 845471fb50db3cd4aa2f7a3fae3cc3a4
+timeCreated: 1517991576
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs
new file mode 100644
index 00000000..5475dd4d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs
@@ -0,0 +1,131 @@
+#pragma warning disable 0414, 0649
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMLookAtBoneApplyer : MonoBehaviour, IVRMComponent
+ {
+ public bool DrawGizmo = false;
+
+ [SerializeField]
+ public OffsetOnTransform LeftEye;
+
+ [SerializeField]
+ public OffsetOnTransform RightEye;
+
+ [SerializeField, Header("Degree Mapping")]
+ public CurveMapper HorizontalOuter = new CurveMapper(90.0f, 10.0f);
+
+ [SerializeField]
+ public CurveMapper HorizontalInner = new CurveMapper(90.0f, 10.0f);
+
+ [SerializeField]
+ public CurveMapper VerticalDown = new CurveMapper(90.0f, 10.0f);
+
+ [SerializeField]
+ public CurveMapper VerticalUp = new CurveMapper(90.0f, 10.0f);
+
+ public void OnImported(VRMImporterContext context)
+ {
+ var animator = GetComponent<Animator>();
+ if (animator != null)
+ {
+ LeftEye = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.LeftEye));
+ RightEye = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.RightEye));
+ }
+
+ var gltfFirstPerson = context.GLTF.extensions.VRM.firstPerson;
+ HorizontalInner.Apply(gltfFirstPerson.lookAtHorizontalInner);
+ HorizontalOuter.Apply(gltfFirstPerson.lookAtHorizontalOuter);
+ VerticalDown.Apply(gltfFirstPerson.lookAtVerticalDown);
+ VerticalUp.Apply(gltfFirstPerson.lookAtVerticalUp);
+ }
+
+ private void OnValidate()
+ {
+ HorizontalInner.OnValidate();
+ HorizontalOuter.OnValidate();
+ VerticalUp.OnValidate();
+ VerticalDown.OnValidate();
+ }
+
+ VRMLookAtHead m_head;
+
+ void Start()
+ {
+ m_head = GetComponent<VRMLookAtHead>();
+ if (m_head == null)
+ {
+ enabled = false;
+ Debug.LogError("[VRMLookAtBoneApplyer]VRMLookAtHead not found");
+ return;
+ }
+ m_head.YawPitchChanged += ApplyRotations;
+ LeftEye.Setup();
+ RightEye.Setup();
+ }
+
+ #region Gizmo
+ static void DrawMatrix(Matrix4x4 m, float size)
+ {
+ Gizmos.matrix = m;
+ Gizmos.color = Color.red;
+ Gizmos.DrawLine(Vector3.zero, Vector3.right * size);
+ Gizmos.color = Color.green;
+ Gizmos.DrawLine(Vector3.zero, Vector3.up * size);
+ Gizmos.color = Color.blue;
+ Gizmos.DrawLine(Vector3.zero, Vector3.forward * size);
+ }
+
+ const float SIZE = 0.5f;
+
+ private void OnDrawGizmos()
+ {
+ if (DrawGizmo)
+ {
+ if (LeftEye.Transform != null & RightEye.Transform != null)
+ {
+ DrawMatrix(LeftEye.WorldMatrix, SIZE);
+ DrawMatrix(RightEye.WorldMatrix, SIZE);
+ }
+ }
+ }
+ #endregion
+
+ void ApplyRotations(float yaw, float pitch)
+ {
+ // horizontal
+ float leftYaw, rightYaw;
+ if (yaw < 0)
+ {
+ leftYaw = -HorizontalOuter.Map(-yaw);
+ rightYaw = -HorizontalInner.Map(-yaw);
+ }
+ else
+ {
+ rightYaw = HorizontalOuter.Map(yaw);
+ leftYaw = HorizontalInner.Map(yaw);
+ }
+
+ // vertical
+ if (pitch < 0)
+ {
+ pitch = -VerticalDown.Map(-pitch);
+ }
+ else
+ {
+ pitch = VerticalUp.Map(pitch);
+ }
+
+ // Apply
+ if (LeftEye.Transform != null && RightEye.Transform != null)
+ {
+ // 目に値を適用する
+ LeftEye.Transform.rotation = LeftEye.InitialWorldMatrix.ExtractRotation() * Matrix4x4.identity.YawPitchRotation(leftYaw, pitch);
+ RightEye.Transform.rotation = RightEye.InitialWorldMatrix.ExtractRotation() * Matrix4x4.identity.YawPitchRotation(rightYaw, pitch);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs.meta
new file mode 100644
index 00000000..4b6f6624
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtBoneApplyer.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: a8b72334adf6f7948bd98b4f0a873949
+timeCreated: 1517991576
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs
new file mode 100644
index 00000000..e93b8acd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs
@@ -0,0 +1,220 @@
+#pragma warning disable 0414, 0649
+using System;
+using UniGLTF;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public enum UpdateType
+ {
+ None,
+ Update,
+ LateUpdate,
+ }
+
+ /// <summary>
+ /// Headボーンローカルで目標物のYaw, Pitchを求めて目線に適用する
+ ///
+ /// * VRMLookAtBoneApplyer
+ /// * VRMLookAtBlendShapeApplyer
+ ///
+ /// </summary>
+ public class VRMLookAtHead : MonoBehaviour, IVRMComponent
+ {
+ public bool DrawGizmo = true;
+
+ [SerializeField]
+ public UpdateType UpdateType = UpdateType.Update;
+
+ [SerializeField]
+ public Transform Target;
+
+ [SerializeField]
+ public Transform Head;
+
+ #region Thumbnail
+ public Texture2D CreateThumbnail()
+ {
+ var texture = new Texture2D(2048, 2048);
+ {
+ var go = new GameObject("ThumbCamera");
+ var camera = go.AddComponent<Camera>();
+ CreateThumbnail(camera, texture);
+ if (Application.isPlaying) { GameObject.Destroy(go); } else { GameObject.DestroyImmediate(go); }
+ }
+ return texture;
+ }
+ void CreateThumbnail(Camera camera, Texture2D dst)
+ {
+ RenderTexture currentRT = RenderTexture.active;
+ {
+ var renderTexture = new RenderTexture(dst.width, dst.height, 24);
+ camera.targetTexture = renderTexture;
+ RenderTexture.active = renderTexture;
+ LookFace(camera.transform);
+ camera.Render();
+ dst.ReadPixels(new Rect(0, 0, dst.width, dst.height), 0, 0);
+
+ RenderTexture.active = currentRT;
+ camera.targetTexture = null;
+ if (Application.isPlaying)
+ {
+ UnityEngine.Object.Destroy(renderTexture);
+ }
+ else
+ {
+ UnityEngine.Object.DestroyImmediate(renderTexture);
+ }
+ }
+ }
+
+ public void LookFace(Transform t)
+ {
+ if (Head == null) return;
+ var headPosition = Head.position + new Vector3(0, 0.05f, 0);
+ t.position = headPosition + Head.localToWorldMatrix.ExtractRotation() * new Vector3(0, 0, 0.7f);
+ t.LookAt(headPosition);
+ }
+ #endregion
+
+ void Awake()
+ {
+ var animator = GetComponent<Animator>();
+ if (animator == null)
+ {
+ Debug.LogWarning("animator is not found");
+ return;
+ }
+
+ var head = animator.GetBoneTransform(HumanBodyBones.Head);
+ if (head == null)
+ {
+ Debug.LogWarning("head is not found");
+ return;
+ }
+
+ Head = head;
+ }
+
+ public void OnImported(VRMImporterContext context)
+ {
+ var gltfFirstPerson = context.GLTF.extensions.VRM.firstPerson;
+ switch (gltfFirstPerson.lookAtType)
+ {
+ case LookAtType.Bone:
+ {
+ var applyer = gameObject.AddComponent<VRMLookAtBoneApplyer>();
+ applyer.OnImported(context);
+ }
+ break;
+
+ case LookAtType.BlendShape:
+ {
+ var applyer = gameObject.AddComponent<VRMLookAtBlendShapeApplyer>();
+ applyer.OnImported(context);
+ }
+ break;
+ }
+ }
+
+ static Matrix4x4 LookAtMatrixFromWorld(Vector3 from, Vector3 target)
+ {
+ var pos = new Vector4(from.x, from.y, from.z, 1);
+ return LookAtMatrix(UnityExtensions.Matrix4x4FromColumns(Vector3.right, Vector3.up, Vector3.forward, pos), target);
+ }
+
+ static Matrix4x4 LookAtMatrix(Vector3 up_vector, Vector3 localPosition)
+ {
+ var z_axis = localPosition.normalized;
+ var x_axis = Vector3.Cross(up_vector, z_axis).normalized;
+ var y_axis = Vector3.Cross(z_axis, x_axis).normalized;
+ return UnityExtensions.Matrix4x4FromColumns(x_axis, y_axis, z_axis, new Vector4(0, 0, 0, 1));
+ }
+
+ static Matrix4x4 LookAtMatrix(Matrix4x4 m, Vector3 target)
+ {
+ return LookAtMatrix(Vector3.up, m.inverse.MultiplyPoint(target));
+ }
+
+ public Matrix4x4 YawMatrix
+ {
+ get
+ {
+ var yaw = Quaternion.AngleAxis(m_yaw, Vector3.up);
+ var m = default(Matrix4x4);
+ m.SetTRS(Vector3.zero, yaw, Vector3.one);
+ return m;
+ }
+ }
+
+ [SerializeField, Header("Debug")]
+ float m_yaw;
+ public float Yaw
+ {
+ get { return m_yaw; }
+ }
+
+ [SerializeField]
+ float m_pitch;
+ public float Pitch
+ {
+ get { return m_pitch; }
+ }
+
+ public event Action<float, float> YawPitchChanged;
+ public void RaiseYawPitchChanged(float yaw, float pitch)
+ {
+ m_yaw = yaw;
+ m_pitch = pitch;
+ var handle = YawPitchChanged;
+ if (handle != null)
+ {
+ handle(yaw, pitch);
+ }
+ }
+
+ private void Update()
+ {
+ if (Head == null)
+ {
+ enabled = false;
+ return;
+ }
+
+ if (UpdateType == UpdateType.Update)
+ {
+ LookWorldPosition();
+ }
+ }
+
+ private void LateUpdate()
+ {
+ if (Head == null)
+ {
+ enabled = false;
+ return;
+ }
+
+ if (UpdateType == UpdateType.LateUpdate)
+ {
+ LookWorldPosition();
+ }
+ }
+
+ public void LookWorldPosition()
+ {
+ if (Target == null) return;
+ float yaw;
+ float pitch;
+ LookWorldPosition(Target.position, out yaw, out pitch);
+ }
+
+ public void LookWorldPosition(Vector3 targetPosition, out float yaw, out float pitch)
+ {
+ var localPosition = Head.worldToLocalMatrix.MultiplyPoint(targetPosition);
+ Matrix4x4.identity.CalcYawPitch(localPosition, out yaw, out pitch);
+ RaiseYawPitchChanged(yaw, pitch);
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs.meta
new file mode 100644
index 00000000..feb7b047
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/LookAt/VRMLookAtHead.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: e0a1a470564f16f4f94acb4b9ef56367
+timeCreated: 1517991576
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta.meta
new file mode 100644
index 00000000..43557402
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1f4af4e58b683c14e93f70773938e78f
+folderAsset: yes
+timeCreated: 1520239983
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs
new file mode 100644
index 00000000..04c9a7af
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs
@@ -0,0 +1,11 @@
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMMeta : MonoBehaviour
+ {
+ [SerializeField]
+ public VRMMetaObject Meta;
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs.meta
new file mode 100644
index 00000000..0b7d246e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMeta.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 690ea0146224b8b4694a1925dddeb352
+timeCreated: 1522391118
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs
new file mode 100644
index 00000000..8eaca37b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs
@@ -0,0 +1,107 @@
+using System;
+using System.IO;
+using UnityEngine;
+using UniGLTF;
+
+
+namespace VRM
+{
+ [Obsolete("reimport, use VRMMeta. Please reimport")]
+ [Serializable]
+ [DisallowMultipleComponent]
+ public class VRMMetaInformation : MonoBehaviour, IEquatable<VRMMetaInformation>
+ {
+ #region Info
+ [SerializeField, Header("Information")]
+ public string Title;
+
+ [SerializeField]
+ public string Author;
+
+ [SerializeField]
+ public string ContactInformation;
+
+ [SerializeField]
+ public Texture2D Thumbnail;
+
+ [SerializeField]
+ public string Reference;
+ #endregion
+
+ #region License
+ [SerializeField, Header("License")]
+ public LicenseType LicenseType;
+
+ [SerializeField]
+ public string OtherLicenseUrl;
+ #endregion
+
+ public bool Equals(VRMMetaInformation other)
+ {
+ return
+ Author == other.Author
+ && Title == other.Title
+ && UniGLTF.MonoBehaviourComparator.AssetAreEquals(Thumbnail, other.Thumbnail)
+ ;
+ }
+
+ private void Reset()
+ {
+ Title = name;
+ }
+
+#if UNITY_EDITOR
+ [ContextMenu("CreateThumbnail")]
+ void CreateThumbnailMenu()
+ {
+ var lookAt = GetComponent<VRMLookAt>();
+ if (lookAt != null)
+ {
+ var texture = lookAt.CreateThumbnail();
+
+#if false
+ var assetPath = string.Format("Assets/{0}.thumbnail.asset", name);
+ assetPath = UnityEditor.AssetDatabase.GenerateUniqueAssetPath(assetPath);
+ UnityEditor.AssetDatabase.CreateAsset(texture, assetPath);
+#else
+ var assetPath = string.Format("Assets/{0}.thumbnail.jpg", name);
+ assetPath = UnityEditor.AssetDatabase.GenerateUniqueAssetPath(assetPath);
+ File.WriteAllBytes(assetPath.AssetPathToFullPath(), texture.EncodeToJPG());
+
+ if (Application.isPlaying)
+ {
+ UnityEngine.Object.Destroy(texture);
+ }
+ else
+ {
+ UnityEngine.Object.DestroyImmediate(texture);
+ }
+
+ UnityEditor.AssetDatabase.ImportAsset(assetPath);
+ Thumbnail = UnityEditor.AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
+#endif
+ }
+ }
+#endif
+
+ public void CopyTo(GameObject _dst)
+ {
+ var dst = _dst.AddComponent<VRMMetaInformation>();
+ dst.Title = Title;
+ dst.Author = Author;
+ dst.Thumbnail = Thumbnail;
+ }
+
+ public void OnValidate()
+ {
+ if (Thumbnail != null)
+ {
+ if (Thumbnail.width != 2048 || Thumbnail.height != 2048)
+ {
+ Thumbnail = null;
+ Debug.LogError("Thumbnail must 2048 x 2048");
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs.meta
new file mode 100644
index 00000000..6cc9fc5e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaInformation.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8ea874a3d9d53e54a86ff1724ede087f
+timeCreated: 1520239812
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs
new file mode 100644
index 00000000..bf352264
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs
@@ -0,0 +1,84 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public class VRMMetaObject : ScriptableObject
+ {
+ [SerializeField]
+ public string ExporterVersion;
+
+ #region Info
+ [SerializeField]
+ public string Title;
+
+ [SerializeField]
+ public string Version;
+
+ [SerializeField]
+ public string Author;
+
+ [SerializeField]
+ public string ContactInformation;
+
+ [SerializeField]
+ public string Reference;
+
+ [SerializeField]
+ public Texture2D Thumbnail;
+ #endregion
+
+ #region Permission
+ [SerializeField, Tooltip("A person who can perform with this avatar")]
+ public AllowedUser AllowedUser;
+
+ [SerializeField, Tooltip("Violent acts using this avatar")]
+ public UssageLicense ViolentUssage;
+
+ [SerializeField, Tooltip("Sexuality acts using this avatar")]
+ public UssageLicense SexualUssage;
+
+ [SerializeField, Tooltip("For commercial use")]
+ public UssageLicense CommercialUssage;
+
+ [SerializeField, Tooltip("Other License Url")]
+ public string OtherPermissionUrl;
+ #endregion
+
+ #region Distribution License
+ [SerializeField]
+ public LicenseType LicenseType;
+
+ [SerializeField]
+ public string OtherLicenseUrl;
+ #endregion
+
+ /*
+ public bool Equals(VRMMetaObject other)
+ {
+ return
+ Author == other.Author
+ && Title == other.Title
+ && UniGLTF.MonoBehaviourComparator.AssetAreEquals(Thumbnail, other.Thumbnail)
+ ;
+ }
+ */
+
+ public IEnumerable<Validation> Validate()
+ {
+ if (string.IsNullOrEmpty(Title))
+ {
+ yield return Validation.Error("Require Title. ");
+ }
+ if (string.IsNullOrEmpty(Version))
+ {
+ yield return Validation.Error("Require Version. ");
+ }
+ if (string.IsNullOrEmpty(Author))
+ {
+ yield return Validation.Error("Require Author. ");
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs.meta
new file mode 100644
index 00000000..7ed6699a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Meta/VRMMetaObject.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 63b589176a34b344b9ccbee2b7e7114a
+timeCreated: 1522391129
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility.meta
new file mode 100644
index 00000000..a82e2343
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 02ffe457c721f1849983f8cceb281b6d
+folderAsset: yes
+timeCreated: 1520848088
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs
new file mode 100644
index 00000000..cc6b6cdd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs
@@ -0,0 +1,238 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniHumanoid;
+using UnityEngine;
+
+
+namespace VRM
+{
+ public static class VRMBoneNormalizer
+ {
+ static void EnforceTPose(GameObject go)
+ {
+ var animator = go.GetComponent<Animator>();
+ if (animator == null)
+ {
+ throw new ArgumentException("Animator with avatar is required");
+ }
+
+ var avatar = animator.avatar;
+ if (avatar == null)
+ {
+ throw new ArgumentException("avatar is required");
+ }
+
+ if (!avatar.isValid)
+ {
+ throw new ArgumentException("invalid avatar");
+ }
+
+ if (!avatar.isHuman)
+ {
+ throw new ArgumentException("avatar is not human");
+ }
+
+ HumanPoseTransfer.SetTPose(avatar, go.transform);
+ }
+
+ /// <summary>
+ /// モデルの正規化を実行する
+ /// </summary>
+ /// <param name="go">対象モデルのルート</param>
+ /// <param name="forceTPose">強制的にT-Pose化するか</param>
+ /// <returns>正規化済みのモデル</returns>
+ public static GameObject Execute(GameObject go, bool forceTPose, bool clearBlendShapeBeforeNormalize)
+ {
+ //
+ // T-Poseにする
+ //
+ if (forceTPose)
+ {
+ var hips = go.GetComponent<Animator>().GetBoneTransform(HumanBodyBones.Hips);
+ var hipsPosition = hips.position;
+ var hipsRotation = hips.rotation;
+ try
+ {
+ EnforceTPose(go);
+ }
+ finally
+ {
+ hips.position = hipsPosition; // restore hipsPosition
+ hips.rotation = hipsRotation;
+ }
+ }
+
+ //
+ // 正規化されたヒエラルキーを作る
+ //
+ var (normalized, bMap) = MeshUtility.BoneNormalizer.Execute(go, clearBlendShapeBeforeNormalize, (_src, dst, boneMap) =>
+ {
+ var src = _src.GetComponent<Animator>();
+
+ var srcHumanBones = Enum.GetValues(typeof(HumanBodyBones))
+ .Cast<HumanBodyBones>()
+ .Where(x => x != HumanBodyBones.LastBone)
+ .Select(x => new { Key = x, Value = src.GetBoneTransform(x) })
+ .Where(x => x.Value != null)
+ ;
+
+ var map =
+ srcHumanBones
+ .Where(x => boneMap.ContainsKey(x.Value))
+ .ToDictionary(x => x.Key, x => boneMap[x.Value])
+ ;
+
+ var animator = dst.AddComponent<Animator>();
+ var vrmHuman = go.GetComponent<VRMHumanoidDescription>();
+ var avatarDescription = AvatarDescription.Create();
+ if (vrmHuman != null && vrmHuman.Description != null)
+ {
+ avatarDescription.armStretch = vrmHuman.Description.armStretch;
+ avatarDescription.legStretch = vrmHuman.Description.legStretch;
+ avatarDescription.upperArmTwist = vrmHuman.Description.upperArmTwist;
+ avatarDescription.lowerArmTwist = vrmHuman.Description.lowerArmTwist;
+ avatarDescription.upperLegTwist = vrmHuman.Description.upperLegTwist;
+ avatarDescription.lowerLegTwist = vrmHuman.Description.lowerLegTwist;
+ avatarDescription.feetSpacing = vrmHuman.Description.feetSpacing;
+ avatarDescription.hasTranslationDoF = vrmHuman.Description.hasTranslationDoF;
+ }
+ avatarDescription.SetHumanBones(map);
+ var avatar = avatarDescription.CreateAvatar(dst.transform);
+ return avatar;
+ });
+
+ // humanPoseTransfer
+ // var animator = normalized.GetComponent<Animator>();
+ // var humanPoseTransfer = normalized.AddComponent<HumanPoseTransfer>();
+ // humanPoseTransfer.Avatar = animator.avatar;
+
+ CopyVRMComponents(go, normalized, bMap);
+
+ return normalized;
+ }
+
+ /// <summary>
+ /// VRMを構成するコンポーネントをコピーする。
+ /// </summary>
+ /// <param name="go">コピー元</param>
+ /// <param name="root">コピー先</param>
+ /// <param name="map">コピー元とコピー先の対応関係</param>
+ static void CopyVRMComponents(GameObject go, GameObject root,
+ Dictionary<Transform, Transform> map)
+ {
+ {
+ // blendshape
+ var src = go.GetComponent<VRMBlendShapeProxy>();
+ if (src != null)
+ {
+ var dst = root.AddComponent<VRMBlendShapeProxy>();
+ dst.BlendShapeAvatar = src.BlendShapeAvatar;
+ }
+ }
+
+ {
+ var secondary = go.transform.Find("secondary");
+ if (secondary == null)
+ {
+ secondary = go.transform;
+ }
+
+ var dstSecondary = root.transform.Find("secondary");
+ if (dstSecondary == null)
+ {
+ dstSecondary = new GameObject("secondary").transform;
+ dstSecondary.SetParent(root.transform, false);
+ }
+
+ // 揺れモノ
+ foreach (var src in go.transform.GetComponentsInChildren<VRMSpringBoneColliderGroup>())
+ {
+ var dst = map[src.transform];
+ var dstColliderGroup = dst.gameObject.AddComponent<VRMSpringBoneColliderGroup>();
+ dstColliderGroup.Colliders = src.Colliders.Select(y =>
+ {
+ var offset = dst.worldToLocalMatrix.MultiplyPoint(src.transform.localToWorldMatrix.MultiplyPoint(y.Offset));
+ return new VRMSpringBoneColliderGroup.SphereCollider
+ {
+ Offset = offset,
+ Radius = y.Radius
+ };
+ }).ToArray();
+ }
+
+ foreach (var src in go.transform.GetComponentsInChildren<VRMSpringBone>())
+ {
+ // Copy VRMSpringBone
+ var dst = dstSecondary.gameObject.AddComponent<VRMSpringBone>();
+ dst.m_comment = src.m_comment;
+ dst.m_stiffnessForce = src.m_stiffnessForce;
+ dst.m_gravityPower = src.m_gravityPower;
+ dst.m_gravityDir = src.m_gravityDir;
+ dst.m_dragForce = src.m_dragForce;
+ if (src.m_center != null)
+ {
+ dst.m_center = map[src.m_center];
+ }
+
+ dst.RootBones = src.RootBones.Select(x => map[x]).ToList();
+ dst.m_hitRadius = src.m_hitRadius;
+ if (src.ColliderGroups != null)
+ {
+ dst.ColliderGroups = src.ColliderGroups
+ .Select(x => map[x.transform].GetComponent<VRMSpringBoneColliderGroup>()).ToArray();
+ }
+ }
+ }
+
+#pragma warning disable 0618
+ {
+ // meta(obsolete)
+ var src = go.GetComponent<VRMMetaInformation>();
+ if (src != null)
+ {
+ src.CopyTo(root);
+ }
+ }
+#pragma warning restore 0618
+
+ {
+ // meta
+ var src = go.GetComponent<VRMMeta>();
+ if (src != null)
+ {
+ var dst = root.AddComponent<VRMMeta>();
+ dst.Meta = src.Meta;
+ }
+ }
+
+ {
+ // firstPerson
+ var src = go.GetComponent<VRMFirstPerson>();
+ if (src != null)
+ {
+ src.CopyTo(root, map);
+ }
+ }
+
+ {
+ // humanoid
+ var dst = root.AddComponent<VRMHumanoidDescription>();
+ var src = go.GetComponent<VRMHumanoidDescription>();
+ if (src != null)
+ {
+ dst.Avatar = src.Avatar;
+ dst.Description = src.Description;
+ }
+ else
+ {
+ var animator = go.GetComponent<Animator>();
+ if (animator != null)
+ {
+ dst.Avatar = animator.avatar;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs.meta
new file mode 100644
index 00000000..64a247ec
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMBoneNormalizer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7c0aa7232aa52244aa546dcabf17fadd
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs
new file mode 100644
index 00000000..1dbbc7ea
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs
@@ -0,0 +1,92 @@
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UnityEngine;
+
+namespace VRM
+{
+ /// <summary>
+ /// Meshを統合し、統合後のMeshのBlendShapeの変化をVRMのBlendShapeClipに反映する
+ /// </summary>
+ public static class VRMMeshIntegratorUtility
+ {
+ public static bool IntegrateRuntime(GameObject vrmRootObject)
+ {
+ if (vrmRootObject == null) return false;
+ var proxy = vrmRootObject.GetComponent<VRMBlendShapeProxy>();
+ if (proxy == null) return false;
+ var avatar = proxy.BlendShapeAvatar;
+ if (avatar == null) return false;
+ var clips = avatar.Clips;
+
+ var results = Integrate(vrmRootObject, clips);
+ if (results.Any(x => x.IntegratedRenderer == null)) return false;
+
+ foreach (var result in results)
+ {
+ foreach (var renderer in result.SourceSkinnedMeshRenderers)
+ {
+ Object.Destroy(renderer);
+ }
+
+ foreach (var renderer in result.SourceMeshRenderers)
+ {
+ Object.Destroy(renderer);
+ }
+ }
+
+ return true;
+ }
+
+ public static List<MeshUtility.MeshIntegrationResult> Integrate(GameObject root, List<BlendShapeClip> blendshapeClips)
+ {
+ var result = new List<MeshUtility.MeshIntegrationResult>();
+
+ var withoutBlendShape = MeshUtility.MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: false);
+ if (withoutBlendShape.IntegratedRenderer != null)
+ {
+ result.Add(withoutBlendShape);
+ }
+
+ var onlyBlendShape = MeshUtility.MeshIntegratorUtility.Integrate(root, onlyBlendShapeRenderers: true);
+ if (onlyBlendShape.IntegratedRenderer != null)
+ {
+ result.Add(onlyBlendShape);
+ FollowBlendshapeRendererChange(blendshapeClips, onlyBlendShape, root);
+ }
+
+ return result;
+ }
+
+ private static void FollowBlendshapeRendererChange(List<BlendShapeClip> clips, MeshUtility.MeshIntegrationResult result, GameObject root)
+ {
+ if (clips == null || result == null || result.IntegratedRenderer == null || root == null) return;
+
+ var rendererDict = result.SourceSkinnedMeshRenderers
+ .ToDictionary(x => x.transform.RelativePathFrom(root.transform), x => x);
+
+ var dstPath = result.IntegratedRenderer.transform.RelativePathFrom(root.transform);
+
+ foreach (var clip in clips)
+ {
+ if (clip == null) continue;
+
+ for (var i = 0; i < clip.Values.Length; ++i)
+ {
+ var val = clip.Values[i];
+ if (rendererDict.ContainsKey(val.RelativePath))
+ {
+ var srcRenderer = rendererDict[val.RelativePath];
+ var name = srcRenderer.sharedMesh.GetBlendShapeName(val.Index);
+ var newIndex = result.IntegratedRenderer.sharedMesh.GetBlendShapeIndex(name);
+
+ val.RelativePath = dstPath;
+ val.Index = newIndex;
+ }
+
+ clip.Values[i] = val;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs.meta
new file mode 100644
index 00000000..49f2e8d7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SkinnedMeshUtility/VRMMeshIntegratorUtility.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8eebeb093136b7f429c0e9e7295816b3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone.meta
new file mode 100644
index 00000000..e2e5ab76
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: f2201df871e857e4f8bc403f56af0ddc
+folderAsset: yes
+timeCreated: 1519303744
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs
new file mode 100644
index 00000000..17d270f9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs
@@ -0,0 +1,327 @@
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UniGLTF;
+
+namespace VRM
+{
+ /// <summary>
+ /// The base algorithm is http://rocketjump.skr.jp/unity3d/109/ of @ricopin416
+ /// DefaultExecutionOrder(11000) means calculate springbone after FinalIK( VRIK )
+ /// </summary>
+ [DefaultExecutionOrder(11000)]
+ // [RequireComponent(typeof(VCIObject))]
+ public sealed class VRMSpringBone : MonoBehaviour
+ {
+ [SerializeField]
+ public string m_comment;
+
+ [SerializeField] [Header("Gizmo")] private bool m_drawGizmo = default;
+
+ [SerializeField] private Color m_gizmoColor = Color.yellow;
+
+ [SerializeField]
+ [Range(0, 4)]
+ [Header("Settings")]
+ public float m_stiffnessForce = 1.0f;
+
+ [SerializeField] [Range(0, 2)] public float m_gravityPower;
+
+ [SerializeField] public Vector3 m_gravityDir = new Vector3(0, -1.0f, 0);
+
+ [SerializeField] [Range(0, 1)] public float m_dragForce = 0.4f;
+
+ [SerializeField] public Transform m_center;
+
+ [SerializeField] public List<Transform> RootBones = new List<Transform>();
+ Dictionary<Transform, Quaternion> m_initialLocalRotationMap;
+
+ [SerializeField]
+ [Range(0, 0.5f)]
+ [Header("Collider")]
+ public float m_hitRadius = 0.02f;
+
+ [SerializeField]
+ public VRMSpringBoneColliderGroup[] ColliderGroups;
+
+ public enum SpringBoneUpdateType
+ {
+ LateUpdate,
+ FixedUpdate,
+ }
+ [SerializeField]
+ public SpringBoneUpdateType m_updateType = SpringBoneUpdateType.LateUpdate;
+
+ /// <summary>
+ /// original from
+ /// http://rocketjump.skr.jp/unity3d/109/
+ /// </summary>
+ private class VRMSpringBoneLogic
+ {
+ Transform m_transform;
+ public Transform Head => m_transform;
+
+ private Vector3 m_boneAxis;
+ private Vector3 m_currentTail;
+
+ private readonly float m_length;
+ private Vector3 m_localDir;
+ private Vector3 m_prevTail;
+
+ public VRMSpringBoneLogic(Transform center, Transform transform, Vector3 localChildPosition)
+ {
+ m_transform = transform;
+ var worldChildPosition = m_transform.TransformPoint(localChildPosition);
+ m_currentTail = center != null
+ ? center.InverseTransformPoint(worldChildPosition)
+ : worldChildPosition;
+ m_prevTail = m_currentTail;
+ LocalRotation = transform.localRotation;
+ m_boneAxis = localChildPosition.normalized;
+ m_length = localChildPosition.magnitude;
+ }
+
+ public Vector3 Tail => m_transform.localToWorldMatrix.MultiplyPoint(m_boneAxis * m_length);
+
+ private Quaternion LocalRotation { get; }
+
+ public float Radius { get; set; }
+
+ private Quaternion ParentRotation =>
+ m_transform.parent != null
+ ? m_transform.parent.rotation
+ : Quaternion.identity;
+
+ public void Update(Transform center,
+ float stiffnessForce, float dragForce, Vector3 external,
+ List<SphereCollider> colliders)
+ {
+ var currentTail = center != null
+ ? center.TransformPoint(m_currentTail)
+ : m_currentTail;
+ var prevTail = center != null
+ ? center.TransformPoint(m_prevTail)
+ : m_prevTail;
+
+ // verlet積分で次の位置を計算
+ var nextTail = currentTail
+ + (currentTail - prevTail) * (1.0f - dragForce) // 前フレームの移動を継続する(減衰もあるよ)
+ + ParentRotation * LocalRotation * m_boneAxis * stiffnessForce // 親の回転による子ボーンの移動目標
+ + external; // 外力による移動量
+
+ // 長さをboneLengthに強制
+ var position = m_transform.position;
+ nextTail = position + (nextTail - position).normalized * m_length;
+
+ // Collisionで移動
+ nextTail = Collision(colliders, nextTail);
+
+ m_prevTail = center != null
+ ? center.InverseTransformPoint(currentTail)
+ : currentTail;
+
+ m_currentTail = center != null
+ ? center.InverseTransformPoint(nextTail)
+ : nextTail;
+
+ //回転を適用
+ m_transform.rotation = ApplyRotation(nextTail);
+ }
+
+ protected virtual Quaternion ApplyRotation(Vector3 nextTail)
+ {
+ var rotation = ParentRotation * LocalRotation;
+ return Quaternion.FromToRotation(rotation * m_boneAxis,
+ nextTail - m_transform.position) * rotation;
+ }
+
+ protected virtual Vector3 Collision(List<SphereCollider> colliders, Vector3 nextTail)
+ {
+ var position = m_transform.position;
+
+ foreach (var collider in colliders)
+ {
+ var ls = collider.transform.lossyScale;
+ var scale = Mathf.Max(ls.x, ls.y, ls.z);
+
+ var r = Radius + collider.radius * scale;
+ var colliderPosition = collider.transform.TransformPoint(collider.center);
+
+ if (Vector3.SqrMagnitude(nextTail - colliderPosition) > r * r) continue;
+
+ // ヒット。Colliderの半径方向に押し出す
+ var normal = (nextTail - colliderPosition).normalized;
+ var posFromCollider = colliderPosition + normal * (Radius + collider.radius * scale);
+
+ // 長さをboneLengthに強制
+ nextTail = position + (posFromCollider - position).normalized * m_length;
+ }
+
+ return nextTail;
+ }
+
+ public void DrawGizmo(Transform center, float radius, Color color)
+ {
+ var currentTail = center != null
+ ? center.TransformPoint(m_currentTail)
+ : m_currentTail;
+ var prevTail = center != null
+ ? center.TransformPoint(m_prevTail)
+ : m_prevTail;
+
+ Gizmos.color = Color.gray;
+ Gizmos.DrawLine(currentTail, prevTail);
+ Gizmos.DrawWireSphere(prevTail, radius);
+
+ Gizmos.color = color;
+ Gizmos.DrawLine(currentTail, m_transform.position);
+ Gizmos.DrawWireSphere(currentTail, radius);
+ }
+ }
+ List<VRMSpringBoneLogic> m_verlet = new List<VRMSpringBoneLogic>();
+
+ void Awake()
+ {
+ Setup();
+ }
+
+ [ContextMenu("Reset bones")]
+ public void Setup(bool force = false)
+ {
+ if (RootBones != null)
+ {
+ if (force || m_initialLocalRotationMap == null)
+ {
+ m_initialLocalRotationMap = new Dictionary<Transform, Quaternion>();
+ }
+ else
+ {
+ foreach (var kv in m_initialLocalRotationMap) kv.Key.localRotation = kv.Value;
+ m_initialLocalRotationMap.Clear();
+ }
+ m_verlet.Clear();
+
+ foreach (var go in RootBones)
+ {
+ if (go != null)
+ {
+ foreach (var x in go.transform.GetComponentsInChildren<Transform>(true)) m_initialLocalRotationMap[x] = x.localRotation;
+
+ SetupRecursive(m_center, go);
+ }
+ }
+ }
+ }
+
+ public void SetLocalRotationsIdentity()
+ {
+ foreach (var verlet in m_verlet) verlet.Head.localRotation = Quaternion.identity;
+ }
+
+ private static IEnumerable<Transform> GetChildren(Transform parent)
+ {
+ for (var i = 0; i < parent.childCount; ++i) yield return parent.GetChild(i);
+ }
+
+ private void SetupRecursive(Transform center, Transform parent)
+ {
+ if (parent.childCount == 0)
+ {
+ var delta = parent.position - parent.parent.position;
+ var childPosition = parent.position + delta.normalized * 0.07f;
+ m_verlet.Add(new VRMSpringBoneLogic(center, parent,
+ parent.worldToLocalMatrix.MultiplyPoint(childPosition)));
+ }
+ else
+ {
+ var firstChild = GetChildren(parent).First();
+ var localPosition = firstChild.localPosition;
+ var scale = firstChild.lossyScale;
+ m_verlet.Add(new VRMSpringBoneLogic(center, parent,
+ new Vector3(
+ localPosition.x * scale.x,
+ localPosition.y * scale.y,
+ localPosition.z * scale.z
+ )))
+ ;
+ }
+
+ foreach (Transform child in parent) SetupRecursive(center, child);
+ }
+
+ void LateUpdate()
+ {
+ if (m_updateType == SpringBoneUpdateType.LateUpdate)
+ {
+ UpdateProcess(Time.deltaTime);
+ }
+ }
+
+ void FixedUpdate()
+ {
+ if (m_updateType == SpringBoneUpdateType.FixedUpdate)
+ {
+ UpdateProcess(Time.fixedDeltaTime);
+ }
+ }
+
+ public struct SphereCollider
+ {
+ public Transform transform;
+ public Vector3 center;
+ public float radius;
+ }
+ private List<SphereCollider> m_colliders = new List<SphereCollider>();
+ private void UpdateProcess(float deltaTime)
+ {
+ if (m_verlet == null || m_verlet.Count == 0)
+ {
+ if (RootBones == null) return;
+
+ Setup();
+ }
+
+ m_colliders.Clear();
+ if (ColliderGroups != null)
+ {
+ foreach (var group in ColliderGroups)
+ {
+ if (group != null)
+ {
+ foreach (var collider in group.Colliders)
+ {
+ m_colliders.Add(new SphereCollider
+ {
+ transform = group.transform,
+ center = group.transform.TransformPoint(collider.Offset),
+ radius = collider.Radius,
+ });
+ }
+ }
+ }
+ }
+
+ var stiffness = m_stiffnessForce * Time.deltaTime;
+ var external = m_gravityDir * (m_gravityPower * Time.deltaTime);
+
+ foreach (var verlet in m_verlet)
+ {
+ verlet.Radius = m_hitRadius;
+ verlet.Update(m_center,
+ stiffness,
+ m_dragForce,
+ external,
+ m_colliders
+ );
+ }
+ }
+
+ private void OnDrawGizmos()
+ {
+ if (!m_drawGizmo) return;
+
+ foreach (var verlet in m_verlet)
+ verlet.DrawGizmo(m_center, m_hitRadius, m_gizmoColor);
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs.meta
new file mode 100644
index 00000000..0efb4ccc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBone.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 00ea06e1753e16f4ca870c39c067c86b
+timeCreated: 1517224588
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs
new file mode 100644
index 00000000..27145ce2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs
@@ -0,0 +1,47 @@
+using System;
+using UnityEngine;
+
+
+namespace VRM
+{
+ #if UNITY_5_5_OR_NEWER
+ [DefaultExecutionOrder(11001)]
+ #endif
+ public class VRMSpringBoneColliderGroup : MonoBehaviour
+ {
+ [Serializable]
+ public class SphereCollider
+ {
+ public Vector3 Offset;
+
+ [Range(0, 1.0f)]
+ public float Radius;
+ }
+
+ [SerializeField]
+ public SphereCollider[] Colliders = new SphereCollider[]{
+ new SphereCollider
+ {
+ Radius=0.1f
+ }
+ };
+
+ [SerializeField]
+ Color m_gizmoColor = Color.magenta;
+
+ private void OnDrawGizmosSelected()
+ {
+ Gizmos.color = m_gizmoColor;
+ Matrix4x4 mat = transform.localToWorldMatrix;
+ Gizmos.matrix = mat * Matrix4x4.Scale(new Vector3(
+ 1.0f / transform.lossyScale.x,
+ 1.0f / transform.lossyScale.y,
+ 1.0f / transform.lossyScale.z
+ ));
+ foreach (var y in Colliders)
+ {
+ Gizmos.DrawWireSphere(y.Offset, y.Radius);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs.meta
new file mode 100644
index 00000000..eeb0dfeb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringBoneColliderGroup.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 646b65a4a57afd34d8c4ed557efb46a5
+timeCreated: 1517984922
+licenseType: Free
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs
new file mode 100644
index 00000000..7d71909f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs
@@ -0,0 +1,267 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UniGLTF;
+using UnityEngine;
+using System.IO;
+using System.Text;
+#if UNITY_EDITOR
+using UnityEditor;
+
+#endif
+
+
+namespace VRM
+{
+ public static class VRMSpringUtility
+ {
+#if UNITY_EDITOR
+
+ #region save
+
+ [MenuItem(VRMVersion.MENU + "/SaveSpringBoneToJSON", validate = true)]
+ static bool SaveSpringBoneToJSONIsEnable()
+ {
+ var root = Selection.activeObject as GameObject;
+ if (root == null)
+ {
+ return false;
+ }
+
+ var animator = root.GetComponent<Animator>();
+ if (animator == null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ [MenuItem(VRMVersion.MENU + "/SaveSpringBoneToJSON")]
+ static void SaveSpringBoneToJSON()
+ {
+ var path = EditorUtility.SaveFilePanel(
+ "Save spring to json",
+ null,
+ "VRMSpring.json",
+ "json");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ var go = Selection.activeObject as GameObject;
+ var root = go.transform;
+ var nodes = root.Traverse().Skip(1).ToList();
+ var spring = new glTF_VRM_SecondaryAnimation();
+ ExportSecondary(root, nodes,
+ spring.colliderGroups.Add,
+ spring.boneGroups.Add
+ );
+
+ File.WriteAllText(path, spring.ToJson());
+ }
+
+ #endregion
+
+ #region load
+
+ [MenuItem(VRMVersion.MENU + "/LoadSpringBoneFromJSON", true)]
+ static bool LoadSpringBoneFromJSONIsEnable()
+ {
+ var root = Selection.activeObject as GameObject;
+ if (root == null)
+ {
+ return false;
+ }
+
+ var animator = root.GetComponent<Animator>();
+ if (animator == null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ [MenuItem(VRMVersion.MENU + "/LoadSpringBoneFromJSON")]
+ static void LoadSpringBoneFromJSON()
+ {
+ var path = EditorUtility.OpenFilePanel(
+ "Load spring from json",
+ null,
+ "json");
+ if (string.IsNullOrEmpty(path))
+ {
+ return;
+ }
+
+ var json = File.ReadAllText(path, Encoding.UTF8);
+ var spring = JsonUtility.FromJson<glTF_VRM_SecondaryAnimation>(json);
+
+ var go = Selection.activeObject as GameObject;
+ var root = go.transform;
+ var nodes = root.Traverse().Skip(1).ToList();
+
+ LoadSecondary(root, nodes, spring);
+ }
+
+ #endregion
+
+#endif
+
+ public static void ExportSecondary(Transform root, List<Transform> nodes,
+ Action<glTF_VRM_SecondaryAnimationColliderGroup> addSecondaryColliderGroup,
+ Action<glTF_VRM_SecondaryAnimationGroup> addSecondaryGroup)
+ {
+ var colliders = new List<VRMSpringBoneColliderGroup>();
+ foreach (var vrmColliderGroup in root.Traverse()
+ .Select(x => x.GetComponent<VRMSpringBoneColliderGroup>())
+ .Where(x => x != null))
+ {
+ colliders.Add(vrmColliderGroup);
+
+ var colliderGroup = new glTF_VRM_SecondaryAnimationColliderGroup
+ {
+ node = nodes.IndexOf(vrmColliderGroup.transform)
+ };
+
+ colliderGroup.colliders = vrmColliderGroup.Colliders.Select(x =>
+ {
+ return new glTF_VRM_SecondaryAnimationCollider
+ {
+ offset = x.Offset,
+ radius = x.Radius,
+ };
+ }).ToList();
+
+ addSecondaryColliderGroup(colliderGroup);
+ }
+
+ foreach (var spring in root.Traverse()
+ .SelectMany(x => x.GetComponents<VRMSpringBone>())
+ .Where(x => x != null))
+ {
+ addSecondaryGroup(new glTF_VRM_SecondaryAnimationGroup
+ {
+ comment = spring.m_comment,
+ center = nodes.IndexOf(spring.m_center),
+ dragForce = spring.m_dragForce,
+ gravityDir = spring.m_gravityDir,
+ gravityPower = spring.m_gravityPower,
+ stiffiness = spring.m_stiffnessForce,
+ hitRadius = spring.m_hitRadius,
+ colliderGroups = spring.ColliderGroups
+ .Select(x => colliders.IndexOf(x))
+ .Where(x => x != -1)
+ .ToArray(),
+ bones = spring.RootBones.Select(x => nodes.IndexOf(x)).ToArray(),
+ });
+ }
+ }
+
+ public static void LoadSecondary(Transform root, List<Transform> nodes,
+ glTF_VRM_SecondaryAnimation secondaryAnimation)
+ {
+ var secondary = root.Find("secondary");
+ if (secondary == null)
+ {
+ secondary = new GameObject("secondary").transform;
+ secondary.SetParent(root, false);
+ }
+
+ // clear components
+ var vrmSpringBones = root.GetComponentsInChildren<VRMSpringBone>();
+ var vrmSpringBoneColliderGroup = root.GetComponentsInChildren<VRMSpringBoneColliderGroup>();
+
+ var length = (vrmSpringBones?.Length ?? 0) + (vrmSpringBoneColliderGroup?.Length ?? 0);
+ var remove = new Component[length];
+
+ var index = 0;
+ if (vrmSpringBones != null)
+ {
+ foreach (var vrmSpringBone in vrmSpringBones)
+ {
+ remove[index++] = vrmSpringBone;
+ }
+ }
+
+ if (vrmSpringBoneColliderGroup != null)
+ {
+ foreach (var vrmSpringBoneCollider in vrmSpringBoneColliderGroup)
+ {
+ remove[index++] = vrmSpringBoneCollider;
+ }
+ }
+
+ foreach (var x in remove)
+ {
+ if (Application.isPlaying)
+ {
+ GameObject.Destroy(x);
+ }
+ else
+ {
+ GameObject.DestroyImmediate(x);
+ }
+ }
+
+ //var secondaryAnimation = context.VRM.extensions.VRM.secondaryAnimation;
+ var colliders = new List<VRMSpringBoneColliderGroup>();
+ foreach (var colliderGroup in secondaryAnimation.colliderGroups)
+ {
+ var vrmGroup = nodes[colliderGroup.node].gameObject.AddComponent<VRMSpringBoneColliderGroup>();
+ vrmGroup.Colliders = colliderGroup.colliders.Select(x =>
+ {
+ return new VRMSpringBoneColliderGroup.SphereCollider
+ {
+ Offset = x.offset,
+ Radius = x.radius
+ };
+ }).ToArray();
+ colliders.Add(vrmGroup);
+ }
+
+ if (secondaryAnimation.boneGroups.Count > 0)
+ {
+ foreach (var boneGroup in secondaryAnimation.boneGroups)
+ {
+ var vrmBoneGroup = secondary.gameObject.AddComponent<VRMSpringBone>();
+ if (boneGroup.center != -1)
+ {
+ vrmBoneGroup.m_center = nodes[boneGroup.center];
+ }
+
+ vrmBoneGroup.m_comment = boneGroup.comment;
+ vrmBoneGroup.m_dragForce = boneGroup.dragForce;
+ vrmBoneGroup.m_gravityDir = boneGroup.gravityDir;
+ vrmBoneGroup.m_gravityPower = boneGroup.gravityPower;
+ vrmBoneGroup.m_hitRadius = boneGroup.hitRadius;
+ vrmBoneGroup.m_stiffnessForce = boneGroup.stiffiness;
+
+ if (boneGroup.colliderGroups != null && boneGroup.colliderGroups.Any())
+ {
+ vrmBoneGroup.ColliderGroups = new VRMSpringBoneColliderGroup[boneGroup.colliderGroups.Length];
+ for (int i = 0; i < boneGroup.colliderGroups.Length; ++i)
+ {
+ var colliderGroup = boneGroup.colliderGroups[i];
+ vrmBoneGroup.ColliderGroups[i] = colliders[colliderGroup];
+ }
+ }
+
+ var boneList = new List<Transform>();
+ foreach (var x in boneGroup.bones)
+ {
+ boneList.Add(nodes[x]);
+ }
+
+ vrmBoneGroup.RootBones = boneList;
+ }
+ }
+ else
+ {
+ secondary.gameObject.AddComponent<VRMSpringBone>();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs.meta
new file mode 100644
index 00000000..773a15d4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/SpringBone/VRMSpringUtility.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 42564d357aca11d4882ab504d7f99166
+timeCreated: 1528358605
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs
new file mode 100644
index 00000000..df2d03a8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs
@@ -0,0 +1,55 @@
+using System;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+namespace VRM
+{
+ public struct Validation
+ {
+ /// <summary>
+ /// エクスポート可能か否か。
+ /// true のメッセージは警告
+ /// false のメッセージはエラー
+ /// </summary>
+ public readonly bool CanExport;
+ public readonly String Message;
+
+ Validation(bool canExport, string message)
+ {
+ CanExport = canExport;
+ Message = message;
+ }
+
+#if UNITY_EDITOR
+ public void DrawGUI()
+ {
+ if (string.IsNullOrEmpty(Message))
+ {
+ return;
+ }
+
+ if (CanExport)
+ {
+ // warning
+ EditorGUILayout.HelpBox(Message, MessageType.Warning);
+ }
+ else
+ {
+ // error
+ EditorGUILayout.HelpBox(Message, MessageType.Error);
+ }
+ }
+#endif
+
+ public static Validation Error(string msg)
+ {
+ return new Validation(false, msg);
+ }
+
+ public static Validation Warning(string msg)
+ {
+ return new Validation(true, msg);
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs.meta b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs.meta
new file mode 100644
index 00000000..b7ff4773
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/UniVRM/Scripts/Validation.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 703726d4973c85447a3bd2ae30c760f0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/VRM.asmdef b/Assets/ThirdParty/VRM/VRM/VRM.asmdef
new file mode 100644
index 00000000..02098b76
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/VRM.asmdef
@@ -0,0 +1,20 @@
+{
+ "name": "VRM",
+ "references": [
+ "MToon",
+ "DepthFirstScheduler",
+ "UniUnlit",
+ "UniHumanoid",
+ "UniJSON",
+ "ShaderProperty.Runtime",
+ "MeshUtility"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": []
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRM/VRM.asmdef.meta b/Assets/ThirdParty/VRM/VRM/VRM.asmdef.meta
new file mode 100644
index 00000000..f675f773
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/VRM.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 05dd262a0c0a2f841b8252c8c3815582
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRM/package.json b/Assets/ThirdParty/VRM/VRM/package.json
new file mode 100644
index 00000000..de9570c4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "com.vrmc.univrm",
+ "version": "0.61.0",
+ "displayName": "VRM",
+ "description": "VRM importer",
+ "unity": "2018.4",
+ "keywords": [
+ "vrm",
+ "importer",
+ "avatar",
+ "vr"
+ ],
+ "author": {
+ "name": "VRM Consortium"
+ },
+ "dependencies": {
+ "com.vrmc.vrmshaders": "0.61.0",
+ "com.vrmc.meshutility": "0.61.0"
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRM/package.json.meta b/Assets/ThirdParty/VRM/VRM/package.json.meta
new file mode 100644
index 00000000..271fbff2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRM/package.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 49de26553a992449a81a8445ac0d865f
+PackageManifestImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders.meta b/Assets/ThirdParty/VRM/VRMShaders.meta
new file mode 100644
index 00000000..83645dcc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 503ae90aee4d0224db69e4e74762223b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md b/Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md
new file mode 100644
index 00000000..ae216065
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md
@@ -0,0 +1,3 @@
+# Changelog
+
+Please refer to the latest release note in [Releases](https://github.com/vrm-c/UniVRM/releases) for all notable changes.
diff --git a/Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md.meta b/Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md.meta
new file mode 100644
index 00000000..69941543
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/CHANGELOG.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 8020a337ceab108438d088a3482a4b90
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/Documentation.meta b/Assets/ThirdParty/VRM/VRMShaders/Documentation.meta
new file mode 100644
index 00000000..f58875e2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/Documentation.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3dd33230757d1984894152dbacf595a6
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md b/Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md
new file mode 100644
index 00000000..8579ce03
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md
@@ -0,0 +1,6 @@
+# VRMShaders
+
+VRM model's supported shaders in Unity:
+
+* MToon
+* UniUnlit \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md.meta b/Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md.meta
new file mode 100644
index 00000000..f3a3cc21
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/Documentation/VRMShaders.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 21fb6bf38127a35498543f81ba8cc2e2
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/LICENSE.md b/Assets/ThirdParty/VRM/VRMShaders/LICENSE.md
new file mode 100644
index 00000000..b1255017
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/LICENSE.md
@@ -0,0 +1,10 @@
+MIT License
+
+Copyright (c) 2020 VRM Consortium
+Copyright (c) 2018 Masataka SUMI for MToon
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/LICENSE.md.meta b/Assets/ThirdParty/VRM/VRMShaders/LICENSE.md.meta
new file mode 100644
index 00000000..7e741cf6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/LICENSE.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 00999fd020bde754ab4ae5f8a5205844
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon.meta
new file mode 100644
index 00000000..7ee8b4e3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ad4e8fc4ac2f50a4d82dc71d012a3596
+folderAsset: yes
+timeCreated: 1521016767
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE b/Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE
new file mode 100644
index 00000000..2b51a7fb
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Masataka SUMI
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE.meta
new file mode 100644
index 00000000..be5656a1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/LICENSE.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2a5e8a5d481e3574b8274fa7ce4bdc2d
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon.meta
new file mode 100644
index 00000000..b5340c31
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 029f110c597b25547ab35b6ed3fc049d
+folderAsset: yes
+timeCreated: 1520006778
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor.meta
new file mode 100644
index 00000000..59203d1f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1b669562c8ecaee4c98c808d3971271b
+folderAsset: yes
+timeCreated: 1514224760
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs
new file mode 100644
index 00000000..5ad360a4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs
@@ -0,0 +1,9 @@
+namespace MToon
+{
+ public enum EditorRotationUnit
+ {
+ Rounds = 0,
+ Degrees = 1,
+ Radians = 2,
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs.meta
new file mode 100644
index 00000000..e31fd653
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorEnums.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 24156f9da0724eb5a159f36c69a7d90a
+timeCreated: 1560622066 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs
new file mode 100644
index 00000000..6e20bb16
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs
@@ -0,0 +1,61 @@
+using System.IO;
+using System.Text.RegularExpressions;
+using UnityEditor;
+using UnityEngine;
+
+namespace MToon
+{
+ public static class EditorUtils
+ {
+ private static string BasePath { get { return Path.Combine(Application.dataPath, "VRM/MToon"); } }
+
+ private static string ShaderFilePath { get { return Path.Combine(BasePath, "MToon/Resources/Shaders/MToon.shader"); } }
+ private static string ReadMeFilePath { get { return Path.Combine(BasePath, "README.md"); } }
+ private static string VersionFilePath { get { return Path.Combine(BasePath, "MToon/Scripts/UtilsVersion.cs"); } }
+
+
+ //[MenuItem("VRM/MToon Version Up")]
+ private static void VerUp(string version)
+ {
+ UpdateShaderFile(version);
+ UpdateReadMeFile(version);
+ UpdateVersionFile(version);
+ }
+
+ private static void UpdateShaderFile(string version)
+ {
+ var file = File.ReadAllText(ShaderFilePath);
+ file = Regex.Replace(
+ file,
+ "(_MToonVersion \\(\"_MToonVersion\", Float\\) = )(\\d+)",
+ "${1}" + version
+ );
+ File.WriteAllText(ShaderFilePath, file);
+ }
+
+ private static void UpdateReadMeFile(string version)
+ {
+ version = "v" + version.Substring(0, version.Length - 1) + "." + version[version.Length - 1];
+
+ var file = File.ReadAllText(ReadMeFilePath);
+ file = Regex.Replace(
+ file,
+ "v(\\d+)\\.(\\d+)",
+ version
+ );
+ File.WriteAllText(ReadMeFilePath, file);
+ }
+
+ private static void UpdateVersionFile(string version)
+ {
+ var file = File.ReadAllText(VersionFilePath);
+ file = Regex.Replace(
+ file,
+ "(public const int VersionNumber = )(\\d+)(;)",
+ "${1}" + version + "${3}"
+ );
+ File.WriteAllText(VersionFilePath, file);
+
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs.meta
new file mode 100644
index 00000000..334cf67a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/EditorUtils.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 531922bb16b74a00b81445116c49b09c
+timeCreated: 1559719559 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef
new file mode 100644
index 00000000..e60398dc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef
@@ -0,0 +1,12 @@
+{
+ "name": "MToon.Editor",
+ "references": [
+ "MToon"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef.meta
new file mode 100644
index 00000000..57face76
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToon.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: dddf8398e965f254cae2d7519d7f67d2
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs
new file mode 100644
index 00000000..871cb44a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs
@@ -0,0 +1,459 @@
+using System;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+namespace MToon
+{
+ public class MToonInspector : ShaderGUI
+ {
+ private const float RoundsToDegree = 360f;
+ private const float RoundsToRadian = (float) Math.PI * 2f;
+
+ private static bool isAdvancedLightingPanelFoldout = false;
+ private static EditorRotationUnit editorRotationUnit = EditorRotationUnit.Rounds;
+
+ private MaterialProperty _version;
+ private MaterialProperty _blendMode;
+ private MaterialProperty _bumpMap;
+ private MaterialProperty _bumpScale;
+ private MaterialProperty _color;
+ private MaterialProperty _cullMode;
+// private MaterialProperty _outlineCullMode;
+ private MaterialProperty _cutoff;
+
+ private MaterialProperty _debugMode;
+ private MaterialProperty _emissionColor;
+ private MaterialProperty _emissionMap;
+ private MaterialProperty _lightColorAttenuation;
+ private MaterialProperty _indirectLightIntensity;
+ private MaterialProperty _mainTex;
+ private MaterialProperty _outlineColor;
+ private MaterialProperty _outlineColorMode;
+ private MaterialProperty _outlineLightingMix;
+ private MaterialProperty _outlineWidth;
+ private MaterialProperty _outlineScaledMaxDistance;
+ private MaterialProperty _outlineWidthMode;
+ private MaterialProperty _outlineWidthTexture;
+ private MaterialProperty _receiveShadowRate;
+ private MaterialProperty _receiveShadowTexture;
+ private MaterialProperty _shadingGradeRate;
+ private MaterialProperty _shadingGradeTexture;
+ private MaterialProperty _shadeColor;
+ private MaterialProperty _shadeShift;
+ private MaterialProperty _shadeTexture;
+ private MaterialProperty _shadeToony;
+ private MaterialProperty _sphereAdd;
+ private MaterialProperty _rimColor;
+ private MaterialProperty _rimTexture;
+ private MaterialProperty _rimLightingMix;
+ private MaterialProperty _rimFresnelPower;
+ private MaterialProperty _rimLift;
+ private MaterialProperty _uvAnimMaskTexture;
+ private MaterialProperty _uvAnimScrollX;
+ private MaterialProperty _uvAnimScrollY;
+ private MaterialProperty _uvAnimRotation;
+
+ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
+ {
+ _version = FindProperty(Utils.PropVersion, properties);
+ _debugMode = FindProperty(Utils.PropDebugMode, properties);
+ _outlineWidthMode = FindProperty(Utils.PropOutlineWidthMode, properties);
+ _outlineColorMode = FindProperty(Utils.PropOutlineColorMode, properties);
+ _blendMode = FindProperty(Utils.PropBlendMode, properties);
+ _cullMode = FindProperty(Utils.PropCullMode, properties);
+// _outlineCullMode = FindProperty(Utils.PropOutlineCullMode, properties);
+ _cutoff = FindProperty(Utils.PropCutoff, properties);
+ _color = FindProperty(Utils.PropColor, properties);
+ _shadeColor = FindProperty(Utils.PropShadeColor, properties);
+ _mainTex = FindProperty(Utils.PropMainTex, properties);
+ _shadeTexture = FindProperty(Utils.PropShadeTexture, properties);
+ _bumpScale = FindProperty(Utils.PropBumpScale, properties);
+ _bumpMap = FindProperty(Utils.PropBumpMap, properties);
+ _receiveShadowRate = FindProperty(Utils.PropReceiveShadowRate, properties);
+ _receiveShadowTexture = FindProperty(Utils.PropReceiveShadowTexture, properties);
+ _shadingGradeRate = FindProperty(Utils.PropShadingGradeRate, properties);
+ _shadingGradeTexture = FindProperty(Utils.PropShadingGradeTexture, properties);
+ _shadeShift = FindProperty(Utils.PropShadeShift, properties);
+ _shadeToony = FindProperty(Utils.PropShadeToony, properties);
+ _lightColorAttenuation = FindProperty(Utils.PropLightColorAttenuation, properties);
+ _indirectLightIntensity = FindProperty(Utils.PropIndirectLightIntensity, properties);
+ _rimColor = FindProperty(Utils.PropRimColor, properties);
+ _rimTexture = FindProperty(Utils.PropRimTexture, properties);
+ _rimLightingMix = FindProperty(Utils.PropRimLightingMix, properties);
+ _rimFresnelPower = FindProperty(Utils.PropRimFresnelPower, properties);
+ _rimLift = FindProperty(Utils.PropRimLift, properties);
+ _sphereAdd = FindProperty(Utils.PropSphereAdd, properties);
+ _emissionColor = FindProperty(Utils.PropEmissionColor, properties);
+ _emissionMap = FindProperty(Utils.PropEmissionMap, properties);
+ _outlineWidthTexture = FindProperty(Utils.PropOutlineWidthTexture, properties);
+ _outlineWidth = FindProperty(Utils.PropOutlineWidth, properties);
+ _outlineScaledMaxDistance = FindProperty(Utils.PropOutlineScaledMaxDistance, properties);
+ _outlineColor = FindProperty(Utils.PropOutlineColor, properties);
+ _outlineLightingMix = FindProperty(Utils.PropOutlineLightingMix, properties);
+ _uvAnimMaskTexture = FindProperty(Utils.PropUvAnimMaskTexture, properties);
+ _uvAnimScrollX = FindProperty(Utils.PropUvAnimScrollX, properties);
+ _uvAnimScrollY = FindProperty(Utils.PropUvAnimScrollY, properties);
+ _uvAnimRotation = FindProperty(Utils.PropUvAnimRotation, properties);
+ var materials = materialEditor.targets.Select(x => x as Material).ToArray();
+ Draw(materialEditor, materials);
+ }
+
+ private void Draw(MaterialEditor materialEditor, Material[] materials)
+ {
+ EditorGUI.BeginChangeCheck();
+ {
+ _version.floatValue = Utils.VersionNumber;
+
+ EditorGUILayout.LabelField("Rendering", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ EditorGUILayout.LabelField("Mode", EditorStyles.boldLabel);
+ if (PopupEnum<RenderMode>("Rendering Type", _blendMode, materialEditor))
+ {
+ ModeChanged(materials, isBlendModeChangedByUser: true);
+ }
+
+ if ((RenderMode) _blendMode.floatValue == RenderMode.TransparentWithZWrite)
+ {
+ EditorGUILayout.HelpBox("TransparentWithZWrite mode can cause problems with rendering.", MessageType.Warning);
+ }
+
+ if (PopupEnum<CullMode>("Cull Mode", _cullMode, materialEditor))
+ {
+ ModeChanged(materials);
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Color", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ EditorGUILayout.LabelField("Texture", EditorStyles.boldLabel);
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Lit Color, Alpha", "Lit (RGB), Alpha (A)"),
+ _mainTex, _color);
+
+ materialEditor.TexturePropertySingleLine(new GUIContent("Shade Color", "Shade (RGB)"), _shadeTexture,
+ _shadeColor);
+ }
+ var bm = (RenderMode) _blendMode.floatValue;
+ if (bm == RenderMode.Cutout)
+ {
+ EditorGUILayout.Space();
+ EditorGUILayout.LabelField("Alpha", EditorStyles.boldLabel);
+ {
+ materialEditor.ShaderProperty(_cutoff, "Cutoff");
+ }
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Lighting", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ {
+ materialEditor.ShaderProperty(_shadeToony,
+ new GUIContent("Shading Toony",
+ "0.0 is Lambert. Higher value get toony shading."));
+
+ // Normal
+ EditorGUI.BeginChangeCheck();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Normal Map [Normal]", "Normal Map (RGB)"),
+ _bumpMap,
+ _bumpScale);
+ if (EditorGUI.EndChangeCheck())
+ {
+ materialEditor.RegisterPropertyChangeUndo("BumpEnabledDisabled");
+ ModeChanged(materials);
+ }
+ }
+ EditorGUILayout.Space();
+
+ EditorGUI.indentLevel++;
+ {
+ isAdvancedLightingPanelFoldout = EditorGUILayout.Foldout(isAdvancedLightingPanelFoldout, "Advanced Settings", EditorStyles.boldFont);
+
+ if (isAdvancedLightingPanelFoldout)
+ {
+ EditorGUILayout.BeginHorizontal();
+ EditorGUILayout.HelpBox(
+ "The default settings are suitable for Advanced Settings if you want to toony result.",
+ MessageType.Info);
+ if (GUILayout.Button("Use Default"))
+ {
+ _shadeShift.floatValue = 0;
+ _receiveShadowTexture.textureValue = null;
+ _receiveShadowRate.floatValue = 1;
+ _shadingGradeTexture.textureValue = null;
+ _shadingGradeRate.floatValue = 1;
+ _lightColorAttenuation.floatValue = 0;
+ _indirectLightIntensity.floatValue = 0.1f;
+ }
+ EditorGUILayout.EndHorizontal();
+
+ materialEditor.ShaderProperty(_shadeShift,
+ new GUIContent("Shading Shift",
+ "Zero is Default. Negative value increase lit area. Positive value increase shade area."));
+ materialEditor.TexturePropertySingleLine(
+ new GUIContent("Shadow Receive Multiplier",
+ "Texture (R) * Rate. White is Default. Black attenuates shadows."),
+ _receiveShadowTexture,
+ _receiveShadowRate);
+ materialEditor.TexturePropertySingleLine(
+ new GUIContent("Lit & Shade Mixing Multiplier",
+ "Texture (R) * Rate. Compatible with UTS2 ShadingGradeMap. White is Default. Black amplifies shade."),
+ _shadingGradeTexture,
+ _shadingGradeRate);
+ materialEditor.ShaderProperty(_lightColorAttenuation, "LightColor Attenuation");
+ materialEditor.ShaderProperty(_indirectLightIntensity, "GI Intensity");
+ }
+ }
+ EditorGUI.indentLevel--;
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Emission", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ TextureWithHdrColor(materialEditor, "Emission", "Emission (RGB)",
+ _emissionMap, _emissionColor);
+
+ materialEditor.TexturePropertySingleLine(new GUIContent("MatCap", "MatCap Texture (RGB)"),
+ _sphereAdd);
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Rim", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ TextureWithHdrColor(materialEditor, "Color", "Rim Color (RGB)",
+ _rimTexture, _rimColor);
+
+ materialEditor.DefaultShaderProperty(_rimLightingMix, "Lighting Mix");
+
+ materialEditor.ShaderProperty(_rimFresnelPower,
+ new GUIContent("Fresnel Power",
+ "If you increase this value, you get sharpness rim light."));
+
+ materialEditor.ShaderProperty(_rimLift,
+ new GUIContent("Lift",
+ "If you increase this value, you can lift rim light."));
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+
+ EditorGUILayout.LabelField("Outline", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ // Outline
+ EditorGUILayout.LabelField("Width", EditorStyles.boldLabel);
+ {
+ if (PopupEnum<OutlineWidthMode>("Mode", _outlineWidthMode, materialEditor))
+ {
+ ModeChanged(materials);
+ }
+
+ if ((RenderMode) _blendMode.floatValue == RenderMode.Transparent &&
+ (OutlineWidthMode) _outlineWidthMode.floatValue != OutlineWidthMode.None)
+ {
+ EditorGUILayout.HelpBox("Outline with Transparent material cause problem with rendering.", MessageType.Warning);
+ }
+
+ var widthMode = (OutlineWidthMode) _outlineWidthMode.floatValue;
+ if (widthMode != OutlineWidthMode.None)
+ {
+ materialEditor.TexturePropertySingleLine(
+ new GUIContent("Width", "Outline Width Texture (RGB)"),
+ _outlineWidthTexture, _outlineWidth);
+ }
+
+ if (widthMode == OutlineWidthMode.ScreenCoordinates)
+ {
+ materialEditor.ShaderProperty(_outlineScaledMaxDistance, "Width Scaled Max Distance");
+ }
+ }
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Color", EditorStyles.boldLabel);
+ {
+ var widthMode = (OutlineWidthMode) _outlineWidthMode.floatValue;
+ if (widthMode != OutlineWidthMode.None)
+ {
+ EditorGUI.BeginChangeCheck();
+
+ if (PopupEnum<OutlineColorMode>("Mode", _outlineColorMode, materialEditor))
+ {
+ ModeChanged(materials);
+ }
+
+ var colorMode = (OutlineColorMode) _outlineColorMode.floatValue;
+
+ materialEditor.ShaderProperty(_outlineColor, "Color");
+ if (colorMode == OutlineColorMode.MixedLighting)
+ materialEditor.DefaultShaderProperty(_outlineLightingMix, "Lighting Mix");
+ }
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+
+ EditorGUILayout.LabelField("UV Coordinates", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ // UV
+ EditorGUILayout.LabelField("Scale & Offset", EditorStyles.boldLabel);
+ {
+ materialEditor.TextureScaleOffsetProperty(_mainTex);
+ }
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Auto Animation", EditorStyles.boldLabel);
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Mask", "Auto Animation Mask Texture (R)"), _uvAnimMaskTexture);
+ materialEditor.ShaderProperty(_uvAnimScrollX, "Scroll X (per second)");
+ materialEditor.ShaderProperty(_uvAnimScrollY, "Scroll Y (per second)");
+
+ {
+ var control = EditorGUILayout.GetControlRect(hasLabel: true);
+ const int popupMargin = 5;
+ const int popupWidth = 80;
+
+ var floatControl = new Rect(control);
+ floatControl.width -= popupMargin + popupWidth;
+ var popupControl = new Rect(control);
+ popupControl.x = floatControl.x + floatControl.width + popupMargin;
+ popupControl.width = popupWidth;
+
+ EditorGUI.BeginChangeCheck();
+ var inspectorRotationValue = GetInspectorRotationValue(editorRotationUnit, _uvAnimRotation.floatValue);
+ inspectorRotationValue = EditorGUI.FloatField(floatControl, "Rotation value (per second)", inspectorRotationValue);
+ if (EditorGUI.EndChangeCheck())
+ {
+ materialEditor.RegisterPropertyChangeUndo("UvAnimRotationValueChanged");
+ _uvAnimRotation.floatValue = GetRawRotationValue(editorRotationUnit, inspectorRotationValue);
+ }
+ editorRotationUnit = (EditorRotationUnit) EditorGUI.EnumPopup(popupControl, editorRotationUnit);
+ }
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+
+
+ EditorGUILayout.LabelField("Options", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ EditorGUILayout.LabelField("Debugging Options", EditorStyles.boldLabel);
+ {
+ if (PopupEnum<DebugMode>("Visualize", _debugMode, materialEditor))
+ {
+ ModeChanged(materials);
+ }
+ }
+ EditorGUILayout.Space();
+
+ EditorGUILayout.LabelField("Advanced Options", EditorStyles.boldLabel);
+ {
+#if UNITY_5_6_OR_NEWER
+// materialEditor.EnableInstancingField();
+ materialEditor.DoubleSidedGIField();
+#endif
+ EditorGUI.BeginChangeCheck();
+ materialEditor.RenderQueueField();
+ if (EditorGUI.EndChangeCheck())
+ {
+ ModeChanged(materials);
+ }
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+ }
+ EditorGUI.EndChangeCheck();
+ }
+
+ public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
+ {
+ base.AssignNewShaderToMaterial(material, oldShader, newShader);
+
+ Utils.ValidateProperties(material, isBlendModeChangedByUser: true);
+ }
+
+ private static void ModeChanged(Material[] materials, bool isBlendModeChangedByUser = false)
+ {
+ foreach (var material in materials)
+ {
+ Utils.ValidateProperties(material, isBlendModeChangedByUser);
+ }
+ }
+
+ private static bool PopupEnum<T>(string name, MaterialProperty property, MaterialEditor editor) where T : struct
+ {
+ EditorGUI.showMixedValue = property.hasMixedValue;
+ EditorGUI.BeginChangeCheck();
+ var ret = EditorGUILayout.Popup(name, (int) property.floatValue, Enum.GetNames(typeof(T)));
+ var changed = EditorGUI.EndChangeCheck();
+ if (changed)
+ {
+ editor.RegisterPropertyChangeUndo("EnumPopUp");
+ property.floatValue = ret;
+ }
+
+ EditorGUI.showMixedValue = false;
+ return changed;
+ }
+
+ private static void TextureWithHdrColor(MaterialEditor materialEditor, string label, string description,
+ MaterialProperty texProp, MaterialProperty colorProp)
+ {
+ materialEditor.TexturePropertyWithHDRColor(new GUIContent(label, description),
+ texProp,
+ colorProp,
+#if UNITY_2018_1_OR_NEWER
+#else
+ new ColorPickerHDRConfig(minBrightness: 0, maxBrightness: 10, minExposureValue: -10,
+ maxExposureValue: 10),
+#endif
+ showAlpha: false);
+
+ }
+
+ private static float GetRawRotationValue(EditorRotationUnit unit, float inspectorValue)
+ {
+ switch (unit)
+ {
+ case EditorRotationUnit.Rounds:
+ return inspectorValue;
+ case EditorRotationUnit.Degrees:
+ return inspectorValue / RoundsToDegree;
+ case EditorRotationUnit.Radians:
+ return inspectorValue / RoundsToRadian;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ private static float GetInspectorRotationValue(EditorRotationUnit unit, float rawValue)
+ {
+ switch (unit)
+ {
+ case EditorRotationUnit.Rounds:
+ return rawValue;
+ case EditorRotationUnit.Degrees:
+ return rawValue * RoundsToDegree;
+ case EditorRotationUnit.Radians:
+ return rawValue * RoundsToRadian;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs.meta
new file mode 100644
index 00000000..cfe69321
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Editor/MToonInspector.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8b43baa9f62f04748bb167ad186f1b1a
+timeCreated: 1514224771
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef
new file mode 100644
index 00000000..e5f1f925
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef
@@ -0,0 +1,3 @@
+{
+ "name": "MToon"
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef.meta
new file mode 100644
index 00000000..4daa4ce3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/MToon.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a9bc101fb0471f94a8f99fd242fdd934
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources.meta
new file mode 100644
index 00000000..f1a215fd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9491ac346386a2b4e9f3c801c6786818
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders.meta
new file mode 100644
index 00000000..09aef816
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 221dcd8025c13ab42a51e886d7a7a92e
+folderAsset: yes
+timeCreated: 1516295202
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader
new file mode 100644
index 00000000..496ac558
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader
@@ -0,0 +1,166 @@
+Shader "VRM/MToon"
+{
+ Properties
+ {
+ _Cutoff ("Alpha Cutoff", Range(0, 1)) = 0.5
+ _Color ("Lit Color + Alpha", Color) = (1,1,1,1)
+ _ShadeColor ("Shade Color", Color) = (0.97, 0.81, 0.86, 1)
+ [NoScaleOffset] _MainTex ("Lit Texture + Alpha", 2D) = "white" {}
+ [NoScaleOffset] _ShadeTexture ("Shade Texture", 2D) = "white" {}
+ _BumpScale ("Normal Scale", Float) = 1.0
+ [Normal] _BumpMap ("Normal Texture", 2D) = "bump" {}
+ _ReceiveShadowRate ("Receive Shadow", Range(0, 1)) = 1
+ [NoScaleOffset] _ReceiveShadowTexture ("Receive Shadow Texture", 2D) = "white" {}
+ _ShadingGradeRate ("Shading Grade", Range(0, 1)) = 1
+ [NoScaleOffset] _ShadingGradeTexture ("Shading Grade Texture", 2D) = "white" {}
+ _ShadeShift ("Shade Shift", Range(-1, 1)) = 0
+ _ShadeToony ("Shade Toony", Range(0, 1)) = 0.9
+ _LightColorAttenuation ("Light Color Attenuation", Range(0, 1)) = 0
+ _IndirectLightIntensity ("Indirect Light Intensity", Range(0, 1)) = 0.1
+ [HDR] _RimColor ("Rim Color", Color) = (0,0,0)
+ [NoScaleOffset] _RimTexture ("Rim Texture", 2D) = "white" {}
+ _RimLightingMix ("Rim Lighting Mix", Range(0, 1)) = 0
+ [PowerSlider(4.0)] _RimFresnelPower ("Rim Fresnel Power", Range(0, 100)) = 1
+ _RimLift ("Rim Lift", Range(0, 1)) = 0
+ [NoScaleOffset] _SphereAdd ("Sphere Texture(Add)", 2D) = "black" {}
+ [HDR] _EmissionColor ("Color", Color) = (0,0,0)
+ [NoScaleOffset] _EmissionMap ("Emission", 2D) = "white" {}
+ [NoScaleOffset] _OutlineWidthTexture ("Outline Width Tex", 2D) = "white" {}
+ _OutlineWidth ("Outline Width", Range(0.01, 1)) = 0.5
+ _OutlineScaledMaxDistance ("Outline Scaled Max Distance", Range(1, 10)) = 1
+ _OutlineColor ("Outline Color", Color) = (0,0,0,1)
+ _OutlineLightingMix ("Outline Lighting Mix", Range(0, 1)) = 1
+ [NoScaleOffset] _UvAnimMaskTexture ("UV Animation Mask", 2D) = "white" {}
+ _UvAnimScrollX ("UV Animation Scroll X", Float) = 0
+ _UvAnimScrollY ("UV Animation Scroll Y", Float) = 0
+ _UvAnimRotation ("UV Animation Rotation", Float) = 0
+
+ [HideInInspector] _MToonVersion ("_MToonVersion", Float) = 34
+ [HideInInspector] _DebugMode ("_DebugMode", Float) = 0.0
+ [HideInInspector] _BlendMode ("_BlendMode", Float) = 0.0
+ [HideInInspector] _OutlineWidthMode ("_OutlineWidthMode", Float) = 0.0
+ [HideInInspector] _OutlineColorMode ("_OutlineColorMode", Float) = 0.0
+ [HideInInspector] _CullMode ("_CullMode", Float) = 2.0
+ [HideInInspector] _OutlineCullMode ("_OutlineCullMode", Float) = 1.0
+ [HideInInspector] _SrcBlend ("_SrcBlend", Float) = 1.0
+ [HideInInspector] _DstBlend ("_DstBlend", Float) = 0.0
+ [HideInInspector] _ZWrite ("_ZWrite", Float) = 1.0
+ [HideInInspector] _AlphaToMask ("_AlphaToMask", Float) = 0.0
+ }
+
+ // for SM 3.0
+ SubShader
+ {
+ Tags { "RenderType" = "Opaque" "Queue" = "Geometry" }
+
+ // Forward Base
+ Pass
+ {
+ Name "FORWARD_BASE"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Cull [_CullMode]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ ZTest LEqual
+ BlendOp Add, Max
+ AlphaToMask [_AlphaToMask]
+
+ CGPROGRAM
+ #pragma target 3.0
+ #pragma shader_feature _ MTOON_DEBUG_NORMAL MTOON_DEBUG_LITSHADERATE
+ #pragma multi_compile _ _NORMALMAP
+ #pragma multi_compile _ _ALPHATEST_ON _ALPHABLEND_ON
+ #include "./MToonSM3.cginc"
+ #pragma vertex vert_forward_base
+ #pragma fragment frag_forward
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_fog
+// #pragma multi_compile_instancing
+ ENDCG
+ }
+
+
+ // Forward Base Outline Pass
+ Pass
+ {
+ Name "FORWARD_BASE_ONLY_OUTLINE"
+ Tags { "LightMode" = "ForwardBase" }
+
+ Cull [_OutlineCullMode]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ ZTest LEqual
+ Offset 1, 1
+ BlendOp Add, Max
+ AlphaToMask [_AlphaToMask]
+
+ CGPROGRAM
+ #pragma target 3.0
+ #pragma shader_feature _ MTOON_DEBUG_NORMAL MTOON_DEBUG_LITSHADERATE
+ #pragma multi_compile _ MTOON_OUTLINE_WIDTH_WORLD MTOON_OUTLINE_WIDTH_SCREEN
+ #pragma multi_compile _ MTOON_OUTLINE_COLOR_FIXED MTOON_OUTLINE_COLOR_MIXED
+ #pragma multi_compile _ _NORMALMAP
+ #pragma multi_compile _ _ALPHATEST_ON _ALPHABLEND_ON
+ #define MTOON_CLIP_IF_OUTLINE_IS_NONE
+ #include "./MToonSM3.cginc"
+ #pragma vertex vert_forward_base_outline
+ #pragma fragment frag_forward
+ #pragma multi_compile_fwdbase
+ #pragma multi_compile_fog
+// #pragma multi_compile_instancing
+ ENDCG
+ }
+
+
+ // Forward Add
+ Pass
+ {
+ Name "FORWARD_ADD"
+ Tags { "LightMode" = "ForwardAdd" }
+
+ Cull [_CullMode]
+ Blend [_SrcBlend] One
+ ZWrite Off
+ ZTest LEqual
+ BlendOp Add, Max
+ AlphaToMask [_AlphaToMask]
+
+ CGPROGRAM
+ #pragma target 3.0
+ #pragma shader_feature _ MTOON_DEBUG_NORMAL MTOON_DEBUG_LITSHADERATE
+ #pragma multi_compile _ _NORMALMAP
+ #pragma multi_compile _ _ALPHATEST_ON _ALPHABLEND_ON
+ #define MTOON_FORWARD_ADD
+ #include "./MToonSM3.cginc"
+ #pragma vertex vert_forward_add
+ #pragma fragment frag_forward
+ #pragma multi_compile_fwdadd_fullshadows
+ #pragma multi_compile_fog
+ ENDCG
+ }
+
+ // Shadow rendering pass
+ Pass
+ {
+ Name "ShadowCaster"
+ Tags { "LightMode" = "ShadowCaster" }
+
+ Cull [_CullMode]
+ ZWrite On
+ ZTest LEqual
+
+ CGPROGRAM
+ #pragma target 3.0
+ #pragma multi_compile _ _ALPHATEST_ON _ALPHABLEND_ON
+ #pragma multi_compile_shadowcaster
+ #pragma vertex vertShadowCaster
+ #pragma fragment fragShadowCaster
+ #include "UnityStandardShadow.cginc"
+ ENDCG
+ }
+ }
+
+ Fallback "Unlit/Texture"
+ CustomEditor "MToon.MToonInspector"
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader.meta
new file mode 100644
index 00000000..dfa84505
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToon.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1a97144e4ad27a04aafd70f7b915cedb
+timeCreated: 1514111466
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc
new file mode 100644
index 00000000..c628eed3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc
@@ -0,0 +1,279 @@
+#ifndef MTOON_CORE_INCLUDED
+#define MTOON_CORE_INCLUDED
+
+#include "Lighting.cginc"
+#include "AutoLight.cginc"
+
+half _Cutoff;
+fixed4 _Color;
+fixed4 _ShadeColor;
+sampler2D _MainTex; float4 _MainTex_ST;
+sampler2D _ShadeTexture;
+half _BumpScale;
+sampler2D _BumpMap;
+sampler2D _ReceiveShadowTexture;
+half _ReceiveShadowRate;
+sampler2D _ShadingGradeTexture;
+half _ShadingGradeRate;
+half _ShadeShift;
+half _ShadeToony;
+half _LightColorAttenuation;
+half _IndirectLightIntensity;
+sampler2D _RimTexture;
+half4 _RimColor;
+half _RimLightingMix;
+half _RimFresnelPower;
+half _RimLift;
+sampler2D _SphereAdd;
+half4 _EmissionColor;
+sampler2D _EmissionMap;
+sampler2D _OutlineWidthTexture;
+half _OutlineWidth;
+half _OutlineScaledMaxDistance;
+fixed4 _OutlineColor;
+half _OutlineLightingMix;
+sampler2D _UvAnimMaskTexture;
+float _UvAnimScrollX;
+float _UvAnimScrollY;
+float _UvAnimRotation;
+
+//UNITY_INSTANCING_BUFFER_START(Props)
+//UNITY_INSTANCING_BUFFER_END(Props)
+
+struct v2f
+{
+ float4 pos : SV_POSITION;
+ float4 posWorld : TEXCOORD0;
+ half3 tspace0 : TEXCOORD1;
+ half3 tspace1 : TEXCOORD2;
+ half3 tspace2 : TEXCOORD3;
+ float2 uv0 : TEXCOORD4;
+ float isOutline : TEXCOORD5;
+ fixed4 color : TEXCOORD6;
+ UNITY_FOG_COORDS(7)
+ SHADOW_COORDS(8)
+ //UNITY_VERTEX_INPUT_INSTANCE_ID // necessary only if any instanced properties are going to be accessed in the fragment Shader.
+};
+
+inline v2f InitializeV2F(appdata_full v, float4 projectedVertex, float isOutline)
+{
+ v2f o;
+ UNITY_INITIALIZE_OUTPUT(v2f, o);
+ UNITY_SETUP_INSTANCE_ID(v);
+ //UNITY_TRANSFER_INSTANCE_ID(v, o);
+
+ o.pos = projectedVertex;
+ o.posWorld = mul(unity_ObjectToWorld, v.vertex);
+ o.uv0 = v.texcoord;
+ half3 worldNormal = UnityObjectToWorldNormal(v.normal);
+ half3 worldTangent = UnityObjectToWorldDir(v.tangent);
+ half tangentSign = v.tangent.w * unity_WorldTransformParams.w;
+ half3 worldBitangent = cross(worldNormal, worldTangent) * tangentSign;
+ o.tspace0 = half3(worldTangent.x, worldBitangent.x, worldNormal.x);
+ o.tspace1 = half3(worldTangent.y, worldBitangent.y, worldNormal.y);
+ o.tspace2 = half3(worldTangent.z, worldBitangent.z, worldNormal.z);
+ o.isOutline = isOutline;
+ o.color = v.color;
+ TRANSFER_SHADOW(o);
+ UNITY_TRANSFER_FOG(o, o.pos);
+ return o;
+}
+
+inline float4 CalculateOutlineVertexClipPosition(appdata_full v)
+{
+ float outlineTex = tex2Dlod(_OutlineWidthTexture, float4(TRANSFORM_TEX(v.texcoord, _MainTex), 0, 0)).r;
+
+ #if defined(MTOON_OUTLINE_WIDTH_WORLD)
+ float3 worldNormalLength = length(mul((float3x3)transpose(unity_WorldToObject), v.normal));
+ float3 outlineOffset = 0.01 * _OutlineWidth * outlineTex * worldNormalLength * v.normal;
+ float4 vertex = UnityObjectToClipPos(v.vertex + outlineOffset);
+ #elif defined(MTOON_OUTLINE_WIDTH_SCREEN)
+ float4 nearUpperRight = mul(unity_CameraInvProjection, float4(1, 1, UNITY_NEAR_CLIP_VALUE, _ProjectionParams.y));
+ float aspect = abs(nearUpperRight.y / nearUpperRight.x);
+ float4 vertex = UnityObjectToClipPos(v.vertex);
+ float3 viewNormal = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal.xyz);
+ float3 clipNormal = TransformViewToProjection(viewNormal.xyz);
+ float2 projectedNormal = normalize(clipNormal.xy);
+ projectedNormal *= min(vertex.w, _OutlineScaledMaxDistance);
+ projectedNormal.x *= aspect;
+ vertex.xy += 0.01 * _OutlineWidth * outlineTex * projectedNormal.xy * saturate(1 - abs(normalize(viewNormal).z)); // ignore offset when normal toward camera
+ #else
+ float4 vertex = UnityObjectToClipPos(v.vertex);
+ #endif
+ return vertex;
+}
+
+float4 frag_forward(v2f i) : SV_TARGET
+{
+#ifdef MTOON_CLIP_IF_OUTLINE_IS_NONE
+ #ifdef MTOON_OUTLINE_WIDTH_WORLD
+ #elif MTOON_OUTLINE_WIDTH_SCREEN
+ #else
+ clip(-1);
+ #endif
+#endif
+
+ //UNITY_TRANSFER_INSTANCE_ID(v, o);
+
+ // const
+ const float PI_2 = 6.28318530718;
+ const float EPS_COL = 0.00001;
+
+ // uv
+ float2 mainUv = TRANSFORM_TEX(i.uv0, _MainTex);
+
+ // uv anim
+ float uvAnim = tex2D(_UvAnimMaskTexture, mainUv).r * _Time.y;
+ // translate uv in bottom-left origin coordinates.
+ mainUv += float2(_UvAnimScrollX, _UvAnimScrollY) * uvAnim;
+ // rotate uv counter-clockwise around (0.5, 0.5) in bottom-left origin coordinates.
+ float rotateRad = _UvAnimRotation * PI_2 * uvAnim;
+ const float2 rotatePivot = float2(0.5, 0.5);
+ mainUv = mul(float2x2(cos(rotateRad), -sin(rotateRad), sin(rotateRad), cos(rotateRad)), mainUv - rotatePivot) + rotatePivot;
+
+ // main tex
+ half4 mainTex = tex2D(_MainTex, mainUv);
+
+ // alpha
+ half alpha = 1;
+#ifdef _ALPHATEST_ON
+ alpha = _Color.a * mainTex.a;
+ alpha = (alpha - _Cutoff) / max(fwidth(alpha), EPS_COL) + 0.5; // Alpha to Coverage
+ clip(alpha - _Cutoff);
+ alpha = 1.0; // Discarded, otherwise it should be assumed to have full opacity
+#endif
+#ifdef _ALPHABLEND_ON
+ alpha = _Color.a * mainTex.a;
+#endif
+
+ // normal
+#ifdef _NORMALMAP
+ half3 tangentNormal = UnpackScaleNormal(tex2D(_BumpMap, mainUv), _BumpScale);
+ half3 worldNormal;
+ worldNormal.x = dot(i.tspace0, tangentNormal);
+ worldNormal.y = dot(i.tspace1, tangentNormal);
+ worldNormal.z = dot(i.tspace2, tangentNormal);
+#else
+ half3 worldNormal = half3(i.tspace0.z, i.tspace1.z, i.tspace2.z);
+#endif
+ float3 worldView = normalize(lerp(_WorldSpaceCameraPos.xyz - i.posWorld.xyz, UNITY_MATRIX_V[2].xyz, unity_OrthoParams.w));
+ worldNormal *= step(0, dot(worldView, worldNormal)) * 2 - 1; // flip if projection matrix is flipped
+ worldNormal *= lerp(+1.0, -1.0, i.isOutline);
+ worldNormal = normalize(worldNormal);
+
+ // Unity lighting
+ UNITY_LIGHT_ATTENUATION(shadowAttenuation, i, i.posWorld.xyz);
+ half3 lightDir = lerp(_WorldSpaceLightPos0.xyz, normalize(_WorldSpaceLightPos0.xyz - i.posWorld.xyz), _WorldSpaceLightPos0.w);
+ half3 lightColor = _LightColor0.rgb * step(0.5, length(lightDir)); // length(lightDir) is zero if directional light is disabled.
+ half dotNL = dot(lightDir, worldNormal);
+#ifdef MTOON_FORWARD_ADD
+ half lightAttenuation = 1;
+#else
+ half lightAttenuation = shadowAttenuation * lerp(1, shadowAttenuation, _ReceiveShadowRate * tex2D(_ReceiveShadowTexture, mainUv).r);
+#endif
+
+ // Decide albedo color rate from Direct Light
+ half shadingGrade = 1.0 - _ShadingGradeRate * (1.0 - tex2D(_ShadingGradeTexture, mainUv).r);
+ half lightIntensity = dotNL; // [-1, +1]
+ lightIntensity = lightIntensity * 0.5 + 0.5; // from [-1, +1] to [0, 1]
+ lightIntensity = lightIntensity * lightAttenuation; // receive shadow
+ lightIntensity = lightIntensity * shadingGrade; // darker
+ lightIntensity = lightIntensity * 2.0 - 1.0; // from [0, 1] to [-1, +1]
+ // tooned. mapping from [minIntensityThreshold, maxIntensityThreshold] to [0, 1]
+ half maxIntensityThreshold = lerp(1, _ShadeShift, _ShadeToony);
+ half minIntensityThreshold = _ShadeShift;
+ lightIntensity = saturate((lightIntensity - minIntensityThreshold) / max(EPS_COL, (maxIntensityThreshold - minIntensityThreshold)));
+
+ // Albedo color
+ half4 shade = _ShadeColor * tex2D(_ShadeTexture, mainUv);
+ half4 lit = _Color * mainTex;
+ half3 col = lerp(shade.rgb, lit.rgb, lightIntensity);
+
+ // Direct Light
+ half3 lighting = lightColor;
+ lighting = lerp(lighting, max(EPS_COL, max(lighting.x, max(lighting.y, lighting.z))), _LightColorAttenuation); // color atten
+#ifdef MTOON_FORWARD_ADD
+#ifdef _ALPHABLEND_ON
+ lighting *= step(0, dotNL); // darken if transparent. Because Unity's transparent material can't receive shadowAttenuation.
+#endif
+ lighting *= 0.5; // darken if additional light.
+ lighting *= min(0, dotNL) + 1; // darken dotNL < 0 area by using half lambert
+ lighting *= shadowAttenuation; // darken if receiving shadow
+#else
+ // base light does not darken.
+#endif
+ col *= lighting;
+
+ // Indirect Light
+#ifdef MTOON_FORWARD_ADD
+#else
+ half3 toonedGI = 0.5 * (ShadeSH9(half4(0, 1, 0, 1)) + ShadeSH9(half4(0, -1, 0, 1)));
+ half3 indirectLighting = lerp(toonedGI, ShadeSH9(half4(worldNormal, 1)), _IndirectLightIntensity);
+ indirectLighting = lerp(indirectLighting, max(EPS_COL, max(indirectLighting.x, max(indirectLighting.y, indirectLighting.z))), _LightColorAttenuation); // color atten
+ col += indirectLighting * lit;
+
+ col = min(col, lit); // comment out if you want to PBR absolutely.
+#endif
+
+ // parametric rim lighting
+#ifdef MTOON_FORWARD_ADD
+ half3 staticRimLighting = 0;
+ half3 mixedRimLighting = lighting;
+#else
+ half3 staticRimLighting = 1;
+ half3 mixedRimLighting = lighting + indirectLighting;
+#endif
+ half3 rimLighting = lerp(staticRimLighting, mixedRimLighting, _RimLightingMix);
+ half3 rim = pow(saturate(1.0 - dot(worldNormal, worldView) + _RimLift), _RimFresnelPower) * _RimColor.rgb * tex2D(_RimTexture, mainUv).rgb;
+ col += lerp(rim * rimLighting, half3(0, 0, 0), i.isOutline);
+
+
+ //c ԵmatcapʵֵģտʼsimLightûѵrimlightǺ
+ // additive matcap
+#ifdef MTOON_FORWARD_ADD
+#else
+ half3 worldCameraUp = normalize(UNITY_MATRIX_V[1].xyz);
+ half3 worldViewUp = normalize(worldCameraUp - worldView * dot(worldView, worldCameraUp));
+ half3 worldViewRight = normalize(cross(worldView, worldViewUp));
+ half2 matcapUv = half2(dot(worldViewRight, worldNormal), dot(worldViewUp, worldNormal)) * 0.5 + 0.5;
+ half3 matcapLighting = tex2D(_SphereAdd, matcapUv);
+ col += lerp(matcapLighting, half3(0, 0, 0), i.isOutline);
+#endif
+
+ // Emission
+#ifdef MTOON_FORWARD_ADD
+#else
+ half3 emission = tex2D(_EmissionMap, mainUv).rgb * _EmissionColor.rgb;
+ col += lerp(emission, half3(0, 0, 0), i.isOutline);
+#endif
+
+ // outline
+#ifdef MTOON_OUTLINE_COLOR_FIXED
+ col = lerp(col, _OutlineColor, i.isOutline);
+#elif MTOON_OUTLINE_COLOR_MIXED
+ col = lerp(col, _OutlineColor * lerp(half3(1, 1, 1), col, _OutlineLightingMix), i.isOutline);
+#else
+#endif
+
+ // debug
+#ifdef MTOON_DEBUG_NORMAL
+ #ifdef MTOON_FORWARD_ADD
+ return float4(0, 0, 0, 0);
+ #else
+ return float4(worldNormal * 0.5 + 0.5, alpha);
+ #endif
+#elif MTOON_DEBUG_LITSHADERATE
+ #ifdef MTOON_FORWARD_ADD
+ return float4(0, 0, 0, 0);
+ #else
+ return float4(lightIntensity * lighting, alpha);
+ #endif
+#endif
+
+
+ half4 result = half4(col, alpha);
+ UNITY_APPLY_FOG(i.fogCoord, result);
+ return result;
+}
+
+#endif // MTOON_CORE_INCLUDED
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc.meta
new file mode 100644
index 00000000..6b680916
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonCore.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ef6682d138947ed4fbc8fbecfe75cd28
+timeCreated: 1514120022
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc
new file mode 100644
index 00000000..cf3a0930
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc
@@ -0,0 +1,19 @@
+#include "./MToonCore.cginc"
+
+v2f vert_forward_base(appdata_full v)
+{
+ v.normal = normalize(v.normal);
+ return InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0);
+}
+
+v2f vert_forward_base_outline(appdata_full v)
+{
+ v.normal = normalize(v.normal);
+ return InitializeV2F(v, CalculateOutlineVertexClipPosition(v), 1);
+}
+
+v2f vert_forward_add(appdata_full v)
+{
+ v.normal = normalize(v.normal);
+ return InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0);
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc.meta
new file mode 100644
index 00000000..843b34e3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM3.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 084281ffd8b1b8e4a8605725d3b0760b
+timeCreated: 1514120022
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc
new file mode 100644
index 00000000..538864b0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc
@@ -0,0 +1,37 @@
+#include "./MToonCore.cginc"
+
+appdata_full vert_forward_base_with_outline(appdata_full v)
+{
+ v.normal = normalize(v.normal);
+ return v;
+}
+
+v2f vert_forward_add(appdata_full v)
+{
+ v.normal = normalize(v.normal);
+ return InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0);
+}
+
+[maxvertexcount(6)]
+void geom_forward_base(triangle appdata_full IN[3], inout TriangleStream<v2f> stream)
+{
+ v2f o;
+
+#if defined(MTOON_OUTLINE_WIDTH_WORLD) || defined(MTOON_OUTLINE_WIDTH_SCREEN)
+ for (int i = 2; i >= 0; --i)
+ {
+ appdata_full v = IN[i];
+ v2f o = InitializeV2F(v, CalculateOutlineVertexClipPosition(v), 1);
+ stream.Append(o);
+ }
+ stream.RestartStrip();
+#endif
+
+ for (int j = 0; j < 3; ++j)
+ {
+ appdata_full v = IN[j];
+ v2f o = InitializeV2F(v, UnityObjectToClipPos(v.vertex), 0);
+ stream.Append(o);
+ }
+ stream.RestartStrip();
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc.meta
new file mode 100644
index 00000000..f6bdf05c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Resources/Shaders/MToonSM4.cginc.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 17d4e0f990fbc794ab41e4fcc196d559
+timeCreated: 1514120022
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples.meta
new file mode 100644
index 00000000..f454277f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 9e9b6e0377a19e54d9d9ff78f925aec6
+folderAsset: yes
+timeCreated: 1520007011
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials.meta
new file mode 100644
index 00000000..3aa2897b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: a028698465d209d4e91f4935e23b138e
+folderAsset: yes
+timeCreated: 1520007030
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat
new file mode 100644
index 00000000..fb6fbd6a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat
@@ -0,0 +1,108 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: Ex_OutlineWidth_Screen
+ m_Shader: {fileID: 4800000, guid: 1a97144e4ad27a04aafd70f7b915cedb, type: 3}
+ m_ShaderKeywords: MTOON_OUTLINE_COLOR_FIXED MTOON_OUTLINE_WIDTH_SCREEN
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap:
+ RenderType: Opaque
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OutlineWidthTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ReceiveShadowTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ShadeTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SphereAdd:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _BlendMode: 0
+ - _BumpScale: 1
+ - _CullMode: 2
+ - _Cutoff: 0.5
+ - _DebugMode: 0
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _IsFirstSetup: 0
+ - _LightColorAttenuation: 0
+ - _Metallic: 0
+ - _Mode: 0
+ - _OcclusionStrength: 1
+ - _OutlineColorMode: 0
+ - _OutlineLightingMix: 1
+ - _OutlineScaledMaxDistance: 10
+ - _OutlineWidth: 1
+ - _OutlineWidthMode: 2
+ - _Parallax: 0.02
+ - _ReceiveShadowRate: 1
+ - _ShadeShift: 0
+ - _ShadeToony: 0.9
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _UVSec: 0
+ - _ZWrite: 1
+ m_Colors:
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
+ - _ShadeColor: {r: 0.97, g: 0.81, b: 0.86, a: 1}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat.meta
new file mode 100644
index 00000000..a2cb2806
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_Screen.mat.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 4f42a26097c877b40a7616aa60580c43
+timeCreated: 1521569501
+licenseType: Free
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat
new file mode 100644
index 00000000..7634815e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat
@@ -0,0 +1,108 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: Ex_OutlineWidth_World
+ m_Shader: {fileID: 4800000, guid: 1a97144e4ad27a04aafd70f7b915cedb, type: 3}
+ m_ShaderKeywords: MTOON_OUTLINE_COLOR_FIXED MTOON_OUTLINE_WIDTH_WORLD
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap:
+ RenderType: Opaque
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OutlineWidthTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ReceiveShadowTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ShadeTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SphereAdd:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _BlendMode: 0
+ - _BumpScale: 1
+ - _CullMode: 2
+ - _Cutoff: 0.5
+ - _DebugMode: 0
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0.5
+ - _GlossyReflections: 1
+ - _IsFirstSetup: 0
+ - _LightColorAttenuation: 0
+ - _Metallic: 0
+ - _Mode: 0
+ - _OcclusionStrength: 1
+ - _OutlineColorMode: 0
+ - _OutlineLightingMix: 1
+ - _OutlineScaledMaxDistance: 1
+ - _OutlineWidth: 1
+ - _OutlineWidthMode: 1
+ - _Parallax: 0.02
+ - _ReceiveShadowRate: 1
+ - _ShadeShift: 0
+ - _ShadeToony: 0.9
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _UVSec: 0
+ - _ZWrite: 1
+ m_Colors:
+ - _Color: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
+ - _ShadeColor: {r: 0.97, g: 0.81, b: 0.86, a: 1}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat.meta
new file mode 100644
index 00000000..9d54c3ed
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ex_OutlineWidth_World.mat.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: e40a129e14e378c4db040df3fd4a6077
+timeCreated: 1521569501
+licenseType: Free
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat
new file mode 100644
index 00000000..9256e9a6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat
@@ -0,0 +1,76 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: Ground
+ m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _BumpScale: 1
+ - _Cutoff: 0.5
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0
+ - _GlossyReflections: 1
+ - _Metallic: 0
+ - _Mode: 0
+ - _OcclusionStrength: 1
+ - _Parallax: 0.02
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _UVSec: 0
+ - _ZWrite: 1
+ m_Colors:
+ - _Color: {r: 0.35294116, g: 0.35294116, b: 0.35294116, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat.meta
new file mode 100644
index 00000000..bc98f082
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Ground.mat.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 54da18ba3126f1343924588562df72e0
+timeCreated: 1520008460
+licenseType: Free
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat
new file mode 100644
index 00000000..a26f22e5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat
@@ -0,0 +1,127 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: Toon
+ m_Shader: {fileID: 4800000, guid: 1a97144e4ad27a04aafd70f7b915cedb, type: 3}
+ m_ShaderKeywords:
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 1
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: -1
+ stringTagMap:
+ RenderType: Opaque
+ disabledShaderPasses: []
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AlphaTexture:
+ m_Texture: {fileID: 2800000, guid: 92024733fdffba54db25f64b8c81a267, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BumpMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailAlbedoMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMask:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _LitTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MetallicGlossMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NormalTexture:
+ m_Texture: {fileID: 179082629, guid: 114e7de62fa527d458ae3774d145e045, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OcclusionMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _OutlineWidthTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ParallaxMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ReceiveShadowTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ShadeTexture:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SphereAdd:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _Alpha: 1
+ - _BlendMode: 0
+ - _BumpScale: 1
+ - _CullMode: 2
+ - _Cutoff: 0.611
+ - _DebugMode: 0
+ - _DetailNormalMapScale: 1
+ - _DstBlend: 0
+ - _GlossMapScale: 1
+ - _Glossiness: 0
+ - _GlossyReflections: 1
+ - _IsFirstSetup: 0
+ - _LightColorAttenuation: 0
+ - _Metallic: 0
+ - _Mode: 0
+ - _NormalCylinderizeRate: 0
+ - _NormalFromVColorRate: 0
+ - _OcclusionStrength: 1
+ - _OutlineColorMode: 0
+ - _OutlineLightingMix: 1
+ - _OutlineMode: 0
+ - _OutlineScaledMaxDistance: 1
+ - _OutlineWidth: 1
+ - _OutlineWidthMode: 0
+ - _Parallax: 0.02
+ - _ReceiveShadowRate: 1
+ - _ShadeShift: 0.5
+ - _ShadeToony: 0.5
+ - _SmoothnessTextureChannel: 0
+ - _SpecularHighlights: 1
+ - _SrcBlend: 1
+ - _UVSec: 0
+ - _ZWrite: 1
+ m_Colors:
+ - _Color: {r: 1, g: 0.93995947, b: 0.45588237, a: 1}
+ - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+ - _LitColor: {r: 1, g: 1, b: 1, a: 1}
+ - _NormalCylinderizeAxis: {r: 0, g: 1, b: 0, a: 0}
+ - _NormalCylinderizePos: {r: 0, g: 0, b: 0, a: 0}
+ - _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
+ - _ShadeColor: {r: 1, g: 0.5147059, b: 0.80588233, a: 1}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat.meta
new file mode 100644
index 00000000..aeb51f3e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/Materials/Toon.mat.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 9639e17dffc656345a70282f7f216672
+timeCreated: 1520007037
+licenseType: Free
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 2100000
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity
new file mode 100644
index 00000000..1d452bb5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity
@@ -0,0 +1,1984 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 8
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 11
+ m_GIWorkflowMode: 0
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_TemporalCoherenceThreshold: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_LightmapEditorSettings:
+ serializedVersion: 9
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_TextureWidth: 1024
+ m_TextureHeight: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 0
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 500
+ m_PVRBounces: 2
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringMode: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
+ m_LightingDataAsset: {fileID: 0}
+ m_UseShadowmask: 1
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &258232875
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 258232876}
+ m_Layer: 0
+ m_Name: OutlineWidth_World
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &258232876
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 258232875}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -1.24, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 785023941}
+ - {fileID: 1884108470}
+ - {fileID: 1151291098}
+ - {fileID: 1122307219}
+ - {fileID: 860725899}
+ - {fileID: 513101434}
+ - {fileID: 1258929826}
+ - {fileID: 1515544977}
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &287894940
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 287894941}
+ - component: {fileID: 287894943}
+ - component: {fileID: 287894942}
+ m_Layer: 0
+ m_Name: Sphere (5)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &287894941
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 287894940}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 5
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &287894942
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 287894940}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &287894943
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 287894940}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &449049889
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 449049892}
+ - component: {fileID: 449049891}
+ - component: {fileID: 449049890}
+ m_Layer: 0
+ m_Name: New Text (3)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!102 &449049890
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 449049889}
+ m_Text: 'Fixed length
+
+ in World coords'
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 0
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &449049891
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 449049889}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!4 &449049892
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 449049889}
+ m_LocalRotation: {x: 0.0000014603138, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: -6.67, y: 0.31272152, z: 7.78}
+ m_LocalScale: {x: 0.29944235, y: 0.29944223, z: 0.29944223}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 8
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &473362767
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 473362770}
+ - component: {fileID: 473362769}
+ - component: {fileID: 473362768}
+ m_Layer: 0
+ m_Name: New Text (4)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!102 &473362768
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 473362767}
+ m_Text: Outline Width Mode
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 0
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &473362769
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 473362767}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!4 &473362770
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 473362767}
+ m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
+ m_LocalPosition: {x: -0.819, y: 0.095275, z: -0.299}
+ m_LocalScale: {x: 0.13751951, y: 0.13751945, z: 0.13751945}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 9
+ m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
+--- !u!1 &513101433
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 513101434}
+ - component: {fileID: 513101436}
+ - component: {fileID: 513101435}
+ m_Layer: 0
+ m_Name: Sphere (5)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &513101434
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 513101433}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 5
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &513101435
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 513101433}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &513101436
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 513101433}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &562432354
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 562432355}
+ - component: {fileID: 562432357}
+ - component: {fileID: 562432356}
+ m_Layer: 0
+ m_Name: Sphere (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &562432355
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 562432354}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 2}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &562432356
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 562432354}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &562432357
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 562432354}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &569565535
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 569565538}
+ - component: {fileID: 569565537}
+ - component: {fileID: 569565536}
+ m_Layer: 0
+ m_Name: New Text (2)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!102 &569565536
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 569565535}
+ m_Text: 'Fixed length
+
+ in Screen coords'
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 0
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &569565537
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 569565535}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!4 &569565538
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 569565535}
+ m_LocalRotation: {x: 0.0000014603138, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 3.96, y: 0.31272152, z: 7.78}
+ m_LocalScale: {x: 0.29944235, y: 0.29944223, z: 0.29944223}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 7
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &570198665
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 570198666}
+ - component: {fileID: 570198668}
+ - component: {fileID: 570198667}
+ m_Layer: 0
+ m_Name: Sphere (7)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &570198666
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 570198665}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 14}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 7
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &570198667
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 570198665}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &570198668
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 570198665}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &785023940
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 785023941}
+ - component: {fileID: 785023943}
+ - component: {fileID: 785023942}
+ m_Layer: 0
+ m_Name: Sphere
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &785023941
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 785023940}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &785023942
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 785023940}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &785023943
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 785023940}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &860725898
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 860725899}
+ - component: {fileID: 860725901}
+ - component: {fileID: 860725900}
+ m_Layer: 0
+ m_Name: Sphere (4)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &860725899
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860725898}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 8}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &860725900
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860725898}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &860725901
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 860725898}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &911241602
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 911241603}
+ - component: {fileID: 911241605}
+ - component: {fileID: 911241604}
+ m_Layer: 0
+ m_Name: Sphere (3)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &911241603
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 911241602}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 6}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &911241604
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 911241602}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &911241605
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 911241602}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &949706138
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 949706139}
+ m_Layer: 0
+ m_Name: OutlineWidth_Screen
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &949706139
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 949706138}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 1.24, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 982378650}
+ - {fileID: 562432355}
+ - {fileID: 2006212098}
+ - {fileID: 911241603}
+ - {fileID: 1933383087}
+ - {fileID: 287894941}
+ - {fileID: 1361188086}
+ - {fileID: 570198666}
+ m_Father: {fileID: 0}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &982378649
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 982378650}
+ - component: {fileID: 982378652}
+ - component: {fileID: 982378651}
+ m_Layer: 0
+ m_Name: Sphere
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &982378650
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 982378649}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &982378651
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 982378649}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &982378652
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 982378649}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1122307218
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1122307219}
+ - component: {fileID: 1122307221}
+ - component: {fileID: 1122307220}
+ m_Layer: 0
+ m_Name: Sphere (3)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1122307219
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1122307218}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 6}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1122307220
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1122307218}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1122307221
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1122307218}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1143053075
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1143053079}
+ - component: {fileID: 1143053078}
+ - component: {fileID: 1143053077}
+ - component: {fileID: 1143053076}
+ m_Layer: 0
+ m_Name: Plane
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!23 &1143053076
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1143053075}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 54da18ba3126f1343924588562df72e0, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!64 &1143053077
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1143053075}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 3
+ m_Convex: 0
+ m_CookingOptions: 14
+ m_SkinWidth: 0.01
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!33 &1143053078
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1143053075}
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &1143053079
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1143053075}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 10, y: 10, z: 10}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1151291097
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1151291098}
+ - component: {fileID: 1151291100}
+ - component: {fileID: 1151291099}
+ m_Layer: 0
+ m_Name: Sphere (2)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1151291098
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1151291097}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 4}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1151291099
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1151291097}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1151291100
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1151291097}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1258929825
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1258929826}
+ - component: {fileID: 1258929828}
+ - component: {fileID: 1258929827}
+ m_Layer: 0
+ m_Name: Sphere (6)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1258929826
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1258929825}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 12}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 6
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1258929827
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1258929825}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1258929828
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1258929825}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1344602170
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1344602173}
+ - component: {fileID: 1344602172}
+ - component: {fileID: 1344602171}
+ m_Layer: 0
+ m_Name: New Text (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!102 &1344602171
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1344602170}
+ m_Text: Screen
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 0
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &1344602172
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1344602170}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!4 &1344602173
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1344602170}
+ m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
+ m_LocalPosition: {x: 0.85066, y: 0.095275, z: -0.43498}
+ m_LocalScale: {x: 0.1727766, y: 0.17277655, z: 0.17277655}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 6
+ m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
+--- !u!1 &1361188085
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1361188086}
+ - component: {fileID: 1361188088}
+ - component: {fileID: 1361188087}
+ m_Layer: 0
+ m_Name: Sphere (6)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1361188086
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1361188085}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 12}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 6
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1361188087
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1361188085}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1361188088
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1361188085}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1515544976
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1515544977}
+ - component: {fileID: 1515544979}
+ - component: {fileID: 1515544978}
+ m_Layer: 0
+ m_Name: Sphere (7)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1515544977
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1515544976}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 14}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 7
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1515544978
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1515544976}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1515544979
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1515544976}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1670878653
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1670878657}
+ - component: {fileID: 1670878656}
+ - component: {fileID: 1670878655}
+ - component: {fileID: 1670878654}
+ m_Layer: 0
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!81 &1670878654
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1670878653}
+ m_Enabled: 1
+--- !u!124 &1670878655
+Behaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1670878653}
+ m_Enabled: 1
+--- !u!20 &1670878656
+Camera:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1670878653}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 45
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 1
+ m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!4 &1670878657
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1670878653}
+ m_LocalRotation: {x: 0.21979502, y: -0, z: -0, w: 0.97554606}
+ m_LocalPosition: {x: 0, y: 2.09, z: -2.67}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 25.394001, y: 0, z: 0}
+--- !u!1 &1884108469
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1884108470}
+ - component: {fileID: 1884108472}
+ - component: {fileID: 1884108471}
+ m_Layer: 0
+ m_Name: Sphere (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1884108470
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1884108469}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 2}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 258232876}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1884108471
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1884108469}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: e40a129e14e378c4db040df3fd4a6077, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1884108472
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1884108469}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1912481823
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1912481826}
+ - component: {fileID: 1912481825}
+ - component: {fileID: 1912481824}
+ m_Layer: 0
+ m_Name: New Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!102 &1912481824
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1912481823}
+ m_Text: World
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 0
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &1912481825
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1912481823}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!4 &1912481826
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1912481823}
+ m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
+ m_LocalPosition: {x: -1.5655, y: 0.095275, z: -0.4374}
+ m_LocalScale: {x: 0.16944185, y: 0.16944179, z: 0.16944179}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 5
+ m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
+--- !u!1 &1933383086
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1933383087}
+ - component: {fileID: 1933383089}
+ - component: {fileID: 1933383088}
+ m_Layer: 0
+ m_Name: Sphere (4)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1933383087
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1933383086}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 8}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &1933383088
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1933383086}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &1933383089
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1933383086}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &2006212097
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 2006212098}
+ - component: {fileID: 2006212100}
+ - component: {fileID: 2006212099}
+ m_Layer: 0
+ m_Name: Sphere (2)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &2006212098
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2006212097}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0.5, z: 4}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 949706139}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &2006212099
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2006212097}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 4f42a26097c877b40a7616aa60580c43, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+--- !u!33 &2006212100
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2006212097}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &2063006920
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 2063006922}
+ - component: {fileID: 2063006921}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!108 &2063006921
+Light:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2063006920}
+ m_Enabled: 1
+ serializedVersion: 8
+ m_Type: 1
+ m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
+ m_Intensity: 1
+ m_Range: 10
+ m_SpotAngle: 30
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 2
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_Lightmapping: 4
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &2063006922
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2063006920}
+ m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
+ m_LocalPosition: {x: 0, y: 3, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity.meta
new file mode 100644
index 00000000..99ace3bd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Samples/OutlineWidthModes.unity.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8b731264e8acd0f4b8f56986e5eb2531
+timeCreated: 1521569785
+licenseType: Free
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts.meta
new file mode 100644
index 00000000..f8e901d7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 88551f898b0043c41b202eeb79752973
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs
new file mode 100644
index 00000000..fde05ed3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs
@@ -0,0 +1,44 @@
+namespace MToon
+{
+ public enum DebugMode
+ {
+ None = 0,
+ Normal = 1,
+ LitShadeRate = 2,
+ }
+
+ public enum OutlineColorMode
+ {
+ FixedColor = 0,
+ MixedLighting = 1,
+ }
+
+ public enum OutlineWidthMode
+ {
+ None = 0,
+ WorldCoordinates = 1,
+ ScreenCoordinates = 2,
+ }
+
+ public enum RenderMode
+ {
+ Opaque = 0,
+ Cutout = 1,
+ Transparent = 2,
+ TransparentWithZWrite = 3,
+ }
+
+ public enum CullMode
+ {
+ Off = 0,
+ Front = 1,
+ Back = 2,
+ }
+
+ public struct RenderQueueRequirement
+ {
+ public int DefaultValue;
+ public int MinValue;
+ public int MaxValue;
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs.meta
new file mode 100644
index 00000000..5149027f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Enums.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 9a3fb070d7eb4114b5cf387e2cd60391
+timeCreated: 1548858571 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs
new file mode 100644
index 00000000..7d208c07
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs
@@ -0,0 +1,109 @@
+using UnityEngine;
+
+namespace MToon
+{
+ public class MToonDefinition
+ {
+ public MetaDefinition Meta;
+ public RenderingDefinition Rendering;
+ public ColorDefinition Color;
+ public LightingDefinition Lighting;
+ public EmissionDefinition Emission;
+ public MatCapDefinition MatCap;
+ public RimDefinition Rim;
+ public OutlineDefinition Outline;
+ public TextureUvCoordsDefinition TextureOption;
+ }
+
+ public class MetaDefinition
+ {
+ public string Implementation;
+ public int VersionNumber;
+ }
+
+ public class RenderingDefinition
+ {
+ public RenderMode RenderMode;
+ public CullMode CullMode;
+ public int RenderQueueOffsetNumber;
+ }
+
+ public class ColorDefinition
+ {
+ public Color LitColor;
+ public Texture2D LitMultiplyTexture;
+ public Color ShadeColor;
+ public Texture2D ShadeMultiplyTexture;
+ public float CutoutThresholdValue;
+ }
+
+ public class LightingDefinition
+ {
+ public LitAndShadeMixingDefinition LitAndShadeMixing;
+ public LightingInfluenceDefinition LightingInfluence;
+ public NormalDefinition Normal;
+ }
+
+ public class LitAndShadeMixingDefinition
+ {
+ public float ShadingShiftValue;
+ public float ShadingToonyValue;
+ public float ShadowReceiveMultiplierValue;
+ public Texture2D ShadowReceiveMultiplierMultiplyTexture;
+ public float LitAndShadeMixingMultiplierValue;
+ public Texture2D LitAndShadeMixingMultiplierMultiplyTexture;
+ }
+
+ public class LightingInfluenceDefinition
+ {
+ public float LightColorAttenuationValue;
+ public float GiIntensityValue;
+ }
+
+ public class EmissionDefinition
+ {
+ public Color EmissionColor;
+ public Texture2D EmissionMultiplyTexture;
+ }
+
+ public class MatCapDefinition
+ {
+ public Texture2D AdditiveTexture;
+ }
+
+ public class RimDefinition
+ {
+ public Color RimColor;
+ public Texture2D RimMultiplyTexture;
+ public float RimLightingMixValue;
+ public float RimFresnelPowerValue;
+ public float RimLiftValue;
+ }
+
+ public class NormalDefinition
+ {
+ public Texture2D NormalTexture;
+ public float NormalScaleValue;
+ }
+
+ public class OutlineDefinition
+ {
+ public OutlineWidthMode OutlineWidthMode;
+ public float OutlineWidthValue;
+ public Texture2D OutlineWidthMultiplyTexture;
+ public float OutlineScaledMaxDistanceValue;
+ public OutlineColorMode OutlineColorMode;
+ public Color OutlineColor;
+ public float OutlineLightingMixValue;
+ }
+
+ public class TextureUvCoordsDefinition
+ {
+ public Vector2 MainTextureLeftBottomOriginScale;
+ public Vector2 MainTextureLeftBottomOriginOffset;
+ public Texture2D UvAnimationMaskTexture;
+ public float UvAnimationScrollXSpeedValue;
+ public float UvAnimationScrollYSpeedValue;
+ public float UvAnimationRotationSpeedValue;
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs.meta
new file mode 100644
index 00000000..47c4a339
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/MToonDefinition.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 2849b99d94074fcf9e10c5ca3eab15a8
+timeCreated: 1548857282 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs
new file mode 100644
index 00000000..672e9e17
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs
@@ -0,0 +1,116 @@
+using System;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+namespace MToon
+{
+ public static partial class Utils
+ {
+ public const string ShaderName = "VRM/MToon";
+
+ public const string PropVersion = "_MToonVersion";
+ public const string PropDebugMode = "_DebugMode";
+ public const string PropOutlineWidthMode = "_OutlineWidthMode";
+ public const string PropOutlineColorMode = "_OutlineColorMode";
+ public const string PropBlendMode = "_BlendMode";
+ public const string PropCullMode = "_CullMode";
+ public const string PropOutlineCullMode = "_OutlineCullMode";
+ public const string PropCutoff = "_Cutoff";
+ public const string PropColor = "_Color";
+ public const string PropShadeColor = "_ShadeColor";
+ public const string PropMainTex = "_MainTex";
+ public const string PropShadeTexture = "_ShadeTexture";
+ public const string PropBumpScale = "_BumpScale";
+ public const string PropBumpMap = "_BumpMap";
+ public const string PropReceiveShadowRate = "_ReceiveShadowRate";
+ public const string PropReceiveShadowTexture = "_ReceiveShadowTexture";
+ public const string PropShadingGradeRate = "_ShadingGradeRate";
+ public const string PropShadingGradeTexture = "_ShadingGradeTexture";
+ public const string PropShadeShift = "_ShadeShift";
+ public const string PropShadeToony = "_ShadeToony";
+ public const string PropLightColorAttenuation = "_LightColorAttenuation";
+ public const string PropIndirectLightIntensity = "_IndirectLightIntensity";
+ public const string PropRimColor = "_RimColor";
+ public const string PropRimTexture = "_RimTexture";
+ public const string PropRimLightingMix = "_RimLightingMix";
+ public const string PropRimFresnelPower = "_RimFresnelPower";
+ public const string PropRimLift = "_RimLift";
+ public const string PropSphereAdd = "_SphereAdd";
+ public const string PropEmissionColor = "_EmissionColor";
+ public const string PropEmissionMap = "_EmissionMap";
+ public const string PropOutlineWidthTexture = "_OutlineWidthTexture";
+ public const string PropOutlineWidth = "_OutlineWidth";
+ public const string PropOutlineScaledMaxDistance = "_OutlineScaledMaxDistance";
+ public const string PropOutlineColor = "_OutlineColor";
+ public const string PropOutlineLightingMix = "_OutlineLightingMix";
+ public const string PropUvAnimMaskTexture = "_UvAnimMaskTexture";
+ public const string PropUvAnimScrollX = "_UvAnimScrollX";
+ public const string PropUvAnimScrollY = "_UvAnimScrollY";
+ public const string PropUvAnimRotation = "_UvAnimRotation";
+ public const string PropSrcBlend = "_SrcBlend";
+ public const string PropDstBlend = "_DstBlend";
+ public const string PropZWrite = "_ZWrite";
+ public const string PropAlphaToMask = "_AlphaToMask";
+
+ public const string KeyNormalMap = "_NORMALMAP";
+ public const string KeyAlphaTestOn = "_ALPHATEST_ON";
+ public const string KeyAlphaBlendOn = "_ALPHABLEND_ON";
+ public const string KeyAlphaPremultiplyOn = "_ALPHAPREMULTIPLY_ON";
+ public const string KeyOutlineWidthWorld = "MTOON_OUTLINE_WIDTH_WORLD";
+ public const string KeyOutlineWidthScreen = "MTOON_OUTLINE_WIDTH_SCREEN";
+ public const string KeyOutlineColorFixed = "MTOON_OUTLINE_COLOR_FIXED";
+ public const string KeyOutlineColorMixed = "MTOON_OUTLINE_COLOR_MIXED";
+ public const string KeyDebugNormal = "MTOON_DEBUG_NORMAL";
+ public const string KeyDebugLitShadeRate = "MTOON_DEBUG_LITSHADERATE";
+
+ public const string TagRenderTypeKey = "RenderType";
+ public const string TagRenderTypeValueOpaque = "Opaque";
+ public const string TagRenderTypeValueTransparentCutout = "TransparentCutout";
+ public const string TagRenderTypeValueTransparent = "Transparent";
+
+ public const int DisabledIntValue = 0;
+ public const int EnabledIntValue = 1;
+
+ public static RenderQueueRequirement GetRenderQueueRequirement(RenderMode renderMode)
+ {
+ const int shaderDefaultQueue = -1;
+ const int firstTransparentQueue = 2501;
+ const int spanOfQueue = 50;
+
+ switch (renderMode)
+ {
+ case RenderMode.Opaque:
+ return new RenderQueueRequirement()
+ {
+ DefaultValue = shaderDefaultQueue,
+ MinValue = shaderDefaultQueue,
+ MaxValue = shaderDefaultQueue,
+ };
+ case RenderMode.Cutout:
+ return new RenderQueueRequirement()
+ {
+ DefaultValue = (int) RenderQueue.AlphaTest,
+ MinValue = (int) RenderQueue.AlphaTest,
+ MaxValue = (int) RenderQueue.AlphaTest,
+ };
+ case RenderMode.Transparent:
+ return new RenderQueueRequirement()
+ {
+ DefaultValue = (int) RenderQueue.Transparent,
+ MinValue = (int) RenderQueue.Transparent - spanOfQueue + 1,
+ MaxValue = (int) RenderQueue.Transparent,
+ };
+ case RenderMode.TransparentWithZWrite:
+ return new RenderQueueRequirement()
+ {
+ DefaultValue = firstTransparentQueue,
+ MinValue = firstTransparentQueue,
+ MaxValue = firstTransparentQueue + spanOfQueue - 1,
+ };
+ default:
+ throw new ArgumentOutOfRangeException("renderMode", renderMode, null);
+ }
+ }
+
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs.meta
new file mode 100644
index 00000000..bd4175c3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/Utils.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 9d2012c170a74b3db0002f7ecda53622
+timeCreated: 1537557325 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs
new file mode 100644
index 00000000..a9179556
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs
@@ -0,0 +1,180 @@
+using System;
+using UnityEngine;
+
+namespace MToon
+{
+ public static partial class Utils
+ {
+ public static MToonDefinition GetMToonParametersFromMaterial(Material material)
+ {
+ return new MToonDefinition
+ {
+ Meta = new MetaDefinition
+ {
+ Implementation = Implementation,
+ VersionNumber = material.GetInt(PropVersion),
+ },
+ Rendering = new RenderingDefinition
+ {
+ RenderMode = GetBlendMode(material),
+ CullMode = GetCullMode(material),
+ RenderQueueOffsetNumber = GetRenderQueueOffset(material, GetRenderQueueOriginMode(material)),
+ },
+ Color = new ColorDefinition
+ {
+ LitColor = GetColor(material, PropColor),
+ LitMultiplyTexture = GetTexture(material, PropMainTex),
+ ShadeColor = GetColor(material, PropShadeColor),
+ ShadeMultiplyTexture = GetTexture(material, PropShadeTexture),
+ CutoutThresholdValue = GetValue(material, PropCutoff),
+ },
+ Lighting = new LightingDefinition
+ {
+ LitAndShadeMixing = new LitAndShadeMixingDefinition
+ {
+ ShadingShiftValue = GetValue(material, PropShadeShift),
+ ShadingToonyValue = GetValue(material, PropShadeToony),
+ ShadowReceiveMultiplierValue = GetValue(material, PropReceiveShadowRate),
+ ShadowReceiveMultiplierMultiplyTexture = GetTexture(material, PropReceiveShadowTexture),
+ LitAndShadeMixingMultiplierValue = GetValue(material, PropShadingGradeRate),
+ LitAndShadeMixingMultiplierMultiplyTexture = GetTexture(material, PropShadingGradeTexture),
+ },
+ LightingInfluence = new LightingInfluenceDefinition
+ {
+ LightColorAttenuationValue = GetValue(material, PropLightColorAttenuation),
+ GiIntensityValue = GetValue(material, PropIndirectLightIntensity),
+ },
+ Normal = new NormalDefinition
+ {
+ NormalTexture = GetTexture(material, PropBumpMap),
+ NormalScaleValue = GetValue(material, PropBumpScale),
+ },
+ },
+ Emission = new EmissionDefinition
+ {
+ EmissionColor = GetColor(material, PropEmissionColor),
+ EmissionMultiplyTexture = GetTexture(material, PropEmissionMap),
+ },
+ MatCap = new MatCapDefinition
+ {
+ AdditiveTexture = GetTexture(material, PropSphereAdd),
+ },
+ Rim = new RimDefinition
+ {
+ RimColor = GetColor(material, PropRimColor),
+ RimMultiplyTexture = GetTexture(material, PropRimTexture),
+ RimLightingMixValue = GetValue(material, PropRimLightingMix),
+ RimFresnelPowerValue = GetValue(material, PropRimFresnelPower),
+ RimLiftValue = GetValue(material, PropRimLift),
+ },
+ Outline = new OutlineDefinition
+ {
+ OutlineWidthMode = GetOutlineWidthMode(material),
+ OutlineWidthValue = GetValue(material, PropOutlineWidth),
+ OutlineWidthMultiplyTexture = GetTexture(material, PropOutlineWidthTexture),
+ OutlineScaledMaxDistanceValue = GetValue(material, PropOutlineScaledMaxDistance),
+ OutlineColorMode = GetOutlineColorMode(material),
+ OutlineColor = GetColor(material, PropOutlineColor),
+ OutlineLightingMixValue = GetValue(material, PropOutlineLightingMix),
+ },
+ TextureOption = new TextureUvCoordsDefinition
+ {
+ MainTextureLeftBottomOriginScale = material.GetTextureScale(PropMainTex),
+ MainTextureLeftBottomOriginOffset = material.GetTextureOffset(PropMainTex),
+ UvAnimationMaskTexture = GetTexture(material, PropUvAnimMaskTexture),
+ UvAnimationScrollXSpeedValue = GetValue(material, PropUvAnimScrollX),
+ UvAnimationScrollYSpeedValue = GetValue(material, PropUvAnimScrollY),
+ UvAnimationRotationSpeedValue = GetValue(material, PropUvAnimRotation),
+ },
+ };
+ }
+
+ private static float GetValue(Material material, string propertyName)
+ {
+ return material.GetFloat(propertyName);
+ }
+
+ private static Color GetColor(Material material, string propertyName)
+ {
+ return material.GetColor(propertyName);
+ }
+
+ private static Texture2D GetTexture(Material material, string propertyName)
+ {
+ return (Texture2D) material.GetTexture(propertyName);
+ }
+
+ private static RenderMode GetBlendMode(Material material)
+ {
+ if (material.IsKeywordEnabled(KeyAlphaTestOn))
+ {
+ return RenderMode.Cutout;
+ }
+ else if (material.IsKeywordEnabled(KeyAlphaBlendOn))
+ {
+ switch (material.GetInt(PropZWrite))
+ {
+ case EnabledIntValue:
+ return RenderMode.TransparentWithZWrite;
+ case DisabledIntValue:
+ return RenderMode.Transparent;
+ default:
+ Debug.LogWarning("Invalid ZWrite Int Value.");
+ return RenderMode.Transparent;
+ }
+ }
+ else
+ {
+ return RenderMode.Opaque;
+ }
+ }
+
+ private static CullMode GetCullMode(Material material)
+ {
+ switch ((CullMode) material.GetInt(PropCullMode))
+ {
+ case CullMode.Off:
+ return CullMode.Off;
+ case CullMode.Front:
+ return CullMode.Front;
+ case CullMode.Back:
+ return CullMode.Back;
+ default:
+ Debug.LogWarning("Invalid CullMode.");
+ return CullMode.Back;
+ }
+ }
+
+ private static OutlineWidthMode GetOutlineWidthMode(Material material)
+ {
+ if (material.IsKeywordEnabled(KeyOutlineWidthWorld)) return OutlineWidthMode.WorldCoordinates;
+ if (material.IsKeywordEnabled(KeyOutlineWidthScreen)) return OutlineWidthMode.ScreenCoordinates;
+
+ return OutlineWidthMode.None;
+ }
+
+ private static OutlineColorMode GetOutlineColorMode(Material material)
+ {
+ if (material.IsKeywordEnabled(KeyOutlineColorFixed)) return OutlineColorMode.FixedColor;
+ if (material.IsKeywordEnabled(KeyOutlineColorMixed)) return OutlineColorMode.MixedLighting;
+
+ return OutlineColorMode.FixedColor;
+ }
+
+ private static RenderMode GetRenderQueueOriginMode(Material material)
+ {
+ return GetBlendMode(material);
+ }
+
+ private static int GetRenderQueueOffset(Material material, RenderMode originMode)
+ {
+ var rawValue = material.renderQueue;
+ var requirement = GetRenderQueueRequirement(originMode);
+ if (rawValue < requirement.MinValue || rawValue > requirement.MaxValue)
+ {
+ return 0;
+ }
+ return rawValue - requirement.DefaultValue;
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs.meta
new file mode 100644
index 00000000..db1134ad
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsGetter.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 6724aa45c8c349fabd5954a531301aa8
+timeCreated: 1557229569 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs
new file mode 100644
index 00000000..ea5ce5c8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs
@@ -0,0 +1,283 @@
+using System;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+namespace MToon
+{
+ public static partial class Utils
+ {
+ public static void SetMToonParametersToMaterial(Material material, MToonDefinition parameters)
+ {
+ {
+ var meta = parameters.Meta;
+ SetValue(material, PropVersion, meta.VersionNumber);
+ }
+ {
+ var rendering = parameters.Rendering;
+ SetRenderMode(material, rendering.RenderMode, rendering.RenderQueueOffsetNumber,
+ useDefaultRenderQueue: false);
+ SetCullMode(material, rendering.CullMode);
+ }
+ {
+ var color = parameters.Color;
+ SetColor(material, PropColor, color.LitColor);
+ SetTexture(material, PropMainTex, color.LitMultiplyTexture);
+ SetColor(material, PropShadeColor, color.ShadeColor);
+ SetTexture(material, PropShadeTexture, color.ShadeMultiplyTexture);
+ SetValue(material, PropCutoff, color.CutoutThresholdValue);
+ }
+ {
+ var lighting = parameters.Lighting;
+ {
+ var prop = lighting.LitAndShadeMixing;
+ SetValue(material, PropShadeShift, prop.ShadingShiftValue);
+ SetValue(material, PropShadeToony, prop.ShadingToonyValue);
+ SetValue(material, PropReceiveShadowRate, prop.ShadowReceiveMultiplierValue);
+ SetTexture(material, PropReceiveShadowTexture, prop.ShadowReceiveMultiplierMultiplyTexture);
+ SetValue(material, PropShadingGradeRate, prop.LitAndShadeMixingMultiplierValue);
+ SetTexture(material, PropShadingGradeTexture, prop.LitAndShadeMixingMultiplierMultiplyTexture);
+ }
+ {
+ var prop = lighting.LightingInfluence;
+ SetValue(material, PropLightColorAttenuation, prop.LightColorAttenuationValue);
+ SetValue(material, PropIndirectLightIntensity, prop.GiIntensityValue);
+ }
+ {
+ var prop = lighting.Normal;
+ SetNormalMapping(material, prop.NormalTexture, prop.NormalScaleValue);
+ }
+ }
+ {
+ var emission = parameters.Emission;
+ SetColor(material, PropEmissionColor, emission.EmissionColor);
+ SetTexture(material, PropEmissionMap, emission.EmissionMultiplyTexture);
+ }
+ {
+ var matcap = parameters.MatCap;
+ SetTexture(material, PropSphereAdd, matcap.AdditiveTexture);
+ }
+ {
+ var rim = parameters.Rim;
+ SetColor(material, PropRimColor, rim.RimColor);
+ SetTexture(material, PropRimTexture, rim.RimMultiplyTexture);
+ SetValue(material, PropRimLightingMix, rim.RimLightingMixValue);
+ SetValue(material, PropRimFresnelPower, rim.RimFresnelPowerValue);
+ SetValue(material, PropRimLift, rim.RimLiftValue);
+ }
+ {
+ var outline = parameters.Outline;
+ SetValue(material, PropOutlineWidth, outline.OutlineWidthValue);
+ SetTexture(material, PropOutlineWidthTexture, outline.OutlineWidthMultiplyTexture);
+ SetValue(material, PropOutlineScaledMaxDistance, outline.OutlineScaledMaxDistanceValue);
+ SetColor(material, PropOutlineColor, outline.OutlineColor);
+ SetValue(material, PropOutlineLightingMix, outline.OutlineLightingMixValue);
+ SetOutlineMode(material, outline.OutlineWidthMode, outline.OutlineColorMode);
+ }
+ {
+ var textureOptions = parameters.TextureOption;
+ material.SetTextureScale(PropMainTex, textureOptions.MainTextureLeftBottomOriginScale);
+ material.SetTextureOffset(PropMainTex, textureOptions.MainTextureLeftBottomOriginOffset);
+ material.SetTexture(PropUvAnimMaskTexture, textureOptions.UvAnimationMaskTexture);
+ material.SetFloat(PropUvAnimScrollX, textureOptions.UvAnimationScrollXSpeedValue);
+ material.SetFloat(PropUvAnimScrollY, textureOptions.UvAnimationScrollYSpeedValue);
+ material.SetFloat(PropUvAnimRotation, textureOptions.UvAnimationRotationSpeedValue);
+ }
+
+ ValidateProperties(material, isBlendModeChangedByUser: false);
+ }
+
+ /// <summary>
+ /// Validate properties and Set hidden properties, keywords.
+ /// if isBlendModeChangedByUser is true, renderQueue will set specified render mode's default value.
+ /// </summary>
+ /// <param name="material"></param>
+ /// <param name="isBlendModeChangedByUser"></param>
+ public static void ValidateProperties(Material material, bool isBlendModeChangedByUser = false)
+ {
+ SetRenderMode(material,
+ (RenderMode) material.GetFloat(PropBlendMode),
+ material.renderQueue - GetRenderQueueRequirement((RenderMode) material.GetFloat(PropBlendMode)).DefaultValue,
+ useDefaultRenderQueue: isBlendModeChangedByUser);
+ SetNormalMapping(material, material.GetTexture(PropBumpMap), material.GetFloat(PropBumpScale));
+ SetOutlineMode(material,
+ (OutlineWidthMode) material.GetFloat(PropOutlineWidthMode),
+ (OutlineColorMode) material.GetFloat(PropOutlineColorMode));
+ SetDebugMode(material, (DebugMode) material.GetFloat(PropDebugMode));
+ SetCullMode(material, (CullMode) material.GetFloat(PropCullMode));
+
+ var mainTex = material.GetTexture(PropMainTex);
+ var shadeTex = material.GetTexture(PropShadeTexture);
+ if (mainTex != null && shadeTex == null)
+ {
+ material.SetTexture(PropShadeTexture, mainTex);
+ }
+ }
+
+ private static void SetDebugMode(Material material, DebugMode debugMode)
+ {
+ SetValue(material, PropDebugMode, (int) debugMode);
+
+ switch (debugMode)
+ {
+ case DebugMode.None:
+ SetKeyword(material, KeyDebugNormal, false);
+ SetKeyword(material, KeyDebugLitShadeRate, false);
+ break;
+ case DebugMode.Normal:
+ SetKeyword(material, KeyDebugNormal, true);
+ SetKeyword(material, KeyDebugLitShadeRate, false);
+ break;
+ case DebugMode.LitShadeRate:
+ SetKeyword(material, KeyDebugNormal, false);
+ SetKeyword(material, KeyDebugLitShadeRate, true);
+ break;
+ }
+ }
+
+ private static void SetRenderMode(Material material, RenderMode renderMode, int renderQueueOffset,
+ bool useDefaultRenderQueue)
+ {
+ SetValue(material, PropBlendMode, (int) renderMode);
+
+ switch (renderMode)
+ {
+ case RenderMode.Opaque:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueOpaque);
+ material.SetInt(PropSrcBlend, (int) BlendMode.One);
+ material.SetInt(PropDstBlend, (int) BlendMode.Zero);
+ material.SetInt(PropZWrite, EnabledIntValue);
+ material.SetInt(PropAlphaToMask, DisabledIntValue);
+ SetKeyword(material, KeyAlphaTestOn, false);
+ SetKeyword(material, KeyAlphaBlendOn, false);
+ SetKeyword(material, KeyAlphaPremultiplyOn, false);
+ break;
+ case RenderMode.Cutout:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparentCutout);
+ material.SetInt(PropSrcBlend, (int) BlendMode.One);
+ material.SetInt(PropDstBlend, (int) BlendMode.Zero);
+ material.SetInt(PropZWrite, EnabledIntValue);
+ material.SetInt(PropAlphaToMask, EnabledIntValue);
+ SetKeyword(material, KeyAlphaTestOn, true);
+ SetKeyword(material, KeyAlphaBlendOn, false);
+ SetKeyword(material, KeyAlphaPremultiplyOn, false);
+ break;
+ case RenderMode.Transparent:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparent);
+ material.SetInt(PropSrcBlend, (int) BlendMode.SrcAlpha);
+ material.SetInt(PropDstBlend, (int) BlendMode.OneMinusSrcAlpha);
+ material.SetInt(PropZWrite, DisabledIntValue);
+ material.SetInt(PropAlphaToMask, DisabledIntValue);
+ SetKeyword(material, KeyAlphaTestOn, false);
+ SetKeyword(material, KeyAlphaBlendOn, true);
+ SetKeyword(material, KeyAlphaPremultiplyOn, false);
+ break;
+ case RenderMode.TransparentWithZWrite:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparent);
+ material.SetInt(PropSrcBlend, (int) BlendMode.SrcAlpha);
+ material.SetInt(PropDstBlend, (int) BlendMode.OneMinusSrcAlpha);
+ material.SetInt(PropZWrite, EnabledIntValue);
+ material.SetInt(PropAlphaToMask, DisabledIntValue);
+ SetKeyword(material, KeyAlphaTestOn, false);
+ SetKeyword(material, KeyAlphaBlendOn, true);
+ SetKeyword(material, KeyAlphaPremultiplyOn, false);
+ break;
+ }
+
+ if (useDefaultRenderQueue)
+ {
+ var requirement = GetRenderQueueRequirement(renderMode);
+ material.renderQueue = requirement.DefaultValue;
+ }
+ else
+ {
+ var requirement = GetRenderQueueRequirement(renderMode);
+ material.renderQueue = Mathf.Clamp(
+ requirement.DefaultValue + renderQueueOffset, requirement.MinValue, requirement.MaxValue);
+ }
+ }
+
+ private static void SetOutlineMode(Material material, OutlineWidthMode outlineWidthMode,
+ OutlineColorMode outlineColorMode)
+ {
+ SetValue(material, PropOutlineWidthMode, (int) outlineWidthMode);
+ SetValue(material, PropOutlineColorMode, (int) outlineColorMode);
+
+ var isFixed = outlineColorMode == OutlineColorMode.FixedColor;
+ var isMixed = outlineColorMode == OutlineColorMode.MixedLighting;
+
+ switch (outlineWidthMode)
+ {
+ case OutlineWidthMode.None:
+ SetKeyword(material, KeyOutlineWidthWorld, false);
+ SetKeyword(material, KeyOutlineWidthScreen, false);
+ SetKeyword(material, KeyOutlineColorFixed, false);
+ SetKeyword(material, KeyOutlineColorMixed, false);
+ break;
+ case OutlineWidthMode.WorldCoordinates:
+ SetKeyword(material, KeyOutlineWidthWorld, true);
+ SetKeyword(material, KeyOutlineWidthScreen, false);
+ SetKeyword(material, KeyOutlineColorFixed, isFixed);
+ SetKeyword(material, KeyOutlineColorMixed, isMixed);
+ break;
+ case OutlineWidthMode.ScreenCoordinates:
+ SetKeyword(material, KeyOutlineWidthWorld, false);
+ SetKeyword(material, KeyOutlineWidthScreen, true);
+ SetKeyword(material, KeyOutlineColorFixed, isFixed);
+ SetKeyword(material, KeyOutlineColorMixed, isMixed);
+ break;
+ }
+ }
+
+ private static void SetNormalMapping(Material material, Texture bumpMap, float bumpScale)
+ {
+ SetTexture(material, PropBumpMap, bumpMap);
+ SetValue(material, PropBumpScale, bumpScale);
+
+ SetKeyword(material, KeyNormalMap, bumpMap != null);
+ }
+
+ private static void SetCullMode(Material material, CullMode cullMode)
+ {
+ SetValue(material, PropCullMode, (int) cullMode);
+
+ switch (cullMode)
+ {
+ case CullMode.Back:
+ material.SetInt(PropCullMode, (int) CullMode.Back);
+ material.SetInt(PropOutlineCullMode, (int) CullMode.Front);
+ break;
+ case CullMode.Front:
+ material.SetInt(PropCullMode, (int) CullMode.Front);
+ material.SetInt(PropOutlineCullMode, (int) CullMode.Back);
+ break;
+ case CullMode.Off:
+ material.SetInt(PropCullMode, (int) CullMode.Off);
+ material.SetInt(PropOutlineCullMode, (int) CullMode.Front);
+ break;
+ }
+ }
+
+ private static void SetValue(Material material, string propertyName, float val)
+ {
+ material.SetFloat(propertyName, val);
+ }
+
+ private static void SetColor(Material material, string propertyName, Color color)
+ {
+ material.SetColor(propertyName, color);
+ }
+
+ private static void SetTexture(Material material, string propertyName, Texture texture)
+ {
+ material.SetTexture(propertyName, texture);
+ }
+
+ private static void SetKeyword(Material mat, string keyword, bool required)
+ {
+ if (required)
+ mat.EnableKeyword(keyword);
+ else
+ mat.DisableKeyword(keyword);
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs.meta
new file mode 100644
index 00000000..d49b0361
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsSetter.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: b24a672e82874c9fbfef9c2b2dfdab42
+timeCreated: 1557304397 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs
new file mode 100644
index 00000000..eca797cd
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs
@@ -0,0 +1,8 @@
+namespace MToon
+{
+ public static partial class Utils
+ {
+ public const string Implementation = "Santarh/MToon";
+ public const int VersionNumber = 34;
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs.meta
new file mode 100644
index 00000000..b2f3ef44
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/MToon/Scripts/UtilsVersion.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 4702d4b2c1414cc08b4382c3762eebab
+timeCreated: 1557306172 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/README.md b/Assets/ThirdParty/VRM/VRMShaders/MToon/README.md
new file mode 100644
index 00000000..ec87a007
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/README.md
@@ -0,0 +1,11 @@
+# MToon
+Toon Shader with Unity Global Illumination
+
+## Tutorial
+https://www.slideshare.net/VirtualCast/vrm-mtoon
+
+## Version
+v3.4
+
+## Release Note
+https://github.com/Santarh/MToon/releases
diff --git a/Assets/ThirdParty/VRM/VRMShaders/MToon/README.md.meta b/Assets/ThirdParty/VRM/VRMShaders/MToon/README.md.meta
new file mode 100644
index 00000000..34892776
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/MToon/README.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 1021e7e6d453b9f4fb2f46a130425deb
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/README.md b/Assets/ThirdParty/VRM/VRMShaders/README.md
new file mode 100644
index 00000000..2b81c6bf
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/README.md
@@ -0,0 +1,17 @@
+# VRMShaders
+
+VRM model's supported shaders in Unity.
+
+## Import VRMShaders (Unity 2019.3.4f1~)
+
+`Window` -> `Package Manager` -> `Add package from git URL` and paste `https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders`.
+
+or add the package name and git URL in `Packages/manifest.json`:
+
+```json
+{
+ "dependencies": {
+ "com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders",
+ }
+}
+```
diff --git a/Assets/ThirdParty/VRM/VRMShaders/README.md.meta b/Assets/ThirdParty/VRM/VRMShaders/README.md.meta
new file mode 100644
index 00000000..394b60a7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/README.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 4918a8517e721c5429d0f8033ae065c7
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty.meta
new file mode 100644
index 00000000..4b06ef7b
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f877649750df3814aa5272250b22678c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor.meta
new file mode 100644
index 00000000..8ccaa983
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 36a5a07493511bd49b1ad9dbad2683d2
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs
new file mode 100644
index 00000000..b13dec97
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs
@@ -0,0 +1,99 @@
+using System.Reflection;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+using System.IO;
+using UniGLTF.ShaderPropExporter;
+using System.Collections.Generic;
+
+namespace UniGLTF
+{
+ public static class ShaderPropMenu
+ {
+#if VRM_DEVELOP
+ [MenuItem("VRM/ShaderProperty/PreExport ShaderProps")]
+#endif
+ public static void PreExport()
+ {
+ foreach (var fi in typeof(PreExportShaders).GetFields(
+ BindingFlags.Static
+ | BindingFlags.Public
+ | BindingFlags.NonPublic))
+ {
+ var attr = fi.GetCustomAttributes(true).FirstOrDefault(y => y is PreExportShadersAttribute);
+ if (attr != null)
+ {
+ var supportedShaders = fi.GetValue(null) as SupportedShader[];
+ foreach (var supported in supportedShaders)
+ {
+ PreExport(supported);
+ }
+ }
+ }
+ }
+
+ static string EscapeShaderName(string name)
+ {
+ return name.Replace("/", "_").Replace(" ", "_");
+ }
+
+ static string ExportDir
+ {
+ get
+ {
+ return Application.dataPath + "/VRM/ShaderProperty/Runtime";
+ }
+ }
+
+ static void PreExport(SupportedShader supportedShader)
+ {
+ var shader = Shader.Find(supportedShader.ShaderName);
+ var props = ShaderProps.FromShader(shader);
+
+ var path = Path.Combine(ExportDir, supportedShader.TargetFolder);
+ path = Path.Combine(path, EscapeShaderName(supportedShader.ShaderName) + ".cs").Replace("\\", "/");
+ Debug.LogFormat("PreExport: {0}", path);
+ File.WriteAllText(path, ToString(props, shader.name));
+ }
+
+ static string ToString(ShaderProps props, string shaderName)
+ {
+ var list = new List<string>();
+ foreach (var prop in props.Properties)
+ {
+ list.Add(string.Format("new ShaderProperty(\"{0}\", ShaderPropertyType.{1})\r\n", prop.Key, prop.ShaderPropertyType));
+ }
+
+ return string.Format(@"using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{{
+ public static partial class PreShaderPropExporter
+ {{
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> {0}
+ {{
+ get
+ {{
+ return new KeyValuePair<string, ShaderProps>(
+ ""{1}"",
+ new ShaderProps
+ {{
+ Properties = new ShaderProperty[]{{
+{2}
+ }}
+ }}
+ );
+ }}
+ }}
+ }}
+}}
+"
+, EscapeShaderName(shaderName)
+, shaderName
+, string.Join(",", list.ToArray()));
+ }
+
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs.meta
new file mode 100644
index 00000000..0626004d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderPropMenu.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5eb12c186c6337e4db278b5f01d47cae
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef
new file mode 100644
index 00000000..382622a7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef
@@ -0,0 +1,12 @@
+{
+ "name": "ShaderProperty.Editor",
+ "references": [
+ "ShaderProperty.Runtime"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef.meta
new file mode 100644
index 00000000..f5affb98
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Editor/ShaderProperty.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: bc66ece0f33b52446a0830c05781d4db
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime.meta
new file mode 100644
index 00000000..8fa342db
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: dd900b6f302c9404b99d77a1ae3d00be
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF.meta
new file mode 100644
index 00000000..38d4fd8e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d9c97ad7f5bbcac489a47a2f34dfff00
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs
new file mode 100644
index 00000000..f6fcb767
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs
@@ -0,0 +1,20 @@
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreExportShaders
+ {
+ const string GLTF_FOLDER = "GLTF";
+
+#pragma warning disable 414
+ [PreExportShaders]
+ static SupportedShader[] SupportedShaders = new SupportedShader[]
+ {
+ new SupportedShader(GLTF_FOLDER, "Standard"),
+ new SupportedShader(GLTF_FOLDER, "Unlit/Color"),
+ new SupportedShader(GLTF_FOLDER, "Unlit/Texture"),
+ new SupportedShader(GLTF_FOLDER, "Unlit/Transparent"),
+ new SupportedShader(GLTF_FOLDER, "Unlit/Transparent Cutout"),
+ new SupportedShader(GLTF_FOLDER, "UniGLTF/UniUnlit"),
+ };
+#pragma warning restore 414
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs.meta
new file mode 100644
index 00000000..fa17b509
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/PreExportShaders_GLTF.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 90dcef1978c51e74386b76d77689dc82
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs
new file mode 100644
index 00000000..aa5b342d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs
@@ -0,0 +1,52 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> Standard
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "Standard",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_Color", ShaderPropertyType.Color)
+,new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_Cutoff", ShaderPropertyType.Range)
+,new ShaderProperty("_Glossiness", ShaderPropertyType.Range)
+,new ShaderProperty("_GlossMapScale", ShaderPropertyType.Range)
+,new ShaderProperty("_SmoothnessTextureChannel", ShaderPropertyType.Float)
+,new ShaderProperty("_Metallic", ShaderPropertyType.Range)
+,new ShaderProperty("_MetallicGlossMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_SpecularHighlights", ShaderPropertyType.Float)
+,new ShaderProperty("_GlossyReflections", ShaderPropertyType.Float)
+,new ShaderProperty("_BumpScale", ShaderPropertyType.Float)
+,new ShaderProperty("_BumpMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_Parallax", ShaderPropertyType.Range)
+,new ShaderProperty("_ParallaxMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_OcclusionStrength", ShaderPropertyType.Range)
+,new ShaderProperty("_OcclusionMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_EmissionColor", ShaderPropertyType.Color)
+,new ShaderProperty("_EmissionMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_DetailMask", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_DetailAlbedoMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_DetailNormalMapScale", ShaderPropertyType.Float)
+,new ShaderProperty("_DetailNormalMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_UVSec", ShaderPropertyType.Float)
+,new ShaderProperty("_Mode", ShaderPropertyType.Float)
+,new ShaderProperty("_SrcBlend", ShaderPropertyType.Float)
+,new ShaderProperty("_DstBlend", ShaderPropertyType.Float)
+,new ShaderProperty("_ZWrite", ShaderPropertyType.Float)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs.meta
new file mode 100644
index 00000000..abf6b6c8
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Standard.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 54043e349b047bf4b8f127cd919a757d
+timeCreated: 1533542890
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs
new file mode 100644
index 00000000..ce4503a7
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> UniGLTF_UniUnlit
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "UniGLTF/UniUnlit",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_Color", ShaderPropertyType.Color)
+,new ShaderProperty("_Cutoff", ShaderPropertyType.Range)
+,new ShaderProperty("_BlendMode", ShaderPropertyType.Float)
+,new ShaderProperty("_CullMode", ShaderPropertyType.Float)
+,new ShaderProperty("_VColBlendMode", ShaderPropertyType.Float)
+,new ShaderProperty("_SrcBlend", ShaderPropertyType.Float)
+,new ShaderProperty("_DstBlend", ShaderPropertyType.Float)
+,new ShaderProperty("_ZWrite", ShaderPropertyType.Float)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs.meta
new file mode 100644
index 00000000..c1315f41
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/UniGLTF_UniUnlit.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ad4b6b115b83ecd48a513f697afc95f0
+timeCreated: 1537860074
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs
new file mode 100644
index 00000000..1ef6c3a0
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> Unlit_Color
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "Unlit/Color",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_Color", ShaderPropertyType.Color)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs.meta
new file mode 100644
index 00000000..4f97a3c6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Color.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4f91421c5846d5d48933d2ee4ffeeceb
+timeCreated: 1535186213
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs
new file mode 100644
index 00000000..ed6f487a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> Unlit_Texture
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "Unlit/Texture",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs.meta
new file mode 100644
index 00000000..83320688
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Texture.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8273e1e61ad8e914baae94d06836f2ad
+timeCreated: 1535186213
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs
new file mode 100644
index 00000000..cad3b4b9
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> Unlit_Transparent
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "Unlit/Transparent",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs.meta
new file mode 100644
index 00000000..f64c6558
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b98a8ee8ca13abb43809305cc4e5571a
+timeCreated: 1535186213
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs
new file mode 100644
index 00000000..ebe366b5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> Unlit_Transparent_Cutout
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "Unlit/Transparent Cutout",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_Cutoff", ShaderPropertyType.Range)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs.meta
new file mode 100644
index 00000000..5ffeb3f4
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/GLTF/Unlit_Transparent_Cutout.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 844490f13976543478d82efe28251941
+timeCreated: 1535186301
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs
new file mode 100644
index 00000000..bdc6b49d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using UnityEngine;
+#if UNITY_EDITOR
+using UnityEditor;
+#endif
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public class PreExportShadersAttribute : Attribute { }
+ public class PreExportShaderAttribute : Attribute { }
+
+ public struct SupportedShader
+ {
+ public string TargetFolder;
+ public string ShaderName;
+
+ public SupportedShader(string targetFolder, string shaderName)
+ {
+ TargetFolder = targetFolder;
+ ShaderName = shaderName;
+ }
+ }
+
+ public static partial class PreShaderPropExporter
+ {
+ static Dictionary<string, ShaderProps> m_shaderPropMap;
+
+ public static ShaderProps GetPropsForSupportedShader(string shaderName)
+ {
+ if (m_shaderPropMap == null)
+ {
+ m_shaderPropMap = new Dictionary<string, ShaderProps>();
+ foreach (var prop in typeof(PreShaderPropExporter).GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
+ {
+ if (prop.GetCustomAttributes(typeof(PreExportShaderAttribute), true).Any())
+ {
+ var kv = (KeyValuePair<string, ShaderProps>)prop.GetValue(null, null);
+ m_shaderPropMap.Add(kv.Key, kv.Value);
+ }
+ }
+ }
+
+ ShaderProps props;
+ if (m_shaderPropMap.TryGetValue(shaderName, out props))
+ {
+ return props;
+ }
+
+#if UNITY_EDITOR
+ // fallback
+ Debug.LogWarningFormat("{0} is not predefined shader. Use ShaderUtil", shaderName);
+ var shader = Shader.Find(shaderName);
+ return ShaderProps.FromShader(shader);
+#else
+ return null;
+#endif
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs.meta
new file mode 100644
index 00000000..431e9cca
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/PreShaderPropExporter.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 50935dd2f9f3fa445a687f30d4dd663b
+timeCreated: 1533035131
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef
new file mode 100644
index 00000000..ed0a498d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef
@@ -0,0 +1,8 @@
+{
+ "name": "ShaderProperty.Runtime",
+ "references": [],
+ "optionalUnityReferences": [],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef.meta
new file mode 100644
index 00000000..ec0da628
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProperty.Runtime.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 301b251fd9834274c9228e0532f444f7
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs
new file mode 100644
index 00000000..36d9a825
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs
@@ -0,0 +1,67 @@
+#if UNITY_EDITOR
+using System;
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+#endif
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public enum ShaderPropertyType
+ {
+ TexEnv,
+ Color,
+ Range,
+ Float,
+ Vector,
+ }
+
+ public struct ShaderProperty
+ {
+ public string Key;
+ public ShaderPropertyType ShaderPropertyType;
+
+ public ShaderProperty(string key, ShaderPropertyType propType)
+ {
+ Key = key;
+ ShaderPropertyType = propType;
+ }
+ }
+
+ public class ShaderProps
+ {
+ public ShaderProperty[] Properties;
+
+#if UNITY_EDITOR
+ static ShaderPropertyType ConvType(ShaderUtil.ShaderPropertyType src)
+ {
+ switch (src)
+ {
+ case ShaderUtil.ShaderPropertyType.TexEnv: return ShaderPropertyType.TexEnv;
+ case ShaderUtil.ShaderPropertyType.Color: return ShaderPropertyType.Color;
+ case ShaderUtil.ShaderPropertyType.Float: return ShaderPropertyType.Float;
+ case ShaderUtil.ShaderPropertyType.Range: return ShaderPropertyType.Range;
+ case ShaderUtil.ShaderPropertyType.Vector: return ShaderPropertyType.Vector;
+ default: throw new NotImplementedException();
+ }
+ }
+
+ public static ShaderProps FromShader(Shader shader)
+ {
+ var properties = new List<ShaderProperty>();
+ for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); ++i)
+ {
+ var name = ShaderUtil.GetPropertyName(shader, i);
+ var propType = ShaderUtil.GetPropertyType(shader, i);
+ properties.Add(new ShaderProperty(name, ConvType(propType)));
+ }
+
+ return new ShaderProps
+ {
+ Properties = properties.ToArray(),
+ };
+ }
+#endif
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs.meta
new file mode 100644
index 00000000..b078bfe6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/ShaderProps.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 279964035c950b24cb745511298855dd
+timeCreated: 1533539330
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM.meta
new file mode 100644
index 00000000..6d0ee19d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: eb31f565eeca6164694b06ccfe3bc251
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs
new file mode 100644
index 00000000..f246304c
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs
@@ -0,0 +1,16 @@
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreExportShaders
+ {
+ const string VRM_TARGET_FOLDER = "VRM";
+ [PreExportShaders]
+ public static SupportedShader[] VRMSupportedShaders = new SupportedShader[]
+ {
+ new SupportedShader(VRM_TARGET_FOLDER, "VRM/MToon"),
+ new SupportedShader(VRM_TARGET_FOLDER, "VRM/UnlitTexture"),
+ new SupportedShader(VRM_TARGET_FOLDER, "VRM/UnlitCutout"),
+ new SupportedShader(VRM_TARGET_FOLDER, "VRM/UnlitTransparent"),
+ new SupportedShader(VRM_TARGET_FOLDER, "VRM/UnlitTransparentZWrite"),
+ };
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs.meta
new file mode 100644
index 00000000..d0fd45ca
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/PreExportShaders_VRM.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 625b5ee8b5811dc4a915a2fbb2cb319d
+timeCreated: 1533035131
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs
new file mode 100644
index 00000000..f5fc6f15
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs
@@ -0,0 +1,67 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> VRM_MToon
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "VRM/MToon",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_Cutoff", ShaderPropertyType.Range)
+,new ShaderProperty("_Color", ShaderPropertyType.Color)
+,new ShaderProperty("_ShadeColor", ShaderPropertyType.Color)
+,new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_ShadeTexture", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_BumpScale", ShaderPropertyType.Float)
+,new ShaderProperty("_BumpMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_ReceiveShadowRate", ShaderPropertyType.Range)
+,new ShaderProperty("_ReceiveShadowTexture", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_ShadingGradeRate", ShaderPropertyType.Range)
+,new ShaderProperty("_ShadingGradeTexture", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_ShadeShift", ShaderPropertyType.Range)
+,new ShaderProperty("_ShadeToony", ShaderPropertyType.Range)
+,new ShaderProperty("_LightColorAttenuation", ShaderPropertyType.Range)
+,new ShaderProperty("_IndirectLightIntensity", ShaderPropertyType.Range)
+,new ShaderProperty("_RimColor", ShaderPropertyType.Color)
+,new ShaderProperty("_RimTexture", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_RimLightingMix", ShaderPropertyType.Range)
+,new ShaderProperty("_RimFresnelPower", ShaderPropertyType.Range)
+,new ShaderProperty("_RimLift", ShaderPropertyType.Range)
+,new ShaderProperty("_SphereAdd", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_EmissionColor", ShaderPropertyType.Color)
+,new ShaderProperty("_EmissionMap", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_OutlineWidthTexture", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_OutlineWidth", ShaderPropertyType.Range)
+,new ShaderProperty("_OutlineScaledMaxDistance", ShaderPropertyType.Range)
+,new ShaderProperty("_OutlineColor", ShaderPropertyType.Color)
+,new ShaderProperty("_OutlineLightingMix", ShaderPropertyType.Range)
+,new ShaderProperty("_UvAnimMaskTexture", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_UvAnimScrollX", ShaderPropertyType.Float)
+,new ShaderProperty("_UvAnimScrollY", ShaderPropertyType.Float)
+,new ShaderProperty("_UvAnimRotation", ShaderPropertyType.Float)
+,new ShaderProperty("_MToonVersion", ShaderPropertyType.Float)
+,new ShaderProperty("_DebugMode", ShaderPropertyType.Float)
+,new ShaderProperty("_BlendMode", ShaderPropertyType.Float)
+,new ShaderProperty("_OutlineWidthMode", ShaderPropertyType.Float)
+,new ShaderProperty("_OutlineColorMode", ShaderPropertyType.Float)
+,new ShaderProperty("_CullMode", ShaderPropertyType.Float)
+,new ShaderProperty("_OutlineCullMode", ShaderPropertyType.Float)
+,new ShaderProperty("_SrcBlend", ShaderPropertyType.Float)
+,new ShaderProperty("_DstBlend", ShaderPropertyType.Float)
+,new ShaderProperty("_ZWrite", ShaderPropertyType.Float)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs.meta
new file mode 100644
index 00000000..26afcbf6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_MToon.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4629d794c8969c141a4724e182af082e
+timeCreated: 1533542890
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs
new file mode 100644
index 00000000..8695f72f
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> VRM_UnlitCutout
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "VRM/UnlitCutout",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+,new ShaderProperty("_Cutoff", ShaderPropertyType.Range)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs.meta
new file mode 100644
index 00000000..3f6607d2
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitCutout.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 611b546ea471ad34cb7d94740c63b558
+timeCreated: 1533542890
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs
new file mode 100644
index 00000000..6a0ab5b3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> VRM_UnlitTexture
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "VRM/UnlitTexture",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs.meta
new file mode 100644
index 00000000..181adad3
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTexture.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 22a8083880389b3498f421e6a5c340d5
+timeCreated: 1533542890
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs
new file mode 100644
index 00000000..2c750386
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> VRM_UnlitTransparent
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "VRM/UnlitTransparent",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs.meta
new file mode 100644
index 00000000..eeaf3b8d
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparent.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 140d6538826e0eb448929d3e4bb2f1cd
+timeCreated: 1533542890
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs
new file mode 100644
index 00000000..8d03c4ec
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+
+
+namespace UniGLTF.ShaderPropExporter
+{
+ public static partial class PreShaderPropExporter
+ {
+ [PreExportShader]
+ static KeyValuePair<string, ShaderProps> VRM_UnlitTransparentZWrite
+ {
+ get
+ {
+ return new KeyValuePair<string, ShaderProps>(
+ "VRM/UnlitTransparentZWrite",
+ new ShaderProps
+ {
+ Properties = new ShaderProperty[]{
+new ShaderProperty("_MainTex", ShaderPropertyType.TexEnv)
+
+ }
+ }
+ );
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs.meta
new file mode 100644
index 00000000..6efeb43e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/ShaderProperty/Runtime/VRM/VRM_UnlitTransparentZWrite.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 165ec79b7aac1564a850fb3d3d19396e
+timeCreated: 1533542890
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit.meta
new file mode 100644
index 00000000..7506b521
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: efc9c56620a6dea44a8cd83c5897e058
+folderAsset: yes
+timeCreated: 1535618674
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta
new file mode 100644
index 00000000..6d77c082
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c1ce4da7404d095459d80006a8609a1c
+folderAsset: yes
+timeCreated: 1535618691
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef
new file mode 100644
index 00000000..564a54cc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef
@@ -0,0 +1,12 @@
+{
+ "name": "UniUnlit.Editor",
+ "references": [
+ "UniUnlit"
+ ],
+ "optionalUnityReferences": [],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta
new file mode 100644
index 00000000..43cedc39
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlit.Editor.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 529ce3a240c1a7a4bbbb220bbd59686b
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs
new file mode 100644
index 00000000..326f129a
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+
+namespace UniGLTF.UniUnlit
+{
+ public class UniUnlitEditor : ShaderGUI
+ {
+ private MaterialProperty _mainTex;
+ private MaterialProperty _color;
+ private MaterialProperty _cutoff;
+ private MaterialProperty _blendMode;
+ private MaterialProperty _cullMode;
+ private MaterialProperty _vColBlendMode;
+// private MaterialProperty _srcBlend;
+// private MaterialProperty _dstBlend;
+// private MaterialProperty _zWrite;
+
+ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
+ {
+ _mainTex = FindProperty(Utils.PropNameMainTex, properties);
+ _color = FindProperty(Utils.PropNameColor, properties);
+ _cutoff = FindProperty(Utils.PropNameCutoff, properties);
+ _blendMode = FindProperty(Utils.PropNameBlendMode, properties);
+ _cullMode = FindProperty(Utils.PropNameCullMode, properties);
+ _vColBlendMode = FindProperty(Utils.PropNameVColBlendMode, properties);
+// _srcBlend = FindProperty(PropNameSrcBlend, properties);
+// _dstBlend = FindProperty(PropNameDstBlend, properties);
+// _zWrite = FindProperty(PropNameZWrite, properties);
+
+ var materials = materialEditor.targets.Select(x => x as Material).ToArray();
+
+ EditorGUI.BeginChangeCheck();
+ {
+ DrawRenderingBox(materialEditor, materials);
+ DrawColorBox(materialEditor, materials);
+ DrawOptionsBox(materialEditor, materials);
+ }
+ EditorGUI.EndChangeCheck();
+ }
+
+ public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
+ {
+ var blendMode = UniUnlitRenderMode.Opaque;
+ if (material.HasProperty(Utils.PropNameStandardShadersRenderMode)) // from Standard shader
+ {
+ blendMode = (UniUnlitRenderMode) Math.Min(2f, material.GetFloat(Utils.PropNameStandardShadersRenderMode));
+ }
+
+ // assigns UniUnlit's properties...
+ base.AssignNewShaderToMaterial(material, oldShader, newShader);
+
+ // take over old value
+ material.SetFloat(Utils.PropNameBlendMode, (float) blendMode);
+
+ Utils.ValidateProperties(material, isRenderModeChangedByUser: true);
+ }
+
+ private void DrawRenderingBox(MaterialEditor materialEditor, Material[] materials)
+ {
+ EditorGUILayout.LabelField("Rendering", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ if (PopupEnum<UniUnlitRenderMode>("Rendering Type", _blendMode, materialEditor))
+ {
+ ModeChanged(materials, isRenderModeChangedByUser: true);
+ }
+ if (PopupEnum<UniUnlitCullMode>("Cull Mode", _cullMode, materialEditor))
+ {
+ ModeChanged(materials, isRenderModeChangedByUser: true);
+ }
+ EditorGUILayout.Space();
+
+ switch ((UniUnlitRenderMode) _blendMode.floatValue)
+ {
+ case UniUnlitRenderMode.Cutout:
+ materialEditor.ShaderProperty(_cutoff, "Cutoff");
+ break;
+ case UniUnlitRenderMode.Opaque:
+ case UniUnlitRenderMode.Transparent:
+ break;
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+ }
+
+ private void DrawColorBox(MaterialEditor materialEditor, Material[] materials)
+ {
+ EditorGUILayout.LabelField("Color", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Main Tex", "(RGBA)"), _mainTex, _color);
+ materialEditor.TextureScaleOffsetProperty(_mainTex);
+ EditorGUILayout.Space();
+
+ if (PopupEnum<UniUnlitVertexColorBlendOp>("Vertex Color Blend Mode", _vColBlendMode, materialEditor))
+ {
+ ModeChanged(materials, isRenderModeChangedByUser: true);
+ }
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+ }
+
+ private void DrawOptionsBox(MaterialEditor materialEditor, Material[] materials)
+ {
+ EditorGUILayout.LabelField("Options", EditorStyles.boldLabel);
+ EditorGUILayout.BeginVertical(GUI.skin.box);
+ {
+ #if UNITY_5_6_OR_NEWER
+// materialEditor.EnableInstancingField();
+ materialEditor.DoubleSidedGIField();
+ #endif
+ materialEditor.RenderQueueField();
+ }
+ EditorGUILayout.EndVertical();
+ EditorGUILayout.Space();
+ }
+
+ private static bool PopupEnum<T>(string name, MaterialProperty property, MaterialEditor editor) where T : struct
+ {
+ if (!typeof(T).IsEnum) return false;
+
+ EditorGUI.showMixedValue = property.hasMixedValue;
+ EditorGUI.BeginChangeCheck();
+ var values = (T[]) Enum.GetValues(typeof(T));
+ var names = Enum.GetNames(typeof(T));
+
+ var currInt = (int) property.floatValue;
+ var currValue = (T) Enum.ToObject(typeof(T), currInt);
+ var currIndex = Array.IndexOf(values, currValue);
+ var nextIndex = EditorGUILayout.Popup(name, currIndex, names);
+ var changed = EditorGUI.EndChangeCheck();
+ if (changed)
+ {
+ editor.RegisterPropertyChangeUndo("EnumPopUp");
+ var nextValue = values[nextIndex];
+ var nextInt = (int) (object) nextValue;
+ property.floatValue = nextInt;
+ }
+ EditorGUI.showMixedValue = false;
+ return changed;
+ }
+
+
+ private static void ModeChanged(Material[] materials, bool isRenderModeChangedByUser = false)
+ {
+ foreach (var material in materials)
+ {
+ Utils.ValidateProperties(material, isRenderModeChangedByUser);
+ }
+ }
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta
new file mode 100644
index 00000000..7d35d3e6
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Editor/UniUnlitEditor.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4c70714358bb2fb4fa96ef08640763fd
+timeCreated: 1514224771
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta
new file mode 100644
index 00000000..61659788
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 9e133c6453ae1c54c931227ff64edd52
+folderAsset: yes
+timeCreated: 1535618682
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader
new file mode 100644
index 00000000..2e2466a1
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader
@@ -0,0 +1,101 @@
+Shader "UniGLTF/UniUnlit"
+{
+ Properties
+ {
+ _MainTex ("Texture", 2D) = "white" {}
+ _Color ("Main Color", COLOR) = (1,1,1,1)
+ _Cutoff ("Alpha Cutoff", Range(0, 1)) = 0.5
+
+ [HideInInspector] _BlendMode ("_BlendMode", Float) = 0.0
+ [HideInInspector] _CullMode ("_CullMode", Float) = 2.0
+ [HideInInspector] _VColBlendMode ("_VColBlendMode", Float) = 0.0
+ [HideInInspector] _SrcBlend ("_SrcBlend", Float) = 1.0
+ [HideInInspector] _DstBlend ("_DstBlend", Float) = 0.0
+ [HideInInspector] _ZWrite ("_ZWrite", Float) = 1.0
+
+ // VertexColor
+ }
+ SubShader
+ {
+ Tags { "RenderType"="Opaque" }
+ LOD 100
+
+ Pass
+ {
+ Cull [_CullMode]
+ Blend [_SrcBlend] [_DstBlend]
+ ZWrite [_ZWrite]
+ ZTest LEqual
+ BlendOp Add, Max
+
+ CGPROGRAM
+ #pragma vertex vert
+ #pragma fragment frag
+ #pragma multi_compile_fog
+ #pragma multi_compile _ _ALPHATEST_ON _ALPHABLEND_ON
+ #pragma multi_compile _ _VERTEXCOL_MUL
+
+ #include "UnityCG.cginc"
+
+ struct appdata
+ {
+ float4 vertex : POSITION;
+ float2 uv : TEXCOORD0;
+ #if defined(_VERTEXCOL_MUL)
+ fixed4 color : COLOR;
+ #endif
+ };
+
+ struct v2f
+ {
+ float4 vertex : SV_POSITION;
+ float2 uv : TEXCOORD0;
+ UNITY_FOG_COORDS(1)
+ #if defined(_VERTEXCOL_MUL)
+ fixed4 color : COLOR;
+ #endif
+ };
+
+ sampler2D _MainTex;
+ float4 _MainTex_ST;
+ half4 _Color;
+ half _Cutoff;
+
+ v2f vert (appdata v)
+ {
+ v2f o;
+ o.vertex = UnityObjectToClipPos(v.vertex);
+ o.uv = TRANSFORM_TEX(v.uv, _MainTex);
+ UNITY_TRANSFER_FOG(o,o.vertex);
+
+ #if defined(_VERTEXCOL_MUL)
+ o.color = v.color;
+ #endif
+ return o;
+ }
+
+ fixed4 frag (v2f i) : SV_Target
+ {
+ fixed4 col = tex2D(_MainTex, i.uv) * _Color;
+
+ #if defined(_VERTEXCOL_MUL)
+ col *= i.color;
+ #endif
+
+ #if defined(_ALPHATEST_ON)
+ clip(col.a - _Cutoff);
+ #endif
+
+ #if !defined(_ALPHATEST_ON) && !defined(_ALPHABLEND_ON)
+ col.a = 1.0;
+ #endif
+
+ UNITY_APPLY_FOG(i.fogCoord, col);
+ return col;
+ }
+ ENDCG
+ }
+ }
+ CustomEditor "UniGLTF.UniUnlit.UniUnlitEditor"
+ Fallback "Unlit/Texture"
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta
new file mode 100644
index 00000000..750c8aba
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Resources/UniUnlit.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8c17b56f4bf084c47872edcb95237e4a
+timeCreated: 1535616926
+licenseType: Free
+ShaderImporter:
+ defaultTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta
new file mode 100644
index 00000000..183e72bc
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b19f3d26eec098d46a33d8d35ba2eab5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs
new file mode 100644
index 00000000..74c47405
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs
@@ -0,0 +1,153 @@
+using System;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+namespace UniGLTF.UniUnlit
+{
+ public enum UniUnlitRenderMode
+ {
+ Opaque = 0,
+ Cutout = 1,
+ Transparent = 2,
+ }
+
+ public enum UniUnlitCullMode
+ {
+ Off = 0,
+ // Front = 1,
+ Back = 2,
+ }
+
+ public enum UniUnlitVertexColorBlendOp
+ {
+ None = 0,
+ Multiply = 1,
+ }
+
+ public static class Utils
+ {
+ public const string ShaderName = "UniGLTF/UniUnlit";
+ public const string PropNameMainTex = "_MainTex";
+ public const string PropNameColor = "_Color";
+ public const string PropNameCutoff = "_Cutoff";
+ public const string PropNameBlendMode = "_BlendMode";
+ public const string PropNameCullMode = "_CullMode";
+ [Obsolete("Use PropNameVColBlendMode")]
+ public const string PropeNameVColBlendMode = PropNameVColBlendMode;
+ public const string PropNameVColBlendMode = "_VColBlendMode";
+ public const string PropNameSrcBlend = "_SrcBlend";
+ public const string PropNameDstBlend = "_DstBlend";
+ public const string PropNameZWrite = "_ZWrite";
+
+ public const string PropNameStandardShadersRenderMode = "_Mode";
+
+ public const string KeywordAlphaTestOn = "_ALPHATEST_ON";
+ public const string KeywordAlphaBlendOn = "_ALPHABLEND_ON";
+ public const string KeywordVertexColMul = "_VERTEXCOL_MUL";
+
+ public const string TagRenderTypeKey = "RenderType";
+ public const string TagRenderTypeValueOpaque = "Opaque";
+ public const string TagRenderTypeValueTransparentCutout = "TransparentCutout";
+ public const string TagRenderTypeValueTransparent = "Transparent";
+
+ public static void SetRenderMode(Material material, UniUnlitRenderMode mode)
+ {
+ material.SetInt(PropNameBlendMode, (int)mode);
+ }
+
+ public static void SetCullMode(Material material, UniUnlitCullMode mode)
+ {
+ material.SetInt(PropNameCullMode, (int)mode);
+ }
+
+ public static void SetVColBlendMode(Material material, UniUnlitVertexColorBlendOp mode)
+ {
+ material.SetInt(PropNameVColBlendMode, (int)mode);
+ }
+
+ public static UniUnlitRenderMode GetRenderMode(Material material)
+ {
+ return (UniUnlitRenderMode)material.GetInt(PropNameBlendMode);
+ }
+
+ public static UniUnlitCullMode GetCullMode(Material material)
+ {
+ return (UniUnlitCullMode)material.GetInt(PropNameCullMode);
+ }
+
+ public static UniUnlitVertexColorBlendOp GetVColBlendMode(Material material)
+ {
+ return (UniUnlitVertexColorBlendOp)material.GetInt(PropNameVColBlendMode);
+ }
+
+ /// <summary>
+ /// Validate target material's UniUnlitRenderMode, UniUnlitVertexColorBlendOp.
+ /// Set appropriate hidden properties & keywords.
+ /// This will change RenderQueue independent to UniUnlitRenderMode if isRenderModeChangedByUser is true.
+ /// </summary>
+ /// <param name="material">Target material</param>
+ /// <param name="isRenderModeChangedByUser">Is changed by user</param>
+ public static void ValidateProperties(Material material, bool isRenderModeChangedByUser = false)
+ {
+ SetupBlendMode(material, (UniUnlitRenderMode)material.GetFloat(PropNameBlendMode),
+ isRenderModeChangedByUser);
+ SetupVertexColorBlendOp(material, (UniUnlitVertexColorBlendOp)material.GetFloat(PropNameVColBlendMode));
+ }
+
+ private static void SetupBlendMode(Material material, UniUnlitRenderMode renderMode,
+ bool isRenderModeChangedByUser = false)
+ {
+ switch (renderMode)
+ {
+ case UniUnlitRenderMode.Opaque:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueOpaque);
+ material.SetInt(PropNameSrcBlend, (int)BlendMode.One);
+ material.SetInt(PropNameDstBlend, (int)BlendMode.Zero);
+ material.SetInt(PropNameZWrite, 1);
+ SetKeyword(material, KeywordAlphaTestOn, false);
+ SetKeyword(material, KeywordAlphaBlendOn, false);
+ if (isRenderModeChangedByUser) material.renderQueue = -1;
+ break;
+ case UniUnlitRenderMode.Cutout:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparentCutout);
+ material.SetInt(PropNameSrcBlend, (int)BlendMode.One);
+ material.SetInt(PropNameDstBlend, (int)BlendMode.Zero);
+ material.SetInt(PropNameZWrite, 1);
+ SetKeyword(material, KeywordAlphaTestOn, true);
+ SetKeyword(material, KeywordAlphaBlendOn, false);
+ if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.AlphaTest;
+ break;
+ case UniUnlitRenderMode.Transparent:
+ material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparent);
+ material.SetInt(PropNameSrcBlend, (int)BlendMode.SrcAlpha);
+ material.SetInt(PropNameDstBlend, (int)BlendMode.OneMinusSrcAlpha);
+ material.SetInt(PropNameZWrite, 0);
+ SetKeyword(material, KeywordAlphaTestOn, false);
+ SetKeyword(material, KeywordAlphaBlendOn, true);
+ if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.Transparent;
+ break;
+ }
+ }
+
+ private static void SetupVertexColorBlendOp(Material material, UniUnlitVertexColorBlendOp vColBlendOp)
+ {
+ switch (vColBlendOp)
+ {
+ case UniUnlitVertexColorBlendOp.None:
+ SetKeyword(material, KeywordVertexColMul, false);
+ break;
+ case UniUnlitVertexColorBlendOp.Multiply:
+ SetKeyword(material, KeywordVertexColMul, true);
+ break;
+ }
+ }
+
+ private static void SetKeyword(Material mat, string keyword, bool required)
+ {
+ if (required)
+ mat.EnableKeyword(keyword);
+ else
+ mat.DisableKeyword(keyword);
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta
new file mode 100644
index 00000000..7824f085
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/Scripts/Utils.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: e96cbbd810384352a6799dd731533178
+timeCreated: 1537534399 \ No newline at end of file
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef
new file mode 100644
index 00000000..e58648d5
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef
@@ -0,0 +1,3 @@
+{
+ "name": "UniUnlit"
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta
new file mode 100644
index 00000000..4d059abe
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/UniUnlit/UniUnlit.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 60c8346e00a8ddd4cafc5a02eceeec57
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/ThirdParty/VRM/VRMShaders/package.json b/Assets/ThirdParty/VRM/VRMShaders/package.json
new file mode 100644
index 00000000..d2478d4e
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "com.vrmc.vrmshaders",
+ "version": "0.61.0",
+ "displayName": "VRM Shaders",
+ "description": "VRM Shaders",
+ "unity": "2018.4",
+ "keywords": [
+ "vrm",
+ "shader"
+ ],
+ "author": {
+ "name": "VRM Consortium"
+ }
+}
diff --git a/Assets/ThirdParty/VRM/VRMShaders/package.json.meta b/Assets/ThirdParty/VRM/VRMShaders/package.json.meta
new file mode 100644
index 00000000..e778f559
--- /dev/null
+++ b/Assets/ThirdParty/VRM/VRMShaders/package.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0905ad83e0b774444bcc48ac9a191d51
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: