(function(thisObj) { buildUI(thisObj); function buildUI(thisObj) { // JSON handler "object"!=typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(i=rep.call(e,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;r 0) { trackName.removeAll(); } stdOut = system.callSystem("python \"Scripts\\ScriptUI Panels\\MMaker_RPPJSON.py\" \"" + rppFile.fsName + "\"") jsonData.text = stdOut; trackNames = getObjectKeys(JSON.parse(jsonData.text)); for (var i = 0; i < trackNames.length; i++) { currentTrack = trackNames[i]; currentTrack = currentTrack.substring(1); trackName.add("item", currentTrack); } } }); runButton.addEventListener("mousedown", function(evt) { try { app.beginUndoGroup("Add markers"); var comp = app.project.activeItem; jsonParsed = JSON.parse(jsonData.text); if (trackName.selection != null) { flipItem = "!" + trackName.selection.text; } else { alert("Please select a track."); return; } if (isNaN(parseInt(frameOffset.text))) { alert("Please enter a valid number for the frame offset."); return; } else { timeConst = parseInt(frameOffset.text) / (1/comp.frameDuration); } if (typeof jsonParsed[flipItem] != 'undefined') { for (var i = 0; i < jsonParsed[flipItem].length; i++) { newMarker = new MarkerValue(""); marker_params = {}; newMarker.label = 0; marker_params.label = newMarker.label; newMarker.setParameters(marker_params); comp.markerProperty.setValueAtTime(jsonParsed[flipItem][i] + timeConst, newMarker); } } else { alert("Track does not exist!"); return; } app.endUndoGroup(); } catch(e) { alert(e); } }); aboutButton.addEventListener("mousedown", function(evt) { alert("Script by MMaker\nmmaker.moe"); }); } // https://gist.github.com/ltfschoen/79ab3e98723e61660117 var getObjectKeys = function(associativeArrayObject) { var arrayWithKeys=[], associativeArrayObject; for (key in associativeArrayObject) { // Avoid returning these keys from the Associative Array that are stored in it for some reason if (key !== undefined && key !== "toJSONString" && key !== "parseJSON" ) { arrayWithKeys.push(key); } } return arrayWithKeys; } })(this);