Skip to content

Instantly share code, notes, and snippets.

@Jickelsen
Last active October 18, 2017 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jickelsen/8943bfc32e2540cffaf701b87570edbe to your computer and use it in GitHub Desktop.
Save Jickelsen/8943bfc32e2540cffaf701b87570edbe to your computer and use it in GitHub Desktop.
ForgeJS schema for jdorn/json-editor. Try it at http://jeremydorn.com/json-editor/ Fields marked with a leading X will requires third party ForgeJS plugins that may not yet be available.
{
"type": "object",
"properties": {
"camera": {
"type": "object",
"properties": {
"fov": {
"type": "object",
"properties": {
"default": {
"type": "number",
"default": 90
},
"min": {
"type": "number",
"default": 50
},
"max": {
"type": "number",
"default": 120
}
}
}
}
},
"playlists": {
"type": "object",
"properties": {
"default": {
"type": "string"
},
"lists": {
"type": "array",
"items": {
"type": "object",
"headerTemplate": "{{self.uid}}",
"properties": {
"uid": {
"type": "string"
},
"name": {
"type": "string"
},
"default": {
"type": "string"
},
"tracks": {
"type": "array",
"items": {
"type": "string",
"watch": {
"tracks": "playlists.tracks"
},
"enumSource": [
{
"source": "tracks",
"value": "{{item.uid}}"
}
]
}
}
}
}
},
"tracks": {
"type": "array",
"items": {
"type": "object",
"headerTemplate": "{{self.uid}}",
"properties": {
"uid": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
},
"volume": {
"type": "object",
"properties": {
"default": {
"type": "number",
"default": 0.5
},
"max": {
"type": "number",
"default": 1
}
}
}
}
},
"markers": {
"type": "array",
"title": "X markers",
"items": {
"type": "object",
"headerTemplate": "{{self.uid}}",
"properties": {
"uid": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
},
"models": {
"type": "array",
"title": "X models",
"items": {
"type": "object",
"headerTemplate": "{{self.uid}}",
"properties": {
"uid": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
},
"actions": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"headerTemplate": "{{self.uid}}",
"properties": {
"uid": {
"type": "string"
},
"target": {
"type": "string",
"enum": [
"viewer.story",
"viewer.renderer.camera"
]
},
"method": {
"name": {
"type": "string",
"enum": [
"loadScene",
"lookAt"
]
}
},
"args": {
"type": "array",
"items": {
"type": "object",
"properties": {
"arg": {
"type": "string"
}
}
}
}
}
}
},
"story": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"name": {
"type": "string"
},
"slug": {
"type": "string"
},
"scenes": {
"type": "array",
"title": "Scenes",
"uniqueItems": true,
"items": {
"type": "object",
"headerTemplate": "{{self.uid}} - {{self.name}}",
"properties": {
"uid": {
"type": "string"
},
"name": {
"type": "string"
},
"ARView": {
"type": "boolean",
"title": "X ARView",
"format": "checkbox"
},
"locations": {
"type": "array",
"title": "X locations",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"locations": {
"type": "string",
"watch": {
"locations": "locations"
},
"enumSource": [
{
"source": "locations",
"value": "{{item.uid}}"
}
]
},
"actions": {
"type": "array",
"items": {
"type": "string",
"watch": {
"actions": "actions"
},
"enumSource": [
{
"source": "actions",
"value": "{{item.uid}}"
}
]
}
}
}
}
},
"markers": {
"type": "array",
"title": "X markers",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"marker-uid": {
"type": "string",
"watch": {
"markers": "markers"
},
"enumSource": [
{
"source": "markers",
"value": "{{item.uid}}"
}
]
},
"model": {
"type": "string",
"watch": {
"models": "models"
},
"enumSource": [
{
"source": "models",
"value": "{{item.uid}}"
}
]
},
"actions": {
"type": "array",
"items": {
"type": "string",
"watch": {
"actions": "actions"
},
"enumSource": [
{
"source": "actions",
"value": "{{item.uid}}"
}
]
}
}
}
}
},
"buttons": {
"type": "array",
"title": "X buttons",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"position": {
"type": "object",
"properties": {
"fromLeft": {
"type": "number",
"default": "0.5"
},
"fromTop": {
"type": "number",
"default": "0.7"
}
}
},
"size": {
"type": "object",
"properties": {
"width": {
"type": "number",
"default": "0.2"
},
"height": {
"type": "number",
"default": "0.2"
}
}
},
"actions": {
"type": "array",
"items": {
"type": "string",
"watch": {
"actions": "actions"
},
"enumSource": [
{
"source": "actions",
"value": "{{item.uid}}"
}
]
}
}
}
}
},
"playlists": {
"type": "object",
"properties": {
"default": {
"type": "string",
"watch": {
"playlists": "playlists"
},
"enumSource": [
{
"source": "playlists",
"value": "{{item.uid}}"
}
]
}
}
},
"delayedActions": {
"type": "array",
"title": "X delayed actions",
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"delay": {
"type": "number"
},
"action": {
"type": "string",
"watch": {
"actions": "actions"
},
"enumSource": [
{
"source": "actions",
"value": "{{item.uid}}"
}
]
}
}
}
},
"media": {
"type": "object",
"oneOf": [
{
"title": "Image",
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"image"
]
},
"source": {
"type": "object",
"properties": {
"format": {
"type": "string",
"enum": [
"equi",
"cube",
"flat"
]
},
"url": {
"type": "string"
}
}
}
}
},
{
"title": "Video",
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"video"
]
},
"source": {
"type": "object",
"properties": {
"format": {
"type": "string",
"enum": [
"equi",
"cube",
"flat"
]
},
"url": {
"type": "string"
}
}
}
}
}
]
},
"hotspots": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"facingCenter": {
"type": "boolean",
"format": "checkbox"
},
"transform": {
"type": "object",
"properties": {
"position": {
"type": "object",
"properties": {
"theta": {
"type": "number",
"default": 0
},
"phi": {
"type": "number",
"default": 90
},
"radius": {
"type": "number",
"default": 10
}
}
},
"rotation": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
}
}
},
"geometry": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"plane",
"model"
]
},
"model-uid": {
"type": "string"
}
}
},
"material": {
"type": "object",
"properties": {
"image": {
"type": "string"
},
"opacity": {
"type": "number",
"default": 1
}
}
},
"sound": {
"type": "object",
"properties": {
"uid": {
"type": "string"
},
"source": {
"type": "string"
},
"options": {
"type": "object",
"properties": {
"volume": {
"type": "object",
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
},
"loop": {
"type": "boolean",
"format": "checkbox"
},
"startTime": {
"type": "number"
},
"autoPlay": {
"type": "boolean",
"format": "checkbox"
},
"range": {
"type": "integer"
}
}
}
}
},
"events": {
"type": "object",
"properties": {
"onClick": {
"type": "array",
"items": {
"type": "string",
"watch": {
"actions": "actions"
},
"enumSource": [
{
"source": "actions",
"value": "{{item.uid}}"
}
]
}
}
}
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment