Skip to content

Commit

Permalink
fix: removes transforms check from validation rules for custom assets (
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxAndreassenRPM authored Sep 27, 2024
1 parent 4b81a96 commit 51b27ec
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 18 deletions.
29 changes: 29 additions & 0 deletions schemas/commonTransforms.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "commonTransforms.schema.json",
"title": "Common Transform Validation Rules",
"description": "Validation schema for common properties of transforms.",
"type": "object",
"properties": {
"transforms": {
"description": "The transforms of the objects (meshes & skeleton root).",
"type": "object",
"additionalProperties": {
"type": "array",
"minItems": 16,
"maxItems": 16,
"items": {
"type": "number"
},
"const": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
"errorMessage": {
"const": "Transforms for ${0#} must be neutral (identity matrix: zero translation or rotation, scale of 1). Found ${0}.",
"_": "Transforms for ${0#} must be an array of 16 numbers (flattened 4x4 identity matrix). Found ${0/length} numbers."
}
}
}
},
"required": [
"transforms"
]
}
43 changes: 25 additions & 18 deletions schemas/gltf-asset.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@
"type": "Asset type should be a string."
}
},
"transforms": {
"description": "The transforms of the objects (meshes & skeleton root).",
"type": "object",
"additionalProperties": {
"type": "array",
"minItems": 16,
"maxItems": 16,
"items": {
"type": "number"
},
"const": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
"errorMessage": {
"const": "Transforms for ${0#} must be neutral (identity matrix: zero translation or rotation, scale of 1). Found ${0}.",
"_": "Transforms for ${0#} must be an array of 16 numbers (flattened 4x4 identity matrix). Found ${0/length} numbers."
}
}
},
"gltfErrors": {
"description": "The errors encountered during glTF validation.",
"type": "array",
Expand All @@ -42,9 +25,33 @@
}
}
},
"required": ["transforms", "gltfErrors"],
"required": ["gltfErrors"],
"$comment": "Below are the asset type specific schemas defined. Some asset share a material definition, but differ in the number of supported textures.",
"allOf": [
{
"if": {
"properties": {
"assetType": {
"enum": [
"outfit",
"beard",
"bottom",
"facewear",
"footwear",
"glasses",
"hair",
"headwear",
"costume",
"shirt",
"top"
]
}
}
},
"then": {
"allOf": [{ "$ref": "commonTransforms.schema.json" }]
}
},
{
"if": {
"not": {
Expand Down

0 comments on commit 51b27ec

Please sign in to comment.