Jump to: Board index » General » Fusion

Modify controls on multiple nodes at the same time?

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

Dan Bethell

  • Posts: 2
  • Joined: Tue Nov 14, 2017 6:06 pm

Modify controls on multiple nodes at the same time?

PostTue Nov 14, 2017 6:15 pm

Apologies if this is a basic question but I can't work out how to modify the controls of multiple (similar) nodes at the same time; is this possible in Fusion?

For example, if I have four Polygon(Ply) nodes selected and I want to set the 'Invert' control of them all to ON at the same time. Is this possible in a single click or do I have to set the control for each node individually?

Thanks in advance,
Dan
Offline
User avatar

Bryan Ray

  • Posts: 221
  • Joined: Mon Nov 28, 2016 5:32 am

Re: Modify controls on multiple nodes at the same time?

PostTue Nov 14, 2017 10:36 pm

You can do it with a short script:

Code: Select all
for _,tool in ipairs(composition:GetToolList(true)) do tool.Invert = 1; end


Just copy that line, paste it into the Console window, and hit Enter to execute it.

To break that down for you, the "for … do … end" structure is an iterator. The stuff between "do" and "end" will happen each time the for loop repeats.

ipairs() is a special function that just feeds the next item in a list to the loop each time. It spits out two variables each time: the first is a simple integer increment that counts from 1 to the end of the list. The second is the actual item from the list. For this application, we don't need to know how far along in the list we are, so we use the underscore character _ to throw that bit of information away. The second variable, tool, will temporarily hold a reference to each tool in the list. So if we have Polygon1, Polygon2, and Polygon3, the first time through the loop "tool" is equivalent to "Polygon1."

composition:GetToolList(true) is a function that creates a list of all of the selected nodes. GetToolList(false) creates a list of all nodes in the comp, regardless of whether or not they're selected. GetToolList(false, "Polygon") would get a list of all of the Polygon tools. We prefix it with composition: in order to tell the script what object we want to get our list of tools from.

tool.Invert = 1; sets the Invert property of the current tool (the one the loop is looking at) to 1. Remember that inside the loop "tool" stands in for the node name. You can learn the scripting name of the property you're interested in by hovering over it with your mouse and looking at the status bar in the lower-left corner. It will say something like [Polygon1.Invert].

So let's change it into a line that will turn on Motion Blur and set the Quality for all selected Transforms. This time, though, I'll write it in a multi-line format which would need to be saved into the Scripts/Comp folder as a .lua file (use a programmer's text editor like Notepad++ or TextMate, not a word processor) and run from the Scripts menu:

Code: Select all
for i,tool in ipairs(composition:GetToolList(true, "Transform") do
    tool.MotionBlur = 1
    tool.Quality = 20
    print("Motion Blur enabled for "..i.." tools)
end


Notice that this time there are no semicolons. Those are only necessary if you're cramming the entire script onto one line, as you have to do to run a loop directly in the console. I've also added a print statement that informs the user what's been done. In Lua, .. is a concatenation operator—it is used to join strings together. Instead of discarding the increment with an underscore I've stored it in the variable i so that it can be used in the print statement.

I know that's way more information than you asked for, but I hope you and any others who wander by can learn something!

There is an old script that works in Fusion 6 and earlier called Batch Change Parameters that creates a pop-up window where you can choose from a list of detected parameters and set values. It needs to be updated a little to work in Fusion 9, but it essentially does the same thing.
Bryan Ray
http://www.bryanray.name
http://www.musevfx.com
Offline
User avatar

Eugene Afanasiev

  • Posts: 558
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Modify controls on multiple nodes at the same time?

PostWed Nov 15, 2017 1:45 pm

Thanks Bryan, as always very helpful!
__
--Blackmagic URSA Mini Pro, DaVinci Resolve 14 Studio, Fusion 9 Studio Owner
--Run on ALIENWARE 17 R3 (Win 10, i7 6820HQ, 32 GB RAM, GeForce 980M 4GB.
--BMD's cameras user since 2014
--All my movies: http://www.youtube.com/rebelorelse
Offline

Dan Bethell

  • Posts: 2
  • Joined: Tue Nov 14, 2017 6:06 pm

Re: Modify controls on multiple nodes at the same time?

PostThu Nov 16, 2017 7:30 am

Thanks Bryan, all very useful information!

Return to Fusion

Who is online

Users browsing this forum: Google Feedfetcher and 8 guests