Metadata - WeAthFolD/MetaSprite GitHub Wiki

You can use specially named layers and frame tags to make MetaSprite perform certain special actions in the importer. Those features are called metadata feature. Example of an aseprite file using several metadata features:

https://github.com/WeAthFoLD/MetaSprite/blob/master/Images/MetadataExample.png

1. Commenting

You can comment out frame tags or layers by prefixing the name with //. Those frame tags and layers are ignored during the import.

2. Frame Tag Properties

You can add certain properties to a frame tag like tagName #prop1 #prop2 ....

Currently there is only one #loop property used for frame tag, which make the generated animation clip loop.

3. Meta Layer

Any layer that begins with @ symbol is considered a meta layer. A meta layer's content is excluded in the atlas generation, and it's content is interpreted by the action it specifies. For example:

  • @transform("EffectPosition") layer controls the position of child object named EffectPosition.
  • @boxCollider("AttackArea") layer manipulates the size and position of BoxCollider2D component of child object AttackArea, according to the pixel area each frame.

To be more precise, a valid meta layer's name is in either of the following syntax:

  • @actionName
  • @actionName(par1, par2, ...)

where a parameter can be either a number (1.0, -1234, 3.14159e3), a string ("abcdef", "233333") or a boolean (true or false). Parameters are used by actions for extra information.

Currently implemented layer actions are:

3.1 @boxCollider Action

Layer syntax: @boxCollider("child object name" [, true/false])

Usage: Manipulates the BoxCollider2D component in the specified child object, to match the position of minimum bounding rect in each frame.

If a frame doesn't have any pixels, the BoxCollider2D is disabled in that frame by default. You can disable this behaviour by passing an additional false argument.

3.2 @transform Action

Layer syntax: @transform("child object name")

Usage: Manipulates the local position of the specified child object, to the average position of all pixels each frame. If a frame doesn't have any pixels, keyframe is not created for that frame.

3.3 @event Action

Layer syntax: @event("messageName" [, param])

Usage: Create an animation event at the given frames with an optional parameter to send. Only frames that have any pixels actually drawn are included.

3.4 @sub and @subTarget Action

Those actions are related to sub image generation. Refer to Sub Image for more details.