Trilex Posted October 10, 2023 Posted October 10, 2023 Hello forum members, I'm facing a challenge while working on my game character, which I design in Affinity Designer and then import into Spine using the Spine JSON export settings. My problem is that I don't know how to set the origin correctly. To explain in more detail: I have numerous artboards in my Affinity Designer project. When I export my character and paste it into Spine, I have to manually move it to coordinates 0.0. Not only is this step time-consuming, but it can also be inaccurate. In the YouTube video I linked you can see how the origin is set in Photoshop so that the sprites are shown in the correct place when exported I would be extremely grateful for any suggestions for solutions and tips on how I can optimize this process. Additionally, if you have general recommendations for the Affinity Designer to Spine workflow, please share them with me. Many thanks in advance! Best regards, Trilex Quote
Hangman Posted October 10, 2023 Posted October 10, 2023 Hi @Trilex and welcome to the forums, It looks as though the Spine JSON export is using the bottom left corner of the first artboard as its X:0, Y:0 positioning and the centre of the exported slice as its origin and is ignoring the origin for each individual artboard which may explain the issue you're seeing if that is indeed what's happening for you and suggests it would only ever honour the origin for the first artboard... I don't know whether this is considered a bug or is expected behaviour but considering that each individual artboard does set its own origin at the top left of the artboard this feels like a bug but hopefully, someone from the moderation team can clarify. DesignDex and Trilex 2 Quote Affinity Designer 2.6.3 | Affinity Photo 2.6.3 | Affinity Publisher 2.6.3 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse
Trilex Posted October 10, 2023 Author Posted October 10, 2023 It looks like your reasoning about origin positioning is correct. I copied the character into a new document that is exactly the same size as the character itself (its a Artboard). When importing into Spine, I observed exactly what you described before: the origin point is pinned to the bottom left corner point of the artboard, as shown in the image. Since this behavior may not be as expected, it would be great if you could let me know if there is a way to work around this issue or if there is a solution to it. Your assessment and advice are very helpful. Quote
Staff Lee D Posted October 11, 2023 Staff Posted October 11, 2023 @TrilexWe do an issue logged with the developers that relates to the x/y position with the Spline JSON option, I can add your report to that. Bryan Rieger and Trilex 2 Quote
Trilex Posted October 11, 2023 Author Posted October 11, 2023 @Lee DYes, very much! It would be great if in the future you could position the origin point yourself or if there were certain presets. Quote
Hangman Posted October 11, 2023 Posted October 11, 2023 @Trilex, In the meantime, you could perhaps use something like Brackets https://brackets.io/ or Phoenix Code Editor (an online version of Brackets) https://phcode.dev/ to open your exported Spine JSON file and use the Find and Replace RegEx functionality to find the incorrect Origin Values and replace with the correct Origin Values... Trilex 1 Quote Affinity Designer 2.6.3 | Affinity Photo 2.6.3 | Affinity Publisher 2.6.3 MacBook Pro M3 Max, 36 GB Unified Memory, macOS Sonoma 14.6.1, Magic Mouse HP ENVY x360, 8 GB RAM, AMD Ryzen 5 2500U, Windows 10 Home, Logitech Mouse
Trilex Posted October 11, 2023 Author Posted October 11, 2023 @HangmanThanks for the tip! I will work with the brackets aplikation. Thanks for your time and for the effort! Hangman 1 Quote
DesignDex Posted May 10 Posted May 10 I am using Affinity Designer version 2.6.2, and it seems I'm also running into issues with the origin being off in my JSON File. I'm not using any artboards and have done some simple tests of exporting rectangle tool shapes as shown below. But I'm still seeing mismatched coordinates in the final Spine JSON file. Manually correcting the coordinates for all slices across several game characters would be very time-consuming, so I hope there's a fix for this. Quote
DesignDex Posted May 10 Posted May 10 I figured out a Python solution to convert the coordinates back to being relative to the top-left corner of the document and slices. It's for Blender though, but here are the formulas I used in case someone needs it for another program: SliceTopLeftCornerX = abs(JsonX - SliceWidth/2) SliceTopLeftCornerY = abs(JsonY + SliceHeight/2 - DocHeight) Thanks @Hangman for pointing out that the JSON coordinates are based on the bottom-left corner of the document. Also on my machine, it appears each slice's individual origin is their centre instead of their top left corner. I'm unsure if these measurement points are a feature or a bug, but regardless, I feel it would be potentially better if we could customize which origins to use from the export persona. Hangman 1 Quote
Recommended Posts
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.