Welcome to WSL!

New to the forum? Please read this and this.

Advice for super simple scripted shot setup stuffs (SSSSSS for short)

User avatar
jbills
Posts: 7
Joined: Tue Mar 23, 2021 9:57 am

Advice for super simple scripted shot setup stuffs (SSSSSS for short)

#1

Post by jbills »

Hey ya'll - I'm getting going with Fusion and am still totally a newb (first show with it) - can I hit you all up for quick tips on approach for some automation?

Just looking to save some clicks and script a couple of mundane "shot setup" bits here - I have about 50 shots on this little project, and lots of A over B stuff, lots of repetition.

Can I ask this in a "this is what I used to do in Nuke" way? To see what you all think and how I'd need to rewire my brain for Fusion.

So - I had a simple node in Nuke that I built up for each project, with the python commands to do the little click savers I needed. Different clients/projects had different needs, and different steps to automate, so having it exist as a node in the base comp for the show that was always there by the output write nodes whenever needed worked well. It traveled with the comp and made more sense than trying to have some sort of uber "shot setup" tool that had to be installed in user menus and things like that, would have been overkill. This had zero overhead + made sense in this case since there were never any changes to roll out or anything.
image.png
and that node had, well, in this example like 3 python buttons + the associated scripts needed on this specific project. Super basic stuff like grabbing the frame in/out of Loader1 and setting the comp global in/out range to match that, maybe adding +1 to the head for a slate. grabbing the name of the comp script and setting the saver nodes to that naming and version number. Basics.
image.png
Is there a way to mimic this sort of setup in Fusion? Is there an idea of a "blank" node where I could build up few little button driven python (or maybe I convert over to lua?) scripts for saving some clicks? I see the PipeRouter node maybe? but don't see a UI for adding "user knobs" (as nuke called them).

or would I be better off abandoning this sort of weird "put it in a node" mentality and doing it as a script that I install + invoke that pops up like a dialogue box with these same sort of bits and pieces?

or maybe there's an existing script or tool out there somewhere that helps with this sort of stuff that I could modify?

Up for anything - thanks for any help.

I'm definitely more of an artist and a total hack when it comes to more TD and dev minded engineering, so be gentle and feel free to assume I know nothing. ;)
You do not have the required permissions to view the files attached to this post.

User avatar
Midgardsormr
Fusionator
Posts: 2148
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 28
Location: Los Angeles, CA, USA
Been thanked: 36 times
Contact:

Re: Advice for super simple scripted shot setup stuffs (SSSSSS for short)

#2

Post by Midgardsormr »

There's a simple Null Fuse that you could use to set up your buttons. It has no controls and doesn't do anything, but it's handy to use as a signpost or for holding User Controls. Obviously, this fuse would need to be available on all workstations your comps could be opened on, including render nodes in order to prevent a pop-up that would block execution.

To add a control to any node, right-click it and choose "Edit Controls." That will give you a little GUI where you can configure the new control. ButtonControls can execute Lua code (and via cross-language scripting, they can also execute Python.)

The script can be encapsulated within the control, or it can run an external sidecar script. Here's an example of our Saver node, with buttons that execute some useful scripts:

Code: Select all

