------------------------------------------------------------------------------ -- Pass Through -- -- composition script for Fusion 5.0 -- -- This script switch glow, soft glow and RSMB nodes on or off (pass through) -- -- Version : 1.1 -- author : Alexandre Aillet (webmaster@F-oeni-X.com) -- Idea from : Guillaume Jallot -- Created : September 2007 ------------------------------------------------------------------------------ ----------------------------------------------------------------------- ----------------------------- functions ----------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- -- GetToolList function ----------------------------------------------------------------------- -- list all "tool" in "comp" -- input : comp (string, name of the composition) -- output : BGTable (table, list of all "comp" loader(s)) ----------------------------------------------------------------------- function GetToolList (comp, tool) toolTable = {} -- cycle on comp toollist for i, tl in comp:GetToolList() do -- tl is a tool? if tl:GetAttrs().TOOLS_RegID == tool then table.insert(toolTable, tl) end end return toolTable end ----------------------------------------------------------------------- ---------------------------- main script ---------------------------- ----------------------------------------------------------------------- print("--------------------------------------------------------------------------------------") print("---------------------------------- Pass Through ------------------------------------") print("--------------------------------------------------------------------------------------") -- get current open comp current_comp = fusion:GetCurrentComp() if not current_comp then print("no open composition") else if table.getn(current_comp:GetToolList()) == 0 then print("no tool in composition") else -- list of tool to pass through toolsToPassThrough = {"Glow", "SoftGlow", "AEPlugIn_SmartMotionBlur3x", "AEPlugIn_RSMotionBlurProA3x", "AEPlugIn_RSMotionBlurProVectors3x", "DirectionalBlur", "Displace", "ErodeDilate"} toolsToPassThroughName = {"Glow", "Soft Glow", "RSMB 3x", "RSMB Pro 3x", "RSMB Vector 3x", "Directional Blur", "Displace", "Erode Dilate"} -- dialog box parameters dialogInputs = {} dialogInputs[1] = {"dlgSwitch", Name = "Pass/Unpass Through", "Checkbox", Default = 1} dialogInputs[2] = {"", "Text", Default = string.format("%50s", "Choose tool(s) to pass/unpass through"), Lines = 1, ReadOnly = true } for i, tool in toolsToPassThroughName do dialogInputs[i+3] = {"toolSwitch" .. i, Name = tool, "Checkbox", Default = 1, NumAcross = 2} end -- dialog box dialogBox = current_comp:AskUser("Pass Through Tool(s)", dialogInputs) if not dialogBox then print("Cancel by user") else -- comp lock current_comp:Lock() -- dialogbox attibute gather toolsSwith = dialogBox.dlgSwitch toolsSelected = {} toolsSelectedName = {} for i, tool in toolsToPassThroughName do toolSwitchIndex = "toolSwitch" .. i if (dialogBox[toolSwitchIndex] == 1) then table.insert(toolsSelectedName, tool) table.insert(toolsSelected, toolsToPassThrough[i]) end end if table.getn(toolsSelected) == 0 then print("no tool selected") else for i, tool in toolsSelectedName do -- list all tool in comp allToolTable = GetToolList(current_comp, toolsSelected[i]) if table.getn(allToolTable) == 0 then print(string.format("%-40s %45s", tool, "not in composition")) else if toolsSwith == 0 then print(string.format("%-40s %45s", tool, "Unpass Through")) else print(string.format("%-40s %45s", tool, "Pass Through")) end -- cycle on tool list for j, tl in allToolTable do if toolsSwith == 0 then tl:SetAttrs({TOOLB_PassThrough = false}) else tl:SetAttrs({TOOLB_PassThrough = true}) end end end end end -- comp unlock current_comp:Unlock() end end print("--------------------------------------------------------------------------------------\n") end