Skip to content

Communication between the CLI and OGrEE 3D

Cédric Vautrain edited this page Apr 8, 2022 · 16 revisions

OGrEE-3D is listening to the TCP port 5500.

All data are given with a simple json structure:

{
  "type" : "keyword",
  "data" : <serialized corresponding data structure>
}

The keyword will identify which type of data is given, in order to deserialize it with the corresponding structure. Data content will always be a serialized structure or the id of the concerned object.

Login

{
  "type" : "login",
  "data" : <serialized login data>
}
  • login data:
{
  "api_url" : "",
  "api_token : ""
}

These values will override/replace the ones given in config.json.

Load a template

Corresponding CLI command here.

{
  "type" : "load template",
  "data" : <JSON of the template>
}

JSON Template structure is described here.

Hierarchy commands

Select an object

Corresponding CLI command here

{
  "type" : "select",
  "data" : "id of the object to select"
}

Delete an object

Corresponding CLI command here

{
  "type" : "delete",
  "data" : "id of the object to delete"
}

Focus an object

Corresponding CLI command here

{
  "type" : "focus",
  "data" : "id of the object to focus"
}

Objects manipulation

Create commands

Corresponding CLI commands here

{
  "type" : "create",
  "data" : <JSON of the created object>
}

JSON object structure is described here.

Set commands

Corresponding CLI command here

Modify an object

{
  "type" : "modify",
  "data" : <JSON of the updated object>
}

JSON object structure is described here

Interact with an object

Some keywords are used only for interacting with OGrEE 3D

{
  "type" : "interact",
  "data" : <Serialiazed interact instruction>
}
  • Structure of an interact data:
{
  "id"    : "id of the targeted object",  //eg: "rackId"
  "param" : "The interaction keyword",    //eg: "slots"
  "value" : "The value to set"            //eg: "false"
}

Manipulate UI

Corresponding CLI commands here

{
  "type" : "ui",
  "data" : <Serialized UI instruction>
}

Possible UI instructions:

  • Delay
{
  "command" : "delay",
  "data"    : "time" 
}
  • Infos panel
{
  "command" : "infos",
  "data"    : "true|false" 
}
  • Debug panel
{
  "command" : "debug",
  "data"    : "true|false" 
}
  • Highlight an object
{
  "command" : "highlight",
  "data"    : "id of the object to highlight" 
}

Manipulate camera

Corresponding CLI commands here

{
  "type" : "camera",
  "data" : <Serialized camera instruction>
}

A camera instruction is:

{
  "command"  : "",
  "position" : <Serialized Vector3>,
  "rotation" : <Serialized Vector2>
}

Possible camera instructions:

  • Move
{
  "command"  : "move",
  "position" : "{"x":posX, "y":posY, "z":posZ}",
  "rotation" : "{"x":rotX, "y":rotY}"
}
  • Translate
{
  "command"  : "translate",
  "position" : "{"x":posX, "y":posY, "z":posZ}",
  "rotation" : "{"x":rotX, "y":rotY}"
}
  • Wait
{
  "command"  : "wait",
  "position" : null,
  "rotation" : "{"x":999, "y":time}"
}

This one is a "hack" to keep the same data structure as the other camera commands: rotation.x = 999 is used as a keycode for rotation.y = time to wait.

Clone this wiki locally