Skip to content

Commit

Permalink
Merge pull request #433 from ousttrue/exporter_use_jpg
Browse files Browse the repository at this point in the history
EditorExport時にアセットが見つかったTextureは、それを使う
  • Loading branch information
hiroj authored Jun 16, 2020
2 parents 348f4af + 8b4bae8 commit 7a7925d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Assets/VRM/UniGLTF/Scripts/IO/TextureExportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public int CopyAndGetIndex(Texture texture, RenderTextureReadWrite readWrite)
return -1;
}

#if UNITY_EDITOR
if (!string.IsNullOrEmpty(UnityEditor.AssetDatabase.GetAssetPath(texture)))
{
m_exportTextures[index] = texture;
return index;
}
#endif

// ToDo: may already exists
m_exportTextures[index] = TextureItem.CopyTexture(texture, readWrite, null);

Expand Down
10 changes: 9 additions & 1 deletion Assets/VRM/UniGLTF/Scripts/IO/TextureIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ static BytesWithMime GetBytesWithMime(Texture texture, glTFTextureTypes textureT
Bytes = System.IO.File.ReadAllBytes(path.FullPath),
Mime = "image/png",
};
}
}
if (path.Extension == ".jpg")
{
return new BytesWithMime
{
Bytes = System.IO.File.ReadAllBytes(path.FullPath),
Mime = "image/jpeg",
};
}
}
#endif

Expand Down

0 comments on commit 7a7925d

Please sign in to comment.