Skip to content

Commit

Permalink
Suppress TANGENT warnings for .vrm files as specification indicates t…
Browse files Browse the repository at this point in the history
…hat these are expected to be generated upon import
mrxz committed Nov 13, 2024
1 parent 43faba6 commit 5b8fa0b
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/src/base/mesh.dart
Original file line number Diff line number Diff line change
@@ -526,7 +526,13 @@ class MeshPrimitive extends GltfProperty {
} else {
_material.markAsUsed();

if (!(hasNormal && hasTangent) && _material.needsTangent) {
// Note: VRM files are instructed to not have tangents
if (context.isVrm) {
if (hasTangent) {
context.addIssue(LinkError.vrm1MeshPrimitiveTangents,
name: MATERIAL);
}
} else if (!(hasNormal && hasTangent) && _material.needsTangent) {
context.addIssue(
_material.canProvideTangent
? LinkError.meshPrimitiveGeneratedTangentSpace
6 changes: 6 additions & 0 deletions lib/src/errors.dart
Original file line number Diff line number Diff line change
@@ -868,6 +868,12 @@ class LinkError extends IssueType {
'VRM1_MORPH_TARGET_NODE_WITHOUT_MESH',
(args) => 'No mesh on node ${args[0]} for morph target bind.');

static final LinkError vrm1MeshPrimitiveTangents = LinkError._(
'VRM1_MESH_PRIMITIVE_TANGENTS',
(args) =>
'Primitive has TANGENTS but VRM importers are expected to generate them.',
Severity.Warning);

LinkError._(String type, ErrorFunction message,
[Severity severity = Severity.Error])
: super(type, message, severity);

0 comments on commit 5b8fa0b

Please sign in to comment.