Refactoring VRMShaders directory & asmdef

This commit is contained in:
Masataka SUMI
2021-04-08 20:19:37 +09:00
parent 987d60d3a0
commit 8eaceb6c8e
131 changed files with 254 additions and 241 deletions

6
.gitmodules vendored
View File

@@ -1,9 +1,9 @@
[submodule "MToon"]
path = Assets/VRMShaders/MToon
url = https://github.com/Santarh/MToon.git
[submodule "vrm-specification"]
path = vrm-specification
url = https://github.com/vrm-c/vrm-specification.git
[submodule "glTF"]
path = glTF
url = https://github.com/KhronosGroup/glTF.git
[submodule "Assets/VRMShaders/VRM/MToon"]
path = Assets/VRMShaders/VRM/MToon
url = https://github.com/Santarh/MToon.git

View File

@@ -4,10 +4,9 @@
"UniGLTF",
"MeshUtility",
"MeshUtility.Editor",
"VRMShaders",
"VRMShaders.Editor"
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
@@ -16,5 +15,7 @@
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,65 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using MeshUtility.M17N;
using UnityEngine;
namespace MeshUtility.Validators
{
public static class MaterialValidator
{
public enum ValidationMessages
{
[LangMsg(Languages.ja, "Standard, Unlit, MToon 以外のマテリアルは、Standard になります")]
[LangMsg(Languages.en, "It will export as `Standard` fallback")]
UNKNOWN_SHADER,
}
public static IEnumerable<Validation> Validate(GameObject ExportRoot)
{
if (ExportRoot == null)
{
yield break;
}
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 (UniGLTF.ShaderPropExporter.PreShaderPropExporter.UseUnlit(material.shader.name))
{
// unlit
continue;
}
if (UniGLTF.ShaderPropExporter.PreShaderPropExporter.VRMExtensionShaders.Contains(material.shader.name))
{
// VRM supported
continue;
}
yield return Validation.Warning($"Material: {material.name}. Unknown Shader: \"{material.shader.name}\" is used. {ValidationMessages.UNKNOWN_SHADER.Msg()}");
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: aa8f593f0ade99a4d9cc23947cdded6e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,16 +1,16 @@
{
"name": "UniGLTF",
"references": [
"UniUnlit",
"ShaderProperty.Runtime",
"VRMShaders"
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.UniUnlit.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -3,19 +3,24 @@
"references": [
"UniGLTF",
"UniGLTF.Editor",
"VRMShaders",
"VRMShaders.Editor"
],
"optionalUnityReferences": [
"TestAssemblies"
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -7,19 +7,24 @@
"UniGLTF",
"UniVRM.Editor",
"VRM.Tests",
"VRMShaders",
"VRMShaders.Editor"
],
"optionalUnityReferences": [
"TestAssemblies"
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -4,14 +4,15 @@
"VRM",
"UniHumanoid",
"UniGLTF",
"VRMShaders"
"VRMShaders.GLTF.IO.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -6,12 +6,11 @@
"MeshUtility",
"MeshUtility.Editor",
"UniUnlit",
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor",
"UniGLTF",
"UniGLTF.Editor",
"VRMShaders",
"VRMShaders.Editor"
"UniGLTF.Editor"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
@@ -20,5 +19,7 @@
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,33 +0,0 @@
%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: []

View File

@@ -2,19 +2,20 @@
"name": "VRM",
"references": [
"MToon",
"UniUnlit",
"UniHumanoid",
"ShaderProperty.Runtime",
"MeshUtility",
"UniGLTF",
"VRMShaders"
"VRMShaders.GLTF.IO.Runtime",
"UniUnlit",
"VRMShaders.VRM.IO.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -5,19 +5,24 @@
"UniGLTF",
"MeshUtility",
"MeshUtility.Editor",
"VRMShaders",
"VRMShaders.Editor"
],
"optionalUnityReferences": [
"TestAssemblies"
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -7,9 +7,9 @@
"MeshUtility.Editor",
"UniGLTF.Editor",
"UniGLTF",
"VRMShaders"
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
@@ -18,5 +18,7 @@
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -7,14 +7,15 @@
"MeshUtility",
"MeshUtility.Editor",
"UniGLTF",
"VRMShaders"
"VRMShaders.GLTF.IO.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -4,16 +4,21 @@
"VrmLib",
"VRM10",
"UniGLTF",
"VRMShaders"
],
"optionalUnityReferences": [
"TestAssemblies"
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"VRMShaders.GLTF.IO.Runtime"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": []
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f877649750df3814aa5272250b22678c
guid: 3b19641943478e4459a38dcd6eeb86f3
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 817051ccab3a4cc4986dc955681fac6f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +1,6 @@
{
"name": "VRMShaders.Editor",
"name": "VRMShaders.GLTF.IO.Editor",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
@@ -9,6 +8,8 @@
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,13 @@
{
"name": "VRMShaders.GLTF.IO.Runtime",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,24 @@
{
"name": "VRMShaders.GLTF.IO.Tests",
"references": [
"VRMShaders.GLTF.IO.Runtime",
"VRMShaders.GLTF.IO.Editor",
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,17 @@
{
"name": "VRMShaders.GLTF.UniUnlit.Editor",
"references": [
"VRMShaders.GLTF.UniUnlit.Runtime"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,13 @@
{
"name": "VRMShaders.GLTF.UniUnlit.Runtime",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,3 +0,0 @@
{
"name": "VRMShaders"
}

View File

@@ -1,12 +0,0 @@
{
"name": "ShaderProperty.Editor",
"references": [
"ShaderProperty.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false
}

View File

@@ -1,8 +0,0 @@
{
"name": "ShaderProperty.Runtime",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false
}

View File

@@ -1,12 +0,0 @@
{
"name": "UniUnlit.Editor",
"references": [
"UniUnlit"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false
}

View File

@@ -1,3 +0,0 @@
{
"name": "UniUnlit"
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 67bc2cd71cccda64bba542dc0d8c2c9f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 85f7c43c499b9f74d9a8e16f42d44492
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +1,7 @@
{
"name": "VRMShaders.Tests",
"name": "VRMShaders.VRM.IO.Editor",
"references": [
"VRMShaders",
"VRMShaders.Editor"
],
"optionalUnityReferences": [
"TestAssemblies"
"VRMShaders.VRM.IO.Runtime"
],
"includePlatforms": [
"Editor"
@@ -15,5 +11,7 @@
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -27,23 +27,6 @@ namespace UniGLTF.ShaderPropExporter
public static partial class PreShaderPropExporter
{
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;
}
public static readonly string[] VRMExtensionShaders = new string[]
{
"VRM/UnlitTransparentZWrite",

Some files were not shown because too many files have changed in this diff Show More