In the color ramp, there are a couple of presets e.g.
- Black Body
- Grayscale
- Infra-Red
- Two-Tone
- White to Red
I am looking for ways to add more presets programmatically.
multiParmInstances, because that's what ramps are comprised of.# (...) # Note: "selection" is an array of SOPs. for op in selection: ramp = op.parm('ramp') if ramp is None: _ = "Parameter 'ramp' doesn't exist" hou.ui.displayMessage(_, severity=hou.severityType.Error) return # Clear the ramp multi = ramp.multiParmInstances() for _ in range(int(len(multi) / 5) -1, 0, -1): ramp.removeMultiParmInstance(0) # Create ramp points pos = 0 hue = 0 sat = 0.75 val = 0.75 for _ in range(0, 360): if not _ == 0: ramp.insertMultiParmInstance(_) # Point position mp_pos = '%s%dpos' % ('ramp', _ + 1) op.parm(mp_pos).set(pos) # Point color color = hou.Color() color.setHSV((hue, sat, val)) color_pt = op.parmTuple('%s%dc' % ('ramp', _ + 1)) color_pt.set(color.rgb()) # Point interpolation op.parm('%s%dinterp' % ('ramp', _ + 1)).set(0) pos += 1.0 / 360 hue += 1 op.parm('%s%dpos' % ('ramp', len(ramp.multiParmInstances()) / 5))