CommandPost / CommandPost

Workflow Enhancements for Creatives

Home Page:https://commandpost.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commit multicam- add option with audio

knurrrrrrt opened this issue · comments

It would be great if there was a second option of commit multi-cam that attaches the clip with audio.

It would also be cool if the attached clip would be attached at the first video frame even if the playhead is not parked there.

Here's a workaround in the meantime:

local log   = require "hs.logger".new "matchframe"
local fcp   = require "cp.apple.finalcutpro"
local just  = require "cp.just"

local wait  = just.wait

fcp:selectMenu({"Mark", "Go to", "Range Start"})
wait(0.5)

--------------------------------------------------------------------------------
-- Store the originally-selected clips:
--------------------------------------------------------------------------------
local contents              = fcp.timeline.contents
local originalSelection     = contents:selectedClipsUI()
local menuBar               = fcp.menu

--------------------------------------------------------------------------------
-- If nothing is selected, select the top clip under the playhead:
--------------------------------------------------------------------------------
if not originalSelection or #originalSelection == 0 then
    local playheadClips = contents:playheadClipsUI(true)
    contents:selectClip(playheadClips[1])
elseif #originalSelection > 1 then
    log.ef("Commit Multicam: More than one clip is selected. Please select a single clip and try again.")
    playErrorSound()
    return
end

--------------------------------------------------------------------------------
-- Get Multicam Angle:
--------------------------------------------------------------------------------
local multicamAngle = cp.plugins("finalcutpro.timeline.matchframe").getMulticamAngleFromSelectedClip()
if not multicamAngle then
    log.ef("Commit Multicam: The selected clip is not a multicam clip.")
    playErrorSound()
    contents:selectClips(originalSelection)
    return
end

--------------------------------------------------------------------------------
-- Open in Angle Editor:
--------------------------------------------------------------------------------
if menuBar:isEnabled({"Clip", "Open in Angle Editor"}) then
    menuBar:selectMenu({"Clip", "Open in Angle Editor"})
else
    log.ef("Commit Multicam: Failed to open clip in Angle Editor.\n\nAre you sure the clip you have selected is a Multicam?")
    playErrorSound()
    return false
end

--------------------------------------------------------------------------------
-- Put focus back on the timeline:
--------------------------------------------------------------------------------
if menuBar:isEnabled({"Window", "Go To", "Timeline"}) then
    menuBar:selectMenu({"Window", "Go To", "Timeline"})
else
    log.ef("Commit Multicam: Unable to return to timeline.")
    playErrorSound()
    return false
end

--------------------------------------------------------------------------------
-- Ensure the playhead is visible:
--------------------------------------------------------------------------------
contents.playhead:show()

--------------------------------------------------------------------------------
-- Select the correct angle:
--------------------------------------------------------------------------------
contents:selectClipInAngle(multicamAngle)

--------------------------------------------------------------------------------
-- Fire off a bunch of menu items:
--------------------------------------------------------------------------------
wait(0.7)
fcp:selectMenu({"File", "Reveal in Browser"})
wait(0.7)
fcp:selectMenu({"Mark", "Set Range Start"})
wait(1.5)
fcp:selectMenu({"View", "Timeline History Back"})
wait(1.5)
fcp:selectMenu({"Window", "Go To", "Timeline"})
wait(0.5)
fcp:selectMenu({"Mark", "Set Range Start"})
wait(0.5)
fcp:selectMenu({"Edit", "Connect to Primary Storyline"})