// Polyfill for Object.assign "function"!=typeof Object.assign&&(Object.assign=function(a,b){"use strict";if(null==a)throw new TypeError("Cannot convert undefined or null to object");for(var c=Object(a),d=1;d>>0;if("function"!=typeof r)throw new TypeError(r+" is not a function");for(arguments.length>1&&(t=arguments[1]),n=new Array(i),o=0;o>>0;if("function"!=typeof r)throw new TypeError;for(arguments.length>1&&(e=t),n=0;n>>0,o=arguments[1],e=0;e>>0;if("function"!=typeof r)throw new TypeError;for(var i=[],o=arguments.length>=2?arguments[1]:void 0,n=0;n>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;d>>0;if(0===n)return!1;for(var i=0|t,o=Math.max(i>=0?i:n-Math.abs(i),0);o 2; if (!multipleControls) { group.children[1].size.width = maxValueWidth; } }); window.layout.layout(true); }; var updating = false; function update() { if (updating) return; updating = true; try { // Handle auto frame rate var autoFrameRate = controls.autoFrameRate.value; controls.frameRate.enabled = !autoFrameRate; if (autoFrameRate) { // Take frame rate from mouth comp var mouthComp = (controls.mouthComp.selection || {}).projectItem; controls.frameRate.text = mouthComp ? mouthComp.frameRate : ''; } else { // Sanitize frame rate var sanitizedFrameRate = controls.frameRate.text.match(/\d*\.?\d*/)[0]; if (sanitizedFrameRate !== controls.frameRate.text) { controls.frameRate.text = sanitizedFrameRate; } } // Store settings var settings = { audioFile: (controls.audioFile.selection || {}).text, dialogText: controls.dialogText.text, mouthComp: (controls.mouthComp.selection || {}).text, extendedMouthShapes: { g: controls.mouthShapeG.value, h: controls.mouthShapeH.value, x: controls.mouthShapeX.value }, targetFolder: (controls.targetFolder.selection || {}).text, frameRate: Number(controls.frameRate.text), autoFrameRate: controls.autoFrameRate.value }; writeSettingsFile(settings); } finally { updating = false; } } // Handle changes update(); controls.audioFile.onChange = update; controls.dialogText.onChanging = update; controls.mouthComp.onChange = update; controls.mouthShapeG.onClick = update; controls.mouthShapeH.onClick = update; controls.mouthShapeX.onClick = update; controls.targetFolder.onChange = update; controls.frameRate.onChanging = update; controls.autoFrameRate.onClick = update; // Handle animation controls.animateButton.onClick = function() { // TODO: validate app.beginUndoGroup('Rhubarb Lip-Sync'); window.close(); // TODO: animate app.endUndoGroup(); }; // Handle cancelation controls.cancelButton.onClick = function() { window.close(); }; return window; } function checkPreconditions() { if (!canWriteFiles()) { Window.alert('This script requires file system access.\n\n' + 'Please enable Preferences > General > Allow Scripts to Write Files and Access Network.', 'Rhubarb Lip-Sync', true); return false; } return true; } if (checkPreconditions()) { createDialogWindow().show(); }