julieta.perezmurillo

I made a custom pipeline made for Monogame since all my animations broke because of it, it works perfectly and it parses the .atlas as intended, however when the game runs no animation appears.

There are no examples for Monogame for 4.0 so I am not sure if I am missing something. Both runtimes were updated, spine-xna and spine-csharp up to 4.0

On LoadContent, loading everything:
logoAnimation = content.Load<SpineAsset>("Logo");
logoAnimation.SetAnimation(0, logoAnimation.SkeletonData.Animations.Items[0].Name, true);
logoAnimation.SetBasePosition(new Vector2(70, 100));
logoAnimation.SetActualPosition(new Vector2(70, 100));
logoAnimation.Skeleton.X += 70;
logoAnimation.Skeleton.Y += 100;
logoAnimation.Skeleton.UpdateWorldTransform();
On Update, I set the current scale and update the position if needed:
logoAnimation.SetScale(screenScale);
logoAnimation.UpdatePosition(screenScale);
logoAnimation.UpdateRoutine(gameTime);
public void UpdateRoutine(GameTime gameTime)
{
AnimationState.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
AnimationState.Apply(Skeleton);
Skeleton.UpdateWorldTransform();
}
OnDraw, I render the skeleton:
skeletonRenderer.Begin();
skeletonRenderer.Draw(logoAnimation.Skeleton);
skeletonRenderer.End();
skeletonRenderer is properly initialized. Did anything change when rendering the animations?
julieta.perezmurillo
  • Postovi: 7

Harald

julieta.perezmurillo je napisao/la:I made a custom pipeline made for Monogame since all my animations broke because of it, it works perfectly and it parses the .atlas as intended, however when the game runs no animation appears.
Do you mean you wrote your own .atlas asset parser? If so, then it most likely does not display anything since the atlas format has changed. In general you might save a lot of work by using the officially provided atlas and skeleton loader classes.
julieta.perezmurillo je napisao/la:There are no examples for Monogame for 4.0 so I am not sure if I am missing something. Both runtimes were updated, spine-na and spine-csharps up to 4.0
Do you mean that there are no example assets for Spine 4.0 available in the spine-monogame subdirectory in git? In general the examples structure has not changed from 3.8 to 4.0, the example assets are still contained in the spine-xna subdirectory on git:
https://github.com/EsotericSoftware/spine-runtimes/tree/4.0/spine-xna/example/data
Avatar
Harald

Harri
  • Postovi: 3924

julieta.perezmurillo

Harald je napisao/la:Do you mean you wrote your own .atlas asset parser? If so, then it most likely does not display anything since the atlas format has changed. In general you might save a lot of work by using the officially provided atlas and skeleton loader classes.
The reason I am adamant to use a pipeline is because I would like to keep the animations from being opened so easily by players. When loading simply as you ask for, the .atlas/.json/.png are put into the Content folder as they were generated by Spine, it looks a bit unprofessional. I already changed it to parse the new format of the .atlas, and the new runtime parse the .json correctly, I get no errors when compiling my game, the animations just don't show up.

I did some test as you mention and it does indeed work without my pipeline processor.
Harald je napisao/la:Do you mean that there are no example assets for Spine 4.0 available in the spine-monogame subdirectory in git? In general the examples structure has not changed from 3.8 to 4.0, the example assets are still contained in the spine-xna subdirectory on git:
https://github.com/EsotericSoftware/spine-runtimes/tree/4.0/spine-xna/example/data
I will check these examples again, I was just wondering if something changed or maybe I was doing something wrong with the new version. Thanks for confirming that.

---

I fixed this problem. I took a better look at the .atlas as you mentioned and found the problem that I was encountering. I did parse the .atlas correctly, but did not take into account that the 'region.originalWidth' and 'region.originalHeight' should be the width and height found in "bounds" even if there is no "offsets" found in the region. They were set to 0, 0 always.

Sorry again. If anyone is interested on getting the pipeline for Monogame working, let me know. I am planning on releasing the parser I made, but because of this kind of issues I think it still requires some work. So maybe when it is more stable.
julieta.perezmurillo
  • Postovi: 7

Harald

Very glad to hear you've figured it out, thanks for letting us know!
julieta.perezmurillo je napisao/la:The reason I am adamant to use a pipeline is because I would like to keep the animations from being opened so easily by players. When loading simply as you ask for, the .atlas/.json/.png are put into the Content folder as they were generated by Spine, it looks a bit unprofessional.
I see your point. The more typical way to achieve that would be to pack the game assets and upon loading unpack them into memory, with or without added encryption on top.
Avatar
Harald

Harri
  • Postovi: 3924


Natrag na Bugs