mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-06-13 11:21:24 -05:00
conflict
This commit is contained in:
parent
20af5606a0
commit
5a86d036bf
|
|
@ -226,6 +226,18 @@ namespace UniVRM10
|
|||
await LoadConstraintAsync(awaitCaller, controller);
|
||||
}
|
||||
|
||||
static ExpressionKey Key(UniGLTF.Extensions.VRMC_vrm.Expression e)
|
||||
{
|
||||
if (e.Preset == UniGLTF.Extensions.VRMC_vrm.ExpressionPreset.custom)
|
||||
{
|
||||
return ExpressionKey.CreateCustom(e.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ExpressionKey.CreateFromPreset(e.Preset);
|
||||
}
|
||||
}
|
||||
|
||||
async Task LoadVrmAsync(IAwaitCaller awaitCaller, VRM10Controller controller, UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm)
|
||||
{
|
||||
// meta
|
||||
|
|
@ -281,7 +293,7 @@ namespace UniVRM10
|
|||
var clip = ScriptableObject.CreateInstance<UniVRM10.VRM10Expression>();
|
||||
clip.Preset = expression.Preset;
|
||||
clip.ExpressionName = expression.Name;
|
||||
clip.name = expression.ExtractName();
|
||||
clip.name = Key(expression).ExtractKey;
|
||||
clip.IsBinary = expression.IsBinary.GetValueOrDefault();
|
||||
clip.OverrideBlink = expression.OverrideBlink;
|
||||
clip.OverrideLookAt = expression.OverrideLookAt;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
using System;
|
||||
// using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniGLTF;
|
||||
using UniGLTF.ShaderPropExporter;
|
||||
// using UniGLTF.ShaderPropExporter;
|
||||
using UnityEngine;
|
||||
using VRMShaders;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,12 +14,17 @@ namespace UniVRM10
|
|||
{
|
||||
var glb = UniGLTF.Glb.Parse(src);
|
||||
var json = glb.Json.Bytes.ParseAsJson();
|
||||
return Migrate(json, glb.Binary.Bytes);
|
||||
}
|
||||
|
||||
public static byte[] Migrate(JsonNode json, ArraySegment<byte> bin)
|
||||
{
|
||||
var gltf = UniGLTF.GltfDeserializer.Deserialize(json);
|
||||
|
||||
// attach glb bin to buffer
|
||||
foreach (var buffer in gltf.buffers)
|
||||
{
|
||||
buffer.OpenStorage(new UniGLTF.SimpleStorage(glb.Binary.Bytes));
|
||||
buffer.OpenStorage(new UniGLTF.SimpleStorage(bin));
|
||||
}
|
||||
|
||||
// https://github.com/vrm-c/vrm-specification/issues/205
|
||||
|
|
@ -71,7 +76,8 @@ namespace UniVRM10
|
|||
UniGLTF.GltfSerializer.Serialize(f, gltf);
|
||||
vrm1Json = f.GetStoreBytes();
|
||||
}
|
||||
return UniGLTF.Glb.Create(vrm1Json, glb.Binary.Bytes).ToBytes();
|
||||
// JSON 部分だけが改変されて、BIN はそのまま
|
||||
return UniGLTF.Glb.Create(vrm1Json, bin).ToBytes();
|
||||
}
|
||||
|
||||
public static void Check(JsonNode vrm0, UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user