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

KeyTypeDefaultDescription
versionstring""Editor version that exported this file
ik_root_idsint[][]ID of every inverse kinematics root bone
baked_ikboolfalseWas this file exported with baked IK frames?
img_formatstring"PNG"Exported atlas image format (PNG, JPG, etc)
clear_colorColor1(0, 0, 0, 0)Exported 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

KeyTypeDefaultDescription
iduint0Bone ID
namestring""Name of bone
posVec2(0, 0)Position of bone
rotfloat0Rotation of bone
scaleVec2(1, 1)Scale of bone
parent_idint-1Bone parent ID (-1 if none)
texstring""Name of texture to use
zindexint0Z-index of bone (higher index renders above lower)
hiddenboolfalseWhether this bone is hidden
tintColor1(255, 255, 255, 255)Color tint

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.

KeyTypeDefault
init_posVec2bone.pos
init_rotfloatbone.rot
init_scaleVec2bone.scale

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.

KeyTypeDefaultDescription
ik_family_iduint-1The ID of family this bone is in (-1 by default)
ik_constraintstring"None"This family’s constraint
ik_modestring"FABRIK"This family’s mode (FABRIK, Arc)
ik_target_iduint-1This 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.

KeyTypeDefaultDescription
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).

KeyTypeDefaultDescription
iduint0ID of vertex
posVec2(0, 0)Position of vertex
uvVec2(0, 0)UV of vertex
init_posintposHelper for initial vertex position

Bind

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

KeyTypeDefaultDescription
idint-1ID of bind
is_pathboolfalseShould this bind behave like a path?
vertsBindVert[][]Array of vertex data associated to this bind

BindVert

Vertices assigned to a bind.

KeyTypeDefaultDescription
iduint0ID of vertex
weightfloat1Weight assigned to this vertex

Animations

KeyTypeDefaultDescription
idstring0ID of animation
namestring""Name of animation
fpsuint0Frames per second of animation
keyframesKeyframe[][]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

KeyTypeDefaultDescription
frameuint0frame of keyframe
bone_iduint0ID of bone that keyframe refers to
elementstring""Element to be animated by this keyframe
valuefloat0Value to set element of bone to
value_strstring""String variant of value
next_kfint-1Index of the next associated keyframe
start_handlefloat0.333Handle to use for start of interpolation
end_handlefloat0.666Handle to use for end of interpolation

Atlases

Easily-accessible information about texture atlas files.

KeyTypeDefaultDescription
filenamestring""Name of file for this atlas
sizeVec2(0, 0)Size of image (in pixels)

Styles

Groups of textures.

KeyTypeDefaultDescription
iduint0ID of style
namestring""Name of style
texturesTexture[]Array of textures

Textures

Note: Coordinates are in pixels.

KeyTypeDefaultDescription
namestring""Name of texture
offsetVec2(0, 0)Top-left corner of texture in the atlas
sizeVec2(0, 0)Append to offset to get bottom-right corner of texture
atlas_idxuint0Index of atlas that this texture lives in

Constructed Bones

An extra set of bones is recommended for optimization in the Construct() generic function. This is a clone of the bones array, but with construction applied to it for use later with Draw().


  1. A variant of Vec4: (r, g, b, a) ↩2