Skip to content

GForceTextIndicator JSON

roosit edited this page Nov 15, 2026 · 1 revision

GForceTextIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the gforceText indicator in a project, in Mixel and in templates. For the user instructions on manually editing .vttp, see the page G-force Text JSON.

Two save modes

  • toJSON(false) — the real Mixel state: it contains the selected source and sensor, the current property values, and the size and position of the layer.
  • toJSON(true) — the template state: it contains the values that can be carried between projects. The sensor property (GForce) is saved in a template as an empty object {}: the source and sensor are picked when the indicator is added to a project.

Common indicator wrapper

The layer identifier is built from the plugin uid and the indicator name:

{
  "name": "com.velitask.plagin.official.gforceText",
  "data": {
    "properties": {}
  }
}
Part Value
plugin uid com.velitask.plagin.official
indicator name gforceText

Besides properties, data contains the common layer fields (visibility, transparency, nested layers, etc.); they do not belong to the indicator and are not described here. The indicator does not declare or save figures.

Real mixel state

In a real Mixel the size and position of the layer are stored next to properties. The exact shape of these State fields depends on the current runtime, so they are shown in abbreviated form. The values sourceId.value and sensorId.value are the numeric identifiers of the project source and sensor, given below as an example.

{
  "name": "com.velitask.plagin.official.gforceText",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "GForce": {"sourceId":{"value":1},"sensorId":{"value":4}},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "measurement": {"system":{"value":0},"format":{"value":0},"acceleration":{"value":0}},
      "textTemplate": {"template":"{total} {unit}","vars":{"total":"%.2f","longitudinal":"%.2f","lateral":"%.2f","peak":"%.2f","unit":"%s"}},
      "pause": {"value":0}
    }
  }
}

Template state

In a template, maket (here auto) is stored instead of the size and position, and the sensor property is empty. The property values match the default values in the code.

{
  "name": "com.velitask.plagin.official.gforceText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "GForce": {},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "measurement": {"system":{"value":0},"format":{"value":0},"acceleration":{"value":0}},
      "textTemplate": {"template":"{total} {unit}","vars":{"total":"%.2f","longitudinal":"%.2f","lateral":"%.2f","peak":"%.2f","unit":"%s"}},
      "pause": {"value":0}
    }
  }
}

Properties

JSON key Java property SDK type User meaning Default
GForce mGForce GForceAtomProperty The selected G-force sensor. An empty object in a template; sourceId/sensorId in a project.
font mText FontColorProperty Font and color of the text. name = Dialog, style = 0, size = 48, white color 255,255,255,255.
textAlign mTextAlign TextAlignProperty Position of the text inside the layer. 4 (CENTER).
measurement mUnits MeasurementProperty The measurement system, the unit caption format and the acceleration unit. system 0, format 0, acceleration 0 (g).
textTemplate mTemplate TextTemplateProperty String template with variables. {total} {unit}.
pause mPause EnumArrayProperty<GForcePause> Behavior in a recording pause. 0 (CENTER).

Formats of the nested values:

  • font — a flat object: name (string), style (number: 0 plain, 1 bold, 2 italic), size (integer, 1..999) and color (r, g, b, a, each 0..255).
  • textAlign — {"value": N}, N from 0 to 8 (the order is TOP_LEFT, TOP_CENTER, TOP_RIGHT, CENTER_LEFT, CENTER, CENTER_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT). A value outside the range is treated as CENTER_LEFT.
  • measurement — a composite property without a unit key. The child keys in order: system, format, acceleration.
Key Type Values
system {"value": int} 0 from global settings, 1 metric, 2 imperial, 3 nautical, 4 mixed
format {"value": int} 0 full, 1 normal, 2 short, 3 symbol
acceleration {"value": int} the ordinal of AccelerationSystem: 0 — G (g), 1 — MPS2 (m/s²)

While system is 0, acceleration is not used: the unit is taken from the general application settings. Choosing system from 1 to 3 substitutes the default unit (G); if the saved unit differs from it, the system automatically switches to "mixed" (4).

  • textTemplate — {"template": string, "vars": {name: format}}; the vars keys are variable names without braces.
  • pause — {"value": N}, N is the ordinal of the GForcePause constant: 0 CENTER (— is output instead of the text), 1 LAST (the values before the pause). See GForcePause.

Template variables (the order of the makeText(...) arguments: total, longitudinal, lateral, peak, unit):

Variable Default format What it shows
{total} %.2f The total G-force (the magnitude over the longitudinal, lateral and vertical components) in the chosen unit.
{longitudinal} %.2f The longitudinal component in the chosen unit; can be negative.
{lateral} %.2f The lateral component in the chosen unit; can be negative.
{peak} %.2f The largest G-force over the longitudinal and lateral components from the start of the recording to the current frame, in the chosen unit.
{unit} %s The caption of the acceleration unit (g or m/s²) in the chosen format.

The compact skin is the only one: it replaces template with {total}, vars stay the same.

Examples

A compact template with the components and the peak, bold red text pressed to the right and bottom:

{
  "name": "com.velitask.plagin.official.gforceText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "GForce": {},
      "font": {"name":"Dialog","style":1,"size":40,"color":{"r":255,"g":80,"b":80,"a":255}},
      "textAlign": {"value":8},
      "measurement": {"system":{"value":0},"format":{"value":0},"acceleration":{"value":0}},
      "textTemplate": {"template":"{total} {unit} ({longitudinal} / {lateral}), max {peak}","vars":{"total":"%.2f","longitudinal":"%.1f","lateral":"%.1f","peak":"%.1f","unit":"%s"}},
      "pause": {"value":1}
    }
  }
}

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without migrating saved projects.
  • Indicator.getName() (gforceText) must not be changed without a migration.
  • The property names (GForce, font, textAlign, measurement, textTemplate, pause) must not be renamed without a migration: loading goes by names.
  • The template variable names (total, longitudinal, lateral, peak, unit) are part of the vars format; renaming them breaks the saved formats.
  • The order of the GForcePause constants defines the saved pause index: the constants must not be reordered without a migration.
  • The order of the properties mostly affects the interface; renaming is more dangerous than reordering.

Clone this wiki locally