vrm spec 更新。InitRotationPoseProvider 修正。ENDSITE 対策

This commit is contained in:
ousttrue 2023-03-02 19:54:37 +09:00
parent 29e885c0d7
commit 655adf3c8d
10 changed files with 790 additions and 367 deletions

View File

@ -8,9 +8,14 @@ namespace UniGLTF
{
public static class NodeImporter
{
static int n = 0;
public static GameObject ImportNode(glTFNode node, int nodeIndex)
{
var nodeName = node.name;
if (nodeName == "ENDSITE")
{
nodeName = $"ENDSITE{n++}";
}
if (!string.IsNullOrEmpty(nodeName) && nodeName.Contains("/"))
{
Debug.LogWarningFormat("node {0} contains /. replace _", node.name);
@ -120,7 +125,7 @@ namespace UniGLTF
// invisible in loading
renderer.enabled = false;
if (mesh.ShouldSetRendererNodeAsBone )
if (mesh.ShouldSetRendererNodeAsBone)
{
renderer.bones = new[] { renderer.transform };

View File

@ -95,15 +95,6 @@ namespace UniHumanoid
hips.position = new Vector3(0, scaledHeight, 0); // foot to ground
}
//
// avatar
//
Avatar = description.CreateAvatar(Root.transform);
Avatar.name = "Avatar";
AvatarDescription = description;
var animator = Root.AddComponent<Animator>();
animator.avatar = Avatar;
//
// create AnimationClip
//
@ -117,15 +108,14 @@ namespace UniHumanoid
animation.clip = Animation;
animation.Play();
var humanPoseTransfer = Root.AddComponent<HumanPoseTransfer>();
humanPoseTransfer.Avatar = Avatar;
// create SkinnedMesh for bone visualize
var renderer = SkeletonMeshUtility.CreateRenderer(animator);
Material = new Material(Shader.Find("Standard"));
renderer.sharedMaterial = Material;
Mesh = renderer.sharedMesh;
Mesh.name = "box-man";
//
// avatar
//
Avatar = description.CreateAvatar(Root.transform);
Avatar.name = "Avatar";
AvatarDescription = description;
var animator = Root.AddComponent<Animator>();
animator.avatar = Avatar;
}
static Transform BuildHierarchy(Transform parent, BvhNode node, float toMeter)

View File

@ -19,6 +19,7 @@ namespace UniVRM10
Transform m_root;
Transform m_hips;
private readonly Dictionary<HumanBodyBones, BoneInitialRotation> m_bones = new Dictionary<HumanBodyBones, BoneInitialRotation>();
private readonly Dictionary<HumanBodyBones, EuclideanTransform> m_worldMap = new Dictionary<HumanBodyBones, EuclideanTransform>();
public Vector3 HipTPoseWorldPosition => throw new System.NotImplementedException();
@ -28,6 +29,7 @@ namespace UniVRM10
foreach (var (t, bone) in humanoid.BoneMap)
{
m_bones.Add(bone, new BoneInitialRotation(t));
m_worldMap.Add(bone, new EuclideanTransform(root.localToWorldMatrix * t.localToWorldMatrix));
}
m_hips = m_bones[HumanBodyBones.Hips].Transform;
}
@ -53,13 +55,20 @@ namespace UniVRM10
}
else
{
throw new System.NotImplementedException();
return m_root.worldToLocalMatrix.MultiplyPoint(m_hips.position);
}
}
EuclideanTransform? ITPoseProvider.GetWorldTransform(HumanBodyBones bone)
{
throw new System.NotImplementedException();
if (m_worldMap.TryGetValue(bone, out var t))
{
return t;
}
else
{
return default;
}
}
}
}

View File

