diff --git a/.gitignore b/.gitignore
index 1e91fb883..7d218df0d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,6 +54,7 @@ Assets/StreamingAssets/crashlytics-build.properties
.idea/
Assets/_Private/
Assets/_Private.meta
+UserSettings/
# Unity
/ProjectSettings/BurstAotSettings_StandaloneWindows.json
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/ExportDialogState.cs b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/ExportDialogState.cs
index b592a438a..dfced70da 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/ExportDialogState.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ExportDialog/ExportDialogState.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
+using VRMShaders;
namespace UniGLTF
{
@@ -58,9 +59,10 @@ namespace UniGLTF
}
if (m_root.IsPrefab)
{
-#if VRM_DEVELOP
- Debug.Log($"PrefabUtility.UnloadPrefabContents({m_root.GameObject})");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.Log($"PrefabUtility.UnloadPrefabContents({m_root.GameObject})");
+ }
PrefabUtility.UnloadPrefabContents(m_root.GameObject);
}
m_root = (value, isPrefab);
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs
index 12bb984ce..9bed4d9c4 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/GltfScriptedImporterBase.cs
@@ -57,9 +57,10 @@ namespace UniGLTF
///
protected static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, Axes reverseAxis, RenderPipelineTypes renderPipeline)
{
-#if VRM_DEVELOP
- Debug.Log("OnImportAsset to " + scriptedImporter.assetPath);
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.Log("OnImportAsset to " + scriptedImporter.assetPath);
+ }
//
// Import(create unity objects)
diff --git a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/TextureExtractor.cs b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/TextureExtractor.cs
index 3824ccd7d..8077b58b3 100644
--- a/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/TextureExtractor.cs
+++ b/Assets/UniGLTF/Editor/UniGLTF/ScriptedImporter/TextureExtractor.cs
@@ -92,9 +92,6 @@ namespace UniGLTF
{
// remap
var externalObject = targetPath.LoadAsset();
-#if VRM_DEVELOP
- // Debug.Log($"remap: {targetPath} => {externalObject}");
-#endif
if (externalObject != null)
{
addRemap(key, externalObject);
diff --git a/Assets/UniGLTF/Runtime/MeshUtility/BoneNormalizer.cs b/Assets/UniGLTF/Runtime/MeshUtility/BoneNormalizer.cs
index 3fe17d482..e642d0cba 100644
--- a/Assets/UniGLTF/Runtime/MeshUtility/BoneNormalizer.cs
+++ b/Assets/UniGLTF/Runtime/MeshUtility/BoneNormalizer.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
+using VRMShaders;
namespace UniGLTF.MeshUtility
@@ -307,9 +308,11 @@ namespace UniGLTF.MeshUtility
var meshVertices = mesh.vertices;
var meshNormals = mesh.normals;
-#if VRM_NORMALIZE_BLENDSHAPE_TANGENT
- var meshTangents = mesh.tangents.Select(x => (Vector3)x).ToArray();
-#endif
+ var meshTangents = Array.Empty();
+ if (Symbols.VRM_NORMALIZE_BLENDSHAPE_TANGENT)
+ {
+ meshTangents = mesh.tangents.Select(x => (Vector3)x).ToArray();
+ }
var originalBlendShapePositions = new Vector3[meshVertices.Length];
var originalBlendShapeNormals = new Vector3[meshVertices.Length];
@@ -323,11 +326,11 @@ namespace UniGLTF.MeshUtility
srcRenderer.sharedMesh.GetBlendShapeFrameVertices(i, 0, originalBlendShapePositions, originalBlendShapeNormals, originalBlendShapeTangents);
var hasVertices = originalBlendShapePositions.Count(x => x != Vector3.zero);
var hasNormals = originalBlendShapeNormals.Count(x => x != Vector3.zero);
-#if VRM_NORMALIZE_BLENDSHAPE_TANGENT
- var hasTangents = originalBlendShapeTangents.Count(x => x != Vector3.zero);
-#else
var hasTangents = 0;
-#endif
+ if (Symbols.VRM_NORMALIZE_BLENDSHAPE_TANGENT)
+ {
+ hasTangents = originalBlendShapeTangents.Count(x => x != Vector3.zero);
+ }
var name = srcMesh.GetBlendShapeName(i);
if (string.IsNullOrEmpty(name))
{
@@ -375,19 +378,20 @@ namespace UniGLTF.MeshUtility
}
Vector3[] tangents = blendShapeMesh.tangents.Select(x => (Vector3)x).ToArray();
-#if VRM_NORMALIZE_BLENDSHAPE_TANGENT
- for (int j = 0; j < tangents.Length; ++j)
+ if (Symbols.VRM_NORMALIZE_BLENDSHAPE_TANGENT)
{
- if (originalBlendShapeTangents[j] == Vector3.zero)
+ for (int j = 0; j < tangents.Length; ++j)
{
- tangents[j] = Vector3.zero;
- }
- else
- {
- tangents[j] = m.MultiplyVector(tangents[j]) - meshTangents[j];
+ if (originalBlendShapeTangents[j] == Vector3.zero)
+ {
+ tangents[j] = Vector3.zero;
+ }
+ else
+ {
+ tangents[j] = m.MultiplyVector(tangents[j]) - meshTangents[j];
+ }
}
}
-#endif
var frameCount = srcMesh.GetBlendShapeFrameCount(i);
for (int f = 0; f < frameCount; f++)
diff --git a/Assets/UniGLTF/Runtime/MeshUtility/MeshExtensions.cs b/Assets/UniGLTF/Runtime/MeshUtility/MeshExtensions.cs
index 9f28ce281..f4a37a4bb 100644
--- a/Assets/UniGLTF/Runtime/MeshUtility/MeshExtensions.cs
+++ b/Assets/UniGLTF/Runtime/MeshUtility/MeshExtensions.cs
@@ -1,5 +1,6 @@
using UnityEngine;
using System.Linq;
+using VRMShaders;
namespace UniGLTF.MeshUtility
@@ -53,11 +54,11 @@ namespace UniGLTF.MeshUtility
{
var vertices = src.vertices;
var normals = src.normals;
-#if VRM_NORMALIZE_BLENDSHAPE_TANGENT
- var tangents = src.tangents.Select(x => (Vector3)x).ToArray();
-#else
Vector3[] tangents = null;
-#endif
+ if (Symbols.VRM_NORMALIZE_BLENDSHAPE_TANGENT)
+ {
+ tangents = src.tangents.Select(x => (Vector3)x).ToArray();
+ }
for (int i = 0; i < src.blendShapeCount; ++i)
{
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContextExtensions.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContextExtensions.cs
index 48b488e35..e804697f5 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContextExtensions.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContextExtensions.cs
@@ -22,9 +22,10 @@ namespace UniGLTF
throw new AggregateException(task.Exception);
}
-#if VRM_DEVELOP
- Debug.Log($"{self.Data.TargetPath}: {meassureTime.GetSpeedLog()}");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.Log($"{self.Data.TargetPath}: {meassureTime.GetSpeedLog()}");
+ }
return task.Result;
}
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/BuiltinRP/GltfMaterialDescriptorGenerator.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/BuiltinRP/GltfMaterialDescriptorGenerator.cs
index baabfe3d7..2926b68ee 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/BuiltinRP/GltfMaterialDescriptorGenerator.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/BuiltinRP/GltfMaterialDescriptorGenerator.cs
@@ -16,9 +16,11 @@ namespace UniGLTF
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param;
if (GltfPbrMaterialImporter.TryCreateParam(data, i, out param)) return param;
// fallback
-#if VRM_DEVELOP
- Debug.LogWarning($"material: {i} out of range. fallback");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"material: {i} out of range. fallback");
+ }
+
return new MaterialDescriptor(
GetMaterialName(i, null),
GltfPbrMaterialImporter.ShaderName,
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/GltfURPMaterialDescriptorGenerator.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/GltfURPMaterialDescriptorGenerator.cs
index 309fc82a7..c13fb5a1e 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/GltfURPMaterialDescriptorGenerator.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/GltfURPMaterialDescriptorGenerator.cs
@@ -17,9 +17,11 @@ namespace UniGLTF
if (GltfUnlitMaterialImporter.TryCreateParam(data, i, out var param)) return param;
if (GltfPbrUrpMaterialImporter.TryCreateParam(data, i, out param)) return param;
// fallback
-#if VRM_DEVELOP
- Debug.LogWarning($"material: {i} out of range. fallback");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"material: {i} out of range. fallback");
+ }
+
return new MaterialDescriptor(
GetMaterialName(i, null),
GltfPbrMaterialImporter.ShaderName,
diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/GltfTextureImporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/GltfTextureImporter.cs
index 753cecb1a..659288f37 100644
--- a/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/GltfTextureImporter.cs
+++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/TextureIO/GltfTextureImporter.cs
@@ -31,7 +31,7 @@ namespace UniGLTF
() =>
{
var imageBytes = data.GetBytesFromImage(imageIndex);
- return Task.FromResult<(byte[], string)?>((ToArray(imageBytes?.binary ?? default), null));
+ return Task.FromResult<(byte[], string)?>((ToArray(imageBytes?.binary ?? default), imageBytes?.mimeType));
},
default, default, default, default, default);
return (texDesc.SubAssetKey, texDesc);
diff --git a/Assets/UniGLTF/Runtime/UniHumanoid/HumanPoseClip.cs b/Assets/UniGLTF/Runtime/UniHumanoid/HumanPoseClip.cs
index bed317955..4d9e63659 100644
--- a/Assets/UniGLTF/Runtime/UniHumanoid/HumanPoseClip.cs
+++ b/Assets/UniGLTF/Runtime/UniHumanoid/HumanPoseClip.cs
@@ -5,7 +5,7 @@ namespace UniHumanoid
{
public class HumanPoseClip : ScriptableObject
{
- public const string TPoseResourcePath = "T-Pose.pose";
+ public const string TPoseResourcePath = "UniHumanoid/T-Pose.pose";
public Vector3 bodyPosition;
diff --git a/Assets/UniGLTF/Runtime/Resources.meta b/Assets/UniGLTF/Runtime/UniHumanoid/Resources.meta
similarity index 62%
rename from Assets/UniGLTF/Runtime/Resources.meta
rename to Assets/UniGLTF/Runtime/UniHumanoid/Resources.meta
index 2285cdc60..6d2ba34e2 100644
--- a/Assets/UniGLTF/Runtime/Resources.meta
+++ b/Assets/UniGLTF/Runtime/UniHumanoid/Resources.meta
@@ -1,8 +1,6 @@
fileFormatVersion: 2
-guid: c61106d290c827b49b7a6e3f6497bd3f
+guid: b4f2ed33f96cfdd4ab1057fccbe1d9e1
folderAsset: yes
-timeCreated: 1519379142
-licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
diff --git a/Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid.meta b/Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid.meta
new file mode 100644
index 000000000..4e4b44155
--- /dev/null
+++ b/Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3c8d7024b7589844a9bbd3d632b5853e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/UniGLTF/Runtime/Resources/T-Pose.pose.asset b/Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid/T-Pose.pose.asset
similarity index 100%
rename from Assets/UniGLTF/Runtime/Resources/T-Pose.pose.asset
rename to Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid/T-Pose.pose.asset
diff --git a/Assets/UniGLTF/Runtime/Resources/T-Pose.pose.asset.meta b/Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid/T-Pose.pose.asset.meta
similarity index 100%
rename from Assets/UniGLTF/Runtime/Resources/T-Pose.pose.asset.meta
rename to Assets/UniGLTF/Runtime/UniHumanoid/Resources/UniHumanoid/T-Pose.pose.asset.meta
diff --git a/Assets/UniGLTF/Runtime/Utils/CachedEnum/CachedEnum.cs b/Assets/UniGLTF/Runtime/Utils/CachedEnum/CachedEnum.cs
index 05322b2fd..10292f329 100644
--- a/Assets/UniGLTF/Runtime/Utils/CachedEnum/CachedEnum.cs
+++ b/Assets/UniGLTF/Runtime/Utils/CachedEnum/CachedEnum.cs
@@ -33,16 +33,6 @@ namespace UniGLTF.Utils
}
}
- ///
- /// bool を返して out 変数に結果を返すのが TryXXX なので、Try ではない。
- ///
- [Obsolete("use ParseOrDefault")]
- public static T TryParseOrDefault(string name, bool ignoreCase = false, T defaultValue = default)
- where T : struct, Enum
- {
- return ParseOrDefault(name, ignoreCase: ignoreCase);
- }
-
public static T[] GetValues() where T : struct, Enum
{
return CachedEnumType.Values;
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta b/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta
index 8968f3a02..34e2b319c 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta
+++ b/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_linear.png.meta
@@ -23,6 +23,7 @@ TextureImporter:
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
+ vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -54,9 +55,12 @@ TextureImporter:
textureType: 0
textureShape: 1
singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
+ ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta b/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta
index 01d1f4a11..4862a8127 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta
+++ b/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_normal_map.png.meta
@@ -23,6 +23,7 @@ TextureImporter:
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
+ vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -54,9 +55,12 @@ TextureImporter:
textureType: 1
textureShape: 1
singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
+ ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
diff --git a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta b/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta
index ab00cb466..39acaa02f 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta
+++ b/Assets/UniGLTF/Tests/UniGLTF/4x4_gray_import_as_srgb.png.meta
@@ -23,6 +23,7 @@ TextureImporter:
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
+ vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@@ -54,9 +55,12 @@ TextureImporter:
textureType: 0
textureShape: 1
singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
+ ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
diff --git a/Assets/UniGLTF/Tests/UniGLTF/CacheEnumTest.cs b/Assets/UniGLTF/Tests/UniGLTF/CacheEnumTest.cs
index 2018c00ee..89d6da927 100644
--- a/Assets/UniGLTF/Tests/UniGLTF/CacheEnumTest.cs
+++ b/Assets/UniGLTF/Tests/UniGLTF/CacheEnumTest.cs
@@ -11,8 +11,8 @@ namespace UniGLTF
[Test]
public void CacheEnumTestSimplePasses()
{
- Assert.AreEqual(default(HumanBodyBones), CachedEnum.TryParseOrDefault("xxx"));
- Assert.AreEqual(HumanBodyBones.UpperChest, CachedEnum.TryParseOrDefault("upperchest", true));
+ Assert.AreEqual(default(HumanBodyBones), CachedEnum.ParseOrDefault("xxx"));
+ Assert.AreEqual(HumanBodyBones.UpperChest, CachedEnum.ParseOrDefault("upperchest", true));
Assert.AreEqual(CachedEnum.GetValues().First(x => x == HumanBodyBones.Hips), HumanBodyBones.Hips);
}
}
diff --git a/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs b/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs
index 0c76bbbdf..d385bd3fe 100644
--- a/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs
+++ b/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs
@@ -118,10 +118,11 @@ namespace VRM
{
if (!string.IsNullOrEmpty(AssetDatabase.GetAssetPath(o)))
{
-#if VRM_DEVELOP
- // 来ない?
- Debug.LogWarning($"{o} already exists. skip write");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ // 来ない?
+ Debug.LogWarning($"{o} already exists. skip write");
+ }
return;
}
diff --git a/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs b/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs
index 1a748011f..bbe77dfb5 100644
--- a/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs
+++ b/Assets/VRM/Runtime/BlendShape/PreviewSceneManager.cs
@@ -1,15 +1,10 @@
-using System.Collections;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using UnityEngine;
-using System.Reflection;
using System;
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
+using VRMShaders;
using UniGLTF;
-
namespace VRM
{
///
@@ -56,14 +51,17 @@ namespace VRM
// 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
- ;
+ if (Symbols.VRM_DEVELOP)
+ {
+ x.gameObject.hideFlags = HideFlags.None |
+ HideFlags.DontSave;
+ }
+ else
+ {
+ x.gameObject.hideFlags = HideFlags.None |
+ HideFlags.DontSave |
+ HideFlags.HideAndDontSave;
+ }
}
return manager;
diff --git a/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs b/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs
index b3d050087..5f9e6a3fd 100644
--- a/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs
+++ b/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs
@@ -127,7 +127,7 @@ namespace VRM
{
if (x.mesh == index)
{
- return CachedEnum.TryParseOrDefault(x.firstPersonFlag, true);
+ return CachedEnum.ParseOrDefault(x.firstPersonFlag, true);
}
}
diff --git a/Assets/VRM/Runtime/Format/glTF_VRM_FirstPerson.cs b/Assets/VRM/Runtime/Format/glTF_VRM_FirstPerson.cs
index 82a7c3799..1c7517bef 100644
--- a/Assets/VRM/Runtime/Format/glTF_VRM_FirstPerson.cs
+++ b/Assets/VRM/Runtime/Format/glTF_VRM_FirstPerson.cs
@@ -72,7 +72,7 @@ namespace VRM
{
get
{
- return CachedEnum.TryParseOrDefault(lookAtTypeName, true);
+ return CachedEnum.ParseOrDefault(lookAtTypeName, true);
}
set { lookAtTypeName = value.ToString(); }
}
diff --git a/Assets/VRM/Runtime/Format/glTF_VRM_Meta.cs b/Assets/VRM/Runtime/Format/glTF_VRM_Meta.cs
index ac668008c..89a11be0a 100644
--- a/Assets/VRM/Runtime/Format/glTF_VRM_Meta.cs
+++ b/Assets/VRM/Runtime/Format/glTF_VRM_Meta.cs
@@ -36,7 +36,7 @@ namespace VRM
{
static UssageLicense FromString(string src)
{
- return CachedEnum.TryParseOrDefault(src, true);
+ return CachedEnum.ParseOrDefault(src, true);
}
[JsonSchema(Description = "Title of VRM model")]
@@ -69,7 +69,7 @@ namespace VRM
{
get
{
- return CachedEnum.TryParseOrDefault(allowedUserName, true);
+ return CachedEnum.ParseOrDefault(allowedUserName, true);
}
set
{
@@ -135,7 +135,7 @@ namespace VRM
{
get
{
- return CachedEnum.TryParseOrDefault(licenseName, true);
+ return CachedEnum.ParseOrDefault(licenseName, true);
}
set
{
diff --git a/Assets/VRM/Runtime/IO/VRMImporterContext.cs b/Assets/VRM/Runtime/IO/VRMImporterContext.cs
index cff816329..ffe6a9772 100644
--- a/Assets/VRM/Runtime/IO/VRMImporterContext.cs
+++ b/Assets/VRM/Runtime/IO/VRMImporterContext.cs
@@ -153,12 +153,12 @@ namespace VRM
if (group != null)
{
asset.BlendShapeName = groupName;
- asset.Preset = CachedEnum.TryParseOrDefault(group.presetName, true);
+ asset.Preset = CachedEnum.ParseOrDefault(group.presetName, true);
asset.IsBinary = group.isBinary;
if (asset.Preset == BlendShapePreset.Unknown)
{
// fallback
- asset.Preset = CachedEnum.TryParseOrDefault(group.name, true);
+ asset.Preset = CachedEnum.ParseOrDefault(group.name, true);
}
asset.Values = group.binds.Select(x =>
{
diff --git a/Assets/VRM/Runtime/IO/VRMURPMaterialDescriptorGenerator.cs b/Assets/VRM/Runtime/IO/VRMURPMaterialDescriptorGenerator.cs
index 1ca38753a..aebbf4e0c 100644
--- a/Assets/VRM/Runtime/IO/VRMURPMaterialDescriptorGenerator.cs
+++ b/Assets/VRM/Runtime/IO/VRMURPMaterialDescriptorGenerator.cs
@@ -22,9 +22,10 @@ namespace VRM
// pbr "Standard" to "Universal Render Pipeline/Lit"
if (GltfPbrUrpMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
// fallback
-#if VRM_DEVELOP
- Debug.LogWarning($"material: {i} out of range. fallback");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"material: {i} out of range. fallback");
+ }
return new MaterialDescriptor(
GltfMaterialDescriptorGenerator.GetMaterialName(i, null),
GltfPbrMaterialImporter.ShaderName,
diff --git a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs
index abc68356b..0e8e11d6b 100644
--- a/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs
+++ b/Assets/VRM10/Editor/ScriptedImporter/VrmScriptedImporterImpl.cs
@@ -73,9 +73,10 @@ namespace UniVRM10
/// normalize する
public static void Import(ScriptedImporter scriptedImporter, AssetImportContext context, bool doMigrate, RenderPipelineTypes renderPipeline)
{
-#if VRM_DEVELOP
- Debug.Log("OnImportAsset to " + scriptedImporter.assetPath);
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.Log("OnImportAsset to " + scriptedImporter.assetPath);
+ }
// 1st parse as vrm1
using (var data = new GlbFileParser(scriptedImporter.assetPath).Parse())
diff --git a/Assets/VRM10/Editor/Vrm10TopMenu.cs b/Assets/VRM10/Editor/Vrm10TopMenu.cs
index 426024e81..cfc99cba7 100644
--- a/Assets/VRM10/Editor/Vrm10TopMenu.cs
+++ b/Assets/VRM10/Editor/Vrm10TopMenu.cs
@@ -7,19 +7,18 @@ namespace UniVRM10
private const string UserMenuPrefix = VRMVersion.MENU;
private const string DevelopmentMenuPrefix = VRMVersion.MENU + "/Development";
- const string CONVERT_HUMANOID_KEY = VRMVersion.MENU + "/Export VRM-1.0";
[MenuItem(UserMenuPrefix + "/Export VRM-1.0", priority = 1)]
- static void OpenExportDialog() => VRM10ExportDialog.Open();
+ private static void OpenExportDialog() => VRM10ExportDialog.Open();
#if VRM_DEVELOP
[MenuItem(UserMenuPrefix + "/VRM1 Window", false, 2)]
- static void OpenWindow() => VRM10Window.Open();
+ private static void OpenWindow() => VRM10Window.Open();
[MenuItem(DevelopmentMenuPrefix + "/Generate from JsonSchema")]
- public static void Generate() => Vrm10SerializerGenerator.Run(false);
+ private static void Generate() => Vrm10SerializerGenerator.Run(false);
[MenuItem(DevelopmentMenuPrefix + "/Generate from JsonSchema(debug)")]
- public static void Parse() => Vrm10SerializerGenerator.Run(true);
+ private static void Parse() => Vrm10SerializerGenerator.Run(true);
#endif
}
}
diff --git a/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs b/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs
index a316dff42..51d83ba51 100644
--- a/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs
+++ b/Assets/VRM10/Runtime/Components/Expression/Preview/PreviewSceneManager.cs
@@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using System;
+using VRMShaders;
namespace UniVRM10
@@ -52,14 +53,17 @@ namespace UniVRM10
// 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
- ;
+ if (Symbols.VRM_DEVELOP)
+ {
+ x.gameObject.hideFlags = HideFlags.None |
+ HideFlags.DontSave;
+ }
+ else
+ {
+ x.gameObject.hideFlags = HideFlags.None |
+ HideFlags.DontSave |
+ HideFlags.HideAndDontSave;
+ }
}
return manager;
diff --git a/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGenerator.cs b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGenerator.cs
index 2f242595b..c483adfb2 100644
--- a/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGenerator.cs
+++ b/Assets/VRM10/Runtime/IO/Material/Vrm10MaterialDescriptorGenerator.cs
@@ -17,9 +17,10 @@ namespace UniVRM10
// pbr
if (GltfPbrMaterialImporter.TryCreateParam(data, i, out matDesc)) return matDesc;
// fallback
-#if VRM_DEVELOP
- Debug.LogWarning($"material: {i} out of range. fallback");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"material: {i} out of range. fallback");
+ }
return new MaterialDescriptor(
GltfMaterialDescriptorGenerator.GetMaterialName(i, null), GltfPbrMaterialImporter.ShaderName,
null,
diff --git a/Assets/VRM10/Runtime/IO/Texture/Vrm10TextureDescriptorGenerator.cs b/Assets/VRM10/Runtime/IO/Texture/Vrm10TextureDescriptorGenerator.cs
index b6e55d56c..7a6db9e79 100644
--- a/Assets/VRM10/Runtime/IO/Texture/Vrm10TextureDescriptorGenerator.cs
+++ b/Assets/VRM10/Runtime/IO/Texture/Vrm10TextureDescriptorGenerator.cs
@@ -10,6 +10,8 @@ namespace UniVRM10
{
public sealed class Vrm10TextureDescriptorGenerator : ITextureDescriptorGenerator
{
+ public const string UniqueThumbnailName = "thumbnail__VRM10";
+
private readonly GltfData m_data;
private TextureDescriptorSet _textureDescriptorSet;
@@ -69,8 +71,6 @@ namespace UniVRM10
}
}
- public const string THUMBNAIL_NAME = "__VRM10_thumbnail__";
-
///
/// VRM-1 の thumbnail テクスチャー。gltf.textures ではなく gltf.images の参照であることに注意(sampler等の設定が無い)
///
@@ -99,12 +99,7 @@ namespace UniVRM10
// data.GLTF.textures は前処理によりユニーク性がある
// unique な名前を振り出す
var used = new HashSet(data.GLTF.textures.Select(x => x.name));
- var imageName = gltfImage.name;
- if (string.IsNullOrEmpty(imageName))
- {
- imageName = THUMBNAIL_NAME;
- }
- var uniqueName = GlbLowLevelParser.FixNameUnique(used, imageName);
+ var uniqueName = GlbLowLevelParser.FixNameUnique(used, UniqueThumbnailName);
value = GltfTextureImporter.CreateSrgbFromOnlyImage(data, imageIndex, uniqueName, gltfImage.uri);
return true;
diff --git a/Assets/VRM10/Runtime/Migration/Materials/Vrm0XMToonValue.cs b/Assets/VRM10/Runtime/Migration/Materials/Vrm0XMToonValue.cs
index 0968453ee..6a68bc5ce 100644
--- a/Assets/VRM10/Runtime/Migration/Materials/Vrm0XMToonValue.cs
+++ b/Assets/VRM10/Runtime/Migration/Materials/Vrm0XMToonValue.cs
@@ -3,6 +3,7 @@ using System.Linq;
using UniGLTF;
using UniJSON;
using UnityEngine;
+using VRMShaders;
using ColorSpace = VRMShaders.ColorSpace;
namespace UniVRM10
@@ -84,9 +85,10 @@ namespace UniVRM10
break;
default:
-#if VRM_DEVELOP
- Debug.LogWarning($"vectorProperties: {kv.Key}: {kv.Value}");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"vectorProperties: {kv.Key}: {kv.Value}");
+ }
break;
}
}
@@ -187,9 +189,10 @@ namespace UniVRM10
break;
default:
-#if VRM_DEVELOP
- Debug.LogWarning($"floatProperties: {kv.Key} is unknown");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"floatProperties: {kv.Key} is unknown");
+ }
break;
}
}
@@ -217,9 +220,10 @@ namespace UniVRM10
// UV Animation
case "_UvAnimMaskTexture": map.UvAnimMaskTexture = index; break;
default:
-#if VRM_DEVELOP
- Debug.LogWarning($"textureProperties: {kv.Key} is unknown");
-#endif
+ if (Symbols.VRM_DEVELOP)
+ {
+ Debug.LogWarning($"textureProperties: {kv.Key} is unknown");
+ }
break;
}
}
diff --git a/Assets/VRM10_Samples/VRM10Viewer/Motions.meta b/Assets/VRM10_Samples/VRM10Viewer/Motions.meta
new file mode 100644
index 000000000..5d616db2f
--- /dev/null
+++ b/Assets/VRM10_Samples/VRM10Viewer/Motions.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b092f2ba86c6ec247afd37d38108bf03
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/UniGLTF/Runtime/Resources/test_motion.txt b/Assets/VRM10_Samples/VRM10Viewer/Motions/vrm10viewer_test_motion.txt
similarity index 100%
rename from Assets/UniGLTF/Runtime/Resources/test_motion.txt
rename to Assets/VRM10_Samples/VRM10Viewer/Motions/vrm10viewer_test_motion.txt
diff --git a/Assets/VRM10_Samples/VRM10Viewer/Motions/vrm10viewer_test_motion.txt.meta b/Assets/VRM10_Samples/VRM10Viewer/Motions/vrm10viewer_test_motion.txt.meta
new file mode 100644
index 000000000..fe3a37d2e
--- /dev/null
+++ b/Assets/VRM10_Samples/VRM10Viewer/Motions/vrm10viewer_test_motion.txt.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 08df5151e71aed748b13547492fb8b9a
+timeCreated: 1546851178
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity b/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity
index b26cea286..15284a929 100644
--- a/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity
+++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity
@@ -5572,7 +5572,7 @@ MonoBehaviour:
m_src: {fileID: 0}
m_target: {fileID: 802105000}
Root: {fileID: 0}
- m_motion: {fileID: 4900000, guid: 7d2617171adc40b41ac50228f101e178, type: 3}
+ m_motion: {fileID: 4900000, guid: 08df5151e71aed748b13547492fb8b9a, type: 3}
m_texts:
m_textModelTitle: {fileID: 1111491925}
m_textModelVersion: {fileID: 1045380263}
@@ -5591,7 +5591,6 @@ MonoBehaviour:
ToggleMotionTPose: {fileID: 1791103380}
ToggleMotionBVH: {fileID: 1311520910}
ToggleMotion: {fileID: 224350194}
- m_pose: {fileID: 11400000, guid: 879e332f84a378c4da3b87af13da3e85, type: 2}
--- !u!1 &1791103378
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs
index 6bc7142c1..b9ab35159 100644
--- a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs
+++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs
@@ -168,9 +168,6 @@ namespace UniVRM10.VRM10Viewer
[SerializeField]
UIFields m_ui = default;
- [SerializeField]
- HumanPoseClip m_pose = default;
-
private void Reset()
{
var buttons = GameObject.FindObjectsOfType