Update After Effects plugin to support non-WAVE audio files

This commit is contained in:
Daniel Wolf 2018-09-01 20:48:13 +02:00
parent c93da48c77
commit bf044ca127
2 changed files with 7 additions and 10 deletions

View File

@ -26,5 +26,5 @@ On **OS X**, that directory is usually `Applications/Adobe After Effects <versio
## How to use ## How to use
In After Effects, select *File > Scripts > Rhubarb Lip Sync.jsx*. That will open a dialog window where you can specify the WAVE file with the dialog recording and a number of other options. To get information about any input field, just hover above it with your mouse and you'll see a tooltip. In After Effects, select *File > Scripts > Rhubarb Lip Sync.jsx*. That will open a dialog window where you can specify the audio file with the dialog recording and a number of other options. To get information about any input field, just hover above it with your mouse and you'll see a tooltip.

View File

@ -266,13 +266,10 @@ function selectByTextOrFirst(itemControl, text) {
} }
} }
function getWaveFileProjectItems() { function getAudioFileProjectItems() {
var result = toArrayBase1(app.project.items).filter(function(item) { var result = toArrayBase1(app.project.items).filter(function(item) {
var isAudioFootage = item instanceof FootageItem && item.hasAudio && !item.hasVideo; var isAudioFootage = item instanceof FootageItem && item.hasAudio && !item.hasVideo;
if (!isAudioFootage) return false; return isAudioFootage;
var isWaveFile = item.file && item.file.exists && item.file.name.match(/\.wav$/i);
return isWaveFile;
}); });
return result; return result;
} }
@ -322,7 +319,7 @@ function createDialogWindow() {
}), }),
value: DropDownList({ value: DropDownList({
helpTip: 'An audio file containing recorded dialog.\n' helpTip: 'An audio file containing recorded dialog.\n'
+ 'This field shows all audio files of type .wav that exist in ' + 'This field shows all audio files that exist in '
+ 'your After Effects project.' + 'your After Effects project.'
}) })
}), }),
@ -400,7 +397,7 @@ function createDialogWindow() {
}); });
// Add audio file options // Add audio file options
getWaveFileProjectItems().forEach(function(projectItem) { getAudioFileProjectItems().forEach(function(projectItem) {
var listItem = controls.audioFile.add('item', getItemPath(projectItem)); var listItem = controls.audioFile.add('item', getItemPath(projectItem));
listItem.projectItem = projectItem; listItem.projectItem = projectItem;
}); });
@ -618,8 +615,8 @@ function createDialogWindow() {
frameRate) frameRate)
{ {
// Find an unconflicting comp name // Find an unconflicting comp name
// ... strip extension .wav, if present // ... strip extension, if present
var baseName = audioFileFootage.name.match(/^(.*?)(\.wav)?$/i)[1]; var baseName = audioFileFootage.name.match(/^(.*?)(\..*)?$/i)[1];
var compName = baseName; var compName = baseName;
// ... add numeric suffix, if needed // ... add numeric suffix, if needed
var existingItems = toArrayBase1(targetProjectFolder.items); var existingItems = toArrayBase1(targetProjectFolder.items);