@ -75,6 +75,33 @@ public static Humanoid Deserialize_Humanoid(JsonNode parsed)
{
var value = new Humanoid();
foreach(var kv in parsed.ObjectItems())
{
var key = kv.Key.GetString();
if(key=="extensions"){
value.Extensions = new glTFExtensionImport(kv.Value);
continue;
}
if(key=="extras"){
value.Extras = new glTFExtensionImport(kv.Value);
continue;
}
if(key=="humanBones"){
value.HumanBones = __humanoid_Deserialize_HumanBones(kv.Value);
continue;
}
}
return value;
}
public static HumanBones __humanoid_Deserialize_HumanBones(JsonNode parsed)
{
var value = new HumanBones();
foreach(var kv in parsed.ObjectItems())
{
var key = kv.Key.GetString();
@ -90,267 +117,267 @@ public static Humanoid Deserialize_Humanoid(JsonNode parsed)
}
if(key=="hips"){
value.Hips = __humanoid_Deserialize_Hips(kv.Value);
value.Hips = __humanoid__humanBones_Deserialize_Hips(kv.Value);
continue;
}
if(key=="spine"){
value.Spine = __humanoid_Deserialize_Spine(kv.Value);
value.Spine = __humanoid__humanBones_Deserialize_Spine(kv.Value);
continue;
}
if(key=="chest"){
value.Chest = __humanoid_Deserialize_Chest(kv.Value);
value.Chest = __humanoid__humanBones_Deserialize_Chest(kv.Value);
continue;
}
if(key=="upperChest"){
value.UpperChest = __humanoid_Deserialize_UpperChest(kv.Value);
value.UpperChest = __humanoid__humanBones_Deserialize_UpperChest(kv.Value);
continue;
}
if(key=="neck"){
value.Neck = __humanoid_Deserialize_Neck(kv.Value);
value.Neck = __humanoid__humanBones_Deserialize_Neck(kv.Value);
continue;
}
if(key=="head"){
value.Head = __humanoid_Deserialize_Head(kv.Value);
value.Head = __humanoid__humanBones_Deserialize_Head(kv.Value);
continue;
}
if(key=="jaw"){
value.Jaw = __humanoid_Deserialize_Jaw(kv.Value);
value.Jaw = __humanoid__humanBones_Deserialize_Jaw(kv.Value);
continue;
}
if(key=="leftUpperLeg"){
value.LeftUpperLeg = __humanoid_Deserialize_LeftUpperLeg(kv.Value);
value.LeftUpperLeg = __humanoid__humanBones_Deserialize_LeftUpperLeg(kv.Value);
continue;
}
if(key=="leftLowerLeg"){
value.LeftLowerLeg = __humanoid_Deserialize_LeftLowerLeg(kv.Value);
value.LeftLowerLeg = __humanoid__humanBones_Deserialize_LeftLowerLeg(kv.Value);
continue;
}
if(key=="leftFoot"){
value.LeftFoot = __humanoid_Deserialize_LeftFoot(kv.Value);
value.LeftFoot = __humanoid__humanBones_Deserialize_LeftFoot(kv.Value);
continue;
}
if(key=="leftToes"){
value.LeftToes = __humanoid_Deserialize_LeftToes(kv.Value);
value.LeftToes = __humanoid__humanBones_Deserialize_LeftToes(kv.Value);
continue;
}
if(key=="rightUpperLeg"){
value.RightUpperLeg = __humanoid_Deserialize_RightUpperLeg(kv.Value);
value.RightUpperLeg = __humanoid__humanBones_Deserialize_RightUpperLeg(kv.Value);
continue;
}
if(key=="rightLowerLeg"){
value.RightLowerLeg = __humanoid_Deserialize_RightLowerLeg(kv.Value);
value.RightLowerLeg = __humanoid__humanBones_Deserialize_RightLowerLeg(kv.Value);
continue;
}
if(key=="rightFoot"){
value.RightFoot = __humanoid_Deserialize_RightFoot(kv.Value);
value.RightFoot = __humanoid__humanBones_Deserialize_RightFoot(kv.Value);
continue;
}
if(key=="rightToes"){
value.RightToes = __humanoid_Deserialize_RightToes(kv.Value);
value.RightToes = __humanoid__humanBones_Deserialize_RightToes(kv.Value);
continue;
}
if(key=="leftShoulder"){
value.LeftShoulder = __humanoid_Deserialize_LeftShoulder(kv.Value);
value.LeftShoulder = __humanoid__humanBones_Deserialize_LeftShoulder(kv.Value);
continue;
}
if(key=="leftUpperArm"){
value.LeftUpperArm = __humanoid_Deserialize_LeftUpperArm(kv.Value);
value.LeftUpperArm = __humanoid__humanBones_Deserialize_LeftUpperArm(kv.Value);
continue;
}
if(key=="leftLowerArm"){
value.LeftLowerArm = __humanoid_Deserialize_LeftLowerArm(kv.Value);
value.LeftLowerArm = __humanoid__humanBones_Deserialize_LeftLowerArm(kv.Value);
continue;
}
if(key=="leftHand"){
value.LeftHand = __humanoid_Deserialize_LeftHand(kv.Value);
value.LeftHand = __humanoid__humanBones_Deserialize_LeftHand(kv.Value);
continue;
}
if(key=="rightShoulder"){
value.RightShoulder = __humanoid_Deserialize_RightShoulder(kv.Value);
value.RightShoulder = __humanoid__humanBones_Deserialize_RightShoulder(kv.Value);
continue;
}
if(key=="rightUpperArm"){
value.RightUpperArm = __humanoid_Deserialize_RightUpperArm(kv.Value);
value.RightUpperArm = __humanoid__humanBones_Deserialize_RightUpperArm(kv.Value);
continue;
}
if(key=="rightLowerArm"){
value.RightLowerArm = __humanoid_Deserialize_RightLowerArm(kv.Value);
value.RightLowerArm = __humanoid__humanBones_Deserialize_RightLowerArm(kv.Value);
continue;
}
if(key=="rightHand"){
value.RightHand = __humanoid_Deserialize_RightHand(kv.Value);
value.RightHand = __humanoid__humanBones_Deserialize_RightHand(kv.Value);
continue;
}
if(key=="leftThumbMetacarpal"){
value.LeftThumbMetacarpal = __humanoid_Deserialize_LeftThumbMetacarpal(kv.Value);
value.LeftThumbMetacarpal = __humanoid__humanBones_Deserialize_LeftThumbMetacarpal(kv.Value);
continue;
}
if(key=="leftThumbProximal"){
value.LeftThumbProximal = __humanoid_Deserialize_LeftThumbProximal(kv.Value);
value.LeftThumbProximal = __humanoid__humanBones_Deserialize_LeftThumbProximal(kv.Value);
continue;
}
if(key=="leftThumbDistal"){
value.LeftThumbDistal = __humanoid_Deserialize_LeftThumbDistal(kv.Value);
value.LeftThumbDistal = __humanoid__humanBones_Deserialize_LeftThumbDistal(kv.Value);
continue;
}
if(key=="leftIndexProximal"){
value.LeftIndexProximal = __humanoid_Deserialize_LeftIndexProximal(kv.Value);
value.LeftIndexProximal = __humanoid__humanBones_Deserialize_LeftIndexProximal(kv.Value);
continue;
}
if(key=="leftIndexIntermediate"){
value.LeftIndexIntermediate = __humanoid_Deserialize_LeftIndexIntermediate(kv.Value);
value.LeftIndexIntermediate = __humanoid__humanBones_Deserialize_LeftIndexIntermediate(kv.Value);
continue;
}
if(key=="leftIndexDistal"){
value.LeftIndexDistal = __humanoid_Deserialize_LeftIndexDistal(kv.Value);
value.LeftIndexDistal = __humanoid__humanBones_Deserialize_LeftIndexDistal(kv.Value);
continue;
}
if(key=="leftMiddleProximal"){
value.LeftMiddleProximal = __humanoid_Deserialize_LeftMiddleProximal(kv.Value);
value.LeftMiddleProximal = __humanoid__humanBones_Deserialize_LeftMiddleProximal(kv.Value);
continue;
}
if(key=="leftMiddleIntermediate"){
value.LeftMiddleIntermediate = __humanoid_Deserialize_LeftMiddleIntermediate(kv.Value);
value.LeftMiddleIntermediate = __humanoid__humanBones_Deserialize_LeftMiddleIntermediate(kv.Value);
continue;
}
if(key=="leftMiddleDistal"){
value.LeftMiddleDistal = __humanoid_Deserialize_LeftMiddleDistal(kv.Value);
value.LeftMiddleDistal = __humanoid__humanBones_Deserialize_LeftMiddleDistal(kv.Value);
continue;
}
if(key=="leftRingProximal"){
value.LeftRingProximal = __humanoid_Deserialize_LeftRingProximal(kv.Value);
value.LeftRingProximal = __humanoid__humanBones_Deserialize_LeftRingProximal(kv.Value);
continue;
}
if(key=="leftRingIntermediate"){
value.LeftRingIntermediate = __humanoid_Deserialize_LeftRingIntermediate(kv.Value);
value.LeftRingIntermediate = __humanoid__humanBones_Deserialize_LeftRingIntermediate(kv.Value);
continue;
}
if(key=="leftRingDistal"){
value.LeftRingDistal = __humanoid_Deserialize_LeftRingDistal(kv.Value);
value.LeftRingDistal = __humanoid__humanBones_Deserialize_LeftRingDistal(kv.Value);
continue;
}
if(key=="leftLittleProximal"){
value.LeftLittleProximal = __humanoid_Deserialize_LeftLittleProximal(kv.Value);
value.LeftLittleProximal = __humanoid__humanBones_Deserialize_LeftLittleProximal(kv.Value);
continue;
}
if(key=="leftLittleIntermediate"){
value.LeftLittleIntermediate = __humanoid_Deserialize_LeftLittleIntermediate(kv.Value);
value.LeftLittleIntermediate = __humanoid__humanBones_Deserialize_LeftLittleIntermediate(kv.Value);
continue;
}
if(key=="leftLittleDistal"){
value.LeftLittleDistal = __humanoid_Deserialize_LeftLittleDistal(kv.Value);
value.LeftLittleDistal = __humanoid__humanBones_Deserialize_LeftLittleDistal(kv.Value);
continue;
}
if(key=="rightThumbMetacarpal"){
value.RightThumbMetacarpal = __humanoid_Deserialize_RightThumbMetacarpal(kv.Value);
value.RightThumbMetacarpal = __humanoid__humanBones_Deserialize_RightThumbMetacarpal(kv.Value);
continue;
}
if(key=="rightThumbProximal"){
value.RightThumbProximal = __humanoid_Deserialize_RightThumbProximal(kv.Value);
value.RightThumbProximal = __humanoid__humanBones_Deserialize_RightThumbProximal(kv.Value);
continue;
}
if(key=="rightThumbDistal"){
value.RightThumbDistal = __humanoid_Deserialize_RightThumbDistal(kv.Value);
value.RightThumbDistal = __humanoid__humanBones_Deserialize_RightThumbDistal(kv.Value);
continue;
}
if(key=="rightIndexProximal"){
value.RightIndexProximal = __humanoid_Deserialize_RightIndexProximal(kv.Value);
value.RightIndexProximal = __humanoid__humanBones_Deserialize_RightIndexProximal(kv.Value);
continue;
}
if(key=="rightIndexIntermediate"){
value.RightIndexIntermediate = __humanoid_Deserialize_RightIndexIntermediate(kv.Value);
value.RightIndexIntermediate = __humanoid__humanBones_Deserialize_RightIndexIntermediate(kv.Value);
continue;
}
if(key=="rightIndexDistal"){
value.RightIndexDistal = __humanoid_Deserialize_RightIndexDistal(kv.Value);
value.RightIndexDistal = __humanoid__humanBones_Deserialize_RightIndexDistal(kv.Value);
continue;
}
if(key=="rightMiddleProximal"){
value.RightMiddleProximal = __humanoid_Deserialize_RightMiddleProximal(kv.Value);
value.RightMiddleProximal = __humanoid__humanBones_Deserialize_RightMiddleProximal(kv.Value);
continue;
}
if(key=="rightMiddleIntermediate"){
value.RightMiddleIntermediate = __humanoid_Deserialize_RightMiddleIntermediate(kv.Value);
value.RightMiddleIntermediate = __humanoid__humanBones_Deserialize_RightMiddleIntermediate(kv.Value);
continue;
}
if(key=="rightMiddleDistal"){
value.RightMiddleDistal = __humanoid_Deserialize_RightMiddleDistal(kv.Value);
value.RightMiddleDistal = __humanoid__humanBones_Deserialize_RightMiddleDistal(kv.Value);
continue;
}
if(key=="rightRingProximal"){
value.RightRingProximal = __humanoid_Deserialize_RightRingProximal(kv.Value);
value.RightRingProximal = __humanoid__humanBones_Deserialize_RightRingProximal(kv.Value);
continue;
}
if(key=="rightRingIntermediate"){
value.RightRingIntermediate = __humanoid_Deserialize_RightRingIntermediate(kv.Value);
value.RightRingIntermediate = __humanoid__humanBones_Deserialize_RightRingIntermediate(kv.Value);
continue;
}
if(key=="rightRingDistal"){
value.RightRingDistal = __humanoid_Deserialize_RightRingDistal(kv.Value);
value.RightRingDistal = __humanoid__humanBones_Deserialize_RightRingDistal(kv.Value);
continue;
}
if(key=="rightLittleProximal"){
value.RightLittleProximal = __humanoid_Deserialize_RightLittleProximal(kv.Value);
value.RightLittleProximal = __humanoid__humanBones_Deserialize_RightLittleProximal(kv.Value);
continue;
}
if(key=="rightLittleIntermediate"){
value.RightLittleIntermediate = __humanoid_Deserialize_RightLittleIntermediate(kv.Value);
value.RightLittleIntermediate = __humanoid__humanBones_Deserialize_RightLittleIntermediate(kv.Value);
continue;
}
if(key=="rightLittleDistal"){
value.RightLittleDistal = __humanoid_Deserialize_RightLittleDistal(kv.Value);
value.RightLittleDistal = __humanoid__humanBones_Deserialize_RightLittleDistal(kv.Value);
continue;
}
@ -358,7 +385,7 @@ public static Humanoid Deserialize_Humanoid(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_Hips(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_Hips(JsonNode parsed)
{
var value = new HumanBone();
@ -385,7 +412,7 @@ public static HumanBone __humanoid_Deserialize_Hips(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_Spine(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_Spine(JsonNode parsed)
{
var value = new HumanBone();
@ -412,7 +439,7 @@ public static HumanBone __humanoid_Deserialize_Spine(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_Chest(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_Chest(JsonNode parsed)
{
var value = new HumanBone();
@ -439,7 +466,7 @@ public static HumanBone __humanoid_Deserialize_Chest(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_UpperChest(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_UpperChest(JsonNode parsed)
{
var value = new HumanBone();
@ -466,7 +493,7 @@ public static HumanBone __humanoid_Deserialize_UpperChest(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_Neck(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_Neck(JsonNode parsed)
{
var value = new HumanBone();
@ -493,7 +520,7 @@ public static HumanBone __humanoid_Deserialize_Neck(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_Head(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_Head(JsonNode parsed)
{
var value = new HumanBone();
@ -520,7 +547,7 @@ public static HumanBone __humanoid_Deserialize_Head(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_Jaw(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_Jaw(JsonNode parsed)
{
var value = new HumanBone();
@ -547,7 +574,7 @@ public static HumanBone __humanoid_Deserialize_Jaw(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftUpperLeg(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftUpperLeg(JsonNode parsed)
{
var value = new HumanBone();
@ -574,7 +601,7 @@ public static HumanBone __humanoid_Deserialize_LeftUpperLeg(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftLowerLeg(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftLowerLeg(JsonNode parsed)
{
var value = new HumanBone();
@ -601,7 +628,7 @@ public static HumanBone __humanoid_Deserialize_LeftLowerLeg(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftFoot(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftFoot(JsonNode parsed)
{
var value = new HumanBone();
@ -628,7 +655,7 @@ public static HumanBone __humanoid_Deserialize_LeftFoot(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftToes(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftToes(JsonNode parsed)
{
var value = new HumanBone();
@ -655,7 +682,7 @@ public static HumanBone __humanoid_Deserialize_LeftToes(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightUpperLeg(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightUpperLeg(JsonNode parsed)
{
var value = new HumanBone();
@ -682,7 +709,7 @@ public static HumanBone __humanoid_Deserialize_RightUpperLeg(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightLowerLeg(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightLowerLeg(JsonNode parsed)
{
var value = new HumanBone();
@ -709,7 +736,7 @@ public static HumanBone __humanoid_Deserialize_RightLowerLeg(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightFoot(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightFoot(JsonNode parsed)
{
var value = new HumanBone();
@ -736,7 +763,7 @@ public static HumanBone __humanoid_Deserialize_RightFoot(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightToes(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightToes(JsonNode parsed)
{
var value = new HumanBone();
@ -763,7 +790,7 @@ public static HumanBone __humanoid_Deserialize_RightToes(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftShoulder(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftShoulder(JsonNode parsed)
{
var value = new HumanBone();
@ -790,7 +817,7 @@ public static HumanBone __humanoid_Deserialize_LeftShoulder(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftUpperArm(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftUpperArm(JsonNode parsed)
{
var value = new HumanBone();
@ -817,7 +844,7 @@ public static HumanBone __humanoid_Deserialize_LeftUpperArm(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftLowerArm(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftLowerArm(JsonNode parsed)
{
var value = new HumanBone();
@ -844,7 +871,7 @@ public static HumanBone __humanoid_Deserialize_LeftLowerArm(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftHand(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftHand(JsonNode parsed)
{
var value = new HumanBone();
@ -871,7 +898,7 @@ public static HumanBone __humanoid_Deserialize_LeftHand(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightShoulder(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightShoulder(JsonNode parsed)
{
var value = new HumanBone();
@ -898,7 +925,7 @@ public static HumanBone __humanoid_Deserialize_RightShoulder(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightUpperArm(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightUpperArm(JsonNode parsed)
{
var value = new HumanBone();
@ -925,7 +952,7 @@ public static HumanBone __humanoid_Deserialize_RightUpperArm(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightLowerArm(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightLowerArm(JsonNode parsed)
{
var value = new HumanBone();
@ -952,7 +979,7 @@ public static HumanBone __humanoid_Deserialize_RightLowerArm(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightHand(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightHand(JsonNode parsed)
{
var value = new HumanBone();
@ -979,7 +1006,7 @@ public static HumanBone __humanoid_Deserialize_RightHand(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftThumbMetacarpal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftThumbMetacarpal(JsonNode parsed)
{
var value = new HumanBone();
@ -1006,7 +1033,7 @@ public static HumanBone __humanoid_Deserialize_LeftThumbMetacarpal(JsonNode pars
return value;
}
public static HumanBone __humanoid_Deserialize_LeftThumbProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftThumbProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1033,7 +1060,7 @@ public static HumanBone __humanoid_Deserialize_LeftThumbProximal(JsonNode parsed
return value;
}
public static HumanBone __humanoid_Deserialize_LeftThumbDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftThumbDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1060,7 +1087,7 @@ public static HumanBone __humanoid_Deserialize_LeftThumbDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftIndexProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftIndexProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1087,7 +1114,7 @@ public static HumanBone __humanoid_Deserialize_LeftIndexProximal(JsonNode parsed
return value;
}
public static HumanBone __humanoid_Deserialize_LeftIndexIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftIndexIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1114,7 +1141,7 @@ public static HumanBone __humanoid_Deserialize_LeftIndexIntermediate(JsonNode pa
return value;
}
public static HumanBone __humanoid_Deserialize_LeftIndexDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftIndexDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1141,7 +1168,7 @@ public static HumanBone __humanoid_Deserialize_LeftIndexDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftMiddleProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftMiddleProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1168,7 +1195,7 @@ public static HumanBone __humanoid_Deserialize_LeftMiddleProximal(JsonNode parse
return value;
}
public static HumanBone __humanoid_Deserialize_LeftMiddleIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftMiddleIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1195,7 +1222,7 @@ public static HumanBone __humanoid_Deserialize_LeftMiddleIntermediate(JsonNode p
return value;
}
public static HumanBone __humanoid_Deserialize_LeftMiddleDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftMiddleDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1222,7 +1249,7 @@ public static HumanBone __humanoid_Deserialize_LeftMiddleDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftRingProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftRingProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1249,7 +1276,7 @@ public static HumanBone __humanoid_Deserialize_LeftRingProximal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftRingIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftRingIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1276,7 +1303,7 @@ public static HumanBone __humanoid_Deserialize_LeftRingIntermediate(JsonNode par
return value;
}
public static HumanBone __humanoid_Deserialize_LeftRingDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftRingDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1303,7 +1330,7 @@ public static HumanBone __humanoid_Deserialize_LeftRingDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_LeftLittleProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftLittleProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1330,7 +1357,7 @@ public static HumanBone __humanoid_Deserialize_LeftLittleProximal(JsonNode parse
return value;
}
public static HumanBone __humanoid_Deserialize_LeftLittleIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftLittleIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1357,7 +1384,7 @@ public static HumanBone __humanoid_Deserialize_LeftLittleIntermediate(JsonNode p
return value;
}
public static HumanBone __humanoid_Deserialize_LeftLittleDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_LeftLittleDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1384,7 +1411,7 @@ public static HumanBone __humanoid_Deserialize_LeftLittleDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightThumbMetacarpal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightThumbMetacarpal(JsonNode parsed)
{
var value = new HumanBone();
@ -1411,7 +1438,7 @@ public static HumanBone __humanoid_Deserialize_RightThumbMetacarpal(JsonNode par
return value;
}
public static HumanBone __humanoid_Deserialize_RightThumbProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightThumbProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1438,7 +1465,7 @@ public static HumanBone __humanoid_Deserialize_RightThumbProximal(JsonNode parse
return value;
}
public static HumanBone __humanoid_Deserialize_RightThumbDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightThumbDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1465,7 +1492,7 @@ public static HumanBone __humanoid_Deserialize_RightThumbDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightIndexProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightIndexProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1492,7 +1519,7 @@ public static HumanBone __humanoid_Deserialize_RightIndexProximal(JsonNode parse
return value;
}
public static HumanBone __humanoid_Deserialize_RightIndexIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightIndexIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1519,7 +1546,7 @@ public static HumanBone __humanoid_Deserialize_RightIndexIntermediate(JsonNode p
return value;
}
public static HumanBone __humanoid_Deserialize_RightIndexDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightIndexDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1546,7 +1573,7 @@ public static HumanBone __humanoid_Deserialize_RightIndexDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightMiddleProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightMiddleProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1573,7 +1600,7 @@ public static HumanBone __humanoid_Deserialize_RightMiddleProximal(JsonNode pars
return value;
}
public static HumanBone __humanoid_Deserialize_RightMiddleIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightMiddleIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1600,7 +1627,7 @@ public static HumanBone __humanoid_Deserialize_RightMiddleIntermediate(JsonNode
return value;
}
public static HumanBone __humanoid_Deserialize_RightMiddleDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightMiddleDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1627,7 +1654,7 @@ public static HumanBone __humanoid_Deserialize_RightMiddleDistal(JsonNode parsed
return value;
}
public static HumanBone __humanoid_Deserialize_RightRingProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightRingProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1654,7 +1681,7 @@ public static HumanBone __humanoid_Deserialize_RightRingProximal(JsonNode parsed
return value;
}
public static HumanBone __humanoid_Deserialize_RightRingIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightRingIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1681,7 +1708,7 @@ public static HumanBone __humanoid_Deserialize_RightRingIntermediate(JsonNode pa
return value;
}
public static HumanBone __humanoid_Deserialize_RightRingDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightRingDistal(JsonNode parsed)
{
var value = new HumanBone();
@ -1708,7 +1735,7 @@ public static HumanBone __humanoid_Deserialize_RightRingDistal(JsonNode parsed)
return value;
}
public static HumanBone __humanoid_Deserialize_RightLittleProximal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightLittleProximal(JsonNode parsed)
{
var value = new HumanBone();
@ -1735,7 +1762,7 @@ public static HumanBone __humanoid_Deserialize_RightLittleProximal(JsonNode pars
return value;
}
public static HumanBone __humanoid_Deserialize_RightLittleIntermediate(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightLittleIntermediate(JsonNode parsed)
{
var value = new HumanBone();
@ -1762,7 +1789,7 @@ public static HumanBone __humanoid_Deserialize_RightLittleIntermediate(JsonNode
return value;
}
public static HumanBone __humanoid_Deserialize_RightLittleDistal(JsonNode parsed)
public static HumanBone __humanoid__humanBones_Deserialize_RightLittleDistal(JsonNode parsed)
{
var value = new HumanBone();

View File

@ -18,7 +18,7 @@ namespace UniGLTF.Extensions.VRMC_vrm_animation
public int? Node;
}
public class Humanoid
public class HumanBones
{
// Dictionary object with extension-specific objects.
public object Extensions;
@ -186,6 +186,18 @@ namespace UniGLTF.Extensions.VRMC_vrm_animation
public HumanBone RightLittleDistal;
}
public class Humanoid
{
// Dictionary object with extension-specific objects.
public object Extensions;
// Application-specific data.
public object Extras;
// An object which maps humanoid bones to nodes.
public HumanBones HumanBones;
}
public class Expression
{
// Dictionary object with extension-specific objects.
@ -295,7 +307,7 @@ namespace UniGLTF.Extensions.VRMC_vrm_animation
// Specification version of VRMC_vrm_animation
public string SpecVersion;
// An object which maps humanoid bones to nodes.
// An object which describes about humanoid bones.
public Humanoid Humanoid;
// An object which maps expressions to nodes.

View File

@ -71,6 +71,29 @@ public static void Serialize_Humanoid(JsonFormatter f, Humanoid value)
f.BeginMap();
if(value.Extensions!=null){
f.Key("extensions");
(value.Extensions as glTFExtension).Serialize(f);
}
if(value.Extras!=null){
f.Key("extras");
(value.Extras as glTFExtension).Serialize(f);
}
if(value.HumanBones!=null){
f.Key("humanBones");
__humanoid_Serialize_HumanBones(f, value.HumanBones);
}
f.EndMap();
}
public static void __humanoid_Serialize_HumanBones(JsonFormatter f, HumanBones value)
{
f.BeginMap();
if(value.Extensions!=null){
f.Key("extensions");
(value.Extensions as glTFExtension).Serialize(f);
@ -83,273 +106,273 @@ public static void Serialize_Humanoid(JsonFormatter f, Humanoid value)
if(value.Hips!=null){
f.Key("hips");
__humanoid_Serialize_Hips(f, value.Hips);
__humanoid__humanBones_Serialize_Hips(f, value.Hips);
}
if(value.Spine!=null){
f.Key("spine");
__humanoid_Serialize_Spine(f, value.Spine);
__humanoid__humanBones_Serialize_Spine(f, value.Spine);
}
if(value.Chest!=null){
f.Key("chest");
__humanoid_Serialize_Chest(f, value.Chest);
__humanoid__humanBones_Serialize_Chest(f, value.Chest);
}
if(value.UpperChest!=null){
f.Key("upperChest");
__humanoid_Serialize_UpperChest(f, value.UpperChest);
__humanoid__humanBones_Serialize_UpperChest(f, value.UpperChest);
}
if(value.Neck!=null){
f.Key("neck");
__humanoid_Serialize_Neck(f, value.Neck);
__humanoid__humanBones_Serialize_Neck(f, value.Neck);
}
if(value.Head!=null){
f.Key("head");
__humanoid_Serialize_Head(f, value.Head);
__humanoid__humanBones_Serialize_Head(f, value.Head);
}
if(value.Jaw!=null){
f.Key("jaw");
__humanoid_Serialize_Jaw(f, value.Jaw);
__humanoid__humanBones_Serialize_Jaw(f, value.Jaw);
}
if(value.LeftUpperLeg!=null){
f.Key("leftUpperLeg");
__humanoid_Serialize_LeftUpperLeg(f, value.LeftUpperLeg);
__humanoid__humanBones_Serialize_LeftUpperLeg(f, value.LeftUpperLeg);
}
if(value.LeftLowerLeg!=null){
f.Key("leftLowerLeg");
__humanoid_Serialize_LeftLowerLeg(f, value.LeftLowerLeg);
__humanoid__humanBones_Serialize_LeftLowerLeg(f, value.LeftLowerLeg);
}
if(value.LeftFoot!=null){
f.Key("leftFoot");
__humanoid_Serialize_LeftFoot(f, value.LeftFoot);
__humanoid__humanBones_Serialize_LeftFoot(f, value.LeftFoot);
}
if(value.LeftToes!=null){
f.Key("leftToes");
__humanoid_Serialize_LeftToes(f, value.LeftToes);
__humanoid__humanBones_Serialize_LeftToes(f, value.LeftToes);
}
if(value.RightUpperLeg!=null){
f.Key("rightUpperLeg");
__humanoid_Serialize_RightUpperLeg(f, value.RightUpperLeg);
__humanoid__humanBones_Serialize_RightUpperLeg(f, value.RightUpperLeg);
}
if(value.RightLowerLeg!=null){
f.Key("rightLowerLeg");
__humanoid_Serialize_RightLowerLeg(f, value.RightLowerLeg);
__humanoid__humanBones_Serialize_RightLowerLeg(f, value.RightLowerLeg);
}
if(value.RightFoot!=null){
f.Key("rightFoot");
__humanoid_Serialize_RightFoot(f, value.RightFoot);
__humanoid__humanBones_Serialize_RightFoot(f, value.RightFoot);
}
if(value.RightToes!=null){
f.Key("rightToes");
__humanoid_Serialize_RightToes(f, value.RightToes);
__humanoid__humanBones_Serialize_RightToes(f, value.RightToes);
}
if(value.LeftShoulder!=null){
f.Key("leftShoulder");
__humanoid_Serialize_LeftShoulder(f, value.LeftShoulder);
__humanoid__humanBones_Serialize_LeftShoulder(f, value.LeftShoulder);
}
if(value.LeftUpperArm!=null){
f.Key("leftUpperArm");
__humanoid_Serialize_LeftUpperArm(f, value.LeftUpperArm);
__humanoid__humanBones_Serialize_LeftUpperArm(f, value.LeftUpperArm);
}
if(value.LeftLowerArm!=null){
f.Key("leftLowerArm");
__humanoid_Serialize_LeftLowerArm(f, value.LeftLowerArm);
__humanoid__humanBones_Serialize_LeftLowerArm(f, value.LeftLowerArm);
}
if(value.LeftHand!=null){
f.Key("leftHand");
__humanoid_Serialize_LeftHand(f, value.LeftHand);
__humanoid__humanBones_Serialize_LeftHand(f, value.LeftHand);
}
if(value.RightShoulder!=null){
f.Key("rightShoulder");
__humanoid_Serialize_RightShoulder(f, value.RightShoulder);
__humanoid__humanBones_Serialize_RightShoulder(f, value.RightShoulder);
}
if(value.RightUpperArm!=null){
f.Key("rightUpperArm");
__humanoid_Serialize_RightUpperArm(f, value.RightUpperArm);
__humanoid__humanBones_Serialize_RightUpperArm(f, value.RightUpperArm);
}
if(value.RightLowerArm!=null){
f.Key("rightLowerArm");
__humanoid_Serialize_RightLowerArm(f, value.RightLowerArm);
__humanoid__humanBones_Serialize_RightLowerArm(f, value.RightLowerArm);
}
if(value.RightHand!=null){
f.Key("rightHand");
__humanoid_Serialize_RightHand(f, value.RightHand);
__humanoid__humanBones_Serialize_RightHand(f, value.RightHand);
}
if(value.LeftThumbMetacarpal!=null){
f.Key("leftThumbMetacarpal");
__humanoid_Serialize_LeftThumbMetacarpal(f, value.LeftThumbMetacarpal);
__humanoid__humanBones_Serialize_LeftThumbMetacarpal(f, value.LeftThumbMetacarpal);
}
if(value.LeftThumbProximal!=null){
f.Key("leftThumbProximal");
__humanoid_Serialize_LeftThumbProximal(f, value.LeftThumbProximal);
__humanoid__humanBones_Serialize_LeftThumbProximal(f, value.LeftThumbProximal);
}
if(value.LeftThumbDistal!=null){
f.Key("leftThumbDistal");
__humanoid_Serialize_LeftThumbDistal(f, value.LeftThumbDistal);
__humanoid__humanBones_Serialize_LeftThumbDistal(f, value.LeftThumbDistal);
}
if(value.LeftIndexProximal!=null){
f.Key("leftIndexProximal");
__humanoid_Serialize_LeftIndexProximal(f, value.LeftIndexProximal);
__humanoid__humanBones_Serialize_LeftIndexProximal(f, value.LeftIndexProximal);
}
if(value.LeftIndexIntermediate!=null){
f.Key("leftIndexIntermediate");
__humanoid_Serialize_LeftIndexIntermediate(f, value.LeftIndexIntermediate);
__humanoid__humanBones_Serialize_LeftIndexIntermediate(f, value.LeftIndexIntermediate);
}
if(value.LeftIndexDistal!=null){
f.Key("leftIndexDistal");
__humanoid_Serialize_LeftIndexDistal(f, value.LeftIndexDistal);
__humanoid__humanBones_Serialize_LeftIndexDistal(f, value.LeftIndexDistal);
}
if(value.LeftMiddleProximal!=null){
f.Key("leftMiddleProximal");
__humanoid_Serialize_LeftMiddleProximal(f, value.LeftMiddleProximal);
__humanoid__humanBones_Serialize_LeftMiddleProximal(f, value.LeftMiddleProximal);
}
if(value.LeftMiddleIntermediate!=null){
f.Key("leftMiddleIntermediate");
__humanoid_Serialize_LeftMiddleIntermediate(f, value.LeftMiddleIntermediate);
__humanoid__humanBones_Serialize_LeftMiddleIntermediate(f, value.LeftMiddleIntermediate);
}
if(value.LeftMiddleDistal!=null){
f.Key("leftMiddleDistal");
__humanoid_Serialize_LeftMiddleDistal(f, value.LeftMiddleDistal);
__humanoid__humanBones_Serialize_LeftMiddleDistal(f, value.LeftMiddleDistal);
}
if(value.LeftRingProximal!=null){
f.Key("leftRingProximal");
__humanoid_Serialize_LeftRingProximal(f, value.LeftRingProximal);
__humanoid__humanBones_Serialize_LeftRingProximal(f, value.LeftRingProximal);
}
if(value.LeftRingIntermediate!=null){
f.Key("leftRingIntermediate");
__humanoid_Serialize_LeftRingIntermediate(f, value.LeftRingIntermediate);
__humanoid__humanBones_Serialize_LeftRingIntermediate(f, value.LeftRingIntermediate);
}
if(value.LeftRingDistal!=null){
f.Key("leftRingDistal");
__humanoid_Serialize_LeftRingDistal(f, value.LeftRingDistal);
__humanoid__humanBones_Serialize_LeftRingDistal(f, value.LeftRingDistal);
}
if(value.LeftLittleProximal!=null){
f.Key("leftLittleProximal");
__humanoid_Serialize_LeftLittleProximal(f, value.LeftLittleProximal);
__humanoid__humanBones_Serialize_LeftLittleProximal(f, value.LeftLittleProximal);
}
if(value.LeftLittleIntermediate!=null){
f.Key("leftLittleIntermediate");
__humanoid_Serialize_LeftLittleIntermediate(f, value.LeftLittleIntermediate);
__humanoid__humanBones_Serialize_LeftLittleIntermediate(f, value.LeftLittleIntermediate);
}
if(value.LeftLittleDistal!=null){
f.Key("leftLittleDistal");
__humanoid_Serialize_LeftLittleDistal(f, value.LeftLittleDistal);
__humanoid__humanBones_Serialize_LeftLittleDistal(f, value.LeftLittleDistal);
}
if(value.RightThumbMetacarpal!=null){
f.Key("rightThumbMetacarpal");
__humanoid_Serialize_RightThumbMetacarpal(f, value.RightThumbMetacarpal);
__humanoid__humanBones_Serialize_RightThumbMetacarpal(f, value.RightThumbMetacarpal);
}
if(value.RightThumbProximal!=null){
f.Key("rightThumbProximal");
__humanoid_Serialize_RightThumbProximal(f, value.RightThumbProximal);
__humanoid__humanBones_Serialize_RightThumbProximal(f, value.RightThumbProximal);
}
if(value.RightThumbDistal!=null){
f.Key("rightThumbDistal");
__humanoid_Serialize_RightThumbDistal(f, value.RightThumbDistal);
__humanoid__humanBones_Serialize_RightThumbDistal(f, value.RightThumbDistal);
}
if(value.RightIndexProximal!=null){
f.Key("rightIndexProximal");
__humanoid_Serialize_RightIndexProximal(f, value.RightIndexProximal);
__humanoid__humanBones_Serialize_RightIndexProximal(f, value.RightIndexProximal);
}
if(value.RightIndexIntermediate!=null){
f.Key("rightIndexIntermediate");
__humanoid_Serialize_RightIndexIntermediate(f, value.RightIndexIntermediate);
__humanoid__humanBones_Serialize_RightIndexIntermediate(f, value.RightIndexIntermediate);
}
if(value.RightIndexDistal!=null){
f.Key("rightIndexDistal");
__humanoid_Serialize_RightIndexDistal(f, value.RightIndexDistal);
__humanoid__humanBones_Serialize_RightIndexDistal(f, value.RightIndexDistal);
}
if(value.RightMiddleProximal!=null){
f.Key("rightMiddleProximal");
__humanoid_Serialize_RightMiddleProximal(f, value.RightMiddleProximal);
__humanoid__humanBones_Serialize_RightMiddleProximal(f, value.RightMiddleProximal);
}
if(value.RightMiddleIntermediate!=null){
f.Key("rightMiddleIntermediate");
__humanoid_Serialize_RightMiddleIntermediate(f, value.RightMiddleIntermediate);
__humanoid__humanBones_Serialize_RightMiddleIntermediate(f, value.RightMiddleIntermediate);
}
if(value.RightMiddleDistal!=null){
f.Key("rightMiddleDistal");
__humanoid_Serialize_RightMiddleDistal(f, value.RightMiddleDistal);
__humanoid__humanBones_Serialize_RightMiddleDistal(f, value.RightMiddleDistal);
}
if(value.RightRingProximal!=null){
f.Key("rightRingProximal");
__humanoid_Serialize_RightRingProximal(f, value.RightRingProximal);
__humanoid__humanBones_Serialize_RightRingProximal(f, value.RightRingProximal);
}
if(value.RightRingIntermediate!=null){
f.Key("rightRingIntermediate");
__humanoid_Serialize_RightRingIntermediate(f, value.RightRingIntermediate);
__humanoid__humanBones_Serialize_RightRingIntermediate(f, value.RightRingIntermediate);
}
if(value.RightRingDistal!=null){
f.Key("rightRingDistal");
__humanoid_Serialize_RightRingDistal(f, value.RightRingDistal);
__humanoid__humanBones_Serialize_RightRingDistal(f, value.RightRingDistal);
}
if(value.RightLittleProximal!=null){
f.Key("rightLittleProximal");
__humanoid_Serialize_RightLittleProximal(f, value.RightLittleProximal);
__humanoid__humanBones_Serialize_RightLittleProximal(f, value.RightLittleProximal);
}
if(value.RightLittleIntermediate!=null){
f.Key("rightLittleIntermediate");
__humanoid_Serialize_RightLittleIntermediate(f, value.RightLittleIntermediate);
__humanoid__humanBones_Serialize_RightLittleIntermediate(f, value.RightLittleIntermediate);
}
if(value.RightLittleDistal!=null){
f.Key("rightLittleDistal");
__humanoid_Serialize_RightLittleDistal(f, value.RightLittleDistal);
__humanoid__humanBones_Serialize_RightLittleDistal(f, value.RightLittleDistal);
}
f.EndMap();
}
public static void __humanoid_Serialize_Hips(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_Hips(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -372,7 +395,7 @@ public static void __humanoid_Serialize_Hips(JsonFormatter f, HumanBone value)
f.EndMap();
}
public static void __humanoid_Serialize_Spine(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_Spine(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -395,7 +418,7 @@ public static void __humanoid_Serialize_Spine(JsonFormatter f, HumanBone value)
f.EndMap();
}
public static void __humanoid_Serialize_Chest(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_Chest(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -418,7 +441,7 @@ public static void __humanoid_Serialize_Chest(JsonFormatter f, HumanBone value)
f.EndMap();
}
public static void __humanoid_Serialize_UpperChest(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_UpperChest(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -441,7 +464,7 @@ public static void __humanoid_Serialize_UpperChest(JsonFormatter f, HumanBone va
f.EndMap();
}
public static void __humanoid_Serialize_Neck(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_Neck(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -464,7 +487,7 @@ public static void __humanoid_Serialize_Neck(JsonFormatter f, HumanBone value)
f.EndMap();
}
public static void __humanoid_Serialize_Head(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_Head(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -487,7 +510,7 @@ public static void __humanoid_Serialize_Head(JsonFormatter f, HumanBone value)
f.EndMap();
}
public static void __humanoid_Serialize_Jaw(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_Jaw(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -510,7 +533,7 @@ public static void __humanoid_Serialize_Jaw(JsonFormatter f, HumanBone value)
f.EndMap();
}
public static void __humanoid_Serialize_LeftUpperLeg(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftUpperLeg(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -533,7 +556,7 @@ public static void __humanoid_Serialize_LeftUpperLeg(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_LeftLowerLeg(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftLowerLeg(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -556,7 +579,7 @@ public static void __humanoid_Serialize_LeftLowerLeg(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_LeftFoot(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftFoot(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -579,7 +602,7 @@ public static void __humanoid_Serialize_LeftFoot(JsonFormatter f, HumanBone valu
f.EndMap();
}
public static void __humanoid_Serialize_LeftToes(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftToes(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -602,7 +625,7 @@ public static void __humanoid_Serialize_LeftToes(JsonFormatter f, HumanBone valu
f.EndMap();
}
public static void __humanoid_Serialize_RightUpperLeg(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightUpperLeg(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -625,7 +648,7 @@ public static void __humanoid_Serialize_RightUpperLeg(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_RightLowerLeg(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightLowerLeg(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -648,7 +671,7 @@ public static void __humanoid_Serialize_RightLowerLeg(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_RightFoot(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightFoot(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -671,7 +694,7 @@ public static void __humanoid_Serialize_RightFoot(JsonFormatter f, HumanBone val
f.EndMap();
}
public static void __humanoid_Serialize_RightToes(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightToes(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -694,7 +717,7 @@ public static void __humanoid_Serialize_RightToes(JsonFormatter f, HumanBone val
f.EndMap();
}
public static void __humanoid_Serialize_LeftShoulder(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftShoulder(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -717,7 +740,7 @@ public static void __humanoid_Serialize_LeftShoulder(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_LeftUpperArm(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftUpperArm(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -740,7 +763,7 @@ public static void __humanoid_Serialize_LeftUpperArm(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_LeftLowerArm(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftLowerArm(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -763,7 +786,7 @@ public static void __humanoid_Serialize_LeftLowerArm(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_LeftHand(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftHand(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -786,7 +809,7 @@ public static void __humanoid_Serialize_LeftHand(JsonFormatter f, HumanBone valu
f.EndMap();
}
public static void __humanoid_Serialize_RightShoulder(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightShoulder(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -809,7 +832,7 @@ public static void __humanoid_Serialize_RightShoulder(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_RightUpperArm(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightUpperArm(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -832,7 +855,7 @@ public static void __humanoid_Serialize_RightUpperArm(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_RightLowerArm(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightLowerArm(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -855,7 +878,7 @@ public static void __humanoid_Serialize_RightLowerArm(JsonFormatter f, HumanBone
f.EndMap();
}
public static void __humanoid_Serialize_RightHand(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightHand(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -878,7 +901,7 @@ public static void __humanoid_Serialize_RightHand(JsonFormatter f, HumanBone val
f.EndMap();
}
public static void __humanoid_Serialize_LeftThumbMetacarpal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftThumbMetacarpal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -901,7 +924,7 @@ public static void __humanoid_Serialize_LeftThumbMetacarpal(JsonFormatter f, Hum
f.EndMap();
}
public static void __humanoid_Serialize_LeftThumbProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftThumbProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -924,7 +947,7 @@ public static void __humanoid_Serialize_LeftThumbProximal(JsonFormatter f, Human
f.EndMap();
}
public static void __humanoid_Serialize_LeftThumbDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftThumbDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -947,7 +970,7 @@ public static void __humanoid_Serialize_LeftThumbDistal(JsonFormatter f, HumanBo
f.EndMap();
}
public static void __humanoid_Serialize_LeftIndexProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftIndexProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -970,7 +993,7 @@ public static void __humanoid_Serialize_LeftIndexProximal(JsonFormatter f, Human
f.EndMap();
}
public static void __humanoid_Serialize_LeftIndexIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftIndexIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -993,7 +1016,7 @@ public static void __humanoid_Serialize_LeftIndexIntermediate(JsonFormatter f, H
f.EndMap();
}
public static void __humanoid_Serialize_LeftIndexDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftIndexDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1016,7 +1039,7 @@ public static void __humanoid_Serialize_LeftIndexDistal(JsonFormatter f, HumanBo
f.EndMap();
}
public static void __humanoid_Serialize_LeftMiddleProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftMiddleProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1039,7 +1062,7 @@ public static void __humanoid_Serialize_LeftMiddleProximal(JsonFormatter f, Huma
f.EndMap();
}
public static void __humanoid_Serialize_LeftMiddleIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftMiddleIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1062,7 +1085,7 @@ public static void __humanoid_Serialize_LeftMiddleIntermediate(JsonFormatter f,
f.EndMap();
}
public static void __humanoid_Serialize_LeftMiddleDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftMiddleDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1085,7 +1108,7 @@ public static void __humanoid_Serialize_LeftMiddleDistal(JsonFormatter f, HumanB
f.EndMap();
}
public static void __humanoid_Serialize_LeftRingProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftRingProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1108,7 +1131,7 @@ public static void __humanoid_Serialize_LeftRingProximal(JsonFormatter f, HumanB
f.EndMap();
}
public static void __humanoid_Serialize_LeftRingIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftRingIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1131,7 +1154,7 @@ public static void __humanoid_Serialize_LeftRingIntermediate(JsonFormatter f, Hu
f.EndMap();
}
public static void __humanoid_Serialize_LeftRingDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftRingDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1154,7 +1177,7 @@ public static void __humanoid_Serialize_LeftRingDistal(JsonFormatter f, HumanBon
f.EndMap();
}
public static void __humanoid_Serialize_LeftLittleProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftLittleProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1177,7 +1200,7 @@ public static void __humanoid_Serialize_LeftLittleProximal(JsonFormatter f, Huma
f.EndMap();
}
public static void __humanoid_Serialize_LeftLittleIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftLittleIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1200,7 +1223,7 @@ public static void __humanoid_Serialize_LeftLittleIntermediate(JsonFormatter f,
f.EndMap();
}
public static void __humanoid_Serialize_LeftLittleDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_LeftLittleDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1223,7 +1246,7 @@ public static void __humanoid_Serialize_LeftLittleDistal(JsonFormatter f, HumanB
f.EndMap();
}
public static void __humanoid_Serialize_RightThumbMetacarpal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightThumbMetacarpal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1246,7 +1269,7 @@ public static void __humanoid_Serialize_RightThumbMetacarpal(JsonFormatter f, Hu
f.EndMap();
}
public static void __humanoid_Serialize_RightThumbProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightThumbProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1269,7 +1292,7 @@ public static void __humanoid_Serialize_RightThumbProximal(JsonFormatter f, Huma
f.EndMap();
}
public static void __humanoid_Serialize_RightThumbDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightThumbDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1292,7 +1315,7 @@ public static void __humanoid_Serialize_RightThumbDistal(JsonFormatter f, HumanB
f.EndMap();
}
public static void __humanoid_Serialize_RightIndexProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightIndexProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1315,7 +1338,7 @@ public static void __humanoid_Serialize_RightIndexProximal(JsonFormatter f, Huma
f.EndMap();
}
public static void __humanoid_Serialize_RightIndexIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightIndexIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1338,7 +1361,7 @@ public static void __humanoid_Serialize_RightIndexIntermediate(JsonFormatter f,
f.EndMap();
}
public static void __humanoid_Serialize_RightIndexDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightIndexDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1361,7 +1384,7 @@ public static void __humanoid_Serialize_RightIndexDistal(JsonFormatter f, HumanB
f.EndMap();
}
public static void __humanoid_Serialize_RightMiddleProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightMiddleProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1384,7 +1407,7 @@ public static void __humanoid_Serialize_RightMiddleProximal(JsonFormatter f, Hum
f.EndMap();
}
public static void __humanoid_Serialize_RightMiddleIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightMiddleIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1407,7 +1430,7 @@ public static void __humanoid_Serialize_RightMiddleIntermediate(JsonFormatter f,
f.EndMap();
}
public static void __humanoid_Serialize_RightMiddleDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightMiddleDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1430,7 +1453,7 @@ public static void __humanoid_Serialize_RightMiddleDistal(JsonFormatter f, Human
f.EndMap();
}
public static void __humanoid_Serialize_RightRingProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightRingProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1453,7 +1476,7 @@ public static void __humanoid_Serialize_RightRingProximal(JsonFormatter f, Human
f.EndMap();
}
public static void __humanoid_Serialize_RightRingIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightRingIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1476,7 +1499,7 @@ public static void __humanoid_Serialize_RightRingIntermediate(JsonFormatter f, H
f.EndMap();
}
public static void __humanoid_Serialize_RightRingDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightRingDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1499,7 +1522,7 @@ public static void __humanoid_Serialize_RightRingDistal(JsonFormatter f, HumanBo
f.EndMap();
}
public static void __humanoid_Serialize_RightLittleProximal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightLittleProximal(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1522,7 +1545,7 @@ public static void __humanoid_Serialize_RightLittleProximal(JsonFormatter f, Hum
f.EndMap();
}
public static void __humanoid_Serialize_RightLittleIntermediate(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightLittleIntermediate(JsonFormatter f, HumanBone value)
{
f.BeginMap();
@ -1545,7 +1568,7 @@ public static void __humanoid_Serialize_RightLittleIntermediate(JsonFormatter f,
f.EndMap();
}
public static void __humanoid_Serialize_RightLittleDistal(JsonFormatter f, HumanBone value)
public static void __humanoid__humanBones_Serialize_RightLittleDistal(JsonFormatter f, HumanBone value)
{
f.BeginMap();

View File

@ -11,123 +11,157 @@ using VRMShaders;
namespace UniVRM10.VRM10Viewer
{
public class VRM10Motion
public interface IMotion : IDisposable
{
public (INormalizedPoseProvider, ITPoseProvider) ControlRig;
(INormalizedPoseProvider, ITPoseProvider) ControlRig { get; }
void ShowBoxMan(bool enable);
}
public class BvhMotion : IMotion
{
UniHumanoid.BvhImporterContext m_context;
UniGLTF.RuntimeGltfInstance m_instance;
public Transform Root => m_context?.Root.transform;
public VRM10Motion(UniHumanoid.BvhImporterContext context)
public SkinnedMeshRenderer m_boxMan;
public SkinnedMeshRenderer BoxMan => m_boxMan;
(INormalizedPoseProvider, ITPoseProvider) m_controlRig;
(INormalizedPoseProvider, ITPoseProvider) IMotion.ControlRig => m_controlRig;
public BvhMotion(UniHumanoid.BvhImporterContext context)
{
m_context = context;
var provider = new AnimatorPoseProvider(m_context.Root.transform, m_context.Root.GetComponent<Animator>());
ControlRig = (provider, provider);
m_controlRig = (provider, provider);
// create SkinnedMesh for bone visualize
var animator = m_context.Root.GetComponent<Animator>();
m_boxMan = SkeletonMeshUtility.CreateRenderer(animator);
var material = new Material(Shader.Find("Standard"));
BoxMan.sharedMaterial = material;
var mesh = BoxMan.sharedMesh;
mesh.name = "box-man";
}
public VRM10Motion(UniGLTF.RuntimeGltfInstance instance)
public static BvhMotion LoadBvhFromText(string source, string path = "tmp.bvh")
{
var context = new UniHumanoid.BvhImporterContext();
context.Parse(path, source);
context.Load();
return new BvhMotion(context);
}
public static BvhMotion LoadBvhFromPath(string path)
{
return LoadBvhFromText(File.ReadAllText(path), path);
}
public void ShowBoxMan(bool enable)
{
m_boxMan.enabled = enable;
}
public void Dispose()
{
GameObject.Destroy(m_context.Root);
}
}
public class VrmAnimation : IMotion
{
UniGLTF.RuntimeGltfInstance m_instance;
public SkinnedMeshRenderer m_boxMan;
public SkinnedMeshRenderer BoxMan => m_boxMan;
(INormalizedPoseProvider, ITPoseProvider) m_controlRig;
(INormalizedPoseProvider, ITPoseProvider) IMotion.ControlRig => m_controlRig;
public VrmAnimation(UniGLTF.RuntimeGltfInstance instance)
{
m_instance = instance;
if (instance.GetComponent<Animation>() is Animation animation)
{
animation.Play();
}
var humanoid = instance.gameObject.AddComponent<Humanoid>();
humanoid.AssignBonesFromAnimator();
var provider = new InitRotationPoseProvider(instance.transform, humanoid);
m_controlRig = (provider, provider);
// create SkinnedMesh for bone visualize
var animator = instance.GetComponent<Animator>();
m_boxMan = SkeletonMeshUtility.CreateRenderer(animator);
var material = new Material(Shader.Find("Standard"));
BoxMan.sharedMaterial = material;
var mesh = BoxMan.sharedMesh;
mesh.name = "box-man";
}
public void ShowBoxMan(bool showBoxMan)
public void ShowBoxMan(bool enable)
{
if (m_context != null)
{
m_context.Root.GetComponent<SkinnedMeshRenderer>().enabled = showBoxMan;
}
m_boxMan.enabled = enable;
}
public static VRM10Motion LoadBvhFromText(string source, string path = "tmp.bvh")
public void Dispose()
{
var context = new UniHumanoid.BvhImporterContext();
context.Parse(path, source);
context.Load();
return new VRM10Motion(context);
}
public static VRM10Motion LoadBvhFromPath(string path)
{
return LoadBvhFromText(File.ReadAllText(path), path);
}
static IEnumerable<Transform> Traverse(Transform t)
{
yield return t;
foreach (Transform child in t)
{
foreach (var x in Traverse(child))
{
yield return x;
}
}
GameObject.Destroy(m_boxMan.gameObject);
}
static int? GetNodeIndex(UniGLTF.Extensions.VRMC_vrm_animation.Humanoid humanoid, HumanBodyBones bone)
{
switch (bone)
{
case HumanBodyBones.Hips: return humanoid.Hips?.Node;
case HumanBodyBones.LeftUpperLeg: return humanoid.LeftUpperLeg?.Node;
case HumanBodyBones.RightUpperLeg: return humanoid.RightUpperLeg?.Node;
case HumanBodyBones.LeftLowerLeg: return humanoid.LeftLowerLeg?.Node;
case HumanBodyBones.RightLowerLeg: return humanoid.RightLowerLeg?.Node;
case HumanBodyBones.LeftFoot: return humanoid.LeftFoot?.Node;
case HumanBodyBones.RightFoot: return humanoid.RightFoot?.Node;
case HumanBodyBones.Spine: return humanoid.Spine?.Node;
case HumanBodyBones.Chest: return humanoid.Chest?.Node;
case HumanBodyBones.Neck: return humanoid.Neck?.Node;
case HumanBodyBones.Head: return humanoid.Head?.Node;
case HumanBodyBones.LeftShoulder: return humanoid.LeftShoulder?.Node;
case HumanBodyBones.RightShoulder: return humanoid.RightShoulder?.Node;
case HumanBodyBones.LeftUpperArm: return humanoid.LeftUpperArm?.Node;
case HumanBodyBones.RightUpperArm: return humanoid.RightUpperArm?.Node;
case HumanBodyBones.LeftLowerArm: return humanoid.LeftLowerArm?.Node;
case HumanBodyBones.RightLowerArm: return humanoid.RightLowerArm?.Node;
case HumanBodyBones.LeftHand: return humanoid.LeftHand?.Node;
case HumanBodyBones.RightHand: return humanoid.RightHand?.Node;
case HumanBodyBones.LeftToes: return humanoid.LeftToes?.Node;
case HumanBodyBones.RightToes: return humanoid.RightToes?.Node;
// case HumanBodyBones.LeftEye: return humanoid.LeftEye?.Node;
// case HumanBodyBones.RightEye: return humanoid.RightEye?.Node;
case HumanBodyBones.Jaw: return humanoid.Jaw?.Node;
case HumanBodyBones.LeftThumbProximal: return humanoid.LeftThumbMetacarpal?.Node; // Metacarpal
case HumanBodyBones.LeftThumbIntermediate: return humanoid.LeftThumbProximal?.Node; // Proximal
case HumanBodyBones.LeftThumbDistal: return humanoid.LeftThumbDistal?.Node;
case HumanBodyBones.LeftIndexProximal: return humanoid.LeftIndexProximal?.Node;
case HumanBodyBones.LeftIndexIntermediate: return humanoid.LeftIndexIntermediate?.Node;
case HumanBodyBones.LeftIndexDistal: return humanoid.LeftIndexDistal?.Node;
case HumanBodyBones.LeftMiddleProximal: return humanoid.LeftMiddleProximal?.Node;
case HumanBodyBones.LeftMiddleIntermediate: return humanoid.LeftMiddleIntermediate?.Node;
case HumanBodyBones.LeftMiddleDistal: return humanoid.LeftMiddleDistal?.Node;
case HumanBodyBones.LeftRingProximal: return humanoid.LeftRingProximal?.Node;
case HumanBodyBones.LeftRingIntermediate: return humanoid.LeftRingIntermediate?.Node;
case HumanBodyBones.LeftRingDistal: return humanoid.LeftRingDistal?.Node;
case HumanBodyBones.LeftLittleProximal: return humanoid.LeftLittleProximal?.Node;
case HumanBodyBones.LeftLittleIntermediate: return humanoid.LeftLittleIntermediate?.Node;
case HumanBodyBones.LeftLittleDistal: return humanoid.LeftLittleDistal?.Node;
case HumanBodyBones.RightThumbProximal: return humanoid.RightThumbMetacarpal?.Node; // Metacarpal
case HumanBodyBones.RightThumbIntermediate: return humanoid.RightThumbProximal?.Node; // Proximal
case HumanBodyBones.RightThumbDistal: return humanoid.RightThumbDistal?.Node;
case HumanBodyBones.RightIndexProximal: return humanoid.RightIndexProximal?.Node;
case HumanBodyBones.RightIndexIntermediate: return humanoid.RightIndexIntermediate?.Node;
case HumanBodyBones.RightIndexDistal: return humanoid.RightIndexDistal?.Node;
case HumanBodyBones.RightMiddleProximal: return humanoid.RightMiddleProximal?.Node;
case HumanBodyBones.RightMiddleIntermediate: return humanoid.RightMiddleIntermediate?.Node;
case HumanBodyBones.RightMiddleDistal: return humanoid.RightMiddleDistal?.Node;
case HumanBodyBones.RightRingProximal: return humanoid.RightRingProximal?.Node;
case HumanBodyBones.RightRingIntermediate: return humanoid.RightRingIntermediate?.Node;
case HumanBodyBones.RightRingDistal: return humanoid.RightRingDistal?.Node;
case HumanBodyBones.RightLittleProximal: return humanoid.RightLittleProximal?.Node;
case HumanBodyBones.RightLittleIntermediate: return humanoid.RightLittleIntermediate?.Node;
case HumanBodyBones.RightLittleDistal: return humanoid.RightLittleDistal?.Node;
case HumanBodyBones.UpperChest: return humanoid.UpperChest?.Node;
case HumanBodyBones.Hips: return humanoid.HumanBones.Hips?.Node;
case HumanBodyBones.LeftUpperLeg: return humanoid.HumanBones.LeftUpperLeg?.Node;
case HumanBodyBones.RightUpperLeg: return humanoid.HumanBones.RightUpperLeg?.Node;
case HumanBodyBones.LeftLowerLeg: return humanoid.HumanBones.LeftLowerLeg?.Node;
case HumanBodyBones.RightLowerLeg: return humanoid.HumanBones.RightLowerLeg?.Node;
case HumanBodyBones.LeftFoot: return humanoid.HumanBones.LeftFoot?.Node;
case HumanBodyBones.RightFoot: return humanoid.HumanBones.RightFoot?.Node;
case HumanBodyBones.Spine: return humanoid.HumanBones.Spine?.Node;
case HumanBodyBones.Chest: return humanoid.HumanBones.Chest?.Node;
case HumanBodyBones.Neck: return humanoid.HumanBones.Neck?.Node;
case HumanBodyBones.Head: return humanoid.HumanBones.Head?.Node;
case HumanBodyBones.LeftShoulder: return humanoid.HumanBones.LeftShoulder?.Node;
case HumanBodyBones.RightShoulder: return humanoid.HumanBones.RightShoulder?.Node;
case HumanBodyBones.LeftUpperArm: return humanoid.HumanBones.LeftUpperArm?.Node;
case HumanBodyBones.RightUpperArm: return humanoid.HumanBones.RightUpperArm?.Node;
case HumanBodyBones.LeftLowerArm: return humanoid.HumanBones.LeftLowerArm?.Node;
case HumanBodyBones.RightLowerArm: return humanoid.HumanBones.RightLowerArm?.Node;
case HumanBodyBones.LeftHand: return humanoid.HumanBones.LeftHand?.Node;
case HumanBodyBones.RightHand: return humanoid.HumanBones.RightHand?.Node;
case HumanBodyBones.LeftToes: return humanoid.HumanBones.LeftToes?.Node;
case HumanBodyBones.RightToes: return humanoid.HumanBones.RightToes?.Node;
// case HumanBodyBones.LeftEye: return humanoid.HumanBones.LeftEye?.Node;
// case HumanBodyBones.RightEye: return humanoid.HumanBones.RightEye?.Node;
case HumanBodyBones.Jaw: return humanoid.HumanBones.Jaw?.Node;
case HumanBodyBones.LeftThumbProximal: return humanoid.HumanBones.LeftThumbMetacarpal?.Node; // Metacarpal
case HumanBodyBones.LeftThumbIntermediate: return humanoid.HumanBones.LeftThumbProximal?.Node; // Proximal
case HumanBodyBones.LeftThumbDistal: return humanoid.HumanBones.LeftThumbDistal?.Node;
case HumanBodyBones.LeftIndexProximal: return humanoid.HumanBones.LeftIndexProximal?.Node;
case HumanBodyBones.LeftIndexIntermediate: return humanoid.HumanBones.LeftIndexIntermediate?.Node;
case HumanBodyBones.LeftIndexDistal: return humanoid.HumanBones.LeftIndexDistal?.Node;
case HumanBodyBones.LeftMiddleProximal: return humanoid.HumanBones.LeftMiddleProximal?.Node;
case HumanBodyBones.LeftMiddleIntermediate: return humanoid.HumanBones.LeftMiddleIntermediate?.Node;
case HumanBodyBones.LeftMiddleDistal: return humanoid.HumanBones.LeftMiddleDistal?.Node;
case HumanBodyBones.LeftRingProximal: return humanoid.HumanBones.LeftRingProximal?.Node;
case HumanBodyBones.LeftRingIntermediate: return humanoid.HumanBones.LeftRingIntermediate?.Node;
case HumanBodyBones.LeftRingDistal: return humanoid.HumanBones.LeftRingDistal?.Node;
case HumanBodyBones.LeftLittleProximal: return humanoid.HumanBones.LeftLittleProximal?.Node;
case HumanBodyBones.LeftLittleIntermediate: return humanoid.HumanBones.LeftLittleIntermediate?.Node;
case HumanBodyBones.LeftLittleDistal: return humanoid.HumanBones.LeftLittleDistal?.Node;
case HumanBodyBones.RightThumbProximal: return humanoid.HumanBones.RightThumbMetacarpal?.Node; // Metacarpal
case HumanBodyBones.RightThumbIntermediate: return humanoid.HumanBones.RightThumbProximal?.Node; // Proximal
case HumanBodyBones.RightThumbDistal: return humanoid.HumanBones.RightThumbDistal?.Node;
case HumanBodyBones.RightIndexProximal: return humanoid.HumanBones.RightIndexProximal?.Node;
case HumanBodyBones.RightIndexIntermediate: return humanoid.HumanBones.RightIndexIntermediate?.Node;
case HumanBodyBones.RightIndexDistal: return humanoid.HumanBones.RightIndexDistal?.Node;
case HumanBodyBones.RightMiddleProximal: return humanoid.HumanBones.RightMiddleProximal?.Node;
case HumanBodyBones.RightMiddleIntermediate: return humanoid.HumanBones.RightMiddleIntermediate?.Node;
case HumanBodyBones.RightMiddleDistal: return humanoid.HumanBones.RightMiddleDistal?.Node;
case HumanBodyBones.RightRingProximal: return humanoid.HumanBones.RightRingProximal?.Node;
case HumanBodyBones.RightRingIntermediate: return humanoid.HumanBones.RightRingIntermediate?.Node;
case HumanBodyBones.RightRingDistal: return humanoid.HumanBones.RightRingDistal?.Node;
case HumanBodyBones.RightLittleProximal: return humanoid.HumanBones.RightLittleProximal?.Node;
case HumanBodyBones.RightLittleIntermediate: return humanoid.HumanBones.RightLittleIntermediate?.Node;
case HumanBodyBones.RightLittleDistal: return humanoid.HumanBones.RightLittleDistal?.Node;
case HumanBodyBones.UpperChest: return humanoid.HumanBones.UpperChest?.Node;
}
return default;
}
@ -159,7 +193,7 @@ namespace UniVRM10.VRM10Viewer
return humanMap;
}
public static async Task<VRM10Motion> LoadVrmAnimationFromPathAsync(string path)
public static async Task<VrmAnimation> LoadVrmAnimationFromPathAsync(string path)
{
//
// GetHumanoid Mapping
@ -175,7 +209,6 @@ namespace UniVRM10.VRM10Viewer
{
throw new ArgumentException("fail to load VRMC_vrm_animation");
}
var description = AvatarDescription.Create(humanMap);
//
@ -187,19 +220,7 @@ namespace UniVRM10.VRM10Viewer
var animator = instance.gameObject.AddComponent<Animator>();
animator.avatar = avatar;
// create SkinnedMesh for bone visualize
var renderer = SkeletonMeshUtility.CreateRenderer(animator);
var material = new Material(Shader.Find("Standard"));
renderer.sharedMaterial = material;
var mesh = renderer.sharedMesh;
mesh.name = "box-man";
var humanoid = instance.gameObject.AddComponent<Humanoid>();
humanoid.AssignBonesFromAnimator();
var motion = new VRM10Motion(instance);
var provider = new InitRotationPoseProvider(instance.transform, humanoid);
motion.ControlRig = (provider, provider);
return motion;
return new VrmAnimation(instance);
}
}
}

View File

@ -230,7 +230,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 339774397}
m_RootOrder: 12
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -763,7 +763,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 339774397}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -1219,10 +1219,11 @@ RectTransform:
- {fileID: 1621794411}
- {fileID: 2009818432}
- {fileID: 168425995}
- {fileID: 1557052150}
- {fileID: 224350191}
- {fileID: 1791103379}
- {fileID: 1311520909}
- {fileID: 1557052150}
- {fileID: 1767706907}
- {fileID: 974864191}
- {fileID: 597950322}
- {fileID: 935566651}
@ -1717,7 +1718,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 339774397}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -1797,7 +1798,7 @@ RectTransform:
- {fileID: 154330168}
- {fileID: 1954133885}
m_Father: {fileID: 339774397}
m_RootOrder: 14
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -1883,7 +1884,7 @@ RectTransform:
- {fileID: 2010083454}
- {fileID: 1081455630}
m_Father: {fileID: 339774397}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -1938,6 +1939,85 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_IsOn: 1
--- !u!1 &642985707
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 642985708}
- component: {fileID: 642985710}
- component: {fileID: 642985709}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &642985708
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 642985707}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1767706907}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 9, y: -0.5}
m_SizeDelta: {x: -28, y: -3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &642985709
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 642985707}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: ShowBoxMan
--- !u!222 &642985710
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 642985707}
m_CullTransparentMesh: 1
--- !u!1 &644517399
GameObject:
m_ObjectHideFlags: 0
@ -2401,6 +2481,82 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 806723448}
m_CullTransparentMesh: 0
--- !u!1 &826167455
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 826167456}
- component: {fileID: 826167458}
- component: {fileID: 826167457}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &826167456
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 826167455}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1987265555}
m_Father: {fileID: 1767706907}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 10, y: -10}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &826167457
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 826167455}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &826167458
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 826167455}
m_CullTransparentMesh: 1
--- !u!1 &827174940
GameObject:
m_ObjectHideFlags: 0
@ -3036,7 +3192,7 @@ RectTransform:
- {fileID: 175751363}
- {fileID: 1904789319}
m_Father: {fileID: 339774397}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -3073,7 +3229,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 339774397}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -4563,7 +4719,7 @@ RectTransform:
- {fileID: 1866921958}
- {fileID: 1767669911}
m_Father: {fileID: 339774397}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -4776,7 +4932,7 @@ RectTransform:
- {fileID: 452923209}
- {fileID: 2090837017}
m_Father: {fileID: 339774397}
m_RootOrder: 13
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -4940,7 +5096,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 339774397}
m_RootOrder: 3
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -5485,6 +5641,92 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1767669910}
m_CullTransparentMesh: 0
--- !u!1 &1767706906
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1767706907}
- component: {fileID: 1767706908}
m_Layer: 5
m_Name: ShowBoxMan
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1767706907
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1767706906}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 826167456}
- {fileID: 642985708}
m_Father: {fileID: 339774397}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1767706908
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1767706906}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 826167457}
toggleTransition: 1
graphic: {fileID: 1987265556}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls: []
m_IsOn: 1
--- !u!1 &1767738853
GameObject:
m_ObjectHideFlags: 0
@ -5516,7 +5758,7 @@ RectTransform:
- {fileID: 62367395}
- {fileID: 1037763549}
m_Father: {fileID: 339774397}
m_RootOrder: 11
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -5687,6 +5929,7 @@ MonoBehaviour:
m_version: {fileID: 1268276256}
m_openModel: {fileID: 2009818433}
m_openMotion: {fileID: 168425996}
m_showBoxMan: {fileID: 1767706908}
m_enableLipSync: {fileID: 935566650}
m_enableAutoBlink: {fileID: 634488422}
m_enableAutoExpression: {fileID: 1767738855}
@ -5743,7 +5986,7 @@ RectTransform:
- {fileID: 1166391799}
- {fileID: 1140410864}
m_Father: {fileID: 339774397}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -6274,6 +6517,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1963417398}
m_CullTransparentMesh: 0
--- !u!1 &1987265554
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1987265555}
- component: {fileID: 1987265557}
- component: {fileID: 1987265556}
m_Layer: 5
m_Name: Checkmark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1987265555
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1987265554}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 826167456}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1987265556
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1987265554}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1987265557
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1987265554}
m_CullTransparentMesh: 1
--- !u!1 &2009818431
GameObject:
m_ObjectHideFlags: 0

View File

@ -21,6 +21,9 @@ namespace UniVRM10.VRM10Viewer
[SerializeField]
Button m_openMotion = default;
[SerializeField]
Toggle m_showBoxMan = default;
[SerializeField]
Toggle m_enableLipSync = default;
@ -44,7 +47,19 @@ namespace UniVRM10.VRM10Viewer
GameObject Root = default;
VRM10Motion m_src = default;
IMotion m_src = default;
public IMotion Motion
{
get { return m_src; }
set
{
if (m_src != null)
{
m_src.Dispose();
}
m_src = value;
}
}
private CancellationTokenSource _cancellationTokenSource;
@ -206,6 +221,7 @@ namespace UniVRM10.VRM10Viewer
m_openMotion = buttons.First(x => x.name == "OpenMotion");
var toggles = GameObject.FindObjectsOfType<Toggle>();
m_showBoxMan = toggles.First(x => x.name == "ShowBoxMan");
m_enableLipSync = toggles.First(x => x.name == "EnableLipSync");
m_enableAutoBlink = toggles.First(x => x.name == "EnableAutoBlink");
m_enableAutoExpression = toggles.First(x => x.name == "EnableAutoExpression");
@ -235,7 +251,7 @@ namespace UniVRM10.VRM10Viewer
// load initial bvh
if (m_motion != null)
{
m_src = VRM10Motion.LoadBvhFromText(m_motion.text);
Motion = BvhMotion.LoadBvhFromText(m_motion.text);
}
string[] cmds = System.Environment.GetCommandLineArgs();
@ -257,13 +273,6 @@ namespace UniVRM10.VRM10Viewer
private void Update()
{
if (m_loaded != null)
{
m_loaded.EnableLipSyncValue = m_enableLipSync.isOn;
m_loaded.EnableBlinkValue = m_enableAutoBlink.isOn;
m_loaded.EnableAutoExpressionValue = m_enableAutoExpression.isOn;
}
if (Input.GetKeyDown(KeyCode.Tab))
{
if (Root != null) Root.SetActive(!Root.activeSelf);
@ -277,11 +286,20 @@ namespace UniVRM10.VRM10Viewer
}
}
if (Motion != null)
{
Motion.ShowBoxMan(m_showBoxMan.isOn);
}
if (m_loaded != null)
{
if (m_ui.IsBvhEnabled && m_src != null)
m_loaded.EnableLipSyncValue = m_enableLipSync.isOn;
m_loaded.EnableBlinkValue = m_enableAutoBlink.isOn;
m_loaded.EnableAutoExpressionValue = m_enableAutoExpression.isOn;
if (m_ui.IsBvhEnabled && Motion != null)
{
VRM10Retarget.Retarget(m_src.ControlRig, (m_loaded.ControlRig, m_loaded.ControlRig));
VRM10Retarget.Retarget(Motion.ControlRig, (m_loaded.ControlRig, m_loaded.ControlRig));
}
else
{
@ -331,12 +349,12 @@ namespace UniVRM10.VRM10Viewer
var ext = Path.GetExtension(path).ToLower();
if (ext == ".bvh")
{
m_src = VRM10Motion.LoadBvhFromPath(path);
Motion = BvhMotion.LoadBvhFromPath(path);
return;
}
// gltf, glb etc...
m_src = await VRM10Motion.LoadVrmAnimationFromPathAsync(path);
Motion = await VrmAnimation.LoadVrmAnimationFromPathAsync(path);
}
static IMaterialDescriptorGenerator GetVrmMaterialDescriptorGenerator(bool useUrp)

@ -1 +1 @@
Subproject commit 29195d5659d4af3d936204ac1bda4d784ce406a8
Subproject commit 0bcc3d4c56311ea36905049b10908a4eb60aa327