New** PSD to LUA +PNG exporter (using Director.lua)

Working on an exporter which uses director.lua as its template. Need to get a few tests on my own CS5 and CS4 at work but its coming along nicely.

http://www.youtube.com/watch?v=Af1-nSr0Tu0

Exports LUA files ready to be used with Director.lua and UI.lua
Exports PNG 32bit

Supports

  • _button_ - buttons
  • _default_ - button up state
  • _touch_ -button touched
  • Generates handlers and eventlistner code.
  • Generates images from normal layers
  • Turns PSD groups into CORONA groups
  • Merges Groups with _merge_ in the name as one image

Am planning on sharing if people of interested in it…

Features incoming include Spritesheet, video launcher buttons, metadata nesting in PSD layers (e.g. onclick:playsound:blip.mp3),entry tweens e.g onAddedToStage:tweenfrombottom[1.0]

@KevCJones [import]uid: 33265 topic_id: 8337 reply_id: 308337[/import]

Consider me interested.

I have been using the exporter provided by Corona, and there was a huge amount of hand editing involved to get things working with the latest UI class, and director.

While the editing would be acceptable for a couple of buttons, for a level select screen with 20 or more buttons, it is very painful.

Drop me a line if you want some testing.

mike at bluerocketlabs dot com [import]uid: 5317 topic_id: 8337 reply_id: 29772[/import]

Cheers Mike, will email as soon as I get my own preliminary SC4 and CS5 tests done this end (busy Monday morning at moment though)…expect something this week though.

I agree though, the other exporter is great if your brewing your own format though and just want coordinates. I just wanted to make something which was ideal if like me… you really like the structure director offers and want to have your PNGS ready to go in one click.

Yeah on a complicated PSD you could probably go and make a cup of tea while its saving the images, but is that such a bad thing :wink: [import]uid: 33265 topic_id: 8337 reply_id: 29793[/import]

That sounds interesting, i’ll test as well if you want.

chris at cl-apps dot com [import]uid: 33866 topic_id: 8337 reply_id: 29800[/import]

Yes, that’s will be useful. [import]uid: 9058 topic_id: 8337 reply_id: 29804[/import]

I look forward to it, Kev. [import]uid: 5317 topic_id: 8337 reply_id: 29822[/import]

So I only managed to get to do a quickest on CS5 before I left work but it worked after a couple of minor fixes. One being I forgot to force the units to pixels, the other which I need to do a device test tomorrow using it. If my CS4 and CS5 device tests go well I’m going to send out versions for closed group tests. I assume all those interested are CS3 and up. Any Android license holders? I have IOS only on work license. [import]uid: 33265 topic_id: 8337 reply_id: 29840[/import]

I also have an Android license. [import]uid: 5317 topic_id: 8337 reply_id: 29841[/import]

So I okay here is a version 0.0.3 going up on Github.

https://github.com/KevCJones/Photoshop-to-Corona-Exporter

I haven’t used Github before to maintain source like this, I’ve only ever used SVN but it seems similar so no accidental deletions yet :slight_smile:

Early testers can download the script plus the PSD which I’ve been messing around in. NOW I stress this is early days. I haven’t tested the following properly myself.

On device =/ I have iOS but work got busy this week so I thought I’d let others have a bash see if it worked well or if its a headache.

I should stress, I used the Director.lua and UI.lua from the monsters and ghosts demo. Updates after that haven’t been tested but if you look inside the script you will see how easy it will be for me to do, simple copy + paste and a few escape slashes for return carriages then put in the $injection_hooks.

I like to try and keep my code easy to read but I’m happy to show and tell any bits that don’t make sense.

Edit: Last minute thought I chucked in my CPM files for use with the simulator. Test build for 480x320px on landscape.

Please be vocal, good or bad :slight_smile: lets get this thing on the road to being noticed…

[import]uid: 33265 topic_id: 8337 reply_id: 29925[/import]

Hello TechnicalSamuraiMac,

Why you are generating “newImage(…)” objects and not “newImageRect(…)” objects for retina support?

Regards.
Francisco.
[import]uid: 11749 topic_id: 8337 reply_id: 29978[/import]

Both iOS/Android tester here.
Just tried exporting your PSD with Photoshop CS5(mac) and it just crashes Photoshop unexpectedly…

It exports a PNG (backgroundimg.png) to export/images/ then crashes out.

Am I the only one to suffer this so far?

I’ll try again in a bit:) [import]uid: 33866 topic_id: 8337 reply_id: 29979[/import]

We are also facing the same problem as cl-apps but in Photoshop CS4

Any suggestions ? [import]uid: 40579 topic_id: 8337 reply_id: 29980[/import]

We are also facing the same problem as cl-apps but in Photoshop CS4

Any suggestions ? [import]uid: 40579 topic_id: 8337 reply_id: 29981[/import]

Hello,

I’m very interested in this exporter, looks great!
But I have the same problem as cl-apps and thewebdepot, the photoshop crashes after exporting “backgroundimg.png”…

[import]uid: 44013 topic_id: 8337 reply_id: 30015[/import]

Put it down to learning Corona as I create the exporter. Will read up and make the edits in the next version.

Cheers [import]uid: 33265 topic_id: 8337 reply_id: 30018[/import]

I’m going to reboot into my Mac now and run a couple of tests… I should of mentioned that at the moment I have been doing more in my windows machine than mac. Its probably just a slash thing… Macs are strict. [import]uid: 33265 topic_id: 8337 reply_id: 30019[/import]

Thank you, TechicalSamuraiMac!

Regards! [import]uid: 44013 topic_id: 8337 reply_id: 30020[/import]

Okay so a quick test is showing me its because the MAC must use a different script for closing a new document… when i remove the exporting stages for the PNG’s it runs through. I will see if I can patch it quickly and spot the difference between the MAC and Windows JSX for close… [import]uid: 33265 topic_id: 8337 reply_id: 30022[/import]

EDIT : Perfect Fix - found the close function syntax…

Fixed but having to try and setup GIT on mac to push the fix so if this keeps dipping me around you can make the fix yourself to the script.

I would only try this if you can read script. Use Ctrl-F to find the code I present below. Search for "charIDToTypeID( “Cls " );”

Find the commands (there are two like this) in the image exporting functions (single and merge versions)

// =======================================================  
 var id247 = charIDToTypeID( "Cls " );  
 var desc43 = new ActionDescriptor();  
 var id248 = charIDToTypeID( "Svng" );  
 var id249 = charIDToTypeID( "YsN " );  
 var id250 = charIDToTypeID( "N " );  
 desc43.putEnumerated( id248, id249, id250 );  
 executeAction( id247, desc43, DialogModes.NO );  

and annotate them out using /* */

underneath the lines you see here below

 // =======================================================  
 /\*var id311 = charIDToTypeID( "Cls " );  
 var desc50 = new ActionDescriptor();  
 var id312 = charIDToTypeID( "Svng" );  
 var id313 = charIDToTypeID( "YsN " );  
 var id314 = charIDToTypeID( "N " );  
 desc50.putEnumerated( id312, id313, id314 );  
 executeAction( id311, desc50, DialogModes.NO );\*/  
  
 app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);  
 app.activeDocument = dom;  
  

Voila hope this fixes CS5 works on CS4 mac. [import]uid: 33265 topic_id: 8337 reply_id: 30025[/import]

Unfortunately didn’t work in CS5… still the same crash at the same point. [import]uid: 33866 topic_id: 8337 reply_id: 30031[/import]