Skip to content

[FR] Refactor Keyframe Data Structure for Simplified Parsing and Consistency #242

@Dearliet

Description

@Dearliet

Current Format:

[
  {
    "channel": "rotation",
    "data_points": [
      {
        "x": "0",
        "y": "0",
        "z": "0"
      },
      {
        "x": "0",
        "y": "2",
        "z": "0"
      }
    ]
  },
  {
    "channel": "position",
    "data_points": [
      {
        "x": "0",
        "y": "12",
        "z": "3"
      }
    ]
  },
  {
    "channel": "command",
    "data_points": [
      {
        "commands": "/say hi",
        "execute_condition": "",
        "repeat": false,
        "repeat_frequency": 1
      }
    ]
  },
  {
    "channel": "variant",
    "data_points": [
      {
        "variant": "e9fff953-e4bc-3879-4376-cf29c402492d",
        "execute_condition": ""
      }
    ]
  }
]

Proposed Format:

[
  {
    "channel": "rotation",
    "data_point": {
      "x": ["0", "0"],
      "y": ["0", "2"],
      "z": ["0", "0"]
    }
  },
  {
    "channel": "position",
    "data_point": {
      "x": ["0", "0"],
      "y": ["12", "12"],
      "z": ["3", "3"]
    }
  },
  {
    "channel": "command",
    "data_point": {
      "commands": "/say hi",
      "execute_condition": "",
      "repeat": false,
      "repeat_frequency": 1
    }
  },
  {
    "channel": "variant",
    "data_point": {
      "variant": "e9fff953-e4bc-3879-4376-cf29c402492d",
      "execute_condition": ""
    }
  }
]
  • Simplifies the format by using a unified data_point object, making it clear and predictable across all keyframes
  • Using pairs for transform keyframes (pre and post values) avoids complexity in handling different numbers of data points, streamlining data processing

Further Simplified Alternative:

[
  {
    "channel": "rotation",
    "x": ["0", "0"],
    "y": ["0", "2"],
    "z": ["0", "0"]
  },
  {
    "channel": "position",
    "x": ["0", "0"],
    "y": ["12", "12"],
    "z": ["3", "3"]
  },
  {
    "channel": "command",
    "commands": "/say hi",
    "execute_condition": "",
    "repeat": false,
    "repeat_frequency": 1
  },
  {
    "channel": "variant",
    "variant": "e9fff953-e4bc-3879-4376-cf29c402492d",
    "execute_condition": ""
  }
]
  • By removing the data_point field and placing keyframe attributes directly under channel, the structure avoids redundant nesting, making it easier for developers to read and process

I personally recommend adopting the further simplified format. It is the easiest to parse and offers the clearest and most straightforward approach.

Metadata

Metadata

Assignees

Labels

✨ EnhancementNew feature or request❓ Needs More InfoThis Issue Needs More Info to be considered valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions