Fusion : Toggle_Passthrough.eyeonscript

eyeonfusion120Created a small script today to alleviate a small niggle i have, namely on a missing feature while working on a comp that became a bit sluggish because of the extensive use of optical flow based nodes, the ability to do quick multiple passthrough toggling by using a sort of pre selected set of nodes.

Before, in order to work with the comp and have it render refreshes fast enough to not be uncomfortable, i often found myself selecting all heavy task nodes (by digging through my comp flow by hand) and then toggle their passthrough state.

Now this isn’t a disaster, but switching between viewing the final product and the editting version takes time and breaks my working flow.

Here’s a small script that scans your comp flow for any nodes that have a line in their comments that contain the following string:

[!]

When you run the script it will toggle their passthrough state, the script becomes really handy when you attach it to a shortcut (you can do this with the Hotkey Manager.)

I haven’t fully tested it with animated comments yet, but it should work as it simply creates a large string comprised of all the text data it finds on an animation spline that is attached to the comments tab and then runs it through the standard Lua find function.

Offcourse you can quite easily change the comment string by simply editing the script, just change the string in line 24.

download : Toggle_Passthrough
.

-- Toggle_Passthrough v1.0
-- by S.Neve - House of Secrets 13-05-2009
-- for latest version, check http://www.svennneve.com

local toollist = composition:GetToolList()

for i, tool in toollist do
	-- Finds all comments for tool.  Checks to see if it’s animated.
	message = ""
	if tool.Comments then
		if tool.Comments[TIME_UNDEFINED]=="" then
		else
			if tool.Comments:GetConnectedOutput() then
				x=tool.Comments:GetKeyFrames()
				for k, keyframe in x do
					message = message .. tool.Comments[keyframe]
				end
			else
				message = tool.Comments[TIME_UNDEFINED]
			end
		end
	end 

	if string.find(message, "[!]") then
		tool:SetAttrs({TOOLB_PassThrough = not tool:GetAttrs().TOOLB_PassThrough})
		print ("toggled passthrough on " .. tool:GetAttrs().TOOLS_Name .. "\n")
	end
end
Share

2 thoughts on “Fusion : Toggle_Passthrough.eyeonscript

  1. Hi!
    I’m currently trying to work onto a lua script.
    I’m not a programmer, just dig here and there to construct my tools.
    Actually there is no more Manual for Lua developping for Fusion because all links point to the new BlackMagic site!
    So i’m a bit embarassed to ask you but maybe you can point me in the right direction.
    You seems to have skills and knows that lua side.

    I’m looking to detect if a Saver is Pass Through active or inactive. I do not want to execute some functiun when a saver is inactive. Could you help with somes code?

    Thanks for your time,

    Yannick
    TAIS
    IJINPROD

Leave a Reply to Yannick Tholomier Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.