------------------------------------------------------------------------------ -- Change BG size -- -- composition script for Fusion 5.0 -- -- This script change all BG size with the specified width and height -- -- Version : 1.0 -- author : Alexandre Aillet (webmaster@F-oeni-X.com) -- Idea from : Guillaume Jallot -- Created : September 2007 ------------------------------------------------------------------------------ ----------------------------------------------------------------------- ----------------------------- functions ----------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- -- GetBGList function ----------------------------------------------------------------------- -- list all BG in "comp" -- input : comp (string, name of the composition) -- output : BGTable (table, list of all "comp" loader(s)) ----------------------------------------------------------------------- function GetBGList (comp) BGTable = {} -- cycle on comp toollist for i, tool in comp:GetToolList() do -- tool is a BG? if tool:GetAttrs().TOOLS_RegID == "Background" then table.insert(BGTable, tool) end end return BGTable end ----------------------------------------------------------------------- ---------------------------- main script ---------------------------- ----------------------------------------------------------------------- print("--------------------------------------------------------------------------------------") print("---------------------------------- Change BG Size ----------------------------------") print("--------------------------------------------------------------------------------------") -- get current open comp current_comp = fusion:GetCurrentComp() if not current_comp then print("no open composition") else -- list all BG in comp allBGTable = GetBGList(current_comp) if table.getn(allBGTable) == 0 then print("no Background in composition") else dialogBox = current_comp:AskUser("Change All BG Size", { {"dlgWidth", Name = "Width", "Slider", Default = 1280, DisplayedPrecision = 0}, {"dlgHeight", Name = "Height", "Slider", Default = 720, DisplayedPrecision = 0}, {"dlgPixelAspect", Name = "Pixel Aspect", "Position", Default = {1, 1}} }) if not dialogBox then print("Cancel by user") else -- comp lock current_comp:Lock() -- dialogbox attibute gather newWidth = dialogBox.dlgWidth newHeight = dialogBox.dlgHeight newPixelAspect = dialogBox.dlgPixelAspect -- cycle on BG list for i, bg in allBGTable do bg.Width = newWidth bg.Height = newHeight bg.PixelAspect = newPixelAspect end print("\n"..table.getn(allBGTable) .." Background(s) size changed\n") -- comp unlock current_comp:Unlock() end end print("--------------------------------------------------------------------------------------\n") end