diff --git a/schema/tool/blender-xrfragments.awk b/schema/tool/blender-xrfragments.awk new file mode 100755 index 0000000..8e99210 --- /dev/null +++ b/schema/tool/blender-xrfragments.awk @@ -0,0 +1,21 @@ +#!/usr/bin/env -S awk -f +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( $1 == "SCHEMA" ) state=REPLACE + } +} diff --git a/schema/tool/blender-xrfragments.py b/schema/tool/blender-xrfragments.py new file mode 100644 index 0000000..9582b6c --- /dev/null +++ b/schema/tool/blender-xrfragments.py @@ -0,0 +1,812 @@ +import bpy +import json + +# --- 1. SCHEMA --- +SCHEMA = { + + "$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, + + "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": "