-
Posts
161 -
Joined
-
Last visited
-
Days Won
19
Content Type
Forums
Store
Gallery
Downloads
Everything posted by loodakrawa
-
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
It's a flag that indicates whether the sound should be played or not. -
You register the methods you want with the EventTriggered event in *SpriterAnimator (as in the examples). Then the library raises the event at the right point during the animation which means you methods get called since you registered them with the event. If you look at the event signature, you'll see that it has a single string argument which represents the event name (as defined in spriter animation) - in other words, your listener method signatures must have a single string argument (again, take a look at the examples). If you're still unclear about this - you should probably learn more about C# events.
-
Pretty much. The C# event is raised by the library when the event in Spriter animation occurs. You just have to register one or more methods to listen to the event (as in the examples).
-
The animation events are fired as C# events. Take a look at Example1 and Example2.
-
Runtime overhead compared to what? I've written the library to be as fast as possible (while still having readable code) and reduced memory allocations per frame to virtually zero. However, if you have really a lot of animations you might have an impact on the CPU. The usual technique to solve this is caching computation results - like in the SnapshotAnimationDataProvider class. This drastically reduces CPU usage but uses more memory. From my testing, the lib performs really well. The only slow down I noticed is on Android (with > 30 complex animations) and the Profiler pinpointed the ApplySpriterTransform method, or more precisely, various calls to Unity's API inside the method. Unfortunately, I don't know if there's another, more efficient way of achieving the same thing in Unity. Regarding coroutines, I don't think it makes much sense to use them here since the overhead of calling Update is probably negligible compared to other processing. But if you get positive improvements, let me know and I'll be more than happy to update the lib. Cheers
-
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
Box is supposed to be for collisions. It is up to the derived classes to do something with the ApplyBoxTransform method - not necessarily draw the box. For example, In the Monogame example I'm drawing the boxes because there's nothing better I can do but in the Unity examples, the box is mapped to the native Unity collider and all transforms get applied in the ApplyBoxTransform method. So in other words, that method gets called every frame for each box with the calculated spatial data for it and it's up to the actual implementation to do something meaningful with it. -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
I wasn't aware of the existence of the pixel art mode. I'll investigate and try to make it working asap. Hi! I'm using the id (id == array index in almost all the cases) because I load all the data from the .scml to arrays. I think having the string as key should be pretty much the same (I'm just not sure if all the ObjectInfos in the .scml MUST have a name set) if you have a slightly different data structure. In the end I'm passing the whole ObjectInfo in the processing method. I didn't have a chance to take a look at the issue you reported but at first glance it does seem like a bug. I'll investigate it asap. Fun fact - my first Spriter implementation was done in Haxe a while ago (although it was significantly different that this one) Cheers -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
All the positions are calculated based on the information in the .scml file. That means if you swap a sprite with another one, all the transformations still come from the original one. The replacement sprite is just drawn in place of the original one. If you need to swap sprites with ones of a different size at runtime you can probably achieve it by extending the UnitySpriterAnimator and overriding the ApplySpriterTransform method and doing all the custom logic in it. -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
There is no guarantee. These game objects are just temporary containers for the library to fill with current sprites. If you need a list of sprites, you can get them in the SpriterDotNetBehaviour.SpriteData field under FileEntries. Keep in mind that a file entry can have either Sprite or AudioClip reference set. Another important thing - the SpriteData is a ScriptableObject which means it is shared between ALL instances. -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
I'm going to create a release in a couple of days. However, if you want to try it out before, do this (assuming you're using Unity): check the dev branch from GitHub, build the SpriterDotNet.sln solution and replace the contents of the SpriterDotNet folder in your project with the contents of the SpriterDotNet.Unity\Assets\SpriterDotNet\ folder in the solution. Glad to hear you got it working! The easiest way of swapping individual sprites is using the SwapSprite (and UnswapSprite) methods of the SpriterAnimator. What do you mean by numbers assigned to a sprite element? -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
Hi. I think this is due to a bug I fixed after the version 1.2. I plan to make the next release in the next couple of days and that should take care of the exception you're getting. In the meantime, you can try checking out the dev branch from GitHub and trying with that. I guess the Awake method should also be fine. I know I placed the init logic in Start and not Awake for some reason but I can't remember why. I'll take a look and move it there if possible since this causes problems for a number of people. -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
Hi, As far as I know, no one is working on that ATM so feel free to do it if you feel like it. I suggest you take a look at the examples and github documentation and you should get a good understanding of how it works. Also, please read CONTRIBUTING.md before starting any work. If you have any questions, feel free to ask me here (or in the Unity plugin thread). Cheers -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
I didn't understand your first question - could you rephrase it somehow? As for the other issue - I didn't realise Character Maps can stack so I raised an issue and I'll try to fix it asap. -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
Hi, The documentation is here and here (Unity Specific) There's a property on SpriterAnimator called CharacterMap which you can set to activate a certain character map. Take a look at the Unity example and/or Monogame example. Cheers -
Hi. In short, the goal of SpriterDotNet is to calculate all transforms in a framework independent way and then just map the transforms to sprites in a concrete framework. Presently, it supports all Spriter features and has no unresolved bugs. Also, it is officially supported by Brashmonkey. It doesn't use Mecanim because AFAIK that makes it impossible to use certain Spriter features (different curves, etc). The downside is not having support for the graphic animation state management tools, IK, etc. On the other hand, it offers full control at all times (e.g. modify the animation at runtime). I guess the library choice really boils down to whether you need Mecanim support or not. If you have any more questions, feel free to ask here or PM me. Cheers
-
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
I tried your solution and couldn't make it work. Then I remembered why I did it like that: Monogame content loading requires file name without extension. But if this works for you, I suppose you use a different version or have it configured in a different way. Which version do you use? -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
You are absolutely right. I don't remember why I did it this way - probably just had a brain fart and didn't realise that the whole path is in the file name. I'll fix this with the next commit. Thanks! -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
SpriterGame.cs is just an example, not a complete solution. This might be caused by a variety of things (how you added the .scml and images to the project, how you registered them in the Content, etc) so I suggest debugging the LoadContent -> RegisterTextures -> FormatPath methods. This should give you a pretty clear idea about what's going on. -
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
I researched a bit and I don't feel comfortable with this library changing the import settings. You can achieve the same effect by changing the project from 3D to 2D. In 2D mode, all images should be imported as Sprites. As an alternative, you can use this script if you want to enforce a certain way of importing images. Cheers -
Released SpriterDotNet version 1.2.0. The new release includes several bug fixes, uses memory much more efficiently (after the initial setup, 0 heap allocations - even on the ancient Mono compiler used in Unity) and the ability to customise the frame data with IAnimationDataProviders. Entire Changelog
-
SpriterDotNet - An implementation for all C# frameworks
loodakrawa replied to loodakrawa's topic in Spriter Implementations
Released SpriterDotNet version 1.2.0. The new release includes several bug fixes, uses memory much more efficiently (after the initial setup, 0 heap allocations - even on the ancient Mono compiler used in Unity) and the ability to customise the frame data with IAnimationDataProviders. Entire Changelog -
If you want to do something like this I suggest extending the DefaultAnimationDataProvider, setting it on the Animator.DataProvider and overriding the GetFrameData method and modifying the data before returning it.
-
To play two animations together - use the blend method. It's just like transition just "permanent" - it doesn't change over time. Transition is basically just calling blend with factor going from 0 to 1 through the transition time.
-
Just realised I haven't answered yet to this: You should be able to achieve that behaviour by using the AnimationFinished event. It gets triggered when a non-looping animation finishes and a looping one loops. About boxes - I'll add the option to the importer to generate boxes for every sprite. Cool suggestion! I will expand the documentation along with the development but for some things it's much easier to just provide code examples than to actually describe it. Changing animations dynamically - I just added support for changing the data source for the animator. Take a look here + the two implementations. It is possible to play multiple animations simultaneously but not on such a granular level - only entire animations. The transition method doesn't reset the current animation on purpose but transitions to the next one from the current time. Otherwise, if you try transitioning from the middle of an animation and it resets immediately it's not smooth - it just "jumps" to the starting point. Let me get this straight - are you saying that after a couple of quick transitions the animation just speeds up? Even after you stop transitioning?
-
That's exactly what I'm doing when playing a new animation: https://github.com/loodakrawa/SpriterDotNet/blob/master/SpriterDotNet/SpriterAnimator.cs#L150 Did you mean while transitioning (blending from one to the other)?