script for nodes (/Tool)

User avatar
kiboost
Posts: 26
Joined: Wed Jan 08, 2020 1:38 am
Been thanked: 3 times

script for nodes (/Tool)

#1

Post by kiboost » Wed Feb 12, 2020 8:06 am

Hi,

I have some comp scripts in Scripts/Comp with subfolders, all working fine.

Now experimenting with tool scripts Scripts/Tool

Starting the script works great on right click on a node.
But, is there a way to filter which node type should display a script in its menu ?

For example, I have a python script to do stuff on loader nodes. Of course, in the script, I can get ActiveTool() and do action actions on it, filtering per type.
But, I don't need to have this script on ColorCurve node for example.

So is there a way to have some python script that only show in right click / Scripts menu on loader nodes ? Other scripts on camera3D nodes, etc ?

Thanks

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

Re: script for nodes (/Tool)

#2

Post by Midgardsormr » Wed Feb 12, 2020 10:27 am

Loader_Loader.setting
Not to my knowledge, but you could instead put the script directly on the tool you would run it from. If you save a default on a tool with a User Control, the control will always appear on the node. Attached is our Loader default with an example.

Although I have these running out of the Tool/buttonScripts/ folder, I think a better choice would be to put them in Utility, so they don't even show up in the list of Tool scripts. I should probably spend a day making that adjustment in all our templates and defaults.
You do not have the required permissions to view the files attached to this post.

User avatar
kiboost
Posts: 26
Joined: Wed Jan 08, 2020 1:38 am
Been thanked: 3 times

Re: script for nodes (/Tool)

#3

Post by kiboost » Wed Feb 12, 2020 12:43 pm

Very nice, many thanks for this example !!

Only problem is that is does apply (as default setting) to new created loader. But is there a way to set such settings on existing loader when reloading a previous comp ?
Or only way will be open comp callback and set them with a script ?
Is it possible to use python callbacks ? Running full python till now and just awesome.

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

Re: script for nodes (/Tool)

#4

Post by Midgardsormr » Wed Feb 12, 2020 3:05 pm

Probably the simplest way would be for the script to add a new Loader, copy the settings of the original Loader into it, switch the Output connections, then delete the old one. You could try to hack apart the old Edit Controls script and convert the necessary bits into Python, but that seems like more trouble than it's worth to me.

But if you want to look at how that old script did it, I've attached it. This script won't run in Fusion 8 or later.
UserControls.eyeonscript
You do not have the required permissions to view the files attached to this post.

User avatar
PeterLoveday
Fusioneer
Posts: 182
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 6 times

Re: script for nodes (/Tool)

#5

Post by PeterLoveday » Wed Feb 12, 2020 4:50 pm

Midgardsormr wrote:
Wed Feb 12, 2020 10:27 am
Although I have these running out of the Tool/buttonScripts/ folder, I think a better choice would be to put them in Utility, so they don't even show up in the list of Tool scripts. I should probably spend a day making that adjustment in all our templates and defaults.
err .. If you put them in Utility, they will show in the File->Script menu (where utility scripts live). I'm assuming that's not what you want.

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

Re: script for nodes (/Tool)

#6

Post by Midgardsormr » Wed Feb 12, 2020 4:58 pm

Oh, really? I didn't even know that menu was there. Guess I should move some stuff...

User avatar
PeterLoveday
Fusioneer
Posts: 182
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 6 times

Re: script for nodes (/Tool)

#7

Post by PeterLoveday » Wed Feb 12, 2020 6:42 pm

Hmm, Perhaps we should designate a folder specifically for user misc support scripts, for consistency.

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

Re: script for nodes (/Tool)

#8

Post by Midgardsormr » Thu Feb 13, 2020 7:42 am

Good idea. "Support" seems like a logical choice.

User avatar
PeterLoveday
Fusioneer
Posts: 182
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 6
Been thanked: 6 times

Re: script for nodes (/Tool)

#9

Post by PeterLoveday » Thu Feb 13, 2020 9:11 am

Done.