Is there any way to dynamically set a ramp parm with Python

   427   2   1
User Avatar
Member
539 posts
Joined: 12月 2005
Offline
The ch reference to a ramp works suprisingly well. However, since I need to control a ramp with raw data, in this case a dictionary attribute stored on a point, I'd like to instead control this ramp with a python expression. This is pretty straitforward with other parm types, I realize a ramp has its difficulties being a nested parm of sorts.

I would hope this would work, but, it doesn't ...

rampEval = hou.parm(pathToParm).evalAsRamp()
return rampEval
User Avatar
Member
153 posts
Joined: 8月 2017
Offline
Aloha
Can you post File

Attachments:
Dict.hipnc (96.4 KB)

Conservation of Momentum
User Avatar
Member
539 posts
Joined: 12月 2005
Offline
I'm not able to post the file, but, the task is fairly simple. This file works great computing the end result, I'm aware of how to use chramp, hou.Ramp.lookup() etc. The issue is to actually reference on to a ramp parameter.

Here's a scenario with a python expression on a float parm.
value = 3.33
return value

Here's a hypothetical value with a python expression on a ramp parm.
ramp = hou.parm(pathToADifferentRamp).eval()
return ramp

If I were to channel reference pathToADifferentRamp to the ramp I'd like to control, it would indeed work. However, a Python return of a ramp object won't. Any solution or hack for this?
  • Quick Links