follow test

This commit is contained in:
Masataka SUMI 2021-05-27 15:35:45 +09:00
parent 86d1dc0db7
commit 157c7091f7
12 changed files with 19 additions and 15 deletions

View File

@ -56,7 +56,7 @@ namespace UniGLTF
s_foldTextures = EditorGUILayout.Foldout(s_foldTextures, "Remapped Textures");
if (s_foldTextures)
{
importer.DrawRemapGUI<UnityEngine.Texture>(textureSetImporter.GetTextureImportParamSet().GetTextureParamsDistinct().Select(x => x.SubAssetKey));
importer.DrawRemapGUI<UnityEngine.Texture>(textureSetImporter.GetTextureImportParamSet().GetEnumerable().Select(x => x.SubAssetKey));
}
if (GUILayout.Button("Clear"))

View File

@ -44,7 +44,7 @@ namespace UniGLTF
using (var loader = new ImporterContext(parser, extractedObjects))
{
// Configure TextureImporter to Extracted Textures.
foreach (var textureInfo in loader.TextureSetImporter.GetTextureImportParamSet().GetTextureParamsDistinct())
foreach (var textureInfo in loader.TextureSetImporter.GetTextureImportParamSet().GetEnumerable())
{
TextureImporterConfigurator.Configure(textureInfo, loader.TextureFactory.ExternalTextures);
}

View File

@ -80,7 +80,7 @@ namespace UniGLTF
Action<IEnumerable<UnityPath>> onCompleted = null)
{
var extractor = new TextureExtractor(parser, textureDirectory, subAssets);
foreach (var param in textureSetImporter.GetTextureImportParamSet().GetTextureParamsDistinct())
foreach (var param in textureSetImporter.GetTextureImportParamSet().GetEnumerable())
{
extractor.Extract(param.SubAssetKey, param);
}

View File

@ -183,7 +183,7 @@ namespace UniGLTF
public async Task LoadTexturesAsync()
{
var textures = TextureSetImporter.GetTextureImportParamSet().GetTextureParamsDistinct();
var textures = TextureSetImporter.GetTextureImportParamSet().GetEnumerable();
foreach (var param in textures)
{
var tex = await TextureFactory.GetTextureAsync(param);

View File

@ -136,7 +136,7 @@ namespace UniGLTF
}
// should unique
var gltfTextures = new GltfTextureSetImporter(parser).GetTextureParamsDistinct()
var gltfTextures = new GltfTextureSetImporter(parser).GetTextureImportParamSet().GetEnumerable()
.Select(x => x.SubAssetKey)
.ToArray();
var distinct = gltfTextures.Distinct().ToArray();

View File

@ -207,7 +207,7 @@ namespace UniGLTF
{
GLTF = TwoTexture(),
};
var items = new GltfTextureSetImporter(parser).GetTextureParamsDistinct().ToArray();
var items = new GltfTextureSetImporter(parser).GetTextureImportParamSet().GetEnumerable().ToArray();
Assert.AreEqual(2, items.Length);
}
@ -216,7 +216,7 @@ namespace UniGLTF
{
GLTF = TwoTextureOneUri(),
};
var items = new GltfTextureSetImporter(parser).GetTextureParamsDistinct().ToArray();
var items = new GltfTextureSetImporter(parser).GetTextureImportParamSet().GetEnumerable().ToArray();
Assert.AreEqual(1, items.Length);
}
@ -225,7 +225,7 @@ namespace UniGLTF
{
GLTF = TwoTextureOneImage(),
};
var items = new GltfTextureSetImporter(parser).GetTextureParamsDistinct().ToArray();
var items = new GltfTextureSetImporter(parser).GetTextureImportParamSet().GetEnumerable().ToArray();
Assert.AreEqual(1, items.Length);
}
@ -234,7 +234,7 @@ namespace UniGLTF
{
GLTF = CombineMetallicSmoothOcclusion(),
};
var items = new GltfTextureSetImporter(parser).GetTextureParamsDistinct().ToArray();
var items = new GltfTextureSetImporter(parser).GetTextureImportParamSet().GetEnumerable().ToArray();
Assert.AreEqual(1, items.Length);
}
}

View File

@ -96,7 +96,8 @@ namespace UniGLTF
// extractor
var extractor = new TextureExtractor(parser, UnityPath.FromUnityPath(""), context.TextureFactory.ConvertedTextures);
var m = context.TextureSetImporter.GetTextureParamsDistinct().FirstOrDefault(x => x.SubAssetKey.Name == "texture_1.standard");
var m = context.TextureSetImporter.GetTextureImportParamSet().GetEnumerable()
.FirstOrDefault(x => x.SubAssetKey.Name == "texture_1.standard");
Assert.Catch<NotImplementedException>(() => extractor.Extract(m.SubAssetKey, m));
}

View File

@ -84,7 +84,7 @@ namespace VRM
using (var context = new VRMImporterContext(parser, map))
{
var editor = new VRMEditorImporterContext(context, prefabPath);
foreach (var textureInfo in editor.TextureSetImporter.GetTextureParamsDistinct())
foreach (var textureInfo in editor.TextureSetImporter.GetTextureImportParamSet().GetEnumerable())
{
VRMShaders.TextureImporterConfigurator.Configure(textureInfo, context.TextureFactory.ExternalTextures);
}

View File

@ -59,7 +59,7 @@ namespace VRM
using (var context = new VRMImporterContext(parser, map))
{
var editor = new VRMEditorImporterContext(context, prefabPath);
foreach (var textureInfo in context.TextureSetImporter.GetTextureParamsDistinct())
foreach (var textureInfo in context.TextureSetImporter.GetTextureImportParamSet().GetEnumerable())
{
VRMShaders.TextureImporterConfigurator.Configure(textureInfo, context.TextureFactory.ExternalTextures);
}

View File

@ -72,7 +72,7 @@ namespace VRM
},
}
};
var items = new VRMTextureSetImporter(parser, vrm).GetTextureParamsDistinct().ToArray();
var items = new VRMTextureSetImporter(parser, vrm).GetTextureImportParamSet().GetEnumerable().ToArray();
Assert.AreEqual(1, items.Length);
}
}

View File

@ -101,7 +101,7 @@ namespace UniVRM10
using (var loader = new Vrm10Importer(parser, extractedObjects))
{
// settings TextureImporters
foreach (var textureInfo in loader.TextureSetImporter.GetTextureParamsDistinct())
foreach (var textureInfo in loader.TextureSetImporter.GetTextureImportParamSet().GetEnumerable())
{
VRMShaders.TextureImporterConfigurator.Configure(textureInfo, loader.TextureFactory.ExternalTextures);
}

View File

@ -2,6 +2,9 @@
namespace VRMShaders
{
/// <summary>
/// TextureImportParam の集合を Unique な集合にする。
/// </summary>
public sealed class TextureImportParamSet
{
private readonly Dictionary<SubAssetKey, TextureImportParam> _params = new Dictionary<SubAssetKey, TextureImportParam>();
@ -13,7 +16,7 @@ namespace VRMShaders
_params.Add(param.SubAssetKey, param);
}
public IEnumerable<TextureImportParam> GetTextureParamsDistinct()
public IEnumerable<TextureImportParam> GetEnumerable()
{
foreach (var kv in _params)
{