Last active
November 3, 2015 16:51
-
-
Save rosslebeau/48d536185af3c9784b2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (command shift a) | |
if (selection.length() > 0){ | |
for (var i=0; i < selection.length(); i++) { | |
addExportSizes(selection[i]); | |
} | |
[doc showMessage:"Export Options Added"]; | |
} else { | |
var app = [NSApplication sharedApplication]; | |
[app displayDialog:"Anything selected :(" withTitle:"Exportabler"]; | |
} | |
function addExportSizes(layer) { | |
var iOSExportData = [{"format": "png", "scale": 0.5, "suffix": ""}, | |
{"format": "png", "scale": 1, "suffix": "@2x"}, | |
{"format": "png", "scale": 1.5, "suffix": "@3x"}, | |
{"format": "png", "scale": 0.5, "suffix": "_mdpi"}, | |
{"format": "png", "scale": 0.75, "suffix": "_hdpi"}, | |
{"format": "png", "scale": 1, "suffix": "_xhdpi"}, | |
{"format": "png", "scale": 1.5, "suffix": "_xxhdpi"}]; | |
var export_options = [layer exportOptions]; | |
var export_sizes = [export_options sizes]; | |
while ([export_sizes count] > 0) { | |
[[export_sizes firstObject] remove] | |
} | |
for (var i = 0; i < iOSExportData.length; i++) { | |
var size_data = iOSExportData[i]; | |
var size = [[layer exportOptions] addExportSize]; | |
[size setFormat:size_data.format]; | |
[size setScale:size_data.scale]; | |
[size setName:size_data.suffix]; | |
} | |
[[doc currentPage] deselectAllLayers]; | |
[layer select:true byExpandingSelection:true]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment