Coder Social home page Coder Social logo

spriterdotnet's People

Contributors

adamholdenyall avatar brunoromes avatar esdotdev avatar loodakrawa avatar lucidspriter avatar rfadeev avatar warmuuh 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spriterdotnet's Issues

StopPlayback & StartPlayback

Hi,

I'm looking for a counter part for those functions that UnityEngine.Animator has.

I see Animator.Speed is this the preferred way ?

Add support for Render Order

Currently there is no ability to set the Render Order of Sprites, ideally this would be a DropDown menu, On SpriterDotNetBehavior which displays all the sorting layers defined currently in the project.

A a lower-cost implementation, would could just expose a String property that we can type our desired layer name into.

Unity importer doesn't handle empty key tags properly

When a SCML file contains an animation with a key tag in the form: <key id="7" time="450"/> the importer creates a SpriterMainlineKey with a null ObjectRefs field, which throws a NullReferenceException in SpriterImporter.cs:307 when it tries to iterate over ObjectRefs ("foreach (SpriterObjectRef obj in key.ObjectRefs)").

I fixed it with a null check as a hack but I don't really know enough about the library to be confident that this is the right way to go about it.

Enhancement: Using Built-in Unity Animator & Animations

Hello, I've recently downloaded the Unity Package to implement in our game because the latest spriter update has broken our animations using the Spriter2UnityDX plugin.

Everything that you've done is pretty radical, but one thing that I loved about Spriter2UnityDX was that it built unity animations and allowed their use in the Animator, so that we could control our animations with state machines and use fancy features like Foot IK.

After a quick look, it looks like this one does all of the work itself which is impressive, but I'm not sure how I could use the built in components with it.

Have you got plans to add support for these things? Or have you got any advice on how to do it myself?

API is out of sync with the unity implementation

The implementations of ApplyTransform() and Animate() are no longer correct due to changes in the core API.

These are easily fixed, but I got stuck trying to fix the importer, which errors with:

Assets/lib/spriter/SpriterDotNetUnity/SpriterImporter.cs(77,26): error CS0246: The type or namespace name `SpriterMainLineKey' could not be found. Are you missing a using directive or an assembly reference?

Although the compiled DLL in the unity folder continues to work, attempting to import or compile the SpriterDotNet core no longer does.

Perhaps you could consider tagging/branching the repo at a known working version for unity?

note about imported as Sprites

I see there is note about the images in the spriter project:
IMPORTANT: Make sure that all the images referenced in the .scml are imported as Sprites.
But I don't remember this was necessary on my previous test with SpriterDotNet.Unity
I see in the demo package this is fine, all the images are aprites, but even when I make this change to every image it doesn’t work on my current test. I have to make it BEFORE I import the spriter project.
Do you use any script to convert the images to sprites on the import step on the fly? I doesn’t seem to work now. I think I see this set on the previous version I test, but I'm not sure.
This will be a new part of the work flow ?

Animation included to animation

Today I tried add to animation, another small animation (to WALK_SHOOT is included FIRE_FLASH), saved project crash in Unity during import on strange place:

StackOverflowException: The requested operation caused a stack overflow.
SpriterDotNetUnity.SpriterImporter.HasSound (SpriterDotNet.SpriterEntity entity) (at Assets/Standard Assets/SpriterDotNet/SpriterImporter.cs:283)

I havent included any sound in scene, only combiner 2 animation. When I remove included animation import works.
EarthStoryVania-Player.zip

Works this feature?

Best regards,
AndyGFX

MonoGame: Add a way to scale a sprite without deforming the texture

Hello everyone :)

I'm looking for a way to repeat a texture on a sprite that we scale instead of stretching it out.

I ask the same question on the Spriter forum (here), but I would like to avoid to manually create multiple sprites for that :/

Do you have any idea of what will be the easiest way to do that?

Unity missing assets

Im importing my project into unity after I import SpriterDotNet into my project, it imports the projects and creates the prefab, the problem is the console throws this error to me in all the images of my project

Missing Asset: Assets/Personaje/Partes esqueleto/esqueleto.png
UnityEngine.Debug:Log(Object)
SpriterDotNetUnity.SpriterImporter:LoadContent(String) (at Assets/SpriterDotNet/SpriterImporter.cs:238)
SpriterDotNetUnity.<LoadAssets>c__Iterator17:MoveNext() (at Assets/SpriterDotNet/SpriterImporter.cs:227)
System.Linq.Enumerable:ToArray(IEnumerable`1)
SpriterDotNetUnity.SpriterImporter:CreateSpriterData(Spriter, String, String) (at Assets/SpriterDotNet/SpriterImporter.cs:87)
SpriterDotNetUnity.SpriterImporter:CreateSpriter(String) (at Assets/SpriterDotNet/SpriterImporter.cs:50)
SpriterDotNetUnity.SpriterImporter:OnPostprocessAllAssets(String[], String[], String[], String[]) (at Assets/SpriterDotNet/SpriterImporter.cs:34)
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEditor.DockArea:OnGUI()

