• Runtimes
  • Setup rotation not working when exporting to older versions (4.0) during runtime

Hello, I am using Monogame runtime 4.0 and I am exporting my animations to 4.0 with the newest Spine build. This problem started just today, I have my animations with an initial rotation for the root bone in the setup, but during runtime they stay in the same position as if they had 0 rotation. Translate and scale appear to be unaffected. I already double checked, and no, it is not the animation I am loading, they don't have any rotation keyframes that would reset the animation rotation from the setup.

I also checked my code and I am not rotating the skeleton. Resetting the skeleton shouldn't be the case neither, because it is rotated in the setup.

On Spine:

During runtime:

I assume this is a bug introduced to the newest version of Spine? This was not a problem yesterday.

Thank you, any help is appreciated.

Related Discussions
...

It seems like the issue you're experiencing is related to exporting your animations from a newer version of Spine to an older version (4.0) and then using them in the Monogame runtime. This kind of problem can occur due to version mismatches or bugs in the runtime.

From the provided contexts, here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Ensure Correct Version Export: Make sure you are exporting your skeleton data correctly for the 4.0 runtime. The export should be done in the 4.0 format, not in a downgraded format like "4.0-from-4.1.xx". This is crucial as exporting in a downgraded format is meant for project downgrading, not for runtime use.

  2. Check for Runtime Updates: Ensure that you are using the latest version of the Monogame runtime for Spine 4.0. Sometimes, bugs are fixed in newer runtime versions, so updating might resolve the issue.

  3. Skeleton Viewer: Test your exported skeleton in the Skeleton Viewer. If the rotation works correctly in the Skeleton Viewer, the issue might be with the Monogame runtime.

  4. Clean Skeleton Setup: Verify that your skeleton setup is clean. Issues like disabled "Inherit Rotation" or negative scaling can cause unexpected behavior. Ensure that the root bone and other bones are set up correctly.

  5. Contact Support: If none of the above steps resolve the issue, it might be a bug introduced in the latest Spine version. In such cases, providing your project files to the support team can help them identify and fix the issue.

Here are some relevant links and references from the contexts:

If you continue to experience issues, you might want to consider reaching out to the support team with your project files for further assistance.

Alright I checked all of these and they don't seem to be the case, it does appear correctly in the Skeleton Viewer, so it is definitely a runtime problem, but it wasn't happening two days ago, so it is something introduced in how the file is being exported to 4.0

My question now is, how does one export to the "Correct version". If I go to Export and choose "4.0" the .json still has the "spine": "4.0-from-4.1-from-4.2.32" in it. I can't open this file with older versions of Spine because I already saved it with the newer ones.

It's not recommended to export to an older version and use the JSON directly in the older runtime. When exporting to an older version it's intended that you'd import the JSON into the older version. You'd then export from the older version and use that data. That'd be the "correct" way.

The reason it's not recommended is that your data may have issues when exporting to older versions. You should import it into the old version and review the project to make sure everything is OK. Many things can go wrong when saving the older JSON, most importantly data loss from the older version not having functionality used in the newer version. For example, if you use physics in 4.2 then export JSON to 4.0 and import that into 4.0, you won't have physics. In other cases it's worse, eg saving < 4.0 versions will lose all curves due to those versions not being able to support how 4.0+ stores and applies curves. There may be bugs in the conversion to older versions, as saving older versions is more of an emergency recovery feature. It's not a common workflow and so with fewer people using it, it's more likely to have problems no one has noticed yet. Finally, the old JSON data may not be exactly the same as what the older version exports, for various reasons.

If you are using 4.0 runtimes, then you should use the latest 4.0 editor, both to animate and export. This has fewer potential problems and ensures your exports will work correctly. To do that, export your JSON to 4.0, run the latest 4.0 editor, import the data into 4.0, and save a 4.0 .spine file. From there keep using 4.0 until you are ready to update your runtimes.

Alternatively, you could update your runtimes to 4.2 and then just export from 4.2. This is likely better, as you get physics and other new features.

The reason Spine has the ability to save to older version data at all is to make it easier to get that data in a format that can be imported into older versions. It used to require using a command line tool called JsonRollback and was generally a big pain.

All that said, I'm not sure why it would go from not working to working. I don't believe we made a chance related to this recently. If it works in Skeleton Viewer then in indeed could be a runtime problem (albeit for a not quite officially support use case). It may be interesting to see if importing into 4.0 and exporting from 4.0 fixes the issue.

Hello, I just did the entire exporting the .json into the 4.0 version and then creating a new export with it. It indeed fixed the problem of the initial setup rotation on the root bone. I think that pretty much confirms that there is a bug in the way 4.2 is exporting to 4.0 and not a runtime bug. The reason I'm sticking to 4.0 is because it is quite time consuming to update runtimes in Monogame. We'll do it eventually, but for now we just want to get our project done.

After exporting with 4.0, rotation in setup is preserved.

Thank you very much.

Interesting. Can you post the 4.0 from 4.2 JSON and the from 4.0 JSON? Comparing them should explain the rotation difference.

You could use the CLI to write a script to perform your exports. In general that is a good idea, as you'll need to re-export all projects to change runtime versions. We have scripts to help:
EsotericSoftware/spine-scriptstree/master/export

Sorry for the late response, I did further digging and after some hours I found that I was indeed resetting the root bone rotation in my code under some very specific conditions. I compared both files and they are generated the same. Sorry for wasting your time, and thank you. I will be triple check everytime from now on.

  • Nate оценил это.