// Hide .scml (Code Copy/Paste Mode)

// Expand/Collapse all function definitions



CC0
To the extent possible under law, BrashMonkey, LLC
has waived all copyright and related or neighboring rights to the

.Scml Sample Pseudo-Code Implementation
(left column - below)


SCML Format Specification
Copyright (c) 2012, BrashMonkey, LLC.
All rights reserved.

The Scml Format (right column - below)
is published under the Modified BSD License. (details)

ScmlObject
{
    Folder folders[]; // <folder> tags
Entity entities[]; // <entity> tags
Folder activeCharacterMap[];

int currentEntity;
int currentAnimation;

float currentTime;

SpatialInfo characterInfo() void setCurrentTime(float newTime)
{ Entity currentEnt=entities[currentEntity]; Animation currentAnim=currentEnt.animations[currentAnimation]; currentAnim.setCurrentTime(newTime); }
void applyCharacterMap(CharacterMap charMap, bool reset) }
<?xml version="1.0" encoding="UTF-8"?>
<spriter_data
        scml_version="1.0"
        generator="BrashMonkey Spriter"
        generator_version="b4">
Folder
{
    string name;
    File files[]; // <file> tags
}

File {     string name;
    float pivotX=0;
    float pivotY=1;
    (engine specific type) fileReference;
// a reference to the image store in this file
}
    <folder   
id="0"
name="relative folder path">
<file
id="0"
name="<relative file path>"
width="<image width>"
height="<image height>"
pivot_x="0.0"
pivot_y="1.0"/>
</folder>
Entity
{
    string name;
CharacterMap characterMaps[]; // <character_map> tags
 Animation animations[]; // <animation> tags
}
    <entity 
id="0"
name="entity name">
CharacterMap
{
    string name;
MapInstruction maps[]; // <map> tags
}

MapInstruction { int folder;
int file;
int tarFolder=-1;
int tarFile=-1;
}
        <character_map 
id="0"
name="character map name">
<map
folder="0"
file="0
target_folder="-1"
target_file="-1"/>
</character_map>
Animation
{
    string name;
   int length;
    int loopType=LOOPING; // enum : NO_LOOPING,LOOPING
MainlineKey mainlineKeys[]; // <key> tags within a single <mainline> tag
    Timeline timelines[]; // <timeline> tags

    void setCurrentTime(float newTime)
    { if(loopType==NO_LOOPING)         {         newTime=min(newTime,length);         }         else if(loopType==LOOPING)         {             newTime=newTime%length;         }         updateCharacter(mainlineKeyFromTime(newTime),newTime);     }
    void updateCharacter(MainlineKey mainKey,int newTime)     MainlineKey mainlineKeyFromTime(int time)
    TimelineKey keyFromRef(Ref ref,int newTime) }
<animation
         id="0"
                name="animation name"
                length="<length in milliseconds>"
looping="true,false">
MainlineKey
{
    int time=0;
    Ref boneRefs[]; // <bone_ref> tags
    Ref objectRefs[]; // <object_ref> tags
            <mainline>
                <key 
                id="0"
                        time="0">
Ref
{   
    int parent=-1; // -1==no parent - uses ScmlObject spatialInfo as parentInfo
    int timeline;
    int key;
}

// edittime features 
                    <bone_ref             
            id="1"            
                parent="-1"
                timeline="0"
            key="0"/>             <object_ref
                id="0"            parent="0"
            timeline="0"
                 key="0"
            z_index="0"/>
        </key>
        </mainline>
Timeline
{
    string name;
    int objectType; // enum : SPRITE,BONE,BOX,POINT,SOUND,ENTITY,VARIABLE
    TimelineKey keys[]; // <key> tags within <timeline> tags
}
            <timeline 
    id="0"
                    name="timeline name"
                    type="sprite">
TimelineKey
{
    int time=0;
    int curveType=LINEAR; // enum : INSTANT,LINEAR,QUADRATIC,CUBIC
    float c1;
    float c2;
   
TimelineKey interpolate(TimelineKey nextKey,int nextKeyTime,float currentTime)     float getTWithNextKey(TimelineKey nextKey,int nextKeyTime,float currentTime)     TimelineKey linear(TimelineKey keyB,t) } SpatialTimelineKey : TimelineKey { SpatialInfo info;
    void paint();
}

SpatialInfo { float x=0;
    float y=0;
    float angle=0;
    float scaleX=1;
    float scaleY=1;
    float a=1;
    int spin=1;

    SpatialInfo unmapFromParent(SpatialInfo parentInfo) } BoneTimelineKey : SpatialTimelineKey { // unimplemented in Spriter     int length=200;     int height=10;     // override paint if you want debug visuals for bones     void paint()     TimelineKey linear(TimelineKey keyB,float t) } SpriteTimelineKey : SpatialTimelineKey { int folder; // index of the folder within the ScmlObject
    int file
    bool useDefaultPivot; // true if missing pivot_x and pivot_y in object tag
    float pivot_x=0;
    float pivot_y=1;

    void paint()     TimelineKey linear(TimelineKey keyB,float t) }
                <key 
                id="0"
                        time="0"
                        spin="1"
                        curve_type="0"
                        c1=""
                        c2="">












<bone
    x="0"
    y="0"
    angle="0"
    scale_x="1"
    scale_y="1"
               a="1"/>
                    <object
    folder="0"
    file="0"
    x="0"
    y="0"
    angle="0"
    scale_x="1"
               scale_y="1"
    pivot_x="0"
    pivot_y="1"
a="1"/>
                </key>
</timeline>
    </animation>
</entity>
</spriter_data>
float linear(float a,float b,float t)
SpatialInfo linear(SpatialInfo infoA,SpatialInfo infoB,int spin,float t)
float angleLinear(float angleA,float angleB,int spin,float t)
float quadratic(float a,float b,float c,float t)
float cubic(float a,float b,float c,float d,float t)