it's not tcl, it's Nuke's expression parser, and yes, it does have a max function so what you suggested is probably the easiest.

On 10/8/12 3:55 AM, Steve Booth wrote:
I forget. Does TCL have a 'max function? If so, it's just:

    Max(0, 1 - ControlPanel.Contrat-Factor)

Steve


Sent from my iPad

On Oct 6, 2012, at 11:48 PM, Jesse Kretschmer <[email protected] <mailto:[email protected]>> wrote:

This question does not seem suited for the nuke-dev list, but that's no reason to ignore it.

Expressions support a couple things that could help. You could use the absolute value:
abs(1+ControlPanel.Contrast-Factor)

or, you may want to add some logic with a ternary operation (shortand if?then:else statement):
1+ControlPanel.Contrast-Factor<0?0:1+ControlPanel.Contrast-Factor

There are probably a ton of other ways to solve this problem, but it all depends on the context.

cheers,
jesse

On Sat, Oct 6, 2012 at 7:46 PM, Synicade <[email protected] <mailto:[email protected]>> wrote:

    I have some saturation values controlled by an expression,
    however when they go too far they go into the negatives.
    Is there an expression to stop values from going into the negatives?

    Here is the current expression, it might be confusing out of
    context but it basically means Add 1 to the value given by the
    contrast and subtract by the factor

    *Code:*
    1+ControlPanel.Contrast-Factor



    Again, values often go into the negatives which looks awful, how
    do I prevent this?

    _______________________________________________
    Nuke-dev mailing list
    [email protected]
    <mailto:[email protected]>,
    http://forums.thefoundry.co.uk/
    http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev


_______________________________________________
Nuke-dev mailing list
[email protected] <mailto:[email protected]>, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev


_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to