From e46bbad5e7c37de875b89e3a7c38ee1b44419583 Mon Sep 17 00:00:00 2001 From: Chris Hocking Date: Wed, 16 Mar 2022 20:30:17 +1100 Subject: [PATCH] Timeline Batch Export Improvements - Check to see if the chosen Destination Preset actually exists in the menubar. - Changed the `.editorconfig` to use spaces as the indent style to hopefully get around all the de-tab issues I've been having on my M1. - Closes #2811 --- .editorconfig | 2 +- .../finalcutpro/export/batch/batch.lua | 28 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 4578ce569..c194bdcb2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,6 +2,6 @@ # Set default charset [*.{js,htm,html,sass,css,lua,lp}] charset = utf-8 -# indent_style = space +indent_style = space indent_size = 4 trim_trailing_whitespace = true \ No newline at end of file diff --git a/src/plugins/finalcutpro/export/batch/batch.lua b/src/plugins/finalcutpro/export/batch/batch.lua index c4140ba7c..d9d7ca9c2 100644 --- a/src/plugins/finalcutpro/export/batch/batch.lua +++ b/src/plugins/finalcutpro/export/batch/batch.lua @@ -579,7 +579,7 @@ function mod.getDestinationFolder() return exportPath and pathToAbsolute(exportPath) end ---- plugins.finalcutpro.export.batch.getDestinationFolder() -> string | nil +--- plugins.finalcutpro.export.batch.getDestinationPreset() -> string | nil --- Function --- Gets the destination preset. --- @@ -606,6 +606,32 @@ function mod.getDestinationPreset() end end + -------------------------------------------------------------------------------- + -- Make sure the Destination Preset actually exists in the menubar: + -------------------------------------------------------------------------------- + if destinationPreset and destinationPreset ~= i18n("sendToCompressor") then + local doesExistInMenu = fcp.menu:findMenuUI({"File", "Share", function(menuItem) + local title = menuItem and menuItem:attributeValue("AXTitle") + + -------------------------------------------------------------------------------- + -- Remove the (default)…: + -------------------------------------------------------------------------------- + if title and title:sub(-13) == " (default)…" then + title = title:sub(1, -14) + end + -------------------------------------------------------------------------------- + -- Remove the …: + -------------------------------------------------------------------------------- + title = tools.replace(title, "…", "") + + return title == destinationPreset + end}) + if not doesExistInMenu then + destinationPreset = nil + config.set("batchExportDestinationPreset", nil) + end + end + -------------------------------------------------------------------------------- -- If there's no existing destination, then try use the Default Destination: --------------------------------------------------------------------------------