any idea what this could be? i need to do something with my project first?

Flipping doesnt work

When I flip animation (changing AtlasExample/0.scml x-direction), pieces goes wrong places.

Test:
Added
if (IsPressed(Keys.Tab)) currentAnimator.Scale = new Vector2(-1f, 1f);
to SpriterGameState.cs.

spr

Pushing a Character Map does not Update Pivot Points or Transform

When pushing a character Map in Unity it seems pivot points from Spriter are not applied, so if I am replacing a Sprite with another one that has a different pivot point then the plugin will simply replace the sprite without changing it's position. Is there any way to fix this or will I have to draw character maps that have exact pivot points.

Original Sprite Pivot Point
screenshot 44

Replacement Sprite and Pivot Point
screenshot 45

How it looks in spriter
screenshot 46

How it appears in Unity
screenshot 47

Pushing a Character Map causes stack overflow

I'm attempting to change the player textures using a character map. The map works in Spriter but UnityAnimator.SpriterProvider.PushCharMap() throws a StackOverflowException. The error only occurs if the character map actually exists.
The bug occurs even in the example provided with SpriterDotNet.

My code:

animator.SpriteProvider.PushCharMap(GetMapByName(map_name,animator));
private static SpriterCharacterMap GetMapByName (string name, UnityAnimator animator) {
        foreach (SpriterCharacterMap map in animator.Entity.CharacterMaps) {
            if (map.Name.Equals(name)) return map;
        }
        GameRuntimeHelper.ThrowStoppingException("No character map exists for name "+name);
        return null;
    }

And the error:

