-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.0] thumbnail の名前が無い時に SubAssetKey を作るのに失敗するのを修正 #1193
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ namespace UniVRM10 | |
// }, | ||
public static class MigrationVrmMeta | ||
{ | ||
public static UniGLTF.Extensions.VRMC_vrm.Meta Migrate(JsonNode vrm0) | ||
public static UniGLTF.Extensions.VRMC_vrm.Meta Migrate(UniGLTF.glTF gltf, JsonNode vrm0) | ||
{ | ||
var meta = new UniGLTF.Extensions.VRMC_vrm.Meta | ||
{ | ||
|
@@ -54,7 +54,21 @@ public static UniGLTF.Extensions.VRMC_vrm.Meta Migrate(JsonNode vrm0) | |
case "author": meta.Authors = new List<string>() { kv.Value.GetString() }; break; | ||
case "contactInformation": meta.ContactInformation = kv.Value.GetString(); break; | ||
case "reference": meta.References = new List<string>() { kv.Value.GetString() }; break; | ||
case "texture": meta.ThumbnailImage = kv.Value.GetInt32(); break; | ||
case "texture": | ||
{ | ||
// vrm0x use texture. vrm10 use image | ||
var textureIndex = kv.Value.GetInt32(); | ||
if (textureIndex == -1) | ||
{ | ||
meta.ThumbnailImage = -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. サムネがない |
||
} | ||
else | ||
{ | ||
var gltfTexture = gltf.textures[textureIndex]; | ||
meta.ThumbnailImage = gltfTexture.source; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. サムネがある |
||
} | ||
break; | ||
} | ||
|
||
case "allowedUserName": | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using NUnit.Framework; | ||
|
||
namespace UniVRM10.Test | ||
{ | ||
public class LoadTests | ||
{ | ||
[Test] | ||
public void EmptyThumbnailName() | ||
{ | ||
Assert.True(Vrm10Data.TryParseOrMigrate(TestAsset.AliciaPath, true, out Vrm10Data vrm)); | ||
|
||
var index = vrm.VrmExtension.Meta.ThumbnailImage.Value; | ||
|
||
// empty thumbnail name | ||
vrm.Data.GLTF.images[index].name = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. image の name が null でもロードできる |
||
|
||
using (var loader = new Vrm10Importer(vrm)) | ||
{ | ||
loader.LoadAsync(new VRMShaders.ImmediateCaller()).Wait(); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.IO; | ||
using UnityEngine; | ||
|
||
namespace UniVRM10 | ||
{ | ||
public static class TestAsset | ||
{ | ||
public static string AliciaPath | ||
{ | ||
get | ||
{ | ||
return Path.GetFullPath(Application.dataPath + "/../Tests/Models/Alicia_vrm-0.51/AliciaSolid_vrm-0.51.vrm") | ||
.Replace("\\", "/"); | ||
} | ||
} | ||
|
||
public static VRM10Controller LoadAlicia() | ||
{ | ||
Vrm10Data.TryParseOrMigrate(AliciaPath, true, out Vrm10Data vrm); | ||
using (var loader = new Vrm10Importer(vrm)) | ||
{ | ||
var task = loader.LoadAsync(new VRMShaders.ImmediateCaller()); | ||
task.Wait(); | ||
|
||
var instance = task.Result; | ||
|
||
return instance.GetComponent<VRM10Controller>(); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FixNameUnique で thumbnail 用の名前を作り出す !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specified な実装だが、致し方なし