check mesh.colors

This commit is contained in:
ousttrue 2021-12-09 19:59:02 +09:00
parent 042847ab64
commit 767b9f6f0c
2 changed files with 5 additions and 4 deletions

View File

@ -46,9 +46,10 @@ namespace UniGLTF
Vector3[] blendShapeNormals = new Vector3[mesh.vertexCount];
var vColorState = VertexColorUtility.DetectVertexColor(mesh, unityMaterials);
var exportVertexColor = (settings.KeepVertexColor // vertex color を残す設定
|| vColorState == VertexColorState.ExistsAndIsUsed // VColor使っている
|| vColorState == VertexColorState.ExistsAndMixed // VColorを使っているところと使っていないところが混在(とりあえずExportする)
var exportVertexColor = (
(settings.KeepVertexColor && mesh.colors != null && mesh.colors.Length == mesh.vertexCount) // vertex color を残す設定
|| vColorState == VertexColorState.ExistsAndIsUsed // VColor使っている
|| vColorState == VertexColorState.ExistsAndMixed // VColorを使っているところと使っていないところが混在(とりあえずExportする)
);
var usedIndices = new List<int>();

View File

@ -49,7 +49,7 @@ namespace UniGLTF
var colorAccessorIndex = -1;
var vColorState = VertexColorUtility.DetectVertexColor(mesh, materials);
if (settings.KeepVertexColor // vertex color を残す設定
if ((settings.KeepVertexColor && mesh.colors != null && mesh.colors.Length == mesh.vertexCount) // vertex color を残す設定
|| vColorState == VertexColorState.ExistsAndIsUsed // VColor使っている
|| vColorState == VertexColorState.ExistsAndMixed // VColorを使っているところと使っていないところが混在(とりあえずExportする)
)