Skip to content

Library Documentation

Kat edited this page Sep 26, 2021 · 4 revisions

This page features on-line documentation for all public Disarm functions.


disarm_import_custom(events)

Uses a set of events to request information that is used to build a Disarm instance. The events struct must contain the fields armature, atlas, and image. Each of these fields must store a function which will return the struct or the file path of where the data is stored externally.

Name Type Description
events struct A struct containing the events to call in order to load the armature, atlas, and image files

Returns: struct


disarm_import_ext(arm, [atlas_map], [image_map])

Attempts to import a Spriter project as a Disarm instance by using a virtual file system.

Name Type Description
arm value The string or struct containing armature data
atlas_map (optional) struct A map from atlas names to atlas data
image_map (optional) struct A map from image names to image data

Returns: struct


disarm_import(arm, [image_map])

Attempts to import a Spriter project as a Disarm instance. If the atlas files are imported as sprites, the image_map struct can be used to map from image filenames to their resource names.

Name Type Description
path string The file path of the skeleton file
image_map (optional) struct A map from image names to image data

Returns: struct


disarm_flush()

Collects any dynamically allocated sprites that are no longer referenced.

Returns: N/A


disarm_atlas_exists(arm, atlas_name_or_id)

Returns whether an atlas exists with this name.

Name Type Description
arm struct The Disarm instance to update
atlas_name_or_id value The name of the atlas to check

Returns: real


disarm_atlas_get_data(arm, atlas_name_or_id)

Returns a reference to the atlas data with this name.

Name Type Description
arm struct The Disarm instance to update
atlas_name_or_id value The name of the atlas to get

Returns: struct

Note: any changes made to this struct will affect the representation of the atlas in the animation.


disarm_entity_exists(arm, entity_name_or_id)

Returns whether an entity exists with this name.

Name Type Description
arm struct The Disarm instance to update
entity_name_or_id value The name of the entity to check

Returns: real


disarm_entity_get_data(arm, entity_name_or_id)

Returns a reference to the entity data with this name.

Name Type Description
arm struct The Disarm instance to update
entity_name_or_id value The name of the entity to get

Returns: struct

Note: any changes made to this struct will affect the representation of the entity in the animation.


disarm_entity_set(arm, entity_name_or_id)

Sets the entity with this name as the current for this armature.

Name Type Description
arm struct The Disarm instance to update
entity_name_or_id real The name of the entity to set

Returns: N/A


disarm_skin_exists(arm, skin_name_or_id)

Returns whether a character map exists with this name.

Name Type Description
arm struct The Disarm instance to update
skin_name_or_id real The name of the skin to check

Returns: real


disarm_skin_get_data(arm, skin_name_or_id)

Returns a reference to the skin data with this name.

Name Type Description
arm struct The Disarm instance to update
skin_name_or_id real The name of the skin to get

Returns: struct

Note: any changes made to this struct will affect the representation of the skin in the animation.


disarm_skin_clear(arm)

Clears the current character map state.

Name Type Description
arm struct The Disarm instance to update

Returns: N/A


disarm_skin_add(arm, skin_name_or_id)

Adds a new character map, or array of character maps, to the current active skin.

Name Type Description
arm struct The Disarm instance to update
skin_name_or_id value The name, or array of names, of skins to add

Returns: N/A


disarm_skin_get(arm)

Returns a copy of the current skin.

Name Type Description
arm struct The Disarm instance to update

Returns: struct


disarm_skin_set(arm, skin_data)

Overrites the current skin with a copy of a stashed skin.

Name Type Description
arm struct The Disarm instance to update
skin_data struct The skin to apply

Returns: N/A


disarm_object_exists(arm, object_name_or_id)

Returns whether an object exists with this name.

Name Type Description
arm struct The Disarm instance to update
object_name_or_id value The name of the object to check

Returns: real


disarm_object_get_data(arm, object_name_or_id)

Returns a reference to the object data with this name.

