CLAMP and clampScalar

What is the difference between CLAMP and clampScalar global functions. Neither are documented.

Also, what data types can they clamp?

I don’t know what CLAMP is. You’ll find the code for clampScalar in direct/src/showbase/PythonUtil.py, which is pretty self-explanatory:

def clampScalar(value, a, b):
    # calling this ought to be faster than calling both min and max
    if a < b:
        if value < a:
            return a
        elif value > b:
            return b
        else:
            return value
    else:
        if value < b:
            return b
        elif value > a:
            return a
        else:
            return value

Many Python functions are this straightforward and easy-to-read. If there’s any doubt as to where a particular function is defined, you can print clampScalar.module .

David