StackOverflowException: The requested operation caused a stack overflow.
SpriterDotNet.Providers.DefaultAssetProvider`1[UnityEngine.Sprite].Get (Int32 folderId, Int32 fileId) (at Assets/SpriterDotNet/Lib/Providers/DefaultAssetProvider.cs:41)
SpriterDotNet.Providers.DefaultAssetProvider`1[UnityEngine.Sprite].Get (Int32 folderId, Int32 fileId) (at Assets/SpriterDotNet/Lib/Providers/DefaultAssetProvider.cs:41)
SpriterDotNet.Providers.DefaultAssetProvider`1[UnityEngine.Sprite].Get (Int32 folderId, Int32 fileId) (at Assets/SpriterDotNet/Lib/Providers/DefaultAssetProvider.cs:41)
...
and so on

which references this line.

File.Width and Height not used

I can see that File.PivotX and PivotY are used in case the SpriterObject do not have the pivotX and pivotY set (right?) but I can see no use of FIle.width and Height.

Is it a bug?

If not , why is there such field ?

Instantiate gameObject with animation as child.

Hi,

I have very strange problem, when I drag converted animation to Unity in design mode, every animation works very well in run mode.

Problem is when I instantiate prefab with animation to scene in run-time, then animation isn't played. I tried debug code, but looks like initialization was done and play is executed.

Tried on empty scene withou any of my code.

I can't find problematic part.

Best regards,

AndyGFX.

Attached Point and Box

Today I tried first time used in my animation Point and Box and result is:
Point is on wrong place, and Box has wrong size. I have used sprite where pixelPerUnits=16.

Looks like Collider2d and point transformation are wrong recalculated.
2016-10-08
2016-10-08 1

EDIT: Yes, when sprite has set PixelPerUnits = 100, then is position and box size correct. => import component doesn't look on sprite PerPixelUnits value :(

Best regards,
AndyGFX

Sprites bug on transition

I'm experiencing a strange bug when using transitions of animations, where the sprites start to rotate and strech. These can be seen in the screens below.

Idle
Transition From Idle to Walk 1
Transition From Idle to Walk 2
Walk
Transition From Walk to Idle

These animations were taken from the Adventure Pack (and stripped down, now I only have idle and walk animations), but I still can't seem to find the problem. To help in the analysis I created a test project (that can be accessed here ).

My setup:

  • Linux Mint 17.3
  • Spriter Pro Release 8
  • Unity 5.3.4f1 64bits linux version

Advanced blending features

Is it possible to implement a feature that lets you blend together more than two animations?

What about a feature that blends a new animation into the current one?

New feature: Adding delta animations onto a base animation

As a new feature, it would be really useful to be able to script adding animations together, e.g. A "crouch" animation plays, lowering the body and head to new positions, a separate "head movement idle" animation plays on top (the extra head idle movement adding on top of the head's crouching position), and, say, her eyes blink fast as a third animation on top.

Then, some moments later, the crouch animation transitions to a walk animation, then to a run, but the other animations continue to play on top.

Note this is not the same as blending. In this scenario we start with 100% of the crouch animation. We then take the difference between the transform of the current frame of the head movement idle animation as compared to the first frame of the same animation, and add this difference on top of the crouch.

For the blinking animation, the eyelids are animated, and we could choose to configure so that the local transform of these eyelid bones overrides any other of our animation's local transforms of these eyelid bones.

I'm not entirely sure here, but it sounds to me like this degree of control is more flexible than SubEntities. It's controlled by script in the runtime, doesn't require special authoring, allows the same bones to be affected by more than one animation, and generally gives customisable control as to how and when animations are added together.

Such a system could then be extended to (a) allow more than two animations to be blended together, (b) allow customisation of how transforms are calculated. e.g. If you always want one bone's transform to be 50% between that of two other bones.

Many bugs when imported to Unity

Hi guys,

I am trying to import an animation to Unity, and in the 50% of the cases, it's fail.
Why this happen?

Here is an animation on the Spriter Pro, and the same in the Unity, after the import:
out-17-2016 14-10-56

In Unity:
out-17-2016 14-12-11

Is not only this animation that the problem occurred.

Can you help me?

SpriterObjectPool bug

There must be some bug with SpriterObjectPool.
With PoolingEnabled==true I get the null pointer exception:

SpriterSpatial SpriterDotNet.SpriterProcessor:Interpolate (SpriterSpatial, SpriterSpatial, Single, Int32)+0x12 at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\SpriterDotNet\SpriterProcessor.cs:446   C#

Void SpriterDotNet.SpriterProcessor:UpdateFrameData (FrameData, SpriterAnimation, SpriterAnimation, Single, Single)+0xd6 at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\SpriterDotNet\SpriterProcessor.cs:49 C#
FrameData SpriterDotNet.AnimationDataProvider.DefaultAnimationDataProvider:GetFrameData (Single, Single, Single, SpriterAnimation, SpriterAnimation)+0x32 at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\SpriterDotNet\AnimationDataProvider\DefaultAnimationDataProvider.cs:23 C#
Void SpriterDotNet.SpriterAnimator2:Animate (Single)+0x1f at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\SpriterDotNet\SpriterAnimator.cs:237 C# Void SpriterDotNetUnity.UnitySpriterAnimator:Animate (Single)+0x17 at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\UnitySpriterAnimator.cs:44 C# Void SpriterDotNet.SpriterAnimator2:Step (Single)+0x1a3 at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\SpriterDotNet\SpriterAnimator.cs:229 C#
Void SpriterDotNetUnity.SpriterDotNetBehaviour:Update ()+0x39 at C:\ALL_PROJECTS\PvPGame\PVP_GAME\Assets\SpriterDotNet\SpriterDotNetBehaviour.cs:72 C#

With PoolingEnabled==false everything works just fine.
The bug occurs in specific combination of several different Spriter animations on screen.
Each animation plays just fine alone, but when 2 or more are playing the bug occurs (I guess because SpriterObjectPool is static and is therefore shared across multiple Spriter animations).

Reimporting Scml breaks prefab instances.

Hi guys,

SpriterImporter seems to break existing prefab connections between gameObjects when reimporting SpriterDotNetBehaviour prefabs.
A monobehaviour of a gameObject in the scene or of a prefab will loose the value of the gameObject.
( tested with a very simple monobehaviour containing only a public gameObject field to isolate the problem).

In SpriterImporter.cs, the function ReplacePrefab(GameObject go, GameObject prefab, string path) should have:

GameObject createdPrefab = PrefabUtility.ReplacePrefab(existing, prefab, ReplacePrefabOptions.ReplaceNameBased);

instead of : GameObject createdPrefab = PrefabUtility.ReplacePrefab(existing, prefab, .ReplacePrefabOptions.Default);

It worked when modifying that option.

Guillaume Ripoll

Sometimes animation transitions cause errors

Seems like something in MathHelper is causing this; after running animations in unity for a while, transitions will go crazy and the editor logs:

ArithmeticException: NAN
System.Math.Sign (Single value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Math.cs:485)
SpriterDotNet.SpriterProcessor.ApplyParentTransform (SpriterDotNet.SpriterSpatial child, SpriterDotNet.SpriterSpatial parent) (at Assets/lib/spriter/core/SpriterProcessor.cs:438)
SpriterDotNet.SpriterProcessor.GetBoneInfos (SpriterDotNet.SpriterMainlineKey key, SpriterDotNet.SpriterAnimation animation, Single targetTime, SpriterDotNet.SpriterSpatial parentInfo) (at Assets/lib/spriter/core/SpriterProcessor.cs:265)
SpriterDotNet.SpriterProcessor.GetFrameData (SpriterDotNet.SpriterAnimation animation, Single targetTime, SpriterDotNet.SpriterSpatial parentInfo) (at Assets/lib/spriter/core/SpriterProcessor.cs:83)
SpriterDotNet.SpriterAnimator`2[TSprite,TSound].Animate (Single deltaTime) (at Assets/lib/spriter/core/SpriterAnimator.cs:142)
SpriterDotNetUnity.UnitySpriterAnimator.Animate (Single deltaTime) (at Assets/lib/spriter/unity/UnitySpriterAnimator.cs:41)
SpriterDotNet.SpriterAnimator`2[TSprite,TSound].Step (Single deltaTime) (at Assets/lib/spriter/core/SpriterAnimator.cs:133)
SpriterDotNetUnity.SpriterDotNetBehaviour.Update () (at Assets/lib/spriter/unity/SpriterDotNetBehaviour.cs:90)

I'm trying to look into what might be causing this or get a repeatable test case causing it and will update the issue with more info when I have it...

Unity resets the sprite color

Fix
renderer.color = new Color(1.0f, 1.0f, 1.0f, info.Alpha);
to use the existing RGB values and apply only the alpha value.

Preprocessing?

I like the event for postprocessing, but having something for preprocessing would be nice as well. Before I just modify the project myself, is such a thing already possible?

AnimationFinished(Name) dispatches repeatedly

When a non-looping animation has finished, the AnimationFinished(Name) event will continuously fire.

In our case, we have a Death animation, when the death animation has finished, we want to re-parent our enemy to a corpses layer. Because the event fires many many times, it causes a bug in the game.

We can work around the issue, but still this can't be too good for performance.

Ideally the onComplete event only fires once for every animation.

No overload for method SpriterImporter

using the unity plug with unity 5.0.0f4 I get this error: "Assets/SpriterDotNet/SpriterImporter.cs(108,49): error CS1501: No overload for method LoadAssetAtPath' takes1' arguments" when drop the unitypackage...

Question regarding SpriterObjectType

in the function addSpatialData (https://github.com/loodakrawa/SpriterDotNet/blob/master/SpriterDotNet/SpriterProcessor.cs#L283)
there is a switch statement that go over some of the SpriterObjectType.

I guess it is not possible that it will be of the type whose the "case" is missing (Bone,Sound,Variable )?

Why do these SpriterObjectType exist then (they are not checked anywhere)?

for Sound is it because it can never be on a timeline and always is on a SoundLine?
What about Bone and Variable ?

Thanks

AOT Compilation not supported

When attempting to compile for PS4, which uses AOT-only compilation mode, I was repeatedly getting an error:
Attempting to JIT compile method 'System.Collections.Generic.Dictionary2<int, System.Collections.Generic.IDictionary2<int, UnityEngine.Sprite>>:.ctor ()' while running with --aot-only. at SpriterDotNet.SpriterAnimator`2[TSprite,TSound]..ctor

This is due to the use of Generics w/ AOT-compilation.

In order to fix this, we need to supply the Unity compiler with some public properties who's signature matches the concrete Dictionary types we need. Specifically, include the following at the top of UnitySpriteAnimator:

public Dictionary<int, IDictionary<int, Sprite>> aot_Sprites = new Dictionary<int, IDictionary<int, Sprite>>();
public Dictionary<int, Sprite> aot_SpritesInner = new Dictionary<int, Sprite>();
public Dictionary<int, IDictionary<int, AudioClip>> aot_Audio = new Dictionary<int, IDictionary<int, AudioClip>>();
public Dictionary<int, AudioClip> aot_AudioInner = new Dictionary<int, AudioClip>();

This gives the Unity compiler the info it needs to compile for these classes ahead of time.

I've created a pull request with the required changes.

Support for TexturePacker / 2dToolKit

We'd like to use an external Sprite Packing tool (like TexturePacker, or 2dToolKit) to create our texture atlases, and wondering how we could integrate that with SpriterDotNet.

Any tips on where to start?

AnimationFinished Event Not Correct

If you do a blended transition from animation A to animation B, the first animation complete event for B doesn't happen at the completion of B. It also seems to vary in time in an unpredictable way. Any idea?

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.