public static void OnGUI(ScriptedImporter importer, GltfParser parser, UniGLTF.Extensions.VRMC_vrm.VRMC_vrm vrm) { var hasExternal = importer.GetExternalObjectMap().Any(x => x.Value is VRM10MetaObject || x.Value is VRM10ExpressionAvatar || x.Value is VRM10Expression); using (new TmpGuiEnable(!hasExternal)) { if (GUILayout.Button("Extract Meta And Expressions ...")) { Extract(importer, parser); } } // meta importer.DrawRemapGUI <VRM10MetaObject>(new SubAssetKey[] { VRM10MetaObject.SubAssetKey }); // expression avatar importer.DrawRemapGUI <VRM10ExpressionAvatar>(new SubAssetKey[] { VRM10ExpressionAvatar.SubAssetKey }); // expressions importer.DrawRemapGUI <VRM10Expression>(vrm.Expressions.Select(x => CreateKey(x).SubAssetKey)); if (GUILayout.Button("Clear")) { importer.ClearExternalObjects <VRM10MetaObject>(); importer.ClearExternalObjects <VRM10ExpressionAvatar>(); importer.ClearExternalObjects <VRM10Expression>(); } }
public static void OnGUI(ScriptedImporter importer, GltfParser parser, EnumerateAllTexturesDistinctFunc enumTextures) { var hasExternal = importer.GetExternalObjectMap().Any(x => x.Value is Material || x.Value is Texture2D); using (new TmpGuiEnable(!hasExternal)) { if (GUILayout.Button("Extract Materials And Textures ...")) { ExtractMaterialsAndTextures(importer, parser, enumTextures); } } // // Draw ExternalObjectMap // s_foldMaterials = EditorGUILayout.Foldout(s_foldMaterials, "Remapped Materials"); if (s_foldMaterials) { importer.DrawRemapGUI <UnityEngine.Material>(parser.GLTF.materials.Select(x => x.name)); } s_foldTextures = EditorGUILayout.Foldout(s_foldTextures, "Remapped Textures"); if (s_foldTextures) { var names = enumTextures(parser) .Select(x => { if (x.TextureType != TextureImportTypes.StandardMap && !string.IsNullOrEmpty(x.Uri)) { // GLTF の 無変換テクスチャーをスキップする return(null); } switch (x.TextureType) { case TextureImportTypes.NormalMap: return(x.GltfName); default: return(x.ConvertedName); } }) .Where(x => !string.IsNullOrEmpty(x)) ; importer.DrawRemapGUI <UnityEngine.Texture2D>(names); } if (GUILayout.Button("Clear")) { importer.ClearExternalObjects <UnityEngine.Material>(); importer.ClearExternalObjects <UnityEngine.Texture2D>(); } }
public static void OnGUI(ScriptedImporter importer, GltfParser parser, EnumerateAllTexturesDistinctFunc enumTextures) { var hasExternal = importer.GetExternalObjectMap().Any(x => x.Value is Material || x.Value is Texture2D); using (new TmpGuiEnable(!hasExternal)) { if (GUILayout.Button("Extract Materials And Textures ...")) { ExtractMaterialsAndTextures(importer, parser, enumTextures); } } // // Draw ExternalObjectMap // s_foldMaterials = EditorGUILayout.Foldout(s_foldMaterials, "Remapped Materials"); if (s_foldMaterials) { importer.DrawRemapGUI <UnityEngine.Material>(parser.GLTF.materials.Select(x => new SubAssetKey(typeof(Material), x.name))); } s_foldTextures = EditorGUILayout.Foldout(s_foldTextures, "Remapped Textures"); if (s_foldTextures) { importer.DrawRemapGUI <UnityEngine.Texture2D>(enumTextures(parser) .Where(x => { var(key, param) = x; if ((param.TextureType == TextureImportTypes.sRGB || param.TextureType == TextureImportTypes.NormalMap) && !string.IsNullOrEmpty(param.Uri)) { // GLTF の 無変換テクスチャーをスキップする return(false); } return(true); }) .Select(x => x.Key) ); } if (GUILayout.Button("Clear")) { importer.ClearExternalObjects <UnityEngine.Material>(); importer.ClearExternalObjects <UnityEngine.Texture2D>(); } }