From 51b27ecc05c2a7903023de1bfc684d27c024286f Mon Sep 17 00:00:00 2001 From: MaxAndreassenRPM <121796327+MaxAndreassenRPM@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:36:04 +0100 Subject: [PATCH] fix: removes transforms check from validation rules for custom assets (#32) --- schemas/commonTransforms.schema.json | 29 +++++++++++++++++++ schemas/gltf-asset.schema.json | 43 ++++++++++++++++------------ 2 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 schemas/commonTransforms.schema.json diff --git a/schemas/commonTransforms.schema.json b/schemas/commonTransforms.schema.json new file mode 100644 index 0000000..2d07cf5 --- /dev/null +++ b/schemas/commonTransforms.schema.json @@ -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" + ] +} diff --git a/schemas/gltf-asset.schema.json b/schemas/gltf-asset.schema.json index 1011f06..f164e35 100644 --- a/schemas/gltf-asset.schema.json +++ b/schemas/gltf-asset.schema.json @@ -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", @@ -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": {