mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-07 03:17:25 -05:00
Updated JsonSchema
This commit is contained in:
@@ -61,6 +61,41 @@ namespace VRM
|
||||
return "";
|
||||
}
|
||||
|
||||
static void TraverseItem(JsonNode node, JsonFormatter f, UnityPath dir)
|
||||
{
|
||||
var title = GetTitle(node);
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
Traverse(node, f, dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ref
|
||||
f.BeginMap();
|
||||
f.Key("$ref");
|
||||
var fileName = string.Format("{0}.schema.json", title);
|
||||
f.Value(fileName);
|
||||
f.EndMap();
|
||||
|
||||
// new formatter
|
||||
{
|
||||
var subFormatter = new JsonFormatter(4);
|
||||
|
||||
subFormatter.BeginMap();
|
||||
foreach (var _kv in node.ObjectItems)
|
||||
{
|
||||
subFormatter.Key(_kv.Key);
|
||||
Traverse(_kv.Value, subFormatter, dir);
|
||||
}
|
||||
subFormatter.EndMap();
|
||||
|
||||
var subJson = subFormatter.ToString();
|
||||
var path = dir.Child(fileName);
|
||||
File.WriteAllText(path.FullPath, subJson, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Traverse(JsonNode node, JsonFormatter f, UnityPath dir)
|
||||
{
|
||||
switch(node.Value.ValueType)
|
||||
@@ -69,7 +104,7 @@ namespace VRM
|
||||
f.BeginList();
|
||||
foreach(var x in node.ArrayItems)
|
||||
{
|
||||
Traverse(x, f, dir);
|
||||
TraverseItem(x, f, dir);
|
||||
}
|
||||
f.EndList();
|
||||
break;
|
||||
@@ -81,37 +116,7 @@ namespace VRM
|
||||
foreach (var kv in node.ObjectItems)
|
||||
{
|
||||
f.Key(kv.Key);
|
||||
var title = GetTitle(kv.Value);
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
Traverse(kv.Value, f, dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ref
|
||||
f.BeginMap();
|
||||
f.Key("$ref");
|
||||
var fileName = string.Format("{0}.schema.json", title);
|
||||
f.Value(fileName);
|
||||
f.EndMap();
|
||||
|
||||
// new formatter
|
||||
{
|
||||
var subFormatter = new JsonFormatter(4);
|
||||
|
||||
subFormatter.BeginMap();
|
||||
foreach (var _kv in kv.Value.ObjectItems)
|
||||
{
|
||||
subFormatter.Key(_kv.Key);
|
||||
Traverse(_kv.Value, subFormatter, dir);
|
||||
}
|
||||
subFormatter.EndMap();
|
||||
|
||||
var subJson = subFormatter.ToString();
|
||||
var path = dir.Child(fileName);
|
||||
File.WriteAllText(path.FullPath, subJson, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
TraverseItem(kv.Value, f, dir);
|
||||
}
|
||||
f.EndMap();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ VRM extension is for 3d humanoid avatars (and models) in VR applications.
|
||||
")]
|
||||
public class glTF_VRM_extensions : JsonSerializableBase
|
||||
{
|
||||
[JsonSchema(Description = @"Version of exporter that vrm created. UniVRM-0.41")]
|
||||
[JsonSchema(Description = @"Version of exporter that vrm created. " + VRMVersion.VRM_VERSION)]
|
||||
public string exporterVersion = "UniVRM-" + VRMVersion.VERSION;
|
||||
|
||||
public glTF_VRM_Meta meta = new glTF_VRM_Meta();
|
||||
|
||||
@@ -8,6 +8,7 @@ using UniJSON;
|
||||
namespace VRM
|
||||
{
|
||||
[Serializable]
|
||||
[JsonSchema(Title = "vrm.materialbind")]
|
||||
public class glTF_VRM_MaterialValueBind : UniGLTF.JsonSerializableBase
|
||||
{
|
||||
public string materialName;
|
||||
@@ -23,6 +24,7 @@ namespace VRM
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[JsonSchema(Title = "vrm.blendshapebind")]
|
||||
public class glTF_VRM_BlendShapeBind : UniGLTF.JsonSerializableBase
|
||||
{
|
||||
public int mesh = -1;
|
||||
@@ -83,11 +85,37 @@ namespace VRM
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[JsonSchema(Title = "vrm.blendshapegroup", Description = "BlendShapeClip of UniVRM")]
|
||||
public class glTF_VRM_BlendShapeGroup : UniGLTF.JsonSerializableBase
|
||||
{
|
||||
[JsonSchema(Description = "Expression name")]
|
||||
public string name;
|
||||
|
||||
[JsonSchema(Description = "Predefined Expression name", EnumValues =new object[] {
|
||||
"Neutral",
|
||||
"A",
|
||||
"I",
|
||||
"U",
|
||||
"E",
|
||||
"O",
|
||||
"Blink",
|
||||
"Joy",
|
||||
"Angry",
|
||||
"Sorrow",
|
||||
"Fun",
|
||||
"LookUp",
|
||||
"LookDown",
|
||||
"LookLeft",
|
||||
"LookRight",
|
||||
"Blink_L",
|
||||
"Blink_R",
|
||||
})]
|
||||
public string presetName;
|
||||
|
||||
[JsonSchema(Description = "Low level blendshape references. ")]
|
||||
public List<glTF_VRM_BlendShapeBind> binds = new List<glTF_VRM_BlendShapeBind>();
|
||||
|
||||
[JsonSchema(Description = "Material animation references.")]
|
||||
public List<glTF_VRM_MaterialValueBind> materialValues = new List<glTF_VRM_MaterialValueBind>();
|
||||
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
@@ -100,7 +128,7 @@ namespace VRM
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[JsonSchema(Title = "vrm.blendshapemaster")]
|
||||
[JsonSchema(Title = "vrm.blendshapemaster", Description = "BlendShapeAvatar of UniVRM")]
|
||||
public class glTF_VRM_BlendShapeMaster : UniGLTF.JsonSerializableBase
|
||||
{
|
||||
public List<glTF_VRM_BlendShapeGroup> blendShapeGroups = new List<glTF_VRM_BlendShapeGroup>();
|
||||
|
||||
@@ -8,11 +8,16 @@ using UniJSON;
|
||||
namespace VRM
|
||||
{
|
||||
[Serializable]
|
||||
[JsonSchema(Title = "vrm.degreemap")]
|
||||
public class glTF_VRM_DegreeMap : UniGLTF.JsonSerializableBase
|
||||
{
|
||||
// time, value, inTangent, outTangent
|
||||
[JsonSchema(Description = "None linear mapping params. time, value, inTangent, outTangent")]
|
||||
public float[] curve;
|
||||
|
||||
[JsonSchema(Description = "Look at input clamp range degree.")]
|
||||
public float xRange = 90.0f;
|
||||
|
||||
[JsonSchema(Description = "Look at map range degree from xRange.")]
|
||||
public float yRange = 10.0f;
|
||||
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
@@ -66,13 +71,20 @@ namespace VRM
|
||||
[JsonSchema(Title = "vrm.firstperson")]
|
||||
public class glTF_VRM_Firstperson : UniGLTF.JsonSerializableBase
|
||||
{
|
||||
[JsonSchema(Description = "Switch to Head bone when model is rendered in first-person view.")]
|
||||
public int firstPersonBone = -1;
|
||||
|
||||
[JsonSchema(Description = "The target headset position in first-person view. Assuming the head bone is offset from the headset.")]
|
||||
public Vector3 firstPersonBoneOffset;
|
||||
|
||||
[JsonSchema(Description = "Switch on / off mesh for display in first-person view, third-person view, or the others.")]
|
||||
public List<glTF_VRM_MeshAnnotation> meshAnnotations = new List<glTF_VRM_MeshAnnotation>();
|
||||
|
||||
// lookat
|
||||
[JsonSchema(Description = "Eye controller mode.", EnumValues = new object[] {
|
||||
"Bone",
|
||||
"BlendShape",
|
||||
})]
|
||||
public string lookAtTypeName = "Bone";
|
||||
public LookAtType lookAtType
|
||||
{
|
||||
@@ -82,9 +94,17 @@ namespace VRM
|
||||
}
|
||||
set { lookAtTypeName = value.ToString(); }
|
||||
}
|
||||
|
||||
[JsonSchema(Description = "Eye controller setting.")]
|
||||
public glTF_VRM_DegreeMap lookAtHorizontalInner = new glTF_VRM_DegreeMap();
|
||||
|
||||
[JsonSchema(Description = "Eye controller setting.")]
|
||||
public glTF_VRM_DegreeMap lookAtHorizontalOuter = new glTF_VRM_DegreeMap();
|
||||
|
||||
[JsonSchema(Description = "Eye controller setting.")]
|
||||
public glTF_VRM_DegreeMap lookAtVerticalDown = new glTF_VRM_DegreeMap();
|
||||
|
||||
[JsonSchema(Description = "Eye controller setting.")]
|
||||
public glTF_VRM_DegreeMap lookAtVerticalUp = new glTF_VRM_DegreeMap();
|
||||
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniGLTF;
|
||||
using UnityEngine;
|
||||
using UniHumanoid;
|
||||
using UniJSON;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
@@ -89,8 +89,66 @@ namespace VRM
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[JsonSchema(Title = "vrm.humanoidbone")]
|
||||
public class glTF_VRM_HumanoidBone : JsonSerializableBase
|
||||
{
|
||||
[JsonSchema(Description = "Human bone name.", EnumValues = new object[] {
|
||||
"hips",
|
||||
"leftUpperLeg",
|
||||
"rightUpperLeg",
|
||||
"leftLowerLeg",
|
||||
"rightLowerLeg",
|
||||
"leftFoot",
|
||||
"rightFoot",
|
||||
"spine",
|
||||
"chest",
|
||||
"neck",
|
||||
"head",
|
||||
"leftShoulder",
|
||||
"rightShoulder",
|
||||
"leftUpperArm",
|
||||
"rightUpperArm",
|
||||
"leftLowerArm",
|
||||
"rightLowerArm",
|
||||
"leftHand",
|
||||
"rightHand",
|
||||
"leftToes",
|
||||
"rightToes",
|
||||
"leftEye",
|
||||
"rightEye",
|
||||
"jaw",
|
||||
"leftThumbProximal",
|
||||
"leftThumbIntermediate",
|
||||
"leftThumbDistal",
|
||||
"leftIndexProximal",
|
||||
"leftIndexIntermediate",
|
||||
"leftIndexDistal",
|
||||
"leftMiddleProximal",
|
||||
"leftMiddleIntermediate",
|
||||
"leftMiddleDistal",
|
||||
"leftRingProximal",
|
||||
"leftRingIntermediate",
|
||||
"leftRingDistal",
|
||||
"leftLittleProximal",
|
||||
"leftLittleIntermediate",
|
||||
"leftLittleDistal",
|
||||
"rightThumbProximal",
|
||||
"rightThumbIntermediate",
|
||||
"rightThumbDistal",
|
||||
"rightIndexProximal",
|
||||
"rightIndexIntermediate",
|
||||
"rightIndexDistal",
|
||||
"rightMiddleProximal",
|
||||
"rightMiddleIntermediate",
|
||||
"rightMiddleDistal",
|
||||
"rightRingProximal",
|
||||
"rightRingIntermediate",
|
||||
"rightRingDistal",
|
||||
"rightLittleProximal",
|
||||
"rightLittleIntermediate",
|
||||
"rightLittleDistal",
|
||||
"upperChest",
|
||||
})]
|
||||
public string bone;
|
||||
public VRMBone vrmBone
|
||||
{
|
||||
@@ -103,12 +161,23 @@ namespace VRM
|
||||
return EnumUtil.TryParseOrDefault<VRMBone>(bone);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonSchema(Description = "Reference node index")]
|
||||
public int node = -1;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanLimit.useDefaultValues")]
|
||||
public bool useDefaultValues = true;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanLimit.min")]
|
||||
public Vector3 min;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanLimit.max")]
|
||||
public Vector3 max;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanLimit.center")]
|
||||
public Vector3 center;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanLimit.axisLength")]
|
||||
public float axisLength;
|
||||
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
@@ -131,13 +200,29 @@ namespace VRM
|
||||
public class glTF_VRM_Humanoid : JsonSerializableBase
|
||||
{
|
||||
public List<glTF_VRM_HumanoidBone> humanBones = new List<glTF_VRM_HumanoidBone>();
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.armStretch")]
|
||||
public float armStretch = 0.05f;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.legStretch")]
|
||||
public float legStretch = 0.05f;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.upperArmTwist")]
|
||||
public float upperArmTwist = 0.5f;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.lowerArmTwist")]
|
||||
public float lowerArmTwist = 0.5f;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.upperLegTwist")]
|
||||
public float upperLegTwist = 0.5f;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.lowerLegTwist")]
|
||||
public float lowerLegTwist = 0.5f;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.feetSpacing")]
|
||||
public float feetSpacing = 0;
|
||||
|
||||
[JsonSchema(Description = "Unity's HumanDescription.hasTranslationDoF")]
|
||||
public bool hasTranslationDoF = false;
|
||||
|
||||
public void SetNodeIndex(HumanBodyBones _key, int node)
|
||||
|
||||
Reference in New Issue
Block a user