mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-22 23:18:01 -05:00
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using UniGLTF;
|
|
using UniGLTF.M17N;
|
|
using UnityEngine;
|
|
|
|
namespace VRM
|
|
{
|
|
public static class VRMExporterValidator
|
|
{
|
|
public enum VRMExporterWizardMessages
|
|
{
|
|
[LangMsg(Languages.ja, "VRMBlendShapeProxyが必要です。先にVRMフォーマットに変換してください")]
|
|
[LangMsg(Languages.en, "VRMBlendShapeProxy is required. Please convert to VRM format first")]
|
|
NEEDS_VRM_BLENDSHAPE_PROXY,
|
|
}
|
|
|
|
public static bool ReduceBlendshape;
|
|
|
|
public static IEnumerable<Validation> Validate(GameObject ExportRoot)
|
|
{
|
|
if (ExportRoot == null)
|
|
{
|
|
yield break;
|
|
}
|
|
|
|
if (ReduceBlendshape && ExportRoot.GetComponentOrNull<VRMBlendShapeProxy>() == null)
|
|
{
|
|
yield return Validation.Error(VRMExporterWizardMessages.NEEDS_VRM_BLENDSHAPE_PROXY.Msg());
|
|
}
|
|
|
|
if (ExportRoot.TryGetComponent<VRMMeta>(out var vrmMeta) && vrmMeta.Meta != null && vrmMeta.Meta.Thumbnail != null)
|
|
{
|
|
var thumbnailName = vrmMeta.Meta.Thumbnail.name;
|
|
if (NameValidator.IsFileNameLengthTooLong(thumbnailName))
|
|
{
|
|
yield return Validation.Error(NameValidator.ValidationMessages.FILENAME_TOO_LONG.Msg() + thumbnailName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|