Jump to content
Spriter Forums

SpriterDotNet - An implementation for all C# frameworks


loodakrawa

Recommended Posts

Its my own framework based on opentk/opengl.

 

I have found another small issue if you are interested, its fairly odd and is only happening on a couple of animations on the goblin guy.  Do you want the information ?

 

Yeah, absolutely. Just try to describe the issue as best as you can and pinpoint the exact .scml / animation / time and I'll give my best to fix it.

Link to comment
Share on other sites

I have two guesses for why this would have issues:

 

1) This animation has keyframes set to "instant" for the speed-curve...this mean the key frame does NOT tween at all.. it holds static for it's entire duration and then instantly pops to coordinates/transforms etc of the next keyframe once it reaches it.

 

2) This animation might not have bones for every image... or they might be different bones from the other animations.

 

So, for animations like these, you can NOT tween from one animation to it, or from it to another animation, you must just immediately switch to or from these animations.

 

Trying to tween to or from these animations would definitely lead to strange and unwanted results.

 

cheers,
Mike at BrashMonkey

Link to comment
Share on other sites

That makes sense.  All seems to work now inside my framework :cool:   I had one issue with the bat animations where the 'a' attribute can be "nan".

Thank you for finding this. Saving "nan" to any value is definitely a bug and your workaround is exactly what I would have suggested. I will have a look into why this happened as soon as I can.

and @loodakrawa, great job on the implementation overall. You seem to be making awesome progress.

Link to comment
Share on other sites

Thanks! :)

 

There's definitely an issue with this. Everything except the last keyframe seems to be working fine. Also the instant curve works as it should - not interpolating between keys, just showing the last keyframe. But in the last keyframe (Time = 171) something goes wrong and everything is at a weird angle/position. I manually stepped through the code and it seems that everything gets calculated as per the scml.

 

@Lucid, any ideas what might be the cause?

 

Screenshots of the anim at the 3 keyframes:

0.png

 

1.png

 

2.png

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

First of all , Amazing job , and congratulations  on releasing the Implementation :)
I am testing this Importer atm . I dunno how I missed it XD

I have came across 1 Issue though : Shifting child transform position.x and .y disturb The looks of some of the animations

that happens on the line 54, in apply transform , in UnitySpriterAnimator

  child.transform.localPosition = new Vector3(deltaX, deltaY, child.transform.localPosition.z);

and solved to me by the line

child.transform.localPosition = new Vector3 (0, 0, child.transform.localPosition.z);

for all my scmls. 

That Solved my Issue by making the child always takes the local 0,0 x y position and keep z position /  while only the parent takes the x y world position and rotation.

 

I just wanted to point out my solution should someone experiance similar thing 

Also , brilliant job :)

Link to comment
Share on other sites

First of all , Amazing job , and congratulations  on releasing the Implementation :)

I am testing this Importer atm . I dunno how I missed it XD

I have came across 1 Issue though : Shifting child transform position.x and .y disturb The looks of some of the animations

that happens on the line 54, in apply transform , in UnitySpriterAnimator

  child.transform.localPosition = new Vector3(deltaX, deltaY, child.transform.localPosition.z);

and solved to me by the line

child.transform.localPosition = new Vector3 (0, 0, child.transform.localPosition.z);

for all my scmls. 

That Solved my Issue by making the child always takes the local 0,0 x y position and keep z position /  while only the parent takes the x y world position and rotation.

 

I just wanted to point out my solution should someone experiance similar thing 

Also , brilliant job :)

 

Glad you like it :)

Which animation is affected by this?

 

In the next couple of weeks I'll add support for the remaining features in the Unity plugin so I'll probably heavily modify the current version but still, I'd like to keep an eye for these potential bugs.

Link to comment
Share on other sites

Almost forgor ^^ Fast question : The Alpha Channel on Sprites inside sprite renderer are not yet to be Implemented no? because I can not see my alpha channel changing 

 

Yeah, I didn't even realise that. The Unity plugin is a little behind the MonoGame example because I've been focusing on implementing all the features in the core library. With that finished, I'll focus on fixing the Unity plugin ASAP.

Thanks for reporting the issue!

Link to comment
Share on other sites

For starters I just want to say thanks for making this!

 

Is there any chance you could put together something to help others understand a little better how the implementation works?

It does work with minor issues. I had one crash when transitioning animations on the green rectangle scml file but I didn't look into it too much. Overall it's nice and clean and works quickly.

My only issue is that there's literally like no comments and for somebody who doesn't know c# that makes things a bit difficult.

I really don't need much, I was just hoping you could make like a flow chart or a diagram to show how everything works together along with a SCML file.

 

PS Sorry to sound ungrateful, I really don't want you to think that's what this is. This is extremely cool that you have a full-featured implementation! :D

Link to comment
Share on other sites

Thanks for the great work loodakrawa and others, to ask a stupid question is there a small guide on how to set this up for unity since it's new? Do we use the spriter2unity plugin from here : http://brashmonkey.com/forum/index.php?/topic/3993-spriter-for-unity-50/ ?

 

