diff --git a/schema/tool/blender-xrfragments.awk b/schema/tool/blender-xrfragments.awk index 8e99210..c5c07de 100755 --- a/schema/tool/blender-xrfragments.awk +++ b/schema/tool/blender-xrfragments.awk @@ -3,19 +3,21 @@ BEGIN { REPLACE=1 state=0 while( (getline < "./tool/blender-xrfragments.py") > 0 ){ - if( $1 ~ /^}/ && state == REPLACE ) state=0 - - print $0 - - if( state == REPLACE ){ - while( (getline < "./xrfragment-engine-prefixes.json") > 0 ){ - gsub("true","True",$0) - gsub("false","False",$0) - if( $1 == "\"$version\":" ) $2 = ($2+1)"," # bump version - if( $0 !~ /^[{}]/ ) print $0 - } + if( $0 ~ /^}/ && state == REPLACE ){ + print $0 + state=0 } - if( $1 == "SCHEMA" ) state=REPLACE + if( state == REPLACE ){ + gsub("True","true",$0) + gsub("False","false",$0) + if( $1 == "\"$version\":" ) $2 = ($2+1)"," # bump version + if( $0 !~ /^[{}]/ ) print $0 + } + + if( $1 == "SCHEMA" ){ + state=REPLACE + print "{" + } } } diff --git a/schema/tool/blender-xrfragments.py b/schema/tool/blender-xrfragments.py index 9582b6c..bfcdf2e 100644 --- a/schema/tool/blender-xrfragments.py +++ b/schema/tool/blender-xrfragments.py @@ -3,495 +3,487 @@ import json # --- 1. SCHEMA --- SCHEMA = { + "title": "XR Fragments", + "type": "object", + "$version": 2, + "flatten": True, + "$defs": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://xrfragment.org/schema/xrfragment-engine-prefixes.json", - "$version": 35, - "title": "XR Fragments Engine Prefixes", - "type": "object", - "flatten": True, + "xrf":{ + "title": "XR Fragments", + "description": "XR Fragments (level2) promotes embedding clickable hyperlinks\nin 3D files (via the href attribute).\nMake sure to check 'custom attributes' in your export dialog.", + "url": "https://xrfragment.org/#How%20it%20works", + "properties":{ + "_xrf-type": { "title": "type", "type": "string", "default":"xrf", "description": "needed for blender UI"}, + "href":{ + "type":"object.name", + "description": "teleport to / href" + } + } + }, - "properties": { - "engine": { - "type": "enum", - "enum": [ - ["NONE", "-- Select --", ""], - ["JANUSXR", "JanusXR", ""], - ["THREEJS", "Three.js", ""], - ["GODOT3", "Godot 3", ""], - ["GODOT4", "Godot 4", ""], - ["AFRAME", "AFRAME", ""], - ["BABYLON", "Babylon.js", ""], - ["PLAYCANVAS", "PlayCanvas", ""] - ], - "default": "NONE" - }, - "engine_settings": { - "oneOf": [ - {"engine_val": "JANUSXR", "$ref": "#/$defs/janus", "title": "JanusXR"}, - {"engine_val": "THREEJS", "$ref": "#/$defs/three", "title": "THREE.js"}, - {"engine_val": "GODOT3", "$ref": "#/$defs/godot3", "title": "Godot3 (beta)"}, - {"engine_val": "GODOT4", "$ref": "#/$defs/godot4", "title": "Godot4 (beta)"}, - {"engine_val": "AFRAME", "$ref": "#/$defs/aframe", "title": "AFRAME (beta)"}, - {"engine_val": "BABYLON", "$ref": "#/$defs/babylon", "title": "Babylon.js (beta)"}, - {"engine_val": "PLAYCANVAS", "$ref": "#/$defs/playcanvas", "title": "PlayCanvas (beta)"} - ] - } - }, - - "$defs": { - - - "three": { - "oneOf":[ - {"$ref": "#/$defs/three_material"}, - {"$ref": "#/$defs/three_object"} - ] - }, - - "aframe": { - "oneOf":[ - {"$ref": "#/$defs/three_material"}, - {"$ref": "#/$defs/three_object"} - ] - }, - - "three_material":{ - "title": "Material", - "description": "Material is THREE's abstract base material class", - "url": "https://threejs.org/docs/?q=material#Material", - "properties":{ - "_three-type": { "title": "type", "type": "string", "default":"material", "description": "needed for blender UI"}, - "-three-material.blending":{ - "type":"string", - "enum": ["THREE.NormalBlending", "THREE.NoBlending", "THREE.AdditiveBlending", "THREE.SubtractiveBlending", "THREE.MultiplyBlending" ] - }, - "-three-material.sides":{ - "type":"string", - "description": "culling: which sides to render (less increases fps)", - "enum": ["THREE.FrontSide","THREE.BackSide","THREE.DoubleSide"] - }, - "-three-material.map.offset.x+":{ - "type":"number", - "description": "texture scrolling speed", - "default": 0.005, - "minimum": 0.000001, - "maximum": 1 - }, - "-three-material.map.offset.yx+":{ - "type":"number", - "description": "texture scrolling speed", - "default": 0.005, - "minimum": 0.000001, - "maximum": 1 - } - } - }, - - "three_object":{ - "title": "Object3D", - "description": "Object3D is THREE's abstract base entity class", - "url": "https://threejs.org/docs/?q=Object3D#Object3D", - "properties":{ - "_three-type": { "title": "type", "type": "string", "default":"object3D", "description": "needed for blender UI"}, - "-three-renderOrder":{ - "type":"integer", - "minimum": 0, - "maximum": 100 - } - } - }, - - "janus": { - "oneOf":[ - {"$ref": "#/$defs/janus_image"}, - {"$ref": "#/$defs/janus_video"}, - {"$ref": "#/$defs/janus_link"} - ] - }, - - "janus_image": { - "description": "The tag allows displaying images via url, relative file, or data-uri's", - "url": "https://janusvr.com/docs/build/roomtag/index.html#Link", - "title": "", - "properties": { - "-janus-tag": {"type":"string", "default":"image"}, - "-janus-id": {"type":"object.name"}, - "-janus-col": {"$ref": "#/$defs/-janus-col"}, - "-janus-lighting": {"$ref": "#/$defs/-janus-lighting"}, - "-janus-fwd": {"$ref": "#/$defs/-janus-fwd"}, - "-janus-scale": {"$ref": "#/$defs/-janus-scale"}, - "-janus-rotation": {"$ref": "#/$defs/-janus-rotation" }, - "-janus-locked": {"$ref": "#/$defs/-janus-locked"}, - "-janus-draw-layer": {"$ref": "#/$defs/-janus-draw_layer"} - } - }, - "janus_video": { - "title": "