Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Some additional fixes. Still needs work.
  • Loading branch information
randomeizer committed Jan 9, 2017
1 parent 9f48920 commit c4cff39
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/hs/fcpxhacks/modules/fcpx10-3.lua
Expand Up @@ -4666,7 +4666,7 @@ end
if menuBar:isEnabled("File", "Reveal in Browser") then
menuBar:selectMenu("File", "Reveal in Browser")
else
dialog.displayErrorMessage("Unable to Reveal in Browser." .. errorFunction)
dialog.displayErrorMessage("No clip is available in the current angle under the playhead." .. errorFunction)
return
end

Expand Down Expand Up @@ -4751,7 +4751,6 @@ end
--------------------------------------------------------------------------------

local angles = media.primaryObject.containedItems[1].anchoredItems
debugMessage("Looking for angle with id of "..inspect(videoAngle))
for i,angle in ipairs(angles) do
if angle.angleID == videoAngle then
return angle.anchoredLane
Expand Down
40 changes: 37 additions & 3 deletions src/hs/finalcutpro/main/TimelineContents.lua
Expand Up @@ -284,21 +284,55 @@ end
-----------------------------------------------------------------------
-----------------------------------------------------------------------

function TimelineContents:anglesUI()
return self:clipsUI()
end

function TimelineContents:angleButtonsUI(angleNumber)
local angles = self:anglesUI()
if angles then
local angle = angles[angleNumber]
if angle then
return axutils.childrenWithRole(angle, "AXButton")
end
end
return nil
end

function TimelineContents:monitorVideoInAngle(angleNumber)
local buttons = self:angleButtonsUI(angleNumber)
if buttons and buttons[1] then
buttons[1]:doPress()
end
end

function TimelineContents:toggleAudioInAngle(angleNumber)
local buttons = self:angleButtonsUI(angleNumber)
if buttons and buttons[2] then
buttons[2]:doPress()
end
end

-- Selects the clip under the playhead in the specified angle.
-- NOTE: This will only work in multicam clips
function TimelineContents:selectClipInAngle(angle)
local clipsUI = self:clipsUI()
function TimelineContents:selectClipInAngle(angleNumber)
local clipsUI = self:anglesUI()
if clipsUI then
local angleUI = clipsUI[angle]
local angleUI = clipsUI[angleNumber]
local playheadPosition = self:playhead():getPosition()
local clipUI = axutils.childMatching(angleUI, function(child)
local frame = child:frame()
return child:attributeValue("AXRole") == "AXLayoutItem"
and frame.x <= playheadPosition and (frame.x+frame.w) >= playheadPosition
end)

self:monitorVideoInAngle(angleNumber)

if clipUI then
debugMessage("Selecting a clip in angle "..angleNumber..":\n".._inspect(clipUI))
self:selectClip(clipUI)
else
debugMessage("Unable to find the clip under the playhead for angle "..angleNumber..".")
end
end
return self
Expand Down

0 comments on commit c4cff39

Please sign in to comment.