Jump to: Board index » General » Fusion

Copy Node - retain input connections

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

Clayton Krause

  • Posts: 31
  • Joined: Tue Oct 31, 2017 3:31 pm

Copy Node - retain input connections

PostMon Oct 15, 2018 2:20 pm

Apologize for the basic question, but I took a look at the manual and a quick google search without finding much of anything.

Is there a way to copy/paste a node and retain the copied node's input connections? Maybe I'm not searching for the correct keywords as this seems like basic functionality Fusion should have.

Thank you for the help.
Offline

Clayton Krause

  • Posts: 31
  • Joined: Tue Oct 31, 2017 3:31 pm

Re: Copy Node - retain input connections

PostTue Oct 23, 2018 8:48 pm

Either this was a stupid question and I'm obviously missing something, this functionality does not exist in Fusion (which I would find extremely odd) or everyone is just taking a nap. :D
Offline
User avatar

Bryan Ray

  • Posts: 2488
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Copy Node - retain input connections

PostTue Oct 23, 2018 11:28 pm

There's not a built-in way to do it, but it could be scripted. You'd need to replace the Ctrl+c hotkey with a small script that copied the tool and also stored its input connections:

Code: Select all
myInputs = {}
for i, inp in ipairs(comp.ActiveTool:GetInputList()) do
    myInputs[i] = inp:GetConnectedOutput()    --for each input, get the output connected to it
end

comp.ActiveTool:SetData("connectedOutputs", myInputs) --store the table in the tool's CustomData
comp:Copy(comp.ActiveTool) -- put the tool on the clipboard


Then a new hotkey, like ctrl+alt+v, would run this script:

Code: Select all
comp:Paste()  -- Paste the tool from the clipboard
myInputs = comp.ActiveTool:GetData("connectedOutputs") -- retrieve the list of connections
if myInputs then
    toolInputs = comp.ActiveTool:GetInputList()  -- retrieve a list of the tool's inputs
    for i, inp in pairs(myInputs) do
        toolInputs[i]:ConnectTo(inp)
    end
end


So you'd save those two scripts as something like copyWithInputs.lua in Scripts/Tool/ and pasteWithInputs.lua in your Scripts/Comp folder. Then assign them to the appropriate hotkeys using the hotkey manager in View > Customize Hotkeys…
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

Clayton Krause

  • Posts: 31
  • Joined: Tue Oct 31, 2017 3:31 pm

Re: Copy Node - retain input connections

PostWed Oct 24, 2018 1:26 am

Alright! A lot like Houdini which isn't a bad thing (expected to build your tools). I think at the end of the day I'm going to need to learn Lua as Python doesn't sound like it's going to cut it inside of Fusion as I go more advanced.

Thank you for the confirmation and sharing your code. I'm thinking I'd be wise to bite the bullet and pick up Lua.
Offline
User avatar

Bryan Ray

  • Posts: 2488
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Copy Node - retain input connections

PostWed Oct 24, 2018 7:25 am

Fusion's not as robust as Houdini—there are quite a few bits and pieces that aren't accessible outside of a full-blown SDK plug-in. It is certainly more low-level than most AE users are used to, and there are fewer community-built gizmos and scripts as Nuke users get to use because the user base is comparatively small (for the moment).

Personally, I love Lua. I know a little bit of Python, and while I can get by, it seems overly complex to do relatively simple things. And that tabs vs spaces thing really gets my goat! For the majority of tasks, Lua tends to be simpler and quicker than Python, but you do run into places where Python's more developed, and you have to build something more explicit to get the same result with Lua.

Fusion's expressions are all Lua based, and Fuses cannot be written in Python*, so it's well worth learning if you intend to do much development in Fusion.

*Technically, you could put Python code in a Fuse, but you'd still have to use a Lua wrapper to invoke it, and you'd lose the speed of the LuaJIT interpreter, which is fast if it's used well.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com

Return to Fusion

Who is online

Users browsing this forum: No registered users and 38 guests