Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement spine extension #5927

Merged
merged 90 commits into from
Jan 17, 2024
Merged

Implement spine extension #5927

merged 90 commits into from
Jan 17, 2024

Conversation

f0nar
Copy link
Contributor

@f0nar f0nar commented Nov 20, 2023

Implementation of 5775 issue

I took responsibility to introduce spine to GDevelop. This PR implements base features such as animations playing and switching, time scaling and auto update.

From known improvement and TODOs I want to add skin support and update spine object configuration panel with autofilling of atlas and image files paths. But let's take our time with this, because there are already quite a lot of changes here.

I am interested in this functionality so I will be grateful for assistance and comments.

@D8H
Copy link
Collaborator

D8H commented Jan 15, 2024

Changes

  • Replace actions, condition and expressions with the one of capabilities
    • It allows extensions for sprites and 3D models to work with Spines
    • The animation mixing duration is in its own action because the Animatable doesn't has this feature.
      • I wonder if users should be allowed to set a default value globally or on each animation in the Spine object editor.
    • Add actions for animation time control
    • Add flip actions
  • Remove the time scale property. In the future, animations duration could be customized one by one (like for sprites).
  • Handle scene and layer time scale

I used this project to test the capabilities:
capabilities.zip
https://gd.games/instant-builds/47ad8ca7-d7bf-4ca4-9abd-b2c30cc861af?dev=true


private:
double scale;
double opacity;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the opacity property could be removed. Especially because the transparency doesn't render correctly. The object parts are blending into each other which make them less transparent.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and removed the opacity property too, but in its own commit so it's easy to create a revert commit.

@D8H
Copy link
Collaborator

D8H commented Jan 15, 2024

In the case you are already using your extension, you can use this setting to update your project:

image

I kept most of the actions and only hidden them (for now) to let you update your project more easily.

@f0nar
Copy link
Contributor Author

f0nar commented Jan 16, 2024

Remove the time scale property. In the future, animations duration could be customized one by one (like for sprites).

@D8H can we remove it when it is the case?

@D8H
Copy link
Collaborator

D8H commented Jan 16, 2024

Remove the time scale property. In the future, animations duration could be customized one by one (like for sprites).

@D8H can we remove it when it is a case?

Properties can never be removed for compatibility reason. This is why in case there is a doubt, it's better not to add them.

Comment on lines 67 to 69
// TODO Remove before the release.
object
.addExpressionAndConditionAndAction(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll actually remove the old actions before the merge.

@D8H
Copy link
Collaborator

D8H commented Jan 17, 2024

I removed the old actions. Please keep your branch to update your projects from the previous commit if you need to.

Copy link
Collaborator

@D8H D8H left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for this extension, it looks really cool!

@LousyMolars
Copy link

LousyMolars commented Jan 17, 2024

Hey, @4ian, I have added new Spine demo to replace this abomination. New issue is here - GDevelopApp/GDevelop-examples#620

I'm planning on maintaining this project in the future, to test and apply new features for Spine object. Not sure if I followed all best practices, game became larger than anticipated. If someone can check project for mistakes, I'm willing to fix or completely redo weak parts.
Some art and sound was generated by neural networks, other was taken from cc0 sources without need for attribution.

Online version https://gd.games/lousymolars/calcopus

Copy link
Owner

@4ian 4ian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

@4ian 4ian merged commit d0005ba into 4ian:master Jan 17, 2024
3 checks passed
@4ian
Copy link
Owner

4ian commented Jan 17, 2024

And this is finally merged! I'm stocked to see this available for the next GDevelop release which should be ready in a few days :)

Many thanks @f0nar and @LousyMolars for your work here, including the various follow ups and examples.

Online version https://gd.games/lousymolars/calcopus

This looks awesome!

I'm planning on maintaining this project in the future, to test and apply new features for Spine object.

We're more than happy to have you continue improving it and maintaining it - the more we have contributors making real world usage of the various GDevelop extensions, the better we ensure they are maintained and up to date.

Thanks again, that's one of the biggest feature we got from new contributors recently 👏
I think the quality of the result is very high (thanks @D8H for implementing the latest "capability" features).

@f0nar
Copy link
Contributor Author

f0nar commented Jan 17, 2024

@4ian and @D8H many thanks for your comments, support and fixes. I am glad to be part of this project. Looking forward for release!
I believe that I will meet many interesting tasks and improvements here

@Onnevan
Copy link

Onnevan commented Mar 1, 2024

Great to see Spine implemented in GDevelop, thank you @f0nar for your work. Do you have any info on how to use it? because when I tried to use it with default export options in Spine I get an error stating the spine file doesn't find the name of the Atlas. I've tried different things, like renaming the .atlas to .txt and other settings but with no luck. Thanks!

@f0nar
Copy link
Contributor Author

f0nar commented Mar 1, 2024

@Onnevan are you working from desktop version? Spine functionality is available there only

@LousyMolars
Copy link

Great to see Spine implemented in GDevelop, thank you @f0nar for your work. Do you have any info on how to use it? because when I tried to use it with default export options in Spine I get an error stating the spine file doesn't find the name of the Atlas. I've tried different things, like renaming the .atlas to .txt and other settings but with no luck. Thanks!

Hey. Can you maybe share your export file or error in details? Spine 4.0 or 4.1 should work. Here are export settings that worked for me:
image
Project where you can check events and object - GDevelopApp/GDevelop-examples#620

We didn't test if extension works with "essential" version, only "pro", maybe that could be a reason.

@Onnevan
Copy link

Onnevan commented Mar 1, 2024

I will try again @LousyMolars and @f0nar , but I'm on desktop (Win) and have the pro version, so we can rule that out. The error is this:

I've tried with diferent files, all of them Spine examples, not my own. Also, I have Spine lisenced

image

@f0nar
Copy link
Contributor Author

f0nar commented Mar 2, 2024

I will try again @LousyMolars and @f0nar , but I'm on desktop (Win) and have the pro version, so we can rule that out. The error is this:

I've tried with diferent files, all of them Spine examples, not my own. Also, I have Spine lisenced

image

Could you attach here the files you are trying to load?

@Onnevan
Copy link

Onnevan commented Mar 2, 2024

@f0nar of course:
vine-pro.zip

@Onnevan
Copy link

Onnevan commented Mar 2, 2024

I'm on Spine 4.1.24 professional and GDevelop 5.3.191, Windows 11

@f0nar
Copy link
Contributor Author

f0nar commented Mar 2, 2024

Everything is fine for me. I am able to load spine by selecting vine-pro.json file and then play it in preview

I see that it is called vine-pro.json in archive but you have selected vine.json on screenshot. Is there any difference?
I would appreciate if you share more details on how you do that. Maybe screen record

@Onnevan
Copy link

Onnevan commented Mar 2, 2024

@f0nar Oh, that's because I thought maybe the dash in the name was the problem (which I know has no sense) but I was just trying things. I can confirm the same error with vine-pro. It's very strange but I guess is just something on my side, I'll try whatever I can think of, like different files, directories and software versions. I'll do a screen record too

@Onnevan
Copy link

Onnevan commented Mar 2, 2024

@f0nar nevermind, I closed everything, started a project from scratch and everything works fine! thanks for the help, don't know what could be happening. is there any doc on how to use it?. Thank you for the great work!

edit: I got tha hang of it, I was lost because I thought every behaviour related to Spine would be under a Spine component but I realized the normal animation behaviours work with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏁PR almost ready: final fixes The PR is almost ready and needs final fixes and/or polishing before merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants