Skip to content

Custom JSON Fixtures

Mark Slee edited this page Nov 25, 2020 · 18 revisions

Overview

Custom lighting fixtures that cannot be simply represented as a strip, arc, or grid can be defined in custom fixture files. These JSON-formatted files should be placed in the Fixtures folder with the .lxf file suffix.

Here is example syntax indicating all possible fields. Fields are described in greater detail below.

{
  "label": "Custom",

  "modelKeys": [ "custom", "another" ],

  "parameters": {
    "intParam": {
      "type": "int", "default": 0, "min": 0, "max": 100,
      "label": "Int Param",
      "description": "Example integer parameter"
    },
    "floatParam": {
      "type": "float", "default": 0.5,
      "label": "Float Param",
      "description": "Example float parameter"
    },
    "stringParam": {
      "type": "string", "default": "text",
      "label": "String Param",
      "description": "Example string parameter"
    },
    "boolParam": {
      "type": "boolean", "default": false,
      "label": "Bool Param",
      "description": "Example boolean parameter"
    }
  },

  "points": [
    { "x": 0, "y":0, "z": 0 }
  ],

  "strips": [
    {
      "x": 0, "y": 0, "z": 0, "numPoints": 40, "spacing": 10,
      "yaw": 45, "pitch": 45, "roll": 45
    },
    {
      "x": 0, "y": 0, "z": 0, "numPoints": 50, "spacing": 20,
      "direction": { "x": 1, "y": -1, "z": 0.5 }
    }
  ],

  "arcs": [
    {
      "x": 0, "y": 0, "z": 0,
      "mode": "center", "radius": 100, "degrees": 90,
      "yaw": 0, "pitch": 0, "roll": 0
    },
    {
      "x": 0, "y": 0, "z": 0,
      "mode": "origin", "radius": 100, "degrees": 90,
      "direction": { "x": 3, "y": 1, "z": -1 }
    },
    {
      "x": 0, "y": 0, "z": 0,
      "mode": "origin", "radius": 100, "degrees": 90,
      "normal": { "x": 3, "y": 1, "z": -1 }
    }
  ],

  "children": [
  ],

  "outputs": [
    {}
  ]
}

Top-Level

  • label - this optional field supplies a default label that will be displayed for any new instantiation of this fixture type

  • modelKeys - an optional array of string identifiers that can be used to query this type of fixture in the LXModel hierarchy.

  • modelKey - an optional single string identifier, same as modelKeys but one string value instead of an array

Parameters

Under the optional parameters field, variables can be defined. The parameters field must hold a dictionary. The keys are the names of parameters which can be later substituted. The UI will automatically display controls for modifying the values of these parameters, and their values can be used in variable substitutions for other values in the JSON file, or a child JSON file.

Fields

  • type: required, one of int,float,boolean,string
  • default: required, a default value for the parameter, must be of correct type
  • label: optional, a human-readable label for the parameter in the UI (if not supplied, the JSON key is used)
  • description: optional, a description of the functionality of this parameter that the UI will show on hover
  • min: optional, for integer parameters only, a minimum value
  • max: optional, for integer parameters only, a maximum value

Substitutions

The keys in this JSON dictionary can be referenced via the syntax "${varKey}", where varKey is the key for this parameter in the JSON dictionary. The substitution must appear inside a quote-encapsulated string. Keys must only be alphanumeric.

Basic mathematical operators +,-,*,/ are available to form simple expressions for integer and floating point values.

Geometry

Points

  • points