fix(premiere-plugin): suppress importFiles UI prompts + 60s timeout guard
app.project.importFiles() can deadlock if a hidden Premiere modal appears (off-screen, behind window, etc) — the evalScript callback never fires and the panel spinner hangs forever. Two changes: 1) Pass suppressUI=true to all five importFiles call sites (main.js inline IIFE + 4 in premiere.jsx). Premiere proceeds even if it would have prompted (audio sample rate, project link, scale-to-frame, etc). 2) Wrap importFileToPremiereProject in a 60s timeout race so even if importFiles does block, the panel surfaces a real error instead of leaving the spinner stuck. Bumps to v1.2.2.
This commit is contained in:
parent
e7eff0ee8c
commit
e3afe38697
3 changed files with 20 additions and 6 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<ExtensionManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
ExtensionBundleId="net.wilddragon.dragonflight.panel"
|
||||
ExtensionBundleName="Wild Dragon MAM"
|
||||
ExtensionBundleVersion="1.2.1"
|
||||
ExtensionBundleVersion="1.2.2"
|
||||
Version="7.0">
|
||||
<ExtensionList>
|
||||
<Extension Id="net.wilddragon.dragonflight.panel" Version="1.0" />
|
||||
|
|
|
|||
|
|
@ -1964,6 +1964,17 @@ function importFileToPremiereProject(filePath) {
|
|||
return new Promise(function (resolve, reject) {
|
||||
var safePath = filePath.replace(/\\/g, '\\\\');
|
||||
|
||||
// Premiere can deadlock on importFiles() if a hidden prompt appears
|
||||
// (off-screen modal, etc.). The evalScript callback then never fires.
|
||||
// Race the import against a 60s timeout so the user sees an error
|
||||
// instead of a frozen spinner.
|
||||
var done = false;
|
||||
var timer = setTimeout(function () {
|
||||
if (done) return;
|
||||
done = true;
|
||||
reject(new Error('ExtendScript importFiles() did not return within 60s — Premiere may have a hidden dialog'));
|
||||
}, 60000);
|
||||
|
||||
var script = [
|
||||
'(function() {',
|
||||
' var result = { success: false, message: "" };',
|
||||
|
|
@ -1977,7 +1988,7 @@ function importFileToPremiereProject(filePath) {
|
|||
' result.message = "File not found: ' + safePath + '";',
|
||||
' return JSON.stringify(result);',
|
||||
' }',
|
||||
' app.project.importFiles(["' + safePath + '"]);',
|
||||
' app.project.importFiles(["' + safePath + '"], true);',
|
||||
' result.success = true;',
|
||||
' result.message = "Imported successfully";',
|
||||
' } catch (e) {',
|
||||
|
|
@ -1988,6 +1999,9 @@ function importFileToPremiereProject(filePath) {
|
|||
].join('\n');
|
||||
|
||||
csInterface.evalScript(script, function (resultStr) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
clearTimeout(timer);
|
||||
try {
|
||||
var parsed = JSON.parse(resultStr);
|
||||
if (parsed.success) resolve(parsed);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ function importFileToProject(filePath) {
|
|||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
app.project.importFiles([filePath]);
|
||||
app.project.importFiles([filePath], true);
|
||||
|
||||
result.success = true;
|
||||
result.message = "File imported successfully";
|
||||
|
|
@ -96,7 +96,7 @@ function insertClipToSequence(filePath, trackIndex) {
|
|||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
app.project.importFiles([filePath]);
|
||||
app.project.importFiles([filePath], true);
|
||||
|
||||
var file = new File(filePath);
|
||||
var fileName = file.displayName;
|
||||
|
|
@ -596,7 +596,7 @@ function relinkClipToNewMedia(clipInstanceId, newMediaPath) {
|
|||
}
|
||||
|
||||
// Import the new media file into the project
|
||||
app.project.importFiles([newMediaPath]);
|
||||
app.project.importFiles([newMediaPath], true);
|
||||
|
||||
// Replace the clip source with the new project item
|
||||
var fileName = newFile.displayName;
|
||||
|
|
@ -812,7 +812,7 @@ function replaceMediaPath(oldPath, newPath) {
|
|||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
app.project.importFiles([newPath]);
|
||||
app.project.importFiles([newPath], true);
|
||||
|
||||
var newName = oldFile.displayName;
|
||||
var rootBin = app.project.rootItem;
|
||||
|
|
|
|||
Loading…
Reference in a new issue