henit1 wrote:Bryan Ray wrote:It sounds like what you need to do is to remove the calculations to a script ...
I can look into that solution. This suggestion also got me thinking. Can a script like that set values on controls?
Absolutely! In the example I gave above, you'll see these lines:
filepath = tool.Clip[1]
myloader = comp:AddTool("Loader", posx+1, posy - 1)
myloader.Clip = filepath
The first queries the current tool for the value contained in it's Clip control. In the case of a script run from a button script, or a tool script run by right-clicking a tool and choosing Script > ..., "tool" will always be a handle to the tool the script is being run on.
The second line creates a new Loader node and assigns a handle to the variable myloader.
The third line refers to the Clip input on the new Loader. A simple assignment puts the string we got from the first line into that input.
The tricky bit when the script itself is not creating the nodes you want to manipulate is that you need to refer to them as members of the composite object. That is, if you have a Merge node named Merge3, and you want to set its Blend control to 0.5, this is the command:
comp.Merge3.Blend = 0.5
If you want to
read an input, though, you need to also indicate which frame to get the value from, since the script doesn't know anything about time, like so:
myBlendValue = comp.Merge3.Blend[comp.CurrentTime]
If the value doesn't change, like the Clip above, it's safe to enter any integer, or you can use fusion.TIME_UNDEFINED. Or you can pull the value from a specific frame by entering that frame number in the brackets.
Combining these ideas, if you want to multiply two Transform nodes' Size values and store the result in a third:
comp.Transform1.Size = comp.Transform2.Size[1] * comp.Transform3.Size[1]