Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 0
  • editor.json - Editor-only data
  • thumbnail.png - Armature preview image
  • readme.md - Little note for runtime devs

This section will only cover the content in armature.json.

Table of Contents

armature.json

KeyTypeData
versionstringEditor version that exported this file
ik_root_idsint[]ID of every inverse kinematics root bone
baked_ikboolWas this file exported with baked IK frames?
img_formatstringExported atlas image format (PNG, JPG, etc)
clear_colorColorExported clear color of atlas images
bonesBone[]Array of all bones
animationsAnimation[]Array of all animations
atlasesAtlas[]Array of all atlases
stylesStyle[]Array of all styles

Bones

KeyTypeData
iduintBone ID
namestringName of bone
posVec2Position of bone
rotfloatRotation of bone
scaleVec2Scale of bone
parent_idintBone parent ID (-1 if none)
texstringName of texture to use
zindexintZ-index of bone (higher index renders above lower)
hiddenboolWhether this bone is hidden
tintVec4Color 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.

KeyType
init_posVec2
init_rotfloat
init_scaleVec2

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.

KeyTypeData
ik_family_iduintThe ID of family this bone is in (-1 by default)
ik_constraintstringThis family’s constraint
ik_modestringThis family’s mode (FABRIK, Arc)
ik_target_iduintThis set’s target bone ID
ik_bone_idsuint[]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.

KeyTypeData
verticesVertex[]Array of vertices
indicesuint[]Each index is vertex ID. Every 3 IDs forms 1 triangle.
bindsBind[]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).

KeyTypeData
iduintID of vertex
posVec2Position of vertex
uvVec2UV of vertex
init_posintHelper for initial vertex position

Bind

Meshes can have ‘binding’ bones to influence a set of vertices. These are the primary method of animating vertices.

KeyTypeData
idintID of bind
is_pathboolShould this bind behave like a path?
vertsBindVert[]Array of vertex data associated to this bind

BindVert

Vertices assigned to a bind.

KeyTypeData
iduintID of vertex
weightfloatWeight assigned to this vertex

Animations

KeyTypeData
idstringID of animation
namestringName of animation
fpsuintFrames per second of animation
keyframessee belowData 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

KeyTypeData
frameuintframe of keyframe
bone_iduintID of bone that keyframe refers to
elementstringElement to be animated by this keyframe
valuefloatValue to set element of bone to
value_strstringString variant of value
start_handlefloatHandle to use for start of interpolation
end_handlefloatHandle to use for end of interpolation

Atlases

Easily-accessible information about texture atlas files.

KeyTypeData
filenamestringName of file for this atlas
sizeVec2Size of image (in pixels)

Styles

Groups of textures.

KeyTypeData
iduintID of style
namestringName of style
texturesTextureArray of textures

Textures

Note: Coordinates are in pixels.

KeyTypeData
namestringName of texture
offsetVec2Top-left corner of texture in the atlas
sizeVec2Append to offset to get bottom-right corner of texture
atlas_idxuintIndex 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.