Code Monkey home page Code Monkey logo

metasprite's Introduction

MetaSprite

MetaSprite is an Unity plugin that lets you import Aseprite's .ase file into Unity, as Mecanim animation clips/controllers. It also has rich metadata support built in, allowing one to manipulate colliders, change transforms, send messages (and much more!) easily in Aseprite.

MetaSprite is now ready for production (already used heavily by myself in a WIP action platformer). New features will gradually be added.

Feature overview

  • Doesn't require external aseprite executable to run
  • Blazing fast
  • Efficient atlas packing
  • Simple workflow achieved using the new scriptable pipeline
  • Extensive metadata support
    • Commented (ignored) Layers/Tags
    • Manipulate colliders/events/positions/sprite pivots using image data
    • Specify clip looping using frame tag properties
    • ...
  • Write custom MetaLayerProcessor for extended functionality

Installation & Usage

Check out releases for unitypackage downloads. You can copy the Assets/Plugins folder of the repo into your unity project's asset folder for same effect.

See wiki for explanation of importing, import settings, meta layers and other importer features.

Credits

Donation

If this plugin helped you in your project or you want to support the developement, consider buying me a cup of coffee (°∀°)ノ

metasprite's People

Contributors

tullrich avatar weathfold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metasprite's Issues

the last frame problem

I found that the animation clip will copy the asesprite first frame as its last frame.
but when I have a transform meta layer, the last frame missing transform meta data.
I think if the last frame is the same as the first, the meta layer must automatic added as first frame.

here is my screenshot:

屏幕快照 2019-07-07 上午8 05 19

屏幕快照 2019-07-07 上午8 14 15

the result of missing transform meta layer of last frame, I got a weird behaviors , the transform curve not the correctly in the run mode, but seem ok in preview mode.

in preview mode:
previewwindow

editor scene or game scene
gamewinow

使用@pivot导致unity生成的碰撞盒位置与在aseprite画的位置不一致

在aseprite中画的碰撞盒位置:
QQ图片20200514105733

未使用@pivot时unity生成的碰撞盒位置:
QQ图片20200514105758

使用@pivot时unity生成的碰撞盒位置:
QQ截图20200514105937

导入设置:
QQ截图20200514110028

看了源码,初步认为是MetaLayerBoxCollider代码中
var pivot = Vector2.Scale(ctx.settings.PivotRelativePos, new Vector2(ctx.file.width, ctx.file.height));
的PivotRelativePos值是customPivot的值,而不是MetaLayerPivot最后生成的Pivot的值。但我对程序基本一窍不通,不知道分析的是否正确。

Improve how ase import settings are organized

Maybe use some rule like asmdef file (all files in a folder follows one setting)
or sprite atlas (both folder and single .ase can be selected in a list)

but anyways, current scheme of storing all settings reference in a global place is definetely bad

关于位移的动画空白像素被trim的问题

带位移的动画,特别是跳跃这种,因为跳起来以后下方的空白像素被去除了,所以工具生成的atlash中动画是不对的,只有单张导出整个canvas的时候,动画才和软件中表现一致,不知道这个问题作者怎么规避的,还有就是对texturepacker的支持, 暂时只能自己改一套了

Store file config under same folder of the plugin

It is not very satisfying to have to store file configs under a global folder. It is prefably placed in MetaSprite/Config folder for each project.

Some user might want to move MetaSprite folder somewhere else than Plugins folder, so we need means to detect where the plugin is placed.

Help with @boxCollider

So I can't figure out how to use @BoxCollider from the wiki...

Can anyone give me a more in-depth walk through or better yet a working example file I could look at?

Thank you for your time.

pivot not set to one specified in config file

Hi, when generating the atlas each frame seems to have some random number for the x and y values of the pivot, I tried setting bottom center and custom (0.5, 0) but I still get different numbers for each frame.

image

image

Root motion

I've loved this Aseprite importer and it solve most of my problem with the adition of a few I didn't have.
Unfortunatelly, my project has a very fine pixel tuned animation based on root motion. So, I would need to add transformation to the root motion translating the pivot position change into the animation. I have no problem in doing this as a last pass on the animation. However, if I try to add the translation on the imported animations it starts to behave oddly changing the sprite in some of the keyframes for the animation.
Is there anyway to set that in aseprite or add it later somehow?
If you could guide me through the code, I may be able to write this transformation based on the pivot change in a given loop myself.

Use better atlas packing algorithm

There are (much) better packing algorithms other than shelf packing, such as skyline, subdividing etc. We can achieve higher space efficiency by optimizing atlas packing algorithm.

Atlas generate issue : IndexOutOfRangeException

MetaSprite.Internal.AtlasGenerator+FrameImage.GetPixel (System.Int32 x, System.Int32 y) (at Assets/Plugins/MetaSprite/Editor/Internal/AtlasGenerator.cs:236)
MetaSprite.Internal.AtlasGenerator+<>c__DisplayClass3_0.<GenerateAtlas>b__0 (MetaSprite.Frame frame) (at Assets/Plugins/MetaSprite/Editor/Internal/AtlasGenerator.cs:46)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToList () (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <1b13ba6391c74847bbc3eddc86df7eee>:0)
MetaSprite.Internal.AtlasGenerator.GenerateAtlas (MetaSprite.ImportContext ctx, System.Collections.Generic.List`1[T] layers, System.String atlasPath) (at Assets/Plugins/MetaSprite/Editor/Internal/AtlasGenerator.cs:30)
MetaSprite.ASEImporter.Import (UnityEditor.DefaultAsset defaultAsset, MetaSprite.ImportSettings settings) (at Assets/Plugins/MetaSprite/Editor/ASEImporter.cs:121)
UnityEngine.Debug:LogException(Exception)
MetaSprite.ASEImporter:Import(DefaultAsset, ImportSettings) (at Assets/Plugins/MetaSprite/Editor/ASEImporter.cs:151)
MetaSprite.ImportMenu:DoImport(DefaultAsset[]) (at Assets/Plugins/MetaSprite/Editor/ImportMenu.cs:106)
MetaSprite.ImportMenu:MenuClicked() (at Assets/Plugins/MetaSprite/Editor/ImportMenu.cs:22)```

Implement better (yet still simple) packing algorithm

Shelve packing algorithm is vastly inefficient in texture space.
It's straightfowardly better to use a greedy large-to-small packing algorithm. We shall compare the difference before/after the algorithm change.

Support for secondary textures

Later version of unity now provide a method of associating secondary textures with a sprite atlas. This can be used for normal maps, emissive maps, or even arbitrarily named texture bindings in a Shader Graph. More info can be found here.

I'm interested in adding support for these to MetaSprite, but I have a few questions regarding how to best do so.

I think adding a @secondary("binding name") meta directive would be a good approach. Each of these layers could written as a separate texture asset and then associated with the main atlas as a secondary texture with the provided binding name.

A few questions though:

  1. Would it be best to provide two directives @secondary("Name") and @secondary-target("Name", "binding name") similar to sub images so that multiple layers could be combined into one secondary atlas? Was that the motivation behind using two in the case of sub images (I don't use this feature)?
  2. I imagine it would be necessary to support secondary textures on sub images as well. What would be a good syntax for this?
  3. MetaSprite will need to write secondary textures as separate assets. I see that sub-images already require this functionality and that I should be able to reuse part of that atlas serialization code. Is this correct? The sprite packing in the secondary texture needs to be exactly the same as the primary atlas. Is that possible?

Finally, thanks for the great importer!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.