{
	Tools = ordered() {
		Saver1 = Saver {
			CtrlWZoom = false,
			Inputs = {
				ProcessWhenBlendIs00 = Input { Value = 0, },
				Clip = Input {
					Value = Clip {
						Length = 0,
						Saving = true,
						TrimIn = 0,
						ExtendFirst = 0,
						ExtendLast = 0,
						Loop = 1,
						AspectMode = 1,
						Depth = 1,
						TimeCode = 0,
						GlobalStart = -2000000000,
						GlobalEnd = 0
					},
				},
				OutputFormat = Input { Value = FuID { "DPXFormat" }, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				["DPXFormat.BypassConversion"] = Input { Value = 1, },
				["DPXFormat.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
			},
			ViewInfo = OperatorInfo { Pos = { 55, 16.5 } },
			UserControls = ordered() {
				MakeLoader = {
					BTNCS_Execute = "						args = { tool = comp.ActiveTool, copyTree = true }\n						comp:RunScript(\"S:/net_exe/BlackMagic/fusion9/scripts/Tool/buttonScripts/Saver_MakeLoader_v03.lua\", args)\n					",
					LINKS_Name = "Make Loader + Downstream Tools",
					INPID_InputControl = "ButtonControl",
					ICS_ControlPage = "File"
				},
				MakeLoaderOnly = {
					BTNCS_Execute = "						args = { tool = comp.ActiveTool, copyTree = false }\n						comp:RunScript(\"S:/net_exe/BlackMagic/fusion9/scripts/Tool/buttonScripts/Saver_MakeLoader_v03.lua\", args)\n					",
					LINKS_Name = "Make Loader",
					INPID_InputControl = "ButtonControl",
					ICS_ControlPage = "File"
				},	
				CopyFilename = {
					BTNCS_Execute = [[
						local mypath = tool.Clip[fu.TIME_UNDEFINED]
						bmd.setclipboard(mypath)
					]],
					LINKS_Name = "Copy Filename",
					INPID_InputControl = "ButtonControl",
					ICS_ControlPage = "File"
				},
				ChangeResolutionFolder = {
					BTNCS_Execute = [[
						args = {tool = comp.ActiveTool}
						comp:RunScript([=[S:\net_exe\BlackMagic\fusion9\scripts\Support\Saver_changeResolutionFolder_v01.lua]=])
					]],
					LINKS_Name = "Change Resolution Folder",
					INPID_InputControl = "ButtonControl",
					ICS_ControlPage = "File",
				},				
			}
		}
	}
}
The first two are a little hard to parse since Fusion reformats the strings when you add the tool to a comp, and I wasn't disciplined enough when making the .setting file to preserve readable code. The third, CopyFilename, is an example of running the entire script from the button, and the fourth, ChangeResolutionFolder, is a readable example of using the RunScript() command to launch a sidecar script.

You might also be interested in SirEdric's ScriptScript script, which is an easy way to access and share small scripts that don't necessarily need a lot of pipeline built around them. viewtopic.php?f=6&t=1887

Or for something similar but more elaborate, I have a ToolBox script I built for Muse VFX. That one is described on my blog: http://www.bryanray.name/wordpress/tool ... or-fusion/

It would obviously need to be modified for use in another facility, but most of the stuff that would need to change is at the top and well sign-posted. I probably ought to update that post with version 2 of the script, which makes it even easier to maintain.

User avatar
jbills
Posts: 7
Joined: Tue Mar 23, 2021 9:57 am

Re: Advice for super simple scripted shot setup stuffs (SSSSSS for short)

#3

Post by jbills »

Thanks a ton! This is great, I'll pick up that Null fuse and see how I go with some button controls that mimic what I had. I'll most definitely chew on the other ideas you mentioned, too. Awesome!

User avatar
intelligent machine
Fusionista
Posts: 752
Joined: Fri May 13, 2016 10:01 pm
Answers: 9
Location: Austin, Texas, USA
Real name: Sam Treadway
Been thanked: 13 times
Contact:

Re: Advice for super simple scripted shot setup stuffs (SSSSSS for short)

#4

Post by intelligent machine »

To add to @Midgardsormr's recommendations: You can also create a simple macro that just contains a brightness/contrast or whatever + a pipe router. Add your custom controls to the BC and when you create the macro, only select those new controls plus the input and output if you want to pipe through it for any reason. In the example below, I removed the inputs and output connections and changed the node color to something I'd rarely use.

The advantage to making a macro is that it can live in the comp file and doesn't need to be installed everywhere as long as the tool(s) within are native, but it can also be installed as a macro without the need to override default settings of existing tools.

Code: Select all

{
	Tools = ordered() {
		myScriptButtons = MacroOperator {
			CtrlWZoom = false,
			Inputs = ordered() {
				Input1 = InstanceInput {
					SourceOp = "Custom_Buttons_1",
					Source = "MakeLoader",
					Page = "Controls",
				},
				Input2 = InstanceInput {
					SourceOp = "Custom_Buttons_1",
					Source = "MakeLoaderOnly",
					Page = "Controls",
				},
				Input3 = InstanceInput {
					SourceOp = "Custom_Buttons_1",
					Source = "CopyFilename",
					Page = "Controls",
				},
				Input4 = InstanceInput {
					SourceOp = "Custom_Buttons_1",
					Source = "ChangeResolutionFolder",
					Page = "Controls",
				}
			},
			ViewInfo = GroupInfo { Pos = { 275, 148.5 } },
			Tools = ordered() {
				PipeRouter1_1 = PipeRouter {
					CtrlWShown = false,
					ViewInfo = PipeRouterInfo { Pos = { -55, 8.75758 } },
				},
				Custom_Buttons_1 = BrightnessContrast {
					CtrlWZoom = false,
					CtrlWShown = false,
					NameSet = true,
					Inputs = {
						Input = Input {
							SourceOp = "PipeRouter1_1",
							Source = "Output",
						},
					},
					ViewInfo = OperatorInfo { Pos = { 55, 8.75758 } },
					UserControls = ordered() {
						MakeLoader = {
							INP_Integer = false,
							INP_External = false,
							LINKID_DataType = "Number",
							BTNCS_Execute = "						args = { tool = comp.ActiveTool, copyTree = true }\n						comp:RunScript(\"S:/net_exe/BlackMagic/fusion9/scripts/Tool/buttonScripts/Saver_MakeLoader_v03.lua\", args)\n					",
							ICS_ControlPage = "Controls",
							INPID_InputControl = "ButtonControl",
							LINKS_Name = "Make Loader + Downstream Tools",
						},
						MakeLoaderOnly = {
							INP_Integer = false,
							INP_External = false,
							LINKID_DataType = "Number",
							BTNCS_Execute = "						args = { tool = comp.ActiveTool, copyTree = false }\n						comp:RunScript(\"S:/net_exe/BlackMagic/fusion9/scripts/Tool/buttonScripts/Saver_MakeLoader_v03.lua\", args)\n					",
							ICS_ControlPage = "Controls",
							INPID_InputControl = "ButtonControl",
							LINKS_Name = "Make Loader",
						},
						CopyFilename = {
							INP_Integer = false,
							INP_External = false,
							LINKID_DataType = "Number",
							BTNCS_Execute = "						local mypath = tool.Clip[fu.TIME_UNDEFINED]\n						bmd.setclipboard(mypath)\n					",
							ICS_ControlPage = "Controls",
							INPID_InputControl = "ButtonControl",
							LINKS_Name = "Copy Filename",
						},
						ChangeResolutionFolder = {
							INP_Integer = false,
							INP_External = false,
							LINKID_DataType = "Number",
							BTNCS_Execute = "						args = {tool = comp.ActiveTool}\n						comp:RunScript([=[S:\\net_exe\\BlackMagic\\fusion9\\scripts\\Support\\Saver_changeResolutionFolder_v01.lua]=])\n					",
							ICS_ControlPage = "Controls",
							INPID_InputControl = "ButtonControl",
							LINKS_Name = "Change Resolution Folder",
						}
					}
				}
			},
			Colors = { TileColor = { R = 0.92156862745098, G = 0.431372549019608, B = 0 }, }
		}
	},
	ActiveTool = "myScriptButtons"
}

User avatar
Midgardsormr
Fusionator
Posts: 2148
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 28
Location: Los Angeles, CA, USA
Been thanked: 36 times
Contact:

Re: Advice for super simple scripted shot setup stuffs (SSSSSS for short)

#5

Post by Midgardsormr »

What's the purpose of the PipeRouter?

User avatar
intelligent machine
Fusionista
Posts: 752
Joined: Fri May 13, 2016 10:01 pm
Answers: 9
Location: Austin, Texas, USA
Real name: Sam Treadway
Been thanked: 13 times
Contact:

Re: Advice for super simple scripted shot setup stuffs (SSSSSS for short)

#6

Post by intelligent machine »

The pipe router of course isn't necessary. I've just got in the habit of always including them out of convenience.

When converting to a group and opening up in the flow it forces visual start and end points on the flow within the group. As you know when you open a group the inputs could be anywhere along the edge unless you've spent the extra time sliding, aligning and resizing everything just right.