{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "https://schema.stfform.at/stfexp.armature.humanoid.schema.json",
	"title": "Humanoid mappings for armatures",
	"description": "Declares that this Armature is humanoid. Defines which bone corresponds to which body part.",
	"stfImplementations": {
		"blender": {
			"representingType": "STF Component on bpy.types.Armature",
			"link": "https://codeberg.org/stf_format/stf_blender/src/branch/master/stfblender/stf_resources/stfexp/stfexp_armature_humanoid.py"
		},
		"unity": {
			"representingType": "Avatar",
			"link": "https://codeberg.org/stf_format/stf_unity/src/branch/master/Runtime/Resources/Resources_STFEXP/STFEXP_Humanoid_Armature.cs",
			"extra_links": {
				"Default Processor": "https://codeberg.org/stf_format/stf_unity/src/branch/master/Runtime/Processors/Processors_STFEXP/STFEXP_Humanoid_Armature_Processor.cs"
			}
		}
	},
	"allOf": [{ "$ref": "https://schema.stfform.at/stf.schema.json#/$defs/stf_component_resource" }],
	"properties": {
		"type": {
			"const": "stfexp.armature.humanoid"
		},
		"locomotion_type": {
			"enum": ["planti", "digi"],
			"default": "planti"
		},
		"no_jaw": {
			"type": "boolean",
			"default": false,
			"description": "Ignore jaw mapping"
		},
		"settings": {
			"type": "object",
			"title": "Settings",
			"properties": {
				"arm_stretch": {
					"type": "number"
				},
				"upper_arm_twist": {
					"type": "number"
				},
				"lower_arm_twist": {
					"type": "number"
				},
				"leg_stretch": {
					"type": "number"
				},
				"upper_leg_twist": {
					"type": "number"
				},
				"lower_leg_twist": {
					"type": "number"
				},
				"feet_spacing": {
					"type": "number"
				},
				"use_translation": {
					"type": "boolean"
				}
			},
			"description": "Unity compatible settings for humanoid armatures.",
			"stfExpand": true
		},
		"mappings": {
			"type": "object",
			"title": "Humanoid bone mappings",
			"patternProperties": {
				".+" : {
					"type": "object",
					"title": "Bone Mapping",
					"properties": {
						"target": {
							"$ref": "https://schema.stfform.at/stf.schema.json#resource_id",
							"description": "Resource ID of the bone which corresponds to this bodypart."
						},
						"rotation_limits": {
							"type": "object",
							"title": "Bone Rotation Limits",
							"properties": {
								"primary": {
									"type": "array",
									"items": {
										"type": "number"
									},
									"minItems": 3,
									"maxItems": 3,
									"description": "3 values define the minimum, center and maximum rotation values for the primary axis."
								},
								"secondary": {
									"type": "array",
									"items": {
										"type": "number"
									},
									"minItems": 3,
									"maxItems": 3,
									"description": "3 values define the minimum, center and maximum rotation values for the secondary axis."
								},
								"twist": {
									"type": "array",
									"items": {
										"type": "number"
									},
									"minItems": 3,
									"maxItems": 3,
									"description": "3 values define the minimum, center and maximum rotation values for the twist axis."
								}
							},
							"stfExpand": true
						}
					},
					"required": [
						"target"
					]
				}
			},
			"propertyNames": {
				"enum": [
					"hip", "spine", "chest", "upper_chest", "neck", "head", "jaw", "eye.l", "eye.r",
					"shoulder.l", "upper_arm.l", "lower_arm.l", "wrist.l",
					"thumb_1.l", "thumb_2.l", "thumb_3.l", "index_1.l", "index_2.l", "index_3.l", "middle_1.l", "middle_2.l", "middle_3.l", "ring_1.l", "ring_2.l", "ring_3.l", "little_1.l", "little_2.l", "little_3.l",
					"shoulder.r", "upper_arm.r", "lower_arm.r", "wrist.r",
					"thumb_1.r", "thumb_2.r", "thumb_3.r", "index_1.r", "index_2.r", "index_3.r", "middle_1.r", "middle_2.r", "middle_3.r", "ring_1.r", "ring_2.r", "ring_3.r", "little_1.r", "little_2.r", "little_3.r",
					"upper_leg.l", "lower_leg.l", "foot.l", "toes.l",
					"upper_leg.r", "lower_leg.r", "foot.r", "toes.r"
				]
			},
			"stfExpand": true,
			"description": "Mapping of Humanoid bone names to bones in the armature.",
			"examples": [
				{
					"hip": {
						"target": "b6f82f9a-b78f-4778-a513-32f4e2342ed0"
					},
					"spine": {
						"target": "1e803b23-4d6e-4f3e-8194-976fe699a46c",
						"rotation_limits": {
							"primary": [-1.0471975803375244, 0.0, 1.0471975803375244],
							"secondary": [-1.0471975803375244, 0.0, 1.0471975803375244],
							"twist": [-1.5707963705062866, 0.0, 1.5707963705062866]
						}
					},
					"chest": {
						"target": "c0eac8b8-4644-40b0-a63a-e6366c70c0e4"
					}
				}
			]
		}
	},
	"required": [
		"type"
	],
	"additionalProperties": false
}