File Structure
The editor exports a unique .skf file, which can be unzipped to reveal:
armature.json- Armature data (bones, animations, etc)atlasX.png- Texture atlas(es), starting from 0editor.json- Editor-only datathumbnail.png- Armature preview imagereadme.md- Little note for runtime devs
This section will only cover the content in armature.json.
Table of Contents
armature.json
| Key | Type | Data |
|---|---|---|
| version | string | Editor version that exported this file |
| ik_root_ids | int[] | ID of every inverse kinematics root bone |
| baked_ik | bool | Was this file exported with baked IK frames? |
| img_format | string | Exported atlas image format (PNG, JPG, etc) |
| clear_color | Color | Exported clear color of atlas images |
| bones | Bone[] | Array of all bones |
| animations | Animation[] | Array of all animations |
| atlases | Atlas[] | Array of all atlases |
| styles | Style[] | Array of all styles |
Bones
| Key | Type | Data |
|---|---|---|
| id | uint | Bone ID |
| name | string | Name of bone |
| pos | Vec2 | Position of bone |
| rot | float | Rotation of bone |
| scale | Vec2 | Scale of bone |
| parent_id | int | Bone parent ID (-1 if none) |
| tex | string | Name of texture to use |
| zindex | int | Z-index of bone (higher index renders above lower) |
| hidden | bool | Whether this bone is hidden |
| tint | Vec4 | Color ting |
Initial Fields
During animation, armature bones need to be modified directly for smoothing to
work.
If a bone field is not being animated, it needs to go back to its initial state
with initial fields (starting with init_).
bool fields use int initial fields, as animations cannot store boolean
values (but can still represent them as 0 and 1)
The following is not an exhaustive list.
| Key | Type |
|---|---|
| init_pos | Vec2 |
| init_rot | float |
| init_scale | Vec2 |
| … | … |
Inverse Kinematics
Inverse kinematics is stored in the root (first) bone of each set of IK bones.
Other bones will only have ik_family_id, which is -1 by default.
| Key | Type | Data |
|---|---|---|
| ik_family_id | uint | The ID of family this bone is in (-1 by default) |
| ik_constraint | string | This family’s constraint |
| ik_mode | string | This family’s mode (FABRIK, Arc) |
| ik_target_id | uint | This set’s target bone ID |
| ik_bone_ids | uint[] | This set’s ID of bones |
Meshes
Only bones that explicitly contain a mesh, will have building data on it.
Bones with a regular texture rect will omit this, as the building data can be
inferred through Texture instead.
| Key | Type | Data |
|---|---|---|
| vertices | Vertex[] | Array of vertices |
| indices | uint[] | Each index is vertex ID. Every 3 IDs forms 1 triangle. |
| binds | Bind[] | Array of bone binds |
Vertex
A mesh is defined by its vertices, which describe how each point is positioned, as well as how the texture is mapped (UV).
| Key | Type | Data |
|---|---|---|
| id | uint | ID of vertex |
| pos | Vec2 | Position of vertex |
| uv | Vec2 | UV of vertex |
| init_pos | int | Helper for initial vertex position |
Bind
Meshes can have ‘binding’ bones to influence a set of vertices. These are the primary method of animating vertices.
| Key | Type | Data |
|---|---|---|
| id | int | ID of bind |
| is_path | bool | Should this bind behave like a path? |
| verts | BindVert[] | Array of vertex data associated to this bind |
BindVert
Vertices assigned to a bind.
| Key | Type | Data |
|---|---|---|
| id | uint | ID of vertex |
| weight | float | Weight assigned to this vertex |
Animations
| Key | Type | Data |
|---|---|---|
| id | string | ID of animation |
| name | string | Name of animation |
| fps | uint | Frames per second of animation |
| keyframes | see below | Data of all keyframes of animation |
Keyframes
Keyframes are defined by their element (what’s animated), as well as either
value or value_str (what value to animate element to)
Eg: element: PosX with value: 20 means ‘Position X = 20 at frame’
| Key | Type | Data |
|---|---|---|
| frame | uint | frame of keyframe |
| bone_id | uint | ID of bone that keyframe refers to |
| element | string | Element to be animated by this keyframe |
| value | float | Value to set element of bone to |
| value_str | string | String variant of value |
| start_handle | float | Handle to use for start of interpolation |
| end_handle | float | Handle to use for end of interpolation |
Atlases
Easily-accessible information about texture atlas files.
| Key | Type | Data |
|---|---|---|
| filename | string | Name of file for this atlas |
| size | Vec2 | Size of image (in pixels) |
Styles
Groups of textures.
| Key | Type | Data |
|---|---|---|
| id | uint | ID of style |
| name | string | Name of style |
| textures | Texture | Array of textures |
Textures
Note: Coordinates are in pixels.
| Key | Type | Data |
|---|---|---|
| name | string | Name of texture |
| offset | Vec2 | Top-left corner of texture in the atlas |
| size | Vec2 | Append to offset to get bottom-right corner of texture |
| atlas_idx | uint | Index of atlas that this texture lives in |
Cached Bones
An extra set of bones is recommended for optimization in the Construct()
generic function. This is essentially a clone of the original bone array.