-
Notifications
You must be signed in to change notification settings - Fork 428
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
Skip mesh export when MeshExportInfo.CanExport is false #1117
Conversation
@@ -247,6 +247,11 @@ public virtual void Export(GltfExportSettings meshExportSettings, ITextureSerial | |||
MeshBlendShapeIndexMap = new Dictionary<Mesh, Dictionary<int, int>>(); | |||
foreach (var unityMesh in uniqueUnityMeshes) | |||
{ | |||
if (!unityMesh.CanExport) | |||
{ | |||
continue; |
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.
continue する前に何かログに出力したほうがいいかもしれない
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.
👍
{ | ||
continue; | ||
} | ||
|
||
var (gltfMesh, blendShapeIndexMap) = meshExportSettings.DivideVertexBuffer | ||
? MeshExporter_DividedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), meshExportSettings) |
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.
- mesh の vertexCount が 0 の場合、ArgumentOutOfRangeException が発生する
- mesh が null の場合、NullReferenceException が発生する
{ | ||
continue; | ||
} | ||
|
||
var (gltfMesh, blendShapeIndexMap) = meshExportSettings.DivideVertexBuffer | ||
? MeshExporter_DividedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), meshExportSettings) | ||
: MeshExporter_SharedVertexBuffer.Export(glTF, bufferIndex, unityMesh, Materials, m_settings.InverseAxis.Create(), meshExportSettings) |
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.
- mesh の vertexCount が 0 の場合処理が正常に終了するが、空の Mesh が Export されることになる
- mesh が null の場合、NullReferenceException が発生する
MeshExportInfo.CanExport
が false である場合、その mesh の export をスキップするなぜそうしたいか
MeshExportList.GetInfo
で集めたMeshExportInfo
の中には「Export 可能ではない Mesh の情報」(Mesh が null であったり、Mesh の vertexCount が 0 だったりするもの)が存在しうるMeshExportInfo
が渡された場合のハンドリングが抜けているMeshExporter_DividedVertexBuffer.Export
ならびにMeshExporter_SharedVertexBuffer.Export
は Mesh が null ではない、Mesh の vertexCount が 0 ではないこと前提の処理となっており、そうでないMeshExportInfo
が渡された場合 Exception が発生するMeshExportInfo.CanExport
を見ればよい)であるため、CanExport が false の場合対象の mesh の export をスキップしたい