Looks like a mod has moved your thread, so if you can see this message, you've found the Fusion forum!
To get a list of selected tools:
- Code: Select all
tools = composition:GetToolList(true)
GetToolList() takes two arguments. The first is a boolean value, true or false, that determines whether you are collecting selected tools or all of the tools in the comp. The second is a tool type. This is the RegID of that tools you want to select. For instance, composition:GetToolList(false, "Loader") will return all the Loaders in your composition, regardless of whether they are selected.
To perform an operation on each item in the list:
- Code: Select all
for i, j in pairs(tools) do
<operation>
end
pairs() is an iterator function that returns the key and value pair to the variables declared in the loop, along with a link to the next item in the table. pairs() will return the keys in an arbitrary order. If your table is indexed by integer indices, you can traverse it in order using ipairs() instead.
So to save a .setting for each selected tool in my own Settings folder:
- Code: Select all
path = "C:\\Users\\bray\\AppData\\Roaming\\Blackmagic Design\\Fusion\\Settings\\"
for i, j in pairs(tools) do
tools[i]:SaveSettings(path .. tools[i].Name .. ".setting")
end
Edit: One more thing. This should be a comp script instead of a tool script. Tool scripts will be run once for each selected tool, which is problematic when using GetToolList() like this.