rstarks

Cross-posting this from the off-topic forum because I think it is potentially more on-topic than not and might be useful for some:

http://animagnum.com/projects/spine/SpineScale.zip

I made a quick and dirty tool that will adjust an exported JSON file in case you need to scale an entire animation to work with different sized assets. The swf will require some form of Flash Player in order to run as it currently does not work when run through a browser. The tool looks for a file named skeleton.json in the same directory as the swf. You can easily rename a file and then change it back when you're done. Enter in the scale value you want to multiply the object by and then click the scale button. You will be prompted to save a new file so the original remains untouched.

Here's an example of how it works:

I created some assets and an animation at one scale (1x) but needed to resize the animation for 2x. First I made 2x assets in Photoshop and then replaced the original assets in my /images/ folder. Then I used my tool to modify the JSON file and used a scale value of 2. This process multiplied all of the relevant values by 2 and then saved a copy of the original JSON. Back in Spine I clicked "Import Data..." and selected my modified JSON file. Then I pointed it to the directory with the resized images. This resulted in doubling the size of the animation I had previously been using.
rstarks
Сообщения: 5

Pharan

Nice. Should be useful until the Editor can do the same. Starting to create a skeleton is always so unnerving because, right now, big questions include "at what resolution should I work?" and "how big should this sprite be on screen?". Once you start working on a skeleton at a certain size, it's rather difficult to resize its 1 sizes. And for one reason or another, you may prefer everything to not be scaled at all or be scaled by a consistent number when loading the json into the engine.
This tool (or this functionality when it's part of the editor) could be a very good answer to this predicament.

I can't believe you made a tool like this using ActionScript. XD
Аватара пользователя
Pharan

Pharan
Сообщения: 5275

Shiu

That's pretty neat. Thanks for sharing! :) Nate handles when things are implemented so I can't really say when/if/how/where/when/what?! we can get around to putting it in Spine.
Аватара пользователя
Shiu

Shiu
Сообщения: 2231

Nate

Interesting tool. For others, note you can work in Spine at any resolution assets and at runtime use a set of assets with a different resolution without needing this tool. You might want to use this tool when you have a Spine project already and want to use different resolution assets in Spine.
Аватара пользователя
Nate

Nate
Сообщения: 8358

funyou

we do want this feature in spine, so we can change the size any time, because at the project startup we may not sure what is the best size of the charactor,
another use case is: design size 3000*2000, runtime size 960*640
funyou
Сообщения: 19

Shiu

You can design your art at 3000x2000 if you want and then import that into Spine. Then when exporting you can change your texture scale to something smaller.
For your use case it could be set to 0.32



At runtime you then scale your skeleton to the same size.
http://esotericsoftware.com/spine-using-runtimes#AtlasAttachmentLoader

json.scale = 0.32
Аватара пользователя
Shiu

Shiu
Сообщения: 2231

Nate

funyou писал(а):we do want this feature in spine, so we can change the size any time, because at the project startup we may not sure what is the best size of the charactor,
another use case is: design size 3000*2000, runtime size 960*640
As Shiu has shown, it's easy to use one size in Spine and a smaller or larger size at runtime. Also the feature has made it into Spine: export your project as JSON and be sure to check Nonessential data, then create a new project, click Import Data and you can change the scale there.
Аватара пользователя
Nate

Nate
Сообщения: 8358

sultan

How we judge that which value is correct for which resolution... ?
sultan
Сообщения: 5

Dmitry

rstarks, thank you very much!

Very helpful!

:) :) :)
Dmitry
Сообщения: 1

lothiack

Nate писал(а):...export your project as JSON and be sure to check Nonessential data, then create a new project, click Import Data and you can change the scale there.
Sorry for resurrecting this thread, but could you elaborate on this process?

I've got a PSD that was was done in the wrong scale. It has been exported using the photoshop plugin and animated in spine.
I must resize the PSD and Spine project to the correct scale without having to redo the whole thing. How can I fix my spine project after resizing the source PSD?

I've understood that, after re-exporting the resized assets, the process above would do that. Is that correct?
For the sake of clarity those were the steps I took:
-Resize PSD to 43% of its size and re-exported the images with the plugin.
-Exported the current spine project with nonessential data.
-Imported the json to a new project selecting 0.43 scale.
-Set the images folder to the newly exported one with the correct scale.
-Failed. The scales were wrong and other things seem out of place. Mostly meshes I guess. :'(
lothiack
Сообщения: 6

Erikari

Hi lothiack, the process is correct! pay attention, if you save the project where an "images" folder is already present, but in the wrong size, it might wreck your meshes. You could simply rename the old images folder to "images-small" or something of the sort so that Spine won't automatically load those again.
Аватара пользователя
Erikari

Erikari
Сообщения: 1330

lothiack

Thanks for the confirmation and prompt reply.

Yes, the process did work when we tried it with another project and it also worked on the one mentioned in the post the second time we tried.

My guess is that we used the wrong source PSD the first time and not the one that was actually used to generate the spine project we were trying to fix, so no wonder the end result was messed up.

This topic and those instructions deserve a better place to live. Are they written somewhere besides here? It was hard to find it.
lothiack
Сообщения: 6


Вернуться в Editor