View Full Version : How do you "clamp" in an XSI expression?

11-10-2006, 10:15 PM
Maya expressions have a clamp function that limits the minimum and maximum output ---
clamp (min, max, <expression>). I can't seem to find the XSI equivalent. I'm trying to make joystick sliders to control blendshapes in case you're wondering.

Thanks for the help

11-10-2006, 10:32 PM
You can use two nested conditions, e.g.:

cond (this.parameter > Max, Max, cond (this.parameter < Min, Min, this.parameter))

11-13-2006, 02:19 PM
Cool, thanks. That works - although it sure makes for some LONG messy expressions. I'll have to fire that off as a feature request.

11-14-2006, 08:51 AM
You could also limit the movement of the slider itself - if you parent an object beneath a square which is set to 2 units, and set pos limits to 1,-1 in x and y axis and 0,0 in z axis it should be limited to moving within the confines of the square, and cannot return a value higher than 1.

A clamp expression would be nice though :)

11-14-2006, 04:14 PM
Indeed my friend, but if you have multiple sliders affecting the same thing you need to clamp the sum of their output.

BTW... thanks to the man who wrote the KP Sliders tool. That thing saved me a lot of time.

CGTalk Moderation
11-14-2006, 04:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.