Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
For running conversation goto http://developer.anscamobile.com/forum/2011/03/28/new-psd-lua-png-exporter-using-directorlua /* The MIT License Copyright (c) 2011 Kevin C Jones aka @KevCJones aka firstname.lastname@example.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Corona Director Exporter ---------------------------------- I will assume people right now know how to drop run a JSX. Google it. You will see something about puttin it into <Adobe Dir>\Presets\Scripts and relaunching Photoshop.. there i practically did it for you :) Converts a layered PSD into a main.lua + and scenes along with an assets folder for all images used in the layout as seperate usable assets. I use templates in the script which are direct copies and make good use of the String.replace(what,with) js function. As we grow these $hooks to inject code can be easily expanded to support more and more complex jobs. The challenge will be finding nice ways to put them into the layers. Currently we make good use of keyterms in the name to help the exported identiy what to treat that layer as. These keyterms are removed once detected and not included in filenames and variable names for the objects they generate. e.g, myscene_scene strips _scene_ and calls the local scene file 'myscene.lua'. Keyterms: + _scene_ in layers on the root is the scene files themselves. + _button_ in group layers will beging creating a button in the scene and look inside the group for : - _default_ for the image used as the default state of the button (UI.lua) - _touch_ for the touch image. + _merge_ on groups will merge normal group layers into flat images and create single local variables to reference the image Note : If _touch_ or _default_ is the name of a group not a layer then that group is merged and saved as a single image as you would expect. Contributors ----------------- So far just me :) but I hope to involve everyone. These things tend to do the best when they have a following and people care about the code as well. I hope that we can keep it clean, readable and maintainable as we grow it, I will be adding it into Github sooner rather than later. With any luck the great guys at Corona will see fit to bundle it in the installer package and offer us all promotion codes for our efforts ;) ;) such rewards are merely a bonus... To Do: --------- - Add Sprite Sheet / MovieClip support - Add Basic Entry Animations (tweenfrombottom, top, left, right etc) Known Issues ------------------- - I added padding because in Corona i was seeing a glitch in the simulator for left hand edges which touched the screen. We should test with and without this on hardware to see if it is purely a scaling issue on the simulator or if there is an issue with the rendering, Padding is all sides and will auto offset the X,Y coord by -padding, -padding to compensate the invisible bordering. - Duplicated Graphics - I added code to stop accidental occurances but then there are cases where i want it to happen... will added in about condition to make this work neatly. */