mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-12 13:34:39 -05:00
use SerializerTypes.Generated
This commit is contained in:
parent
2b9ddba32c
commit
e76e2f9671
|
|
@ -666,10 +666,7 @@ namespace UniGLTF
|
|||
|
||||
// import new version
|
||||
{
|
||||
var context = new ImporterContext
|
||||
{
|
||||
SerializerType = SerializerTypes.UniJSON
|
||||
};
|
||||
var context = new ImporterContext();
|
||||
context.ParseJson(json, new SimpleStorage(new ArraySegment<byte>(new byte[1024 * 1024])));
|
||||
//Debug.LogFormat("{0}", context.Json);
|
||||
context.Load();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
{
|
||||
public enum SerializerTypes
|
||||
{
|
||||
Generated, // generated, No AOT Problem
|
||||
JsonSerializable, // manual, Obsolete
|
||||
UniJSON, // reflection
|
||||
Generated, // generated, experimental for mobile
|
||||
UniJSON, // reflection, Obsolete
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,10 +427,10 @@ namespace UniGLTF
|
|||
|
||||
void Traverse(ListTreeNode<JsonValue> node, JsonFormatter f, Utf8String parentKey)
|
||||
{
|
||||
if(node.IsMap())
|
||||
if (node.IsMap())
|
||||
{
|
||||
f.BeginMap();
|
||||
foreach(var kv in node.ObjectItems())
|
||||
foreach (var kv in node.ObjectItems())
|
||||
{
|
||||
if (parentKey == s_extensions)
|
||||
{
|
||||
|
|
@ -444,10 +444,10 @@ namespace UniGLTF
|
|||
}
|
||||
f.EndMap();
|
||||
}
|
||||
else if(node.IsArray())
|
||||
else if (node.IsArray())
|
||||
{
|
||||
f.BeginList();
|
||||
foreach(var x in node.ArrayItems())
|
||||
foreach (var x in node.ArrayItems())
|
||||
{
|
||||
Traverse(x, f, default(Utf8String));
|
||||
}
|
||||
|
|
@ -468,11 +468,12 @@ namespace UniGLTF
|
|||
return f.ToString();
|
||||
}
|
||||
|
||||
public byte[] ToGlbBytes(SerializerTypes serializer = SerializerTypes.UniJSON)
|
||||
public byte[] ToGlbBytes(SerializerTypes serializer = SerializerTypes.Generated)
|
||||
{
|
||||
string json;
|
||||
if (serializer == SerializerTypes.UniJSON)
|
||||
{
|
||||
// Obsolete
|
||||
var c = new JsonSchemaValidationContext(this)
|
||||
{
|
||||
EnableDiagnosisForNotRequiredFields = true,
|
||||
|
|
@ -485,7 +486,7 @@ namespace UniGLTF
|
|||
f.GenSerialize(this);
|
||||
json = f.ToString().ParseAsJson().ToString(" ");
|
||||
}
|
||||
else if(serializer == SerializerTypes.JsonSerializable)
|
||||
else if (serializer == SerializerTypes.JsonSerializable)
|
||||
{
|
||||
// Obsolete
|
||||
json = ToJson();
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ namespace UniGLTF
|
|||
}
|
||||
}
|
||||
|
||||
private SerializerTypes _serializerType = SerializerTypes.UniJSON;
|
||||
private SerializerTypes _serializerType = SerializerTypes.Generated;
|
||||
public SerializerTypes SerializerType { get { return _serializerType; } set { _serializerType = value; } }
|
||||
|
||||
public virtual void ParseJson(string json, IStorage storage)
|
||||
|
|
@ -281,6 +281,7 @@ namespace UniGLTF
|
|||
|
||||
if (_serializerType == SerializerTypes.UniJSON)
|
||||
{
|
||||
// Obsolete
|
||||
Json.ParseAsJson().Deserialize(ref GLTF);
|
||||
}
|
||||
else if (_serializerType == SerializerTypes.Generated)
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ namespace VRM
|
|||
// vrm.extensions.VRM.meta.contactInformation = settings.ContactInformation;
|
||||
// vrm.extensions.VRM.meta.reference = settings.Reference;
|
||||
|
||||
var bytes = vrm.ToGlbBytes(settings.UseExperimentalExporter ? SerializerTypes.Generated : SerializerTypes.UniJSON);
|
||||
var bytes = vrm.ToGlbBytes();
|
||||
File.WriteAllBytes(path, bytes);
|
||||
Debug.LogFormat("Export elapsed {0}", sw.Elapsed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,6 @@ namespace VRM
|
|||
[Tooltip("Require only first time")]
|
||||
public bool PoseFreeze = true;
|
||||
|
||||
/// <summary>
|
||||
/// エクスポート時に新しいJsonSerializerを使う
|
||||
/// </summary>
|
||||
[Tooltip("Use new JSON serializer")]
|
||||
public bool UseExperimentalExporter = false;
|
||||
|
||||
/// <summary>
|
||||
/// BlendShapeのシリアライズにSparseAccessorを使う
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user