hou.Ramp class

Represents a ramp, such as would be returned from a ramp parameter.

See also: spline

Methods

__init__(self, basis, keys, values)float

The basis should be a sequence of hou.rampBasis values, one for each key.

The keys should be a sequence of floats, one for each key. The keys represent the location of the values for the given key. Each key should be between 0 and 1.

The values should either be a sequence of floats, or a sequence of tuples of floats. That is, either scalar or vector values. If you give vector values, the values are padded with the last index of the tuple.

>>> lin = hou.rampBasis.Linear
>>> hou.Ramp( (lin, lin), (0, 1), (0, 1) )
<hou.Ramp is_color=False num_keys=2 keys=((t=0, 0), (t=1, 1))>
>>> hou.Ramp( (lin, lin), (0, 1), ( (0,0,0), (1,1,1) ) )
<hou.Ramp is_color=True num_keys=2 keys=((t=0, rgb=(0, 0, 0)), (t=1, rgb=(1, 1, 1)))>
colorType(self)colorType

In the case of a color ramp, this returns the color space that is used during interpolation. The default is hou.colorType.RGB.

isColor(self)bool

Returns whether this is a color ramp.

lookup(self, interpolant)float or tuple

Gets the value of the ramp at a certain point.

Evaluates the ramp at the interpolant and returns the float (for floating-point value ramps) or tuple (for color ramps) representing the ramp value at that point.

setColorType(self, hou.colorType)

In the case of a color ramp, this sets the color space that is used during interpolation. The default is hou.colorType.RGB. To obtain a more perceptually uniform interpolation, use hou.colorType.LAB. To obtain a ramp that matches the rainbow, use hou.colorType.HSV.

setIsColor(self, bool)

Sets whether this is a color ramp.