Jump to: Board index » General » Fusion

Custom tool to gang RGB values when changing colors

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

TCP786

  • Posts: 267
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 2:22 am

I would like to write a custom tool to help me manipulate color sliders a little differently (on things like background nodes, etc). What I want to be able to do is manipulate the RGB values separately like normal, but also have a tool that lets me move them all by the same amount. For example, the behavior I'm trying to create would be for me to be able to set red to 0.2, blue to 0.7, and green to 0.3; then if I use the tool instead, changing the tool's slider(s?) by 0.2 would change the red value to 0.4, but also change the blue slider to 0.9 and the green one to 0.5. The tricky part is that I want to be able to go back and forth with both, so I could then change the blue slider to 0.8 without it affecting the other values, since I'm not changing that value via the tool.

The and math and expression/code themselves is pretty straightforward, but the one thing I don't know how to do is to set the sliders' current values to variables that remain unchanged while using the tool, but do change when using the normal sliders. Feels weird to say that I need a variable to remain constant, but of course it can't be a constant if it needs to be changed when I go back and forth between the tool and the normal sliders.

Maybe I'm thinking about the structure of this tool the wrong way. Any suggestions?
Offline

Sander de Regt

  • Posts: 2457
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 10:49 am

The and math and expression/code themselves is pretty straightforward

Is it? I envy you, I don't understand math at all.
But... I think there is a way to do this, but you need to add 4 sliders not one.
What you probably have noticed is that as soon as you create an expression or modify a value with a modifier they get 'stuck' in the sense that you can't move them seperately anymore.

If I understand you correctly, you should add 3 sliders one for R,G and B and one for your 'constant' addition. Then create an expression in R,G and B that basically says 'Value R=slider R + slider constant' now the resulting value is that of the two sliders.

If you want to make this look nice, you can wrap this up in a macro and hide the original sliders, so it will look (more or less) like a Regular BG tool and you should be good to go.
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

TCP786

  • Posts: 267
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 12:37 pm

Sander de Regt wrote:If I understand you correctly, you should add 3 sliders one for R,G and B and one for your 'constant' addition. Then create an expression in R,G and B that basically says 'Value R=slider R + slider constant' now the resulting value is that of the two sliders.
Am I understanding you correctly if I take this to mean that I should use a slider in my custom control for the R, G, and B values instead of using the original ones at all? Like when I was saying I want to be able to change them individually even after making the group offset adjustment? That does seem like a good way to go about it. I'm going to do some tests and get back to you.


Sander de Regt wrote:I envy you, I don't understand math at all.
For what it's worth, a lot of people think they're simply bad at math in general because the only teachers they ever had weren't good at teaching; and in the worst cases, had no other reasonable conclusion to make because the teacher did genuinely understand the material they were teaching. I'll avoid the temptation to rant about how many times I've seen math taught exceptionally poorly, but my main point is this: unless you actively don't want to learn the material, until you at least get to calculus, the reason it's prohibitively hard to learn is almost certainly because of the teacher, not you. So if you want to understand math better than you do, please don't let "I'm just bad at math" be the reason you don't try to learn more.
Offline

Sander de Regt

  • Posts: 2457
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 12:45 pm

I think this is basically what you were asking for.
Took 5 minutes to set up.
Cleaning it up to make it look nice is a different matter, but this seems to be the functionality you're after.


Code: Select all
{
   Tools = ordered() {
      Background1 = Background {
         CtrlWZoom = false,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Expression = "RedSlider+Offsetslider", },
            TopLeftGreen = Input { Expression = "GreenSlider+Offsetslider", },
            TopLeftBlue = Input { Expression = "BlueSlider+Offsetslider", },
         },
         ViewInfo = OperatorInfo { Pos = { 247, 32.8636 } },
         UserControls = ordered() {
            RedSlider = {
               LINKS_Name = "RedSlider",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Default = 0,
               INP_Integer = false,
               INP_MinScale = 0,
               INP_MaxScale = 1,
               ICS_ControlPage = "Color",
            },
            GreenSlider = {
               LINKS_Name = "GreenSlider",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               INP_MinScale = 0,
               INP_MaxScale = 1,
               ICS_ControlPage = "Color",
            },
            BlueSlider = {
               LINKS_Name = "BlueSlider",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               INP_MinScale = 0,
               INP_MaxScale = 1,
               ICS_ControlPage = "Color",
            },
            Offsetslider = {
               LINKS_Name = "Offsetslider",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               INP_MinScale = 0,
               INP_MaxScale = 1,
               ICS_ControlPage = "Color",
            }
         }
      }
   },
   ActiveTool = "Background1"
}
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

TCP786

  • Posts: 267
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 12:53 pm

I've played with expressions before, but I haven't used the custom tool yet. Where do I copy paste this so I can test it? Haha
Offline

Sander de Regt

  • Posts: 2457
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 12:56 pm

Just copy/paste it in the flow area (where the nodes are) and you'll get a nice Background Tool with additional sliders. No need for a custom tool in this case.
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

TCP786

  • Posts: 267
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 1:15 pm

How did you make that and where can I learn how to do that too?
Offline

TCP786

  • Posts: 267
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Custom tool to gang RGB values when changing colors

PostMon Dec 06, 2021 1:17 pm

Also how do I open the code from the fusion node?

EDIT: Sorry, should have at least checked the right click menu before asking.
Offline

TCP786

  • Posts: 267
  • Joined: Thu Sep 16, 2021 7:05 am
  • Real Name: Cody Predum

Re: Custom tool to gang RGB values when changing colors

PostTue Dec 07, 2021 1:59 am

Sander de Regt wrote:I think this is basically what you were asking for.
Pretty much. I want to play with it some more, but I can't find a recent version of the API. Do you know where I can find that info?
Offline

Sander de Regt

  • Posts: 2457
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Custom tool to gang RGB values when changing colors

PostTue Dec 07, 2021 1:38 pm

I'm not a developer, so maybe I don't understand you correctly. Do you want to write a native plugin for Fusion to do what you want to do? Because a lot of things can be done either with macros (effectively repackaging built-in tools) or with Fuses which are scripted plugins that can do more than macros, but they can be created without having to compile anything. For actual plugins you need access to the SDK which - currently - is only available on request, although there have been people (including me) that have asked BMD to open up the SDK to everyone.
Sander de Regt

ShadowMaker SdR
The Netherlands

Return to Fusion

Who is online

Users browsing this forum: No registered users and 6 guests