Hello Guest

Author Topic: Code generate SpriteSheet?  (Read 9136 times)

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Code generate SpriteSheet?
« on: February 02, 2016, 03:57:51 pm »
Hi,

We are developing a new UI workflow and as part of that we'd really like to be able to automate the generation of SpriteSheets via C# editor scripts.

Looking through the forums I have found a few interesting references but wanted to check these are still relevant and if there is any new details I should be aware of?

tk2dSpriteCollectionEditorSpriteSheetView.s seems to be my friend :)
http://2dtoolkit.com/forum/index.php/topic,3381.msg16320.html#msg16320
http://2dtoolkit.com/forum/index.php/topic,644.msg3091.html#msg3091

Thanks!
Ricky

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Code generate SpriteSheet?
« Reply #1 on: February 02, 2016, 10:35:10 pm »
There is another bit of code that you might find interesting. This lets you do some pretty interesting things, but is officially unsupported.
http://2dtoolkit.com/forum/index.php/topic,4546.0.html

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Code generate SpriteSheet?
« Reply #2 on: February 03, 2016, 09:02:01 am »
Excellent! That looks very interesting. I notice the link to documentation is 404 now, is this documentation available anywhere else?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Code generate SpriteSheet?
« Reply #3 on: February 03, 2016, 10:28:22 am »
Fixed the link.

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Code generate SpriteSheet?
« Reply #4 on: February 03, 2016, 10:38:19 am »
Thank you. This looks very close to what we need. Only thing I had to do was update tk2dDemoDataDrivenCollection.cs
Settings.InputPath = "Unsupported/DataDefinition/Demo";

Then works great, going over the code now to get a better understanding of how it all works. Thanks again, you have saved me several days work!

fizzd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Code generate SpriteSheet?
« Reply #5 on: February 09, 2016, 02:51:09 pm »
Hi Ricky or Unikron,

I'm very hopeful of the Data Driven workflow. What I wanted to do was to save time making animations, and this is perfect. However, the only thing that is missing from the docs is how to use SPRITESHEETS in the workflow. From what I understand if I create the spritesheets using the usual method, I can't make animations from them via the Data Driven approach.

(I can't test it yet because I've only just submitted my invoice number to you guys to get access to the downloads)

Is there a quick way of adding spritesheets to the Data Driven scripts? Ricky if you have coded up a solution I would really appreciate if I could use them!

fizzd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Code generate SpriteSheet?
« Reply #6 on: February 15, 2016, 04:11:37 am »
Hi, still stuck on this problem. Wish I realised how cumbersome it is to add a lot of animations in 2dtoolkit. There was no way for me to know before shelling out the money for it though :/ A suggestion I have is the ability to shift-select multiple frames in the list in the Sprite Collection window, right click and select 'create animation'. And have a dialogue box letting you input the name of the animation, and choose the SpriteAnimation library. That would save hours of work compared to the dropdown method right now!

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Code generate SpriteSheet?
« Reply #7 on: February 26, 2016, 12:20:06 pm »
Hi again unikronsoftware!

Have an interesting issue with our process. I have just tried using some data that does not fit into the target atlas size. There is a popup that explains the issue but no logging, I've looked at the logging produced by the "tk2dDataDefinitionBuilder.Build" method but it does not state any issues. Ideally our setup will be to use this our Jenkins continuous integration, using log output or editor scripts to inform and handle errors in our input data.

My question to you is where/how could I catch this and other errors? I notice that the Prefabs get built but the texture does not so I can use this to track that something went wrong and investigation is required?

Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Code generate SpriteSheet?
« Reply #8 on: March 02, 2016, 09:38:04 am »
Hi Ricky,

So... that was one of the reasons this never got promoted to a full supported feature. There were lots of things that needed to be done to polish it up for production and I didn't have the time to do it.

Simplest way I can think of to work around it is to wrap all the DisplayDialog calls so they Debug.LogError as well. I'll try to fit that in the next release but no promises, I would recommend patching locally

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Code generate SpriteSheet?
« Reply #9 on: March 02, 2016, 10:00:58 am »
Thanks for the info.

I'll add this to my back log too ;)