Last active
April 27, 2016 21:25
-
-
Save caiodv/0c4a0aaa66c71b1519257f2c5341fcc2 to your computer and use it in GitHub Desktop.
Exports a json with all the markers in the selected compositions in After Effects. (exporting only the timestamp, but can be easily modified to export the others properties from the marker)
This file contains hidden or 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
var jsonText = '{"markers":['; | |
var length = app.project.selection.length; | |
for(var i = 0; i < length;i++){ | |
var activeItem = app.project.selection[i]; | |
var tempNull = activeItem.layers.addNull(activeItem.duration); | |
var tempPos = tempNull.property("ADBE Transform Group").property("ADBE Position"); | |
tempPos.expression = "x = thisComp.marker.numKeys;[x,0];"; | |
var result = tempPos.value[0]; | |
jsonText += '{ "id":"' +activeItem.name+ '", "hits": [' ; | |
for (x = 1; x <= result; x++) { | |
tempPos.expression = "x = thisComp.marker.key(" + x + ").time;[x,0];"; | |
jsonText += tempPos.value[0]; | |
if(x != result) { jsonText += ','; } | |
} | |
jsonText += ']}' | |
if(i != length-1){ jsonText += ','; } | |
} | |
jsonText += ']}' | |
var name = 'markers'; | |
var file = new File("./" + name + ".json"); | |
file.remove(); | |
file.open("w", "TEXT"); | |
file.lineFeed = "\n"; | |
file.write(jsonText); | |
file.close(); | |
tempNull.remove(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment