Visualize ramp param via HDA node description

   595   0   1
User Avatar
Member
80 posts
Joined: 2月 2020
Offline
Sometimes it's nice to have a visual of a curve parameter without needing to pull up the parameter window for a node. This code samples a ramp at 10 locations then gets a Unicode character to create a rough approximation of the curve viewable within the network view.

def lookup_ramp_pos():
    node = hou.pwd()
    ramp = node.parm("out_ramp").eval()
    samples = 10
    chars = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
    out_chars=[]
    for item in range(samples):
        val = ramp.lookup(item/samples)
        char_ind = round(val)*len(chars)
        char = chars[round(val*len(chars))]
        out_chars.append(char)
        
    return ''.join(out_chars)
Edited by wyhinton1 - 2024年8月22日 04:02:11

Attachments:
curve_to_text.gif (224.6 KB)

  • Quick Links