Last active
August 29, 2015 14:15
-
-
Save K240-zz/1d32bbe18f57af5f8bc9 to your computer and use it in GitHub Desktop.
How to access Ramp by python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node_name = '/obj/geo1/null1' | |
| ramp_name = 'color' | |
| n = hou.node(node_name) | |
| ramp = n.parm(ramp_name).evalAsRamp() | |
| for i in range(len(ramp.keys())): | |
| # Position | |
| # get | |
| pos = n.parm('%s%dpos' % (ramp_name, i+1)).eval() | |
| # set | |
| n.parm('%s%dpos' % (ramp_name, i+1)).set(pos * 0.5) | |
| # Color | |
| # get | |
| r = n.parm('%s%dcr' % (ramp_name, i+1)).eval() | |
| g = n.parm('%s%dcg' % (ramp_name, i+1)).eval() | |
| b = n.parm('%s%dcb' % (ramp_name, i+1)).eval() | |
| # set | |
| n.parm('%s%dcr' % (ramp_name, i+1)).set(pos) | |
| n.parm('%s%dcg' % (ramp_name, i+1)).set(pos) | |
| n.parm('%s%dcb' % (ramp_name, i+1)).set(pos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment