mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-08 03:48:19 -05:00
Merge branch 'master' of https://github.com/vrm-c/UniVRM into refactorMaterialExporter
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -54,6 +54,7 @@ Assets/StreamingAssets/crashlytics-build.properties
|
||||
.idea/
|
||||
Assets/_Private/
|
||||
Assets/_Private.meta
|
||||
UserSettings/
|
||||
|
||||
# Unity
|
||||
/ProjectSettings/BurstAotSettings_StandaloneWindows.json
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -57,9 +57,10 @@ namespace UniGLTF
|
||||
/// <param name="reverseAxis"></param>
|
||||
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)
|
||||
|
||||
@@ -92,9 +92,6 @@ namespace UniGLTF
|
||||
{
|
||||
// remap
|
||||
var externalObject = targetPath.LoadAsset<Texture2D>();
|
||||
#if VRM_DEVELOP
|
||||
// Debug.Log($"remap: {targetPath} => {externalObject}");
|
||||
#endif
|
||||
if (externalObject != null)
|
||||
{
|
||||
addRemap(key, externalObject);
|
||||
|
||||
@@ -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<Vector3>();
|
||||
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++)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c61106d290c827b49b7a6e3f6497bd3f
|
||||
guid: b4f2ed33f96cfdd4ab1057fccbe1d9e1
|
||||
folderAsset: yes
|
||||
timeCreated: 1519379142
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c8d7024b7589844a9bbd3d632b5853e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -33,16 +33,6 @@ namespace UniGLTF.Utils
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// bool を返して out 変数に結果を返すのが TryXXX なので、Try ではない。
|
||||
/// </summary>
|
||||
[Obsolete("use ParseOrDefault")]
|
||||
public static T TryParseOrDefault<T>(string name, bool ignoreCase = false, T defaultValue = default)
|
||||
where T : struct, Enum
|
||||
{
|
||||
return ParseOrDefault<T>(name, ignoreCase: ignoreCase);
|
||||
}
|
||||
|
||||
public static T[] GetValues<T>() where T : struct, Enum
|
||||
{
|
||||
return CachedEnumType<T>.Values;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace UniGLTF
|
||||
[Test]
|
||||
public void CacheEnumTestSimplePasses()
|
||||
{
|
||||
Assert.AreEqual(default(HumanBodyBones), CachedEnum.TryParseOrDefault<HumanBodyBones>("xxx"));
|
||||
Assert.AreEqual(HumanBodyBones.UpperChest, CachedEnum.TryParseOrDefault<HumanBodyBones>("upperchest", true));
|
||||
Assert.AreEqual(default(HumanBodyBones), CachedEnum.ParseOrDefault<HumanBodyBones>("xxx"));
|
||||
Assert.AreEqual(HumanBodyBones.UpperChest, CachedEnum.ParseOrDefault<HumanBodyBones>("upperchest", true));
|
||||
Assert.AreEqual(CachedEnum.GetValues<HumanBodyBones>().First(x => x == HumanBodyBones.Hips), HumanBodyBones.Hips);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
@@ -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;
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace VRM
|
||||
{
|
||||
if (x.mesh == index)
|
||||
{
|
||||
return CachedEnum.TryParseOrDefault<FirstPersonFlag>(x.firstPersonFlag, true);
|
||||
return CachedEnum.ParseOrDefault<FirstPersonFlag>(x.firstPersonFlag, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace VRM
|
||||
{
|
||||
get
|
||||
{
|
||||
return CachedEnum.TryParseOrDefault<LookAtType>(lookAtTypeName, true);
|
||||
return CachedEnum.ParseOrDefault<LookAtType>(lookAtTypeName, true);
|
||||
}
|
||||
set { lookAtTypeName = value.ToString(); }
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace VRM
|
||||
{
|
||||
static UssageLicense FromString(string src)
|
||||
{
|
||||
return CachedEnum.TryParseOrDefault<UssageLicense>(src, true);
|
||||
return CachedEnum.ParseOrDefault<UssageLicense>(src, true);
|
||||
}
|
||||
|
||||
[JsonSchema(Description = "Title of VRM model")]
|
||||
@@ -69,7 +69,7 @@ namespace VRM
|
||||
{
|
||||
get
|
||||
{
|
||||
return CachedEnum.TryParseOrDefault<AllowedUser>(allowedUserName, true);
|
||||
return CachedEnum.ParseOrDefault<AllowedUser>(allowedUserName, true);
|
||||
}
|
||||
set
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace VRM
|
||||
{
|
||||
get
|
||||
{
|
||||
return CachedEnum.TryParseOrDefault<LicenseType>(licenseName, true);
|
||||
return CachedEnum.ParseOrDefault<LicenseType>(licenseName, true);
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
@@ -153,12 +153,12 @@ namespace VRM
|
||||
if (group != null)
|
||||
{
|
||||
asset.BlendShapeName = groupName;
|
||||
asset.Preset = CachedEnum.TryParseOrDefault<BlendShapePreset>(group.presetName, true);
|
||||
asset.Preset = CachedEnum.ParseOrDefault<BlendShapePreset>(group.presetName, true);
|
||||
asset.IsBinary = group.isBinary;
|
||||
if (asset.Preset == BlendShapePreset.Unknown)
|
||||
{
|
||||
// fallback
|
||||
asset.Preset = CachedEnum.TryParseOrDefault<BlendShapePreset>(group.name, true);
|
||||
asset.Preset = CachedEnum.ParseOrDefault<BlendShapePreset>(group.name, true);
|
||||
}
|
||||
asset.Values = group.binds.Select(x =>
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -73,9 +73,10 @@ namespace UniVRM10
|
||||
/// <param name="doNormalize">normalize する</param>
|
||||
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())
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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__";
|
||||
|
||||
/// <summary>
|
||||
/// VRM-1 の thumbnail テクスチャー。gltf.textures ではなく gltf.images の参照であることに注意(sampler等の設定が無い)
|
||||
/// </summary>
|
||||
@@ -99,12 +99,7 @@ namespace UniVRM10
|
||||
// data.GLTF.textures は前処理によりユニーク性がある
|
||||
// unique な名前を振り出す
|
||||
var used = new HashSet<string>(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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
8
Assets/VRM10_Samples/VRM10Viewer/Motions.meta
Normal file
8
Assets/VRM10_Samples/VRM10Viewer/Motions.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b092f2ba86c6ec247afd37d38108bf03
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08df5151e71aed748b13547492fb8b9a
|
||||
timeCreated: 1546851178
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
|
||||
@@ -168,9 +168,6 @@ namespace UniVRM10.VRM10Viewer
|
||||
[SerializeField]
|
||||
UIFields m_ui = default;
|
||||
|
||||
[SerializeField]
|
||||
HumanPoseClip m_pose = default;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
var buttons = GameObject.FindObjectsOfType<Button>();
|
||||
|
||||
@@ -55,9 +55,6 @@ namespace VRMShaders
|
||||
if (!x.UseExternal)
|
||||
{
|
||||
// 外部の '.asset' からロードしていない
|
||||
#if VRM_DEVELOP
|
||||
// Debug.Log($"Destroy {x.Asset}");
|
||||
#endif
|
||||
UnityObjectDestroyer.DestroyRuntimeOrEditor(x.Asset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,14 @@ namespace VRMShaders
|
||||
case "image/jpeg":
|
||||
break;
|
||||
default:
|
||||
Debug.LogWarning($"Texture image MIME type `{textureInfo.DataMimeType}` is not supported.");
|
||||
if (string.IsNullOrEmpty(textureInfo.DataMimeType))
|
||||
{
|
||||
Debug.Log($"Texture image MIME type is empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"Texture image MIME type `{textureInfo.DataMimeType}` is not supported.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,18 @@ namespace VRMShaders
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public static bool VRM_NORMALIZE_BLENDSHAPE_TANGENT
|
||||
{
|
||||
get
|
||||
{
|
||||
#if VRM_NORMALIZE_BLENDSHAPE_TANGENT
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
8
Assets/VRM_Samples/SimpleViewer/Motions.meta
Normal file
8
Assets/VRM_Samples/SimpleViewer/Motions.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79cea8265d53aaf47b16fff91ee9a5d6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
167
ProjectSettings/SceneTemplateSettings.json
Normal file
167
ProjectSettings/SceneTemplateSettings.json
Normal file
@@ -0,0 +1,167 @@
|
||||
{
|
||||
"templatePinStates": [],
|
||||
"dependencyTypeInfos": [
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.AnimationClip",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.Animations.AnimatorController",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.AnimatorOverrideController",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.Audio.AudioMixerController",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.ComputeShader",
|
||||
"ignore": true,
|
||||
"defaultInstantiationMode": 1,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Cubemap",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.GameObject",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.LightingDataAsset",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": false
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.LightingSettings",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Material",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.MonoScript",
|
||||
"ignore": true,
|
||||
"defaultInstantiationMode": 1,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.PhysicMaterial",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.PhysicsMaterial2D",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.VolumeProfile",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.SceneAsset",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": false
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Shader",
|
||||
"ignore": true,
|
||||
"defaultInstantiationMode": 1,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.ShaderVariantCollection",
|
||||
"ignore": true,
|
||||
"defaultInstantiationMode": 1,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Texture",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Texture2D",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Timeline.TimelineAsset",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 0,
|
||||
"supportsModification": true
|
||||
}
|
||||
],
|
||||
"defaultDependencyTypeInfo": {
|
||||
"userAdded": false,
|
||||
"type": "<default_scene_template_dependencies>",
|
||||
"ignore": false,
|
||||
"defaultInstantiationMode": 1,
|
||||
"supportsModification": true
|
||||
},
|
||||
"newSceneOverride": 0
|
||||
}
|
||||
Reference in New Issue
Block a user