Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

### New Features

* Added new `NODE_SKINNED_MESH_PARENT_TRANSFORMS` validation warning.

### Changes

* Changed `NODE_SKINNED_MESH_NON_ROOT` default severity to Information.

## 2.0.0-dev.3.10

### New Features
Expand Down
3 changes: 2 additions & 1 deletion ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
|NODE_MATRIX_NON_TRS|Matrix must be decomposable to TRS.|Error|
|NODE_MATRIX_TRS|A node can have either a matrix or any combination of translation/rotation/scale (TRS) properties.|Error|
|NODE_SKINNED_MESH_LOCAL_TRANSFORMS|Local transforms will not affect a skinned mesh.|Warning|
|NODE_SKINNED_MESH_NON_ROOT|Node with a skinned mesh is not root. Parent transforms will not affect a skinned mesh.|Warning|
|NODE_SKINNED_MESH_NON_ROOT|Node with a skinned mesh is not root. Parent transforms will not affect a skinned mesh.|Information|
|NODE_SKINNED_MESH_PARENT_TRANSFORMS|Node with a skinned mesh has parent nodes with transforms. Parent transforms will not affect a skinned mesh.|Warning|
|NODE_SKIN_NO_SCENE|A node with a skinned mesh is used in a scene that does not contain joint nodes.|Error|
|NON_OBJECT_EXTRAS|Prefer JSON Objects for extras.|Information|
|NON_RELATIVE_URI|Non-relative URI found: '`%1`'.|Warning|
Expand Down
16 changes: 12 additions & 4 deletions lib/src/base/gltf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,22 @@ class Gltf extends GltfProperty {

// Node has a skinned mesh, check hierarchy and scenes
if (node.skin != null) {
if (node.parent != null) {
context.addIssue(SemanticError.nodeSkinnedMeshNonRoot, index: i);
}

if (node.hasTransform) {
context.addIssue(SemanticError.nodeSkinnedMeshLocalTransforms,
index: i);
}
if (node.parent != null) {
var parent = node.parent;
while (parent != null) {
if (parent.hasTransform) {
context.addIssue(SemanticError.nodeSkinnedMeshParentTransforms,
index: i);
break;
}
parent = parent.parent;
}
context.addIssue(SemanticError.nodeSkinnedMeshNonRoot, index: i);
}

final topCommonRoot = node.skin.commonRoots
.firstWhere((root) => root.parent == null, orElse: () => null);
Expand Down
18 changes: 12 additions & 6 deletions lib/src/errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -441,17 +441,23 @@ class SemanticError extends IssueType {
static final SemanticError nodeEmpty = SemanticError._(
'NODE_EMPTY', (args) => 'Empty node encountered.', Severity.Information);

static final SemanticError nodeSkinnedMeshNonRoot = SemanticError._(
'NODE_SKINNED_MESH_NON_ROOT',
(args) => 'Node with a skinned mesh is not root. '
'Parent transforms will not affect a skinned mesh.',
Severity.Warning);

static final SemanticError nodeSkinnedMeshLocalTransforms = SemanticError._(
'NODE_SKINNED_MESH_LOCAL_TRANSFORMS',
(args) => 'Local transforms will not affect a skinned mesh.',
Severity.Warning);

static final SemanticError nodeSkinnedMeshParentTransforms = SemanticError._(
'NODE_SKINNED_MESH_PARENT_TRANSFORMS',
(args) => 'Node with a skinned mesh has parent nodes with transforms. '
'Parent transforms will not affect a skinned mesh.',
Severity.Warning);

static final SemanticError nodeSkinnedMeshNonRoot = SemanticError._(
'NODE_SKINNED_MESH_NON_ROOT',
(args) => 'Node with a skinned mesh is not root. '
'Parent transforms will not affect a skinned mesh.',
Severity.Information);

static final SemanticError nodeSkinNoScene = SemanticError._(
'NODE_SKIN_NO_SCENE',
(args) => 'A node with a skinned mesh is used in a scene that does not '
Expand Down
12 changes: 9 additions & 3 deletions test/base/data/skin/ignored_parent_transform.gltf.report.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
"issues": {
"numErrors": 0,
"numWarnings": 1,
"numInfos": 1,
"numInfos": 2,
"numHints": 0,
"messages": [
{
"code": "NODE_SKINNED_MESH_PARENT_TRANSFORMS",
"message": "Node with a skinned mesh has parent nodes with transforms. Parent transforms will not affect a skinned mesh.",
"severity": 1,
"pointer": "/nodes/2"
},
{
"code": "NODE_SKINNED_MESH_NON_ROOT",
"message": "Node with a skinned mesh is not root. Parent transforms will not affect a skinned mesh.",
"severity": 1,
"severity": 2,
"pointer": "/nodes/2"
},
{
Expand All @@ -38,4 +44,4 @@
"maxInfluences": 4,
"maxAttributes": 3
}
}
}