Git Product home page Git Product logo

photoshop-to-corona-exporter's Introduction

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 [email protected]

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.
	
	
	
	
*/

photoshop-to-corona-exporter's People

Contributors

kevcjones avatar sponno avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.