mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-28 05:44:48 -05:00
Merge pull request #1489 from ousttrue/fix10/fix_migration_meta_firstpersonboneoffset
[1.0] Migrationのエッジケースを修正
This commit is contained in:
@@ -52,7 +52,7 @@ namespace UniJSON
|
||||
return kv.Value;
|
||||
}
|
||||
}
|
||||
throw new KeyNotFoundException();
|
||||
throw new KeyNotFoundException(key.ToString());
|
||||
}
|
||||
|
||||
public static bool ContainsKey(this JsonNode self, Utf8String key)
|
||||
|
||||
@@ -21,5 +21,14 @@ namespace UniVRM10
|
||||
vrm0["z"].GetSingle(),
|
||||
};
|
||||
}
|
||||
|
||||
public static float[] Migrate(JsonNode parent, string key)
|
||||
{
|
||||
if (!parent.ContainsKey(key))
|
||||
{
|
||||
return new float[] { 0, 0, 0 };
|
||||
}
|
||||
return Migrate(parent[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UniGLTF;
|
||||
using UniGLTF.Extensions.VRMC_vrm;
|
||||
using UniJSON;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
@@ -39,14 +41,15 @@ namespace UniVRM10
|
||||
{
|
||||
// VRM1
|
||||
// firstPerson に同居していた LookAt は独立します
|
||||
var lookAt = new LookAt
|
||||
LookAt lookAt = default;
|
||||
lookAt = new LookAt
|
||||
{
|
||||
RangeMapHorizontalInner = MigrateLookAtRangeMap(vrm0["lookAtHorizontalInner"]),
|
||||
RangeMapHorizontalOuter = MigrateLookAtRangeMap(vrm0["lookAtHorizontalOuter"]),
|
||||
RangeMapVerticalDown = MigrateLookAtRangeMap(vrm0["lookAtVerticalDown"]),
|
||||
RangeMapVerticalUp = MigrateLookAtRangeMap(vrm0["lookAtVerticalUp"]),
|
||||
Type = MigrateLookAtType(vrm0["lookAtTypeName"]),
|
||||
OffsetFromHeadBone = MigrateVector3.Migrate(vrm0["firstPersonBoneOffset"]),
|
||||
OffsetFromHeadBone = MigrateVector3.Migrate(vrm0, "firstPersonBoneOffset"),
|
||||
};
|
||||
|
||||
var firstPerson = new FirstPerson
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UniJSON;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
@@ -152,7 +153,8 @@ namespace UniVRM10
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException(key);
|
||||
Debug.LogWarning($"[meta migration] unknown key: {key}");
|
||||
break;
|
||||
} // switch
|
||||
} // foreach
|
||||
|
||||
|
||||
Reference in New Issue
Block a user