Merge pull request #1685 from ousttrue/fix/material_SetVector

fix Property PROP_NAME already exists in the property sheet with a different type: 5
This commit is contained in:
ousttrue 2022-06-08 17:58:58 +09:00 committed by GitHub
commit 79c1933c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UniGLTF;
using UnityEngine;
using VRMShaders;
@ -8,6 +9,19 @@ namespace VRM
{
public static class VRMMToonMaterialImporter
{
static string[] MToonTextureSlots = new string[]{
"_MainTex",
"_ShadeTexture",
"_BumpMap",
"_EmissionMap",
"_OutlineWidthTexture",
"_ReceiveShadowTexture",
"_RimTexture",
"_ShadingGradeTexture",
"_SphereAdd",
"_UvAnimMaskTexture",
};
public static bool TryCreateParam(GltfData data, glTF_VRM_extensions vrm, int materialIdx,
out MaterialDescriptor matDesc)
{
@ -60,7 +74,10 @@ namespace VRM
foreach (var kv in vrmMaterial.vectorProperties)
{
// vector4 exclude TextureOffsetScale
if (vrmMaterial.textureProperties.ContainsKey(kv.Key)) continue;
if (MToonTextureSlots.Contains(kv.Key))
{
continue;
}
var v = new Vector4(kv.Value[0], kv.Value[1], kv.Value[2], kv.Value[3]);
vectors.Add(kv.Key, v);
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;