From 8457f06ebba4a7ea3f87014184008bda483ad604 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 27 Apr 2021 14:39:15 +0900 Subject: [PATCH] =?UTF-8?q?otherPermissionUrl=20=E3=81=A8=20otherLiceneseU?= =?UTF-8?q?rl=20=E3=81=AE=E4=B8=A1=E6=96=B9=E3=81=8C=E6=9C=89=E5=8A=B9?= =?UTF-8?q?=E3=81=A7=E5=86=85=E5=AE=B9=E3=81=8C=E7=95=B0=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=AF=E3=83=9E=E3=82=A4=E3=82=B0=E3=83=AC?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=A7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/Migration/MigrationVrmMeta.cs | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs b/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs index 073587d58..5ae09f173 100644 --- a/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs +++ b/Assets/VRM10/Runtime/Migration/MigrationVrmMeta.cs @@ -41,6 +41,9 @@ namespace UniVRM10 Modification = UniGLTF.Extensions.VRMC_vrm.ModificationType.prohibited, }; + string otherLicenseUrl = default; + string otherPermissionUrl = default; + foreach (var kv in vrm0.ObjectItems()) { var key = kv.Key.GetString(); @@ -124,18 +127,8 @@ namespace UniVRM10 } break; - case "otherPermissionUrl": - { - // TODO - // var url = kv.Value.GetString(); - // if (!String.IsNullOrWhiteSpace(url)) - // { - // throw new NotImplementedException("otherPermissionUrl not allowd"); - // } - } - break; - - case "otherLicenseUrl": meta.OtherLicenseUrl = kv.Value.GetString(); break; + case "otherPermissionUrl": otherPermissionUrl = kv.Value.GetString(); break; + case "otherLicenseUrl": otherLicenseUrl = kv.Value.GetString(); break; case "licenseName": { @@ -146,7 +139,38 @@ namespace UniVRM10 default: throw new NotImplementedException(key); + } // switch + } // foreach + + // + // OtherLicenseUrl migrate + // OtherPermissionURL removed + // + if (!string.IsNullOrEmpty(otherLicenseUrl) && !string.IsNullOrEmpty(otherPermissionUrl)) + { + if (otherLicenseUrl == otherPermissionUrl) + { + // OK + meta.OtherLicenseUrl = otherLicenseUrl; } + else + { + // different otherLicenseUrl & otherPermissionUrl + throw new MigrationException("otherPermissionUrl", "can not migrate"); + } + } + else if (!string.IsNullOrEmpty(otherLicenseUrl)) + { + meta.OtherLicenseUrl = otherLicenseUrl; + } + else if (!string.IsNullOrEmpty(otherPermissionUrl)) + { + // otherPermissionUrl => otherLicenseUrl + meta.OtherLicenseUrl = otherPermissionUrl; + } + else + { + // null } return meta;