Page 1 of 1

A/B Switch Node

PostPosted: Mon Jun 01, 2015 1:42 pm
by simonj
I am sure there is already an easy way to do this but how about implementing a switch node into WD

For example:
I have two faders and a digital display showing the value of the selected fader position eg opacity readout

If I had an A/B switch node I could use a CS button to select which fader value was displayed in the digital display

AB Switch node.jpg

Re: A/B Switch Node

PostPosted: Mon Jun 01, 2015 3:29 pm
by florian
the "if" node lets you swap between two input values given a third.

if you want to use a float value of 0-1 to "mix" between two input values, you need to build a linear interpolation function out of math nodes:
([mix factor]*[variable A]) - (1-[mix factor])*[variable B])
where [mix factor] is a value between 0 and 1.

this works well, but looks convoluted. i have asked for a single node to do this in the past, but it would probably also just work if you could route external values into the "range" node's "output range" fields.

Re: A/B Switch Node

PostPosted: Tue Jun 02, 2015 12:17 pm
by simonj
Thanks Florian - I will give that a go :0)
I thought that a simplified "switch" node would make life a bit easier. Maybe coolux will add it to the wish list?

Cheers
Simon

Re: A/B Switch Node

PostPosted: Tue Jun 02, 2015 12:22 pm
by simonj
Actually while we are on the subject of faders and opacity readouts is there currently an easy way to add some sort of number pad within WD so the user can type in a specific opacity value and the fader will react accordingly?

Re: A/B Switch Node

PostPosted: Tue Jun 02, 2015 3:09 pm
by florian
The "If" node behaves exactly like your switch from what I can tell. If you hover over it with your mouse and press F2, you can change the text to say "switch" instead of "if".

you could set up a text input to type values into. i think that might be handier than a keypad you operate with a mouse.

Re: A/B Switch Node

PostPosted: Wed Jun 03, 2015 3:04 pm
by simonj
I guess the problem I am having with the "if" node is that:

1. We have two possible input parameters available in the node. A & B
A=Fader output#1 B=Fader output#2

2. I almost need a third parameter within the "if" node to connect my CS A/B button to, which operates as follows:

CS Button On Click>Then>True output fader 1 value and False output fader value 2
CS Button On Release Script>Then>True output fader value 2 and False output fader value 1

I have tried using commands directly in the CS button
CS Button On Click
WDNodeEnableOutput,2
WDNodeDisableOutput,1


CS Button On Release Script
WDNodeEnableOutput,1
WDNodeDisableOutput,2


But the Digital Display node only allows one source value and does not dynamically switch

Please see screen grab below for this next bit.....Another alternative (which would be nice) would be to have an "if" node that offers

If
A 9 Value
Equals
B Output State of CS button 1(which would be either 1 or 0) as opposed to Value
Then
True 2 Value
Else
False 3 Value

Thanks for all your help with this mate :D
node state.jpg

Re: A/B Switch Node

PostPosted: Wed Jun 03, 2015 5:21 pm
by florian
Hi,

Sorry, I wasn't clear on whether you got it working right or not.

I've attached a project file that demonstrates using the IF node to do what I think it was you wanted it to do.

Re: A/B Switch Node

PostPosted: Wed Jun 03, 2015 5:46 pm
by florian
and... because I'm easily amused, attached is another project that uses the Delta node to determine which fader is moving and automatically switch to displaying it's value.

Re: A/B Switch Node

PostPosted: Thu Jun 04, 2015 10:30 am
by simonj
You ROCK!

The funny thing is that your Switch project is absolutely identical to the one that I built but couldn't get mine to work properly. Turns out that I had some sneaky node connect/disconnect commands lurking in the c/s button that was causing the problem. Sometimes you can't see the woods for the trees!

The Autoswitch is great, I will run a post mortem on it later today to figure out how you did it.

Many thanks good Sir

Cheers
Simon