There's a Unity project in the SpriterDotNet repo. It is not up to date due to a recent push to implement all the features in the core library. However, it's being worked on and should be complete soon (as a nice Unity package).

 

 

For starters I just want to say thanks for making this!

 

Is there any chance you could put together something to help others understand a little better how the implementation works?

It does work with minor issues. I had one crash when transitioning animations on the green rectangle scml file but I didn't look into it too much. Overall it's nice and clean and works quickly.

My only issue is that there's literally like no comments and for somebody who doesn't know c# that makes things a bit difficult.

I really don't need much, I was just hoping you could make like a flow chart or a diagram to show how everything works together along with a SCML file.

 

PS Sorry to sound ungrateful, I really don't want you to think that's what this is. This is extremely cool that you have a full-featured implementation! :D

 

Thanks for the feedback!

 

While writing the library I took really a lot of effort into breaking down everything into smallest possible methods and naming everything in a consistent and meaningful way (hoping to have self-documenting code). Also, I used only the most common data structures which are available in virtually any language. But I understand why it might be a bit hard to understand, especially if you're not familiar with the scml data structure. In light of this, I will add a document that explains the general flow. In the meantime, you can start by looking at the "main" method and trying to follow the flow while keeping any scml open for reference.

 

I've added a note about animation blending in the official documentation. The crash you discovered should not be happening and I'll fix it asap.

Link to comment
Share on other sites

Thanks for the feedback!

 

While writing the library I took really a lot of effort into breaking down everything into smallest possible methods and naming everything in a consistent and meaningful way (hoping to have self-documenting code). Also, I used only the most common data structures which are available in virtually any language. But I understand why it might be a bit hard to understand, especially if you're not familiar with the scml data structure. In light of this, I will add a document that explains the general flow. In the meantime, you can start by looking at the "main" method and trying to follow the flow while keeping any scml open for reference.

 

I've added a note about animation blending in the official documentation. The crash you discovered should not be happening and I'll fix it asap.

 

Very cool to hear and I definitely look forward to it. I'll take a closer look at everything next time I run through it all again. 

Link to comment
Share on other sites

Untitled_2.png

 

The Way I Understand It Happens that the "child game object" x, y is relative to the "parent", while the parent  x,y is relative to world. that is why sitting the child to 0,0 fixes the Issue. 

 

 

I've been looking into the issue you're having and couldn't replicate it. The DeltaX and DeltaY take care of the Spriter's pivot point. If you set it to 0,0 it's not going to work properly if anything has a non default pivot point. The only other thing I could think of is pivot points of imported Sprites in Unity. The plugin assumes that the Sprites are imported with Unity's default settings. Let me know if this helps.

Link to comment
Share on other sites

Ah no no , The 0,0 "fix" is for the (Child) game object NOT for the pivots points. Examine the game objects that has has name "child" to it and check their "transform" position :)

this is the suggested Fix , and it sets the child game object to 0,0
again , not the pivots , the child objects, you transform.position.x and .y had deltaXandDeltaY affecting the local position in the original code

 

Oirginal :

child.transform.localPosition = new Vector3(deltaX, deltaY, child.transform.localPosition.z); 

Suggested Fix:

		protected override void ApplyTransform (Sprite sprite, SpriterObjectInfo info)		{			GameObject child = children [index];			GameObject pivot = pivots [index];			SpriteRenderer renderer = renderers [index];			float ppu = sprite.pixelsPerUnit;			renderer.sprite = sprite;			Vector3 size = sprite.bounds.size;			float deltaX = (0.5f - info.PivotX) * size.x * info.ScaleX;			float deltaY = (0.5f - info.PivotY) * size.y * info.ScaleY;			pivot.transform.localEulerAngles = new Vector3 (0, 0, info.Angle);			pivot.transform.localPosition = new Vector3 (info.X / ppu, info.Y / ppu, 0);			child.transform.localPosition = new Vector3 (0, 0, child.transform.localPosition.z); //The fix Suggested if anyone has "position" of game objects appearing in diffrent places			child.transform.localScale = new Vector3 (info.ScaleX, info.ScaleY, 1);						++index;		}

In case you can not replicate the Issue still , I'll be releasing my game in the next 3~5 days , and I'll be more than happy to share any file with you and the community to improve the New scml Importer :)

Check you message box for sample file~

I tried my fix on "Grey Guy" example and it was distorted, then it worked properly when i changed pivots from "center" into the respective human anchoring points. it is 6am in the morning now , I am heading to bed and will test it again hopfully as soon as i finish my game and should not get distracted XD hopefully you'll find the smaple file helpful ^^

Link to comment
Share on other sites

I probably haven't explained it well enough. The pivot I was referring to is Spriter's pivot point, not the "pivot" object created in Unity. The "pivot" in Unity is basically the position of the object and it's being set to X and Y and the "child" is moved by deltaX and deltaY to account for the pivot point defined in Spriter.

 

I took a quick look to the files you sent me. If you check the .meta files of your /parts folder you'll notice that the spritePivot property is not {x: 0.5, y: 0.5} as it should be with the default settings. I'm pretty sure resetting the pivot point of your sprites in Unity should fix the issue. I will however try to incorporate support for sprites with different pivot points.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...