Putting It All Together: Automated Asset Generation
It is possible to combine Generator capabilities to automatically produce a large number of assets for your SmartStudio applet project. This is particularly helpful when you need to generate 1x and 2x versions of your assets.
Let’s assume that you have created your content at 1x and tagged your layers and groups with file format extensions that Generator listens for. To be sure that your applet displays as expected on a Retina device, you will also need a 2x version of each asset. Generator will let you automatically scale your 1x assets to create 2x assets, name the assets correctly, and store them in separate sub-folders to keep everything organized.
To do this, you will make use of a ‘default layer’.
Purpose of the Default layer
Adobe Generator allows users to specify global default image asset specifications, affecting every layer and/or group tagged with file format extension.
To specify global default asset specifications, an empty layer named default needs to be created, preferably on top of the layers stacking order. Syntax like naming applied to the default layer which activates specific actions (eg. scaling, folder creation etc.) will then affect all the layers in the document.
- Use the word ‘default’ to begin the layer name.
- Specify a sub-folder for assets by adding a name for the folder followed by a ‘/’ character:
- Specify a transformation percentage for assets in a sub-folder by adding the percentage before the folder name (include a space between the ‘%’ and the folder name):
- 200% 2x_Images/ will scale all assets to 200% (2x) and place them in the ‘2x_assets’ folder.
- Add a file name suffix to assets by adding it after the folder name (include a space between folder name and suffix):
- 200% 2x_Images/ @2x will transform all assets to 200% (2x), add the suffix ‘@2x’ at the end of the file name (before the extension), and place the output in the ‘2x_assets’ folder.
- Using this naming convention, Generator would generate an asset from layer called ‘blue_btn.png’, scale it to 200%, name it ‘email@example.com’, and place it in the ‘2x_assets’.
- Combined Default layer name syntax, which will allow you to automatically scale and copy assets to appropriate folders, is as follows:
- default 200% 2x_Images/ @2x, 1x_Images/