mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-20 09:47:56 -05:00
Updated UniGLTF
This commit is contained in:
parent
ba0c210c5b
commit
fa03db60d6
|
|
@ -15,7 +15,6 @@ namespace VRM
|
|||
public static glTF_VRM Export(GameObject go)
|
||||
{
|
||||
var gltf = new glTF_VRM();
|
||||
gltf.asset.generator = string.Format("UniVRM-{0}.{1}", VRMVersion.MAJOR, VRMVersion.MINOR);
|
||||
using (var exporter = new VRMExporter(gltf)
|
||||
{
|
||||
#if VRM_EXPORTER_USE_SPARSE
|
||||
|
|
@ -27,6 +26,7 @@ namespace VRM
|
|||
_Export(gltf, exporter, go);
|
||||
}
|
||||
|
||||
gltf.asset.generator = string.Format("UniVRM-{0}.{1}", VRMVersion.MAJOR, VRMVersion.MINOR);
|
||||
return gltf;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace VRM
|
|||
public glTF_VRM_SecondaryAnimation secondaryAnimation = new glTF_VRM_SecondaryAnimation();
|
||||
public List<glTF_VRM_Material> materialProperties = new List<glTF_VRM_Material>();
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => exporterVersion);
|
||||
f.KeyValue(() => meta);
|
||||
|
|
@ -34,7 +34,7 @@ namespace VRM
|
|||
{
|
||||
public glTF_VRM_extensions VRM = new glTF_VRM_extensions();
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => VRM);
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ namespace VRM
|
|||
"VRM",
|
||||
};
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => extensionsUsed);
|
||||
f.KeyValue(() => extensions);
|
||||
|
|
|
|||
|
|
@ -337,14 +337,14 @@ namespace VRM
|
|||
[Obsolete]
|
||||
private static void LoadHumanoidObsolete(VRMImporterContext context)
|
||||
{
|
||||
var parsed = context.Json.ParseAsJson()["extensions"]["VRM"];
|
||||
var parsed = UniJSON.JsonParser.Parse(context.Json)["extensions"]["VRM"];
|
||||
var skeleton = context.Root.transform.Traverse().Select(x => ToSkeletonBone(x)).ToArray();
|
||||
|
||||
var description = new HumanDescription
|
||||
{
|
||||
human = parsed[HUMANOID_KEY]["bones"]
|
||||
.ObjectItems
|
||||
.Select(x => new { x.Key, Index = x.Value.GetInt32() })
|
||||
.Select(x => new { x.Key, Index = x.Value.Value.GetInt32() })
|
||||
.Where(x => x.Index != -1)
|
||||
.Select(x =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace VRM
|
|||
public string propertyName;
|
||||
public float[] targetValue;
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => materialName);
|
||||
f.KeyValue(() => propertyName);
|
||||
|
|
@ -29,7 +29,7 @@ namespace VRM
|
|||
public int index = -1;
|
||||
public float weight = 0;
|
||||
|
||||
protected override void SerializeMembers(UniGLTF.JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => mesh);
|
||||
f.KeyValue(() => index);
|
||||
|
|
@ -90,7 +90,7 @@ namespace VRM
|
|||
public List<glTF_VRM_BlendShapeBind> binds = new List<glTF_VRM_BlendShapeBind>();
|
||||
public List<glTF_VRM_MaterialValueBind> materialValues = new List<glTF_VRM_MaterialValueBind>();
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => name);
|
||||
f.KeyValue(() => presetName);
|
||||
|
|
@ -133,7 +133,7 @@ namespace VRM
|
|||
blendShapeGroups.Add(group);
|
||||
}
|
||||
|
||||
protected override void SerializeMembers(UniGLTF.JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => blendShapeGroups);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace VRM
|
|||
public float xRange = 90.0f;
|
||||
public float yRange = 10.0f;
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
if (curve != null)
|
||||
{
|
||||
|
|
@ -48,7 +48,7 @@ namespace VRM
|
|||
|
||||
public string firstPersonFlag;
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => mesh);
|
||||
f.KeyValue(() => firstPersonFlag);
|
||||
|
|
@ -85,7 +85,7 @@ namespace VRM
|
|||
public glTF_VRM_DegreeMap lookAtVerticalDown = new glTF_VRM_DegreeMap();
|
||||
public glTF_VRM_DegreeMap lookAtVerticalUp = new glTF_VRM_DegreeMap();
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => firstPersonBone);
|
||||
f.KeyValue(() => firstPersonBoneOffset);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace VRM
|
|||
public Vector3 center;
|
||||
public float axisLength;
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.Key("bone"); f.Value((string)bone.ToString());
|
||||
f.KeyValue(() => node);
|
||||
|
|
@ -158,7 +158,7 @@ namespace VRM
|
|||
}
|
||||
}
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => humanBones);
|
||||
f.KeyValue(() => armStretch);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using UniGLTF;
|
||||
using UnityEngine;
|
||||
using UniJSON;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
|
@ -28,7 +29,7 @@ namespace VRM
|
|||
// "Queue",
|
||||
};
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => name);
|
||||
f.KeyValue(() => renderQueue);
|
||||
|
|
@ -77,17 +78,17 @@ namespace VRM
|
|||
|
||||
public static List<glTF_VRM_Material> Parse(string src)
|
||||
{
|
||||
var json = src.ParseAsJson()["extensions"]["VRM"]["materialProperties"];
|
||||
var json = UniJSON.JsonParser.Parse(src)["extensions"]["VRM"]["materialProperties"];
|
||||
var materials = json.DeserializeList<glTF_VRM_Material>();
|
||||
var jsonItems = json.ListItems.ToArray();
|
||||
var jsonItems = json.ArrayItems.ToArray();
|
||||
for(int i=0; i<materials.Count; ++i)
|
||||
{
|
||||
materials[i].floatProperties =
|
||||
jsonItems[i]["floatProperties"].ObjectItems.ToDictionary(x => x.Key, x => x.Value.GetSingle());
|
||||
jsonItems[i]["floatProperties"].ObjectItems.ToDictionary(x => x.Key, x => x.Value.Value.GetSingle());
|
||||
materials[i].vectorProperties =
|
||||
jsonItems[i]["vectorProperties"].ObjectItems.ToDictionary(x => x.Key, x =>
|
||||
{
|
||||
return x.Value.ListItems.Select(y => y.GetSingle()).ToArray();
|
||||
return x.Value.ArrayItems.Select(y => y.Value.GetSingle()).ToArray();
|
||||
});
|
||||
materials[i].keywordMap =
|
||||
jsonItems[i]["keywordMap"].ObjectItems.ToDictionary(x => x.Key, x => x.Value.GetBoolean());
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace VRM
|
|||
public string otherLicenseUrl;
|
||||
#endregion
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => version);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace VRM
|
|||
public Vector3 offset;
|
||||
public float radius;
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => offset);
|
||||
f.KeyValue(() => radius);
|
||||
|
|
@ -25,7 +25,7 @@ namespace VRM
|
|||
public int node;
|
||||
public List<glTF_VRM_SecondaryAnimationCollider> colliders = new List<glTF_VRM_SecondaryAnimationCollider>();
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => node);
|
||||
f.KeyValue(() => colliders);
|
||||
|
|
@ -46,7 +46,7 @@ namespace VRM
|
|||
public int[] bones = new int[] { };
|
||||
public int[] colliderGroups = new int[] { };
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => comment);
|
||||
f.KeyValue(() => stiffiness);
|
||||
|
|
@ -66,7 +66,7 @@ namespace VRM
|
|||
public List<glTF_VRM_SecondaryAnimationGroup> boneGroups = new List<glTF_VRM_SecondaryAnimationGroup>();
|
||||
public List<glTF_VRM_SecondaryAnimationColliderGroup> colliderGroups = new List<glTF_VRM_SecondaryAnimationColliderGroup>();
|
||||
|
||||
protected override void SerializeMembers(JsonFormatter f)
|
||||
protected override void SerializeMembers(GLTFJsonFormatter f)
|
||||
{
|
||||
f.KeyValue(() => boneGroups);
|
||||
f.KeyValue(() => colliderGroups);
|
||||
|
|
|
|||
2
UniGLTF
2
UniGLTF
|
|
@ -1 +1 @@
|
|||
Subproject commit 820d2658e149156b226f4137a0c94bfc93e3f305
|
||||
Subproject commit bd0899dd3e13e1fb06303a7d110cf682632bbc76
|
||||
Loading…
Reference in New Issue
Block a user