Name Type Description
arm struct The Disarm instance to update
object_name_or_id value The name of the object to get

Returns: struct

Note: any changes made to this struct will affect the representation of the object in the animation.


disarm_slot_exists(arm, slot_name_or_id)

Returns whether a slot exists with this name.

Name Type Description
arm struct The Disarm instance to update
slot_name_or_id value The name of the slot to check

Returns: real


disarm_slot_get_data(arm, slot_name_or_id)

Returns a reference to the slot data with this name.

Name Type Description
arm struct The Disarm instance to update
slot_name_or_id value The name of the slot to get

Returns: struct

Note: any changes made to this struct will affect the representation of the slot in the animation.


disarm_animation_exists(arm, anim_name_or_id)

Returns whether an animation exists with this name.

Name Type Description
arm struct The Disarm instance to update
anim_name_or_id value The name of the animation to check

Returns: real


disarm_animation_get_data(arm, anim_name_or_id)

Returns a reference to the animation data with this name.

Name Type Description
arm struct The Disarm instance to update
anim_name_or_id value The name of the animation to get

Returns: real

Note: any changes made to this struct will affect the representation of the animation.


disarm_animation_begin(arm)

Resets the state of armature objects.

Name Type Description
arm struct The Disarm instance to update
anim_name_or_id value The name of the animation to check

Returns: real


disarm_animation_add(arm, anim_name_or_id, progress, [blend_amount])

Adds an animation to the armature pose.

Name Type Description
arm struct The Disarm instance to update
anim_name_or_id value The name of the animation to play
progress real The progress, as a number between 0 and 1, of the animation
blend_amount (optional) real The intensity of the animation

Returns: N/A


disarm_animation_end(arm, [skin_data])

Updates the world transformation of armature objects.

Name Type Description
arm struct The Disarm instance to update
skin_data (optional) value The skin to use

Returns: N/A


disarm_draw_debug(arm, [x], [y], [xscale], [yscale])

Renders a debug view of the armature.

Name Type Description
arm struct The Disarm instance to render
x (optional) real The X offset to render the armature at
y (optional) real The Y offset to render the armature at
xscale (optional) real The X scale to render the armature with
yscale (optional) real The X scale to render the armature with

Returns: N/A


disarm_draw_debug_atlas(arm, atlas_name_or_id, x, y, [width], [height])

Renders a debug view of an armature atlas.

Name Type Description
arm struct The Disarm instance to render
atlas_name_or_id real The name of the atlas the draw
x real The X position to render the atlas debug window
y real The Y position to render the atlas debug window
width (optional) real The width of the debug window
height (optional) real The height of the debug window

Returns: N/A


disarm_mesh_create()

Creates a new Disarm mesh that manages the rendering of Disarm animations.

Returns: struct


disarm_mesh_destroy(mesh)

Destroys this Disarm mesh. Because Disarm meshes use vertex buffers, this function must be called in the Clean-up event of any objects that use it.

Name Type Description
mesh struct The Disarm mesh to destroy

Returns: N/A


disarm_mesh_begin(mesh)

Resets the draw options for this mesh.

Name Type Description
mesh struct The Disarm mesh to begin drawing

Returns: N/A


disarm_mesh_add_armature(mesh, arm, [x], [y], [xscale], [yscale])

Adds the current world transform of an armature to this mesh.

Name Type Description
mesh struct The Disarm mesh to add vertices to
arm struct The armature to get vertices from
x (optional) real The X offset to render the armature at
y (optional) real The Y offset to render the armature at
xscale (optional) real The X scale to render the armature with
yscale (optional) real The Y scale to render the armature with

Returns: N/A


disarm_mesh_end(mesh)

Finalises the drawing of this mesh.

Name Type Description
mesh struct The Disarm mesh to finalise

Returns: N/A


disarm_mesh_submit(mesh)

Submits this mesh to the draw pipeline.

Name Type Description
mesh struct The Disarm mesh to draw

Returns: N/A